Commit 985d09d0 authored by claes's avatar claes

Open xtt and opplace added

parent ee08fd46
/* /*
* Proview $Id: co_statusmon_nodelist_gtk.cpp,v 1.1 2007-05-16 12:32:26 claes Exp $ * Proview $Id: co_statusmon_nodelist_gtk.cpp,v 1.2 2007-05-21 14:20:58 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
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "rt_gdh.h" #include "rt_gdh.h"
#include "co_lng.h" #include "co_lng.h"
#include "co_dcli.h"
#include "co_wow_gtk.h" #include "co_wow_gtk.h"
#include "co_msgwindow_gtk.h" #include "co_msgwindow_gtk.h"
#include "co_statusmon_nodelist.h" #include "co_statusmon_nodelist.h"
...@@ -92,16 +93,24 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx, ...@@ -92,16 +93,24 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
GtkWidget *file_remove_node = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Remove Node")); GtkWidget *file_remove_node = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Remove Node"));
g_signal_connect(file_remove_node, "activate", G_CALLBACK(activate_remove_node), this); g_signal_connect(file_remove_node, "activate", G_CALLBACK(activate_remove_node), this);
GtkWidget *file_open_xtt = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Open _Runtime Navigator"));
g_signal_connect(file_open_xtt, "activate", G_CALLBACK(activate_open_xtt), this);
GtkWidget *file_open_opplace = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Open Operatorplace"));
g_signal_connect(file_open_opplace, "activate", G_CALLBACK(activate_open_opplace), this);
GtkWidget *file_save = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Save Configuration")); GtkWidget *file_save = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Save Configuration"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(file_save), gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(file_save),
gtk_image_new_from_stock( "gtk-save", GTK_ICON_SIZE_MENU)); gtk_image_new_from_stock( "gtk-save", GTK_ICON_SIZE_MENU));
g_signal_connect(file_save, "activate", G_CALLBACK(activate_save), this); g_signal_connect(file_save, "activate", G_CALLBACK(activate_save), this);
GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL); GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_save);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_add_node); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_add_node);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_remove_node); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_remove_node);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_save); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_open_xtt);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_open_opplace);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
GtkWidget *file = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_File")); GtkWidget *file = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_File"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file); gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file);
...@@ -191,6 +200,23 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx, ...@@ -191,6 +200,23 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
g_object_set( tools_remove_node, "can-focus", FALSE, NULL); g_object_set( tools_remove_node, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_remove_node,CoWowGtk::translate_utf8("Remove node"), ""); gtk_toolbar_append_widget( tools, tools_remove_node,CoWowGtk::translate_utf8("Remove node"), "");
pwr_tFileName fname;
GtkWidget *tools_xtt = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_navigator.png");
gtk_container_add( GTK_CONTAINER(tools_xtt),
gtk_image_new_from_file( fname));
g_signal_connect(tools_xtt, "clicked", G_CALLBACK(activate_open_xtt), this);
g_object_set( tools_xtt, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_xtt,CoWowGtk::translate_utf8("Start Runtime Navigator on selected node"), "");
GtkWidget *tools_op = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_op.png");
gtk_container_add( GTK_CONTAINER(tools_op),
gtk_image_new_from_file( fname));
g_signal_connect(tools_op, "clicked", G_CALLBACK(activate_open_opplace), this);
g_object_set( tools_op, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_op,CoWowGtk::translate_utf8("Start Operatorplace on selected node"), "");
GtkWidget *tools_zoom_in = gtk_button_new(); GtkWidget *tools_zoom_in = gtk_button_new();
gtk_container_add( GTK_CONTAINER(tools_zoom_in), gtk_container_add( GTK_CONTAINER(tools_zoom_in),
gtk_image_new_from_stock( "gtk-zoom-in", GTK_ICON_SIZE_SMALL_TOOLBAR)); gtk_image_new_from_stock( "gtk-zoom-in", GTK_ICON_SIZE_SMALL_TOOLBAR));
...@@ -299,6 +325,20 @@ void NodelistGtk::activate_remove_node( GtkWidget *w, gpointer data) ...@@ -299,6 +325,20 @@ void NodelistGtk::activate_remove_node( GtkWidget *w, gpointer data)
nodelist->activate_remove_node(); nodelist->activate_remove_node();
} }
void NodelistGtk::activate_open_xtt( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
nodelist->activate_open_xtt();
}
void NodelistGtk::activate_open_opplace( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
nodelist->activate_open_opplace();
}
void NodelistGtk::activate_save( GtkWidget *w, gpointer data) void NodelistGtk::activate_save( GtkWidget *w, gpointer data)
{ {
Nodelist *nodelist = (Nodelist *)data; Nodelist *nodelist = (Nodelist *)data;
...@@ -349,9 +389,9 @@ void NodelistGtk::activate_help( GtkWidget *w, gpointer data) ...@@ -349,9 +389,9 @@ void NodelistGtk::activate_help( GtkWidget *w, gpointer data)
nodelist->activate_help(); nodelist->activate_help();
} }
void NodelistGtk::open_input_dialog( char *text, char *title, void NodelistGtk::open_input_dialog( char *text, char *text2, char *title,
char *init_text, char *init_text,
void (*ok_cb)( Nodelist *, char *)) void (*ok_cb)( Nodelist *, char *, char *))
{ {
create_input_dialog(); create_input_dialog();
...@@ -361,6 +401,7 @@ void NodelistGtk::open_input_dialog( char *text, char *title, ...@@ -361,6 +401,7 @@ void NodelistGtk::open_input_dialog( char *text, char *title,
NULL); NULL);
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);
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);
...@@ -373,17 +414,21 @@ void NodelistGtk::open_input_dialog( char *text, char *title, ...@@ -373,17 +414,21 @@ void NodelistGtk::open_input_dialog( char *text, 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, *textutf8; char *text, *text2, *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);
text = g_convert( textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL); text = 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_text2),
0, -1);
text2 = 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);
printf( "Add node %s\n", text); (nodelist->india_ok_cb)( nodelist, text, text2);
(nodelist->india_ok_cb)( nodelist, text);
g_free( text); g_free( text);
} }
...@@ -418,7 +463,11 @@ void NodelistGtk::create_input_dialog() ...@@ -418,7 +463,11 @@ void NodelistGtk::create_input_dialog()
india_text = gtk_entry_new(); india_text = gtk_entry_new();
g_signal_connect( india_text, "activate", g_signal_connect( india_text, "activate",
G_CALLBACK(NodelistGtk::activate_india_ok), this); G_CALLBACK(NodelistGtk::activate_india_ok), this);
india_text2 = gtk_entry_new();
g_signal_connect( india_text2, "activate",
G_CALLBACK(NodelistGtk::activate_india_ok), this);
india_label = gtk_label_new(""); india_label = gtk_label_new("");
india_label2 = 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,
...@@ -435,10 +484,18 @@ void NodelistGtk::create_input_dialog() ...@@ -435,10 +484,18 @@ void NodelistGtk::create_input_dialog()
g_signal_connect( india_cancel, "clicked", g_signal_connect( india_cancel, "clicked",
G_CALLBACK(NodelistGtk::activate_india_cancel), this); G_CALLBACK(NodelistGtk::activate_india_cancel), this);
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_text2, FALSE, FALSE, 15);
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_label2, 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, 15);
gtk_box_pack_start( GTK_BOX(india_hboxtext), india_label, 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_text, TRUE, TRUE, 30); gtk_box_pack_end( GTK_BOX(india_hboxtext), india_vboxtext, TRUE, TRUE, 30);
GtkWidget *india_hboxbuttons = gtk_hbox_new( TRUE, 40); GtkWidget *india_hboxbuttons = gtk_hbox_new( TRUE, 40);
gtk_box_pack_start( GTK_BOX(india_hboxbuttons), india_ok, FALSE, FALSE, 0); gtk_box_pack_start( GTK_BOX(india_hboxbuttons), india_ok, FALSE, FALSE, 0);
......
/* /*
* Proview $Id: co_statusmon_nodelist_gtk.h,v 1.1 2007-05-16 12:32:26 claes Exp $ * Proview $Id: co_statusmon_nodelist_gtk.h,v 1.2 2007-05-21 14:20:58 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
...@@ -46,7 +46,9 @@ class NodelistGtk : public Nodelist { ...@@ -46,7 +46,9 @@ class NodelistGtk : public Nodelist {
GdkCursor *clock_cursor; GdkCursor *clock_cursor;
GtkWidget *india_widget; GtkWidget *india_widget;
GtkWidget *india_label; GtkWidget *india_label;
GtkWidget *india_label2;
GtkWidget *india_text; GtkWidget *india_text;
GtkWidget *india_text2;
CoWowFocusTimerGtk focustimer; CoWowFocusTimerGtk focustimer;
void pop(); void pop();
...@@ -54,14 +56,16 @@ class NodelistGtk : public Nodelist { ...@@ -54,14 +56,16 @@ 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 *title, void open_input_dialog( char *text, char *text2, char *title,
char *init_text, char *init_text,
void (*ok_cb)( Nodelist *, char *)); void (*ok_cb)( Nodelist *, 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);
static void activate_add_node( GtkWidget*w, gpointer data); static void activate_add_node( GtkWidget*w, gpointer data);
static void activate_remove_node( GtkWidget*w, gpointer data); static void activate_remove_node( GtkWidget*w, gpointer data);
static void activate_open_xtt( GtkWidget*w, gpointer data);
static void activate_open_opplace( GtkWidget*w, gpointer data);
static void activate_save( GtkWidget*w, gpointer data); static void activate_save( GtkWidget*w, gpointer data);
static void activate_show_events( GtkWidget *w, gpointer data); static void activate_show_events( GtkWidget *w, gpointer data);
static void activate_pop_events( GtkWidget *w, gpointer data); static void activate_pop_events( GtkWidget *w, gpointer data);
......
/* /*
* Proview $Id: co_statusmon_nodelist.cpp,v 1.1 2007-05-16 12:32:26 claes Exp $ * Proview $Id: co_statusmon_nodelist.cpp,v 1.2 2007-05-21 14:20:58 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
...@@ -28,10 +28,12 @@ ...@@ -28,10 +28,12 @@
#include "co_time.h" #include "co_time.h"
#include "pwr_baseclasses.h" #include "pwr_baseclasses.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_syi.h"
#include "co_lng.h" #include "co_lng.h"
#include "co_wow.h" #include "co_wow.h"
#include "co_statusmon_nodelist.h" #include "co_statusmon_nodelist.h"
#include "statussrv_utl.h"
#include "rt_xnav_msg.h" #include "rt_xnav_msg.h"
Nodelist::Nodelist( void *nodelist_parent_ctx, Nodelist::Nodelist( void *nodelist_parent_ctx,
...@@ -64,14 +66,14 @@ void Nodelist::find_node_cb( void *ctx, pwr_tOid oid) ...@@ -64,14 +66,14 @@ void Nodelist::find_node_cb( void *ctx, pwr_tOid oid)
nodelist->pop(); nodelist->pop();
} }
void Nodelist::add_node_ok( Nodelist *nodelist, char *node_name) void Nodelist::add_node_ok( Nodelist *nodelist, char *node_name, char *opplace)
{ {
nodelist->nodelistnav->add_node( node_name); nodelist->nodelistnav->add_node( node_name, opplace);
} }
void Nodelist::activate_add_node() void Nodelist::activate_add_node()
{ {
open_input_dialog( "Enter node name", "Add Node", "", open_input_dialog( "Node name", "Operatorplace", "Add Node", "",
add_node_ok); add_node_ok);
} }
...@@ -99,6 +101,59 @@ void Nodelist::activate_remove_node() ...@@ -99,6 +101,59 @@ void Nodelist::activate_remove_node()
NULL, node_name); NULL, node_name);
} }
static void get_display( char *disp)
{
char display[80] = "";
char name[80];
pwr_tStatus sts;
char *val = getenv("DISPLAY");
if ( val)
strcpy( display, val);
if ( strcmp( display, "") == 0 ||
strcmp( display, ":0") == 0) {
syi_NodeName( &sts, name, sizeof(name));
strcpy( display, name);
strcat( display, ":0");
}
strcpy( disp, display);
}
void Nodelist::activate_open_xtt()
{
char node_name[80];
int sts;
char display[80];
sts = nodelistnav->get_selected_node( node_name);
if ( EVEN(sts)) {
nodelistnav->wow->DisplayError( "Open Xtt", "Select a node");
return;
}
get_display( display);
statussrv_XttStart( node_name, "", "", display);
}
void Nodelist::activate_open_opplace()
{
int sts;
char node_name[80];
pwr_tOName opplace;
char display[80];
sts = nodelistnav->get_selected_node( node_name);
if ( EVEN(sts)) {
nodelistnav->wow->DisplayError( "Open Xtt", "Select a node");
return;
}
sts = nodelistnav->get_selected_opplace( opplace);
get_display( display);
statussrv_XttStart( node_name, opplace, "", display);
}
void Nodelist::activate_save() void Nodelist::activate_save()
{ {
nodelistnav->save(); nodelistnav->save();
......
/* /*
* Proview $Id: co_statusmon_nodelist.h,v 1.1 2007-05-16 12:32:26 claes Exp $ * Proview $Id: co_statusmon_nodelist.h,v 1.2 2007-05-21 14:20:58 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
...@@ -46,7 +46,7 @@ class Nodelist { ...@@ -46,7 +46,7 @@ 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 *); void (*india_ok_cb)( Nodelist *, char *, char *);
CoWow *wow; CoWow *wow;
MsgWindow *msg_window; MsgWindow *msg_window;
...@@ -54,17 +54,19 @@ class Nodelist { ...@@ -54,17 +54,19 @@ class Nodelist {
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 *title, virtual void open_input_dialog( char *text, char *text2, char *title,
char *init_text, char *init_text,
void (*ok_cb)( Nodelist *, char *)) {} void (*ok_cb)( Nodelist *, 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();
void activate_add_node(); void activate_add_node();
void activate_remove_node(); void activate_remove_node();
void activate_open_xtt();
void activate_open_opplace();
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); static void add_node_ok( Nodelist *nodelist, char *node_name, char *opplace);
}; };
#endif #endif
......
/* /*
* Proview $Id: co_statusmon_nodelistnav.cpp,v 1.1 2007-05-16 12:32:26 claes Exp $ * Proview $Id: co_statusmon_nodelistnav.cpp,v 1.2 2007-05-21 14:20:58 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
...@@ -279,6 +279,7 @@ NodelistNavBrow::~NodelistNavBrow() ...@@ -279,6 +279,7 @@ NodelistNavBrow::~NodelistNavBrow()
void NodelistNav::read() void NodelistNav::read()
{ {
char line[400]; char line[400];
char line_part[2][256];
int sts; int sts;
FILE *fp; FILE *fp;
pwr_tFileName fname; pwr_tFileName fname;
...@@ -301,7 +302,12 @@ void NodelistNav::read() ...@@ -301,7 +302,12 @@ void NodelistNav::read()
if ( line[0] == 0 || line[0] == '#' || line[0] == '!') if ( line[0] == 0 || line[0] == '#' || line[0] == '!')
continue; continue;
NodelistNode node( line); int num = dcli_parse( line, " ", "", (char *)line_part,
sizeof(line_part)/sizeof(line_part[0]), sizeof(line_part[0]), 0);
NodelistNode node( line_part[0]);
if ( num >= 2)
strcpy( node.opplace, line_part[1]);
node_list.push_back( node); node_list.push_back( node);
} }
fclose( fp); fclose( fp);
...@@ -923,7 +929,10 @@ void NodelistNav::save() ...@@ -923,7 +929,10 @@ 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\n", node_list[i].node_name); fprintf( fp, "%s", node_list[i].node_name);
if ( strcmp( node_list[i].opplace, "") != 0)
fprintf( fp, " %s", node_list[i].opplace);
fprintf( fp, "\n");
} }
fclose( fp); fclose( fp);
...@@ -949,6 +958,31 @@ int NodelistNav::get_selected_node( char *name) ...@@ -949,6 +958,31 @@ int NodelistNav::get_selected_node( char *name)
return 1; return 1;
} }
int NodelistNav::get_selected_opplace( char *opplace)
{
brow_tNode *nodelist;
int node_count;
ItemNode *item;
brow_GetSelectedNodes( brow->ctx, &nodelist, &node_count);
if ( node_count != 1)
return 0;
brow_GetUserData( nodelist[0], (void **)&item);
free( nodelist);
if ( item->type != nodelistnav_eItemType_Node)
return 0;
for ( int i = 0; i < (int) node_list.size(); i++) {
if ( node_list[i].item == item) {
strcpy( opplace, node_list[i].opplace);
return 1;
}
}
return 0;
}
void NodelistNav::remove_node( char *name) void NodelistNav::remove_node( char *name)
{ {
for ( int i = 0; i < (int) node_list.size(); i++) { for ( int i = 0; i < (int) node_list.size(); i++) {
...@@ -963,7 +997,7 @@ void NodelistNav::remove_node( char *name) ...@@ -963,7 +997,7 @@ void NodelistNav::remove_node( char *name)
} }
} }
void NodelistNav::add_node( char *name) void NodelistNav::add_node( char *name, char *opplace)
{ {
brow_tNode *nodelist; brow_tNode *nodelist;
int node_count; int node_count;
...@@ -987,6 +1021,7 @@ void NodelistNav::add_node( char *name) ...@@ -987,6 +1021,7 @@ void NodelistNav::add_node( char *name)
return; return;
NodelistNode node( name); NodelistNode node( name);
strcpy( node.opplace, opplace);
if ( idx == (int)node_list.size()) if ( idx == (int)node_list.size())
node_list.push_back( node); node_list.push_back( node);
...@@ -1004,6 +1039,7 @@ void NodelistNav::add_node( char *name) ...@@ -1004,6 +1039,7 @@ void NodelistNav::add_node( char *name)
else { else {
// Nothing selected, insert last // Nothing selected, insert last
NodelistNode node( name); NodelistNode node( name);
strcpy( node.opplace, opplace);
node_list.push_back( node); node_list.push_back( node);
item = new ItemNode( this, name, 0, flow_eDest_IntoLast); item = new ItemNode( this, name, 0, flow_eDest_IntoLast);
......
/* /*
* Proview $Id: co_statusmon_nodelistnav.h,v 1.1 2007-05-16 12:32:26 claes Exp $ * Proview $Id: co_statusmon_nodelistnav.h,v 1.2 2007-05-21 14:20:58 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
...@@ -111,8 +111,10 @@ class NodelistNode { ...@@ -111,8 +111,10 @@ class NodelistNode {
item(0), connection_sts(0), init_done(0) item(0), connection_sts(0), init_done(0)
{ {
strncpy( node_name, name, sizeof(node_name)); strncpy( node_name, name, sizeof(node_name));
strcpy( opplace, "");
} }
char node_name[80]; char node_name[80];
pwr_tOName opplace;
ItemNode *item; ItemNode *item;
pwr_tStatus connection_sts; pwr_tStatus connection_sts;
int init_done; int init_done;
...@@ -154,8 +156,9 @@ class NodelistNav { ...@@ -154,8 +156,9 @@ class NodelistNav {
int select_node( int idx); int select_node( int idx);
void remove_node( char *name); void remove_node( char *name);
int get_selected_node( char *name); int get_selected_node( char *name);
int get_selected_opplace( char *opplace);
void save(); void save();
void add_node( char *name); void add_node( char *name, 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,
......
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