Commit 5c2ccbaa authored by Marcus Nordenberg's avatar Marcus Nordenberg

rt_xtt: Operator window popup placement + show all available function buttons by default

parent be9d0585
......@@ -99,10 +99,10 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Specifies on which monitor the operator dialogue will
! Specifies on which display the operator dialogue will
! take place.
! If the operator communication is run on the local node
! and the display is to be displayed on the own monitor
! and the display is to be displayed on the own display
! ('default display') the Display attribute ought to be
! left blank.
!*/
......@@ -246,7 +246,7 @@ SObject pwrb:Class
! in respective node. In each node the message handler
! has its own skyline of events (also named MaxNoOfEvents)
! defined by a MessageHandler object. In principle, the
! User object's skyline of events should be selected as å
! User object's skyline of events should be selected as
! MaxNoOfEvents, added up over MaxNoOfEvents in the
! MessageHandler objects in all nodes throughout the
! ProviewR system, or make it simple and assign the
......@@ -356,6 +356,17 @@ SObject pwrb:Class
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Override on what monitor the operator panel will show up. Default 0
! will use the primary monitor of the system. A value of 1 selects the first
! monitor and so on and so forth.
!*/
Object Monitor $Attribute 53
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags = 0
EndBody
EndObject
EndObject
Object Template OpPlace
......@@ -366,6 +377,7 @@ SObject pwrb:Class
Attr OpWindEventNameSegments = 2
Attr MaxNoOfAlarms = 200
Attr MaxNoOfEvents = 500
Attr Monitor = 0
EndBody
EndObject
Object FastAvail $ReferenceList
......
......@@ -80,9 +80,11 @@ static void cnv_pango_text(char* in, char* out, int size)
char* s = in;
char* t = out;
for (int i = 0; i < size && *s; i++, s++) {
for (int i = 0; i < size && *s; i++, s++)
{
*(t++) = *s;
if (*s == '&') {
if (*s == '&')
{
// & -> &amp;
if (i + 4 >= size)
break;
......@@ -98,10 +100,9 @@ static void cnv_pango_text(char* in, char* out, int size)
OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
pwr_tStatus* status)
: Op(op_parent_ctx, opplace, status), parent_wid(op_parent_wid),
title_label(0), a_height(2), text_size(12)
title_label(0), a_height(5), text_size(12)
{
pwr_tStatus sts;
GdkRectangle xtt_monitor_geometry;
GdkColor black_color;
memset(a_exist, 0, sizeof(a_exist));
......@@ -114,15 +115,12 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
gdk_color_parse("Black", &black_color);
gdk_color_parse("White", &white_color);
toplevel = (GtkWidget*)g_object_new(GTK_TYPE_WINDOW, "default-height",
OP_HEIGHT_MIN, "default-width", 1100, NULL);
toplevel =
(GtkWidget*)g_object_new(GTK_TYPE_WINDOW, "default-height", OP_HEIGHT_MIN,
"default-width", 1100, NULL);
gtk_window_set_decorated(GTK_WINDOW(toplevel), FALSE);
CoWowGtk::SetWindowIcon(toplevel);
GdkScreen* xtt_screen = gtk_widget_get_screen(toplevel);
int xtt_monitor = gdk_screen_get_monitor_at_point(xtt_screen, 0, 0);
gdk_screen_get_monitor_geometry(
xtt_screen, xtt_monitor, &xtt_monitor_geometry);
pwr_tFileName fname;
dcli_translate_filename(fname, "$pwr_exe/xtt_alarm_active.png");
......@@ -284,8 +282,8 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
gtk_container_add(GTK_CONTAINER(aalarm_ack), gtk_image_new_from_file(fname));
gtk_widget_set_size_request(aalarm_ack, 30, 20);
gtk_widget_set_size_request(aalarm_mark, -1, 20);
g_signal_connect(
aalarm_ack, "clicked", G_CALLBACK(activate_aalarm_ack), this);
g_signal_connect(aalarm_ack, "clicked", G_CALLBACK(activate_aalarm_ack),
this);
// Increment size button
GtkWidget* incr_button = gtk_button_new();
......@@ -293,16 +291,16 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
gtk_container_add(GTK_CONTAINER(incr_button), gtk_image_new_from_file(fname));
gtk_widget_set_size_request(incr_button, 30, 20);
gtk_widget_set_size_request(alarmcnt_label, -1, 20);
g_signal_connect(
incr_button, "clicked", G_CALLBACK(activate_aalarm_incr), this);
g_signal_connect(incr_button, "clicked", G_CALLBACK(activate_aalarm_incr),
this);
// Decrement size button
decr_button = gtk_button_new();
dcli_translate_filename(fname, "$pwr_exe/xtt_up.png");
gtk_container_add(GTK_CONTAINER(decr_button), gtk_image_new_from_file(fname));
gtk_widget_set_size_request(decr_button, 30, 20);
g_signal_connect(
decr_button, "clicked", G_CALLBACK(activate_aalarm_decr), this);
g_signal_connect(decr_button, "clicked", G_CALLBACK(activate_aalarm_decr),
this);
// Acknowledge button for b alarms
GtkWidget* balarm_ack = gtk_button_new();
......@@ -310,8 +308,8 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
gtk_container_add(GTK_CONTAINER(balarm_ack), gtk_image_new_from_file(fname));
gtk_widget_set_size_request(balarm_ack, 30, 20);
gtk_widget_set_size_request(balarm_mark, -1, 20);
g_signal_connect(
balarm_ack, "clicked", G_CALLBACK(activate_balarm_ack), this);
g_signal_connect(balarm_ack, "clicked", G_CALLBACK(activate_balarm_ack),
this);
GtkWidget* hbox_abutton = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox_abutton), aalarm_ack, FALSE, FALSE, 2);
......@@ -348,8 +346,8 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
// Menu
// Accelerators
GtkAccelGroup* accel_g
= (GtkAccelGroup*)g_object_new(GTK_TYPE_ACCEL_GROUP, NULL);
GtkAccelGroup* accel_g =
(GtkAccelGroup*)g_object_new(GTK_TYPE_ACCEL_GROUP, NULL);
gtk_window_add_accel_group(GTK_WINDOW(toplevel), accel_g);
menu_bar = (GtkMenuBar*)g_object_new(GTK_TYPE_MENU_BAR, NULL);
......@@ -389,19 +387,19 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
g_signal_connect(functions_alarm_blocklist, "activate",
G_CALLBACK(activate_blocklist), this);
GtkWidget* functions_alarm
= gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Alarm"));
GtkWidget* functions_alarm =
gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Alarm"));
GtkMenu* functions_alarm_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_alarm_menu), functions_alarm_alarmlist);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_alarm_menu), functions_alarm_eventlist);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_alarm_menu), functions_alarm_eventlog);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_alarm_menu), functions_alarm_blocklist);
gtk_menu_item_set_submenu(
GTK_MENU_ITEM(functions_alarm), GTK_WIDGET(functions_alarm_menu));
gtk_menu_shell_append(GTK_MENU_SHELL(functions_alarm_menu),
functions_alarm_alarmlist);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_alarm_menu),
functions_alarm_eventlist);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_alarm_menu),
functions_alarm_eventlog);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_alarm_menu),
functions_alarm_blocklist);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions_alarm),
GTK_WIDGET(functions_alarm_menu));
// End Alarm submenu
// Submenu Curves
......@@ -410,33 +408,33 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
dcli_translate_filename(fname, "$pwr_exe/xtt_meth_trend.png");
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(functions_curves_trend),
gtk_image_new_from_file(fname));
g_signal_connect(
functions_curves_trend, "activate", G_CALLBACK(activate_trend), this);
g_signal_connect(functions_curves_trend, "activate",
G_CALLBACK(activate_trend), this);
GtkWidget* functions_curves_fast = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Fast"));
GtkWidget* functions_curves_fast =
gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Fast"));
dcli_translate_filename(fname, "$pwr_exe/xtt_meth_fast.png");
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(functions_curves_fast),
gtk_image_new_from_file(fname));
g_signal_connect(
functions_curves_fast, "activate", G_CALLBACK(activate_fast), this);
g_signal_connect(functions_curves_fast, "activate", G_CALLBACK(activate_fast),
this);
GtkWidget* functions_curves_history = gtk_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Process History"));
g_signal_connect(
functions_curves_history, "activate", G_CALLBACK(activate_history), this);
g_signal_connect(functions_curves_history, "activate",
G_CALLBACK(activate_history), this);
GtkWidget* functions_curves
= gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Curves"));
GtkWidget* functions_curves =
gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Curves"));
GtkMenu* functions_curves_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_curves_menu), functions_curves_trend);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_curves_menu), functions_curves_fast);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_curves_menu), functions_curves_history);
gtk_menu_item_set_submenu(
GTK_MENU_ITEM(functions_curves), GTK_WIDGET(functions_curves_menu));
gtk_menu_shell_append(GTK_MENU_SHELL(functions_curves_menu),
functions_curves_trend);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_curves_menu),
functions_curves_fast);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_curves_menu),
functions_curves_history);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions_curves),
GTK_WIDGET(functions_curves_menu));
// End Curves submenu
// Submenu View
......@@ -448,82 +446,82 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
GtkWidget* functions_view_incr = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Larger Text"));
dcli_translate_filename(fname, "$pwr_exe/xtt_zoom_in.png");
gtk_image_menu_item_set_image(
GTK_IMAGE_MENU_ITEM(functions_view_incr), gtk_image_new_from_file(fname));
g_signal_connect(
functions_view_incr, "activate", G_CALLBACK(activate_zoom_in), this);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(functions_view_incr),
gtk_image_new_from_file(fname));
g_signal_connect(functions_view_incr, "activate",
G_CALLBACK(activate_zoom_in), this);
GtkWidget* functions_view_decr = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Smaller Text"));
dcli_translate_filename(fname, "$pwr_exe/xtt_zoom_out.png");
gtk_image_menu_item_set_image(
GTK_IMAGE_MENU_ITEM(functions_view_decr), gtk_image_new_from_file(fname));
g_signal_connect(
functions_view_decr, "activate", G_CALLBACK(activate_zoom_out), this);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(functions_view_decr),
gtk_image_new_from_file(fname));
g_signal_connect(functions_view_decr, "activate",
G_CALLBACK(activate_zoom_out), this);
GtkWidget* functions_view
= gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_View"));
GtkWidget* functions_view =
gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_View"));
GtkMenu* functions_view_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_view_menu), functions_view_colortheme);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_view_menu), functions_view_incr);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_view_menu), functions_view_decr);
gtk_menu_item_set_submenu(
GTK_MENU_ITEM(functions_view), GTK_WIDGET(functions_view_menu));
gtk_menu_shell_append(GTK_MENU_SHELL(functions_view_menu),
functions_view_colortheme);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_view_menu),
functions_view_incr);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_view_menu),
functions_view_decr);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions_view),
GTK_WIDGET(functions_view_menu));
// End View submenu
// Submenu User
GtkWidget* functions_user_switch = gtk_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("S_witch User"));
GtkWidget* functions_user_switch =
gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("S_witch User"));
g_signal_connect(functions_user_switch, "activate",
G_CALLBACK(activate_switch_user), this);
GtkWidget* functions_user_show
= gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Show User"));
g_signal_connect(
functions_user_show, "activate", G_CALLBACK(activate_show_user), this);
GtkWidget* functions_user_show =
gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Show User"));
g_signal_connect(functions_user_show, "activate",
G_CALLBACK(activate_show_user), this);
GtkWidget* functions_user_logout
= gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Return"));
g_signal_connect(
functions_user_logout, "activate", G_CALLBACK(activate_logout), this);
GtkWidget* functions_user_logout =
gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Return"));
g_signal_connect(functions_user_logout, "activate",
G_CALLBACK(activate_logout), this);
GtkWidget* functions_user
= gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_User"));
GtkWidget* functions_user =
gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_User"));
GtkMenu* functions_user_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_user_menu), functions_user_switch);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_user_menu), functions_user_show);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_user_menu), functions_user_logout);
gtk_menu_item_set_submenu(
GTK_MENU_ITEM(functions_user), GTK_WIDGET(functions_user_menu));
gtk_menu_shell_append(GTK_MENU_SHELL(functions_user_menu),
functions_user_switch);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_user_menu),
functions_user_show);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_user_menu),
functions_user_logout);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions_user),
GTK_WIDGET(functions_user_menu));
// End User submenu
GtkWidget* functions_navigator = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Navigator"));
dcli_translate_filename(fname, "$pwr_exe/xtt_navigator.png");
gtk_image_menu_item_set_image(
GTK_IMAGE_MENU_ITEM(functions_navigator), gtk_image_new_from_file(fname));
g_signal_connect(
functions_navigator, "activate", G_CALLBACK(activate_navigator), this);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(functions_navigator),
gtk_image_new_from_file(fname));
g_signal_connect(functions_navigator, "activate",
G_CALLBACK(activate_navigator), this);
// gtk_widget_add_accelerator( functions_navigator, "activate", accel_g,
// 'd', GdkModifierType(GDK_CONTROL_MASK),
//GTK_ACCEL_VISIBLE);
// GTK_ACCEL_VISIBLE);
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
gtk_image_menu_item_set_image(
GTK_IMAGE_MENU_ITEM(functions_graph), gtk_image_new_from_file(fname));
g_signal_connect(
functions_graph, "activate", G_CALLBACK(activate_graph), this);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(functions_graph),
gtk_image_new_from_file(fname));
g_signal_connect(functions_graph, "activate", G_CALLBACK(activate_graph),
this);
// gtk_widget_add_accelerator( functions_graph, "activate", accel_g,
// 'g', GdkModifierType(GDK_CONTROL_MASK),
//GTK_ACCEL_VISIBLE);
// GTK_ACCEL_VISIBLE);
// Submenu Help
GtkWidget* functions_help_project = gtk_image_menu_item_new_with_mnemonic(
......@@ -531,49 +529,50 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
dcli_translate_filename(fname, "$pwr_exe/xtt_help.png");
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(functions_help_project),
gtk_image_new_from_file(fname));
g_signal_connect(
functions_help_project, "activate", G_CALLBACK(activate_help), this);
g_signal_connect(functions_help_project, "activate",
G_CALLBACK(activate_help), this);
GtkWidget* functions_help_overview
= gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Overview"));
GtkWidget* functions_help_overview =
gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Overview"));
g_signal_connect(functions_help_overview, "activate",
G_CALLBACK(activate_help_overview), this);
GtkWidget* functions_help_opwin = gtk_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_OperatorWindow"));
g_signal_connect(
functions_help_opwin, "activate", G_CALLBACK(activate_help_opwin), this);
g_signal_connect(functions_help_opwin, "activate",
G_CALLBACK(activate_help_opwin), this);
GtkWidget* functions_help_proview = gtk_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_About ProviewR"));
g_signal_connect(functions_help_proview, "activate",
G_CALLBACK(activate_help_proview), this);
GtkWidget* functions_help
= gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Help"));
GtkWidget* functions_help =
gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Help"));
GtkMenu* functions_help_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_help_menu), functions_help_project);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_help_menu), functions_help_overview);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_help_menu), functions_help_opwin);
gtk_menu_shell_append(
GTK_MENU_SHELL(functions_help_menu), functions_help_proview);
gtk_menu_item_set_submenu(
GTK_MENU_ITEM(functions_help), GTK_WIDGET(functions_help_menu));
gtk_menu_shell_append(GTK_MENU_SHELL(functions_help_menu),
functions_help_project);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_help_menu),
functions_help_overview);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_help_menu),
functions_help_opwin);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_help_menu),
functions_help_proview);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions_help),
GTK_WIDGET(functions_help_menu));
// End Help submenu
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),
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_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,
// 'w', GdkModifierType(GDK_CONTROL_MASK),
//GTK_ACCEL_VISIBLE);
// GTK_ACCEL_VISIBLE);
GtkMenu* functions_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_alarm);
......@@ -588,12 +587,12 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
GtkWidget* functions = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Functions"));
dcli_translate_filename(fname, "$pwr_exe/xtt_down.png");
gtk_image_menu_item_set_image(
GTK_IMAGE_MENU_ITEM(functions), gtk_image_new_from_file(fname));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(functions),
gtk_image_new_from_file(fname));
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), functions);
gtk_menu_item_set_submenu(
GTK_MENU_ITEM(functions), GTK_WIDGET(functions_menu));
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions),
GTK_WIDGET(functions_menu));
// Toolbar
tools = (GtkWidget*)g_object_new(GTK_TYPE_TOOLBAR, NULL);
......@@ -601,19 +600,19 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
GtkWidget* tools_zoom_in = gtk_button_new();
dcli_translate_filename(fname, "$pwr_exe/xtt_zoom_in.png");
gtk_container_add(
GTK_CONTAINER(tools_zoom_in), gtk_image_new_from_file(fname));
g_signal_connect(
tools_zoom_in, "clicked", G_CALLBACK(activate_zoom_in), this);
gtk_container_add(GTK_CONTAINER(tools_zoom_in),
gtk_image_new_from_file(fname));
g_signal_connect(tools_zoom_in, "clicked", G_CALLBACK(activate_zoom_in),
this);
gtk_toolbar_append_widget(GTK_TOOLBAR(tools), tools_zoom_in,
CoWowGtk::translate_utf8("Larger Text"), "");
GtkWidget* tools_zoom_out = gtk_button_new();
dcli_translate_filename(fname, "$pwr_exe/xtt_zoom_out.png");
gtk_container_add(
GTK_CONTAINER(tools_zoom_out), gtk_image_new_from_file(fname));
g_signal_connect(
tools_zoom_out, "clicked", G_CALLBACK(activate_zoom_out), this);
gtk_container_add(GTK_CONTAINER(tools_zoom_out),
gtk_image_new_from_file(fname));
g_signal_connect(tools_zoom_out, "clicked", G_CALLBACK(activate_zoom_out),
this);
gtk_toolbar_append_widget(GTK_TOOLBAR(tools), tools_zoom_out,
CoWowGtk::translate_utf8("Smaller Text"), "");
......@@ -621,70 +620,70 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
dcli_translate_filename(fname, "$pwr_exe/xtt_help.png");
gtk_container_add(GTK_CONTAINER(tools_help), gtk_image_new_from_file(fname));
g_signal_connect(tools_help, "clicked", G_CALLBACK(activate_help), this);
gtk_toolbar_append_widget(
GTK_TOOLBAR(tools), tools_help, CoWowGtk::translate_utf8("Help"), "");
gtk_toolbar_append_widget(GTK_TOOLBAR(tools), tools_help,
CoWowGtk::translate_utf8("Help"), "");
tools_close = gtk_button_new();
dcli_translate_filename(fname, "$pwr_exe/xtt_close.png");
gtk_container_add(GTK_CONTAINER(tools_close), gtk_image_new_from_file(fname));
g_signal_connect(tools_close, "clicked", G_CALLBACK(activate_exit), this);
gtk_toolbar_append_widget(
GTK_TOOLBAR(tools), tools_close, CoWowGtk::translate_utf8("Close"), "");
gtk_toolbar_append_widget(GTK_TOOLBAR(tools), tools_close,
CoWowGtk::translate_utf8("Close"), "");
GtkWidget* tools_alarmlist = gtk_button_new();
dcli_translate_filename(fname, "$pwr_exe/xtt_alarmlist.png");
gtk_container_add(
GTK_CONTAINER(tools_alarmlist), gtk_image_new_from_file(fname));
g_signal_connect(
tools_alarmlist, "clicked", G_CALLBACK(activate_alarmlist), this);
gtk_container_add(GTK_CONTAINER(tools_alarmlist),
gtk_image_new_from_file(fname));
g_signal_connect(tools_alarmlist, "clicked", G_CALLBACK(activate_alarmlist),
this);
gtk_toolbar_append_widget(GTK_TOOLBAR(tools2), tools_alarmlist,
CoWowGtk::translate_utf8("Alarm List"), "");
GtkWidget* tools_eventlist = gtk_button_new();
dcli_translate_filename(fname, "$pwr_exe/xtt_eventlist.png");
gtk_container_add(
GTK_CONTAINER(tools_eventlist), gtk_image_new_from_file(fname));
g_signal_connect(
tools_eventlist, "clicked", G_CALLBACK(activate_eventlist), this);
gtk_container_add(GTK_CONTAINER(tools_eventlist),
gtk_image_new_from_file(fname));
g_signal_connect(tools_eventlist, "clicked", G_CALLBACK(activate_eventlist),
this);
gtk_toolbar_append_widget(GTK_TOOLBAR(tools2), tools_eventlist,
CoWowGtk::translate_utf8("Event List"), "");
GtkWidget* tools_eventlog = gtk_button_new();
dcli_translate_filename(fname, "$pwr_exe/xtt_eventlog.png");
gtk_container_add(
GTK_CONTAINER(tools_eventlog), gtk_image_new_from_file(fname));
g_signal_connect(
tools_eventlog, "clicked", G_CALLBACK(activate_eventlog), this);
gtk_container_add(GTK_CONTAINER(tools_eventlog),
gtk_image_new_from_file(fname));
g_signal_connect(tools_eventlog, "clicked", G_CALLBACK(activate_eventlog),
this);
gtk_toolbar_append_widget(GTK_TOOLBAR(tools2), tools_eventlog,
CoWowGtk::translate_utf8("Event Log"), "");
GtkWidget* tools_blocklist = gtk_button_new();
dcli_translate_filename(fname, "$pwr_exe/xtt_blocklist.png");
gtk_container_add(
GTK_CONTAINER(tools_blocklist), gtk_image_new_from_file(fname));
g_signal_connect(
tools_blocklist, "clicked", G_CALLBACK(activate_blocklist), this);
gtk_container_add(GTK_CONTAINER(tools_blocklist),
gtk_image_new_from_file(fname));
g_signal_connect(tools_blocklist, "clicked", G_CALLBACK(activate_blocklist),
this);
gtk_toolbar_append_widget(GTK_TOOLBAR(tools2), tools_blocklist,
CoWowGtk::translate_utf8("Blocked Alarms"), "");
GtkWidget* tools_navigator = gtk_button_new();
dcli_translate_filename(fname, "$pwr_exe/xtt_navigator.png");
gtk_container_add(
GTK_CONTAINER(tools_navigator), gtk_image_new_from_file(fname));
g_signal_connect(
tools_navigator, "clicked", G_CALLBACK(activate_navigator), this);
gtk_container_add(GTK_CONTAINER(tools_navigator),
gtk_image_new_from_file(fname));
g_signal_connect(tools_navigator, "clicked", G_CALLBACK(activate_navigator),
this);
gtk_toolbar_append_widget(GTK_TOOLBAR(tools2), tools_navigator,
CoWowGtk::translate_utf8("Navigator"), "");
// System pushbuttons
GtkWidget* sysbutton_box = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(
GTK_BOX(sysbutton_box), GTK_WIDGET(menu_bar), FALSE, FALSE, 0);
gtk_box_pack_start(
GTK_BOX(sysbutton_box), GTK_WIDGET(tools), FALSE, FALSE, 0);
gtk_box_pack_start(
GTK_BOX(sysbutton_box), GTK_WIDGET(tools2), FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(sysbutton_box), GTK_WIDGET(menu_bar), FALSE, FALSE,
0);
gtk_box_pack_start(GTK_BOX(sysbutton_box), GTK_WIDGET(tools), 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);
sts = configure(opplace);
......@@ -693,7 +692,8 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
// Status bar
GtkWidget* status_bar = NULL;
if (!(layout_mask & pwr_mOpWindLayoutMask_HideStatusBar)) {
if (!(layout_mask & pwr_mOpWindLayoutMask_HideStatusBar))
{
char text[80];
pwr_tTime time;
......@@ -705,29 +705,35 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
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);
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
int padding1, padding2, buttonwidth;
if (sup_vect.size() > 10) {
if (sup_vect.size() > 10)
{
padding1 = 0;
padding2 = 0;
buttonwidth = (xtt_monitor_geometry.width - 350) / sup_vect.size();
} else if (sup_vect.size() > 6) {
buttonwidth = (monitor_geometry.width - 350) / sup_vect.size();
}
else if (sup_vect.size() > 6)
{
padding1 = 8;
padding2 = 5;
buttonwidth
= (xtt_monitor_geometry.width - 350) / sup_vect.size() - 2 * padding2;
} else {
buttonwidth =
(monitor_geometry.width - 350) / sup_vect.size() - 2 * padding2;
}
else
{
padding1 = 8;
padding2 = 5;
buttonwidth = 0;
}
for (unsigned int i = 0; i < sup_vect.size(); i++) {
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>", 11 * 1024,
sup_vect[i].node_name);
......@@ -748,8 +754,8 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
gtk_fixed_put(GTK_FIXED(node_ind_frame_box), node_ind, 1, 1);
gtk_box_pack_start(GTK_BOX(node_hbox), GTK_WIDGET(node_ind_frame_box),
FALSE, FALSE, padding1);
gtk_box_pack_start(
GTK_BOX(node_hbox), GTK_WIDGET(node_label_bg), TRUE, TRUE, padding1);
gtk_box_pack_start(GTK_BOX(node_hbox), GTK_WIDGET(node_label_bg), TRUE,
TRUE, padding1);
GtkWidget* node_image = gtk_vbox_new(FALSE, 0);
GtkWidget* node_ind_filler1 = gtk_event_box_new();
......@@ -760,12 +766,12 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
gtk_widget_modify_bg(GTK_WIDGET(node_ind), GTK_STATE_NORMAL, &gray_color);
gtk_widget_set_size_request(node_ind, 18, 18);
gtk_widget_modify_bg(
GTK_WIDGET(node_ind_frame), GTK_STATE_NORMAL, &black_color);
gtk_widget_modify_bg(
GTK_WIDGET(node_ind_frame), GTK_STATE_PRELIGHT, &black_color);
gtk_widget_modify_bg(
GTK_WIDGET(node_ind_frame), GTK_STATE_ACTIVE, &black_color);
gtk_widget_modify_bg(GTK_WIDGET(node_ind_frame), GTK_STATE_NORMAL,
&black_color);
gtk_widget_modify_bg(GTK_WIDGET(node_ind_frame), GTK_STATE_PRELIGHT,
&black_color);
gtk_widget_modify_bg(GTK_WIDGET(node_ind_frame), GTK_STATE_ACTIVE,
&black_color);
gtk_widget_set_size_request(node_ind_frame, 20, 20);
if (buttonwidth)
......@@ -781,11 +787,11 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
g_signal_connect(node_button, "button_press_event",
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, padding2);
gtk_box_pack_start(GTK_BOX(status_bar), GTK_WIDGET(node_button), FALSE,
FALSE, padding2);
}
if (buttonwidth)
gtk_widget_set_size_request(status_bar, xtt_monitor_geometry.width, -1);
gtk_widget_set_size_request(status_bar, monitor_geometry.width, -1);
}
// Main window
......@@ -800,10 +806,11 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
gtk_paned_pack2(GTK_PANED(pane), hbox_conf, FALSE, TRUE);
GtkWidget* vbox_conf = gtk_vbox_new(FALSE, 0);
if (!(layout_mask & pwr_mOpWindLayoutMask_HideStatusBar)) {
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), gtk_hseparator_new(), FALSE, FALSE,
2);
}
gtk_box_pack_start(GTK_BOX(vbox_conf), pane, FALSE, FALSE, 0);
......@@ -817,7 +824,8 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
gtk_widget_show_all(toplevel);
if (start_jop) {
if (start_jop)
{
jop = new Jop((void*)this);
jop->command_cb = &jop_command_cb;
}
......@@ -829,23 +837,16 @@ OpGtk::OpGtk(void* op_parent_ctx, GtkWidget* op_parent_wid, char* opplace,
g_object_set(aalarm_box[3], "visible", FALSE, NULL);
g_object_set(aalarm_box[4], "visible", FALSE, NULL);
g_object_set(balarm_box, "visible", FALSE, NULL);
g_object_set(decr_button, "visible", FALSE, NULL);
if (layout_mask & pwr_mOpWindLayoutMask_HideCloseButton) {
g_object_set(decr_button, "visible", TRUE, 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)
activate_aalarm_decr(0, this);
if (a_height == 4) {
// g_object_set( decr_button, "visible", TRUE, NULL);
activate_aalarm_decr(0, this);
activate_aalarm_decr(0, this);
}
gtk_window_resize(
GTK_WINDOW(toplevel), xtt_monitor_geometry.width, OP_HEIGHT_MIN);
gtk_window_move(GTK_WINDOW(toplevel), 0, 0);
gtk_window_resize(GTK_WINDOW(toplevel), monitor_geometry.width,
OP_HEIGHT_MIN);
gtk_window_move(GTK_WINDOW(toplevel), monitor_geometry.x, 0);
wow = new CoWowGtk(toplevel);
sup_timerid = wow->timer_new();
......@@ -864,7 +865,8 @@ OpGtk::~OpGtk()
{
if (jop)
delete jop;
if (sup_timerid) {
if (sup_timerid)
{
sup_timerid->remove();
delete sup_timerid;
}
......@@ -889,8 +891,8 @@ void OpGtk::add_close_button()
g_object_set(functions_close, "visible", TRUE, NULL);
}
int OpGtk::create_menu_item(
const char* name, int pixmap, int append, const char* cmd)
int OpGtk::create_menu_item(const char* name, int pixmap, int append,
const char* cmd)
{
GtkWidget* w;
int sts;
......@@ -924,9 +926,11 @@ void OpGtk::update_alarm_info()
int show_time = 0;
time_eFormat time_format = time_eFormat_Time;
char* s;
int backward = layout_mask & pwr_mOpWindLayoutMask_ShowOldestNotAckedAlarm ? 1 : 0;
int backward =
layout_mask & pwr_mOpWindLayoutMask_ShowOldestNotAckedAlarm ? 1 : 0;
if (get_alarm_info_cb) {
if (get_alarm_info_cb)
{
sts = (get_alarm_info_cb)(parent_ctx, &info, backward, a_height);
if (EVEN(sts))
return;
......@@ -941,55 +945,71 @@ void OpGtk::update_alarm_info()
snprintf(str, sizeof(str), "%d", info.alarms_total);
gtk_label_set_text(GTK_LABEL(alarmcnt_label), str);
if (layout_mask & pwr_mOpWindLayoutMask_ShowAlarmDateAndTime) {
if (layout_mask & pwr_mOpWindLayoutMask_ShowAlarmDateAndTime)
{
time_format = time_eFormat_ComprDateAndTime;
show_time = 1;
} else if (layout_mask & pwr_mOpWindLayoutMask_ShowAlarmTime) {
}
else if (layout_mask & pwr_mOpWindLayoutMask_ShowAlarmTime)
{
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_active[i] = info.a_alarm_active[i];
strcpy(a_alarm_moretext[i], info.a_alarm_moretext[i]);
if (info.a_alarm_exist[i]) {
if (info.a_alarm_exist[i])
{
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 (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
}
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);
snprintf(text, sizeof(text), "<span size=\"%d\">%s</span>", fsize,
timestr);
// 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);
if (info.a_alarm_active[i]) {
if (info.a_alarm_active[i])
{
g_object_set(aalarm_active[i], "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(aalarm_active[i], "visible", FALSE, NULL);
}
if (!streq(info.a_alarm_moretext[i], "")) {
if (!streq(info.a_alarm_moretext[i], ""))
{
g_object_set(aalarm_info[i], "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(aalarm_info[i], "visible", FALSE, NULL);
}
}
} else {
}
else
{
gtk_label_set_text(GTK_LABEL(aalarm_label[i]), "");
// gtk_widget_modify_bg( aalarm_box[i], GTK_STATE_NORMAL, &bg_color);
g_object_set(aalarm_active[i], "visible", FALSE, NULL);
......@@ -997,43 +1017,54 @@ void OpGtk::update_alarm_info()
}
}
if (info.b_alarm_exist[0]) {
if (info.b_alarm_exist[0])
{
balarm_type = evlist_eEventType_Alarm;
balarm_prio = mh_eEventPrio_B;
strcpy(b_alarm_moretext, info.b_alarm_moretext[0]);
cnv_pango_text(info.b_alarm_text[0], ctext, sizeof(ctext));
if (show_time) {
sts = time_AtoAscii(
&info.b_alarm_time[0], time_format, timestr, sizeof(timestr));
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
}
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);
g_object_set(balarm_box, "visible", TRUE, NULL);
gtk_label_set_text(GTK_LABEL(balarm_mark), "B");
if (info.b_alarm_active[0]) {
if (info.b_alarm_active[0])
{
g_object_set(balarm_active, "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(balarm_active, "visible", FALSE, NULL);
}
if (!streq(info.b_alarm_moretext[0], "")) {
if (!streq(info.b_alarm_moretext[0], ""))
{
g_object_set(balarm_info, "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(balarm_info, "visible", FALSE, NULL);
}
} else if (info.c_alarm_exist[0]) {
}
else if (info.c_alarm_exist[0])
{
GdkColor blue_color;
gdk_color_parse("Lightblue", &blue_color);
......@@ -1041,35 +1072,45 @@ void OpGtk::update_alarm_info()
balarm_prio = mh_eEventPrio_C;
strcpy(b_alarm_moretext, info.c_alarm_moretext[0]);
cnv_pango_text(info.c_alarm_text[0], ctext, sizeof(ctext));
if (show_time) {
sts = time_AtoAscii(
&info.c_alarm_time[0], time_format, timestr, sizeof(timestr));
if (show_time)
{
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
}
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);
g_object_set(balarm_box, "visible", TRUE, NULL);
gtk_label_set_text(GTK_LABEL(balarm_mark), "C");
if (info.c_alarm_active[0]) {
if (info.c_alarm_active[0])
{
g_object_set(balarm_active, "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(balarm_active, "visible", FALSE, NULL);
}
if (!streq(info.c_alarm_moretext[0], "")) {
if (!streq(info.c_alarm_moretext[0], ""))
{
g_object_set(balarm_info, "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(balarm_info, "visible", FALSE, NULL);
}
} else if (info.d_alarm_exist[0]) {
}
else if (info.d_alarm_exist[0])
{
GdkColor violet_color;
gdk_color_parse("Violet", &violet_color);
......@@ -1077,51 +1118,63 @@ void OpGtk::update_alarm_info()
balarm_prio = mh_eEventPrio_D;
strcpy(b_alarm_moretext, info.d_alarm_moretext[0]);
cnv_pango_text(info.d_alarm_text[0], ctext, sizeof(ctext));
if (show_time) {
sts = time_AtoAscii(
&info.d_alarm_time[0], time_format, timestr, sizeof(timestr));
if (show_time)
{
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
}
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);
g_object_set(balarm_box, "visible", TRUE, NULL);
gtk_label_set_text(GTK_LABEL(balarm_mark), "D");
if (info.b_alarm_active[0]) {
if (info.b_alarm_active[0])
{
g_object_set(balarm_active, "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(balarm_active, "visible", FALSE, NULL);
}
if (!streq(info.d_alarm_moretext[0], "")) {
if (!streq(info.d_alarm_moretext[0], ""))
{
g_object_set(balarm_info, "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(balarm_info, "visible", FALSE, NULL);
}
} else if (info.i_alarm_exist[0]) {
}
else if (info.i_alarm_exist[0])
{
balarm_type = info.i_alarm_eventtype[0];
strcpy(b_alarm_moretext, info.i_alarm_moretext[0]);
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 (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
}
else
snprintf(text, sizeof(text), "<span size=\"%d\">%s %s</span>", 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));
if (balarm_type == evlist_eEventType_InfoSuccess)
gtk_widget_modify_bg(balarm_ebox, GTK_STATE_NORMAL, &green_color);
else
......@@ -1130,17 +1183,25 @@ void OpGtk::update_alarm_info()
gtk_label_set_text(GTK_LABEL(balarm_mark), "I");
if (info.i_alarm_active[0]) {
if (info.i_alarm_active[0])
{
g_object_set(balarm_active, "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(balarm_active, "visible", FALSE, NULL);
}
if (!streq(info.i_alarm_moretext[0], "")) {
if (!streq(info.i_alarm_moretext[0], ""))
{
g_object_set(balarm_info, "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(balarm_info, "visible", FALSE, NULL);
}
} else {
}
else
{
gtk_label_set_text(GTK_LABEL(balarm_label), "");
gtk_widget_modify_bg(balarm_ebox, GTK_STATE_NORMAL, &bg_color);
gtk_label_set_text(GTK_LABEL(balarm_mark), "");
......@@ -1173,10 +1234,22 @@ int OpGtk::configure(char* opplace_str)
if (opplace_p->StartJavaProcess)
start_jop = 1;
GdkScreen* xtt_screen = gtk_widget_get_screen(toplevel);
int numberOfMonitors = gdk_screen_get_n_monitors(xtt_screen);
int monitor = opplace_p->Monitor;
if (monitor > numberOfMonitors || monitor < 0) monitor = 0;
if (monitor == 0) monitor = gdk_screen_get_primary_monitor(xtt_screen);
else monitor = opplace_p->Monitor - 1;
gdk_screen_get_monitor_geometry(xtt_screen, monitor,
&monitor_geometry);
// Examine Graph objects
for (i = 0;
i < sizeof(opplace_p->FastAvail) / sizeof(opplace_p->FastAvail[0]);
i++) {
i < sizeof(opplace_p->FastAvail) / sizeof(opplace_p->FastAvail[0]); i++)
{
button_aref[i].Objid = pwr_cNOid;
if (cdh_ObjidIsNull(opplace_p->FastAvail[i].Objid))
continue;
......@@ -1186,34 +1259,35 @@ int OpGtk::configure(char* opplace_str)
continue;
memset(&attrref, 0, sizeof(attrref));
switch (tid) {
switch (tid)
{
case pwr_cClass_XttGraph:
sts = gdh_ClassAttrToAttrref(
pwr_cClass_XttGraph, ".ButtonText", &attrref);
sts =
gdh_ClassAttrToAttrref(pwr_cClass_XttGraph, ".ButtonText", &attrref);
if (EVEN(sts))
return sts;
break;
case pwr_cClass_XttMultiView:
sts = gdh_ClassAttrToAttrref(
pwr_cClass_XttMultiView, ".ButtonText", &attrref);
sts = gdh_ClassAttrToAttrref(pwr_cClass_XttMultiView, ".ButtonText",
&attrref);
if (EVEN(sts))
return sts;
break;
case pwr_cClass_XttCamera:
sts = gdh_ClassAttrToAttrref(
pwr_cClass_XttCamera, ".ButtonText", &attrref);
sts =
gdh_ClassAttrToAttrref(pwr_cClass_XttCamera, ".ButtonText", &attrref);
if (EVEN(sts))
return sts;
break;
case pwr_cClass_SevPlotGroup:
sts = gdh_ClassAttrToAttrref(
pwr_cClass_SevPlotGroup, ".ButtonText", &attrref);
sts = gdh_ClassAttrToAttrref(pwr_cClass_SevPlotGroup, ".ButtonText",
&attrref);
if (EVEN(sts))
return sts;
break;
case pwr_cClass_PlotGroup:
sts = gdh_ClassAttrToAttrref(
pwr_cClass_PlotGroup, ".ButtonText", &attrref);
sts =
gdh_ClassAttrToAttrref(pwr_cClass_PlotGroup, ".ButtonText", &attrref);
if (EVEN(sts))
return sts;
break;
......@@ -1222,12 +1296,13 @@ int OpGtk::configure(char* opplace_str)
}
attrref = cdh_ArefAdd(&opplace_p->FastAvail[i], &attrref);
sts = gdh_GetObjectInfoAttrref(
&attrref, (void*)button_title[i], sizeof(button_title[0]));
sts = gdh_GetObjectInfoAttrref(&attrref, (void*)button_title[i],
sizeof(button_title[0]));
if (EVEN(sts))
continue;
if (streq(button_title[i], "")) {
if (streq(button_title[i], ""))
{
// Take object name instead
sts = gdh_AttrrefToName(&opplace_p->FastAvail[i], button_title[i],
sizeof(button_title[0]), cdh_mName_object);
......@@ -1240,13 +1315,13 @@ int OpGtk::configure(char* opplace_str)
// Create the application buttons
for (i = 0;
i < sizeof(opplace_p->FastAvail) / sizeof(opplace_p->FastAvail[0]);
i++) {
i < sizeof(opplace_p->FastAvail) / sizeof(opplace_p->FastAvail[0]); i++)
{
if (cdh_ObjidIsNull(button_aref[i].Objid))
continue;
char* textutf8 = g_convert(
button_title[i], -1, "UTF-8", "ISO8859-1", NULL, NULL, NULL);
char* textutf8 =
g_convert(button_title[i], -1, "UTF-8", "ISO8859-1", NULL, NULL, NULL);
// appl_buttons[i] = gtk_button_new_with_label(textutf8);
appl_buttons[i] = gtk_event_box_new();
gtk_container_set_border_width(GTK_CONTAINER(appl_buttons[i]), 2);
......@@ -1254,7 +1329,8 @@ int OpGtk::configure(char* opplace_str)
g_free(textutf8);
gtk_container_add(GTK_CONTAINER(appl_buttons[i]), label);
gtk_widget_set_size_request(appl_buttons[i], -1, 28);
switch (i) {
switch (i)
{
case 0:
g_signal_connect(appl_buttons[i], "button_press_event",
G_CALLBACK(activate_appl1), this);
......@@ -1358,46 +1434,35 @@ int OpGtk::configure(char* opplace_str)
}
}
int showRow[5] = {1, 1, 1, 0, 0};
appl_form = gtk_vbox_new(FALSE, 0);
for (i = 0;
i < sizeof(opplace_p->FastAvail) / sizeof(opplace_p->FastAvail[0]);
i++) {
if (i == 0) {
funcbox[0] = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(appl_form), funcbox[0], FALSE, FALSE, 0);
} else if (i == 4) {
funcbox[1] = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(appl_form), funcbox[1], FALSE, FALSE, 0);
} else if (i == 9) {
funcbox[2] = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(appl_form), funcbox[2], FALSE, FALSE, 0);
} else if (i == 14) {
funcbox[3] = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(appl_form), funcbox[3], FALSE, FALSE, 0);
} else if (i == 19) {
funcbox[4] = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(appl_form), funcbox[4], FALSE, FALSE, 0);
}
if (i < 5) {
if (cdh_ObjidIsNotNull(button_aref[i].Objid))
gtk_box_pack_start(GTK_BOX(funcbox[0]), appl_buttons[i], TRUE, TRUE, 0);
} else if (i < 10) {
if (cdh_ObjidIsNotNull(button_aref[i].Objid))
gtk_box_pack_start(GTK_BOX(funcbox[1]), appl_buttons[i], TRUE, TRUE, 0);
} else if (i < 15) {
i < sizeof(opplace_p->FastAvail) / sizeof(opplace_p->FastAvail[0]); i++)
{
// Create new box every 5th row
if (i % 5 == 0)
{
funcbox[i / 5] = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(appl_form), funcbox[i / 5], FALSE, FALSE, 0);
}
// Pack everything and set showRow accordingly
if (cdh_ObjidIsNotNull(button_aref[i].Objid))
gtk_box_pack_start(GTK_BOX(funcbox[2]), appl_buttons[i], TRUE, TRUE, 0);
} else if (i < 20) {
if (cdh_ObjidIsNotNull(button_aref[i].Objid)) {
gtk_box_pack_start(GTK_BOX(funcbox[3]), appl_buttons[i], TRUE, TRUE, 0);
a_height = 4;
{
gtk_box_pack_start(GTK_BOX(funcbox[i / 5]), appl_buttons[i], TRUE, TRUE,
0);
showRow[i / 5] = 1;
}
} else if (i < 25) {
if (cdh_ObjidIsNotNull(button_aref[i].Objid)) {
gtk_box_pack_start(GTK_BOX(funcbox[4]), appl_buttons[i], TRUE, TRUE, 0);
a_height = 5;
}
// Start checking at the last row
for (int row = (sizeof(showRow) / sizeof(showRow[0])) - 1; row >= 0; row--)
{
if (showRow[row])
{
for (int height = a_height - 1; height > row; height--)
activate_aalarm_decr(0, this);
break;
}
}
......@@ -1453,7 +1518,8 @@ void OpGtk::activate_colortheme(GtkWidget* w, gpointer data)
{
OpGtk* op = (OpGtk*)data;
if (op->command_cb) {
if (op->command_cb)
{
op->command_cb(op->parent_ctx, (char*)"open colorthemeselector");
}
}
......@@ -1469,24 +1535,35 @@ void OpGtk::activate_aalarm_incr(GtkWidget* w, gpointer data)
return;
op->a_height++;
height = OP_HEIGHT_MIN + (op->a_height - 2) * OP_HEIGHT_INC
+ ((op->layout_mask & pwr_mOpWindLayoutMask_HideStatusBar) ? 0 : 1)
* OP_HEIGHT_STATUSBAR;
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);
} else if (op->a_height == 4) {
}
else if (op->a_height == 4)
{
g_object_set(op->funcbox[3], "visible", TRUE, NULL);
} else if (op->a_height == 5) {
}
else if (op->a_height == 5)
{
g_object_set(op->funcbox[4], "visible", TRUE, NULL);
}
for (int i = 2; i < 5; i++) {
if (i < op->a_height) {
if (op->a_exist[i]) {
for (int i = 2; i < 5; i++)
{
if (i < op->a_height)
{
if (op->a_exist[i])
{
g_object_set(op->aalarm_box[i], "visible", TRUE, NULL);
if (op->a_active[i]) {
if (op->a_active[i])
{
g_object_set(op->aalarm_active[i], "visible", TRUE, NULL);
} else {
}
else
{
g_object_set(op->aalarm_active[i], "visible", FALSE, NULL);
}
}
......@@ -1506,20 +1583,28 @@ void OpGtk::activate_aalarm_decr(GtkWidget* w, gpointer data)
return;
op->a_height--;
height = OP_HEIGHT_MIN + (op->a_height - 2) * OP_HEIGHT_INC
+ ((op->layout_mask & pwr_mOpWindLayoutMask_HideStatusBar) ? 0 : 1)
* OP_HEIGHT_STATUSBAR;
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);
} else if (op->a_height == 3) {
}
else if (op->a_height == 3)
{
g_object_set(op->funcbox[3], "visible", FALSE, NULL);
} else if (op->a_height == 4) {
}
else if (op->a_height == 4)
{
g_object_set(op->funcbox[4], "visible", FALSE, NULL);
}
for (int i = 2; i < 5; i++) {
if (i >= op->a_height) {
if (op->a_exist[i]) {
for (int i = 2; i < 5; i++)
{
if (i >= op->a_height)
{
if (op->a_exist[i])
{
g_object_set(op->aalarm_box[i], "visible", FALSE, NULL);
g_object_set(op->aalarm_active[i], "visible", FALSE, NULL);
g_object_set(op->aalarm_info[i], "visible", FALSE, NULL);
......@@ -1648,7 +1733,8 @@ void OpGtk::activate_cmd_menu_item(GtkWidget* w, gpointer data)
int sts;
sts = ((OpGtk*)op)->get_cmd(w, cmd);
if (ODD(sts)) {
if (ODD(sts))
{
op->activate_cmd_menu_item(cmd);
}
}
......@@ -1860,8 +1946,10 @@ void OpGtk::activate_info(GtkWidget* w, gpointer data)
int OpGtk::get_cmd(GtkWidget* w, char* cmd)
{
for (unsigned int i = 0; i < cmd_vect.size(); i++) {
if (w == cmd_vect[i].w) {
for (unsigned int i = 0; i < cmd_vect.size(); i++)
{
if (w == cmd_vect[i].w)
{
strcpy(cmd, cmd_vect[i].cmd);
return 1;
}
......@@ -1873,7 +1961,8 @@ void OpGtk::change_sup_color(void* imagew, op_eSupColor color)
{
GdkColor* col;
switch (color) {
switch (color)
{
case op_eSupColor_Gray:
col = &gray_color;
break;
......@@ -1940,129 +2029,155 @@ void OpGtk::set_color_theme(int idx)
GdkColor menu_text;
red_color.pixel = 0;
red_color.red = 0xFFFF
* colors[(glow_eCtColor_RedIndicator - glow_eDrawType_CustomColor1) * 3];
red_color.green = 0xFFFF
* colors[(glow_eCtColor_RedIndicator - glow_eDrawType_CustomColor1) * 3
+ 1];
red_color.blue = 0xFFFF
* colors[(glow_eCtColor_RedIndicator - glow_eDrawType_CustomColor1) * 3
+ 2];
red_color.red =
0xFFFF *
colors[(glow_eCtColor_RedIndicator - glow_eDrawType_CustomColor1) * 3];
red_color.green =
0xFFFF *
colors[(glow_eCtColor_RedIndicator - glow_eDrawType_CustomColor1) * 3 +
1];
red_color.blue =
0xFFFF *
colors[(glow_eCtColor_RedIndicator - glow_eDrawType_CustomColor1) * 3 +
2];
green_color.pixel = 0;
green_color.red = 0xFFFF
* colors[(glow_eCtColor_GreenIndicator - glow_eDrawType_CustomColor1)
* 3];
green_color.green = 0xFFFF
* colors[(glow_eCtColor_GreenIndicator - glow_eDrawType_CustomColor1) * 3
+ 1];
green_color.blue = 0xFFFF
* colors[(glow_eCtColor_GreenIndicator - glow_eDrawType_CustomColor1) * 3
+ 2];
green_color.red =
0xFFFF *
colors[(glow_eCtColor_GreenIndicator - glow_eDrawType_CustomColor1) * 3];
green_color.green =
0xFFFF *
colors[(glow_eCtColor_GreenIndicator - glow_eDrawType_CustomColor1) * 3 +
1];
green_color.blue =
0xFFFF *
colors[(glow_eCtColor_GreenIndicator - glow_eDrawType_CustomColor1) * 3 +
2];
yellow_color.pixel = 0;
yellow_color.red = 0xFFFF
* colors[(glow_eCtColor_YellowIndicator - glow_eDrawType_CustomColor1)
* 3];
yellow_color.green = 0xFFFF
* colors[(glow_eCtColor_YellowIndicator - glow_eDrawType_CustomColor1) * 3
+ 1];
yellow_color.blue = 0xFFFF
* colors[(glow_eCtColor_YellowIndicator - glow_eDrawType_CustomColor1) * 3
+ 2];
yellow_color.red =
0xFFFF *
colors[(glow_eCtColor_YellowIndicator - glow_eDrawType_CustomColor1) * 3];
yellow_color.green =
0xFFFF *
colors[(glow_eCtColor_YellowIndicator - glow_eDrawType_CustomColor1) * 3 +
1];
yellow_color.blue =
0xFFFF *
colors[(glow_eCtColor_YellowIndicator - glow_eDrawType_CustomColor1) * 3 +
2];
gray_color.pixel = 0;
gray_color.red = 0xFFFF
* colors[(glow_eCtColor_IndicatorLowColor - glow_eDrawType_CustomColor1)
* 3];
gray_color.green = 0xFFFF
* colors[(glow_eCtColor_IndicatorLowColor - glow_eDrawType_CustomColor1)
* 3
+ 1];
gray_color.blue = 0xFFFF
* colors[(glow_eCtColor_IndicatorLowColor - glow_eDrawType_CustomColor1)
* 3
+ 2];
gray_color.red =
0xFFFF *
colors[(glow_eCtColor_IndicatorLowColor - glow_eDrawType_CustomColor1) *
3];
gray_color.green =
0xFFFF *
colors[(glow_eCtColor_IndicatorLowColor - glow_eDrawType_CustomColor1) *
3 +
1];
gray_color.blue =
0xFFFF *
colors[(glow_eCtColor_IndicatorLowColor - glow_eDrawType_CustomColor1) *
3 +
2];
bg.pixel = 0;
bg.red = 0xFFFF
* colors[(glow_eCtColor_Background - glow_eDrawType_CustomColor1) * 3];
bg.green = 0xFFFF
* colors[(glow_eCtColor_Background - glow_eDrawType_CustomColor1) * 3
+ 1];
bg.blue = 0xFFFF
* colors[(glow_eCtColor_Background - glow_eDrawType_CustomColor1) * 3
+ 2];
bg.red = 0xFFFF *
colors[(glow_eCtColor_Background - glow_eDrawType_CustomColor1) * 3];
bg.green =
0xFFFF *
colors[(glow_eCtColor_Background - glow_eDrawType_CustomColor1) * 3 + 1];
bg.blue =
0xFFFF *
colors[(glow_eCtColor_Background - glow_eDrawType_CustomColor1) * 3 + 2];
bg_text.pixel = 0;
bg_text.red = 0xFFFF * colors[(glow_eCtColor_BackgroundTextAndLines
- glow_eDrawType_CustomColor1)
* 3];
bg_text.green = 0xFFFF * colors[(glow_eCtColor_BackgroundTextAndLines
- glow_eDrawType_CustomColor1)
* 3
+ 1];
bg_text.blue = 0xFFFF * colors[(glow_eCtColor_BackgroundTextAndLines
- glow_eDrawType_CustomColor1)
* 3
+ 2];
bg_text.red = 0xFFFF * colors[(glow_eCtColor_BackgroundTextAndLines -
glow_eDrawType_CustomColor1) *
3];
bg_text.green = 0xFFFF * colors[(glow_eCtColor_BackgroundTextAndLines -
glow_eDrawType_CustomColor1) *
3 +
1];
bg_text.blue = 0xFFFF * colors[(glow_eCtColor_BackgroundTextAndLines -
glow_eDrawType_CustomColor1) *
3 +
2];
button_bg.pixel = 0;
button_bg.red = 0xFFFF
* colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1)
* 3];
button_bg.green = 0xFFFF
* colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1) * 3
+ 1];
button_bg.blue = 0xFFFF
* colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1) * 3
+ 2];
button_bg.red =
0xFFFF *
colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1) * 3];
button_bg.green =
0xFFFF *
colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1) * 3 +
1];
button_bg.blue =
0xFFFF *
colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1) * 3 +
2];
button_text.pixel = 0;
button_text.red = 0xFFFF
* colors[(glow_eCtColor_ButtonTextcolor - glow_eDrawType_CustomColor1)
* 3];
button_text.green = 0xFFFF
* colors[(glow_eCtColor_ButtonTextcolor - glow_eDrawType_CustomColor1) * 3
+ 1];
button_text.blue = 0xFFFF
* colors[(glow_eCtColor_ButtonTextcolor - glow_eDrawType_CustomColor1) * 3
+ 2];
button_text.red =
0xFFFF *
colors[(glow_eCtColor_ButtonTextcolor - glow_eDrawType_CustomColor1) * 3];
button_text.green =
0xFFFF *
colors[(glow_eCtColor_ButtonTextcolor - glow_eDrawType_CustomColor1) * 3 +
1];
button_text.blue =
0xFFFF *
colors[(glow_eCtColor_ButtonTextcolor - glow_eDrawType_CustomColor1) * 3 +
2];
button_prelight.pixel = 0;
button_prelight.red = 0xFFFF
* colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 3)
* 3];
button_prelight.green = 0xFFFF
* colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 3)
* 3
+ 1];
button_prelight.blue = 0xFFFF
* colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 3)
* 3
+ 2];
button_prelight.red =
0xFFFF *
colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 3) *
3];
button_prelight.green =
0xFFFF *
colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 3) *
3 +
1];
button_prelight.blue =
0xFFFF *
colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 3) *
3 +
2];
button_active.pixel = 0;
button_active.red = 0xFFFF
* colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 2)
* 3];
button_active.green = 0xFFFF
* colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 2)
* 3
+ 1];
button_active.blue = 0xFFFF
* colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 2)
* 3
+ 2];
button_active.red =
0xFFFF *
colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 2) *
3];
button_active.green =
0xFFFF *
colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 2) *
3 +
1];
button_active.blue =
0xFFFF *
colors[(glow_eCtColor_ButtonFillcolor - glow_eDrawType_CustomColor1 + 2) *
3 +
2];
menu.pixel = 0;
menu.red = 0xFFFF
* colors[(glow_eCtColor_MenuFillcolor - glow_eDrawType_CustomColor1) * 3];
menu.green = 0xFFFF
* colors[(glow_eCtColor_MenuFillcolor - glow_eDrawType_CustomColor1) * 3
+ 1];
menu.blue = 0xFFFF
* colors[(glow_eCtColor_MenuFillcolor - glow_eDrawType_CustomColor1) * 3
+ 2];
menu.red =
0xFFFF *
colors[(glow_eCtColor_MenuFillcolor - glow_eDrawType_CustomColor1) * 3];
menu.green =
0xFFFF *
colors[(glow_eCtColor_MenuFillcolor - glow_eDrawType_CustomColor1) * 3 +
1];
menu.blue =
0xFFFF *
colors[(glow_eCtColor_MenuFillcolor - glow_eDrawType_CustomColor1) * 3 +
2];
menu_text.pixel = 0;
menu_text.red = 0xFFFF
* colors[(glow_eCtColor_MenuTextcolor - glow_eDrawType_CustomColor1) * 3];
menu_text.green = 0xFFFF
* colors[(glow_eCtColor_MenuTextcolor - glow_eDrawType_CustomColor1) * 3
+ 1];
menu_text.blue = 0xFFFF
* colors[(glow_eCtColor_MenuTextcolor - glow_eDrawType_CustomColor1) * 3
+ 2];
menu_text.red =
0xFFFF *
colors[(glow_eCtColor_MenuTextcolor - glow_eDrawType_CustomColor1) * 3];
menu_text.green =
0xFFFF *
colors[(glow_eCtColor_MenuTextcolor - glow_eDrawType_CustomColor1) * 3 +
1];
menu_text.blue =
0xFFFF *
colors[(glow_eCtColor_MenuTextcolor - glow_eDrawType_CustomColor1) * 3 +
2];
gtk_widget_modify_bg(toplevel, GTK_STATE_NORMAL, &bg);
gtk_widget_modify_fg(GTK_WIDGET(title_label), GTK_STATE_NORMAL, &bg_text);
......@@ -2078,72 +2193,76 @@ void OpGtk::set_color_theme(int idx)
gtk_widget_modify_fg(GTK_WIDGET(balarm_mark), GTK_STATE_NORMAL, &bg_text);
gtk_widget_modify_bg(GTK_WIDGET(balarm_active_box), GTK_STATE_NORMAL, &bg);
for (int i = 0; i < 5; i++)
gtk_widget_modify_bg(
GTK_WIDGET(aalarm_active_box[i]), GTK_STATE_NORMAL, &bg);
gtk_widget_modify_bg(GTK_WIDGET(aalarm_active_box[i]), GTK_STATE_NORMAL,
&bg);
gtk_widget_modify_bg(GTK_WIDGET(menu_bar), GTK_STATE_NORMAL, &menu);
gtk_widget_modify_bg(GTK_WIDGET(menu_bar), GTK_STATE_ACTIVE, &menu);
GList* children = gtk_container_get_children(GTK_CONTAINER(menu_bar));
GList* child;
for (child = g_list_first(children); child; child = g_list_next(child)) {
for (child = g_list_first(children); child; child = g_list_next(child))
{
gtk_widget_modify_bg(GTK_WIDGET(child->data), GTK_STATE_NORMAL, &menu);
gtk_widget_modify_fg(GTK_WIDGET(child->data), GTK_STATE_NORMAL, &menu_text);
GList* children2 = gtk_container_get_children(GTK_CONTAINER(child->data));
GList* child2;
for (child2 = g_list_first(children2); child2;
child2 = g_list_next(child2)) {
for (child2 = g_list_first(children2); child2; child2 = g_list_next(child2))
{
gtk_widget_modify_bg(GTK_WIDGET(child2->data), GTK_STATE_NORMAL, &menu);
gtk_widget_modify_fg(
GTK_WIDGET(child2->data), GTK_STATE_NORMAL, &menu_text);
gtk_widget_modify_fg(GTK_WIDGET(child2->data), GTK_STATE_NORMAL,
&menu_text);
}
g_list_free(children2);
}
g_list_free(children);
for (unsigned int i = 0; i < sup_vect.size(); i++) {
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].buttonw), GTK_STATE_NORMAL, &button_bg);
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].buttonw), GTK_STATE_PRELIGHT, &button_prelight);
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].buttonw), GTK_STATE_ACTIVE, &button_active);
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].indfiller1w), GTK_STATE_NORMAL, &button_bg);
for (unsigned int i = 0; i < sup_vect.size(); i++)
{
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].buttonw), GTK_STATE_NORMAL,
&button_bg);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].buttonw), GTK_STATE_PRELIGHT,
&button_prelight);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].buttonw), GTK_STATE_ACTIVE,
&button_active);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].indfiller1w), GTK_STATE_NORMAL,
&button_bg);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].indfiller1w),
GTK_STATE_PRELIGHT, &button_prelight);
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].indfiller1w), GTK_STATE_ACTIVE, &button_active);
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].indfiller2w), GTK_STATE_NORMAL, &button_bg);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].indfiller1w), GTK_STATE_ACTIVE,
&button_active);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].indfiller2w), GTK_STATE_NORMAL,
&button_bg);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].indfiller2w),
GTK_STATE_PRELIGHT, &button_prelight);
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].indfiller2w), GTK_STATE_ACTIVE, &button_active);
gtk_widget_modify_fg(
GTK_WIDGET(sup_vect[i].textw), GTK_STATE_NORMAL, &button_text);
gtk_widget_modify_fg(
GTK_WIDGET(sup_vect[i].textw), GTK_STATE_PRELIGHT, &button_text);
gtk_widget_modify_fg(
GTK_WIDGET(sup_vect[i].textw), GTK_STATE_ACTIVE, &button_text);
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].textbgw), GTK_STATE_NORMAL, &button_bg);
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].textbgw), GTK_STATE_PRELIGHT, &button_prelight);
gtk_widget_modify_bg(
GTK_WIDGET(sup_vect[i].textbgw), GTK_STATE_ACTIVE, &button_active);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].indfiller2w), GTK_STATE_ACTIVE,
&button_active);
gtk_widget_modify_fg(GTK_WIDGET(sup_vect[i].textw), GTK_STATE_NORMAL,
&button_text);
gtk_widget_modify_fg(GTK_WIDGET(sup_vect[i].textw), GTK_STATE_PRELIGHT,
&button_text);
gtk_widget_modify_fg(GTK_WIDGET(sup_vect[i].textw), GTK_STATE_ACTIVE,
&button_text);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].textbgw), GTK_STATE_NORMAL,
&button_bg);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].textbgw), GTK_STATE_PRELIGHT,
&button_prelight);
gtk_widget_modify_bg(GTK_WIDGET(sup_vect[i].textbgw), GTK_STATE_ACTIVE,
&button_active);
sup_vect[i].old_color = op_eSupColor_;
}
for (unsigned int i = 0; i < 25; i++) {
if (appl_buttons[i]) {
gtk_widget_modify_bg(
GTK_WIDGET(appl_buttons[i]), GTK_STATE_NORMAL, &button_bg);
gtk_widget_modify_bg(
GTK_WIDGET(appl_buttons[i]), GTK_STATE_PRELIGHT, &button_prelight);
gtk_widget_modify_bg(
GTK_WIDGET(appl_buttons[i]), GTK_STATE_ACTIVE, &button_active);
for (unsigned int i = 0; i < 25; i++)
{
if (appl_buttons[i])
{
gtk_widget_modify_bg(GTK_WIDGET(appl_buttons[i]), GTK_STATE_NORMAL,
&button_bg);
gtk_widget_modify_bg(GTK_WIDGET(appl_buttons[i]), GTK_STATE_PRELIGHT,
&button_prelight);
gtk_widget_modify_bg(GTK_WIDGET(appl_buttons[i]), GTK_STATE_ACTIVE,
&button_active);
gtk_widget_modify_fg(
GTK_WIDGET(gtk_bin_get_child(GTK_BIN(appl_buttons[i]))),
GTK_STATE_NORMAL, &button_text);
......@@ -2165,12 +2284,14 @@ void OpGtk::set_text_size()
char str[80];
char bold_str[10] = "";
sprintf(
str, "%s %s%f", "Lucida Sans", bold_str, FONT_SCALE * (text_size + 2));
sprintf(str, "%s %s%f", "Lucida Sans", bold_str,
FONT_SCALE * (text_size + 2));
fd = pango_font_description_from_string(str);
for (unsigned int i = 0; i < 25; i++) {
if (appl_buttons[i]) {
for (unsigned int i = 0; i < 25; i++)
{
if (appl_buttons[i])
{
gtk_widget_modify_font(
GTK_WIDGET(gtk_bin_get_child(GTK_BIN(appl_buttons[i]))), fd);
}
......
......@@ -93,6 +93,7 @@ public:
GdkColor green_color;
GdkColor gray_color;
GdkColor white_color;
GdkRectangle monitor_geometry;
int a_height;
int a_exist[5];
int a_active[5];
......
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