Commit 629eb82c authored by claes's avatar claes

View and store node description in statusmonitor

parent 6a001f69
/* /*
* Proview $Id: co_rtmon_gtk.cpp,v 1.4 2007-09-06 11:22:18 claes Exp $ * Proview $Id: co_rtmon_gtk.cpp,v 1.5 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -162,7 +162,7 @@ RtMonGtk::RtMonGtk( void *rtmon_parent_ctx, ...@@ -162,7 +162,7 @@ RtMonGtk::RtMonGtk( void *rtmon_parent_ctx,
gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu)); gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu));
nodelistnav = new NodelistNavGtk( this, vbox, 0, nodename, nodelist_eMode_SystemStatus, nodelistnav = new NodelistNavGtk( this, vbox, 0, nodename, nodelist_eMode_SystemStatus,
0, &nodelistnav_widget); 0, 0, &nodelistnav_widget);
// Toolbar // Toolbar
GtkToolbar *tools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL); GtkToolbar *tools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL);
......
/* /*
* Proview $Id: co_statusmon_nodelist_gtk.cpp,v 1.6 2007-09-06 11:22:18 claes Exp $ * Proview $Id: co_statusmon_nodelist_gtk.cpp,v 1.7 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -51,8 +51,10 @@ static void destroy_event( GtkWidget *w, gpointer data) ...@@ -51,8 +51,10 @@ static void destroy_event( GtkWidget *w, gpointer data)
NodelistGtk::NodelistGtk( void *nodelist_parent_ctx, NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
GtkWidget *nodelist_parent_wid, GtkWidget *nodelist_parent_wid,
char *nodelist_name, int nodelist_mode, char *nodelist_name, int nodelist_mode,
int msgw_pop, pwr_tStatus *status) : int nodelist_view_node_descr, int msgw_pop,
Nodelist( nodelist_parent_ctx, nodelist_name, nodelist_mode, status), pwr_tStatus *status) :
Nodelist( nodelist_parent_ctx, nodelist_name, nodelist_mode,
nodelist_view_node_descr, status),
parent_wid(nodelist_parent_wid), clock_cursor(0), india_widget(0) parent_wid(nodelist_parent_wid), clock_cursor(0), india_widget(0)
{ {
pwr_tStatus sts; pwr_tStatus sts;
...@@ -246,8 +248,8 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx, ...@@ -246,8 +248,8 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
msg_window->find_wnav_cb = find_node_cb; msg_window->find_wnav_cb = find_node_cb;
msg_window->msg( 'I', "Status Montitor started"); msg_window->msg( 'I', "Status Montitor started");
nodelistnav = new NodelistNavGtk( this, vbox, msg_window, 0, mode, msgw_pop, nodelistnav = new NodelistNavGtk( this, vbox, msg_window, 0, mode, view_node_descr,
&nodelistnav_widget); msgw_pop, &nodelistnav_widget);
// Toolbar // Toolbar
GtkToolbar *tools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL); GtkToolbar *tools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL);
...@@ -551,9 +553,9 @@ void NodelistGtk::activate_help( GtkWidget *w, gpointer data) ...@@ -551,9 +553,9 @@ void NodelistGtk::activate_help( GtkWidget *w, gpointer data)
nodelist->activate_help(); nodelist->activate_help();
} }
void NodelistGtk::open_input_dialog( char *text, char *text2, char *title, void NodelistGtk::open_input_dialog( char *text, char *text2, char *text3,
char *init_text, char *title, char *init_text,
void (*ok_cb)( Nodelist *, char *, char *)) void (*ok_cb)( Nodelist *, char *, char *, char *))
{ {
create_input_dialog(); create_input_dialog();
...@@ -564,6 +566,7 @@ void NodelistGtk::open_input_dialog( char *text, char *text2, char *title, ...@@ -564,6 +566,7 @@ void NodelistGtk::open_input_dialog( char *text, char *text2, char *title,
gtk_label_set_text( GTK_LABEL(india_label), text); gtk_label_set_text( GTK_LABEL(india_label), text);
gtk_label_set_text( GTK_LABEL(india_label2), text2); gtk_label_set_text( GTK_LABEL(india_label2), text2);
gtk_label_set_text( GTK_LABEL(india_label3), text3);
gint pos = 0; gint pos = 0;
gtk_editable_delete_text( GTK_EDITABLE(india_text), 0, -1); gtk_editable_delete_text( GTK_EDITABLE(india_text), 0, -1);
...@@ -576,7 +579,7 @@ void NodelistGtk::open_input_dialog( char *text, char *text2, char *title, ...@@ -576,7 +579,7 @@ void NodelistGtk::open_input_dialog( char *text, char *text2, char *title,
void NodelistGtk::activate_india_ok( GtkWidget *w, gpointer data) void NodelistGtk::activate_india_ok( GtkWidget *w, gpointer data)
{ {
Nodelist *nodelist = (Nodelist *)data; Nodelist *nodelist = (Nodelist *)data;
char *text, *text2, *textutf8; char *text, *text2, *text3, *textutf8;
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(((NodelistGtk *)nodelist)->india_text), textutf8 = gtk_editable_get_chars( GTK_EDITABLE(((NodelistGtk *)nodelist)->india_text),
0, -1); 0, -1);
...@@ -588,9 +591,14 @@ void NodelistGtk::activate_india_ok( GtkWidget *w, gpointer data) ...@@ -588,9 +591,14 @@ void NodelistGtk::activate_india_ok( GtkWidget *w, gpointer data)
text2 = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL); text2 = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8); g_free( textutf8);
textutf8 = gtk_editable_get_chars( GTK_EDITABLE(((NodelistGtk *)nodelist)->india_text3),
0, -1);
text3 = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
g_free( textutf8);
g_object_set( ((NodelistGtk *)nodelist)->india_widget, "visible", FALSE, NULL); g_object_set( ((NodelistGtk *)nodelist)->india_widget, "visible", FALSE, NULL);
(nodelist->india_ok_cb)( nodelist, text, text2); (nodelist->india_ok_cb)( nodelist, text, text2, text3);
g_free( text); g_free( text);
} }
...@@ -628,13 +636,17 @@ void NodelistGtk::create_input_dialog() ...@@ -628,13 +636,17 @@ void NodelistGtk::create_input_dialog()
india_text2 = gtk_entry_new(); india_text2 = gtk_entry_new();
g_signal_connect( india_text2, "activate", g_signal_connect( india_text2, "activate",
G_CALLBACK(NodelistGtk::activate_india_ok), this); G_CALLBACK(NodelistGtk::activate_india_ok), this);
india_text3 = gtk_entry_new();
g_signal_connect( india_text3, "activate",
G_CALLBACK(NodelistGtk::activate_india_ok), this);
india_label = gtk_label_new(""); india_label = gtk_label_new("");
india_label2 = gtk_label_new(""); india_label2 = gtk_label_new("");
india_label3 = gtk_label_new("");
GtkWidget *india_image = (GtkWidget *)g_object_new( GTK_TYPE_IMAGE, GtkWidget *india_image = (GtkWidget *)g_object_new( GTK_TYPE_IMAGE,
"stock", GTK_STOCK_DIALOG_QUESTION, "stock", GTK_STOCK_DIALOG_QUESTION,
"icon-size", GTK_ICON_SIZE_DIALOG, "icon-size", GTK_ICON_SIZE_DIALOG,
"xalign", 0.5, "xalign", 0.5,
"yalign", 1.0, "yalign", 0.4,
NULL); NULL);
GtkWidget *india_ok = gtk_button_new_with_label( "Ok"); GtkWidget *india_ok = gtk_button_new_with_label( "Ok");
...@@ -647,15 +659,17 @@ void NodelistGtk::create_input_dialog() ...@@ -647,15 +659,17 @@ void NodelistGtk::create_input_dialog()
G_CALLBACK(NodelistGtk::activate_india_cancel), this); G_CALLBACK(NodelistGtk::activate_india_cancel), this);
GtkWidget *india_vboxtext = gtk_vbox_new( FALSE, 0); GtkWidget *india_vboxtext = gtk_vbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(india_vboxtext), india_text, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(india_vboxtext), india_text, FALSE, FALSE, 12);
gtk_box_pack_start( GTK_BOX(india_vboxtext), india_text2, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(india_vboxtext), india_text2, FALSE, FALSE, 12);
gtk_box_pack_start( GTK_BOX(india_vboxtext), india_text3, FALSE, FALSE, 12);
GtkWidget *india_vboxlabel = gtk_vbox_new( FALSE, 0); GtkWidget *india_vboxlabel = gtk_vbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(india_vboxlabel), india_label, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(india_vboxlabel), india_label, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(india_vboxlabel), india_label2, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(india_vboxlabel), india_label2, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(india_vboxlabel), india_label3, FALSE, FALSE, 15);
GtkWidget *india_hboxtext = gtk_hbox_new( FALSE, 0); GtkWidget *india_hboxtext = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(india_hboxtext), india_image, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(india_hboxtext), india_image, FALSE, FALSE, 40);
gtk_box_pack_start( GTK_BOX(india_hboxtext), india_vboxlabel, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(india_hboxtext), india_vboxlabel, FALSE, FALSE, 15);
gtk_box_pack_end( GTK_BOX(india_hboxtext), india_vboxtext, TRUE, TRUE, 30); gtk_box_pack_end( GTK_BOX(india_hboxtext), india_vboxtext, TRUE, TRUE, 30);
......
/* /*
* Proview $Id: co_statusmon_nodelist_gtk.h,v 1.5 2007-09-06 11:22:18 claes Exp $ * Proview $Id: co_statusmon_nodelist_gtk.h,v 1.6 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -34,7 +34,8 @@ class NodelistGtk : public Nodelist { ...@@ -34,7 +34,8 @@ class NodelistGtk : public Nodelist {
public: public:
NodelistGtk( void *nodelist_parent_ctx, NodelistGtk( void *nodelist_parent_ctx,
GtkWidget *nodelist_parent_wid, GtkWidget *nodelist_parent_wid,
char *nodelist_name, int nodelist_mode, int msgw_pop, char *nodelist_name, int nodelist_mode,
int nodelist_view_node_descr, int msgw_pop,
pwr_tStatus *status); pwr_tStatus *status);
~NodelistGtk(); ~NodelistGtk();
...@@ -47,8 +48,10 @@ class NodelistGtk : public Nodelist { ...@@ -47,8 +48,10 @@ class NodelistGtk : public Nodelist {
GtkWidget *india_widget; GtkWidget *india_widget;
GtkWidget *india_label; GtkWidget *india_label;
GtkWidget *india_label2; GtkWidget *india_label2;
GtkWidget *india_label3;
GtkWidget *india_text; GtkWidget *india_text;
GtkWidget *india_text2; GtkWidget *india_text2;
GtkWidget *india_text3;
CoWowFocusTimerGtk focustimer; CoWowFocusTimerGtk focustimer;
void pop(); void pop();
...@@ -56,9 +59,9 @@ class NodelistGtk : public Nodelist { ...@@ -56,9 +59,9 @@ class NodelistGtk : public Nodelist {
void reset_cursor(); void reset_cursor();
void free_cursor(); void free_cursor();
void create_input_dialog(); void create_input_dialog();
void open_input_dialog( char *text, char *text2, char *title, void open_input_dialog( char *text, char *text2, char *text3, char *title,
char *init_text, char *init_text,
void (*ok_cb)( Nodelist *, char *, char *)); void (*ok_cb)( Nodelist *, char *, char *, char *));
static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data); static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void activate_exit( GtkWidget*w, gpointer data); static void activate_exit( GtkWidget*w, gpointer data);
......
/* /*
* Proview $Id: co_statusmon_nodelistnav_gtk.cpp,v 1.4 2007-09-06 11:22:18 claes Exp $ * Proview $Id: co_statusmon_nodelistnav_gtk.cpp,v 1.5 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -43,10 +43,11 @@ NodelistNavGtk::NodelistNavGtk( void *nodelist_parent_ctx, ...@@ -43,10 +43,11 @@ NodelistNavGtk::NodelistNavGtk( void *nodelist_parent_ctx,
MsgWindow *nodelist_msg_window, MsgWindow *nodelist_msg_window,
char *nodelist_nodename, char *nodelist_nodename,
int nodelist_mode, int nodelist_mode,
int nodelist_view_node_descr,
int nodelist_msgw_pop, int nodelist_msgw_pop,
GtkWidget **w) : GtkWidget **w) :
NodelistNav( nodelist_parent_ctx, nodelist_msg_window, nodelist_nodename, NodelistNav( nodelist_parent_ctx, nodelist_msg_window, nodelist_nodename,
nodelist_mode, nodelist_msgw_pop), nodelist_mode, nodelist_view_node_descr, nodelist_msgw_pop),
parent_wid(nodelist_parent_wid) parent_wid(nodelist_parent_wid)
{ {
form_widget = scrolledbrowwidgetgtk_new( init_brow_cb, this, &brow_widget); form_widget = scrolledbrowwidgetgtk_new( init_brow_cb, this, &brow_widget);
......
/* /*
* Proview $Id: co_statusmon_nodelistnav_gtk.h,v 1.2 2007-09-06 11:22:18 claes Exp $ * Proview $Id: co_statusmon_nodelistnav_gtk.h,v 1.3 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -35,7 +35,8 @@ class NodelistNavGtk : public NodelistNav { ...@@ -35,7 +35,8 @@ class NodelistNavGtk : public NodelistNav {
GtkWidget *nodelistnav_parent_wid, GtkWidget *nodelistnav_parent_wid,
MsgWindow *nodelistnav_msg_window, MsgWindow *nodelistnav_msg_window,
char *nodelistnav_msg_nodename, char *nodelistnav_msg_nodename,
int nodelistnav_mode, int nodelist_msgw_pop, int nodelistnav_mode, int nodelistnav_view_node_descr,
int nodelist_msgw_pop,
GtkWidget **w); GtkWidget **w);
~NodelistNavGtk(); ~NodelistNavGtk();
......
/* /*
* Proview $Id: co_statusmon_nodelist.cpp,v 1.7 2007-09-06 11:22:18 claes Exp $ * Proview $Id: co_statusmon_nodelist.cpp,v 1.8 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -36,9 +36,11 @@ ...@@ -36,9 +36,11 @@
#include "rt_xnav_msg.h" #include "rt_xnav_msg.h"
Nodelist::Nodelist( void *nodelist_parent_ctx, Nodelist::Nodelist( void *nodelist_parent_ctx,
char *nodelist_name, int nodelist_mode, pwr_tStatus *status) : char *nodelist_name, int nodelist_mode,
int nodelist_view_node_descr, pwr_tStatus *status) :
parent_ctx(nodelist_parent_ctx), parent_ctx(nodelist_parent_ctx),
nodelistnav(NULL), nodelist_displayed(0), help_cb(0), close_cb(0), mode(nodelist_mode) nodelistnav(NULL), nodelist_displayed(0), help_cb(0), close_cb(0), mode(nodelist_mode),
view_node_descr(nodelist_view_node_descr)
{ {
strcpy( remote_gui, ""); strcpy( remote_gui, "");
*status = 1; *status = 1;
...@@ -66,14 +68,15 @@ void Nodelist::find_node_cb( void *ctx, pwr_tOid oid) ...@@ -66,14 +68,15 @@ void Nodelist::find_node_cb( void *ctx, pwr_tOid oid)
nodelist->pop(); nodelist->pop();
} }
void Nodelist::add_node_ok( Nodelist *nodelist, char *node_name, char *opplace) void Nodelist::add_node_ok( Nodelist *nodelist, char *node_name,
char *description, char *opplace)
{ {
nodelist->nodelistnav->add_node( node_name, opplace); nodelist->nodelistnav->add_node( node_name, description, opplace);
} }
void Nodelist::activate_add_node() void Nodelist::activate_add_node()
{ {
open_input_dialog( "Node name", "Operatorplace", "Add Node", "", open_input_dialog( "Node name", "Description", "Operatorplace", "Add Node", "",
add_node_ok); add_node_ok);
} }
......
/* /*
* Proview $Id: co_statusmon_nodelist.h,v 1.5 2007-09-06 11:22:18 claes Exp $ * Proview $Id: co_statusmon_nodelist.h,v 1.6 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -38,6 +38,7 @@ class Nodelist { ...@@ -38,6 +38,7 @@ class Nodelist {
Nodelist( void *nodelist_parent_ctx, Nodelist( void *nodelist_parent_ctx,
char *nodelist_name, char *nodelist_name,
int nodelist_mode, int nodelist_mode,
int nodelist_view_node_descr,
pwr_tStatus *status); pwr_tStatus *status);
virtual ~Nodelist(); virtual ~Nodelist();
...@@ -47,19 +48,20 @@ class Nodelist { ...@@ -47,19 +48,20 @@ class Nodelist {
int nodelist_displayed; int nodelist_displayed;
void (*help_cb)( void *, char *); void (*help_cb)( void *, char *);
void (*close_cb)( void *); void (*close_cb)( void *);
void (*india_ok_cb)( Nodelist *, char *, char *); void (*india_ok_cb)( Nodelist *, char *, char *, char *);
CoWow *wow; CoWow *wow;
MsgWindow *msg_window; MsgWindow *msg_window;
char remote_gui[20]; char remote_gui[20];
int mode; int mode;
int view_node_descr;
virtual void pop() {} virtual void pop() {}
virtual void set_clock_cursor() {} virtual void set_clock_cursor() {}
virtual void reset_cursor() {} virtual void reset_cursor() {}
virtual void free_cursor() {} virtual void free_cursor() {}
virtual void open_input_dialog( char *text, char *text2, char *title, virtual void open_input_dialog( char *text, char *text2, char *text3, char *title,
char *init_text, char *init_text,
void (*ok_cb)( Nodelist *, char *, char *)) {} void (*ok_cb)( Nodelist *, char *, char *, char *)) {}
void set_scantime( float scantime) { nodelistnav->scantime = int(scantime * 1000);} void set_scantime( float scantime) { nodelistnav->scantime = int(scantime * 1000);}
void activate_help(); void activate_help();
...@@ -70,7 +72,8 @@ class Nodelist { ...@@ -70,7 +72,8 @@ class Nodelist {
void activate_open_rtmon(); void activate_open_rtmon();
void activate_save(); void activate_save();
static void find_node_cb( void *ctx, pwr_tOid oid); static void find_node_cb( void *ctx, pwr_tOid oid);
static void add_node_ok( Nodelist *nodelist, char *node_name, char *opplace); static void add_node_ok( Nodelist *nodelist, char *node_name, char *description,
char *opplace);
}; };
#endif #endif
......
/* /*
* Proview $Id: co_statusmon_nodelistnav.cpp,v 1.5 2007-09-06 11:22:18 claes Exp $ * Proview $Id: co_statusmon_nodelistnav.cpp,v 1.6 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -237,7 +237,7 @@ int NodelistNav::init_brow_cb( FlowCtx *fctx, void *client_data) ...@@ -237,7 +237,7 @@ int NodelistNav::init_brow_cb( FlowCtx *fctx, void *client_data)
nodelistnav->brow->create_nodeclasses(); nodelistnav->brow->create_nodeclasses();
if ( strcmp( nodelistnav->nodename, "") != 0) { if ( strcmp( nodelistnav->nodename, "") != 0) {
nodelistnav->add_node( nodelistnav->nodename, ""); nodelistnav->add_node( nodelistnav->nodename, "", "");
nodelistnav->node_list[0].item->open_children( nodelistnav, 0, 0); nodelistnav->node_list[0].item->open_children( nodelistnav, 0, 0);
} }
else else
...@@ -253,11 +253,12 @@ int NodelistNav::init_brow_cb( FlowCtx *fctx, void *client_data) ...@@ -253,11 +253,12 @@ int NodelistNav::init_brow_cb( FlowCtx *fctx, void *client_data)
} }
NodelistNav::NodelistNav( void *nodelist_parent_ctx, MsgWindow *nodelistnav_msg_window, NodelistNav::NodelistNav( void *nodelist_parent_ctx, MsgWindow *nodelistnav_msg_window,
char *nodelistnav_nodename, int nodelistnav_mode, int nodelistnav_msgw_pop) : char *nodelistnav_nodename, int nodelistnav_mode,
int nodelistnav_view_node_descr, int nodelistnav_msgw_pop) :
parent_ctx(nodelist_parent_ctx), parent_ctx(nodelist_parent_ctx),
nodelist_size(0), trace_started(0), scantime(4000), first_scan(1), nodelist_size(0), trace_started(0), scantime(4000), first_scan(1),
msg_window(nodelistnav_msg_window), msgw_pop(nodelistnav_msgw_pop), msg_window(nodelistnav_msg_window), msgw_pop(nodelistnav_msgw_pop),
mode(nodelistnav_mode) mode(nodelistnav_mode), view_node_descr(nodelistnav_view_node_descr)
{ {
if ( nodelistnav_nodename) if ( nodelistnav_nodename)
strcpy( nodename, nodelistnav_nodename); strcpy( nodename, nodelistnav_nodename);
...@@ -281,7 +282,7 @@ NodelistNavBrow::~NodelistNavBrow() ...@@ -281,7 +282,7 @@ NodelistNavBrow::~NodelistNavBrow()
void NodelistNav::read() void NodelistNav::read()
{ {
char line[400]; char line[400];
char line_part[2][256]; char line_part[3][256];
int sts; int sts;
FILE *fp; FILE *fp;
pwr_tFileName fname; pwr_tFileName fname;
...@@ -309,7 +310,10 @@ void NodelistNav::read() ...@@ -309,7 +310,10 @@ void NodelistNav::read()
NodelistNode node( line_part[0]); NodelistNode node( line_part[0]);
if ( num >= 2) if ( num >= 2)
strcpy( node.opplace, line_part[1]); strncpy( node.opplace, line_part[1], sizeof(node.opplace));
if ( num >= 3)
strncpy( node.description, line_part[2], sizeof(node.description));
node_list.push_back( node); node_list.push_back( node);
} }
fclose( fp); fclose( fp);
...@@ -320,7 +324,7 @@ void NodelistNav::read() ...@@ -320,7 +324,7 @@ void NodelistNav::read()
for ( int i = 0; i < (int)node_list.size(); i++) { for ( int i = 0; i < (int)node_list.size(); i++) {
item = new ItemNode( this, node_list[i].node_name, dest, flow_eDest_After); item = new ItemNode( this, node_list[i].node_name, node_list[i].description, dest, flow_eDest_After);
dest = item->node; dest = item->node;
node_list[i].item = item; node_list[i].item = item;
} }
...@@ -911,7 +915,8 @@ int NodelistNav::update_nodes() ...@@ -911,7 +915,8 @@ int NodelistNav::update_nodes()
sizeof(node_list[i].item->data.SystemStatusStr)); sizeof(node_list[i].item->data.SystemStatusStr));
if ( ODD(sts)) { if ( ODD(sts)) {
if ( strcmp( node_list[i].item->data.Description, response.Description) != 0) if ( strcmp( node_list[i].item->data.Description, response.Description) != 0 &&
view_node_descr == 0)
brow_SetAnnotation( node_list[i].item->node, 1, response.Description, brow_SetAnnotation( node_list[i].item->node, 1, response.Description,
strlen(response.Description)); strlen(response.Description));
...@@ -951,10 +956,8 @@ void NodelistNav::save() ...@@ -951,10 +956,8 @@ void NodelistNav::save()
return; return;
for ( int i = 0; i < (int)node_list.size(); i++) { for ( int i = 0; i < (int)node_list.size(); i++) {
fprintf( fp, "%s", node_list[i].node_name); fprintf( fp, "%s \"%s\" \"%s\"\n", node_list[i].node_name, node_list[i].opplace,
if ( strcmp( node_list[i].opplace, "") != 0) node_list[i].description);
fprintf( fp, " %s", node_list[i].opplace);
fprintf( fp, "\n");
} }
fclose( fp); fclose( fp);
...@@ -1019,7 +1022,7 @@ void NodelistNav::remove_node( char *name) ...@@ -1019,7 +1022,7 @@ void NodelistNav::remove_node( char *name)
} }
} }
void NodelistNav::add_node( char *name, char *opplace) void NodelistNav::add_node( char *name, char *description, char *opplace)
{ {
brow_tNode *nodelist; brow_tNode *nodelist;
int node_count; int node_count;
...@@ -1044,6 +1047,7 @@ void NodelistNav::add_node( char *name, char *opplace) ...@@ -1044,6 +1047,7 @@ void NodelistNav::add_node( char *name, char *opplace)
NodelistNode node( name); NodelistNode node( name);
strcpy( node.opplace, opplace); strcpy( node.opplace, opplace);
strcpy( node.description, description);
if ( idx == (int)node_list.size()) if ( idx == (int)node_list.size())
node_list.push_back( node); node_list.push_back( node);
...@@ -1055,16 +1059,19 @@ void NodelistNav::add_node( char *name, char *opplace) ...@@ -1055,16 +1059,19 @@ void NodelistNav::add_node( char *name, char *opplace)
node_list[idx] = node; node_list[idx] = node;
} }
item = new ItemNode( this, name, nodelist[0], flow_eDest_After);
item = new ItemNode( this, name, node_list[idx].description, nodelist[0],
flow_eDest_After);
node_list[idx].item = item; node_list[idx].item = item;
} }
else { else {
// Nothing selected, insert last // Nothing selected, insert last
NodelistNode node( name); NodelistNode node( name);
strcpy( node.opplace, opplace); strcpy( node.opplace, opplace);
strcpy( node.description, description);
node_list.push_back( node); node_list.push_back( node);
item = new ItemNode( this, name, 0, flow_eDest_IntoLast); item = new ItemNode( this, name, node.description, 0, flow_eDest_IntoLast);
node_list[node_list.size()-1].item = item; node_list[node_list.size()-1].item = item;
} }
} }
...@@ -1124,18 +1131,22 @@ void NodelistNav::attrvalue_to_string( int type_id, void *value_ptr, ...@@ -1124,18 +1131,22 @@ void NodelistNav::attrvalue_to_string( int type_id, void *value_ptr,
} }
} }
ItemNode::ItemNode( NodelistNav *item_nodelistnav, char *item_name, ItemNode::ItemNode( NodelistNav *item_nodelistnav, char *item_name, char *item_node_descr,
brow_tNode dest, flow_eDest dest_code): brow_tNode dest, flow_eDest dest_code):
ItemBase( item_nodelistnav, item_name), syssts_open(0) ItemBase( item_nodelistnav, item_name), syssts_open(0)
{ {
type = nodelistnav_eItemType_Node; type = nodelistnav_eItemType_Node;
strcpy( name, item_name); strcpy( name, item_name);
strcpy( node_descr, item_node_descr);
memset( &xdata, 0, sizeof(xdata)); memset( &xdata, 0, sizeof(xdata));
brow_CreateNode( nodelistnav->brow->ctx, item_name, nodelistnav->brow->nc_node, brow_CreateNode( nodelistnav->brow->ctx, item_name, nodelistnav->brow->nc_node,
dest, dest_code, (void *) this, 1, &node); dest, dest_code, (void *) this, 1, &node);
brow_SetAnnotation( node, 0, name, strlen(name)); brow_SetAnnotation( node, 0, name, strlen(name));
if ( nodelistnav->view_node_descr)
brow_SetAnnotation( node, 1, node_descr, strlen(node_descr));
else
brow_SetAnnotation( node, 1, data.Description, strlen(data.Description)); brow_SetAnnotation( node, 1, data.Description, strlen(data.Description));
brow_SetAnnotPixmap( node, 0, nodelistnav->brow->pixmap_map); brow_SetAnnotPixmap( node, 0, nodelistnav->brow->pixmap_map);
} }
......
/* /*
* Proview $Id: co_statusmon_nodelistnav.h,v 1.3 2007-09-06 11:22:18 claes Exp $ * Proview $Id: co_statusmon_nodelistnav.h,v 1.4 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -125,8 +125,10 @@ class NodelistNode { ...@@ -125,8 +125,10 @@ class NodelistNode {
{ {
strncpy( node_name, name, sizeof(node_name)); strncpy( node_name, name, sizeof(node_name));
strcpy( opplace, ""); strcpy( opplace, "");
strcpy( description, "");
} }
char node_name[80]; char node_name[80];
char description[80];
pwr_tOName opplace; pwr_tOName opplace;
ItemNode *item; ItemNode *item;
pwr_tStatus connection_sts; pwr_tStatus connection_sts;
...@@ -137,7 +139,7 @@ class NodelistNav { ...@@ -137,7 +139,7 @@ class NodelistNav {
public: public:
NodelistNav( void *ev_parent_ctx, MsgWindow *nodelistnav_msg_window, NodelistNav( void *ev_parent_ctx, MsgWindow *nodelistnav_msg_window,
char *nodelistnav_nodename, int nodelistnav_mode, char *nodelistnav_nodename, int nodelistnav_mode,
int nodelistnav_msgw_pop); int nodelistnav_view_node_descr, int nodelistnav_msgw_pop);
virtual ~NodelistNav(); virtual ~NodelistNav();
void *parent_ctx; void *parent_ctx;
...@@ -154,6 +156,7 @@ class NodelistNav { ...@@ -154,6 +156,7 @@ class NodelistNav {
static const char config_file[40]; static const char config_file[40];
int msgw_pop; int msgw_pop;
int mode; int mode;
int view_node_descr;
virtual void set_input_focus() {} virtual void set_input_focus() {}
virtual void trace_start() {} virtual void trace_start() {}
...@@ -174,7 +177,7 @@ class NodelistNav { ...@@ -174,7 +177,7 @@ class NodelistNav {
int get_selected_node( char *name); int get_selected_node( char *name);
int get_selected_opplace( char *opplace); int get_selected_opplace( char *opplace);
void save(); void save();
void add_node( char *name, char *opplace); void add_node( char *name, char *description, char *opplace);
void set_msgw_pop( int pop) { msgw_pop = pop;} void set_msgw_pop( int pop) { msgw_pop = pop;}
static void attrvalue_to_string( int type_id, void *value_ptr, static void attrvalue_to_string( int type_id, void *value_ptr,
...@@ -207,12 +210,13 @@ class ItemBase { ...@@ -207,12 +210,13 @@ class ItemBase {
class ItemNode : public ItemBase { class ItemNode : public ItemBase {
public: public:
ItemNode( NodelistNav *item_nodelistnav, char *item_name, ItemNode( NodelistNav *item_nodelistnav, char *item_name, char *item_node_descr,
brow_tNode dest, flow_eDest dest_code); brow_tNode dest, flow_eDest dest_code);
NodeData data; NodeData data;
statussrv_sGetExtStatus xdata; statussrv_sGetExtStatus xdata;
int syssts_open; int syssts_open;
char node_descr[80];
int open_children( NodelistNav *nodelistnav, double x, double y); int open_children( NodelistNav *nodelistnav, double x, double y);
int close( NodelistNav *nodelistnav, double x, double y); int close( NodelistNav *nodelistnav, double x, double y);
......
/* /*
* Proview $Id: wb_wtt_gtk.cpp,v 1.18 2007-09-21 10:49:39 claes Exp $ * Proview $Id: wb_wtt_gtk.cpp,v 1.19 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -892,7 +892,7 @@ void WttGtk::activate_statusmon( GtkWidget *w, gpointer data) ...@@ -892,7 +892,7 @@ void WttGtk::activate_statusmon( GtkWidget *w, gpointer data)
pwr_tStatus sts; pwr_tStatus sts;
Nodelist *nl = new NodelistGtk( wtt, ((WttGtk *)wtt)->toplevel, "Supervision Center", Nodelist *nl = new NodelistGtk( wtt, ((WttGtk *)wtt)->toplevel, "Supervision Center",
nodelist_eMode_SystemStatus, 0, &sts); nodelist_eMode_SystemStatus, 0, 0, &sts);
nl->set_scantime(3); nl->set_scantime(3);
nl->help_cb = wtt_help_cb; nl->help_cb = wtt_help_cb;
} }
......
/* /*
* Proview $Id: rt_statusmon_gtk.cpp,v 1.5 2007-09-07 06:26:50 claes Exp $ * Proview $Id: rt_statusmon_gtk.cpp,v 1.6 2007-10-02 15:53:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -45,6 +45,7 @@ int main( int argc, char *argv[]) ...@@ -45,6 +45,7 @@ int main( int argc, char *argv[])
{ {
int sts; int sts;
int mode = nodelist_eMode_SystemStatus; int mode = nodelist_eMode_SystemStatus;
int view_descr = 0;
if ( argc > 1) { if ( argc > 1) {
for ( int i = 1; i < argc; i++) { for ( int i = 1; i < argc; i++) {
...@@ -71,13 +72,18 @@ int main( int argc, char *argv[]) ...@@ -71,13 +72,18 @@ int main( int argc, char *argv[])
usage(); usage();
exit(0); exit(0);
} }
i++;
}
else if ( strcmp( argv[i], "-e") == 0) {
view_descr = 1;
} }
} }
} }
gtk_init( &argc, &argv); gtk_init( &argc, &argv);
Nodelist *nl = new NodelistGtk( NULL, NULL, "Status Monitor", mode, msgw_ePop_No, &sts); Nodelist *nl = new NodelistGtk( NULL, NULL, "Status Monitor", mode, view_descr,
msgw_ePop_No, &sts);
nl->close_cb = statusmon_close; nl->close_cb = statusmon_close;
nl->set_scantime(3); nl->set_scantime(3);
......
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