Commit 057dd1bb authored by claes's avatar claes

New focustimer class, different pixmaps in menu, list of volumes and nodes

parent 744477d1
...@@ -50,7 +50,9 @@ extern "C" { ...@@ -50,7 +50,9 @@ extern "C" {
#include "xtt_url.h" #include "xtt_url.h"
#include "co_lng.h" #include "co_lng.h"
#include "co_xhelp.h" #include "co_xhelp.h"
#include "co_wow.h"
#include "rt_xnav_msg.h" #include "rt_xnav_msg.h"
#include "xtt_focustimer.h"
// //
// //
...@@ -72,47 +74,50 @@ static XtActionsRec HotkeyActions[] = { ...@@ -72,47 +74,50 @@ static XtActionsRec HotkeyActions[] = {
}; };
static xnav_sStartMenu alarm_menu[] = { static xnav_sStartMenu alarm_menu[] = {
{ "Alarm list", xnav_eItemType_Command, (void *) "show alarm"}, { "Alarm list", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show alarm"},
{ "Event list", xnav_eItemType_Command, (void *) "show event"}, { "Event list", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show event"},
{ "Historical list", xnav_eItemType_Command, (void *) "show hist"}, { "Historical list", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show hist"},
{ "", 0, NULL}}; { "", 0, 0, NULL}};
static xnav_sStartMenu nethandler_menu[] = { static xnav_sStartMenu nethandler_menu[] = {
{ "Link", xnav_eItemType_Command, (void *) "show link"}, { "Link", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show link"},
{ "Subscription Client", xnav_eItemType_Command, (void *) "show subcli"}, { "Subscription Client", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show subcli"},
{ "Subscription Server", xnav_eItemType_Command, (void *) "show subsrv"}, { "Subscription Server", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show subsrv"},
{ "", 0, NULL}}; { "", 0, 0, NULL}};
static xnav_sStartMenu communication_menu[] = { static xnav_sStartMenu communication_menu[] = {
{ "RemNode", xnav_eItemType_Command, (void *) "show remnode"}, { "RemNode", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show remnode"},
{ "RemTrans", xnav_eItemType_Command, (void *) "show remtrans"}, { "RemTrans", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show remtrans"},
{ "", 0, NULL}}; { "", 0, 0, NULL}};
static xnav_sStartMenu logging_menu[] = { static xnav_sStartMenu logging_menu[] = {
{ "Logging entry 1", xnav_eItemType_Command, (void *) "show logging/entry=1"}, { "Logging entry 1", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=1"},
{ "Logging entry 2", xnav_eItemType_Command, (void *) "show logging/entry=2"}, { "Logging entry 2", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=2"},
{ "Logging entry 3", xnav_eItemType_Command, (void *) "show logging/entry=3"}, { "Logging entry 3", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=3"},
{ "Logging entry 4", xnav_eItemType_Command, (void *) "show logging/entry=4"}, { "Logging entry 4", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=4"},
{ "Logging entry 5", xnav_eItemType_Command, (void *) "show logging/entry=5"}, { "Logging entry 5", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=5"},
{ "Logging entry 6", xnav_eItemType_Command, (void *) "show logging/entry=6"}, { "Logging entry 6", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=6"},
{ "Logging entry 7", xnav_eItemType_Command, (void *) "show logging/entry=7"}, { "Logging entry 7", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=7"},
{ "Logging entry 8", xnav_eItemType_Command, (void *) "show logging/entry=8"}, { "Logging entry 8", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=8"},
{ "Logging entry 9", xnav_eItemType_Command, (void *) "show logging/entry=9"}, { "Logging entry 9", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=9"},
{ "Logging entry 10", xnav_eItemType_Command, (void *) "show logging/entry=10"}, { "Logging entry 10", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show logging/entry=10"},
{ "", 0, NULL}}; { "", 0, 0, NULL}};
static xnav_sStartMenu system_menu[] = { static xnav_sStartMenu system_menu[] = {
{ "Nethandler", xnav_eItemType_Menu, (void *)&nethandler_menu}, { "Nethandler", xnav_eItemType_Menu, menu_ePixmap_Map, (void *)&nethandler_menu},
{ "Communication", xnav_eItemType_Menu, (void *)&communication_menu}, { "Communication", xnav_eItemType_Menu, menu_ePixmap_Map, (void *)&communication_menu},
{ "Device", xnav_eItemType_Command, (void *) "show device"}, { "Device", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show device"},
{ "PlcThread", xnav_eItemType_Command, (void *) "show plcthread"}, { "PlcThread", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show plcthread"},
{ "PlcPgm", xnav_eItemType_Command, (void *) "show plcpgm"}, { "PlcPgm", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show plcpgm"},
{ "Logging", xnav_eItemType_Menu, (void *)&logging_menu}, { "Logging", xnav_eItemType_Menu, menu_ePixmap_Map, (void *)&logging_menu},
{ "System Messages", xnav_eItemType_Command, (void *) "open consolelog"}, { "System Messages", xnav_eItemType_Command, menu_ePixmap_List, (void *) "open consolelog"},
{ "", 0, NULL}}; { "System Status", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show nodeinfo"},
{ "Nodes", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show nodeobjects"},
{ "Volumes", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show volumes"},
{ "", 0, 0, NULL}};
static xnav_sStartMenu root_menu[] = { static xnav_sStartMenu root_menu[] = {
{ "Database", xnav_eItemType_Command, (void *) "show database"}, { "Database", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show database"},
{ "Alarm", xnav_eItemType_Menu, (void *)&alarm_menu}, { "Alarm", xnav_eItemType_Menu, menu_ePixmap_Map, (void *)&alarm_menu},
{ "Store", xnav_eItemType_Command, (void *) "show file"}, { "Store", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show file"},
{ "System", xnav_eItemType_Menu, (void *)&system_menu}, { "System", xnav_eItemType_Menu, menu_ePixmap_Map, (void *)&system_menu},
{ "Exit", xnav_eItemType_Command, (void *) "exit"}, { "Close", xnav_eItemType_Command, menu_ePixmap_Leaf, (void *) "exit"},
{ "", 0, NULL}}; { "", 0, 0, NULL}};
...@@ -139,6 +144,7 @@ typedef struct xtt_sCtx { ...@@ -139,6 +144,7 @@ typedef struct xtt_sCtx {
Widget india_label; Widget india_label;
Widget india_text; Widget india_text;
void (*india_ok_cb)( struct xtt_sCtx *, char *); void (*india_ok_cb)( struct xtt_sCtx *, char *);
FocusTimer focustimer;
} *xtt_tCtx; } *xtt_tCtx;
static Xtt *hot_xtt; static Xtt *hot_xtt;
...@@ -366,16 +372,24 @@ static void xtt_message( void *ctx, char severity, char *message) ...@@ -366,16 +372,24 @@ static void xtt_message( void *ctx, char severity, char *message)
XmStringFree( cstr); XmStringFree( cstr);
} }
static void xtt_close( void *ctx) static void xtt_close_ok( void *ctx, void *data)
{ {
Xtt *xtt = (Xtt *) ctx; Xtt *xtt = (Xtt *) ctx;
if ( !xtt->xnav->op)
{
delete xtt->xnav; delete xtt->xnav;
exit(0); exit(0);
}
static void xtt_close( void *ctx)
{
Xtt *xtt = (Xtt *) ctx;
if ( !xtt->xnav->op) {
wow_DisplayQuestion( xtt, xtt->toplevel, "Confirm",
"Do you want to close", xtt_close_ok, 0, 0);
// delete xtt->xnav;
// exit(0);
} }
else else {
{
xtt->xnav->displayed = 0; xtt->xnav->displayed = 0;
flow_UnmapWidget( xtt->toplevel); flow_UnmapWidget( xtt->toplevel);
} }
...@@ -555,6 +569,7 @@ static void xtt_activate_opengraph( Widget w, Xtt *xtt, XmAnyCallbackStruct *dat ...@@ -555,6 +569,7 @@ static void xtt_activate_opengraph( Widget w, Xtt *xtt, XmAnyCallbackStruct *dat
int sts; int sts;
pwr_tClassId classid; pwr_tClassId classid;
char name[120]; char name[120];
char vname[120];
char classname[80]; char classname[80];
char filename[120]; char filename[120];
char fname[120]; char fname[120];
...@@ -580,12 +595,16 @@ static void xtt_activate_opengraph( Widget w, Xtt *xtt, XmAnyCallbackStruct *dat ...@@ -580,12 +595,16 @@ static void xtt_activate_opengraph( Widget w, Xtt *xtt, XmAnyCallbackStruct *dat
name, sizeof(name), cdh_mNName); name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return; if ( EVEN(sts)) return;
sts = gdh_ObjidToName( attrref.Objid,
vname, sizeof(vname), cdh_mName_volumeStrict);
if ( EVEN(sts)) return;
sts = gdh_GetObjectClass( attrref.Objid, &classid); sts = gdh_GetObjectClass( attrref.Objid, &classid);
if ( EVEN(sts)) return; if ( EVEN(sts)) return;
if ( classid == pwr_cClass_DsTrend || classid == pwr_cClass_PlotGroup) { if ( classid == pwr_cClass_DsTrend || classid == pwr_cClass_PlotGroup) {
// Open trend // Open trend
sprintf( cmd, "open trend /name=%s /title=\"%s\"", name, name); sprintf( cmd, "open trend /name=%s /title=\"%s\"", vname, name);
xtt->xnav->command( cmd); xtt->xnav->command( cmd);
return; return;
...@@ -616,7 +635,7 @@ static void xtt_activate_opengraph( Widget w, Xtt *xtt, XmAnyCallbackStruct *dat ...@@ -616,7 +635,7 @@ static void xtt_activate_opengraph( Widget w, Xtt *xtt, XmAnyCallbackStruct *dat
} }
} }
sprintf( cmd, "open graph %s/inst=%s/name=\"%s\"", sprintf( cmd, "open graph %s/inst=%s/name=\"%s\"",
filename, name, name); filename, vname, name);
// Add scrollbars for some classes // Add scrollbars for some classes
switch ( classid) { switch ( classid) {
...@@ -790,8 +809,21 @@ static void xtt_action_inputfocus( Widget w, XmAnyCallbackStruct *data) ...@@ -790,8 +809,21 @@ static void xtt_action_inputfocus( Widget w, XmAnyCallbackStruct *data)
XtSetArg (args[0], XmNuserData, &xtt); XtSetArg (args[0], XmNuserData, &xtt);
XtGetValues (w, args, 1); XtGetValues (w, args, 1);
if ( mrm_IsIconicState(w))
return;
if ( xtt->xnav) { if ( xtt->xnav) {
if ( xtt->focustimer.disabled()) {
// printf( "Inputfocus disabled\n");
return;
}
else {
// printf( "Set Inputfocus\n");
}
xtt->xnav->set_inputfocus(); xtt->xnav->set_inputfocus();
xtt->focustimer.disable( xtt->toplevel, 400);
} }
} }
......
...@@ -38,6 +38,10 @@ extern "C" { ...@@ -38,6 +38,10 @@ extern "C" {
#include "xtt_xnav.h" #include "xtt_xnav.h"
#endif #endif
#ifndef xtt_focustimer_h
#include "xtt_focustimer.h"
#endif
class Xtt { class Xtt {
public: public:
Xtt( int argc, char *argv[], int *sts); Xtt( int argc, char *argv[], int *sts);
...@@ -65,6 +69,7 @@ class Xtt { ...@@ -65,6 +69,7 @@ class Xtt {
void (*india_ok_cb)( Xtt *, char *); void (*india_ok_cb)( Xtt *, char *);
qcom_sQid queid; qcom_sQid queid;
XtIntervalId timerid; XtIntervalId timerid;
FocusTimer focustimer;
}; };
#endif #endif
......
...@@ -32,6 +32,7 @@ extern "C" { ...@@ -32,6 +32,7 @@ extern "C" {
#include "flow_x.h" #include "flow_x.h"
} }
#include "co_lng.h" #include "co_lng.h"
#include "co_mrm_util.h"
#include "xtt_ev.h" #include "xtt_ev.h"
#include "rt_xnav_msg.h" #include "rt_xnav_msg.h"
...@@ -392,8 +393,16 @@ static void ev_eve_action_inputfocus( Widget w, XmAnyCallbackStruct *data) ...@@ -392,8 +393,16 @@ static void ev_eve_action_inputfocus( Widget w, XmAnyCallbackStruct *data)
XtSetArg (args[0], XmNuserData, &ev); XtSetArg (args[0], XmNuserData, &ev);
XtGetValues (w, args, 1); XtGetValues (w, args, 1);
if ( ev && ev->eve_displayed) if ( mrm_IsIconicState(w))
return;
if ( ev && ev->eve_displayed) {
if ( ev->eve_focustimer.disabled())
return;
ev->eve->set_input_focus(); ev->eve->set_input_focus();
ev->eve_focustimer.disable( ev->toplevel_eve, 400);
}
} }
static void ev_ala_action_inputfocus( Widget w, XmAnyCallbackStruct *data) static void ev_ala_action_inputfocus( Widget w, XmAnyCallbackStruct *data)
...@@ -404,8 +413,16 @@ static void ev_ala_action_inputfocus( Widget w, XmAnyCallbackStruct *data) ...@@ -404,8 +413,16 @@ static void ev_ala_action_inputfocus( Widget w, XmAnyCallbackStruct *data)
XtSetArg (args[0], XmNuserData, &ev); XtSetArg (args[0], XmNuserData, &ev);
XtGetValues (w, args, 1); XtGetValues (w, args, 1);
if ( ev && ev->ala_displayed) if ( mrm_IsIconicState(w))
return;
if ( ev && ev->ala_displayed) {
if ( ev->ala_focustimer.disabled())
return;
ev->ala->set_input_focus(); ev->ala->set_input_focus();
ev->ala_focustimer.disable( ev->toplevel_ala, 400);
}
} }
static void ev_eve_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data) static void ev_eve_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data)
......
...@@ -24,6 +24,10 @@ extern "C" { ...@@ -24,6 +24,10 @@ extern "C" {
# include "xtt_evlist.h" # include "xtt_evlist.h"
#endif #endif
#ifndef xtt_focustimer_h
# include "xtt_focustimer.h"
#endif
class Ev { class Ev {
public: public:
Ev( Ev(
...@@ -68,6 +72,8 @@ class Ev { ...@@ -68,6 +72,8 @@ class Ev {
int beep; int beep;
int eve_size; int eve_size;
int ala_size; int ala_size;
FocusTimer eve_focustimer;
FocusTimer ala_focustimer;
int outunit_connect( pwr_tObjid user); int outunit_connect( pwr_tObjid user);
void update( double scantime); void update( double scantime);
...@@ -84,3 +90,6 @@ class Ev { ...@@ -84,3 +90,6 @@ class Ev {
}; };
#endif #endif
#ifndef xtt_focustimer_h
#define xtt_focustimer_h
class FocusTimer {
public:
FocusTimer() : set_focus_disabled(0), request_cnt(0), focus_timerid(0) {
}
void disable( Widget w, int time) {
set_focus_disabled++;
request_cnt = 0;
focus_timerid = XtAppAddTimeOut( XtWidgetToApplicationContext(w), time,
enable_set_focus, this);
}
int disabled() {
// Return false on first request after disable
request_cnt++;
return (request_cnt > 1);
}
private:
int set_focus_disabled;
int request_cnt;
XtIntervalId focus_timerid;
static void enable_set_focus( void *ft, XtIntervalId *id) {
((FocusTimer *)ft)->set_focus_disabled--;
}
public:
~FocusTimer() {
if ( set_focus_disabled)
XtRemoveTimeOut( focus_timerid);
}
};
#endif
...@@ -358,6 +358,8 @@ extern "C" void ge_delete( ge_tCtx gectx) ...@@ -358,6 +358,8 @@ extern "C" void ge_delete( ge_tCtx gectx)
{ {
if ( gectx->close_cb) if ( gectx->close_cb)
(gectx->close_cb)( gectx); (gectx->close_cb)( gectx);
if ( gectx->set_focus_disabled)
XtRemoveTimeOut( gectx->focus_timerid);
delete (Graph *)((Graph *)gectx->graph); delete (Graph *)((Graph *)gectx->graph);
XtDestroyWidget( gectx->toplevel); XtDestroyWidget( gectx->toplevel);
free( (char *) gectx); free( (char *) gectx);
......
...@@ -74,10 +74,17 @@ ItemObject::ItemObject( XNavBrow *brow, pwr_tObjid item_objid, ...@@ -74,10 +74,17 @@ ItemObject::ItemObject( XNavBrow *brow, pwr_tObjid item_objid,
if ( EVEN(sts)) throw co_error(sts); if ( EVEN(sts)) throw co_error(sts);
if ( !is_root) if ( !is_root)
{ {
if ( objid.oix != 0) {
sts = gdh_ObjidToName( objid, segname, sizeof(segname), cdh_mName_object); sts = gdh_ObjidToName( objid, segname, sizeof(segname), cdh_mName_object);
if ( EVEN(sts)) throw co_error(sts);
brow_CreateNode( brow->ctx, segname, brow->nc_object, brow_CreateNode( brow->ctx, segname, brow->nc_object,
dest, dest_code, (void *) this, 1, &node); dest, dest_code, (void *) this, 1, &node);
}
else {
sts = gdh_VolumeIdToName( objid.vid, segname, sizeof(segname));
brow_CreateNode( brow->ctx, segname, brow->nc_table,
dest, dest_code, (void *) this, 1, &node);
}
if ( EVEN(sts)) throw co_error(sts);
// Set pixmap // Set pixmap
sts = gdh_GetChild( objid, &child); sts = gdh_GetChild( objid, &child);
...@@ -97,14 +104,31 @@ ItemObject::ItemObject( XNavBrow *brow, pwr_tObjid item_objid, ...@@ -97,14 +104,31 @@ ItemObject::ItemObject( XNavBrow *brow, pwr_tObjid item_objid,
brow_SetAnnotation( node, 1, segname, strlen(segname)); brow_SetAnnotation( node, 1, segname, strlen(segname));
// Set description annotation // Set description annotation
sts = gdh_ObjidToName( objid, segname, sizeof(segname), cdh_mNName); sts = gdh_ObjidToName( objid, segname, sizeof(segname), cdh_mName_volumeStrict);
if ( EVEN(sts)) throw co_error(sts); if ( EVEN(sts)) throw co_error(sts);
if ( objid.oix != 0) {
strcat( segname, ".Description"); strcat( segname, ".Description");
sts = gdh_GetObjectInfo( segname, descr, sizeof(descr)); sts = gdh_GetObjectInfo( segname, descr, sizeof(descr));
if ( ODD(sts)) if ( ODD(sts))
brow_SetAnnotation( node, 2, descr, strlen(descr)); brow_SetAnnotation( node, 2, descr, strlen(descr));
}
else {
gdh_sVolumeInfo info;
sts = gdh_GetVolumeInfo( objid.vid, &info);
if ( ODD(sts)) {
time_AtoAscii( &info.time, time_eFormat_DateAndTime, descr, sizeof(descr));
strcat( descr, " ");
if ( info.isLoaded)
strcat( descr, "L");
if ( info.isCached)
strcat( descr, "C");
if ( info.isMounted)
strcat( descr, "M");
brow_SetAnnotation( node, 3, descr, strlen(descr));
}
}
} }
} }
...@@ -830,7 +854,12 @@ int ItemHelp::open_children( XNavBrow *brow, XNav *xnav, double x, double y) ...@@ -830,7 +854,12 @@ int ItemHelp::open_children( XNavBrow *brow, XNav *xnav, double x, double y)
} }
else if ( strcmp( link, "") != 0) else if ( strcmp( link, "") != 0)
{ {
if ( (strstr( link, ".htm") != 0) || (strstr( link, ".pdf") != 0)) { if ( strncmp( link, "$web:", 5) == 0) {
// Open the url
xnav_open_URL( &link[5]);
}
else if ( (strstr( link, ".htm") != 0) ||
(strstr( link, ".pdf") != 0)) {
// Open the url // Open the url
xnav_open_URL( link); xnav_open_URL( link);
} }
...@@ -882,7 +911,12 @@ int ItemHelpBold::open_children( XNavBrow *brow, XNav *xnav, double x, double y) ...@@ -882,7 +911,12 @@ int ItemHelpBold::open_children( XNavBrow *brow, XNav *xnav, double x, double y)
} }
else if ( strcmp( link, "") != 0) else if ( strcmp( link, "") != 0)
{ {
if ( (strstr( link, ".htm") != 0) || (strstr( link, ".pdf") != 0)) { if ( strncmp( link, "$web:", 5) == 0) {
// Open the url
xnav_open_URL( &link[5]);
}
else if ( (strstr( link, ".htm") != 0) ||
(strstr( link, ".pdf") != 0)) {
// Open the url // Open the url
xnav_open_URL( link); xnav_open_URL( link);
} }
...@@ -1111,29 +1145,48 @@ int ItemMenu::open_children( XNavBrow *brow, double x, double y) ...@@ -1111,29 +1145,48 @@ int ItemMenu::open_children( XNavBrow *brow, double x, double y)
// Display childlist // Display childlist
Item *item; Item *item;
xnav_sMenu *menu; xnav_sMenu *menu;
flow_sAnnotPixmap *pixmap;
brow_SetNodraw( brow->ctx); brow_SetNodraw( brow->ctx);
menu = *child_list; menu = *child_list;
while ( menu) while ( menu)
{ {
switch ( menu->item_type) switch ( menu->pixmap) {
{ case menu_ePixmap_Map:
pixmap = brow->pixmap_map;
break;
case menu_ePixmap_Graph:
pixmap = brow->pixmap_graph;
break;
case menu_ePixmap_Script:
pixmap = brow->pixmap_script;
break;
case menu_ePixmap_List:
pixmap = brow->pixmap_list;
break;
case menu_ePixmap_Leaf:
pixmap = brow->pixmap_leaf;
break;
default:
pixmap = brow->pixmap_map;
}
switch ( menu->item_type) {
case xnav_eItemType_Menu: case xnav_eItemType_Menu:
item = (Item *) new ItemMenu( brow, menu->title, node, item = (Item *) new ItemMenu( brow, menu->title, node,
flow_eDest_IntoLast, &menu->child_list, flow_eDest_IntoLast, &menu->child_list,
0); 0);
break; break;
case xnav_eItemType_Command: case xnav_eItemType_Command:
item = (Item *) new ItemCommand( brow, menu->title, node, item = (Item *) new ItemCommand( brow, menu->title, 0, node,
flow_eDest_IntoLast, menu->command, 0, flow_eDest_IntoLast, menu->command, 0,
brow->pixmap_map); pixmap);
break; break;
default: default:
; ;
} }
menu = menu->next; menu = menu->next;
if ( !is_root) if ( !is_root) {
{
brow_SetOpen( node, xnav_mOpen_Children); brow_SetOpen( node, xnav_mOpen_Children);
brow_SetAnnotPixmap( node, 0, brow->pixmap_openmap); brow_SetAnnotPixmap( node, 0, brow->pixmap_openmap);
} }
...@@ -1167,7 +1220,7 @@ int ItemMenu::close( XNavBrow *brow, double x, double y) ...@@ -1167,7 +1220,7 @@ int ItemMenu::close( XNavBrow *brow, double x, double y)
return 1; return 1;
} }
ItemCommand::ItemCommand( XNavBrow *brow, char *item_name, ItemCommand::ItemCommand( XNavBrow *brow, char *item_name, char *item_text,
brow_tNode dest, flow_eDest dest_code, char *item_command, brow_tNode dest, flow_eDest dest_code, char *item_command,
int item_is_root, flow_sAnnotPixmap *pixmap) : int item_is_root, flow_sAnnotPixmap *pixmap) :
Item( pwr_cNObjid, item_is_root) Item( pwr_cNObjid, item_is_root)
...@@ -1185,6 +1238,8 @@ ItemCommand::ItemCommand( XNavBrow *brow, char *item_name, ...@@ -1185,6 +1238,8 @@ ItemCommand::ItemCommand( XNavBrow *brow, char *item_name,
brow_SetAnnotPixmap( node, 0, pixmap); brow_SetAnnotPixmap( node, 0, pixmap);
// Set object name annotation // Set object name annotation
brow_SetAnnotation( node, 0, name, strlen(name)); brow_SetAnnotation( node, 0, name, strlen(name));
if ( item_text != 0)
brow_SetAnnotation( node, 1, item_text, strlen(item_text));
} }
} }
......
...@@ -276,7 +276,7 @@ class ItemMenu : public Item { ...@@ -276,7 +276,7 @@ class ItemMenu : public Item {
class ItemCommand : public Item { class ItemCommand : public Item {
public: public:
ItemCommand( XNavBrow *brow, char *item_name, ItemCommand( XNavBrow *brow, char *item_name, char *item_text,
brow_tNode dest, flow_eDest dest_code, char *item_command, brow_tNode dest, flow_eDest dest_code, char *item_command,
int item_is_root, flow_sAnnotPixmap *pixmap); int item_is_root, flow_sAnnotPixmap *pixmap);
char command[200]; char command[200];
......
...@@ -2658,28 +2658,28 @@ int XNav::show_logging( int index) ...@@ -2658,28 +2658,28 @@ int XNav::show_logging( int index)
(void *) &logg[index].active, NULL, flow_eDest_IntoLast); (void *) &logg[index].active, NULL, flow_eDest_IntoLast);
sprintf( command, "logging set/insert/entry=%d", entry); sprintf( command, "logging set/insert/entry=%d", entry);
new ItemCommand( brow, Lng::translate("Insert"), NULL, new ItemCommand( brow, Lng::translate("Insert"), 0, NULL,
flow_eDest_IntoLast, command, 0, brow->pixmap_action); flow_eDest_IntoLast, command, 0, brow->pixmap_action);
sprintf( command, "logging start/entry=%d", entry); sprintf( command, "logging start/entry=%d", entry);
new ItemCommand( brow, Lng::translate("Start"), NULL, new ItemCommand( brow, Lng::translate("Start"), 0, NULL,
flow_eDest_IntoLast, command, 0, brow->pixmap_action); flow_eDest_IntoLast, command, 0, brow->pixmap_action);
sprintf( command, "logging stop/entry=%d", entry); sprintf( command, "logging stop/entry=%d", entry);
new ItemCommand( brow, Lng::translate("Stop"), NULL, new ItemCommand( brow, Lng::translate("Stop"), 0, NULL,
flow_eDest_IntoLast, command, 0, brow->pixmap_action); flow_eDest_IntoLast, command, 0, brow->pixmap_action);
sprintf( command, "logging store/entry=%d/file=rtt_store_logg%d.rtt_com", sprintf( command, "logging store/entry=%d/file=rtt_store_logg%d.rtt_com",
entry, entry); entry, entry);
new ItemCommand( brow, Lng::translate("Store"), NULL, new ItemCommand( brow, Lng::translate("Store"), 0, NULL,
flow_eDest_IntoLast, command, 0, brow->pixmap_action); flow_eDest_IntoLast, command, 0, brow->pixmap_action);
sprintf( command, "@rtt_store_logg%d", entry); sprintf( command, "@rtt_store_logg%d", entry);
new ItemCommand( brow, Lng::translate("Restore"), NULL, new ItemCommand( brow, Lng::translate("Restore"), 0, NULL,
flow_eDest_IntoLast, command, 0, brow->pixmap_action); flow_eDest_IntoLast, command, 0, brow->pixmap_action);
sprintf( command, "open loggfile/entry=current"); sprintf( command, "open loggfile/entry=current");
new ItemCommand( brow, Lng::translate("ShowFile"), NULL, new ItemCommand( brow, Lng::translate("ShowFile"), 0, NULL,
flow_eDest_IntoLast, command, 0, brow->pixmap_action); flow_eDest_IntoLast, command, 0, brow->pixmap_action);
new ItemLocal( brow, Lng::translate("Time (ms)"), "logg_Time", new ItemLocal( brow, Lng::translate("Time (ms)"), "logg_Time",
...@@ -2944,6 +2944,7 @@ xnav_sMenu *XNav::menu_tree_build_children( xnav_sStartMenu *first_child, ...@@ -2944,6 +2944,7 @@ xnav_sMenu *XNav::menu_tree_build_children( xnav_sStartMenu *first_child,
menu_p->item_type = start_menu_p->item_type; menu_p->item_type = start_menu_p->item_type;
strcpy( menu_p->title, Lng::translate(start_menu_p->title)); strcpy( menu_p->title, Lng::translate(start_menu_p->title));
strcpy( menu_p->command, (char *)start_menu_p->action); strcpy( menu_p->command, (char *)start_menu_p->action);
menu_p->pixmap = (menu_ePixmap) start_menu_p->pixmap;
if ( first) if ( first)
{ {
return_menu = menu_p; return_menu = menu_p;
...@@ -3024,7 +3025,7 @@ int XNav::menu_tree_delete( char *name) ...@@ -3024,7 +3025,7 @@ int XNav::menu_tree_delete( char *name)
return 1; return 1;
} }
int XNav::menu_tree_insert( char *title, int item_type, char *command, int XNav::menu_tree_insert( char *title, int item_type, char *command, menu_ePixmap pixmap,
char *destination, int dest_code, xnav_sMenu **menu_item) char *destination, int dest_code, xnav_sMenu **menu_item)
{ {
xnav_sMenu *dest_item; xnav_sMenu *dest_item;
...@@ -3045,12 +3046,14 @@ int XNav::menu_tree_insert( char *title, int item_type, char *command, ...@@ -3045,12 +3046,14 @@ int XNav::menu_tree_insert( char *title, int item_type, char *command,
menu_p->item_type = item_type; menu_p->item_type = item_type;
strcpy( menu_p->title, title); strcpy( menu_p->title, title);
strcpy( menu_p->command, command); strcpy( menu_p->command, command);
menu_p->pixmap = pixmap;
break; break;
case xnav_eItemType_Menu: case xnav_eItemType_Menu:
default: default:
menu_p = (xnav_sMenu *) calloc( 1, sizeof(xnav_sMenu)); menu_p = (xnav_sMenu *) calloc( 1, sizeof(xnav_sMenu));
menu_p->item_type = item_type; menu_p->item_type = item_type;
strcpy( menu_p->title, title); strcpy( menu_p->title, title);
menu_p->pixmap = pixmap;
} }
if ( !destination) if ( !destination)
......
...@@ -115,9 +115,18 @@ typedef enum { ...@@ -115,9 +115,18 @@ typedef enum {
xnav_eSearchType_RegularExpr xnav_eSearchType_RegularExpr
} xnav_eSearchType; } xnav_eSearchType;
typedef enum {
menu_ePixmap_Map,
menu_ePixmap_Graph,
menu_ePixmap_Script,
menu_ePixmap_List,
menu_ePixmap_Leaf
} menu_ePixmap;
typedef struct { typedef struct {
char title[80]; char title[80];
int item_type; int item_type;
int pixmap;
void *action; void *action;
} xnav_sStartMenu; } xnav_sStartMenu;
...@@ -125,6 +134,7 @@ typedef struct xnav_s_Menu { ...@@ -125,6 +134,7 @@ typedef struct xnav_s_Menu {
char title[80]; char title[80];
int item_type; int item_type;
char command[256]; char command[256];
menu_ePixmap pixmap;
struct xnav_s_Menu *child_list; struct xnav_s_Menu *child_list;
struct xnav_s_Menu *parent; struct xnav_s_Menu *parent;
struct xnav_s_Menu *next; struct xnav_s_Menu *next;
...@@ -319,7 +329,7 @@ class XNav { ...@@ -319,7 +329,7 @@ class XNav {
int menu_tree_search( char *name, xnav_sMenu **menu_item); int menu_tree_search( char *name, xnav_sMenu **menu_item);
int menu_tree_search_children( char *name, xnav_sMenu *child_list, int menu_tree_search_children( char *name, xnav_sMenu *child_list,
xnav_sMenu **menu_item); xnav_sMenu **menu_item);
int menu_tree_insert( char *title, int item_type, char *command, int menu_tree_insert( char *title, int item_type, char *command, menu_ePixmap pixmap,
char *destination, int dest_code, xnav_sMenu **menu_item); char *destination, int dest_code, xnav_sMenu **menu_item);
int menu_tree_delete( char *name); int menu_tree_delete( char *name);
void pop(); void pop();
......
...@@ -115,6 +115,7 @@ extern "C" { ...@@ -115,6 +115,7 @@ extern "C" {
#include "xnav_bitmap_crrread12.h" #include "xnav_bitmap_crrread12.h"
#include "xnav_bitmap_crrwrite12.h" #include "xnav_bitmap_crrwrite12.h"
#include "xnav_bitmap_script12.h" #include "xnav_bitmap_script12.h"
#include "xnav_bitmap_list12.h"
#include "xnav_bitmap_graph12.h" #include "xnav_bitmap_graph12.h"
#include "xnav_bitmap_curve12.h" #include "xnav_bitmap_curve12.h"
#include "xnav_bitmap_file12.h" #include "xnav_bitmap_file12.h"
...@@ -151,6 +152,7 @@ void XNavBrow::free_pixmaps() ...@@ -151,6 +152,7 @@ void XNavBrow::free_pixmaps()
brow_FreeAnnotPixmap( ctx, pixmap_crrread); brow_FreeAnnotPixmap( ctx, pixmap_crrread);
brow_FreeAnnotPixmap( ctx, pixmap_crrwrite); brow_FreeAnnotPixmap( ctx, pixmap_crrwrite);
brow_FreeAnnotPixmap( ctx, pixmap_script); brow_FreeAnnotPixmap( ctx, pixmap_script);
brow_FreeAnnotPixmap( ctx, pixmap_list);
brow_FreeAnnotPixmap( ctx, pixmap_file); brow_FreeAnnotPixmap( ctx, pixmap_file);
brow_FreeAnnotPixmap( ctx, pixmap_graph); brow_FreeAnnotPixmap( ctx, pixmap_graph);
brow_FreeAnnotPixmap( ctx, pixmap_curve); brow_FreeAnnotPixmap( ctx, pixmap_curve);
...@@ -506,6 +508,15 @@ void XNavBrow::allocate_pixmaps() ...@@ -506,6 +508,15 @@ void XNavBrow::allocate_pixmaps()
brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_script); brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_script);
for ( i = 0; i < 9; i++)
{
pixmap_data[i].width =xnav_bitmap_list12_width;
pixmap_data[i].height =xnav_bitmap_list12_height;
pixmap_data[i].bits = (char *)xnav_bitmap_list12_bits;
}
brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_list);
for ( i = 0; i < 9; i++) for ( i = 0; i < 9; i++)
{ {
pixmap_data[i].width =xnav_bitmap_graph12_width; pixmap_data[i].width =xnav_bitmap_graph12_width;
......
...@@ -42,6 +42,7 @@ class XNavBrow { ...@@ -42,6 +42,7 @@ class XNavBrow {
flow_sAnnotPixmap *pixmap_crrread; flow_sAnnotPixmap *pixmap_crrread;
flow_sAnnotPixmap *pixmap_crrwrite; flow_sAnnotPixmap *pixmap_crrwrite;
flow_sAnnotPixmap *pixmap_script; flow_sAnnotPixmap *pixmap_script;
flow_sAnnotPixmap *pixmap_list;
flow_sAnnotPixmap *pixmap_graph; flow_sAnnotPixmap *pixmap_graph;
flow_sAnnotPixmap *pixmap_curve; flow_sAnnotPixmap *pixmap_curve;
flow_sAnnotPixmap *pixmap_action; flow_sAnnotPixmap *pixmap_action;
......
...@@ -176,7 +176,7 @@ dcli_tCmdTable xnav_command_table[] = { ...@@ -176,7 +176,7 @@ dcli_tCmdTable xnav_command_table[] = {
&xnav_create_func, &xnav_create_func,
{ "dcli_arg1", "/TEXT", "/MENU", "/DESTINATION", { "dcli_arg1", "/TEXT", "/MENU", "/DESTINATION",
"/COMMAND", "/AFTER", "/BEFORE", "/FIRSTCHILD", "/COMMAND", "/AFTER", "/BEFORE", "/FIRSTCHILD",
"/LASTCHILD", "/CLASS", "/NAME", "/LASTCHILD", "/CLASS", "/NAME", "/PIXMAP",
""} ""}
}, },
{ {
...@@ -1529,6 +1529,119 @@ static int xnav_show_func( void *client_data, ...@@ -1529,6 +1529,119 @@ static int xnav_show_func( void *client_data,
xnav->message('I', msg); xnav->message('I', msg);
} }
} }
else if ( strncmp( arg1_str, "VOLUMES", strlen( arg1_str)) == 0)
{
/* Command is "SHOW VOLUMES" */
pwr_tVid vid;
pwr_tOid oid;
pwr_tStatus nsts;
int volume_cnt = 0;
Item *item;
sts = gdh_GetVolumeList( &vid);
while ( ODD(sts)) {
oid.oix = 0;
oid.vid = vid;
if ( !volume_cnt) {
xnav->brow_pop();
brow_SetNodraw( xnav->brow->ctx);
}
nsts = xnav->create_object_item( oid, NULL, flow_eDest_IntoLast, (void **)&item, 0);
volume_cnt++;
sts = gdh_GetNextVolume( vid, &vid);
}
brow_ResetNodraw( xnav->brow->ctx);
brow_Redraw( xnav->brow->ctx, 0);
}
else if ( strncmp( arg1_str, "NODEOBJECTS", strlen( arg1_str)) == 0)
{
/* Command is "SHOW NODEOBJECTS" */
pwr_tVid vid;
pwr_tOid oid;
pwr_tStatus nsts;
int node_cnt = 0;
Item *item;
gdh_sVolumeInfo info;
for ( sts = gdh_GetVolumeList( &vid);
ODD(sts);
sts = gdh_GetNextVolume( vid, &vid)) {
sts = gdh_GetVolumeInfo( vid, &info);
if ( EVEN(sts)) continue;
if ( info.cid != pwr_eClass_RootVolume || info.nid == 0)
continue;
sts = gdh_GetNodeObject( info.nid, &oid);
if ( EVEN(sts)) continue;
if ( !node_cnt) {
xnav->brow_pop();
brow_SetNodraw( xnav->brow->ctx);
}
nsts = xnav->create_object_item( oid, NULL, flow_eDest_IntoLast, (void **)&item, 0);
node_cnt++;
}
brow_ResetNodraw( xnav->brow->ctx);
brow_Redraw( xnav->brow->ctx, 0);
}
else if ( strncmp( arg1_str, "NODEINFO", strlen( arg1_str)) == 0)
{
/* Command is "SHOW NODEINFO" */
pwr_tVid vid;
pwr_tOid oid;
int node_cnt = 0;
Item *item;
gdh_sVolumeInfo info;
char name[80];
char vname[120];
char cmd[200];
char descr[120];
char *descr_p;
for ( sts = gdh_GetVolumeList( &vid);
ODD(sts);
sts = gdh_GetNextVolume( vid, &vid)) {
sts = gdh_GetVolumeInfo( vid, &info);
if ( EVEN(sts)) continue;
if ( info.cid != pwr_eClass_RootVolume || info.nid == 0)
continue;
sts = gdh_GetNodeObject( info.nid, &oid);
if ( EVEN(sts)) continue;
if ( !node_cnt) {
xnav->brow_pop();
brow_SetNodraw( xnav->brow->ctx);
}
sts = gdh_ObjidToName( oid, name, sizeof(name), cdh_mName_object);
if ( EVEN(sts)) return sts;
sts = gdh_ObjidToName( oid, vname, sizeof(vname), cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
sprintf( cmd, "open graph/class/inst=%s", vname);
// Set description annotation
strcat( vname, ".Description");
sts = gdh_GetObjectInfo( vname, descr, sizeof(descr));
if ( ODD(sts))
descr_p = descr;
else
descr_p = 0;
item = (Item *) new ItemCommand( xnav->brow, name, descr, NULL,
flow_eDest_IntoLast, cmd, 0,
xnav->brow->pixmap_list);
node_cnt++;
}
brow_ResetNodraw( xnav->brow->ctx);
brow_Redraw( xnav->brow->ctx, 0);
}
else else
{ {
/* This might be a system picture */ /* This might be a system picture */
...@@ -1808,7 +1921,7 @@ static int xnav_add_func( void *client_data, ...@@ -1808,7 +1921,7 @@ static int xnav_add_func( void *client_data,
if ( object) if ( object)
new ItemObject( xnav->brow, objid, NULL, flow_eDest_IntoLast, 0); new ItemObject( xnav->brow, objid, NULL, flow_eDest_IntoLast, 0);
else if ( command) else if ( command)
new ItemCommand( xnav->brow, text_str, NULL, new ItemCommand( xnav->brow, text_str, 0, NULL,
flow_eDest_IntoLast, command_str, 0, xnav->brow->pixmap_map); flow_eDest_IntoLast, command_str, 0, xnav->brow->pixmap_map);
// else // else
// new ItemMenu( xnav->brow, text_str, NULL, // new ItemMenu( xnav->brow, text_str, NULL,
...@@ -2808,6 +2921,8 @@ static int xnav_create_func( void *client_data, ...@@ -2808,6 +2921,8 @@ static int xnav_create_func( void *client_data,
char destination_str[80]; char destination_str[80];
char command_str[80]; char command_str[80];
char tmp_str[80]; char tmp_str[80];
char pixmap_str[80];
menu_ePixmap pixmap;
int dest_code; int dest_code;
int item_type; int item_type;
xnav_sMenu *menu_item; xnav_sMenu *menu_item;
...@@ -2846,7 +2961,24 @@ static int xnav_create_func( void *client_data, ...@@ -2846,7 +2961,24 @@ static int xnav_create_func( void *client_data,
else else
dest_code = xnav_eDestCode_After; dest_code = xnav_eDestCode_After;
sts = xnav->menu_tree_insert( text_str, item_type, command_str, if ( ODD( dcli_get_qualifier( "/PIXMAP", pixmap_str))) {
if ( strcmp( pixmap_str, "MAP") == 0)
pixmap = menu_ePixmap_Map;
else if ( strcmp( pixmap_str, "GRAPH") == 0)
pixmap = menu_ePixmap_Graph;
else if ( strcmp( pixmap_str, "SCRIPT") == 0)
pixmap = menu_ePixmap_Script;
else if ( strcmp( pixmap_str, "LIST") == 0)
pixmap = menu_ePixmap_List;
else if ( strcmp( pixmap_str, "LEAF") == 0)
pixmap = menu_ePixmap_Leaf;
else
pixmap = menu_ePixmap_Map;
}
else
pixmap = menu_ePixmap_Map;
sts = xnav->menu_tree_insert( text_str, item_type, command_str, pixmap,
destination_str, dest_code, &menu_item); destination_str, dest_code, &menu_item);
if ( EVEN(sts)) if ( EVEN(sts))
xnav->message('E',"Destination not found"); xnav->message('E',"Destination not found");
...@@ -5008,7 +5140,7 @@ int XNav::show_symbols() ...@@ -5008,7 +5140,7 @@ int XNav::show_symbols()
brow_SetNodraw( brow->ctx); brow_SetNodraw( brow->ctx);
new ItemHeader( brow, "Title", "Symbols", NULL, flow_eDest_IntoLast); new ItemHeader( brow, "Title", "Symbols", NULL, flow_eDest_IntoLast);
} }
new ItemCommand( brow, text, NULL, new ItemCommand( brow, text, 0, NULL,
flow_eDest_IntoLast, key, 0, brow->pixmap_symbol); flow_eDest_IntoLast, key, 0, brow->pixmap_symbol);
i++; i++;
} }
......
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