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
256ae378
Commit
256ae378
authored
Feb 17, 2005
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enum and Mask displayed in xtt, and alarm blocking implemented
parent
9f068076
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
860 additions
and
61 deletions
+860
-61
xtt/lib/xtt/src/xtt_xnav.cpp
xtt/lib/xtt/src/xtt_xnav.cpp
+178
-8
xtt/lib/xtt/src/xtt_xnav.h
xtt/lib/xtt/src/xtt_xnav.h
+13
-1
xtt/lib/xtt/src/xtt_xnav_brow.cpp
xtt/lib/xtt/src/xtt_xnav_brow.cpp
+302
-32
xtt/lib/xtt/src/xtt_xnav_brow.h
xtt/lib/xtt/src/xtt_xnav_brow.h
+9
-0
xtt/lib/xtt/src/xtt_xnav_command.cpp
xtt/lib/xtt/src/xtt_xnav_command.cpp
+357
-20
xtt/lib/xtt/src/xtt_xnav_help.cpp
xtt/lib/xtt/src/xtt_xnav_help.cpp
+1
-0
No files found.
xtt/lib/xtt/src/xtt_xnav.cpp
View file @
256ae378
/* rt_xtt.cpp -- Display plant and node hier
era
chy
/* rt_xtt.cpp -- Display plant and node hier
ar
chy
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
...
...
@@ -388,7 +388,7 @@ int xnav_attr_string_to_value( int type_id, char *value_str,
//
// Convert attribute value to string
//
void
xnav_attrvalue_to_string
(
int
type_id
,
void
*
value_ptr
,
void
xnav_attrvalue_to_string
(
int
type_id
,
pwr_tTid
tid
,
void
*
value_ptr
,
char
*
str
,
int
size
,
int
*
len
,
char
*
format
)
{
char
hiername
[
120
];
...
...
@@ -479,7 +479,6 @@ void xnav_attrvalue_to_string( int type_id, void *value_ptr,
}
case
pwr_eType_UInt32
:
case
pwr_eType_Mask
:
case
pwr_eType_Enum
:
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%d"
,
*
(
unsigned
int
*
)
value_ptr
);
...
...
@@ -487,6 +486,34 @@ void xnav_attrvalue_to_string( int type_id, void *value_ptr,
*
len
=
sprintf
(
str
,
format
,
*
(
unsigned
int
*
)
value_ptr
);
break
;
}
case
pwr_eType_Enum
:
{
gdh_sValueDef
*
valuedef
;
int
rows
;
bool
converted
=
false
;
sts
=
gdh_GetEnumValueDef
(
tid
,
&
valuedef
,
&
rows
);
if
(
ODD
(
sts
))
{
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
if
(
valuedef
[
i
].
Value
->
Value
==
*
(
pwr_tInt32
*
)
value_ptr
)
{
strcpy
(
str
,
valuedef
[
i
].
Value
->
Text
);
*
len
=
strlen
(
str
);
converted
=
true
;
break
;
}
}
free
(
(
char
*
)
valuedef
);
}
if
(
!
converted
)
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%d"
,
*
(
unsigned
int
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
unsigned
int
*
)
value_ptr
);
break
;
}
break
;
}
case
pwr_eType_String
:
{
strncpy
(
str
,
(
char
*
)
value_ptr
,
size
);
...
...
@@ -638,6 +665,7 @@ int XNav::collect_insert( pwr_sAttrRef *arp)
unsigned
int
a_size
;
unsigned
int
a_offset
;
unsigned
int
a_dim
;
pwr_tTid
a_tid
;
sts
=
gdh_AttrrefToName
(
arp
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
...
...
@@ -650,6 +678,9 @@ int XNav::collect_insert( pwr_sAttrRef *arp)
sts
=
gdh_GetAttributeCharAttrref
(
arp
,
&
a_type_id
,
&
a_size
,
&
a_offset
,
&
a_dim
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetAttrRefTid
(
arp
,
&
a_tid
);
if
(
EVEN
(
sts
))
return
sts
;
}
else
{
sts
=
xnav_get_trace_attr
(
arp
,
attr
);
...
...
@@ -665,10 +696,13 @@ int XNav::collect_insert( pwr_sAttrRef *arp)
sts
=
gdh_GetAttributeCharAttrref
(
&
ar
,
&
a_type_id
,
&
a_size
,
&
a_offset
,
&
a_dim
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetAttrRefTid
(
arp
,
&
a_tid
);
if
(
EVEN
(
sts
))
return
sts
;
}
item
=
new
ItemCollect
(
collect_brow
,
arp
->
Objid
,
attr
,
NULL
,
flow_eDest_IntoLast
,
a_type_id
,
a_size
,
0
);
flow_eDest_IntoLast
,
a_type_id
,
a_
tid
,
a_
size
,
0
);
message
(
'I'
,
"Object inserted"
);
return
1
;
}
...
...
@@ -1718,9 +1752,20 @@ static int xnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
case
xnav_eItemType_Collect
:
case
xnav_eItemType_Local
:
case
xnav_eItemType_ObjectStruct
:
sts
=
item
->
open_children
(
xnav
->
brow
,
0
,
0
);
if
(
ODD
(
sts
))
break
;
if
(
xnav
->
gbl
.
advanced_user
&&
xnav
->
change_value_cb
)
(
xnav
->
change_value_cb
)(
xnav
->
parent_ctx
);
break
;
case
xnav_eItemType_Enum
:
if
(
xnav
->
gbl
.
advanced_user
)
((
ItemEnum
*
)
item
)
->
set_value
();
break
;
case
xnav_eItemType_Mask
:
if
(
xnav
->
gbl
.
advanced_user
)
((
ItemMask
*
)
item
)
->
toggle_value
();
break
;
default:
sts
=
item
->
open_children
(
xnav
->
brow
,
0
,
0
);
if
(
sts
==
XNAV__NOCHILD
&&
xnav
->
gbl
.
advanced_user
)
...
...
@@ -1910,6 +1955,29 @@ static int xnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
brow_SelectClear
(
xnav
->
brow
->
ctx
);
}
break
;
case
flow_eEvent_Radiobutton
:
{
switch
(
event
->
object
.
object_type
)
{
case
flow_eObjectType_Node
:
brow_GetUserData
(
event
->
object
.
object
,
(
void
**
)
&
item
);
switch
(
item
->
type
)
{
case
xnav_eItemType_Enum
:
if
(
!
event
->
radiobutton
.
value
)
((
ItemEnum
*
)
item
)
->
set_value
();
break
;
case
xnav_eItemType_Mask
:
((
ItemMask
*
)
item
)
->
set_value
(
!
event
->
radiobutton
.
value
);
break
;
default:
;
}
break
;
default:
;
}
break
;
}
case
flow_eEvent_MB3Press
:
{
// Popup menu
...
...
@@ -2039,6 +2107,8 @@ static void xnav_trace_scan( XNav *xnav)
XtWidgetToApplicationContext
(
xnav
->
brow_widget
)
,
time
,
(
XtTimerCallbackProc
)
xnav_trace_scan
,
xnav
);
}
xnav
->
update_alarminfo
();
if
(
xnav
->
ev
)
xnav
->
ev
->
update
(
xnav
->
gbl
.
scantime
);
if
(
xnav
->
op
)
...
...
@@ -2082,11 +2152,49 @@ static int xnav_trace_scan_bc( brow_tObject object, void *p)
else
item
->
first_scan
=
0
;
xnav_attrvalue_to_string
(
item
->
type_id
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
xnav_attrvalue_to_string
(
item
->
type_id
,
item
->
tid
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
brow_SetAnnotation
(
object
,
1
,
buf
,
len
);
memcpy
(
item
->
old_value
,
p
,
min
(
item
->
size
,
(
int
)
sizeof
(
item
->
old_value
)));
break
;
}
case
xnav_eItemType_Enum
:
{
ItemEnum
*
item
;
item
=
(
ItemEnum
*
)
base_item
;
if
(
!
item
->
first_scan
)
{
if
(
memcmp
(
item
->
old_value
,
p
,
sizeof
(
pwr_tEnum
))
==
0
)
// No change since last time
return
1
;
}
else
item
->
first_scan
=
0
;
if
(
*
(
pwr_tEnum
*
)
p
==
item
->
num
)
brow_SetRadiobutton
(
object
,
0
,
1
);
else
brow_SetRadiobutton
(
object
,
0
,
0
);
memcpy
(
item
->
old_value
,
p
,
sizeof
(
pwr_tEnum
));
break
;
}
case
xnav_eItemType_Mask
:
{
ItemMask
*
item
;
item
=
(
ItemMask
*
)
base_item
;
if
(
!
item
->
first_scan
)
{
if
(
memcmp
(
item
->
old_value
,
p
,
sizeof
(
pwr_tMask
))
==
0
)
// No change since last time
return
1
;
}
else
item
->
first_scan
=
0
;
if
(
*
(
pwr_tMask
*
)
p
&
item
->
num
)
brow_SetRadiobutton
(
object
,
0
,
1
);
else
brow_SetRadiobutton
(
object
,
0
,
0
);
memcpy
(
item
->
old_value
,
p
,
sizeof
(
pwr_tMask
));
break
;
}
case
xnav_eItemType_Local
:
{
ItemLocal
*
item
;
...
...
@@ -2107,7 +2215,7 @@ static int xnav_trace_scan_bc( brow_tObject object, void *p)
else
item
->
first_scan
=
0
;
xnav_attrvalue_to_string
(
item
->
type_id
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
xnav_attrvalue_to_string
(
item
->
type_id
,
0
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
brow_SetAnnotation
(
object
,
1
,
buf
,
len
);
memcpy
(
item
->
old_value
,
p
,
min
(
item
->
size
,
(
int
)
sizeof
(
item
->
old_value
)));
break
;
...
...
@@ -2132,7 +2240,7 @@ static int xnav_trace_scan_bc( brow_tObject object, void *p)
else
item
->
first_scan
=
0
;
xnav_attrvalue_to_string
(
item
->
type_id
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
xnav_attrvalue_to_string
(
item
->
type_id
,
0
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
brow_SetAnnotation
(
object
,
1
,
buf
,
len
);
memcpy
(
item
->
old_value
,
p
,
min
(
item
->
size
,
(
int
)
sizeof
(
item
->
old_value
)));
break
;
...
...
@@ -2196,7 +2304,7 @@ static int xnav_trace_scan_bc( brow_tObject object, void *p)
if
(
!
nochange
)
{
xnav_attrvalue_to_string
(
item
->
col
.
elem
[
i
].
type_id
,
xnav_attrvalue_to_string
(
item
->
col
.
elem
[
i
].
type_id
,
0
,
item
->
col
.
elem
[
i
].
value_p
,
buf
,
sizeof
(
buf
),
&
len
,
item
->
col
.
elem
[
i
].
format
);
brow_SetAnnotation
(
object
,
i
,
buf
,
len
);
...
...
@@ -2231,6 +2339,8 @@ static int xnav_trace_connect_bc( brow_tObject object, char *name, char *attr,
switch
(
base_item
->
type
)
{
case
xnav_eItemType_Attr
:
case
xnav_eItemType_Enum
:
case
xnav_eItemType_Mask
:
case
xnav_eItemType_AttrArrayElem
:
case
xnav_eItemType_Collect
:
{
...
...
@@ -2328,6 +2438,64 @@ static int xnav_trace_disconnect_bc( brow_tObject object)
return
1
;
}
int
XNav
::
update_alarminfo
()
{
flow_tObject
*
object_list
;
int
object_cnt
;
Item
*
item
;
int
i
;
pwr_tStatus
sts
;
brow_GetObjectList
(
brow
->
ctx
,
&
object_list
,
&
object_cnt
);
for
(
i
=
0
;
i
<
object_cnt
;
i
++
)
{
brow_GetUserData
(
object_list
[
i
],
(
void
**
)
&
item
);
switch
(
item
->
type
)
{
case
xnav_eItemType_Object
:
{
pwr_tUInt32
alarm_level
,
max_alarm_level
;
pwr_tUInt32
block_level
,
max_block_level
,
visibility
;
ItemObject
*
oitem
=
(
ItemObject
*
)
item
;
sts
=
gdh_GetAlarmInfo
(
oitem
->
objid
,
&
alarm_level
,
&
max_alarm_level
,
&
block_level
,
&
max_block_level
,
&
visibility
);
if
(
EVEN
(
sts
))
break
;
// Update alarm pixmap
if
(
alarm_level
!=
oitem
->
alarm_level
||
max_alarm_level
!=
oitem
->
max_alarm_level
)
{
if
(
alarm_level
&&
max_alarm_level
)
brow_SetAnnotPixmap
(
object_list
[
i
],
2
,
brow
->
pixmap_alarm2
);
else
if
(
alarm_level
)
brow_SetAnnotPixmap
(
object_list
[
i
],
2
,
brow
->
pixmap_arrowright
);
else
if
(
max_alarm_level
)
brow_SetAnnotPixmap
(
object_list
[
i
],
2
,
brow
->
pixmap_arrowdown
);
else
brow_RemoveAnnotPixmap
(
object_list
[
i
],
2
);
oitem
->
alarm_level
=
alarm_level
;
oitem
->
max_alarm_level
=
max_alarm_level
;
}
// Update block pixmap
if
(
block_level
!=
oitem
->
block_level
||
max_block_level
!=
oitem
->
max_block_level
)
{
if
(
block_level
&&
max_block_level
)
brow_SetAnnotPixmap
(
object_list
[
i
],
3
,
brow
->
pixmap_block2
);
else
if
(
block_level
)
brow_SetAnnotPixmap
(
object_list
[
i
],
3
,
brow
->
pixmap_blockr
);
else
if
(
max_block_level
)
brow_SetAnnotPixmap
(
object_list
[
i
],
3
,
brow
->
pixmap_blockd
);
else
brow_RemoveAnnotPixmap
(
object_list
[
i
],
3
);
oitem
->
block_level
=
block_level
;
oitem
->
max_block_level
=
max_block_level
;
}
break
;
}
default:
;
}
}
return
1
;
}
int
XNav
::
display_object
(
pwr_tObjid
objid
,
int
open
)
{
...
...
@@ -3176,6 +3344,8 @@ void XNav::enable_events( XNavBrow *brow)
xnav_brow_cb
);
brow_EnableEvent
(
brow
->
ctx
,
flow_eEvent_Resized
,
flow_eEventType_CallBack
,
xnav_brow_cb
);
brow_EnableEvent
(
brow
->
ctx
,
flow_eEvent_Radiobutton
,
flow_eEventType_CallBack
,
xnav_brow_cb
);
}
//
...
...
xtt/lib/xtt/src/xtt_xnav.h
View file @
256ae378
...
...
@@ -152,6 +152,7 @@ typedef enum {
applist_eType_Trace
,
applist_eType_Graph
,
applist_eType_Attr
,
applist_eType_AttrOne
,
applist_eType_Trend
,
applist_eType_Crossref
,
applist_eType_Hist
,
...
...
@@ -351,10 +352,12 @@ class XNav {
int
open_object
(
pwr_sAttrRef
*
arp
);
int
open_crossref
(
pwr_sAttrRef
*
arp
);
void
swap
(
int
mode
);
int
update_alarminfo
();
// Command module member functions
int
command
(
char
*
cmd
);
pwr_tStatus
get_command_sts
();
int
readcmdfile
(
char
*
incommand
);
int
show_database
();
int
get_current_object
(
...
...
@@ -428,7 +431,7 @@ int xnav_cut_segments (
int
xnav_attr_string_to_value
(
int
type_id
,
char
*
value_str
,
void
*
buffer_ptr
,
int
buff_size
,
int
attr_size
);
void
xnav_attrvalue_to_string
(
int
type_id
,
void
*
value_ptr
,
void
xnav_attrvalue_to_string
(
int
type_id
,
pwr_tTid
tid
,
void
*
value_ptr
,
char
*
str
,
int
size
,
int
*
len
,
char
*
format
);
Widget
xnav_create_popup_menu
(
XNav
*
xnav
,
pwr_sAttrRef
attrref
,
...
...
@@ -440,6 +443,15 @@ int xnav_call_method( XNav *xnav, char *method, char *filter,
xmenu_eItemType
item_type
,
xmenu_mUtility
caller
,
unsigned
int
priv
,
char
*
arg
);
int
xnav_call_object_method
(
XNav
*
xnav
,
pwr_sAttrRef
attrref
,
xmenu_eItemType
item_type
,
xmenu_mUtility
caller
,
unsigned
int
priv
,
char
*
method_name
);
int
xnav_check_object_methodfilter
(
XNav
*
xnav
,
pwr_sAttrRef
attrref
,
xmenu_eItemType
item_type
,
xmenu_mUtility
caller
,
unsigned
int
priv
,
char
*
method_name
);
void
xnav_popup_menu_cb
(
void
*
xnav
,
pwr_sAttrRef
attrref
,
unsigned
long
item_type
,
unsigned
long
utility
,
char
*
arg
,
Widget
*
popup
);
...
...
xtt/lib/xtt/src/xtt_xnav_brow.cpp
View file @
256ae378
This diff is collapsed.
Click to expand it.
xtt/lib/xtt/src/xtt_xnav_brow.h
View file @
256ae378
...
...
@@ -36,6 +36,7 @@ class XNavBrow {
brow_tNodeClass
nc_header
;
brow_tNodeClass
nc_headerlarge
;
brow_tNodeClass
nc_table_header
;
brow_tNodeClass
nc_enum
;
flow_sAnnotPixmap
*
pixmap_leaf
;
flow_sAnnotPixmap
*
pixmap_map
;
flow_sAnnotPixmap
*
pixmap_openmap
;
...
...
@@ -57,6 +58,14 @@ class XNavBrow {
flow_sAnnotPixmap
*
pixmap_morehelp
;
flow_sAnnotPixmap
*
pixmap_closehelp
;
flow_sAnnotPixmap
*
pixmap_object
;
flow_sAnnotPixmap
*
pixmap_attrenum
;
flow_sAnnotPixmap
*
pixmap_attrmask
;
flow_sAnnotPixmap
*
pixmap_block2
;
flow_sAnnotPixmap
*
pixmap_blockd
;
flow_sAnnotPixmap
*
pixmap_blockr
;
flow_sAnnotPixmap
*
pixmap_alarm2
;
flow_sAnnotPixmap
*
pixmap_arrowdown
;
flow_sAnnotPixmap
*
pixmap_arrowright
;
char
push_command
[
200
];
void
free_pixmaps
();
...
...
xtt/lib/xtt/src/xtt_xnav_command.cpp
View file @
256ae378
This diff is collapsed.
Click to expand it.
xtt/lib/xtt/src/xtt_xnav_help.cpp
View file @
256ae378
...
...
@@ -76,6 +76,7 @@ void *xnav_help_insert_cb( void *ctx, navh_eItemType item_type, char *text1,
switch
(
item_type
)
{
case
navh_eItemType_Help
:
case
navh_eItemType_HelpCode
:
{
ItemHelp
*
item
=
new
ItemHelp
(
xnav
->
brow
,
"help"
,
text1
,
text2
,
text3
,
link
,
bookmark
,
file_name
,
file_type
,
help_index
,
...
...
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