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
796de9df
Commit
796de9df
authored
Aug 12, 2014
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ge dynamic DigTextColor added
parent
a564504b
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
419 additions
and
55 deletions
+419
-55
java/jpwr/jopg/src/Dyn.java
java/jpwr/jopg/src/Dyn.java
+188
-42
java/jpwr/jopg/src/GrowNode.java
java/jpwr/jopg/src/GrowNode.java
+10
-0
xtt/lib/ge/src/ge_attrnav.cpp
xtt/lib/ge/src/ge_attrnav.cpp
+13
-12
xtt/lib/ge/src/ge_dyn.cpp
xtt/lib/ge/src/ge_dyn.cpp
+167
-0
xtt/lib/ge/src/ge_dyn.h
xtt/lib/ge/src/ge_dyn.h
+41
-1
No files found.
java/jpwr/jopg/src/Dyn.java
View file @
796de9df
This diff is collapsed.
Click to expand it.
java/jpwr/jopg/src/GrowNode.java
View file @
796de9df
...
...
@@ -611,6 +611,16 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
public
void
resetBorderColor
()
{
draw_type
=
original_border_drawtype
;
}
public
void
setTextColor
(
int
draw_type
)
{
text_drawtype
=
draw_type
;
color_tone
=
Glow
.
eDrawTone_No
;
color_shift
=
0
;
color_lightness
=
0
;
color_intensity
=
0
;
}
public
void
resetTextColor
()
{
text_drawtype
=
original_text_drawtype
;
}
public
void
setColorInverse
(
int
color_inverse
)
{
this
.
color_inverse
=
color_inverse
;
}
...
...
xtt/lib/ge/src/ge_attrnav.cpp
View file @
796de9df
...
...
@@ -78,10 +78,10 @@
static
attrnav_sEnumElement
elem_dyn_type1
[]
=
{
{
(
int
)
ge_mDynType1_Inherit
,
"Inherit"
},
{
(
int
)
ge_mDynType1_Tone
,
"Tone"
},
{
(
int
)
ge_mDynType1_DigLowColor
,
"DigLowColor"
},
{
(
int
)
ge_mDynType1_DigLowColor
,
"DigLowColor"
},
{
(
int
)
ge_mDynType1_DigColor
,
"DigColor"
},
{
(
int
)
ge_mDynType1_AnalogColor
,
"AnalogColor"
},
{
(
int
)
ge_mDynType1_StatusColor
,
"StatusColor"
},
{
(
int
)
ge_mDynType1_AnalogColor
,
"AnalogColor"
},
{
(
int
)
ge_mDynType1_StatusColor
,
"StatusColor"
},
{
(
int
)
ge_mDynType1_DigWarning
,
"DigWarning"
},
{
(
int
)
ge_mDynType1_DigError
,
"DigError"
},
{
(
int
)
ge_mDynType1_DigFlash
,
"DigFlash"
},
...
...
@@ -93,14 +93,14 @@ static attrnav_sEnumElement elem_dyn_type1[] = {
{
(
int
)
ge_mDynType1_Value
,
"Value"
},
{
(
int
)
ge_mDynType1_Rotate
,
"Rotate"
},
{
(
int
)
ge_mDynType1_Move
,
"Move"
},
{
(
int
)
ge_mDynType1_AnalogShift
,
"AnalogShift"
},
{
(
int
)
ge_mDynType1_AnalogShift
,
"AnalogShift"
},
{
(
int
)
ge_mDynType1_DigShift
,
"DigShift"
},
{
(
int
)
ge_mDynType1_Animation
,
"Animation"
},
{
(
int
)
ge_mDynType1_Bar
,
"Bar"
},
{
(
int
)
ge_mDynType1_Bar
,
"Bar"
},
{
(
int
)
ge_mDynType1_Trend
,
"Trend"
},
{
(
int
)
ge_mDynType1_FastCurve
,
"FastCurve"
},
{
(
int
)
ge_mDynType1_XY_Curve
,
"XY_Curve"
},
{
(
int
)
ge_mDynType1_SliderBackground
,
"SliderBackground"
},
{
(
int
)
ge_mDynType1_SliderBackground
,
"SliderBackground"
},
{
(
int
)
ge_mDynType1_Video
,
"Video"
},
{
(
int
)
ge_mDynType1_Table
,
"Table"
},
{
(
int
)
ge_mDynType1_HostObject
,
"HostObject"
},
...
...
@@ -109,15 +109,16 @@ static attrnav_sEnumElement elem_dyn_type1[] = {
{
0
,
""
}};
static
attrnav_sEnumElement
elem_dyn_type2
[]
=
{
{
(
int
)
ge_mDynType2_DigTextColor
,
"DigTextColor"
},
{
0
,
""
}};
static
attrnav_sEnumElement
elem_dyn_type1_tone
[]
=
{
{
(
int
)
ge_mDynType1_Inherit
,
"Inherit"
},
{
(
int
)
ge_mDynType1_Tone
,
"Tone"
},
{
(
int
)
ge_mDynType1_DigLowColor
,
"DigLowTone"
},
{
(
int
)
ge_mDynType1_DigLowColor
,
"DigLowTone"
},
{
(
int
)
ge_mDynType1_DigColor
,
"DigTone"
},
{
(
int
)
ge_mDynType1_AnalogColor
,
"AnalogTone"
},
{
(
int
)
ge_mDynType1_StatusColor
,
"StatusTone"
},
{
(
int
)
ge_mDynType1_AnalogColor
,
"AnalogTone"
},
{
(
int
)
ge_mDynType1_StatusColor
,
"StatusTone"
},
{
(
int
)
ge_mDynType1_DigWarning
,
"DigToneWarning"
},
{
(
int
)
ge_mDynType1_DigError
,
"DigToneError"
},
{
(
int
)
ge_mDynType1_DigFlash
,
"DigFlash"
},
...
...
@@ -129,14 +130,14 @@ static attrnav_sEnumElement elem_dyn_type1_tone[] = {
{
(
int
)
ge_mDynType1_Value
,
"Value"
},
{
(
int
)
ge_mDynType1_Rotate
,
"Rotate"
},
{
(
int
)
ge_mDynType1_Move
,
"Move"
},
{
(
int
)
ge_mDynType1_AnalogShift
,
"AnalogShift"
},
{
(
int
)
ge_mDynType1_AnalogShift
,
"AnalogShift"
},
{
(
int
)
ge_mDynType1_DigShift
,
"DigShift"
},
{
(
int
)
ge_mDynType1_Animation
,
"Animation"
},
{
(
int
)
ge_mDynType1_Bar
,
"Bar"
},
{
(
int
)
ge_mDynType1_Bar
,
"Bar"
},
{
(
int
)
ge_mDynType1_Trend
,
"Trend"
},
{
(
int
)
ge_mDynType1_FastCurve
,
"FastCurve"
},
{
(
int
)
ge_mDynType1_XY_Curve
,
"XY_Curve"
},
{
(
int
)
ge_mDynType1_SliderBackground
,
"SliderBackground"
},
{
(
int
)
ge_mDynType1_SliderBackground
,
"SliderBackground"
},
{
(
int
)
ge_mDynType1_Video
,
"Video"
},
{
(
int
)
ge_mDynType1_Table
,
"Table"
},
{
(
int
)
ge_mDynType1_HostObject
,
"HostObject"
},
...
...
xtt/lib/ge/src/ge_dyn.cpp
View file @
796de9df
...
...
@@ -452,6 +452,8 @@ GeDyn::GeDyn( const GeDyn& x) :
switch
(
elem
->
dyn_type2
)
{
case
ge_mDynType2_Axis
:
e
=
new
GeAxis
((
const
GeAxis
&
)
*
elem
);
break
;
case
ge_mDynType2_DigTextColor
:
e
=
new
GeDigTextColor
((
const
GeDigTextColor
&
)
*
elem
);
break
;
default:
;
}
switch
(
elem
->
action_type1
)
{
...
...
@@ -590,6 +592,7 @@ void GeDyn::open( ifstream& fp)
case
ge_eSave_Pie
:
e
=
(
GeDynElem
*
)
new
GePie
(
this
);
break
;
case
ge_eSave_BarChart
:
e
=
(
GeDynElem
*
)
new
GeBarChart
(
this
);
break
;
case
ge_eSave_Axis
:
e
=
(
GeDynElem
*
)
new
GeAxis
(
this
);
break
;
case
ge_eSave_DigTextColor
:
e
=
(
GeDynElem
*
)
new
GeDigTextColor
(
this
);
break
;
case
ge_eSave_HostObject
:
e
=
(
GeDynElem
*
)
new
GeHostObject
(
this
);
break
;
case
ge_eSave_DigSound
:
e
=
(
GeDynElem
*
)
new
GeDigSound
(
this
);
break
;
case
ge_eSave_XY_Curve
:
e
=
(
GeDynElem
*
)
new
GeXY_Curve
(
this
);
break
;
...
...
@@ -794,6 +797,12 @@ void GeDyn::get_attributes( grow_tObject object, attr_sItem *itemlist, int *item
attrinfo
[
i
].
mask
=
ge_mDynType1_Invisible
;
attrinfo
[
i
++
].
size
=
sizeof
(
dyn_type1
);
}
strcpy
(
attrinfo
[
i
].
name
,
"DynType2"
);
attrinfo
[
i
].
value
=
&
dyn_type2
;
attrinfo
[
i
].
type
=
ge_eAttrType_DynType2
;
attrinfo
[
i
++
].
size
=
sizeof
(
dyn_type2
);
strcpy
(
attrinfo
[
i
].
name
,
"Action"
);
attrinfo
[
i
].
value
=
&
action_type1
;
attrinfo
[
i
].
type
=
ge_eAttrType_ActionType1
;
...
...
@@ -1500,6 +1509,9 @@ GeDynElem *GeDyn::create_dyn2_element( int mask, int instance)
case
ge_mDynType2_Axis
:
e
=
(
GeDynElem
*
)
new
GeAxis
(
this
);
break
;
case
ge_mDynType2_DigTextColor
:
e
=
(
GeDynElem
*
)
new
GeDigTextColor
(
this
);
break
;
default:
;
}
return
e
;
...
...
@@ -1679,6 +1691,9 @@ GeDynElem *GeDyn::copy_element( GeDynElem& x)
case
ge_mDynType2_Axis
:
e
=
(
GeDynElem
*
)
new
GeAxis
((
GeAxis
&
)
x
);
break
;
case
ge_mDynType2_DigTextColor
:
e
=
(
GeDynElem
*
)
new
GeDigTextColor
((
GeDigTextColor
&
)
x
);
break
;
default:
;
}
}
...
...
@@ -3264,6 +3279,158 @@ int GeInvisible::export_java( grow_tObject object, ofstream& fp, bool first, cha
return
1
;
}
void
GeDigTextColor
::
get_attributes
(
attr_sItem
*
attrinfo
,
int
*
item_count
)
{
int
i
=
*
item_count
;
strcpy
(
attrinfo
[
i
].
name
,
"DigTextColor.Attribute"
);
attrinfo
[
i
].
value
=
attribute
;
attrinfo
[
i
].
type
=
glow_eType_String
;
attrinfo
[
i
++
].
size
=
sizeof
(
attribute
);
strcpy
(
attrinfo
[
i
].
name
,
"DigTextColor.Color"
);
attrinfo
[
i
].
value
=
&
color
;
attrinfo
[
i
].
type
=
glow_eType_Color
;
attrinfo
[
i
++
].
size
=
sizeof
(
color
);
*
item_count
=
i
;
}
void
GeDigTextColor
::
set_attribute
(
grow_tObject
object
,
const
char
*
attr_name
,
int
*
cnt
)
{
(
*
cnt
)
--
;
if
(
*
cnt
==
0
)
{
char
msg
[
200
];
strncpy
(
attribute
,
attr_name
,
sizeof
(
attribute
));
snprintf
(
msg
,
sizeof
(
msg
),
"DigTextColor.Attribute = %s"
,
attr_name
);
msg
[
sizeof
(
msg
)
-
1
]
=
0
;
dyn
->
graph
->
message
(
'I'
,
msg
);
}
}
void
GeDigTextColor
::
replace_attribute
(
char
*
from
,
char
*
to
,
int
*
cnt
,
int
strict
)
{
GeDyn
::
replace_attribute
(
attribute
,
sizeof
(
attribute
),
from
,
to
,
cnt
,
strict
);
}
void
GeDigTextColor
::
save
(
ofstream
&
fp
)
{
fp
<<
int
(
ge_eSave_DigTextColor
)
<<
endl
;
fp
<<
int
(
ge_eSave_DigTextColor_attribute
)
<<
FSPACE
<<
attribute
<<
endl
;
fp
<<
int
(
ge_eSave_DigTextColor_color
)
<<
FSPACE
<<
int
(
color
)
<<
endl
;
fp
<<
int
(
ge_eSave_End
)
<<
endl
;
}
void
GeDigTextColor
::
open
(
ifstream
&
fp
)
{
int
type
;
int
end_found
=
0
;
int
tmp
;
char
dummy
[
40
];
for
(;;)
{
if
(
!
fp
.
good
())
{
fp
.
clear
();
fp
.
getline
(
dummy
,
sizeof
(
dummy
));
printf
(
"** Read error GeDigTextColor:
\"
%d %s
\"\n
"
,
type
,
dummy
);
}
fp
>>
type
;
switch
(
type
)
{
case
ge_eSave_DigTextColor
:
break
;
case
ge_eSave_DigTextColor_attribute
:
fp
.
get
();
fp
.
getline
(
attribute
,
sizeof
(
attribute
));
break
;
case
ge_eSave_DigTextColor_color
:
fp
>>
tmp
;
color
=
(
glow_eDrawType
)
tmp
;
break
;
case
ge_eSave_End
:
end_found
=
1
;
break
;
default:
cout
<<
"GeDigTextColor:open syntax error"
<<
endl
;
fp
.
getline
(
dummy
,
sizeof
(
dummy
));
}
if
(
end_found
)
break
;
}
}
int
GeDigTextColor
::
connect
(
grow_tObject
object
,
glow_sTraceData
*
trace_data
)
{
int
attr_type
,
attr_size
;
pwr_tAName
parsed_name
;
int
sts
;
color
=
dyn
->
get_color1
(
object
,
color
);
if
(
color
<
0
||
color
>=
glow_eDrawType__
)
{
printf
(
"** Color out of range, %s
\n
"
,
attribute
);
return
0
;
}
size
=
4
;
p
=
0
;
db
=
dyn
->
parse_attr_name
(
attribute
,
parsed_name
,
&
inverted
,
&
attr_type
,
&
attr_size
);
if
(
strcmp
(
parsed_name
,
""
)
==
0
)
return
1
;
get_bit
(
parsed_name
,
attr_type
,
&
bitmask
);
a_typeid
=
attr_type
;
sts
=
dyn
->
graph
->
ref_object_info
(
dyn
->
cycle
,
parsed_name
,
(
void
**
)
&
p
,
&
subid
,
size
);
if
(
EVEN
(
sts
))
return
sts
;
trace_data
->
p
=
&
pdummy
;
first_scan
=
true
;
return
1
;
}
int
GeDigTextColor
::
disconnect
(
grow_tObject
object
)
{
if
(
p
&&
db
==
graph_eDatabase_Gdh
)
gdh_UnrefObjectInfo
(
subid
);
p
=
0
;
return
1
;
}
int
GeDigTextColor
::
scan
(
grow_tObject
object
)
{
if
(
!
p
)
return
1
;
pwr_tBoolean
val
=
*
p
;
if
(
!
get_dig
(
&
val
,
p
,
a_typeid
,
bitmask
))
return
1
;
if
(
inverted
)
val
=
!
val
;
if
(
!
first_scan
)
{
if
(
old_value
==
val
)
{
// No change since last time
return
1
;
}
}
else
first_scan
=
false
;
if
(
val
)
{
grow_SetObjectTextColor
(
object
,
color
);
}
else
{
grow_ResetObjectTextColor
(
object
);
}
old_value
=
val
;
return
1
;
}
int
GeDigTextColor
::
export_java
(
grow_tObject
object
,
ofstream
&
fp
,
bool
first
,
char
*
var_name
)
{
return
1
;
}
void
GeDigBorder
::
get_attributes
(
attr_sItem
*
attrinfo
,
int
*
item_count
)
{
int
i
=
*
item_count
;
...
...
xtt/lib/ge/src/ge_dyn.h
View file @
796de9df
...
...
@@ -129,6 +129,7 @@
ge_eDynPrio_AnalogColor
,
ge_eDynPrio_DigColor
,
ge_eDynPrio_DigLowColor
,
ge_eDynPrio_DigTextColor
,
ge_eDynPrio_DigBorder
,
ge_eDynPrio_DigText
,
ge_eDynPrio_FillLevel
,
...
...
@@ -215,7 +216,8 @@
typedef
enum
{
ge_mDynType2_No
=
0
,
ge_mDynType2_Axis
=
1
<<
0
ge_mDynType2_Axis
=
1
<<
0
,
ge_mDynType2_DigTextColor
=
1
<<
1
}
ge_mDynType2
;
//! Action types.
...
...
@@ -322,6 +324,7 @@
ge_eSave_Pie
=
36
,
ge_eSave_BarChart
=
37
,
ge_eSave_Axis
=
38
,
ge_eSave_DigTextColor
=
39
,
ge_eSave_PopupMenu
=
50
,
ge_eSave_SetDig
=
51
,
ge_eSave_ResetDig
=
52
,
...
...
@@ -522,6 +525,8 @@
ge_eSave_BarChart_fix_range
=
3712
,
ge_eSave_Axis_minvalue_attr
=
3800
,
ge_eSave_Axis_maxvalue_attr
=
3801
,
ge_eSave_DigTextColor_attribute
=
3900
,
ge_eSave_DigTextColor_color
=
3901
,
ge_eSave_PopupMenu_ref_object
=
5000
,
ge_eSave_SetDig_attribute
=
5100
,
ge_eSave_SetDig_instance
=
5101
,
...
...
@@ -1211,6 +1216,41 @@ class GeDigBorder : public GeDynElem {
};
//! Set the supplied border color when the signal is high.
class
GeDigTextColor
:
public
GeDynElem
{
public:
pwr_tAName
attribute
;
//!< Database reference to digital attribute.
glow_eDrawType
color
;
//!< Text color to set when the signal is high.
pwr_tBoolean
*
p
;
pwr_tSubid
subid
;
int
size
;
graph_eDatabase
db
;
int
inverted
;
bool
first_scan
;
pwr_tBoolean
old_value
;
int
a_typeid
;
unsigned
int
bitmask
;
GeDigTextColor
(
GeDyn
*
e_dyn
)
:
GeDynElem
(
e_dyn
,
ge_mDynType1_No
,
ge_mDynType2_DigTextColor
,
ge_mActionType1_No
,
ge_mActionType2_No
,
ge_eDynPrio_DigTextColor
),
color
(
glow_eDrawType_Inherit
)
{
strcpy
(
attribute
,
""
);}
GeDigTextColor
(
const
GeDigTextColor
&
x
)
:
GeDynElem
(
x
.
dyn
,
x
.
dyn_type1
,
x
.
dyn_type2
,
x
.
action_type1
,
x
.
action_type2
,
x
.
prio
),
color
(
x
.
color
)
{
strcpy
(
attribute
,
x
.
attribute
);}
void
get_attributes
(
attr_sItem
*
attrinfo
,
int
*
item_count
);
void
save
(
ofstream
&
fp
);
void
open
(
ifstream
&
fp
);
int
connect
(
grow_tObject
object
,
glow_sTraceData
*
trace_data
);
int
disconnect
(
grow_tObject
object
);
int
scan
(
grow_tObject
object
);
void
set_attribute
(
grow_tObject
object
,
const
char
*
attr_name
,
int
*
cnt
);
void
replace_attribute
(
char
*
from
,
char
*
to
,
int
*
cnt
,
int
strict
);
int
export_java
(
grow_tObject
object
,
ofstream
&
fp
,
bool
first
,
char
*
var_name
);
};
//! Set supplied text when the signal is low.
class
GeDigText
:
public
GeDynElem
{
public:
...
...
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