Commit 4799be55 authored by Claes Sjofors's avatar Claes Sjofors

Xtt methods menu, hist event for attribute objects added (refs #136)

parent d0e98683
...@@ -92,9 +92,9 @@ static void destroy_event( GtkWidget *w, gpointer data) ...@@ -92,9 +92,9 @@ static void destroy_event( GtkWidget *w, gpointer data)
HistGtk::HistGtk( void *hist_parent_ctx, HistGtk::HistGtk( void *hist_parent_ctx,
GtkWidget *hist_parent_wid, GtkWidget *hist_parent_wid,
char *hist_name, pwr_tObjid objid, char *hist_name, pwr_tAttrRef *arp,
pwr_tStatus *status) : pwr_tStatus *status) :
Hist( hist_parent_ctx, hist_name, objid, status), Hist( hist_parent_ctx, hist_name, arp, status),
parent_wid(hist_parent_wid), parent_wid_hist(NULL) parent_wid(hist_parent_wid), parent_wid_hist(NULL)
{ {
const int hist_width = 800; const int hist_width = 800;
...@@ -438,20 +438,22 @@ HistGtk::HistGtk( void *hist_parent_ctx, ...@@ -438,20 +438,22 @@ HistGtk::HistGtk( void *hist_parent_ctx,
// Init start and stop time // Init start and stop time
pwr_tStatus sts; pwr_tStatus sts;
pwr_tOName name_str; pwr_tAName name_str;
gint pos = 0; gint pos = 0;
((Hist *)this)->all_cb(); ((Hist *)this)->all_cb();
// If objid is applied, search for this object // If objid is applied, search for this object
pos = 0; pos = 0;
sts = gdh_ObjidToName( objid, name_str, sizeof(name_str), cdh_mName_pathStrict); if ( arp && cdh_ObjidIsNotNull(arp->Objid)) {
sts = gdh_AttrrefToName( arp, name_str, sizeof(name_str), cdh_mName_pathStrict);
if (ODD(sts)) { if (ODD(sts)) {
gtk_editable_insert_text( GTK_EDITABLE(event_name_entry_w), name_str, gtk_editable_insert_text( GTK_EDITABLE(event_name_entry_w), name_str,
strlen(name_str), &pos); strlen(name_str), &pos);
this->eventName_str = name_str; this->eventName_str = name_str;
get_hist_list(); get_hist_list();
} }
}
wow = new CoWowGtk( parent_wid_hist); wow = new CoWowGtk( parent_wid_hist);
......
...@@ -49,7 +49,7 @@ class HistGtk : public Hist { ...@@ -49,7 +49,7 @@ class HistGtk : public Hist {
public: public:
HistGtk( void *hist_parent_ctx, HistGtk( void *hist_parent_ctx,
GtkWidget *hist_parent_wid, GtkWidget *hist_parent_wid,
char *hist_name, pwr_tObjid objid, char *hist_name, pwr_tAttrRef *arp,
pwr_tStatus *status); pwr_tStatus *status);
~HistGtk(); ~HistGtk();
......
...@@ -226,9 +226,9 @@ Ev *XNavGtk::ev_new( char *eve_name, char *ala_name, char *blk_name, ...@@ -226,9 +226,9 @@ Ev *XNavGtk::ev_new( char *eve_name, char *ala_name, char *blk_name,
status); status);
} }
Hist *XNavGtk::hist_new( char *title, pwr_tOid oid, pwr_tStatus *sts) Hist *XNavGtk::hist_new( char *title, pwr_tAttrRef *arp, pwr_tStatus *sts)
{ {
return new HistGtk( this, parent_wid, title, oid, sts); return new HistGtk( this, parent_wid, title, arp, sts);
} }
Block *XNavGtk::block_new( pwr_tAttrRef *arp, char *name, unsigned int priv, Block *XNavGtk::block_new( pwr_tAttrRef *arp, char *name, unsigned int priv,
......
...@@ -71,7 +71,7 @@ class XNavGtk : public XNav { ...@@ -71,7 +71,7 @@ class XNavGtk : public XNav {
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,
int ev_beep, pwr_tMask ev_pop_mask, int ev_eventname_seg, pwr_tStatus *status); int ev_beep, pwr_tMask ev_pop_mask, int ev_eventname_seg, pwr_tStatus *status);
Hist *hist_new( char *title, pwr_tOid oid, pwr_tStatus *sts); Hist *hist_new( char *title, pwr_tAttrRef *arp, pwr_tStatus *sts);
Block *block_new( pwr_tAttrRef *arp, char *name, unsigned int priv, Block *block_new( pwr_tAttrRef *arp, char *name, unsigned int priv,
pwr_tStatus *sts); pwr_tStatus *sts);
Op *op_new( char *opplace, pwr_tStatus *sts); Op *op_new( char *opplace, pwr_tStatus *sts);
......
...@@ -92,9 +92,9 @@ extern "C" { ...@@ -92,9 +92,9 @@ extern "C" {
HistMotif::HistMotif( void *hist_parent_ctx, HistMotif::HistMotif( void *hist_parent_ctx,
Widget hist_parent_wid, Widget hist_parent_wid,
char *hist_name, pwr_tObjid objid, char *hist_name, pwr_tAttrRef *arp,
pwr_tStatus *status) : pwr_tStatus *status) :
Hist( hist_parent_ctx, hist_name, objid, status), Hist( hist_parent_ctx, hist_name, arp, status),
parent_wid(hist_parent_wid), parent_wid_hist(NULL) parent_wid(hist_parent_wid), parent_wid_hist(NULL)
{ {
char uid_filename[120] = {"xtt_hist.uid"}; char uid_filename[120] = {"xtt_hist.uid"};
...@@ -252,17 +252,18 @@ HistMotif::HistMotif( void *hist_parent_ctx, ...@@ -252,17 +252,18 @@ HistMotif::HistMotif( void *hist_parent_ctx,
flow_AddCloseVMProtocolCb( parent_wid_hist, flow_AddCloseVMProtocolCb( parent_wid_hist,
(XtCallbackProc)activate_exit, this); (XtCallbackProc)activate_exit, this);
char name_str[80]; pwr_tAName name_str;
sts = gdh_ObjidToName ( objid, name_str, sizeof(name_str), cdh_mName_pathStrict);
if (ODD(sts)) if ( arp && cdh_ObjidIsNotNull(arp->Objid)) {
{ sts = gdh_AttrrefToName( arp, name_str, sizeof(name_str), cdh_mName_pathStrict);
if(this->event_name_entry_w != NULL) if (ODD(sts)) {
{ if(this->event_name_entry_w != NULL) {
XmTextSetString(this->event_name_entry_w, name_str); XmTextSetString(this->event_name_entry_w, name_str);
this->eventName_str = name_str; this->eventName_str = name_str;
this->get_hist_list(); this->get_hist_list();
} }
} }
}
wow = new CoWowMotif( parent_wid_hist); wow = new CoWowMotif( parent_wid_hist);
......
...@@ -53,7 +53,7 @@ class HistMotif : public Hist { ...@@ -53,7 +53,7 @@ class HistMotif : public Hist {
public: public:
HistMotif( void *hist_parent_ctx, HistMotif( void *hist_parent_ctx,
Widget hist_parent_wid, Widget hist_parent_wid,
char *hist_name, pwr_tObjid objid, char *hist_name, pwr_tAttrRef *arp,
pwr_tStatus *status); pwr_tStatus *status);
~HistMotif(); ~HistMotif();
......
...@@ -246,9 +246,9 @@ Ev *XNavMotif::ev_new( char *eve_name, char *ala_name, char *blk_name, ...@@ -246,9 +246,9 @@ Ev *XNavMotif::ev_new( char *eve_name, char *ala_name, char *blk_name,
display_return, display_ack, ev_beep, ev_pop_mask, ev_eventname_seg, status); display_return, display_ack, ev_beep, ev_pop_mask, ev_eventname_seg, status);
} }
Hist *XNavMotif::hist_new( char *title, pwr_tOid oid, pwr_tStatus *sts) Hist *XNavMotif::hist_new( char *title, pwr_tAttrRef *arp, pwr_tStatus *sts)
{ {
return new HistMotif( this, parent_wid, title, oid, sts); return new HistMotif( this, parent_wid, title, arp, sts);
} }
Block *XNavMotif::block_new( pwr_tAttrRef *arp, char *name, unsigned int priv, Block *XNavMotif::block_new( pwr_tAttrRef *arp, char *name, unsigned int priv,
......
...@@ -69,7 +69,7 @@ class XNavMotif : public XNav { ...@@ -69,7 +69,7 @@ class XNavMotif : public XNav {
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,
int ev_beep, pwr_tMask ev_pop_mask, int ev_eventname_seg, pwr_tStatus *status); int ev_beep, pwr_tMask ev_pop_mask, int ev_eventname_seg, pwr_tStatus *status);
Hist *hist_new( char *title, pwr_tOid oid, pwr_tStatus *sts); Hist *hist_new( char *title, pwr_tAttrRef *arp, pwr_tStatus *sts);
Block *block_new( pwr_tAttrRef *arp, char *name, unsigned int priv, Block *block_new( pwr_tAttrRef *arp, char *name, unsigned int priv,
pwr_tStatus *sts); pwr_tStatus *sts);
Op *op_new( char *opplace, pwr_tStatus *sts); Op *op_new( char *opplace, pwr_tStatus *sts);
......
...@@ -167,7 +167,7 @@ static pwr_tStatus HistEventFilter( xmenu_sMenuCall *ip) ...@@ -167,7 +167,7 @@ static pwr_tStatus HistEventFilter( xmenu_sMenuCall *ip)
else else
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
if ( objar->Flags.b.Object) if ( objar->Flags.b.Object || objar->Flags.b.ObjectAttr)
return 1; return 1;
return 0; return 0;
} }
......
...@@ -83,7 +83,7 @@ pwr_tStatus mh_clear_alarmlist_bc( pwr_tNodeIndex nix); ...@@ -83,7 +83,7 @@ pwr_tStatus mh_clear_alarmlist_bc( pwr_tNodeIndex nix);
bool compDate(sEvent ev1, sEvent ev2); bool compDate(sEvent ev1, sEvent ev2);
Hist::Hist( void *hist_parent_ctx, Hist::Hist( void *hist_parent_ctx,
char *hist_name, pwr_tObjid objid, char *hist_name, pwr_tAttrRef *arp,
pwr_tStatus *status) : pwr_tStatus *status) :
parent_ctx(hist_parent_ctx), parent_ctx(hist_parent_ctx),
start_trace_cb(NULL), display_in_xnav_cb(NULL), update_info_cb(NULL), start_trace_cb(NULL), display_in_xnav_cb(NULL), update_info_cb(NULL),
......
...@@ -61,7 +61,7 @@ class CoWow; ...@@ -61,7 +61,7 @@ class CoWow;
class Hist { class Hist {
public: public:
Hist( void *hist_parent_ctx, Hist( void *hist_parent_ctx,
char *hist_name, pwr_tObjid objid, char *hist_name, pwr_tAttrRef *arp,
pwr_tStatus *status); pwr_tStatus *status);
virtual ~Hist(); virtual ~Hist();
......
...@@ -342,7 +342,7 @@ class XNav { ...@@ -342,7 +342,7 @@ class XNav {
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,
int ev_beep, pwr_tMask ev_pop_mask, int ev_eventname_seg, pwr_tStatus *status) { return 0;} int ev_beep, pwr_tMask ev_pop_mask, int ev_eventname_seg, pwr_tStatus *status) { return 0;}
virtual Hist *hist_new( char *title, pwr_tOid oid, pwr_tStatus *sts) {return 0;} virtual Hist *hist_new( char *title, pwr_tAttrRef *arp, pwr_tStatus *sts) {return 0;}
virtual Block *block_new( pwr_tAttrRef *arp, char *name, unsigned int priv, virtual Block *block_new( pwr_tAttrRef *arp, char *name, unsigned int priv,
pwr_tStatus *sts) {return 0;} pwr_tStatus *sts) {return 0;}
virtual Op *op_new( char *opplace, pwr_tStatus *sts) {return 0;} virtual Op *op_new( char *opplace, pwr_tStatus *sts) {return 0;}
......
...@@ -1932,22 +1932,23 @@ static int xnav_show_func( void *client_data, ...@@ -1932,22 +1932,23 @@ static int xnav_show_func( void *client_data,
else if ( cdh_NoCaseStrncmp( arg1_str, "HISTLIST", strlen( arg1_str)) == 0) else if ( cdh_NoCaseStrncmp( arg1_str, "HISTLIST", strlen( arg1_str)) == 0)
{ {
char hist_title[40]; char hist_title[40];
pwr_tOName name_str; pwr_tAName name_str;
pwr_tObjid objid = pwr_cNObjid; pwr_tAttrRef *arp = 0;
pwr_tAttrRef aref;
if ( ODD( dcli_get_qualifier( "dcli_arg2", name_str, sizeof(name_str)))) if ( ODD( dcli_get_qualifier( "dcli_arg2", name_str, sizeof(name_str)))) {
{
sts = gdh_NameToObjid ( name_str, &objid); sts = gdh_NameToAttrref( pwr_cNOid, name_str, &aref);
if (EVEN(sts)) if (EVEN(sts)) {
{
xnav->message('E', "Object not found"); xnav->message('E', "Object not found");
return XNAV__HOLDCOMMAND; return XNAV__HOLDCOMMAND;
} }
arp = &aref;
} }
strcpy( hist_title, Lng::translate( "Hist list")); strcpy( hist_title, Lng::translate( "Hist list"));
Hist *hist; Hist *hist;
hist = xnav->hist_new( hist_title, objid, &sts); hist = xnav->hist_new( hist_title, arp, &sts);
if ( EVEN(sts)) if ( EVEN(sts))
{ {
delete hist; delete hist;
......
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