Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
3322e73d
Commit
3322e73d
authored
Nov 14, 2005
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Time format added
parent
ad1871e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
10 deletions
+47
-10
xtt/lib/glow/src/glow_growaxis.cpp
xtt/lib/glow/src/glow_growaxis.cpp
+38
-9
xtt/lib/glow/src/glow_growaxis.h
xtt/lib/glow/src/glow_growaxis.h
+9
-1
No files found.
xtt/lib/glow/src/glow_growaxis.cpp
View file @
3322e73d
/*
/*
* Proview $Id: glow_growaxis.cpp,v 1.
6 2005-11-04 11:53:46
claes Exp $
* Proview $Id: glow_growaxis.cpp,v 1.
7 2005-11-14 16:28:12
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Copyright (C) 2005 SSAB Oxelsund AB.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -298,7 +298,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
...
@@ -298,7 +298,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
if
(
draw_text
)
{
if
(
draw_text
)
{
for
(
i
=
0
;
i
<
lines
;
i
++
)
{
for
(
i
=
0
;
i
<
lines
;
i
++
)
{
if
(
i
%
valuequotient
==
0
)
{
if
(
i
%
valuequotient
==
0
)
{
sprintf
(
text
,
format
,
max_value
-
i
*
increment
);
format_text
(
text
,
format
,
max_value
-
i
*
increment
);
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
max
(
0
,
text_idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
max
(
0
,
text_idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
if
(
max_z_width
<
z_width
)
if
(
max_z_width
<
z_width
)
...
@@ -324,7 +324,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
...
@@ -324,7 +324,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
glow_draw_line
(
ctx
,
ur_x
-
int
(
2.0
/
3
*
line_length
),
y
,
glow_draw_line
(
ctx
,
ur_x
-
int
(
2.0
/
3
*
line_length
),
y
,
ur_x
,
y
,
drawtype
,
idx
,
0
);
ur_x
,
y
,
drawtype
,
idx
,
0
);
if
(
draw_text
)
{
if
(
draw_text
)
{
sprintf
(
text
,
format
,
max_value
-
i
*
increment
);
format_text
(
text
,
format
,
max_value
-
i
*
increment
);
if
(
text_idx
>=
0
&&
max_z_width
<
ur_x
-
ll_x
&&
if
(
text_idx
>=
0
&&
max_z_width
<
ur_x
-
ll_x
&&
i
%
valuequotient
==
0
)
{
i
%
valuequotient
==
0
)
{
...
@@ -369,7 +369,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
...
@@ -369,7 +369,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
ur_y
,
drawtype
,
idx
,
0
);
ur_y
,
drawtype
,
idx
,
0
);
if
(
draw_text
&&
i
%
valuequotient
==
0
)
{
if
(
draw_text
&&
i
%
valuequotient
==
0
)
{
sprintf
(
text
,
format
,
max_value
-
i
*
increment
);
format_text
(
text
,
format
,
max_value
-
i
*
increment
);
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
max
(
0
,
text_idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
max
(
0
,
text_idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
...
@@ -396,7 +396,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
...
@@ -396,7 +396,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
if
(
draw_text
)
{
if
(
draw_text
)
{
for
(
i
=
0
;
i
<
lines
;
i
++
)
{
for
(
i
=
0
;
i
<
lines
;
i
++
)
{
if
(
i
%
valuequotient
==
0
)
{
if
(
i
%
valuequotient
==
0
)
{
sprintf
(
text
,
format
,
max_value
-
i
*
increment
);
format_text
(
text
,
format
,
max_value
-
i
*
increment
);
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
max
(
0
,
text_idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
max
(
0
,
text_idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
if
(
max_z_width
<
z_width
)
if
(
max_z_width
<
z_width
)
...
@@ -421,7 +421,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
...
@@ -421,7 +421,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
else
else
glow_draw_line
(
ctx
,
ll_x
,
y
,
glow_draw_line
(
ctx
,
ll_x
,
y
,
ll_x
+
int
(
2.0
/
3
*
line_length
),
y
,
drawtype
,
idx
,
0
);
ll_x
+
int
(
2.0
/
3
*
line_length
),
y
,
drawtype
,
idx
,
0
);
sprintf
(
text
,
format
,
max_value
-
i
*
increment
);
format_text
(
text
,
format
,
max_value
-
i
*
increment
);
if
(
draw_text
&&
if
(
draw_text
&&
text_idx
>=
0
&&
max_z_width
<
ur_x
-
ll_x
&&
text_idx
>=
0
&&
max_z_width
<
ur_x
-
ll_x
&&
...
@@ -465,7 +465,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
...
@@ -465,7 +465,7 @@ void GrowAxis::draw( GlowTransform *t, int highlight, int hot, void *node,
glow_draw_line
(
ctx
,
x
,
ll_y
,
x
,
glow_draw_line
(
ctx
,
x
,
ll_y
,
x
,
ll_y
+
int
(
2.0
/
3
*
line_length
),
drawtype
,
idx
,
0
);
ll_y
+
int
(
2.0
/
3
*
line_length
),
drawtype
,
idx
,
0
);
if
(
draw_text
&&
i
%
valuequotient
==
0
)
{
if
(
draw_text
&&
i
%
valuequotient
==
0
)
{
sprintf
(
text
,
format
,
max_value
-
i
*
increment
);
format_text
(
text
,
format
,
max_value
-
i
*
increment
);
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
max
(
0
,
text_idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
max
(
0
,
text_idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
...
@@ -910,7 +910,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node,
...
@@ -910,7 +910,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node,
if
(
draw_text
)
{
if
(
draw_text
)
{
for
(
i
=
0
;
i
<
lines
;
i
++
)
{
for
(
i
=
0
;
i
<
lines
;
i
++
)
{
if
(
i
%
valuequotient
==
0
)
{
if
(
i
%
valuequotient
==
0
)
{
sprintf
(
text
,
format
,
max_value
-
i
*
increment
);
format_text
(
text
,
format
,
max_value
-
i
*
increment
);
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
max
(
0
,
idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
max
(
0
,
idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
if
(
max_z_width
<
z_width
)
if
(
max_z_width
<
z_width
)
...
@@ -938,7 +938,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node,
...
@@ -938,7 +938,7 @@ void GrowAxis::export_javabean( GlowTransform *t, void *node,
if
(
draw_text
)
{
if
(
draw_text
)
{
for
(
i
=
0
;
i
<
lines
;
i
++
)
{
for
(
i
=
0
;
i
<
lines
;
i
++
)
{
if
(
i
%
valuequotient
==
0
)
{
if
(
i
%
valuequotient
==
0
)
{
sprintf
(
text
,
format
,
max_value
-
i
*
increment
);
format_text
(
text
,
format
,
max_value
-
i
*
increment
);
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
draw_get_text_extent
(
ctx
,
text
,
strlen
(
text
),
text_drawtype
,
max
(
0
,
idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
max
(
0
,
idx
),
&
z_width
,
&
z_height
,
&
z_descent
);
if
(
max_z_width
<
z_width
)
if
(
max_z_width
<
z_width
)
...
@@ -998,6 +998,35 @@ void GrowAxis::set_axis_info( glow_sAxisInfo *info)
...
@@ -998,6 +998,35 @@ void GrowAxis::set_axis_info( glow_sAxisInfo *info)
strcpy
(
format
,
info
->
format
);
strcpy
(
format
,
info
->
format
);
}
}
void
GrowAxis
::
format_text
(
char
*
text
,
char
*
fmt
,
double
value
)
{
if
(
strcmp
(
fmt
,
"%1t"
)
==
0
)
{
// Hours, minutes and seconds, value in seconds
int
val
=
(
int
)
nearbyint
(
value
);
int
hours
=
val
/
3600
;
int
minutes
=
(
val
-
hours
*
3600
)
/
60
;
int
seconds
=
(
val
-
hours
*
3600
-
minutes
*
60
);
sprintf
(
text
,
"%d:%02d:%02d"
,
hours
,
minutes
,
seconds
);
}
else
if
(
strcmp
(
fmt
,
"%2t"
)
==
0
)
{
// Hours and minutes, value in seconds
int
val
=
(
int
)
nearbyint
(
value
);
int
hours
=
val
/
3600
;
int
minutes
=
(
val
-
hours
*
3600
)
/
60
;
sprintf
(
text
,
"%d:%02d"
,
hours
,
minutes
);
}
else
if
(
strcmp
(
fmt
,
"%3t"
)
==
0
)
{
// Days, hours and minues, value in seconds
int
val
=
(
int
)
nearbyint
(
value
);
int
days
=
val
/
(
24
*
3600
);
int
hours
=
(
val
-
days
*
24
*
3600
)
/
3600
;
int
minutes
=
(
val
-
days
*
24
*
3600
-
hours
*
3600
)
/
60
;
sprintf
(
text
,
"%d %02d:%02d"
,
days
,
hours
,
minutes
);
}
else
sprintf
(
text
,
fmt
,
value
);
}
void
GrowAxis
::
convert
(
glow_eConvert
version
)
void
GrowAxis
::
convert
(
glow_eConvert
version
)
{
{
switch
(
version
)
{
switch
(
version
)
{
...
...
xtt/lib/glow/src/glow_growaxis.h
View file @
3322e73d
/*
/*
* Proview $Id: glow_growaxis.h,v 1.
3 2005-09-01 14:57:53
claes Exp $
* Proview $Id: glow_growaxis.h,v 1.
4 2005-11-14 16:28:12
claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
* Copyright (C) 2005 SSAB Oxelösund AB.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -242,6 +242,14 @@ class GrowAxis : public GrowRect {
...
@@ -242,6 +242,14 @@ class GrowAxis : public GrowRect {
*/
*/
void
set_original_text_color
(
glow_eDrawType
drawtype
)
void
set_original_text_color
(
glow_eDrawType
drawtype
)
{
text_color_drawtype
=
drawtype
;
draw
();};
{
text_color_drawtype
=
drawtype
;
draw
();};
//! Format axis text.
/*!
\param text Formated text.
\param fmt Format specification, c syntax or %1t(h:m:s), %2t (d h:m) for time formats.
\param value Value to format.
*/
void
format_text
(
char
*
text
,
char
*
fmt
,
double
value
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment