Commit 9b78f9a7 authored by Claes Sjofors's avatar Claes Sjofors

Ge action PopupMenu: attribute can be used, and object methods viewed with cascading menu

parent 38af1e46
...@@ -1305,6 +1305,12 @@ SObject pwrs:Class ...@@ -1305,6 +1305,12 @@ SObject pwrs:Class
Attr FilterName = "$Object-CollectFilter" Attr FilterName = "$Object-CollectFilter"
EndBody EndBody
EndObject EndObject
Object Object $MenuRef
Body SysBody
Attr ButtonName = "Object"
Attr RefAttribute = "_SelfObject"
EndBody
EndObject
EndObject EndObject
Object RtXttCrossref $RtMenu Object RtXttCrossref $RtMenu
Object CrrOpenTrace $MenuButton Object CrrOpenTrace $MenuButton
......
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
// Until xtt_menu.h i unavailable... // Until xtt_menu.h i unavailable...
#define xmenu_mUtility_Ge (1 << 5) #define xmenu_mUtility_Ge (1 << 5)
#define xmenu_eItemType_Object 1 #define xmenu_eItemType_Object 1
#define xmenu_eItemType_AttrObject 2
#define xmenu_eItemType_Attribute 3
#define glow_cJBean_Offset 2 #define glow_cJBean_Offset 2
#define glow_cJBean_SizeCorr 2 #define glow_cJBean_SizeCorr 2
...@@ -9554,10 +9556,15 @@ int GePopupMenu::action( grow_tObject object, glow_tEvent event) ...@@ -9554,10 +9556,15 @@ int GePopupMenu::action( grow_tObject object, glow_tEvent event)
// Display popup menu // Display popup menu
grow_GetName( dyn->graph->grow->ctx, name); grow_GetName( dyn->graph->grow->ctx, name);
int item_type = xmenu_eItemType_Attribute;
if ( attrref.Flags.b.Object)
item_type = xmenu_eItemType_Object;
else if ( attrref.Flags.b.ObjectAttr)
item_type = xmenu_eItemType_AttrObject;
dyn->graph->popup_position( event->any.x_pixel + 8, event->any.y_pixel, &x, &y); dyn->graph->popup_position( event->any.x_pixel + 8, event->any.y_pixel, &x, &y);
(dyn->graph->popup_menu_cb)( dyn->graph->parent_ctx, attrref, (dyn->graph->popup_menu_cb)( dyn->graph->parent_ctx, attrref,
xmenu_eItemType_Object, item_type, xmenu_mUtility_Ge, name, x, y);
xmenu_mUtility_Ge, name, x, y);
} }
break; break;
} }
......
...@@ -186,29 +186,46 @@ int XNav::getAllMenuItems( xmenu_sMenuCall *ip, ...@@ -186,29 +186,46 @@ int XNav::getAllMenuItems( xmenu_sMenuCall *ip,
sts = XNAV__SUCCESS; sts = XNAV__SUCCESS;
if ( ODD(sts)) { if ( ODD(sts)) {
sts = gdh_AttrrefToName( &ip->Pointed, aname, sizeof(aname), cdh_mName_volumeStrict); int create_object_button = 0;
if ( EVEN(sts)) return sts;
strcat( aname, ".");
strcat( aname, mrp->RefAttribute);
sts = gdh_GetAttributeCharacteristics( aname, &a_tid, &a_size, if ( strcmp( mrp->RefAttribute, "_SelfObject") == 0) {
&a_offs, &a_elem); // Object entry for attributes
if ( ODD(sts)) { char *s;
switch ( a_tid) {
case pwr_eType_AttrRef:
sts = gdh_GetObjectInfo( aname, &currentar, sizeof(currentar));
break;
case pwr_eType_Objid: {
pwr_tOid oid;
currentar = pwr_cNAttrRef; sts = gdh_AttrrefToName( &ip->Pointed, aname, sizeof(aname), cdh_mName_volumeStrict);
sts = gdh_GetObjectInfo( aname, &oid, sizeof(oid)); if ( EVEN(sts)) return sts;
currentar = cdh_ObjidToAref( oid); if ( (s = strrchr( aname, '.')))
break; *s = 0;
sts = gdh_NameToAttrref( pwr_cNOid, aname, &currentar);
if ( EVEN(sts)) return sts;
}
else {
sts = gdh_AttrrefToName( &ip->Pointed, aname, sizeof(aname), cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
strcat( aname, ".");
strcat( aname, mrp->RefAttribute);
sts = gdh_GetAttributeCharacteristics( aname, &a_tid, &a_size,
&a_offs, &a_elem);
if ( ODD(sts)) {
switch ( a_tid) {
case pwr_eType_AttrRef:
sts = gdh_GetObjectInfo( aname, &currentar, sizeof(currentar));
break;
case pwr_eType_Objid: {
pwr_tOid oid;
currentar = pwr_cNAttrRef;
sts = gdh_GetObjectInfo( aname, &oid, sizeof(oid));
currentar = cdh_ObjidToAref( oid);
break;
}
default:
sts = 0;
} }
default:
sts = 0;
} }
create_object_button = 0;
} }
if ( ODD(sts) && cdh_ObjidIsNotNull( currentar.Objid)) { if ( ODD(sts) && cdh_ObjidIsNotNull( currentar.Objid)) {
(*Item)->Level = Level; (*Item)->Level = Level;
...@@ -222,7 +239,7 @@ int XNav::getAllMenuItems( xmenu_sMenuCall *ip, ...@@ -222,7 +239,7 @@ int XNav::getAllMenuItems( xmenu_sMenuCall *ip,
// Create a label with current object name // Create a label with current object name
sts = gdh_AttrrefToName( &currentar, aname, sizeof(aname), sts = gdh_AttrrefToName( &currentar, aname, sizeof(aname),
cdh_mNName); cdh_mNName);
if ( ODD(sts)) { if ( ODD(sts) && create_object_button) {
(*Item)->Level = Level; (*Item)->Level = Level;
(*Item)->Item = xmenu_eMenuItem_Button; (*Item)->Item = xmenu_eMenuItem_Button;
(*Item)->MenuObject = pwr_cNObjid; (*Item)->MenuObject = pwr_cNObjid;
...@@ -239,8 +256,16 @@ int XNav::getAllMenuItems( xmenu_sMenuCall *ip, ...@@ -239,8 +256,16 @@ int XNav::getAllMenuItems( xmenu_sMenuCall *ip,
sts = gdh_GetAttrRefTid( &currentar, &current_cid); sts = gdh_GetAttrRefTid( &currentar, &current_cid);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
xmenu_eItemType item_type = ip->ItemType;
if ( currentar.Flags.b.Object)
ip->ItemType = xmenu_eItemType_Object;
else
ip->ItemType = xmenu_eItemType_AttrObject;
sts = GetObjectMenu(ip, current_cid, Item, Level, nItems, 0, &currentar); sts = GetObjectMenu(ip, current_cid, Item, Level, nItems, 0, &currentar);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
ip->ItemType = item_type;
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment