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
9f068076
Commit
9f068076
authored
Feb 17, 2005
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enum and Mask displayed in xtt
parent
779272bb
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
404 additions
and
155 deletions
+404
-155
xtt/lib/xtt/src/xtt_item.cpp
xtt/lib/xtt/src/xtt_item.cpp
+234
-11
xtt/lib/xtt/src/xtt_item.h
xtt/lib/xtt/src/xtt_item.h
+58
-7
xtt/lib/xtt/src/xtt_xatt.cpp
xtt/lib/xtt/src/xtt_xatt.cpp
+1
-1
xtt/lib/xtt/src/xtt_xattnav.cpp
xtt/lib/xtt/src/xtt_xattnav.cpp
+79
-57
xtt/lib/xtt/src/xtt_xnav_tables.cpp
xtt/lib/xtt/src/xtt_xnav_tables.cpp
+32
-79
No files found.
xtt/lib/xtt/src/xtt_item.cpp
View file @
9f068076
...
...
@@ -60,7 +60,8 @@ extern "C" {
//
ItemObject
::
ItemObject
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
int
item_is_root
)
:
ItemBaseObject
(
item_objid
,
item_is_root
)
ItemBaseObject
(
item_objid
,
item_is_root
),
alarm_level
(
0
),
max_alarm_level
(
0
),
block_level
(
0
),
max_block_level
(
0
)
{
int
sts
;
char
segname
[
120
];
...
...
@@ -314,6 +315,7 @@ int ItemBaseObject::open_attributes( XNavBrow *brow, double x, double y)
bd
[
i
].
attrName
,
bd
[
i
].
attr
->
Param
.
Info
.
Elements
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
);
}
...
...
@@ -332,6 +334,7 @@ int ItemBaseObject::open_attributes( XNavBrow *brow, double x, double y)
flow_eDest_IntoLast
,
bd
[
i
].
attrName
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
,
item_eDisplayType_Attr
);
...
...
@@ -395,6 +398,7 @@ int ItemBaseObject::open_attribute( XNavBrow *brow, double x, double y,
flow_eDest_IntoLast
,
bd
[
i
].
attrName
,
element
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
/
bd
[
i
].
attr
->
Param
.
Info
.
Elements
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
,
item_eDisplayType_Path
);
...
...
@@ -404,6 +408,7 @@ int ItemBaseObject::open_attribute( XNavBrow *brow, double x, double y,
item
=
(
Item
*
)
new
ItemAttr
(
brow
,
objid
,
node
,
flow_eDest_IntoLast
,
bd
[
i
].
attrName
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
,
item_eDisplayType_Path
);
...
...
@@ -544,7 +549,7 @@ int ItemAttrArray::open_attributes( XNavBrow *brow, double x, double y)
size
/
elements
,
flags
,
i
,
0
);
else
item
=
(
Item
*
)
new
ItemAttrArrayElem
(
brow
,
objid
,
node
,
flow_eDest_IntoLast
,
name
,
i
,
type_id
,
flow_eDest_IntoLast
,
name
,
i
,
type_id
,
tid
,
size
/
elements
,
flags
,
is_root
,
item_eDisplayType_Attr
);
}
...
...
@@ -574,12 +579,95 @@ void ItemAttrArray::close( XNavBrow *brow, double x, double y)
}
}
int
ItemBaseAttr
::
open_children
(
XNavBrow
*
brow
,
double
x
,
double
y
)
{
double
node_x
,
node_y
;
if
(
cdh_ObjidIsNull
(
objid
))
return
1
;
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
if
(
brow_IsOpen
(
node
)
&
xnav_mOpen_Children
)
{
// Attributes is open, close
brow_SetNodraw
(
brow
->
ctx
);
brow_CloseNode
(
brow
->
ctx
,
node
);
brow_ResetOpen
(
node
,
xnav_mOpen_Children
);
brow_RemoveAnnotPixmap
(
node
,
1
);
brow_ResetNodraw
(
brow
->
ctx
);
brow_Redraw
(
brow
->
ctx
,
node_y
);
}
else
{
int
sts
;
if
(
type_id
==
pwr_eType_Enum
)
{
gdh_sValueDef
*
vd
;
int
rows
;
sts
=
gdh_GetEnumValueDef
(
tid
,
&
vd
,
&
rows
);
if
(
EVEN
(
sts
))
return
XNAV__NOCHILDREN
;
// Create some children
brow_SetNodraw
(
brow
->
ctx
);
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
new
ItemEnum
(
brow
,
objid
,
node
,
flow_eDest_IntoLast
,
vd
[
i
].
Value
->
Text
,
attr
,
type_id
,
tid
,
size
,
flags
,
vd
[
i
].
Value
->
Value
,
0
,
1
);
}
free
(
(
char
*
)
vd
);
}
else
{
gdh_sBitDef
*
bd
;
int
rows
;
sts
=
gdh_GetMaskBitDef
(
tid
,
&
bd
,
&
rows
);
if
(
EVEN
(
sts
))
return
XNAV__NOCHILDREN
;
// Create some children
brow_SetNodraw
(
brow
->
ctx
);
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
new
ItemMask
(
brow
,
objid
,
node
,
flow_eDest_IntoLast
,
bd
[
i
].
Bit
->
Text
,
attr
,
type_id
,
tid
,
size
,
flags
,
(
unsigned
int
)
bd
[
i
].
Bit
->
Value
,
0
,
1
);
}
free
(
(
char
*
)
bd
);
}
brow_SetOpen
(
node
,
xnav_mOpen_Children
);
brow_SetAnnotPixmap
(
node
,
1
,
brow
->
pixmap_openmap
);
brow_ResetNodraw
(
brow
->
ctx
);
brow_Redraw
(
brow
->
ctx
,
node_y
);
}
return
1
;
}
void
ItemBaseAttr
::
close
(
XNavBrow
*
brow
,
double
x
,
double
y
)
{
double
node_x
,
node_y
;
if
(
brow_IsOpen
(
node
)
&
xnav_mOpen_Children
)
{
// Children is open, close
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
brow_SetNodraw
(
brow
->
ctx
);
brow_CloseNode
(
brow
->
ctx
,
node
);
brow_ResetOpen
(
node
,
xnav_mOpen_All
);
brow_ResetNodraw
(
brow
->
ctx
);
brow_Redraw
(
brow
->
ctx
,
node_y
);
}
}
ItemAttr
::
ItemAttr
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_name
,
int
attr_type_id
,
int
attr_size
,
int
attr_flags
,
char
*
attr_name
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
int
item_is_root
,
item_eDisplayType
item_display_type
)
:
ItemBaseAttr
(
item_objid
,
attr_name
,
attr_type_id
,
attr_size
,
attr_flags
,
item_is_root
,
item_display_type
)
attr_type_id
,
attr_
tid
,
attr_
size
,
attr_flags
,
item_is_root
,
item_display_type
)
{
char
obj_name
[
120
];
char
annot
[
120
];
...
...
@@ -615,6 +703,12 @@ ItemAttr::ItemAttr( XNavBrow *brow, pwr_tObjid item_objid,
case
pwr_eType_Objid
:
brow_SetAnnotPixmap
(
node
,
0
,
brow
->
pixmap_ref
);
break
;
case
pwr_eType_Enum
:
brow_SetAnnotPixmap
(
node
,
0
,
brow
->
pixmap_attrenum
);
break
;
case
pwr_eType_Mask
:
brow_SetAnnotPixmap
(
node
,
0
,
brow
->
pixmap_attrmask
);
break
;
default:
brow_SetAnnotPixmap
(
node
,
0
,
brow
->
pixmap_attr
);
}
...
...
@@ -628,10 +722,10 @@ ItemAttr::ItemAttr( XNavBrow *brow, pwr_tObjid item_objid,
ItemAttrArray
::
ItemAttrArray
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_name
,
int
attr_elements
,
int
attr_type_id
,
char
*
attr_name
,
int
attr_elements
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
int
item_is_root
)
:
Item
(
item_objid
,
item_is_root
),
elements
(
attr_elements
),
type_id
(
attr_type_id
),
elements
(
attr_elements
),
type_id
(
attr_type_id
),
tid
(
attr_tid
),
size
(
attr_size
),
flags
(
attr_flags
)
{
char
*
annot
;
...
...
@@ -653,10 +747,10 @@ ItemAttrArray::ItemAttrArray( XNavBrow *brow, pwr_tObjid item_objid,
ItemAttrArrayElem
::
ItemAttrArrayElem
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_name
,
int
attr_element
,
int
attr_type_id
,
char
*
attr_name
,
int
attr_element
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
int
item_is_root
,
item_eDisplayType
item_display_type
)
:
ItemBaseAttr
(
item_objid
,
attr_name
,
attr_type_id
,
attr_size
,
attr_flags
,
item_is_root
,
item_display_type
),
attr_type_id
,
attr_
tid
,
attr_
size
,
attr_flags
,
item_is_root
,
item_display_type
),
element
(
attr_element
)
{
char
obj_name
[
120
];
...
...
@@ -848,6 +942,7 @@ int ItemAttrObject::open_attributes( XNavBrow *brow, double x, double y)
attr_name
,
bd
[
i
].
attr
->
Param
.
Info
.
Elements
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
);
}
...
...
@@ -866,6 +961,7 @@ int ItemAttrObject::open_attributes( XNavBrow *brow, double x, double y)
flow_eDest_IntoLast
,
attr_name
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
,
item_eDisplayType_Attr
);
...
...
@@ -1215,10 +1311,10 @@ int ItemFile::open_children( XNavBrow *brow, double x, double y)
ItemCollect
::
ItemCollect
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
char
*
attr_name
,
brow_tNode
dest
,
flow_eDest
dest_code
,
int
attr_type_id
,
brow_tNode
dest
,
flow_eDest
dest_code
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
item_is_root
)
:
ItemBaseAttr
(
item_objid
,
attr_name
,
attr_type_id
,
attr_size
,
0
,
item_is_root
,
item_eDisplayType_Path
)
attr_type_id
,
attr_
tid
,
attr_
size
,
0
,
item_is_root
,
item_eDisplayType_Path
)
{
int
sts
;
char
obj_name
[
120
];
...
...
@@ -1760,6 +1856,133 @@ int ItemRemTrans::open_children( XNavBrow *brow, double x, double y)
return
ItemTable
::
open_children
(
brow
,
x
,
y
);
}
ItemEnum
::
ItemEnum
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_enum_name
,
char
*
attr_name
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
unsigned
int
item_num
,
int
item_is_element
,
int
item_element
)
:
ItemBaseAttr
(
item_objid
,
attr_name
,
attr_type_id
,
attr_tid
,
attr_size
,
attr_flags
,
0
,
item_eDisplayType_Attr
),
num
(
item_num
),
is_element
(
item_is_element
),
element
(
item_element
)
{
pwr_tOName
obj_name
;
pwr_tStatus
sts
;
type
=
xnav_eItemType_Enum
;
sprintf
(
name
,
"%s%u"
,
attr_name
,
num
);
strcpy
(
enum_name
,
attr_enum_name
);
brow_CreateNode
(
brow
->
ctx
,
enum_name
,
brow
->
nc_enum
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
brow_SetAnnotPixmap
(
node
,
0
,
brow
->
pixmap_attr
);
brow_SetAnnotation
(
node
,
0
,
enum_name
,
strlen
(
enum_name
));
sts
=
gdh_ObjidToName
(
objid
,
obj_name
,
sizeof
(
obj_name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
throw
co_error
(
sts
);
brow_SetTraceAttr
(
node
,
obj_name
,
attr_name
,
flow_eTraceType_User
);
}
int
ItemEnum
::
set_value
()
{
pwr_tStatus
sts
;
pwr_tAName
name
;
sts
=
gdh_ObjidToName
(
objid
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
strcat
(
name
,
"."
);
strcat
(
name
,
attr
);
sts
=
gdh_SetObjectInfo
(
name
,
&
num
,
sizeof
(
pwr_tEnum
));
return
sts
;
}
ItemMask
::
ItemMask
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_mask_name
,
char
*
attr_name
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
unsigned
int
item_num
,
int
item_is_element
,
int
item_element
)
:
ItemBaseAttr
(
item_objid
,
attr_name
,
attr_type_id
,
attr_tid
,
attr_size
,
attr_flags
,
0
,
item_eDisplayType_Attr
),
num
(
item_num
),
is_element
(
item_is_element
),
element
(
item_element
)
{
pwr_tOName
obj_name
;
pwr_tStatus
sts
;
type
=
xnav_eItemType_Mask
;
sprintf
(
name
,
"%s%u"
,
attr_name
,
num
);
strcpy
(
mask_name
,
attr_mask_name
);
brow_CreateNode
(
brow
->
ctx
,
mask_name
,
brow
->
nc_enum
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
brow_SetAnnotPixmap
(
node
,
0
,
brow
->
pixmap_attr
);
brow_SetAnnotation
(
node
,
0
,
mask_name
,
strlen
(
mask_name
));
sts
=
gdh_ObjidToName
(
objid
,
obj_name
,
sizeof
(
obj_name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
throw
co_error
(
sts
);
brow_SetTraceAttr
(
node
,
obj_name
,
attr_name
,
flow_eTraceType_User
);
}
int
ItemMask
::
set_value
(
int
bittrue
)
{
pwr_tStatus
sts
;
pwr_tAName
name
;
pwr_tMask
value
;
sts
=
gdh_ObjidToName
(
objid
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
strcat
(
name
,
"."
);
strcat
(
name
,
attr
);
sts
=
gdh_GetObjectInfo
(
name
,
&
value
,
sizeof
(
pwr_tMask
));
if
(
EVEN
(
sts
))
return
sts
;
if
(
bittrue
)
value
=
value
|
num
;
else
value
=
value
&
~
num
;
sts
=
gdh_SetObjectInfo
(
name
,
&
value
,
sizeof
(
pwr_tMask
));
return
sts
;
}
int
ItemMask
::
toggle_value
()
{
pwr_tStatus
sts
;
pwr_tAName
name
;
pwr_tMask
value
;
sts
=
gdh_ObjidToName
(
objid
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
strcat
(
name
,
"."
);
strcat
(
name
,
attr
);
sts
=
gdh_GetObjectInfo
(
name
,
&
value
,
sizeof
(
pwr_tMask
));
if
(
EVEN
(
sts
))
return
sts
;
if
(
value
&
num
)
value
=
value
&
~
num
;
else
value
=
value
|
num
;
sts
=
gdh_SetObjectInfo
(
name
,
&
value
,
sizeof
(
pwr_tMask
));
return
sts
;
}
...
...
xtt/lib/xtt/src/xtt_item.h
View file @
9f068076
...
...
@@ -54,7 +54,9 @@ typedef enum {
xnav_eItemType_HelpBold
,
xnav_eItemType_HelpHeader
,
xnav_eItemType_ObjectStruct
,
xnav_eItemType_AttrObject
xnav_eItemType_AttrObject
,
xnav_eItemType_Enum
,
xnav_eItemType_Mask
}
xnav_eItemType
;
typedef
enum
{
...
...
@@ -115,14 +117,19 @@ class Item {
class
ItemBaseAttr
:
public
Item
{
public:
ItemBaseAttr
(
pwr_tObjid
item_objid
,
char
*
attr_name
,
int
attr_type_id
,
int
attr_size
,
int
attr_flags
,
char
*
attr_name
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
int
item_is_root
,
item_eDisplayType
item_display_type
)
:
Item
(
item_objid
,
item_is_root
),
type_id
(
attr_type_id
),
size
(
attr_size
),
flags
(
attr_flags
),
type_id
(
attr_type_id
),
tid
(
attr_tid
),
size
(
attr_size
),
flags
(
attr_flags
),
subid
(
pwr_cNSubid
),
first_scan
(
1
),
display_type
(
item_display_type
)
{
strcpy
(
attr
,
attr_name
);
memset
(
old_value
,
0
,
sizeof
(
old_value
));};
virtual
int
open_children
(
XNavBrow
*
brow
,
double
x
,
double
y
);
virtual
void
close
(
XNavBrow
*
brow
,
double
x
,
double
y
);
int
type_id
;
pwr_tTid
tid
;
int
size
;
int
flags
;
pwr_tSubid
subid
;
...
...
@@ -224,6 +231,10 @@ class ItemObject : public ItemBaseObject {
public:
ItemObject
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
int
item_is_root
);
pwr_tUInt32
alarm_level
;
pwr_tUInt32
max_alarm_level
;
pwr_tUInt32
block_level
;
pwr_tUInt32
max_block_level
;
};
...
...
@@ -231,7 +242,8 @@ class ItemAttr : public ItemBaseAttr {
public:
ItemAttr
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_name
,
int
attr_type_id
,
int
attr_size
,
int
attr_flags
,
char
*
attr_name
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
int
item_is_root
,
item_eDisplayType
item_display_type
);
};
...
...
@@ -239,11 +251,12 @@ class ItemAttrArray : public Item {
public:
int
elements
;
int
type_id
;
pwr_tTid
tid
;
int
size
;
int
flags
;
ItemAttrArray
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_name
,
int
attr_elements
,
int
attr_type_id
,
char
*
attr_name
,
int
attr_elements
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
int
item_is_root
);
int
open_children
(
XNavBrow
*
brow
,
double
x
,
double
y
)
{
return
1
;};
int
open_attributes
(
XNavBrow
*
brow
,
double
x
,
double
y
);
...
...
@@ -255,7 +268,7 @@ class ItemAttrArrayElem : public ItemBaseAttr {
int
element
;
ItemAttrArrayElem
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_name
,
int
attr_element
,
int
attr_type_id
,
char
*
attr_name
,
int
attr_element
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
int
item_is_root
,
item_eDisplayType
item_display_type
);
};
...
...
@@ -277,7 +290,7 @@ class ItemAttrObject : public Item {
class
ItemCollect
:
public
ItemBaseAttr
{
public:
ItemCollect
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
char
*
attr_name
,
brow_tNode
dest
,
flow_eDest
dest_code
,
int
attr_type_id
,
brow_tNode
dest
,
flow_eDest
dest_code
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
item_is_root
);
};
...
...
@@ -442,6 +455,44 @@ class ItemPlc : public ItemTable {
int
open_children
(
XNavBrow
*
brow
,
double
x
,
double
y
);
};
class
ItemEnum
:
public
ItemBaseAttr
{
public:
ItemEnum
::
ItemEnum
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_enum_name
,
char
*
attr_name
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
unsigned
int
item_num
,
int
item_is_element
,
int
item_element
);
int
set_value
();
int
num
;
char
enum_name
[
32
];
int
is_element
;
int
element
;
};
class
ItemMask
:
public
ItemBaseAttr
{
public:
ItemMask
::
ItemMask
(
XNavBrow
*
brow
,
pwr_tObjid
item_objid
,
brow_tNode
dest
,
flow_eDest
dest_code
,
char
*
attr_enum_name
,
char
*
attr_name
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
unsigned
int
item_num
,
int
item_is_element
,
int
item_element
);
int
set_value
(
int
bittrue
);
int
toggle_value
();
int
num
;
char
mask_name
[
32
];
int
is_element
;
int
element
;
};
#if defined __cplusplus
}
#endif
...
...
xtt/lib/xtt/src/xtt_xatt.cpp
View file @
9f068076
...
...
@@ -487,7 +487,7 @@ XAtt::XAtt(
objar
(
*
xa_objar
),
input_open
(
0
),
input_multiline
(
0
),
close_cb
(
0
),
redraw_cb
(
0
),
client_data
(
0
),
set_focus_disabled
(
0
)
set_focus_disabled
(
0
)
,
value_current_recall
(
0
)
{
char
uid_filename
[
120
]
=
{
"xtt_xatt.uid"
};
char
*
uid_filename_p
=
uid_filename
;
...
...
xtt/lib/xtt/src/xtt_xattnav.cpp
View file @
9f068076
...
...
@@ -415,19 +415,19 @@ static int xattnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
{
brow_tNode
*
node_list
;
int
node_count
;
pwr_tStatus
sts
;
brow_GetSelectedNodes
(
xattnav
->
brow
->
ctx
,
&
node_list
,
&
node_count
);
if
(
!
node_count
)
return
1
;
brow_GetUserData
(
node_list
[
0
],
(
void
**
)
&
item
);
switch
(
item
->
type
)
{
switch
(
item
->
type
)
{
case
xnav_eItemType_Attr
:
if
(
xattnav
->
advanced_user
&&
xattnav
->
change_value_cb
)
(
xattnav
->
change_value_cb
)(
xattnav
->
parent_ctx
);
break
;
case
xnav_eItemType_AttrArrayElem
:
sts
=
item
->
open_children
(
xattnav
->
brow
,
0
,
0
);
if
(
ODD
(
sts
))
break
;
if
(
xattnav
->
advanced_user
&&
xattnav
->
change_value_cb
)
(
xattnav
->
change_value_cb
)(
xattnav
->
parent_ctx
);
break
;
...
...
@@ -437,29 +437,14 @@ static int xattnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
case
xnav_eItemType_AttrObject
:
((
ItemAttrObject
*
)
item
)
->
open_attributes
(
xattnav
->
brow
,
0
,
0
);
break
;
#if 0
case
xnav_eItemType_Enum
:
{
int value;
if ( !xattnav->advanced_user)
break;
brow_GetRadiobutton( node_list[0], 0, &value);
if ( !value)
((ItemEnum *)item)->set();
if
(
xattnav
->
advanced_user
)
((
ItemEnum
*
)
item
)
->
set_value
();
break
;
}
case
xnav_eItemType_Mask
:
{
int value;
if ( !xattnav->advanced_user)
break;
brow_GetRadiobutton( node_list[0], 0, &value);
((ItemMask *)item)->set( !value);
if
(
xattnav
->
advanced_user
)
((
ItemMask
*
)
item
)
->
toggle_value
();
break
;
}
#endif
default:
;
}
...
...
@@ -513,17 +498,14 @@ static int xattnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
{
case
flow_eObjectType_Node
:
brow_GetUserData
(
event
->
object
.
object
,
(
void
**
)
&
item
);
switch
(
item
->
type
)
{
#if 0
switch
(
item
->
type
)
{
case
xnav_eItemType_Enum
:
if
(
!
event
->
radiobutton
.
value
)
((ItemEnum *)item)->set
();
((
ItemEnum
*
)
item
)
->
set_value
();
break
;
case
xnav_eItemType_Mask
:
((ItemMask *)item)->set
( !event->radiobutton.value);
((
ItemMask
*
)
item
)
->
set_value
(
!
event
->
radiobutton
.
value
);
break
;
#endif
default:
;
}
...
...
@@ -531,8 +513,6 @@ static int xattnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
default:
;
}
break
;
}
case
flow_eEvent_Map
:
...
...
@@ -563,6 +543,8 @@ static int xattnav_trace_connect_bc( brow_tObject object, char *name,
switch
(
base_item
->
type
)
{
case
xnav_eItemType_Attr
:
case
xnav_eItemType_Enum
:
case
xnav_eItemType_Mask
:
case
xnav_eItemType_AttrArrayElem
:
{
ItemAttr
*
item
;
...
...
@@ -632,11 +614,49 @@ static int xattnav_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
;
}
default:
;
}
...
...
@@ -746,6 +766,7 @@ int XAttNav::object_attr()
name
,
bd
[
i
].
attr
->
Param
.
Info
.
Elements
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
);
}
...
...
@@ -764,6 +785,7 @@ int XAttNav::object_attr()
flow_eDest_IntoLast
,
name
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
,
item_eDisplayType_Attr
);
...
...
xtt/lib/xtt/src/xtt_xnav_tables.cpp
View file @
9f068076
...
...
@@ -1086,21 +1086,13 @@ int XNav::show_object( pwr_tObjid objid, brow_tNode node)
else
{
int
sts
;
pwr_tObjid
parameter
;
char
classname
[
80
];
char
hiername
[
80
];
char
parname
[
80
];
char
fullname
[
80
];
char
*
s
;
pwr_tClassId
classid
;
unsigned
long
elements
;
pwr_sParInfo
parinfo
;
pwr_tObjid
body
;
pwr_tClassId
parameter_class
;
gdh_sAttrDef
*
bd
;
int
rows
;
Item
*
item
;
int
attr_exist
;
int
i
,
j
;
int
i
;
if
(
brow_IsOpen
(
node
)
&
xnav_mOpen_Children
||
brow_IsOpen
(
node
)
&
xnav_mOpen_Crossref
)
...
...
@@ -1118,85 +1110,46 @@ int XNav::show_object( pwr_tObjid objid, brow_tNode node)
// Create some attributes
brow_SetNodraw
(
brow
->
ctx
);
// Get objid for rtbody or sysbody
sts
=
gdh_GetObjectClass
(
objid
,
&
classid
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_ObjidToName
(
cdh_ClassIdToObjid
(
classid
),
classname
,
sizeof
(
classname
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
return
sts
;
attr_exist
=
0
;
for
(
j
=
0
;
j
<
2
;
j
++
)
{
strcpy
(
hiername
,
classname
);
if
(
j
==
0
)
strcat
(
hiername
,
"-RtBody"
);
else
strcat
(
hiername
,
"-SysBody"
);
sts
=
gdh_NameToObjid
(
hiername
,
&
body
);
if
(
EVEN
(
sts
))
continue
;
// Get first attribute of the body
i
=
0
;
sts
=
gdh_GetChild
(
body
,
&
parameter
);
while
(
ODD
(
sts
))
{
sts
=
gdh_ObjidToName
(
parameter
,
hiername
,
sizeof
(
hiername
),
cdh_mName_volumeStrict
);
// Get attributes for this class
sts
=
gdh_GetObjectBodyDef
(
classid
,
&
bd
,
&
rows
);
if
(
EVEN
(
sts
))
return
sts
;
/* Skip hierarchy */
s
=
strrchr
(
hiername
,
'-'
);
if
(
s
==
0
)
strcpy
(
parname
,
hiername
);
else
strcpy
(
parname
,
s
+
1
);
/* Get parameter info for this parameter */
strcpy
(
fullname
,
hiername
);
sts
=
gdh_GetObjectInfo
(
fullname
,
&
parinfo
,
sizeof
(
parinfo
));
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetObjectClass
(
parameter
,
&
parameter_class
);
if
(
EVEN
(
sts
))
return
sts
;
for
(
i
=
0
;
i
<
rows
;
i
++
)
{
if
(
parinfo
.
Flags
&
PWR_MASK_RTVIRTUAL
||
parinfo
.
Flags
&
PWR_MASK_PRIVATE
)
{
/* This parameter does not contain any useful information, take the
next one */
sts
=
gdh_GetNextSibling
(
parameter
,
&
parameter
);
i
++
;
if
(
bd
[
i
].
attr
->
Param
.
Info
.
Flags
&
PWR_MASK_RTVIRTUAL
||
bd
[
i
].
attr
->
Param
.
Info
.
Flags
&
PWR_MASK_PRIVATE
)
continue
;
}
elements
=
1
;
if
(
parinfo
.
Flags
&
PWR_MASK_ARRAY
)
{
if
(
bd
[
i
].
attr
->
Param
.
Info
.
Flags
&
PWR_MASK_ARRAY
)
{
attr_exist
=
1
;
item
=
(
Item
*
)
new
ItemAttrArray
(
brow
,
objid
,
node
,
flow_eDest_IntoLast
,
parname
,
parinfo
.
Elements
,
parinfo
.
Type
,
parinfo
.
Size
,
parinfo
.
Flags
,
0
);
bd
[
i
].
attrName
,
bd
[
i
].
attr
->
Param
.
Info
.
Elements
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
);
}
else
{
else
{
attr_exist
=
1
;
item
=
(
Item
*
)
new
ItemAttr
(
brow
,
objid
,
node
,
flow_eDest_IntoLast
,
parname
,
parinfo
.
Type
,
parinfo
.
Size
,
parinfo
.
Flags
,
0
,
item_eDisplayType_Attr
);
}
sts
=
gdh_GetNextSibling
(
parameter
,
&
parameter
);
i
++
;
flow_eDest_IntoLast
,
bd
[
i
].
attrName
,
bd
[
i
].
attr
->
Param
.
Info
.
Type
,
bd
[
i
].
attr
->
Param
.
TypeRef
,
bd
[
i
].
attr
->
Param
.
Info
.
Size
,
bd
[
i
].
attr
->
Param
.
Info
.
Flags
,
0
,
item_eDisplayType_Attr
);
}
}
if
(
attr_exist
)
{
free
(
(
char
*
)
bd
);
if
(
attr_exist
)
{
brow_SetOpen
(
node
,
xnav_mOpen_Attributes
);
brow_SetAnnotPixmap
(
node
,
1
,
brow
->
pixmap_openattr
);
}
...
...
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