Commit fd2a9e78 authored by Claes Sjofors's avatar Claes Sjofors

Xtt, collection of all signals in an hierarchy and insert into a collection window

parent 5b9866ca
...@@ -841,8 +841,8 @@ shooting you often need to look at a number of different attributes simultaneous ...@@ -841,8 +841,8 @@ shooting you often need to look at a number of different attributes simultaneous
traversing the object tree and collecting attributes with Functions/Collect/Insert, Ctrl+V, traversing the object tree and collecting attributes with Functions/Collect/Insert, Ctrl+V,
and then activating Functions/Collect/Show these attributes are viewed on one page. and then activating Functions/Collect/Show these attributes are viewed on one page.
A collection view can be saved to a later session by the 'save' command. To save a collection A collection view can be saved to a later session by the 'save' command. To save a
view with the name 'mycollection' you write the command collection view with the name 'mycollection' you write the command
<c>> save/collect mycollection <c>> save/collect mycollection
...@@ -853,6 +853,18 @@ The name can be found in the 'Store' map, and can also be restored by the comman ...@@ -853,6 +853,18 @@ The name can be found in the 'Store' map, and can also be restored by the comman
<c>> @mycollection <c>> @mycollection
<h2>Collection window
A collection view can be copied to a separate window with Functions/Collect/Copy To Window.
Also an empty window can be created from Functions/Collect/New Window. New attributes are
added to the window by selecting the attribute in the runtime navigator, then selecting the
collection window and activating Edit/Insert (Ctrl+V). With Shift+ArrowUp and
Shift+ArrowDown attributes can be moved up and down in the window.
A collection window is saved from File/Save (Ctrl+S) with a specified name. It can later
be opened from Functions/Collect/Open in the runtime navigator, or File/Open in an
collection window. The desired window is opened from a list containing all saved collection
windows.
</topic> </topic>
<headerlevel> <headerlevel>
...@@ -1510,11 +1522,13 @@ Xtt commands ...@@ -1510,11 +1522,13 @@ Xtt commands
add parameter<t>Add an attribute to a picture <LINK> add parameter add parameter<t>Add an attribute to a picture <LINK> add parameter
add menu <t>Add a menu item to a xtt menu <LINK> add menu add menu <t>Add a menu item to a xtt menu <LINK> add menu
collect <t>Add an attribute to collect list <LINK> collect
call method <t>Call a xtt method for an object <LINK> call method call method <t>Call a xtt method for an object <LINK> call method
check method <t>Call a xtt method filter for an object <LINK> check method check method <t>Call a xtt method filter for an object <LINK> check method
collect <t>Add an attribute to collect list <LINK> collect
collect show<t>Show the collect list <LINK> collect show collect show<t>Show the collect list <LINK> collect show
collect clear<t>Clear the collect list <LINK> collect clear collect clear<t>Clear the collect list <LINK> collect clear
collect remove<t>Remove an attribute from the collect list <LINK> collect remove
collect open<t>Open a stored collect window <LINK> collect open
close alarmlist <t>Close alarmlist <LINK> close alarmlist close alarmlist <t>Close alarmlist <LINK> close alarmlist
close eventlist <t>Close eventlist <LINK> close eventlist close eventlist <t>Close eventlist <LINK> close eventlist
close graph <t>Close a graph <LINK> close graph close graph <t>Close a graph <LINK> close graph
...@@ -1692,13 +1706,29 @@ delete item <LINK> delete item ...@@ -1692,13 +1706,29 @@ delete item <LINK> delete item
Command collect Command collect
Add an attribute to the collection list. Add an attribute to the collection list.
If the name qualifier is omitted the current If the name qualifier is omitted the current selected attribute will
selected attribute will be collected. be collected.
The /newwindow and /addwindow qualifiers are usually used in command
files for stored collections windows (files of type .rtt_col)
<B>xtt> collect <B>xtt> collect
<B>xtt> collect /name= <B>xtt> collect /name=
<B>xtt> collect /name= /newwindow /width= /height= /zoomfactor= /scantime=
/title= /last
<B>xtt> collect /name= /addwindow /last
/name<t>Name of the attribute /name<t>Name of the attribute
/newwindow<t>Creates a new window and inserts the attrbute into
<t>this window.
/width <t>Window width.
/height <t>Window height.
/zoomfactor<t>Text zoom factor in new window.
/scantime <t>Update frequency for values.
/title <t>Window title.
/last <t>This is the last attribute to add for this window.
/addwindow <t>The attribute is added to the last created collect window.
Example Example
...@@ -1707,6 +1737,8 @@ xtt> collect /name=hql-hvk-Start.ActualValue ...@@ -1707,6 +1737,8 @@ xtt> collect /name=hql-hvk-Start.ActualValue
<H2>related subjects <H2>related subjects
collect show <LINK> collect show collect show <LINK> collect show
collect clear <LINK> collect clear collect clear <LINK> collect clear
collect remove <LINK> collect remove
collect open <LINK> collect open
</TOPIC> </TOPIC>
<TOPIC> collect show <style> function <TOPIC> collect show <style> function
...@@ -1731,8 +1763,38 @@ Clear the collect list. ...@@ -1731,8 +1763,38 @@ Clear the collect list.
<H2>related subjects <H2>related subjects
collect <LINK> collect collect <LINK> collect
collect show <LINK> collect show collect show <LINK> collect show
collect remove <LINK> collect remove
collect open <LINK> collect open
</TOPIC> </TOPIC>
<TOPIC> collect remove <style> function
Command collect remove
Clear an item in the collect list.
<B>xtt> collect remove
<H2>related subjects
collect <LINK> collect
collect show <LINK> collect show
collect open <LINK> collect open
</TOPIC>
<TOPIC> collect open <style> function
Command collect open /file=
Open a stored collection window. If file is not specified, a
list of store windows are displayed.
<B>xtt> collect open
<B>xtt> collect open /file=Motor2
<H2>related subjects
collect <LINK> collect
collect show <LINK> collect show
collect remove <LINK> collect remove
collect open <LINK> collect open
</TOPIC>
<TOPIC> create opmenuitem <style> function <TOPIC> create opmenuitem <style> function
Command create opmenuitem Command create opmenuitem
......
...@@ -723,6 +723,114 @@ finish: ...@@ -723,6 +723,114 @@ finish:
} }
/*************************************************************************
*
* Name: get_signals()
*
* Type int
*
* Type Parameter IOGF Description
*
* Description:
* Returns all signals under an object.
*
**************************************************************************/
int NavCrr::get_signals( char *filename,
char *objectname)
{
pwr_tFileName default_filename;
char line[1000];
int object_spaces;
pwr_tAName object;
pwr_tAName objname;
int spaces;
int first;
int sts;
char *s;
int signalcount = 0;
pwr_tFileName filestr;
int lines;
pwr_tVolumeId volid;
pwr_tObjid objid;
cdh_ToUpper( objectname, objectname);
/* Open file */
while ( 1) {
FILE *file;
/* Open file */
if ( filename) {
file = fopen( filestr, "r");
}
else {
/* Open file, first get the volume id */
sts = (name_to_objid_cb)( parent_ctx, objectname, &objid);
if ( EVEN(sts))
return NAV__OBJECTNOTFOUND;
volid = objid.vid;
sprintf( default_filename, "%srtt_crrs_%s.dat",
dcli_pwr_dir("pwrp_load"), nav_VolumeIdToStr( volid));
dcli_get_defaultfilename( default_filename, filestr, NULL);
file = fopen( filestr, "r");
}
if ( file == 0)
return NAV__NOFILE;
/* Get the hierarchy */
sts = nav_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines);
if ( EVEN(sts)) goto finish;
object_spaces = spaces;
first = 1;
while ( 1) {
if ( (s = strchr( object, ':')))
strcpy( objname, s+1);
else
strcpy( objname, object);
cdh_ToUpper( objname, objname);
if ( strncmp( objectname, objname, strlen(objectname)) == 0 &&
(objname[strlen(objectname)] == 0 ||
objname[strlen(objectname)] == '.' ||
objname[strlen(objectname)] == '-')) {
/* Hit, print this object */
signalcount++;
(insert_cb)( parent_ctx, parent_node,
navc_eItemType_Crossref,
object, 0, 0);
signalcount++;
sts = nav_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines);
if ( EVEN(sts)) goto finish;
}
else {
sts = nav_get_signal_line( file, line, sizeof( line),
&spaces, object, &lines);
if ( EVEN(sts)) goto finish;
}
}
finish:
fclose( file);
break;
}
if ( signalcount == 0)
return NAV__OBJECTNOTFOUND;
return NAV__SUCCESS;
}
/************************************************************************* /*************************************************************************
......
...@@ -66,6 +66,8 @@ class NavCrr { ...@@ -66,6 +66,8 @@ class NavCrr {
int crr_object( char *filename, char *objectname); int crr_object( char *filename, char *objectname);
int crr_code( char *filename, char *str, int brief, int func, int crr_code( char *filename, char *str, int brief, int func,
int case_sensitive); int case_sensitive);
int get_signals( char *filename,
char *objectname);
}; };
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
%# define load_cNameRttCrr "rtt_crr_%03.3d_%03.3d_%03.3d_%03.3d.dat" %# define load_cNameRttCrr "rtt_crr_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define load_cNameRttCrrObj "rtt_crro_%03.3d_%03.3d_%03.3d_%03.3d.dat" %# define load_cNameRttCrrObj "rtt_crro_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define load_cNameRttCrrCode "rtt_crrc_%03.3d_%03.3d_%03.3d_%03.3d.dat" %# define load_cNameRttCrrCode "rtt_crrc_%03.3d_%03.3d_%03.3d_%03.3d.dat"
%# define load_cNameRttPlc "rtt_plc_%03.3d_%03.3d_%03.3d_%03.3d.dat" %# define load_cNameRttSignals "rtt_crrs_%03.3d_%03.3d_%03.3d_%03.3d.dat"
% %
%#elif defined OS_LYNX || defined OS_LINUX || OS_MACOS || OS_FREEBSD %#elif defined OS_LYNX || defined OS_LINUX || OS_MACOS || OS_FREEBSD
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
%# define load_cNameRttCrr "rtt_crr_%3.3d_%3.3d_%3.3d_%3.3d.dat" %# define load_cNameRttCrr "rtt_crr_%3.3d_%3.3d_%3.3d_%3.3d.dat"
%# define load_cNameRttCrrObj "rtt_crro_%3.3d_%3.3d_%3.3d_%3.3d.dat" %# define load_cNameRttCrrObj "rtt_crro_%3.3d_%3.3d_%3.3d_%3.3d.dat"
%# define load_cNameRttCrrCode "rtt_crrc_%3.3d_%3.3d_%3.3d_%3.3d.dat" %# define load_cNameRttCrrCode "rtt_crrc_%3.3d_%3.3d_%3.3d_%3.3d.dat"
%# define load_cNameRttPlc "rtt_plc_%3.3d_%3.3d_%3.3d_%3.3d.dat" %# define load_cNameRttSignals "rtt_crrs_%3.3d_%3.3d_%3.3d_%3.3d.dat"
%# define load_cNamePkg "pwrp_pkg_%s_%04d.tgz" %# define load_cNamePkg "pwrp_pkg_%s_%04d.tgz"
%# define load_cNameCustomBuild "$pwrp_exe/custom_build.sh" %# define load_cNameCustomBuild "$pwrp_exe/custom_build.sh"
%#endif %#endif
......
...@@ -574,6 +574,50 @@ void wb_crrgen::write( pwr_tStatus *rsts) ...@@ -574,6 +574,50 @@ void wb_crrgen::write( pwr_tStatus *rsts)
} }
fps.close(); fps.close();
// Signal list
sprintf( fname, "$pwrp_load/rtt_crrs_%s.dat", vldh_VolumeIdToStr( m_sp->vid()));
dcli_translate_filename( fname, fname);
ofstream fpsl( fname);
if ( !fps) {
*rsts = LDH__FILEOPEN;
return;
}
pwr_tCid siglist[] = {pwr_cClass_Di, pwr_cClass_Do, pwr_cClass_Dv,
pwr_cClass_Ai, pwr_cClass_Ao, pwr_cClass_Av,
pwr_cClass_Ii, pwr_cClass_Io, pwr_cClass_Iv,
pwr_cClass_Co, pwr_cClass_Sv, pwr_cClass_ATv, pwr_cClass_DTv};
for ( int i = 0; i < int(sizeof(siglist)/sizeof(siglist[0])); i++) {
pwr_tAttrRef aref;
for ( m_sp->aref( siglist[i], &aref); m_sp->oddSts(); m_sp->nextAref( siglist[i], &aref, &aref)) {
wb_object o = m_sp->object( aref.Objid);
if ( !o) continue;
// Skip if in LibHier
bool in_libhier = false;
for ( wb_object p = o.parent(); p; p = p.parent()) {
if ( p.cid() == pwr_eClass_LibHier) {
in_libhier = true;
break;
}
}
if ( in_libhier)
continue;
wb_attribute a = m_sp->attribute( &aref);
if ( !a) continue;
fpsl << a.longName().name( cdh_mName_path | cdh_mName_object | cdh_mName_attribute) << endl;
}
}
fpsl.close();
sprintf( fname, "$pwrp_load/rtt_crro_%s.dat", vldh_VolumeIdToStr( m_sp->vid())); sprintf( fname, "$pwrp_load/rtt_crro_%s.dat", vldh_VolumeIdToStr( m_sp->vid()));
dcli_translate_filename( fname, fname); dcli_translate_filename( fname, fname);
......
...@@ -261,14 +261,14 @@ void wb_pkg::readConfig() ...@@ -261,14 +261,14 @@ void wb_pkg::readConfig()
pkg_pattern rttcrrcode( fname); pkg_pattern rttcrrcode( fname);
n.push_back( rttcrrcode); n.push_back( rttcrrcode);
// RttPlc-file // RttSignals
#if 0
strcpy( dir, "$pwrp_load/"); strcpy( dir, "$pwrp_load/");
sprintf( fname, "%s" load_cNameRttPlc, sprintf( fname, "%s" load_cNameRttSignals,
dir, vid.v.vid_3, vid.v.vid_2, vid.v.vid_1, vid.v.vid_0); dir, vid.v.vid_3, vid.v.vid_2, vid.v.vid_1, vid.v.vid_0);
pkg_pattern rttplc( fname); pkg_pattern rttsignals( fname);
n.push_back( rttplc); n.push_back( rttsignals);
#endif
} }
} }
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include "xtt_xnav_gtk.h" #include "xtt_xnav_gtk.h"
#include "xtt_item.h" #include "xtt_item.h"
#include "xtt_url.h" #include "xtt_url.h"
#include "xtt_xcolwind.h"
#include "co_lng.h" #include "co_lng.h"
#include "cow_xhelp_gtk.h" #include "cow_xhelp_gtk.h"
#include "cow_wow_gtk.h" #include "cow_wow_gtk.h"
...@@ -433,7 +434,7 @@ void XttGtk::activate_collect_window( GtkWidget *w, gpointer data) ...@@ -433,7 +434,7 @@ void XttGtk::activate_collect_window( GtkWidget *w, gpointer data)
if ( !xtt->xnav->is_authorized()) if ( !xtt->xnav->is_authorized())
return; return;
xtt->xnav->collect_window( 1); xtt->xnav->collect_window( 1, xcolwind_eType_Collect);
} }
void XttGtk::activate_collect_new_window( GtkWidget *w, gpointer data) void XttGtk::activate_collect_new_window( GtkWidget *w, gpointer data)
...@@ -443,7 +444,27 @@ void XttGtk::activate_collect_new_window( GtkWidget *w, gpointer data) ...@@ -443,7 +444,27 @@ void XttGtk::activate_collect_new_window( GtkWidget *w, gpointer data)
if ( !xtt->xnav->is_authorized()) if ( !xtt->xnav->is_authorized())
return; return;
xtt->xnav->collect_window( 0); xtt->xnav->collect_window( 0, xcolwind_eType_Collect);
}
void XttGtk::activate_collect_signals( GtkWidget *w, gpointer data)
{
Xtt *xtt = (Xtt *)data;
if ( !xtt->xnav->is_authorized())
return;
xtt->xnav->collect_window( 0, xcolwind_eType_CollectSignals);
}
void XttGtk::activate_collect_iosignals( GtkWidget *w, gpointer data)
{
Xtt *xtt = (Xtt *)data;
if ( !xtt->xnav->is_authorized())
return;
xtt->xnav->collect_window( 0, xcolwind_eType_CollectIOSignals);
} }
void XttGtk::activate_collect_open( GtkWidget *w, gpointer data) void XttGtk::activate_collect_open( GtkWidget *w, gpointer data)
...@@ -817,6 +838,20 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) : ...@@ -817,6 +838,20 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) :
g_signal_connect( functions_collect_new_window, "activate", g_signal_connect( functions_collect_new_window, "activate",
G_CALLBACK(XttGtk::activate_collect_new_window), this); G_CALLBACK(XttGtk::activate_collect_new_window), this);
GtkWidget *functions_collect_signals = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Signals"));
g_signal_connect( functions_collect_signals, "activate",
G_CALLBACK(XttGtk::activate_collect_signals), this);
gtk_widget_add_accelerator( functions_collect_signals, "activate", accel_g,
't', GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK),
GTK_ACCEL_VISIBLE);
GtkWidget *functions_collect_iosignals = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_IO Signals"));
g_signal_connect( functions_collect_iosignals, "activate",
G_CALLBACK(XttGtk::activate_collect_iosignals), this);
gtk_widget_add_accelerator( functions_collect_iosignals, "activate", accel_g,
't', GdkModifierType(GDK_CONTROL_MASK),
GTK_ACCEL_VISIBLE);
GtkWidget *functions_collect_open = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Open")); GtkWidget *functions_collect_open = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Open"));
g_signal_connect( functions_collect_open, "activate", g_signal_connect( functions_collect_open, "activate",
G_CALLBACK(XttGtk::activate_collect_open), this); G_CALLBACK(XttGtk::activate_collect_open), this);
...@@ -830,6 +865,8 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) : ...@@ -830,6 +865,8 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) :
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_clear); gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_clear);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_window); gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_window);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_new_window); gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_new_window);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_signals);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_iosignals);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_open); gtk_menu_shell_append(GTK_MENU_SHELL(functions_collect_menu), functions_collect_open);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions_collect), gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions_collect),
......
...@@ -109,6 +109,8 @@ class XttGtk : public Xtt { ...@@ -109,6 +109,8 @@ class XttGtk : public Xtt {
static void activate_collect_clear( GtkWidget *w, gpointer data); static void activate_collect_clear( GtkWidget *w, gpointer data);
static void activate_collect_window( GtkWidget *w, gpointer data); static void activate_collect_window( GtkWidget *w, gpointer data);
static void activate_collect_new_window( GtkWidget *w, gpointer data); static void activate_collect_new_window( GtkWidget *w, gpointer data);
static void activate_collect_signals( GtkWidget *w, gpointer data);
static void activate_collect_iosignals( GtkWidget *w, gpointer data);
static void activate_collect_open( GtkWidget *w, gpointer data); static void activate_collect_open( GtkWidget *w, gpointer data);
static void activate_advanceduser( GtkWidget *w, gpointer data); static void activate_advanceduser( GtkWidget *w, gpointer data);
static void activate_zoom_in( GtkWidget *w, gpointer data); static void activate_zoom_in( GtkWidget *w, gpointer data);
......
...@@ -584,6 +584,7 @@ XAttGtk::XAttGtk( GtkWidget *xa_parent_wid, ...@@ -584,6 +584,7 @@ XAttGtk::XAttGtk( GtkWidget *xa_parent_wid,
xattnav->change_value_cb = &change_value_cb; xattnav->change_value_cb = &change_value_cb;
xattnav->popup_menu_cb = &xatt_popup_menu_cb; xattnav->popup_menu_cb = &xatt_popup_menu_cb;
xattnav->is_authorized_cb = &xatt_is_authorized_cb; xattnav->is_authorized_cb = &xatt_is_authorized_cb;
xattnav->init_cb = &init_cb;
GtkWidget *statusbar = gtk_hbox_new( FALSE, 0); GtkWidget *statusbar = gtk_hbox_new( FALSE, 0);
msg_label = gtk_label_new( ""); msg_label = gtk_label_new( "");
......
...@@ -578,12 +578,14 @@ XColWindGtk::XColWindGtk( GtkWidget *xa_parent_wid, ...@@ -578,12 +578,14 @@ XColWindGtk::XColWindGtk( GtkWidget *xa_parent_wid,
pwr_sAttrRef *xa_objar_list, pwr_sAttrRef *xa_objar_list,
char *xa_title, char *xa_title,
int xa_advanced_user, int xa_advanced_user,
xcolwind_eType xa_type,
int *xa_sts) : int *xa_sts) :
XColWind( xa_parent_ctx, xa_objar_list, xa_title, xa_advanced_user, xa_sts), XColWind( xa_parent_ctx, xa_objar_list, xa_title, xa_advanced_user, xa_type, xa_sts),
parent_wid(xa_parent_wid) parent_wid(xa_parent_wid)
{ {
int sts; int sts;
pwr_tAttrRef ar; pwr_tAttrRef ar;
xattnav_eType xattnav_type;
toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW, toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", 600, "default-height", 600,
...@@ -829,12 +831,25 @@ XColWindGtk::XColWindGtk( GtkWidget *xa_parent_wid, ...@@ -829,12 +831,25 @@ XColWindGtk::XColWindGtk( GtkWidget *xa_parent_wid,
pane = gtk_vpaned_new(); pane = gtk_vpaned_new();
memset( &ar, 0, sizeof(ar)); memset( &ar, 0, sizeof(ar));
xattnav = new XAttNavGtk( (void *)this, pane, xattnav_eType_Collect, switch( type) {
case xcolwind_eType_Collect:
xattnav_type = xattnav_eType_Collect;
break;
case xcolwind_eType_CollectSignals:
xattnav_type = xattnav_eType_CollectSignals;
break;
case xcolwind_eType_CollectIOSignals:
xattnav_type = xattnav_eType_CollectSignals;
break;
}
xattnav = new XAttNavGtk( (void *)this, pane, xattnav_type,
"Plant", &ar, xa_advanced_user, objar_list, &brow_widget, &sts); "Plant", &ar, xa_advanced_user, objar_list, &brow_widget, &sts);
xattnav->message_cb = &message_cb; xattnav->message_cb = &message_cb;
xattnav->change_value_cb = &change_value_cb; xattnav->change_value_cb = &change_value_cb;
xattnav->popup_menu_cb = &xcolwind_popup_menu_cb; xattnav->popup_menu_cb = &xcolwind_popup_menu_cb;
xattnav->is_authorized_cb = &xcolwind_is_authorized_cb; xattnav->is_authorized_cb = &xcolwind_is_authorized_cb;
xattnav->init_cb = &init_cb;
GtkWidget *statusbar = gtk_hbox_new( FALSE, 0); GtkWidget *statusbar = gtk_hbox_new( FALSE, 0);
msg_label = gtk_label_new( ""); msg_label = gtk_label_new( "");
......
...@@ -57,6 +57,7 @@ class XColWindGtk : public XColWind { ...@@ -57,6 +57,7 @@ class XColWindGtk : public XColWind {
pwr_sAttrRef *xa_objar, pwr_sAttrRef *xa_objar,
char *xa_title, char *xa_title,
int xa_advanced_user, int xa_advanced_user,
xcolwind_eType xa_type,
int *xa_sts); int *xa_sts);
~XColWindGtk(); ~XColWindGtk();
GtkWidget *parent_wid; GtkWidget *parent_wid;
......
...@@ -199,6 +199,7 @@ XCrrGtk::XCrrGtk( ...@@ -199,6 +199,7 @@ XCrrGtk::XCrrGtk(
xcrrnav->popup_menu_cb = &xcrr_popup_menu_cb; xcrrnav->popup_menu_cb = &xcrr_popup_menu_cb;
xcrrnav->start_trace_cb = &xcrr_start_trace_cb; xcrrnav->start_trace_cb = &xcrr_start_trace_cb;
xcrrnav->close_cb = &xcrr_close_cb; xcrrnav->close_cb = &xcrr_close_cb;
xcrrnav->init_cb = &init_cb;
gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(menu_bar), FALSE, FALSE, 0); gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(menu_bar), FALSE, FALSE, 0);
gtk_box_pack_end( GTK_BOX(vbox), GTK_WIDGET(brow_widget), TRUE, TRUE, 0); gtk_box_pack_end( GTK_BOX(vbox), GTK_WIDGET(brow_widget), TRUE, TRUE, 0);
......
...@@ -206,9 +206,10 @@ XCrr *XNavGtk::xcrr_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts) ...@@ -206,9 +206,10 @@ XCrr *XNavGtk::xcrr_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts)
} }
XColWind *XNavGtk::xcolwind_new( pwr_tAttrRef *ar_list, char *title, int advanced_user, XColWind *XNavGtk::xcolwind_new( pwr_tAttrRef *ar_list, char *title, int advanced_user,
pwr_tStatus *sts) int type, pwr_tStatus *sts)
{ {
return new XColWindGtk( form_widget, this, ar_list, title, advanced_user, sts); return new XColWindGtk( form_widget, this, ar_list, title, advanced_user,
(xcolwind_eType)type, sts);
} }
Ev *XNavGtk::ev_new( char *eve_name, char *ala_name, char *blk_name, Ev *XNavGtk::ev_new( char *eve_name, char *ala_name, char *blk_name,
......
...@@ -66,7 +66,7 @@ class XNavGtk : public XNav { ...@@ -66,7 +66,7 @@ class XNavGtk : public XNav {
XAtt *xatt_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts); XAtt *xatt_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts);
XCrr *xcrr_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts); XCrr *xcrr_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts);
XColWind *xcolwind_new( pwr_tAttrRef *ar_list, char *title, int advanced_user, XColWind *xcolwind_new( pwr_tAttrRef *ar_list, char *title, int advanced_user,
pwr_tStatus *sts); int type, pwr_tStatus *sts);
Ev *ev_new( char *eve_name, char *ala_name, char *blk_name, Ev *ev_new( char *eve_name, char *ala_name, char *blk_name,
pwr_tObjid ev_user, int display_ala, int display_eve, pwr_tObjid ev_user, int display_ala, int display_eve,
int display_blk, int display_return, int display_ack, int display_blk, int display_return, int display_ack,
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "xtt_xatt.h" #include "xtt_xatt.h"
#include "xtt_xattnav.h" #include "xtt_xattnav.h"
#include "xtt_xnav.h" #include "xtt_xnav.h"
#include "xtt_item.h"
#include "rt_xatt_msg.h" #include "rt_xatt_msg.h"
...@@ -173,5 +174,123 @@ int XAtt::xatt_is_authorized_cb( void *ctx, unsigned int access) ...@@ -173,5 +174,123 @@ int XAtt::xatt_is_authorized_cb( void *ctx, unsigned int access)
return 0; return 0;
} }
int XAtt::init_cb( void *ctx)
{
XAtt *xatt = (XAtt *)ctx;
return xatt->object_attr();
}
int XAtt::object_attr()
{
int sts;
pwr_tClassId classid;
unsigned long elements;
Item *item;
int attr_exist;
int i;
gdh_sAttrDef *bd;
int rows;
pwr_tAName aname;
pwr_tAName attr_name;
pwr_tAName name;
char *s;
brow_SetNodraw( xattnav->brow->ctx);
// Get objid for rtbody or sysbody
sts = gdh_AttrrefToName ( &objar, name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return sts;
s = strchr( name, '.');
if ( s != 0)
strcpy( aname, s + 1);
else
strcpy( aname, "");
sts = gdh_GetAttrRefTid( &objar, &classid);
if ( EVEN(sts)) return sts;
sts = gdh_GetObjectBodyDef( classid, &bd, &rows, objar.Objid);
if ( EVEN(sts)) return sts;
for ( i = 0; i < rows; i++) {
if ( bd[i].flags & gdh_mAttrDef_Shadowed)
continue;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
continue;
if ( bd[i].attr->Param.Info.Type == pwr_eType_CastId ||
bd[i].attr->Param.Info.Type == pwr_eType_DisableAttr)
continue;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_DISABLEATTR) {
pwr_sAttrRef aaref;
pwr_tDisableAttr disabled;
sts = gdh_ArefANameToAref( &objar, bd[i].attrName, &aaref);
if ( EVEN(sts)) return sts;
sts = gdh_ArefDisabled( &aaref, &disabled);
if ( EVEN(sts)) return sts;
if ( disabled)
continue;
}
if ( objar.Flags.b.CastAttr)
cdh_SuppressSuper( attr_name, bd[i].attrName);
else
strcpy( attr_name, bd[i].attrName);
if ( strcmp( aname, "") == 0)
strcpy( name, attr_name);
else {
strcpy( name, aname);
strcat( name, ".");
strcat( name, attr_name);
}
elements = 1;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_ARRAY ) {
attr_exist = 1;
item = (Item *) new ItemAttrArray( xattnav->brow, objar.Objid, 0,
flow_eDest_IntoLast,
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);
}
else if ( bd[i].attr->Param.Info.Flags & PWR_MASK_CLASS ) {
attr_exist = 1;
item = (Item *) new ItemAttrObject( xattnav->brow, objar.Objid, 0,
flow_eDest_IntoLast,
name,
bd[i].attr->Param.TypeRef,
bd[i].attr->Param.Info.Size,
bd[i].attr->Param.Info.Flags, 0, 0);
}
else {
attr_exist = 1;
item = (Item *) new ItemAttr( xattnav->brow, objar.Objid, 0,
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);
}
}
free( (char *)bd);
brow_ResetNodraw( xattnav->brow->ctx);
brow_Redraw( xattnav->brow->ctx, 0);
return XATT__SUCCESS;
}
...@@ -80,6 +80,7 @@ class XAtt { ...@@ -80,6 +80,7 @@ class XAtt {
int open_changevalue( char *name); int open_changevalue( char *name);
void swap( int mode); void swap( int mode);
int object_attr();
void activate_display_object(); void activate_display_object();
void activate_show_cross(); void activate_show_cross();
void activate_open_classgraph(); void activate_open_classgraph();
...@@ -92,6 +93,7 @@ class XAtt { ...@@ -92,6 +93,7 @@ class XAtt {
static int xatt_is_authorized_cb( void *ctx, unsigned int access); static int xatt_is_authorized_cb( void *ctx, unsigned int access);
static void message_cb( void *xatt, char severity, const char *message); static void message_cb( void *xatt, char severity, const char *message);
static void change_value_cb( void *xatt); static void change_value_cb( void *xatt);
static int init_cb( void *ctx);
}; };
#endif #endif
......
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#include "xtt_xattnav.h" #include "xtt_xattnav.h"
#include "xtt_xnav.h" #include "xtt_xnav.h"
#include "xtt_xnav_brow.h" #include "xtt_xnav_brow.h"
#include "xtt_xnav_crr.h"
#include "xtt_item.h" #include "xtt_item.h"
#include "pwr_privilege.h" #include "pwr_privilege.h"
#include "cow_wow.h" #include "cow_wow.h"
...@@ -96,8 +95,6 @@ XAttNav::XAttNav( ...@@ -96,8 +95,6 @@ XAttNav::XAttNav(
// //
XAttNav::~XAttNav() XAttNav::~XAttNav()
{ {
if ( userdata)
free( userdata);
} }
// //
...@@ -663,203 +660,6 @@ void XAttNav::trace_scan( void *data) ...@@ -663,203 +660,6 @@ void XAttNav::trace_scan( void *data)
} }
} }
int XAttNav::crossref()
{
int sts;
pwr_tAName name;
pwr_tClassId classid;
char file[20] = "*";
sts = gdh_AttrrefToName ( &objar, name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttrRefTid( &objar, &classid);
if ( EVEN(sts)) return sts;
switch ( classid)
{
case pwr_cClass_Di:
case pwr_cClass_Dv:
case pwr_cClass_Do:
case pwr_cClass_Po:
case pwr_cClass_Av:
case pwr_cClass_Ai:
case pwr_cClass_Ao:
case pwr_cClass_Iv:
case pwr_cClass_Ii:
case pwr_cClass_Io:
case pwr_cClass_Co:
sts = xnav_crr_signal( brow, file, name, NULL);
break;
default:
/* Not a signal */
sts = xnav_crr_object( brow, file, name, NULL);
}
// if ( EVEN(sts))
// xnav->message(' ', XNav::get_message(sts));
return XATT__SUCCESS;
}
int XAttNav::object_attr()
{
int sts;
pwr_tClassId classid;
unsigned long elements;
Item *item;
int attr_exist;
int i;
gdh_sAttrDef *bd;
int rows;
pwr_tAName aname;
pwr_tAName attr_name;
pwr_tAName name;
char *s;
brow_SetNodraw( brow->ctx);
// Get objid for rtbody or sysbody
sts = gdh_AttrrefToName ( &objar, name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return sts;
s = strchr( name, '.');
if ( s != 0)
strcpy( aname, s + 1);
else
strcpy( aname, "");
sts = gdh_GetAttrRefTid( &objar, &classid);
if ( EVEN(sts)) return sts;
sts = gdh_GetObjectBodyDef( classid, &bd, &rows, objar.Objid);
if ( EVEN(sts)) return sts;
for ( i = 0; i < rows; i++) {
if ( bd[i].flags & gdh_mAttrDef_Shadowed)
continue;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
continue;
if ( bd[i].attr->Param.Info.Type == pwr_eType_CastId ||
bd[i].attr->Param.Info.Type == pwr_eType_DisableAttr)
continue;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_DISABLEATTR) {
pwr_sAttrRef aaref;
pwr_tDisableAttr disabled;
sts = gdh_ArefANameToAref( &objar, bd[i].attrName, &aaref);
if ( EVEN(sts)) return sts;
sts = gdh_ArefDisabled( &aaref, &disabled);
if ( EVEN(sts)) return sts;
if ( disabled)
continue;
}
if ( objar.Flags.b.CastAttr)
cdh_SuppressSuper( attr_name, bd[i].attrName);
else
strcpy( attr_name, bd[i].attrName);
if ( strcmp( aname, "") == 0)
strcpy( name, attr_name);
else {
strcpy( name, aname);
strcat( name, ".");
strcat( name, attr_name);
}
elements = 1;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_ARRAY ) {
attr_exist = 1;
item = (Item *) new ItemAttrArray( brow, objar.Objid, 0,
flow_eDest_IntoLast,
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);
}
else if ( bd[i].attr->Param.Info.Flags & PWR_MASK_CLASS ) {
attr_exist = 1;
item = (Item *) new ItemAttrObject( brow, objar.Objid, 0,
flow_eDest_IntoLast,
name,
bd[i].attr->Param.TypeRef,
bd[i].attr->Param.Info.Size,
bd[i].attr->Param.Info.Flags, 0, 0);
}
else {
attr_exist = 1;
item = (Item *) new ItemAttr( brow, objar.Objid, 0,
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);
}
}
free( (char *)bd);
brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, 0);
return XATT__SUCCESS;
}
int XAttNav::collect_add( pwr_tAttrRef *areflist)
{
ItemCollect *item;
int sts;
pwr_tAName attr;
char *s;
pwr_tTypeId a_type_id;
unsigned int a_size;
unsigned int a_offset;
unsigned int a_dim;
pwr_tTid a_tid;
pwr_tAName name;
pwr_tAttrRef *arp;
if ( !areflist)
return XATT__SUCCESS;
brow_SetNodraw( brow->ctx);
for ( arp = areflist; cdh_ObjidIsNotNull( arp->Objid); arp++) {
sts = gdh_AttrrefToName ( arp, name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return sts;
if ( !arp->Flags.b.Object && !arp->Flags.b.ObjectAttr) {
if ( (s = strchr( name, '.')) == 0)
return 0;
strcpy( attr, s+1);
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
continue;
item = new ItemCollect( brow, arp->Objid, attr, NULL,
flow_eDest_IntoLast, a_type_id, a_tid, a_size, 0);
}
brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, 0);
return XATT__SUCCESS;
}
void XAttNav::enable_events() void XAttNav::enable_events()
{ {
brow_EnableEvent( brow->ctx, flow_eEvent_MB1Click, flow_eEventType_CallBack, brow_EnableEvent( brow->ctx, flow_eEvent_MB1Click, flow_eEventType_CallBack,
...@@ -914,20 +714,10 @@ int XAttNav::init_brow_cb( FlowCtx *fctx, void *client_data) ...@@ -914,20 +714,10 @@ int XAttNav::init_brow_cb( FlowCtx *fctx, void *client_data)
xattnav->brow->create_nodeclasses(); xattnav->brow->create_nodeclasses();
xattnav->enable_events(); xattnav->enable_events();
// Create the root item // Create the items
switch ( xattnav->type) { if ( xattnav->init_cb)
case xattnav_eType_Object: (xattnav->init_cb) ( xattnav->parent_ctx);
xattnav->object_attr();
break;
case xattnav_eType_CrossRef:
xattnav->crossref();
break;
case xattnav_eType_Collect:
xattnav->collect_add( (pwr_tAttrRef *)xattnav->userdata);
break;
default:
;
}
sts = brow_TraceInit( ctx, trace_connect_bc, sts = brow_TraceInit( ctx, trace_connect_bc,
trace_disconnect_bc, trace_scan_bc); trace_disconnect_bc, trace_scan_bc);
xattnav->trace_started = 1; xattnav->trace_started = 1;
......
...@@ -55,13 +55,18 @@ ...@@ -55,13 +55,18 @@
#include "xtt_xnav_brow.h" #include "xtt_xnav_brow.h"
#endif #endif
#ifndef co_nav_crr_h
#include "co_nav_crr.h"
#endif
#define xattnav_cVersion "X3.3b" #define xattnav_cVersion "X3.3b"
#define XATTNAV_BROW_MAX 25 #define XATTNAV_BROW_MAX 25
typedef enum { typedef enum {
xattnav_eType_Object, xattnav_eType_Object,
xattnav_eType_CrossRef, xattnav_eType_CrossRef,
xattnav_eType_Collect xattnav_eType_Collect,
xattnav_eType_CollectSignals
} xattnav_eType; } xattnav_eType;
class CoWow; class CoWow;
...@@ -96,6 +101,7 @@ class XAttNav { ...@@ -96,6 +101,7 @@ class XAttNav {
unsigned long, char *, int x, int y); unsigned long, char *, int x, int y);
void (*start_trace_cb)( void *, pwr_tObjid, char *); void (*start_trace_cb)( void *, pwr_tObjid, char *);
int (*is_authorized_cb)(void *, unsigned int); int (*is_authorized_cb)(void *, unsigned int);
int (*init_cb)(void *);
int displayed; int displayed;
CoWow *wow; CoWow *wow;
int scantime; int scantime;
...@@ -109,9 +115,6 @@ class XAttNav { ...@@ -109,9 +115,6 @@ class XAttNav {
char **init_value, int *size); char **init_value, int *size);
void message( char sev, const char *text); void message( char sev, const char *text);
void force_trace_scan(); void force_trace_scan();
int object_attr();
int crossref();
int collect_add( pwr_tAttrRef *areflist);
int object_exist( brow_tObject object); int object_exist( brow_tObject object);
void redraw(); void redraw();
void enable_events(); void enable_events();
......
...@@ -143,6 +143,27 @@ void XColWind::activate_save() ...@@ -143,6 +143,27 @@ void XColWind::activate_save()
fp.close(); fp.close();
} }
int XColWind::init_cb( void *ctx)
{
XColWind *xcolwind = (XColWind *)ctx;
int sts;
switch ( xcolwind->type) {
case xcolwind_eType_Collect:
sts = xcolwind->collect_add( xcolwind->objar_list);
free( xcolwind->objar_list);
xcolwind->objar_list = 0;
break;
case xcolwind_eType_CollectSignals:
case xcolwind_eType_CollectIOSignals:
sts = xcolwind->collect_signals( xcolwind->objar_list);
break;
default:
;
}
return sts;
}
void XColWind::file_selected_cb( void *ctx, void *data, char *text) void XColWind::file_selected_cb( void *ctx, void *data, char *text)
{ {
XColWind *xcolwind = (XColWind *)ctx; XColWind *xcolwind = (XColWind *)ctx;
...@@ -321,21 +342,40 @@ XColWind::XColWind( ...@@ -321,21 +342,40 @@ XColWind::XColWind(
pwr_sAttrRef *xa_objar_list, pwr_sAttrRef *xa_objar_list,
char *xa_title, char *xa_title,
int xa_advanced_user, int xa_advanced_user,
xcolwind_eType xa_type,
int *xa_sts) : int *xa_sts) :
parent_ctx(xa_parent_ctx), parent_ctx(xa_parent_ctx),
objar_list(xa_objar_list), objar_list(xa_objar_list),
input_open(0), input_multiline(0), input_open(0), input_multiline(0),
close_cb(0), redraw_cb(0), popup_menu_cb(0), call_method_cb(0), close_cb(0), redraw_cb(0), popup_menu_cb(0), call_method_cb(0),
command_cb(0), get_select_cb(0), client_data(0) command_cb(0), get_select_cb(0), client_data(0), type(xa_type)
{ {
if ( xa_title && strcmp( xa_title, "") != 0) { if ( xa_title && strcmp( xa_title, "") != 0) {
strcpy( title, xa_title); strcpy( title, xa_title);
set_filename( title); set_filename( title);
} }
else {
if ( type == xcolwind_eType_CollectSignals ||
type == xcolwind_eType_CollectIOSignals) {
pwr_tAName aname;
pwr_tStatus sts;
sts = gdh_AttrrefToName( objar_list, aname, sizeof(aname),
cdh_mNName);
if ( EVEN(sts)) {
*xa_sts = sts;
return;
}
memset( title, 0, sizeof(title));
strcpy( title, "Signals ");
strncat( title, aname, sizeof(title)-strlen(title)-1);
strcpy( filename, "");
}
else { else {
strcpy( title, "Collection"); strcpy( title, "Collection");
strcpy( filename, ""); strcpy( filename, "");
} }
}
*xa_sts = XATT__SUCCESS; *xa_sts = XATT__SUCCESS;
} }
...@@ -357,7 +397,7 @@ void XColWind::collect_insert( pwr_tAttrRef *aref) ...@@ -357,7 +397,7 @@ void XColWind::collect_insert( pwr_tAttrRef *aref)
pwr_tAttrRef *areflist = (pwr_tAttrRef *) calloc( 2, sizeof(pwr_tAttrRef)); pwr_tAttrRef *areflist = (pwr_tAttrRef *) calloc( 2, sizeof(pwr_tAttrRef));
areflist[0] = *aref; areflist[0] = *aref;
xattnav->collect_add( areflist); collect_add( areflist);
free( areflist); free( areflist);
} }
...@@ -411,3 +451,143 @@ void XColWind::zoom( double zoom_factor) ...@@ -411,3 +451,143 @@ void XColWind::zoom( double zoom_factor)
brow_ZoomAbsolute( xattnav->brow->ctx, zoom_factor); brow_ZoomAbsolute( xattnav->brow->ctx, zoom_factor);
} }
int XColWind::collect_add( pwr_tAttrRef *areflist)
{
ItemCollect *item;
int sts;
pwr_tAName attr;
char *s;
pwr_tTypeId a_type_id;
unsigned int a_size;
unsigned int a_offset;
unsigned int a_dim;
pwr_tTid a_tid;
pwr_tAName name;
pwr_tAttrRef *arp;
if ( !areflist)
return XATT__SUCCESS;
brow_SetNodraw( xattnav->brow->ctx);
for ( arp = areflist; cdh_ObjidIsNotNull( arp->Objid); arp++) {
sts = gdh_AttrrefToName ( arp, name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return sts;
if ( !arp->Flags.b.Object && !arp->Flags.b.ObjectAttr) {
if ( (s = strchr( name, '.')) == 0)
return 0;
strcpy( attr, s+1);
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
continue;
item = new ItemCollect( xattnav->brow, arp->Objid, attr, NULL,
flow_eDest_IntoLast, a_type_id, a_tid, a_size, 0);
}
brow_ResetNodraw( xattnav->brow->ctx);
brow_Redraw( xattnav->brow->ctx, 0);
return XATT__SUCCESS;
}
int XColWind::collect_signals( pwr_tAttrRef *arp)
{
int sts;
pwr_tAName name;
brow_SetNodraw( xattnav->brow->ctx);
sts = gdh_AttrrefToName ( arp, name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return sts;
NavCrr *navcrr = new NavCrr( this, 0);
navcrr->insert_cb = signal_insert_cb;
navcrr->name_to_objid_cb = name_to_objid_cb;
navcrr->get_volume_cb = 0;
sts = navcrr->get_signals( 0, name);
delete navcrr;
brow_ResetNodraw( xattnav->brow->ctx);
brow_Redraw( xattnav->brow->ctx, 0);
return XATT__SUCCESS;
}
int XColWind::name_to_objid_cb( void *ctx, char *name, pwr_tObjid *objid)
{
return gdh_NameToObjid( name, objid);
}
void XColWind::signal_insert_cb( void *ctx, void *parent_node,
navc_eItemType item_type,
char *text1, char *text2, int write)
{
XColWind *xcolwind = (XColWind *)ctx;
XNavBrow *brow = xcolwind->xattnav->brow;
pwr_tAttrRef aref;
pwr_tTypeId a_type_id;
unsigned int a_size;
unsigned int a_offset;
unsigned int a_dim;
pwr_tTid a_tid;
pwr_tStatus sts;
ItemCollect *item;
char *s;
pwr_tOName attr, trace_attr;
pwr_tAName name;
pwr_tCid cid;
sts = gdh_NameToAttrref( pwr_cNObjid, text1, &aref);
if ( EVEN(sts)) return;
if ( xcolwind->type == xcolwind_eType_CollectIOSignals) {
sts = gdh_GetAttrRefTid( &aref, &cid);
if ( EVEN(sts)) return;
switch ( cid) {
case pwr_cClass_Di:
case pwr_cClass_Do:
case pwr_cClass_Ai:
case pwr_cClass_Ao:
case pwr_cClass_Ii:
case pwr_cClass_Io:
case pwr_cClass_Co:
break;
default:
return;
}
}
sts = XNav::get_trace_attr( &aref, trace_attr);
if ( EVEN(sts)) return;
if ((s = strchr( text1, '.'))) {
strcpy( attr, s+1);
strcat( attr, ".");
strcat( attr, trace_attr);
}
else
strcpy( attr, trace_attr);
strcpy( name, text1);
strcat( name, ".");
strcat( name, trace_attr);
sts = gdh_GetAttributeCharacteristics( name, &a_type_id, &a_size, &a_offset,
&a_dim);
if ( EVEN(sts)) return;
item = new ItemCollect( brow, aref.Objid, attr, NULL,
flow_eDest_IntoLast, a_type_id, a_tid, a_size, 0);
}
...@@ -43,10 +43,20 @@ ...@@ -43,10 +43,20 @@
# include "pwr.h" # include "pwr.h"
#endif #endif
#include "cow_wow.h" #include "cow_wow.h"
#ifndef co_nav_crr_h
#include "co_nav_crr.h"
#endif
class XAttNav; class XAttNav;
class CoWow; class CoWow;
typedef enum {
xcolwind_eType_Collect,
xcolwind_eType_CollectSignals,
xcolwind_eType_CollectIOSignals
} xcolwind_eType;
class XColWind { class XColWind {
public: public:
XColWind( XColWind(
...@@ -54,6 +64,7 @@ class XColWind { ...@@ -54,6 +64,7 @@ class XColWind {
pwr_sAttrRef *xa_objar_list, pwr_sAttrRef *xa_objar_list,
char *xa_title, char *xa_title,
int xa_advanced_user, int xa_advanced_user,
xcolwind_eType xa_type,
int *xa_sts); int *xa_sts);
virtual ~XColWind(); virtual ~XColWind();
void *parent_ctx; void *parent_ctx;
...@@ -79,6 +90,7 @@ class XColWind { ...@@ -79,6 +90,7 @@ class XColWind {
pwr_tFileName filename; pwr_tFileName filename;
CoWow *wow; CoWow *wow;
char title[80]; char title[80];
xcolwind_eType type;
virtual void message( char severity, const char *message) {} virtual void message( char severity, const char *message) {}
virtual void set_prompt( const char *prompt) {} virtual void set_prompt( const char *prompt) {}
...@@ -95,6 +107,8 @@ class XColWind { ...@@ -95,6 +107,8 @@ class XColWind {
void collect_insert( pwr_tAttrRef *aref); void collect_insert( pwr_tAttrRef *aref);
void zoom( double zoom_factor); void zoom( double zoom_factor);
void set_scantime( int t); void set_scantime( int t);
int collect_add( pwr_tAttrRef *areflist);
int collect_signals( pwr_tAttrRef *arp);
void activate_open(); void activate_open();
void activate_save(); void activate_save();
void activate_saveas(); void activate_saveas();
...@@ -117,6 +131,11 @@ class XColWind { ...@@ -117,6 +131,11 @@ class XColWind {
static void message_cb( void *xcolwind, char severity, const char *message); static void message_cb( void *xcolwind, char severity, const char *message);
static void change_value_cb( void *xcolwind); static void change_value_cb( void *xcolwind);
static void file_selected_cb( void *ctx, void *data, char *text); static void file_selected_cb( void *ctx, void *data, char *text);
static int init_cb( void *ctx);
static void signal_insert_cb( void *ctx, void *parent_node,
navc_eItemType item_type,
char *text1, char *text2, int write);
static int name_to_objid_cb( void *ctx, char *name, pwr_tObjid *objid);
}; };
#endif #endif
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "xtt_xcrr.h" #include "xtt_xcrr.h"
#include "xtt_xattnav.h" #include "xtt_xattnav.h"
#include "co_lng.h" #include "co_lng.h"
#include "xtt_xnav_crr.h"
#include "xtt_xnav.h" #include "xtt_xnav.h"
#include "rt_xatt_msg.h" #include "rt_xatt_msg.h"
...@@ -104,6 +105,51 @@ void XCrr::xcrr_close_cb( void *ctx) ...@@ -104,6 +105,51 @@ void XCrr::xcrr_close_cb( void *ctx)
((XCrr *)ctx)->close_cb( ((XCrr *)ctx)->parent_ctx, ctx); ((XCrr *)ctx)->close_cb( ((XCrr *)ctx)->parent_ctx, ctx);
} }
int XCrr::init_cb( void *ctx)
{
XCrr *xcrr = (XCrr *)ctx;
return xcrr->crossref();
}
int XCrr::crossref()
{
int sts;
pwr_tAName name;
pwr_tClassId classid;
char file[20] = "*";
sts = gdh_AttrrefToName ( &objar, name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttrRefTid( &objar, &classid);
if ( EVEN(sts)) return sts;
switch ( classid)
{
case pwr_cClass_Di:
case pwr_cClass_Dv:
case pwr_cClass_Do:
case pwr_cClass_Po:
case pwr_cClass_Av:
case pwr_cClass_Ai:
case pwr_cClass_Ao:
case pwr_cClass_Iv:
case pwr_cClass_Ii:
case pwr_cClass_Io:
case pwr_cClass_Co:
sts = xnav_crr_signal( xcrrnav->brow, file, name, NULL);
break;
default:
/* Not a signal */
sts = xnav_crr_object( xcrrnav->brow, file, name, NULL);
}
// if ( EVEN(sts))
// xnav->message(' ', XNav::get_message(sts));
return XATT__SUCCESS;
}
...@@ -72,11 +72,13 @@ class XCrr { ...@@ -72,11 +72,13 @@ class XCrr {
virtual void pop() {} virtual void pop() {}
int crossref();
static void xcrr_popup_menu_cb( void *ctx, pwr_sAttrRef attrref, static void xcrr_popup_menu_cb( void *ctx, pwr_sAttrRef attrref,
unsigned long item_type, unsigned long utility, unsigned long item_type, unsigned long utility,
char *arg, int x, int y); char *arg, int x, int y);
static void xcrr_start_trace_cb( void *ctx, pwr_tObjid objid, char *name); static void xcrr_start_trace_cb( void *ctx, pwr_tObjid objid, char *name);
static void xcrr_close_cb( void *ctx); static void xcrr_close_cb( void *ctx);
static int init_cb( void *ctx);
}; };
#endif #endif
......
...@@ -358,7 +358,7 @@ class XNav { ...@@ -358,7 +358,7 @@ class XNav {
virtual XAtt *xatt_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts) {return 0;} virtual XAtt *xatt_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts) {return 0;}
virtual XCrr *xcrr_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts) {return 0;} virtual XCrr *xcrr_new( pwr_tAttrRef *arp, int advanced_user, pwr_tStatus *sts) {return 0;}
virtual XColWind *xcolwind_new( pwr_tAttrRef *ar_list, char *title, int advanced_user, virtual XColWind *xcolwind_new( pwr_tAttrRef *ar_list, char *title, int advanced_user,
pwr_tStatus *sts) {return 0;} int type, pwr_tStatus *sts) {return 0;}
virtual Ev *ev_new( char *eve_name, char *ala_name, char *blk_name, virtual Ev *ev_new( char *eve_name, char *ala_name, char *blk_name,
pwr_tObjid ev_user, int display_ala, int display_eve, pwr_tObjid ev_user, int display_ala, int display_eve,
int display_blk, int display_return, int display_ack, int display_blk, int display_return, int display_ack,
...@@ -414,7 +414,7 @@ class XNav { ...@@ -414,7 +414,7 @@ class XNav {
int collect_insert( pwr_sAttrRef *attrref); int collect_insert( pwr_sAttrRef *attrref);
int collect_remove(); int collect_remove();
int collect_show(); int collect_show();
int collect_window( int copy); int collect_window( int copy, int type);
void collect_clear(); void collect_clear();
void clear(); void clear();
void message( char sev, const char *text); void message( char sev, const char *text);
......
...@@ -328,7 +328,7 @@ dcli_tCmdTable xnav_command_table[] = { ...@@ -328,7 +328,7 @@ dcli_tCmdTable xnav_command_table[] = {
"COLLECT", "COLLECT",
&xnav_collect_func, &xnav_collect_func,
{ "dcli_arg1", "/NAME", "/NEWWINDOW", "/ADDWINDOW", "/LAST", "/TITLE", { "dcli_arg1", "/NAME", "/NEWWINDOW", "/ADDWINDOW", "/LAST", "/TITLE",
"/WIDTH", "/HEIGHT", "/SCANTIME", "/ZOOMFACTOR", ""} "/WIDTH", "/HEIGHT", "/SCANTIME", "/ZOOMFACTOR", "/FILE", ""}
}, },
{ {
"CROSSREFERENCE", "CROSSREFERENCE",
...@@ -4591,7 +4591,7 @@ static int xnav_collect_func( void *client_data, ...@@ -4591,7 +4591,7 @@ static int xnav_collect_func( void *client_data,
dcli_get_qualifier( "/TITLE", title_str, sizeof(title_str)); dcli_get_qualifier( "/TITLE", title_str, sizeof(title_str));
xnav->last_xcolwind = xnav->xcolwind_new( arlist, title_str, xnav->gbl.advanced_user, xnav->last_xcolwind = xnav->xcolwind_new( arlist, title_str, xnav->gbl.advanced_user,
&sts); xcolwind_eType_Collect, &sts);
if ( EVEN(sts)) { if ( EVEN(sts)) {
xnav->last_xcolwind = 0; xnav->last_xcolwind = 0;
return XNAV__SUCCESS; return XNAV__SUCCESS;
...@@ -4633,8 +4633,25 @@ static int xnav_collect_func( void *client_data, ...@@ -4633,8 +4633,25 @@ static int xnav_collect_func( void *client_data,
} }
else if ( cdh_NoCaseStrncmp( arg1_str, "OPEN", strlen( arg1_str)) == 0) else if ( cdh_NoCaseStrncmp( arg1_str, "OPEN", strlen( arg1_str)) == 0)
{ {
pwr_tFileName file_str;
if ( ODD( dcli_get_qualifier( "/FILE", file_str, sizeof(file_str)))) {
pwr_tCmd cmd;
strcpy( cmd, "@\"");
if ( !strchr( file_str, '/'))
strcat( cmd, "$pwrp_load/");
strcat( cmd, file_str);
if ( !strchr( file_str, '.'))
strcat( cmd, ".rtt_col");
strcat( cmd, "\"");
xnav->command( cmd);
}
else
xnav->wow->CreateFileList( "Open Collection", "$pwrp_load", "*", "rtt_col", xnav->wow->CreateFileList( "Open Collection", "$pwrp_load", "*", "rtt_col",
xnav_collect_open_cb, 0, xnav, 1); xnav_collect_open_cb, 0, xnav, 1);
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
else if ( cdh_NoCaseStrncmp( arg1_str, "SHOW", strlen( arg1_str)) == 0) else if ( cdh_NoCaseStrncmp( arg1_str, "SHOW", strlen( arg1_str)) == 0)
...@@ -7910,7 +7927,7 @@ pwr_tStatus XNav::get_instance_classgraph( char *instance_str, pwr_tFileName fil ...@@ -7910,7 +7927,7 @@ pwr_tStatus XNav::get_instance_classgraph( char *instance_str, pwr_tFileName fil
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
int XNav::collect_window( int copy) int XNav::collect_window( int copy, int type)
{ {
brow_tNode *node_list; brow_tNode *node_list;
int node_count; int node_count;
...@@ -7920,6 +7937,7 @@ int XNav::collect_window( int copy) ...@@ -7920,6 +7937,7 @@ int XNav::collect_window( int copy)
int i; int i;
XColWind *xcolwind; XColWind *xcolwind;
if ( type == xcolwind_eType_Collect) {
if ( copy) { if ( copy) {
brow_GetObjectList( collect_brow->ctx, &node_list, &node_count); brow_GetObjectList( collect_brow->ctx, &node_list, &node_count);
if ( !node_count) if ( !node_count)
...@@ -7940,10 +7958,10 @@ int XNav::collect_window( int copy) ...@@ -7940,10 +7958,10 @@ int XNav::collect_window( int copy)
} }
} }
xcolwind = xcolwind_new( ap, 0, gbl.advanced_user, &sts); xcolwind = xcolwind_new( ap, 0, gbl.advanced_user, xcolwind_eType_Collect, &sts);
} }
else else
xcolwind = xcolwind_new( 0, 0, gbl.advanced_user, &sts); xcolwind = xcolwind_new( 0, 0, gbl.advanced_user, xcolwind_eType_Collect, &sts);
if ( ODD(sts)) { if ( ODD(sts)) {
xcolwind->close_cb = xatt_close_cb; xcolwind->close_cb = xatt_close_cb;
...@@ -7956,6 +7974,25 @@ int XNav::collect_window( int copy) ...@@ -7956,6 +7974,25 @@ int XNav::collect_window( int copy)
if ( copy) if ( copy)
collect_clear(); collect_clear();
} }
}
else if ( type == xcolwind_eType_CollectSignals ||
type == xcolwind_eType_CollectIOSignals) {
pwr_tAttrRef attrref;
int is_attr;
sts = get_select( &attrref, &is_attr);
if ( EVEN(sts)) return sts;
xcolwind = xcolwind_new( &attrref, 0, gbl.advanced_user, type, &sts);
if ( ODD(sts)) {
xcolwind->close_cb = xatt_close_cb;
xcolwind->popup_menu_cb = xnav_popup_menu_cb;
xcolwind->call_method_cb = xnav_call_method_cb;
xcolwind->is_authorized_cb = is_authorized_cb;
xcolwind->command_cb = xnav_op_command_cb;
xcolwind->get_select_cb = xnav_get_select_cb;
}
}
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
...@@ -115,7 +115,7 @@ int xnav_crr_signal( ...@@ -115,7 +115,7 @@ int xnav_crr_signal(
XNavBrow *brow, XNavBrow *brow,
char *filename, char *filename,
char *signalname, char *signalname,
flow_tNode parent_node) brow_tNode parent_node)
{ {
int sts; int sts;
NavCrr *navcrr = new NavCrr( brow, parent_node); NavCrr *navcrr = new NavCrr( brow, parent_node);
...@@ -133,7 +133,7 @@ int xnav_crr_object( ...@@ -133,7 +133,7 @@ int xnav_crr_object(
XNavBrow *brow, XNavBrow *brow,
char *filename, char *filename,
char *objectname, char *objectname,
flow_tNode parent_node) brow_tNode parent_node)
{ {
int sts; int sts;
NavCrr *navcrr = new NavCrr( brow, parent_node); NavCrr *navcrr = new NavCrr( brow, parent_node);
......
...@@ -38,12 +38,12 @@ int xnav_crr_signal( ...@@ -38,12 +38,12 @@ int xnav_crr_signal(
XNavBrow *brow, XNavBrow *brow,
char *filename, char *filename,
char *signalname, char *signalname,
flow_tNode parent_node); brow_tNode parent_node);
int xnav_crr_object( int xnav_crr_object(
XNavBrow *brow, XNavBrow *brow,
char *filename, char *filename,
char *objectname, char *objectname,
flow_tNode parent_node); brow_tNode parent_node);
int xnav_crr_code( int xnav_crr_code(
XNavBrow *brow, XNavBrow *brow,
char *filename, char *filename,
......
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