Commit bf3610bb authored by Claes Sjofors's avatar Claes Sjofors

Operator window: new status bar and alarm time viewed

parent 3da6358f
...@@ -274,6 +274,13 @@ pushbuttons to iconify and delete the window. It is divided in tree parts, to th ...@@ -274,6 +274,13 @@ pushbuttons to iconify and delete the window. It is divided in tree parts, to th
current alarms and messages are viewed, in the middle there are pushbuttons for some base current alarms and messages are viewed, in the middle there are pushbuttons for some base
functions, and to the left there are pushbuttons configured for this operator place. functions, and to the left there are pushbuttons configured for this operator place.
<h2>Status bar
The top row is a status bar. It shows who is logged in on on which node. For tha current
node, and for all nodes that there are node supervision configured, an indicator for system
status is viewed. Green states that everything is all right, yellow indicates warning, red
error and flashing red fatal error. If you click on a node, the status graph for the node
is opened.
<h2>Alarms and messages <h2>Alarms and messages
In the left part of the operator window alarm and messages are displayed. In the left part of the operator window alarm and messages are displayed.
......
src/doc/man/src/opg_fig6.png

17.8 KB | W: | H:

src/doc/man/src/opg_fig6.png

30.4 KB | W: | H:

src/doc/man/src/opg_fig6.png
src/doc/man/src/opg_fig6.png
src/doc/man/src/opg_fig6.png
src/doc/man/src/opg_fig6.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -277,6 +277,13 @@ att ikonisera och ta bort f ...@@ -277,6 +277,13 @@ att ikonisera och ta bort f
larm och meddelanden, i mitten finns en meny och knappar för olika basfunktioner, och till larm och meddelanden, i mitten finns en meny och knappar för olika basfunktioner, och till
vänster knappar som är konfigurerade för just den här operatörsplatsen. vänster knappar som är konfigurerade för just den här operatörsplatsen.
<h2>Statusfält
Den översta raden är ett statusfält. Här visas vem som är inloggad och på vilken nod. För
den aktuella noden, och för alla noder som det finns nod-övervakning på, visas en indikator
för nodens systemstatus. Grön innebär att allt fungerar som det ska, gult indikerar varning,
rött fel och blinkande rött fatalt fel. Om man klickar på en nod öppnas status-bilden för
noden.
<h2>Larm och meddelanden <h2>Larm och meddelanden
I vänstra delen av operatörsfönstret visas larm och meddelanden. I vänstra delen av operatörsfönstret visas larm och meddelanden.
......
...@@ -53,11 +53,11 @@ extern "C" { ...@@ -53,11 +53,11 @@ extern "C" {
return (((long int)(sts)?((*sts)=(lsts)):(EVEN(lsts)?(errh_Bugcheck(lsts, (str)),(lsts)):(lsts))),a) return (((long int)(sts)?((*sts)=(lsts)):(EVEN(lsts)?(errh_Bugcheck(lsts, (str)),(lsts)):(lsts))),a)
#endif #endif
#define errh_SeveritySuccess(sts) ((sts) & 7 == 3) #define errh_SeveritySuccess(sts) (((sts) & 7) == 3)
#define errh_SeverityInfo(sts) ((sts) & 7 == 1) #define errh_SeverityInfo(sts) (((sts) & 7) == 1)
#define errh_SeverityWarning(sts) ((sts) & 7 == 0) #define errh_SeverityWarning(sts) (((sts) & 7) == 0)
#define errh_SeverityError(sts) ((sts) & 7 == 2) #define errh_SeverityError(sts) (((sts) & 7) == 2)
#define errh_SeverityFatal(sts) ((sts) & 7 == 4) #define errh_SeverityFatal(sts) (((sts) & 7) == 4)
typedef enum { typedef enum {
errh_eSeverity_Null, errh_eSeverity_Null,
......
...@@ -71,12 +71,13 @@ SObject pwrb:Class ...@@ -71,12 +71,13 @@ SObject pwrb:Class
EndBody EndBody
EndObject EndObject
!/** !/**
! Only if the user has logged in to the operator system ! List of operator system users, separated by comma.
! as this user he has authority to start this operator place. ! Only if the user has logged in to the operator system as
! one of these user he has authority to start this operator place.
!*/ !*/
Object DedicatedOpsysUser $Attribute 29 Object DedicatedOpsysUser $Attribute 29
Body SysBody Body SysBody
Attr TypeRef = "pwrs:Type-$String32" Attr TypeRef = "pwrs:Type-$String256"
Attr Flags |= PWR_MASK_CONST Attr Flags |= PWR_MASK_CONST
EndBody EndBody
EndObject EndObject
......
...@@ -65,7 +65,7 @@ SObject pwrb:Type ...@@ -65,7 +65,7 @@ SObject pwrb:Type
EndBody EndBody
EndObject EndObject
!/** !/**
! Close button. ! Hide the Close button.
!*/ !*/
Object HideCloseButton $Bit Object HideCloseButton $Bit
Body SysBody Body SysBody
...@@ -74,6 +74,26 @@ SObject pwrb:Type ...@@ -74,6 +74,26 @@ SObject pwrb:Type
Attr Value = 8 Attr Value = 8
EndBody EndBody
EndObject EndObject
!/**
! Show the alarm time.
!*/
Object ShowAlarmTime $Bit
Body SysBody
Attr PgmName = "ShowAlarmTime"
Attr Text = "ShowAlarmTime"
Attr Value = 16
EndBody
EndObject
!/**
! Show the alarm time.
!*/
Object ShowAlarmDateAndTime $Bit
Body SysBody
Attr PgmName = "ShowAlarmDateAndTime"
Attr Text = "ShowAlarmDateAndTime"
Attr Value = 32
EndBody
EndObject
EndObject EndObject
EndSObject EndSObject
......
...@@ -582,10 +582,25 @@ Xtt::Xtt( int *argc, char **argv[], int *return_sts) : ...@@ -582,10 +582,25 @@ Xtt::Xtt( int *argc, char **argv[], int *return_sts) :
if ( EVEN(sts)) exit(sts); if ( EVEN(sts)) exit(sts);
if ( strcmp( opp->DedicatedOpsysUser, "") != 0) { if ( strcmp( opp->DedicatedOpsysUser, "") != 0) {
int duser_cnt;
char duser_array[10][40];
int found = 0;
sts = syi_UserName( opsys_user, sizeof(opsys_user)); sts = syi_UserName( opsys_user, sizeof(opsys_user));
if ( EVEN(sts)) exit(sts); if ( EVEN(sts)) exit(sts);
if ( strcmp( opp->DedicatedOpsysUser, opsys_user) != 0) { duser_cnt = dcli_parse( opp->DedicatedOpsysUser, ",", "",
(char *) duser_array, sizeof( duser_array)/sizeof( duser_array[0]),
sizeof( duser_array[0]), 0);
for ( int i = 0; i < duser_cnt; i++) {
dcli_trim( duser_array[i], duser_array[i]);
if ( strcmp( duser_array[i], opsys_user) == 0) {
found = 1;
break;
}
}
if ( !found) {
printf( "Operator place is dedicated for another user\n"); printf( "Operator place is dedicated for another user\n");
exit(0); exit(0);
} }
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "co_cdh.h" #include "co_cdh.h"
#include "co_time.h" #include "co_time.h"
#include "co_dcli.h" #include "co_dcli.h"
#include "co_login.h"
#include "co_syi.h"
#include "pwr_baseclasses.h" #include "pwr_baseclasses.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_mh.h" #include "rt_mh.h"
...@@ -40,6 +42,7 @@ ...@@ -40,6 +42,7 @@
#define OP_HEIGHT_MIN 75 #define OP_HEIGHT_MIN 75
#define OP_HEIGHT_INC 20 #define OP_HEIGHT_INC 20
#define OP_HEIGHT_MAX (OP_HEIGHT_MIN + 3 * OP_HEIGHT_INC) #define OP_HEIGHT_MAX (OP_HEIGHT_MIN + 3 * OP_HEIGHT_INC)
#define OP_HEIGHT_STATUSBAR 30
static void cnv_pango_text( char *in, char *out, int size) static void cnv_pango_text( char *in, char *out, int size)
...@@ -67,7 +70,7 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -67,7 +70,7 @@ OpGtk::OpGtk( void *op_parent_ctx,
GtkWidget *op_parent_wid, GtkWidget *op_parent_wid,
char *opplace, char *opplace,
pwr_tStatus *status) : pwr_tStatus *status) :
Op( op_parent_ctx, opplace, status), parent_wid(op_parent_wid), a_height(2), Op( op_parent_ctx, opplace, status), parent_wid(op_parent_wid), title_label(0), a_height(2),
text_size(12) text_size(12)
{ {
memset( a_exist, 0, sizeof(a_exist)); memset( a_exist, 0, sizeof(a_exist));
...@@ -81,6 +84,7 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -81,6 +84,7 @@ OpGtk::OpGtk( void *op_parent_ctx,
NULL); NULL);
gtk_window_set_decorated( GTK_WINDOW(toplevel), FALSE); gtk_window_set_decorated( GTK_WINDOW(toplevel), FALSE);
CoWowGtk::SetWindowIcon( toplevel);
pwr_tFileName fname; pwr_tFileName fname;
dcli_translate_filename( fname, "$pwr_exe/xtt_alarm_active.png"); dcli_translate_filename( fname, "$pwr_exe/xtt_alarm_active.png");
...@@ -389,8 +393,8 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -389,8 +393,8 @@ OpGtk::OpGtk( void *op_parent_ctx,
gtk_image_new_from_file( fname)); gtk_image_new_from_file( fname));
g_signal_connect( functions_navigator, "activate", g_signal_connect( functions_navigator, "activate",
G_CALLBACK(activate_navigator), this); G_CALLBACK(activate_navigator), this);
gtk_widget_add_accelerator( functions_navigator, "activate", accel_g, // gtk_widget_add_accelerator( functions_navigator, "activate", accel_g,
'd', GdkModifierType(GDK_CONTROL_MASK), GTK_ACCEL_VISIBLE); // 'd', GdkModifierType(GDK_CONTROL_MASK), GTK_ACCEL_VISIBLE);
GtkWidget *functions_graph = gtk_image_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Process Graphics")); GtkWidget *functions_graph = gtk_image_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Process Graphics"));
dcli_translate_filename( fname, "$pwr_exe/wtt_ge.png"); //TODO dcli_translate_filename( fname, "$pwr_exe/wtt_ge.png"); //TODO
...@@ -398,8 +402,8 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -398,8 +402,8 @@ OpGtk::OpGtk( void *op_parent_ctx,
gtk_image_new_from_file( fname)); gtk_image_new_from_file( fname));
g_signal_connect( functions_graph, "activate", g_signal_connect( functions_graph, "activate",
G_CALLBACK(activate_graph), this); G_CALLBACK(activate_graph), this);
gtk_widget_add_accelerator( functions_graph, "activate", accel_g, // gtk_widget_add_accelerator( functions_graph, "activate", accel_g,
'g', GdkModifierType(GDK_CONTROL_MASK), GTK_ACCEL_VISIBLE); // 'g', GdkModifierType(GDK_CONTROL_MASK), GTK_ACCEL_VISIBLE);
// Submenu Help // Submenu Help
GtkWidget *functions_help_project = gtk_image_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Project")); GtkWidget *functions_help_project = gtk_image_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Project"));
...@@ -432,13 +436,13 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -432,13 +436,13 @@ OpGtk::OpGtk( void *op_parent_ctx,
GTK_WIDGET(functions_help_menu)); GTK_WIDGET(functions_help_menu));
// End Help submenu // End Help submenu
GtkWidget *functions_close = gtk_image_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Close")); functions_close = gtk_image_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Close"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(functions_close), gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(functions_close),
gtk_image_new_from_stock( "gtk-close", GTK_ICON_SIZE_MENU)); gtk_image_new_from_stock( "gtk-close", GTK_ICON_SIZE_MENU));
g_signal_connect(functions_close, "activate", G_CALLBACK(activate_exit), this); g_signal_connect(functions_close, "activate", G_CALLBACK(activate_exit), this);
gtk_widget_add_accelerator( functions_close, "activate", accel_g, // gtk_widget_add_accelerator( functions_close, "activate", accel_g,
'w', GdkModifierType(GDK_CONTROL_MASK), GTK_ACCEL_VISIBLE); // 'w', GdkModifierType(GDK_CONTROL_MASK), GTK_ACCEL_VISIBLE);
GtkMenu *functions_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL); GtkMenu *functions_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_alarm); gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_alarm);
...@@ -534,9 +538,45 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -534,9 +538,45 @@ OpGtk::OpGtk( void *op_parent_ctx,
gtk_box_pack_start( GTK_BOX(sysbutton_box), GTK_WIDGET(tools2), FALSE, FALSE, 0); gtk_box_pack_start( GTK_BOX(sysbutton_box), GTK_WIDGET(tools2), FALSE, FALSE, 0);
gtk_widget_set_size_request( sysbutton_box, 160, -1); gtk_widget_set_size_request( sysbutton_box, 160, -1);
// Main window
configure( opplace); configure( opplace);
// Status bar
GtkWidget *status_bar;
if ( !(layout_mask & pwr_mOpWindLayoutMask_HideStatusBar)) {
char text[80];
dcli_translate_filename( fname, "$pwr_exe/proview_icon.png");
GtkWidget *icon_image = gtk_image_new_from_file( fname);
title_label = gtk_label_new("");
status_bar = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(status_bar), GTK_WIDGET(icon_image), FALSE, FALSE, 5);
gtk_box_pack_start( GTK_BOX(status_bar), GTK_WIDGET(title_label), FALSE, FALSE, 20);
// Add node supervision buttons
for ( unsigned int i = 0; i < sup_vect.size(); i++) {
GtkWidget *node_label = gtk_label_new("");
snprintf( text, sizeof(text), "<span size=\"%d\">%s</span>", 12 * 1024, sup_vect[i].node_name);
gtk_label_set_markup( GTK_LABEL(node_label), CoWowGtk::convert_utf8(text));
GtkWidget *node_button = gtk_button_new();
GtkWidget *node_hbox = gtk_hbox_new( FALSE, 0);
dcli_translate_filename( fname, "$pwr_exe/xtt_ind_gray2.png");
GtkWidget *node_image = gtk_image_new_from_file( fname);
gtk_box_pack_start( GTK_BOX(node_hbox), GTK_WIDGET(node_image), FALSE, FALSE, 8);
gtk_box_pack_start( GTK_BOX(node_hbox), GTK_WIDGET(node_label), FALSE, FALSE, 8);
gtk_container_add( GTK_CONTAINER(node_button), node_hbox);
sup_vect[i].imagew = (void *)node_image;
sup_vect[i].buttonw = (void *)node_button;
g_signal_connect( node_button, "clicked", G_CALLBACK(activate_sup_node), this);
g_object_set( node_button, "can-focus", FALSE, NULL);
gtk_box_pack_start( GTK_BOX(status_bar), GTK_WIDGET(node_button), FALSE, FALSE, 5);
}
}
// Main window
GtkWidget *hbox_conf = gtk_hbox_new( FALSE, 0); GtkWidget *hbox_conf = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(hbox_conf), sysbutton_box, FALSE, FALSE, 0); gtk_box_pack_start( GTK_BOX(hbox_conf), sysbutton_box, FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(hbox_conf), gtk_hseparator_new(), FALSE, FALSE, 2); gtk_box_pack_start( GTK_BOX(hbox_conf), gtk_hseparator_new(), FALSE, FALSE, 2);
...@@ -546,12 +586,19 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -546,12 +586,19 @@ OpGtk::OpGtk( void *op_parent_ctx,
gtk_paned_pack1( GTK_PANED(pane), vbox_ala, TRUE, TRUE); gtk_paned_pack1( GTK_PANED(pane), vbox_ala, TRUE, TRUE);
gtk_paned_pack2( GTK_PANED(pane), hbox_conf, FALSE, TRUE); gtk_paned_pack2( GTK_PANED(pane), hbox_conf, FALSE, TRUE);
GtkWidget *vbox_conf = gtk_vbox_new( FALSE, 0);
if ( !(layout_mask & pwr_mOpWindLayoutMask_HideStatusBar)) {
gtk_box_pack_start( GTK_BOX(vbox_conf), status_bar, FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(vbox_conf), gtk_hseparator_new(), FALSE, FALSE, 2);
}
gtk_box_pack_start( GTK_BOX(vbox_conf), pane, FALSE, FALSE, 0);
GtkWidget *frame = gtk_frame_new( NULL); GtkWidget *frame = gtk_frame_new( NULL);
GdkColor background; GdkColor background;
gdk_color_parse( "black", &background); gdk_color_parse( "black", &background);
gtk_widget_modify_bg( frame, GTK_STATE_NORMAL, &background); gtk_widget_modify_bg( frame, GTK_STATE_NORMAL, &background);
gtk_container_add( GTK_CONTAINER(frame), pane); gtk_container_add( GTK_CONTAINER(frame), vbox_conf);
gtk_container_add( GTK_CONTAINER(toplevel), frame); gtk_container_add( GTK_CONTAINER(toplevel), frame);
gtk_widget_show_all(toplevel); gtk_widget_show_all(toplevel);
...@@ -568,10 +615,11 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -568,10 +615,11 @@ OpGtk::OpGtk( void *op_parent_ctx,
g_object_set( aalarm_box[3], "visible", FALSE, NULL); g_object_set( aalarm_box[3], "visible", FALSE, NULL);
g_object_set( aalarm_box[4], "visible", FALSE, NULL); g_object_set( aalarm_box[4], "visible", FALSE, NULL);
g_object_set( balarm_box, "visible", FALSE, NULL); g_object_set( balarm_box, "visible", FALSE, NULL);
// g_object_set( help_button, "visible", FALSE, NULL);
// g_object_set( eventlog_button, "visible", FALSE, NULL);
g_object_set( decr_button, "visible", FALSE, NULL); g_object_set( decr_button, "visible", FALSE, NULL);
g_object_set( tools_close, "visible", FALSE, NULL); if ( layout_mask & pwr_mOpWindLayoutMask_HideCloseButton) {
g_object_set( tools_close, "visible", FALSE, NULL);
g_object_set( functions_close, "visible", FALSE, NULL);
}
if ( a_height == 5) if ( a_height == 5)
activate_aalarm_decr( 0, this); activate_aalarm_decr( 0, this);
...@@ -592,8 +640,12 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -592,8 +640,12 @@ OpGtk::OpGtk( void *op_parent_ctx,
gtk_window_move( GTK_WINDOW(toplevel), 0, 0); gtk_window_move( GTK_WINDOW(toplevel), 0, 0);
wow = new CoWowGtk( toplevel); wow = new CoWowGtk( toplevel);
sup_timerid = wow->timer_new();
wow->DisplayWarranty(); wow->DisplayWarranty();
if ( !(layout_mask & pwr_mOpWindLayoutMask_HideStatusBar))
sup_scan( this);
*status = 1; *status = 1;
} }
...@@ -605,6 +657,9 @@ OpGtk::~OpGtk() ...@@ -605,6 +657,9 @@ OpGtk::~OpGtk()
{ {
if ( jop) if ( jop)
delete jop; delete jop;
sup_timerid->remove();
delete sup_timerid;
delete wow;
gtk_widget_destroy( toplevel); gtk_widget_destroy( toplevel);
} }
...@@ -621,6 +676,7 @@ void OpGtk::map() ...@@ -621,6 +676,7 @@ void OpGtk::map()
void OpGtk::add_close_button() void OpGtk::add_close_button()
{ {
g_object_set( tools_close, "visible", TRUE, NULL); g_object_set( tools_close, "visible", TRUE, NULL);
g_object_set( functions_close, "visible", TRUE, NULL);
} }
...@@ -652,8 +708,12 @@ void OpGtk::update_alarm_info() ...@@ -652,8 +708,12 @@ void OpGtk::update_alarm_info()
int height, active_height; int height, active_height;
char str[40]; char str[40];
char text[500], ctext[500]; char text[500], ctext[500];
char timestr[40];
int fsize = text_size * 1024; int fsize = text_size * 1024;
int show_time = 0;
time_eFormat time_format;
char *s;
if ( get_alarm_info_cb) { if ( get_alarm_info_cb) {
sts = (get_alarm_info_cb)( parent_ctx, &info); sts = (get_alarm_info_cb)( parent_ctx, &info);
if ( EVEN(sts)) return; if ( EVEN(sts)) return;
...@@ -668,18 +728,40 @@ void OpGtk::update_alarm_info() ...@@ -668,18 +728,40 @@ void OpGtk::update_alarm_info()
snprintf( str, sizeof(str), "%d", info.alarms_total); snprintf( str, sizeof(str), "%d", info.alarms_total);
gtk_label_set_text( GTK_LABEL(alarmcnt_label), str); gtk_label_set_text( GTK_LABEL(alarmcnt_label), str);
if ( layout_mask & pwr_mOpWindLayoutMask_ShowAlarmDateAndTime) {
time_format = time_eFormat_ComprDateAndTime;
show_time = 1;
}
else if ( layout_mask & pwr_mOpWindLayoutMask_ShowAlarmDateAndTime) {
time_format = time_eFormat_Time;
show_time = 1;
}
for ( i = 0; i < 5; i++) { for ( i = 0; i < 5; i++) {
a_exist[i] = info.a_alarm_exist[i]; a_exist[i] = info.a_alarm_exist[i];
a_active[i] = info.a_alarm_active[i]; a_active[i] = info.a_alarm_active[i];
if ( info.a_alarm_exist[i]) { if ( info.a_alarm_exist[i]) {
cnv_pango_text( info.a_alarm_text[i], ctext, sizeof(ctext));
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>",
fsize, info.a_alarm_alias[i], ctext);
cnv_pango_text( info.a_alarm_text[i], ctext, sizeof(ctext));
if ( show_time) {
sts = time_AtoAscii( &info.a_alarm_time[i], time_format, timestr, sizeof(timestr));
if ( (s = strrchr( timestr, '.')))
*s = 0;
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s %s</span>",
fsize, timestr, info.a_alarm_alias[i], ctext);
}
else
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>",
fsize, info.a_alarm_alias[i], ctext);
gtk_label_set_markup( GTK_LABEL(aalarm_label[i]), CoWowGtk::convert_utf8(text)); gtk_label_set_markup( GTK_LABEL(aalarm_label[i]), CoWowGtk::convert_utf8(text));
snprintf( text, sizeof(text), "<span size=\"%d\">%s</span>",
fsize, timestr);
// gtk_widget_modify_bg( aalarm_box[i], GTK_STATE_NORMAL, &red_color); // gtk_widget_modify_bg( aalarm_box[i], GTK_STATE_NORMAL, &red_color);
if ( i < a_height) { if ( i < a_height) {
g_object_set( aalarm_box[i], "visible", TRUE, NULL); g_object_set( aalarm_box[i], "visible", TRUE, NULL);
...@@ -707,8 +789,19 @@ void OpGtk::update_alarm_info() ...@@ -707,8 +789,19 @@ void OpGtk::update_alarm_info()
balarm_prio = mh_eEventPrio_B; balarm_prio = mh_eEventPrio_B;
cnv_pango_text( info.b_alarm_text[0], ctext, sizeof(ctext)); cnv_pango_text( info.b_alarm_text[0], ctext, sizeof(ctext));
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>",
fsize, info.b_alarm_alias[0], ctext); if ( show_time) {
sts = time_AtoAscii( &info.b_alarm_time[0], time_format, timestr, sizeof(timestr));
if ( (s = strrchr( timestr, '.')))
*s = 0;
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s %s</span>",
fsize, timestr, info.b_alarm_alias[0], ctext);
}
else
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>",
fsize, info.b_alarm_alias[0], ctext);
gtk_label_set_markup( GTK_LABEL(balarm_label), CoWowGtk::convert_utf8(text)); gtk_label_set_markup( GTK_LABEL(balarm_label), CoWowGtk::convert_utf8(text));
gtk_widget_modify_bg( balarm_ebox, GTK_STATE_NORMAL, &yellow_color); gtk_widget_modify_bg( balarm_ebox, GTK_STATE_NORMAL, &yellow_color);
g_object_set( balarm_box, "visible", TRUE, NULL); g_object_set( balarm_box, "visible", TRUE, NULL);
...@@ -729,8 +822,17 @@ void OpGtk::update_alarm_info() ...@@ -729,8 +822,17 @@ void OpGtk::update_alarm_info()
balarm_type = evlist_eEventType_Alarm; balarm_type = evlist_eEventType_Alarm;
balarm_prio = mh_eEventPrio_C; balarm_prio = mh_eEventPrio_C;
cnv_pango_text( info.c_alarm_text[0], ctext, sizeof(ctext)); cnv_pango_text( info.c_alarm_text[0], ctext, sizeof(ctext));
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>", if ( show_time) {
fsize, info.c_alarm_alias[0], ctext); sts = time_AtoAscii( &info.c_alarm_time[0], time_format, timestr, sizeof(timestr));
if ( (s = strrchr( timestr, '.')))
*s = 0;
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s %s</span>",
fsize, timestr, info.c_alarm_alias[i], ctext);
}
else
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>",
fsize, info.c_alarm_alias[0], ctext);
gtk_label_set_markup( GTK_LABEL(balarm_label), CoWowGtk::convert_utf8(text)); gtk_label_set_markup( GTK_LABEL(balarm_label), CoWowGtk::convert_utf8(text));
gtk_widget_modify_bg( balarm_ebox, GTK_STATE_NORMAL, &blue_color); gtk_widget_modify_bg( balarm_ebox, GTK_STATE_NORMAL, &blue_color);
g_object_set( balarm_box, "visible", TRUE, NULL); g_object_set( balarm_box, "visible", TRUE, NULL);
...@@ -752,8 +854,17 @@ void OpGtk::update_alarm_info() ...@@ -752,8 +854,17 @@ void OpGtk::update_alarm_info()
balarm_type = evlist_eEventType_Alarm; balarm_type = evlist_eEventType_Alarm;
balarm_prio = mh_eEventPrio_D; balarm_prio = mh_eEventPrio_D;
cnv_pango_text( info.d_alarm_text[0], ctext, sizeof(ctext)); cnv_pango_text( info.d_alarm_text[0], ctext, sizeof(ctext));
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>", if ( show_time) {
fsize, info.d_alarm_alias[0], ctext); sts = time_AtoAscii( &info.d_alarm_time[0], time_format, timestr, sizeof(timestr));
if ( (s = strrchr( timestr, '.')))
*s = 0;
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s %s</span>",
fsize, timestr, info.d_alarm_alias[0], ctext);
}
else
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>",
fsize, info.d_alarm_alias[0], ctext);
gtk_label_set_markup( GTK_LABEL(balarm_label), CoWowGtk::convert_utf8(text)); gtk_label_set_markup( GTK_LABEL(balarm_label), CoWowGtk::convert_utf8(text));
gtk_widget_modify_bg( balarm_ebox, GTK_STATE_NORMAL, &violet_color); gtk_widget_modify_bg( balarm_ebox, GTK_STATE_NORMAL, &violet_color);
g_object_set( balarm_box, "visible", TRUE, NULL); g_object_set( balarm_box, "visible", TRUE, NULL);
...@@ -774,6 +885,15 @@ void OpGtk::update_alarm_info() ...@@ -774,6 +885,15 @@ void OpGtk::update_alarm_info()
balarm_type = evlist_eEventType_Info; balarm_type = evlist_eEventType_Info;
cnv_pango_text( info.i_alarm_text[0], ctext, sizeof(ctext)); cnv_pango_text( info.i_alarm_text[0], ctext, sizeof(ctext));
if ( show_time) {
sts = time_AtoAscii( &info.i_alarm_time[0], time_format, timestr, sizeof(timestr));
if ( (s = strrchr( timestr, '.')))
*s = 0;
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s %s</span>",
fsize, timestr, info.i_alarm_alias[0], ctext);
}
else
snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>", snprintf( text, sizeof(text), "<span size=\"%d\">%s %s</span>",
fsize, info.i_alarm_alias[0], ctext); fsize, info.i_alarm_alias[0], ctext);
gtk_label_set_markup( GTK_LABEL(balarm_label), CoWowGtk::convert_utf8(text)); gtk_label_set_markup( GTK_LABEL(balarm_label), CoWowGtk::convert_utf8(text));
...@@ -815,6 +935,7 @@ int OpGtk::configure( char *opplace_str) ...@@ -815,6 +935,7 @@ int OpGtk::configure( char *opplace_str)
sts = gdh_ObjidToPointer( opplace, (void **) &opplace_p); sts = gdh_ObjidToPointer( opplace, (void **) &opplace_p);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
layout_mask = opplace_p->OpWindLayout;
if ( opplace_p->StartJavaProcess) if ( opplace_p->StartJavaProcess)
start_jop = 1; start_jop = 1;
...@@ -1046,7 +1167,8 @@ void OpGtk::activate_aalarm_incr( GtkWidget *w, gpointer data) ...@@ -1046,7 +1167,8 @@ void OpGtk::activate_aalarm_incr( GtkWidget *w, gpointer data)
return; return;
op->a_height++; op->a_height++;
height = OP_HEIGHT_MIN + (op->a_height - 2) * OP_HEIGHT_INC; height = OP_HEIGHT_MIN + (op->a_height - 2) * OP_HEIGHT_INC +
((op->layout_mask & pwr_mOpWindLayoutMask_HideStatusBar) ? 0 : 1) * OP_HEIGHT_STATUSBAR;
if ( op->a_height == 3) { if ( op->a_height == 3) {
g_object_set( op->decr_button, "visible", TRUE, NULL); g_object_set( op->decr_button, "visible", TRUE, NULL);
...@@ -1084,7 +1206,8 @@ void OpGtk::activate_aalarm_decr( GtkWidget *w, gpointer data) ...@@ -1084,7 +1206,8 @@ void OpGtk::activate_aalarm_decr( GtkWidget *w, gpointer data)
return; return;
op->a_height--; op->a_height--;
height = OP_HEIGHT_MIN + (op->a_height - 2) * OP_HEIGHT_INC; height = OP_HEIGHT_MIN + (op->a_height - 2) * OP_HEIGHT_INC +
((op->layout_mask & pwr_mOpWindLayoutMask_HideStatusBar) ? 0 : 1) * OP_HEIGHT_STATUSBAR;
if ( op->a_height == 2) { if ( op->a_height == 2) {
g_object_set( op->decr_button, "visible", FALSE, NULL); g_object_set( op->decr_button, "visible", FALSE, NULL);
...@@ -1227,11 +1350,16 @@ void OpGtk::activate_cmd_menu_item( GtkWidget *w, gpointer data) ...@@ -1227,11 +1350,16 @@ void OpGtk::activate_cmd_menu_item( GtkWidget *w, gpointer data)
sts = ((OpGtk *)op)->get_cmd( w, cmd); sts = ((OpGtk *)op)->get_cmd( w, cmd);
if ( ODD(sts)) { if ( ODD(sts)) {
op->activate_cmd_menu_item( cmd); op->activate_cmd_menu_item( cmd);
if ( op->command_cb)
op->command_cb( op->parent_ctx, cmd);
} }
} }
void OpGtk::activate_sup_node( GtkWidget *w, gpointer data)
{
Op *op = (Op*)data;
op->activate_sup_node( (void *)w);
}
void OpGtk::activate_appl1( GtkWidget *w, gpointer data) void OpGtk::activate_appl1( GtkWidget *w, gpointer data)
{ {
Op *op = (Op*)data; Op *op = (Op*)data;
...@@ -1417,3 +1545,48 @@ int OpGtk::get_cmd( GtkWidget *w, char *cmd) ...@@ -1417,3 +1545,48 @@ int OpGtk::get_cmd( GtkWidget *w, char *cmd)
} }
return 0; return 0;
} }
void OpGtk::change_sup_color( void *imagew, op_eSupColor color)
{
GtkWidget *image = (GtkWidget *)imagew;
pwr_tFileName fname;
switch ( color) {
case op_eSupColor_Gray:
dcli_translate_filename( fname, "$pwr_exe/xtt_ind_gray.png");
break;
case op_eSupColor_Green:
dcli_translate_filename( fname, "$pwr_exe/xtt_ind_green.png");
break;
case op_eSupColor_Yellow:
dcli_translate_filename( fname, "$pwr_exe/xtt_ind_yellow.png");
break;
case op_eSupColor_Red:
dcli_translate_filename( fname, "$pwr_exe/xtt_ind_red.png");
break;
case op_eSupColor_Black:
dcli_translate_filename( fname, "$pwr_exe/xtt_ind_black.png");
break;
}
gtk_image_set_from_file( GTK_IMAGE(image), fname);
}
void OpGtk::set_title( char *user)
{
char title[80];
char text[120];
pwr_tStatus sts;
char nodename[32];
if ( !title_label)
return;
syi_NodeName( &sts, nodename, sizeof(nodename));
strcpy( title, CoWowGtk::convert_utf8(user));
strcat( title, CoWowGtk::translate_utf8(" on "));
strcat( title, CoWowGtk::convert_utf8(nodename));
snprintf( text, sizeof(text), "<span size=\"%d\">%s</span>", 14 * 1024, title);
gtk_label_set_markup( GTK_LABEL(title_label), text);
}
...@@ -64,8 +64,10 @@ class OpGtk : public Op { ...@@ -64,8 +64,10 @@ class OpGtk : public Op {
GtkWidget *appl_form; GtkWidget *appl_form;
GtkWidget *decr_button; GtkWidget *decr_button;
GtkWidget *tools_close; GtkWidget *tools_close;
GtkWidget *functions_close;
GtkWidget *funcbox[5]; GtkWidget *funcbox[5];
GtkMenuBar *menu_bar; GtkMenuBar *menu_bar;
GtkWidget *title_label;
int a_height; int a_height;
int a_exist[5]; int a_exist[5];
int a_active[5]; int a_active[5];
...@@ -80,6 +82,8 @@ class OpGtk : public Op { ...@@ -80,6 +82,8 @@ class OpGtk : public Op {
int get_cmd( GtkWidget *w, char *cmd); int get_cmd( GtkWidget *w, char *cmd);
int create_menu_item( const char *name, int pixmap, int append, const char *cmd); int create_menu_item( const char *name, int pixmap, int append, const char *cmd);
int delete_menu_item( const char *name); int delete_menu_item( const char *name);
void change_sup_color( void *imagew, op_eSupColor color);
void set_title( char *user);
static void activate_exit( GtkWidget *w, gpointer data); static void activate_exit( GtkWidget *w, gpointer data);
static void activate_aalarm_ack( GtkWidget *w, gpointer data); static void activate_aalarm_ack( GtkWidget *w, gpointer data);
...@@ -104,6 +108,7 @@ class OpGtk : public Op { ...@@ -104,6 +108,7 @@ class OpGtk : public Op {
static void activate_show_user( GtkWidget *w, gpointer data); static void activate_show_user( GtkWidget *w, gpointer data);
static void activate_logout( GtkWidget *w, gpointer data); static void activate_logout( GtkWidget *w, gpointer data);
static void activate_cmd_menu_item( GtkWidget *w, gpointer data); static void activate_cmd_menu_item( GtkWidget *w, gpointer data);
static void activate_sup_node( GtkWidget *w, gpointer data);
static void activate_graph( GtkWidget *w, gpointer data); static void activate_graph( GtkWidget *w, gpointer data);
static void activate_appl1( GtkWidget *w, gpointer data); static void activate_appl1( GtkWidget *w, gpointer data);
static void activate_appl2( GtkWidget *w, gpointer data); static void activate_appl2( GtkWidget *w, gpointer data);
......
...@@ -1546,6 +1546,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info) ...@@ -1546,6 +1546,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info)
sizeof(info->a_alarm_text[0])); sizeof(info->a_alarm_text[0]));
strncpy( info->a_alarm_alias[a_cnt], object_item->alias, strncpy( info->a_alarm_alias[a_cnt], object_item->alias,
sizeof(info->a_alarm_alias[0])); sizeof(info->a_alarm_alias[0]));
info->a_alarm_time[a_cnt] = object_item->time;
info->a_alarm_active[a_cnt] = object_item->status & mh_mEventStatus_NotRet; info->a_alarm_active[a_cnt] = object_item->status & mh_mEventStatus_NotRet;
info->a_alarm_exist[a_cnt] = 1; info->a_alarm_exist[a_cnt] = 1;
a_cnt++; a_cnt++;
...@@ -1557,6 +1558,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info) ...@@ -1557,6 +1558,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info)
sizeof(info->b_alarm_text[0])); sizeof(info->b_alarm_text[0]));
strncpy( info->b_alarm_alias[b_cnt], object_item->alias, strncpy( info->b_alarm_alias[b_cnt], object_item->alias,
sizeof(info->b_alarm_alias[0])); sizeof(info->b_alarm_alias[0]));
info->b_alarm_time[b_cnt] = object_item->time;
info->b_alarm_active[b_cnt] = object_item->status & mh_mEventStatus_NotRet; info->b_alarm_active[b_cnt] = object_item->status & mh_mEventStatus_NotRet;
info->b_alarm_exist[b_cnt] = 1; info->b_alarm_exist[b_cnt] = 1;
b_cnt++; b_cnt++;
...@@ -1568,6 +1570,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info) ...@@ -1568,6 +1570,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info)
sizeof(info->c_alarm_text[0])); sizeof(info->c_alarm_text[0]));
strncpy( info->c_alarm_alias[c_cnt], object_item->alias, strncpy( info->c_alarm_alias[c_cnt], object_item->alias,
sizeof(info->c_alarm_alias[0])); sizeof(info->c_alarm_alias[0]));
info->c_alarm_time[c_cnt] = object_item->time;
info->c_alarm_active[c_cnt] = object_item->status & mh_mEventStatus_NotRet; info->c_alarm_active[c_cnt] = object_item->status & mh_mEventStatus_NotRet;
info->c_alarm_exist[c_cnt] = 1; info->c_alarm_exist[c_cnt] = 1;
c_cnt++; c_cnt++;
...@@ -1579,6 +1582,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info) ...@@ -1579,6 +1582,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info)
sizeof(info->d_alarm_text[0])); sizeof(info->d_alarm_text[0]));
strncpy( info->d_alarm_alias[d_cnt], object_item->alias, strncpy( info->d_alarm_alias[d_cnt], object_item->alias,
sizeof(info->d_alarm_alias[0])); sizeof(info->d_alarm_alias[0]));
info->d_alarm_time[d_cnt] = object_item->time;
info->d_alarm_active[d_cnt] = object_item->status & mh_mEventStatus_NotRet; info->d_alarm_active[d_cnt] = object_item->status & mh_mEventStatus_NotRet;
info->d_alarm_exist[d_cnt] = 1; info->d_alarm_exist[d_cnt] = 1;
d_cnt++; d_cnt++;
...@@ -1598,6 +1602,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info) ...@@ -1598,6 +1602,7 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info)
sizeof(info->i_alarm_text[0])); sizeof(info->i_alarm_text[0]));
strncpy( info->i_alarm_alias[i_cnt], object_item->alias, strncpy( info->i_alarm_alias[i_cnt], object_item->alias,
sizeof(info->i_alarm_alias[0])); sizeof(info->i_alarm_alias[0]));
info->i_alarm_time[i_cnt] = object_item->time;
info->i_alarm_active[i_cnt] = object_item->status & mh_mEventStatus_NotRet; info->i_alarm_active[i_cnt] = object_item->status & mh_mEventStatus_NotRet;
info->i_alarm_exist[i_cnt] = 1; info->i_alarm_exist[i_cnt] = 1;
i_cnt++; i_cnt++;
......
...@@ -60,22 +60,27 @@ class ItemAlarm; ...@@ -60,22 +60,27 @@ class ItemAlarm;
typedef struct { typedef struct {
char a_alarm_text[ALARM_INFO_A_SIZE][80]; char a_alarm_text[ALARM_INFO_A_SIZE][80];
char a_alarm_alias[ALARM_INFO_A_SIZE][40]; char a_alarm_alias[ALARM_INFO_A_SIZE][40];
pwr_tTime a_alarm_time[ALARM_INFO_A_SIZE];
int a_alarm_active[ALARM_INFO_A_SIZE]; int a_alarm_active[ALARM_INFO_A_SIZE];
int a_alarm_exist[ALARM_INFO_A_SIZE]; int a_alarm_exist[ALARM_INFO_A_SIZE];
char b_alarm_text[ALARM_INFO_B_SIZE][80]; char b_alarm_text[ALARM_INFO_B_SIZE][80];
char b_alarm_alias[ALARM_INFO_A_SIZE][40]; char b_alarm_alias[ALARM_INFO_A_SIZE][40];
pwr_tTime b_alarm_time[ALARM_INFO_B_SIZE];
int b_alarm_active[ALARM_INFO_B_SIZE]; int b_alarm_active[ALARM_INFO_B_SIZE];
int b_alarm_exist[ALARM_INFO_B_SIZE]; int b_alarm_exist[ALARM_INFO_B_SIZE];
char c_alarm_text[ALARM_INFO_C_SIZE][80]; char c_alarm_text[ALARM_INFO_C_SIZE][80];
char c_alarm_alias[ALARM_INFO_A_SIZE][40]; char c_alarm_alias[ALARM_INFO_A_SIZE][40];
pwr_tTime c_alarm_time[ALARM_INFO_C_SIZE];
int c_alarm_active[ALARM_INFO_C_SIZE]; int c_alarm_active[ALARM_INFO_C_SIZE];
int c_alarm_exist[ALARM_INFO_C_SIZE]; int c_alarm_exist[ALARM_INFO_C_SIZE];
char d_alarm_text[ALARM_INFO_D_SIZE][80]; char d_alarm_text[ALARM_INFO_D_SIZE][80];
char d_alarm_alias[ALARM_INFO_A_SIZE][40]; char d_alarm_alias[ALARM_INFO_A_SIZE][40];
pwr_tTime d_alarm_time[ALARM_INFO_D_SIZE];
int d_alarm_active[ALARM_INFO_D_SIZE]; int d_alarm_active[ALARM_INFO_D_SIZE];
int d_alarm_exist[ALARM_INFO_D_SIZE]; int d_alarm_exist[ALARM_INFO_D_SIZE];
char i_alarm_text[ALARM_INFO_I_SIZE][80]; char i_alarm_text[ALARM_INFO_I_SIZE][80];
char i_alarm_alias[ALARM_INFO_A_SIZE][40]; char i_alarm_alias[ALARM_INFO_A_SIZE][40];
pwr_tTime i_alarm_time[ALARM_INFO_I_SIZE];
int i_alarm_active[ALARM_INFO_I_SIZE]; int i_alarm_active[ALARM_INFO_I_SIZE];
int i_alarm_exist[ALARM_INFO_I_SIZE]; int i_alarm_exist[ALARM_INFO_I_SIZE];
int alarms_total; int alarms_total;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "co_cdh.h" #include "co_cdh.h"
#include "co_time.h" #include "co_time.h"
#include "co_syi.h"
#include "pwr_baseclasses.h" #include "pwr_baseclasses.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_mh.h" #include "rt_mh.h"
...@@ -46,8 +47,9 @@ Op::Op( void *op_parent_ctx, ...@@ -46,8 +47,9 @@ Op::Op( void *op_parent_ctx,
pwr_tStatus *status) : pwr_tStatus *status) :
parent_ctx(op_parent_ctx), start_jop(0), parent_ctx(op_parent_ctx), start_jop(0),
jop(NULL), command_cb(NULL), map_cb(NULL), help_cb(NULL), jop(NULL), command_cb(NULL), map_cb(NULL), help_cb(NULL),
close_cb(NULL), get_alarm_info_cb(NULL), ack_last_cb(NULL) close_cb(NULL), get_alarm_info_cb(NULL), ack_last_cb(NULL), sup_timerid(0)
{ {
sup_init();
} }
...@@ -203,6 +205,20 @@ void Op::activate_cmd_menu_item( char *cmd) ...@@ -203,6 +205,20 @@ void Op::activate_cmd_menu_item( char *cmd)
command_cb( parent_ctx, cmd); command_cb( parent_ctx, cmd);
} }
void Op::activate_sup_node( void *id)
{
pwr_tCmd cmd;
for ( unsigned int i = 0; i < sup_vect.size(); i++) {
if ( sup_vect[i].buttonw == id) {
sprintf( cmd, "open graph/class/inst=%s", sup_vect[i].object_name);
if ( command_cb)
command_cb( parent_ctx, cmd);
break;
}
}
}
void Op::activate_help() void Op::activate_help()
{ {
if ( help_cb) if ( help_cb)
...@@ -230,3 +246,103 @@ void Op::jop_command_cb( void *op, char *command) ...@@ -230,3 +246,103 @@ void Op::jop_command_cb( void *op, char *command)
if ( ((Op *)op)->command_cb) if ( ((Op *)op)->command_cb)
((Op *)op)->command_cb( ((Op *)op)->parent_ctx, command); ((Op *)op)->command_cb( ((Op *)op)->parent_ctx, command);
} }
int Op::sup_init()
{
pwr_tOid node_oid;
pwr_tOid sup_oid;
pwr_tAName aname;
pwr_tStatus sts;
// Index 0 is current node
sts = gdh_GetNodeObject( 0, &node_oid);
if ( EVEN(sts)) return sts;
OpSup sup;
sup.node_oid = node_oid;
sts = gdh_ObjidToName( node_oid, sup.object_name, sizeof(sup.object_name), cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
strcpy( aname, sup.object_name);
strcat( aname, ".SystemStatus");
sts = gdh_RefObjectInfo( aname, (void **)&sup.p, &sup.refid, sizeof(pwr_tStatus));
if ( EVEN(sts)) return sts;
syi_NodeName( &sts, sup.node_name, sizeof(sup.node_name));
sup_vect.push_back(sup);
// Add nodes in NodeLinkSup objects
for ( sts = gdh_GetClassList( pwr_cClass_NodeLinkSup, &sup_oid);
ODD(sts);
sts = gdh_GetNextObject( sup_oid, &sup_oid)) {
pwr_sClass_NodeLinkSup *sup_p;
qcom_sNode qnode;
pwr_tNid nid;
sts = gdh_ObjidToPointer( sup_oid, (void **)&sup_p);
OpSup nsup;
nsup.node_oid = sup_p->Node;
sts = gdh_ObjidToName( nsup.node_oid, nsup.object_name, sizeof(nsup.object_name),
cdh_mName_volumeStrict);
if ( EVEN(sts)) strcpy( nsup.object_name, "");
sts = gdh_ObjidToName( sup_oid, aname, sizeof(aname), cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
strcat( aname, ".SystemStatus");
sts = gdh_RefObjectInfo( aname, (void **)&nsup.p, &sup.refid, sizeof(pwr_tStatus));
if ( EVEN(sts)) return sts;
int found = 0;
for (nid = qcom_cNNid; qcom_NextNode(&sts, &qnode, nid); nid = qnode.nid) {
if ( qnode.nid == nsup.node_oid.vid) {
strcpy( nsup.node_name, qnode.name);
found = 1;
break;
}
}
if ( !found)
strcpy( nsup.node_name, "Unknown");
sup_vect.push_back(nsup);
}
return 1;
}
void Op::sup_scan( void *data)
{
Op *op = (Op *) data;
int time = 1000;
for ( unsigned int i = 0; i < op->sup_vect.size(); i++) {
op_eSupColor color;
pwr_tStatus status = *op->sup_vect[i].p;
if ( status == 0)
color = op_eSupColor_Gray;
else if ( errh_SeveritySuccess( status) || errh_SeverityInfo( status))
color = op_eSupColor_Green;
else if ( errh_SeverityWarning( status))
color = op_eSupColor_Yellow;
else if ( errh_SeverityError( status))
color = op_eSupColor_Red;
else if ( errh_SeverityFatal( status)) {
if ( op->sup_vect[i].old_color == op_eSupColor_Red)
color = op_eSupColor_Black;
else
color = op_eSupColor_Red;
}
if ( color != op->sup_vect[i].old_color) {
op->sup_vect[i].old_color = color;
op->change_sup_color( op->sup_vect[i].imagew, color);
}
}
op->sup_timerid->add( time, sup_scan, op);
}
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
/* xtt_op.h -- Operator window in xtt */ /* xtt_op.h -- Operator window in xtt */
#include <vector>
#ifndef pwr_h #ifndef pwr_h
# include "pwr.h" # include "pwr.h"
#endif #endif
...@@ -38,7 +40,35 @@ ...@@ -38,7 +40,35 @@
# include "xtt_evlist.h" # include "xtt_evlist.h"
#endif #endif
using namespace std;
class CoWow; class CoWow;
class CoWowTimer;
class Op;
typedef enum {
op_eSupColor_Gray,
op_eSupColor_Green,
op_eSupColor_Yellow,
op_eSupColor_Red,
op_eSupColor_Black
} op_eSupColor;
class OpSup {
public:
OpSup() : buttonw(0), imagew(0), p(0), old_color(op_eSupColor_Gray), flash(0)
{ strcpy( node_name, ""); strcpy( object_name, "");}
pwr_tOid node_oid;
pwr_tOName object_name;
pwr_tObjName node_name;
void *buttonw;
void *imagew;
pwr_tStatus *p;
pwr_tRefId refid;
op_eSupColor old_color;
int flash;
};
class Op { class Op {
public: public:
...@@ -57,6 +87,9 @@ class Op { ...@@ -57,6 +87,9 @@ class Op {
int (*get_alarm_info_cb)( void *, evlist_sAlarmInfo *); int (*get_alarm_info_cb)( void *, evlist_sAlarmInfo *);
void (*ack_last_cb)( void *, unsigned long, unsigned long); void (*ack_last_cb)( void *, unsigned long, unsigned long);
CoWow *wow; CoWow *wow;
pwr_tMask layout_mask;
vector<OpSup> sup_vect;
CoWowTimer *sup_timerid;
Op( void *op_parent_ctx, Op( void *op_parent_ctx,
char *opplace, char *opplace,
...@@ -69,11 +102,14 @@ class Op { ...@@ -69,11 +102,14 @@ class Op {
virtual void add_close_button() {} virtual void add_close_button() {}
virtual int create_menu_item( const char *name, int pixmap, int append, const char *cmd) { return 0;} virtual int create_menu_item( const char *name, int pixmap, int append, const char *cmd) { return 0;}
virtual int delete_menu_item( const char *name) { return 0;} virtual int delete_menu_item( const char *name) { return 0;}
virtual void change_sup_color( void *imagew, op_eSupColor color) {}
virtual void set_title( char *user) {}
void set_jop_qid( int qix) { if ( jop) jop->set_jop_qid( qix);}; void set_jop_qid( int qix) { if ( jop) jop->set_jop_qid( qix);};
void scan(); void scan();
int appl_action( int idx); int appl_action( int idx);
int jop_command( char *command); int jop_command( char *command);
int sup_init();
void activate_exit(); void activate_exit();
void activate_aalarm_ack(); void activate_aalarm_ack();
void activate_balarm_ack(); void activate_balarm_ack();
...@@ -94,8 +130,10 @@ class Op { ...@@ -94,8 +130,10 @@ class Op {
void activate_show_user(); void activate_show_user();
void activate_logout(); void activate_logout();
void activate_cmd_menu_item( char *cmd); void activate_cmd_menu_item( char *cmd);
void activate_sup_node( void *id);
static void jop_command_cb( void *op, char *command); static void jop_command_cb( void *op, char *command);
static void sup_scan( void *data);
}; };
#endif #endif
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <float.h> #include <float.h>
#include <vector>
#include "co_nav_help.h" #include "co_nav_help.h"
#include "pwr_privilege.h" #include "pwr_privilege.h"
...@@ -3436,6 +3437,10 @@ int XNav::login_from_opplace() ...@@ -3436,6 +3437,10 @@ int XNav::login_from_opplace()
strcpy( user, username); strcpy( user, username);
strcpy( base_user, username); strcpy( base_user, username);
priv = base_priv = privilege; priv = base_priv = privilege;
if (op)
op->set_title( user);
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
......
...@@ -565,6 +565,8 @@ static void xnav_login_success_bc( void *ctx) ...@@ -565,6 +565,8 @@ static void xnav_login_success_bc( void *ctx)
sprintf( msg, "User %s logged in", xnav->user); sprintf( msg, "User %s logged in", xnav->user);
xnav->cologin = 0; xnav->cologin = 0;
xnav->message('I', msg); xnav->message('I', msg);
if ( xnav->op)
xnav->op->set_title( xnav->user);
} }
static void xnav_login_cancel_bc(void *xnav) static void xnav_login_cancel_bc(void *xnav)
...@@ -611,6 +613,8 @@ static int xnav_login_func( void *client_data, ...@@ -611,6 +613,8 @@ static int xnav_login_func( void *client_data,
xnav->priv = priv; xnav->priv = priv;
sprintf( msg, "User %s logged in", arg1_str); sprintf( msg, "User %s logged in", arg1_str);
xnav->message('I', msg); xnav->message('I', msg);
if ( xnav->op)
xnav->op->set_title( xnav->user);
} }
return sts; return sts;
} }
...@@ -637,6 +641,8 @@ static int xnav_logout_func( void *client_data, ...@@ -637,6 +641,8 @@ static int xnav_logout_func( void *client_data,
} }
strcpy( xnav->user, xnav->base_user); strcpy( xnav->user, xnav->base_user);
xnav->priv = xnav->base_priv; xnav->priv = xnav->base_priv;
if ( xnav->op)
xnav->op->set_title( xnav->user);
return 1; return 1;
} }
...@@ -2817,6 +2823,7 @@ static int xnav_open_func( void *client_data, ...@@ -2817,6 +2823,7 @@ static int xnav_open_func( void *client_data,
if ( closebutton) if ( closebutton)
xnav->op->add_close_button(); xnav->op->add_close_button();
strcpy( xnav->opplace_name, opplace_str); strcpy( xnav->opplace_name, opplace_str);
xnav->op->set_title( xnav->user);
// Load eventlist // Load eventlist
if ( xnav->ev) { if ( xnav->ev) {
......
...@@ -261,6 +261,7 @@ E 1.13.26 "_User" ...@@ -261,6 +261,7 @@ E 1.13.26 "_User"
E 1.13.27 "S_witch User" E 1.13.27 "S_witch User"
E 1.13.28 "_Show User" E 1.13.28 "_Show User"
E 1.13.29 "_Return" E 1.13.29 "_Return"
E 1.13.30 " on "
# #
# Postscript printing # Postscript printing
E 2.1.1 "Contents" E 2.1.1 "Contents"
......
...@@ -261,6 +261,7 @@ E 1.13.26 "_Anv ...@@ -261,6 +261,7 @@ E 1.13.26 "_Anv
E 1.13.27 "_Byt Anvndare" E 1.13.27 "_Byt Anvndare"
E 1.13.28 "_Visa Anvndare" E 1.13.28 "_Visa Anvndare"
E 1.13.29 "_terg" E 1.13.29 "_terg"
E 1.13.30 " p "
# #
# Postscript printing # Postscript printing
E 2.1.1 "Innehll" E 2.1.1 "Innehll"
......
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