Commit 1b641e47 authored by Claes Sjöfors's avatar Claes Sjöfors

Xtt eventlist satellite implemented

parent 07453054
......@@ -57,6 +57,7 @@
#include "xtt_methodtoolbar_gtk.h"
#include "rt_xnav_msg.h"
#include "xtt_evala_gtk.h"
#include "xtt_eveve_gtk.h"
static gint eve_delete_event( GtkWidget *w, GdkEvent *event, gpointer data)
{
......@@ -861,6 +862,32 @@ EvAla *EvGtk::open_alarmlist_satellite( const char *title, pwr_tStatus *sts,
return sala[sala_cnt-1];
}
EvEve *EvGtk::open_eventlist_satellite( const char *title, pwr_tStatus *sts,
int width, int height, int x, int y, pwr_tObjid view,
unsigned int options, void *widget)
{
if ( seve_cnt >= (int)(sizeof(seve)/sizeof(seve[0])))
return 0;
seve[seve_cnt++] = new EvEveGtk( this, parent_wid, (char *)title, user, eventname_seg,
width, height, x, y, view, options, widget, sts);
if ( EVEN(*sts)) return 0;
seve[seve_cnt-1]->start_trace_cb = eve_start_trace_cb;
seve[seve_cnt-1]->display_in_xnav_cb = eve_display_in_xnav_cb;
seve[seve_cnt-1]->help_cb = ala_help_cb;
seve[seve_cnt-1]->popup_menu_cb = ev_popup_menu_cb;
seve[seve_cnt-1]->sound_cb = ev_sound_cb;
seve[seve_cnt-1]->is_authorized_cb = ala_is_authorized_cb;
seve[seve_cnt-1]->acknowledge_cb = seve_acknowledge_cb;
seve[seve_cnt-1]->name_to_alias_cb = ev_name_to_alias_cb;
seve[seve_cnt-1]->copy_list_cb = seve_copy_list_cb;
seve[seve_cnt-1]->close_cb = seve_close_cb;
seve[seve_cnt-1]->init();
return seve[seve_cnt-1];
}
//
// Delete ev
//
......
......@@ -88,6 +88,9 @@ class EvGtk : public Ev {
EvAla *open_alarmlist_satellite( const char *title, pwr_tStatus *sts,
int width, int height, int x, int y, pwr_tObjid view,
unsigned int options = 0, void *widget = 0);
EvEve *open_eventlist_satellite( const char *title, pwr_tStatus *sts,
int width, int height, int x, int y, pwr_tObjid view,
unsigned int options = 0, void *widget = 0);
static gboolean eve_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static gboolean ala_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* xtt_ev_gtk.cpp -- Alarm and event window in xtt */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
#include "cow_wow_gtk.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "rt_mh.h"
#include "rt_mh_outunit.h"
#include "rt_mh_util.h"
#include "co_lng.h"
#include "xtt_evlist_gtk.h"
#include "xtt_eveve_gtk.h"
#include "xtt_ev.h"
#include "xtt_methodtoolbar_gtk.h"
#include "rt_xnav_msg.h"
static gint eve_delete_event( GtkWidget *w, GdkEvent *event, gpointer data)
{
EvEveGtk::eve_activate_exit( w, data);
return TRUE;
}
static void eve_destroy_event( GtkWidget *w, gpointer data)
{
}
EvEveGtk::EvEveGtk( void *ev_parent_ctx,
GtkWidget *ev_parent_wid,
char *eve_name,
pwr_tObjid ev_user,
int ev_eventname_seg,
int ev_width,
int ev_height,
int ev_x,
int ev_y,
pwr_tObjid ev_view,
unsigned int ev_options,
void *widget,
pwr_tStatus *status) :
EvEve( ev_parent_ctx, eve_name, ev_user, ev_eventname_seg,
ev_width, ev_height, ev_x, ev_y, ev_view, ev_options, status),
parent_wid(ev_parent_wid), toplevel(0)
{
pwr_tStatus sts;
pwr_sClass_OpPlace *opp;
pwr_tFileName fname;
int eve_width = 700;
int eve_height = 300;
*status = 1;
if ( ev_width != 0 && ev_height != 0) {
eve_width = ev_width;
eve_height = ev_height;
}
// Check user object
if ( cdh_ObjidIsNull( user)) {
*status = XNAV__NOUSER;
return;
}
sts = gdh_ObjidToPointer( user, (pwr_tAddress *) &opp);
if ( EVEN(sts)) {
*status = XNAV__NOUSER;
return;
}
eve_size = opp->MaxNoOfAlarms;
// create_aliaslist( opp);
// Ala Window
if ( !(options & ev_mAlaOptions_Embedded)) {
toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", eve_height,
"default-width", eve_width,
"title", CoWowGtk::translate_utf8(eve_name),
NULL);
parent_wid_ala = toplevel;
g_signal_connect( parent_wid_ala, "delete_event", G_CALLBACK(eve_delete_event), this);
g_signal_connect( parent_wid_ala, "destroy", G_CALLBACK(eve_destroy_event), this);
g_signal_connect( parent_wid_ala, "focus-in-event", G_CALLBACK(eve_action_inputfocus), this);
CoWowGtk::SetWindowIcon( parent_wid_ala);
}
else
parent_wid_ala = (GtkWidget *)widget;
eve_vbox = gtk_vbox_new( FALSE, 0);
// Menu
// Accelerators
GtkAccelGroup *accel_g = (GtkAccelGroup *) g_object_new(GTK_TYPE_ACCEL_GROUP, NULL);
gtk_window_add_accel_group(GTK_WINDOW(parent_wid_ala), accel_g);
GtkMenuBar *menu_bar = (GtkMenuBar *) g_object_new(GTK_TYPE_MENU_BAR, NULL);
// File entry
GtkWidget *file_print = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Print"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(file_print),
gtk_image_new_from_stock( "gtk-print", GTK_ICON_SIZE_MENU));
g_signal_connect(file_print, "activate", G_CALLBACK(eve_activate_print), this);
GtkWidget *file_close = gtk_image_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Close"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(file_close),
gtk_image_new_from_stock( "gtk-close", GTK_ICON_SIZE_MENU));
g_signal_connect(file_close, "activate", G_CALLBACK(eve_activate_exit), this);
gtk_widget_add_accelerator( file_close, "activate", accel_g,
'w', GdkModifierType(GDK_CONTROL_MASK), GTK_ACCEL_VISIBLE);
GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
GtkWidget *file = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_File"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), GTK_WIDGET(file_menu));
GtkWidget *functions_open_plc = gtk_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("Open _Program"));
g_signal_connect( functions_open_plc, "activate",
G_CALLBACK(eve_activate_open_plc), this);
gtk_widget_add_accelerator( functions_open_plc, "activate", accel_g,
'l', GdkModifierType(GDK_CONTROL_MASK),
GTK_ACCEL_VISIBLE);
GtkWidget *functions_display_object = gtk_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Display object in Navigator"));
g_signal_connect( functions_display_object, "activate",
G_CALLBACK(eve_activate_display_in_xnav), this);
gtk_widget_add_accelerator( functions_display_object, "activate", accel_g,
'd', GdkModifierType(GDK_CONTROL_MASK),
GTK_ACCEL_VISIBLE);
GtkMenu *func_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(func_menu), functions_open_plc);
gtk_menu_shell_append(GTK_MENU_SHELL(func_menu), functions_display_object);
GtkWidget *functions = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Functions"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), functions);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions), GTK_WIDGET(func_menu));
// View entry
GtkWidget *view_shift_view = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("S_hift View"));
g_signal_connect( view_shift_view, "activate",
G_CALLBACK(eve_activate_shift_view), this);
gtk_widget_add_accelerator( view_shift_view, "activate", accel_g,
'n', GdkModifierType(GDK_CONTROL_MASK),
GTK_ACCEL_VISIBLE);
GtkWidget *view_zoom_in = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Zoom _In"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(view_zoom_in),
gtk_image_new_from_stock( "gtk-zoom-in", GTK_ICON_SIZE_MENU));
g_signal_connect( view_zoom_in, "activate",
G_CALLBACK(eve_activate_zoom_in), this);
gtk_widget_add_accelerator( view_zoom_in, "activate", accel_g,
'i', GdkModifierType(GDK_CONTROL_MASK),
GTK_ACCEL_VISIBLE);
GtkWidget *view_zoom_out = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Zoom _Out"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(view_zoom_out),
gtk_image_new_from_stock( "gtk-zoom-out", GTK_ICON_SIZE_MENU));
g_signal_connect( view_zoom_out, "activate",
G_CALLBACK(eve_activate_zoom_out), this);
gtk_widget_add_accelerator( view_zoom_out, "activate", accel_g,
'o', GdkModifierType(GDK_CONTROL_MASK),
GTK_ACCEL_VISIBLE);
GtkWidget *view_zoom_reset = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Zoom _Reset"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(view_zoom_reset),
gtk_image_new_from_stock( "gtk-zoom-100", GTK_ICON_SIZE_MENU));
g_signal_connect( view_zoom_reset, "activate",
G_CALLBACK(eve_activate_zoom_reset), this);
gtk_widget_add_accelerator( view_zoom_reset, "activate", accel_g,
'b', GdkModifierType(GDK_CONTROL_MASK),
GTK_ACCEL_VISIBLE);
GtkWidget *view_disp_hundredth = gtk_check_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Display hundredth"));
g_signal_connect( view_disp_hundredth, "activate",
G_CALLBACK(eve_activate_disp_hundredth), this);
GtkWidget *view_hide_object = gtk_check_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Hide Event Name"));
g_signal_connect( view_hide_object, "activate",
G_CALLBACK(eve_activate_hide_object), this);
GtkWidget *view_hide_text = gtk_check_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("Hide _Event Text"));
g_signal_connect( view_hide_text, "activate",
G_CALLBACK(eve_activate_hide_text), this);
// Submenu Select View
GtkWidget *view_select_flat = gtk_menu_item_new_with_mnemonic( "_Flat");
g_signal_connect( view_select_flat, "activate",
G_CALLBACK(eve_activate_select_flat), this);
GtkWidget *view_select = gtk_menu_item_new_with_mnemonic( "_Select View");
GtkMenu *view_select_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(view_select_menu), view_select_flat);
for ( unsigned int i = 0; i < sizeof(opp->AlarmViews)/sizeof(opp->AlarmViews[0]); i++) {
pwr_sClass_AlarmView *viewp;
if ( cdh_ObjidIsNull( opp->AlarmViews[i]))
break;
sts = gdh_ObjidToPointer( opp->AlarmViews[i], (void **)&viewp);
if ( ODD(sts)) {
alarm_views[i] = opp->AlarmViews[i];
GtkWidget *view_select_view = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8(viewp->Name));
switch ( i) {
case 0: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view1), this); break;
case 1: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view2), this); break;
case 2: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view3), this); break;
case 3: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view4), this); break;
case 4: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view5), this); break;
case 5: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view6), this); break;
case 6: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view7), this); break;
case 7: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view8), this); break;
case 8: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view9), this); break;
case 9: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view10), this); break;
case 10: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view11), this); break;
case 11: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view12), this); break;
case 12: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view13), this); break;
case 13: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view14), this); break;
case 14: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view15), this); break;
case 15: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view16), this); break;
case 16: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view17), this); break;
case 17: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view18), this); break;
case 18: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view19), this); break;
case 19: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view20), this); break;
case 20: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view21), this); break;
case 21: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view22), this); break;
case 22: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view23), this); break;
case 23: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view24), this); break;
case 24: g_signal_connect( view_select_view, "activate", G_CALLBACK(eve_activate_select_view25), this); break;
}
gtk_menu_shell_append(GTK_MENU_SHELL(view_select_menu), view_select_view);
}
}
gtk_menu_item_set_submenu(GTK_MENU_ITEM(view_select),
GTK_WIDGET(view_select_menu));
GtkMenu *view_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_shift_view);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_select);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_in);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_out);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_reset);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_disp_hundredth);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_hide_object);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_hide_text);
GtkWidget *view = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_View"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), view);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(view), GTK_WIDGET(view_menu));
// Help entry
GtkWidget *help_help = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Help"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(help_help),
gtk_image_new_from_stock( "gtk-help", GTK_ICON_SIZE_MENU));
g_signal_connect(help_help, "activate", G_CALLBACK(eve_activate_help), this);
gtk_widget_add_accelerator( help_help, "activate", accel_g,
'h', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
GtkWidget *help_helpevent = gtk_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("Help Selected Event"));
g_signal_connect( help_helpevent, "activate",
G_CALLBACK(eve_activate_helpevent), this);
GtkMenu *help_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(help_menu), help_help);
gtk_menu_shell_append(GTK_MENU_SHELL(help_menu), help_helpevent);
GtkWidget *help = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Help"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu));
// Create ala evlist
ala = new EvListGtk( this, eve_vbox, ev_eType_EventList, eve_size, eventname_seg,
&eve_widget, eve_init_cb);
ala->start_trace_cb = &eve_start_trace_cb;
ala->display_in_xnav_cb =&eve_display_in_xnav_cb;
ala->name_to_alias_cb = &eve_name_to_alias_cb;
ala->popup_menu_cb = &eve_popup_menu_cb;
ala->sound_cb = &eve_sound_cb;
ala->help_event_cb = &help_event_cb;
ala->selection_changed_cb = &eve_selection_changed_cb;
// Toolbar
GtkToolbar *tools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL);
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(eve_activate_zoom_in), this);
g_object_set( tools_zoom_in, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_zoom_in,CoWowGtk::translate_utf8("Zoom in"), "");
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(eve_activate_zoom_out), this);
g_object_set( tools_zoom_out, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_zoom_out,CoWowGtk::translate_utf8("Zoom out"), "");
GtkWidget *tools_zoom_reset = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_zoom_reset.png");
gtk_container_add( GTK_CONTAINER(tools_zoom_reset),
gtk_image_new_from_file( fname));
g_signal_connect(tools_zoom_reset, "clicked", G_CALLBACK(eve_activate_zoom_reset), this);
g_object_set( tools_zoom_reset, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_zoom_reset,CoWowGtk::translate_utf8("Zoom reset"), "");
eve_methodtoolbar = new XttMethodToolbarGtk(0, 0, ~0, "");
GtkToolbar *tools_meth = (GtkToolbar *) ((XttMethodToolbarGtk *)eve_methodtoolbar)->build();
eve_methodtoolbar->m_xnav = (XNav *)((Ev *)parent_ctx)->parent_ctx;
eve_methodtoolbar->m_parent_ctx = ala;
eve_methodtoolbar->get_select_cb = ala->get_select;
eve_sup_methodtoolbar = new XttMethodToolbarGtk(0, 0, mt_mMethod_OpenPlc | mt_mMethod_RtNavigator,
" for supervisory object");
GtkToolbar *tools_sup = (GtkToolbar *) ((XttMethodToolbarGtk *)eve_sup_methodtoolbar)->build();
eve_sup_methodtoolbar->m_xnav = (XNav *)((Ev *)parent_ctx)->parent_ctx;
eve_sup_methodtoolbar->m_parent_ctx = ala;
eve_sup_methodtoolbar->get_select_cb = ala->get_select_supobject;
GtkWidget *eve_toolsbox = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(eve_toolsbox), GTK_WIDGET(tools), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(eve_toolsbox), GTK_WIDGET(gtk_separator_tool_item_new()), FALSE, FALSE, 4);
gtk_box_pack_start( GTK_BOX(eve_toolsbox), GTK_WIDGET(tools_sup), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(eve_toolsbox), GTK_WIDGET(gtk_separator_tool_item_new()), FALSE, FALSE, 4);
gtk_box_pack_start( GTK_BOX(eve_toolsbox), GTK_WIDGET(tools_meth), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(eve_vbox), GTK_WIDGET(menu_bar), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(eve_vbox), GTK_WIDGET(eve_toolsbox), FALSE, FALSE, 0);
gtk_box_pack_end( GTK_BOX(eve_vbox), GTK_WIDGET(eve_widget), TRUE, TRUE, 0);
if ( !(options & ev_mAlaOptions_Embedded)) {
gtk_container_add( GTK_CONTAINER(parent_wid_ala), eve_vbox);
}
// gtk_widget_show_all( parent_wid_ala);
eve_methodtoolbar->set_sensitive();
eve_sup_methodtoolbar->set_sensitive();
// }
if ( !(options & ev_mAlaOptions_Embedded)) {
gtk_widget_show_all( parent_wid_ala);
if ( !(x == 0 && y == 0)) {
// Set position
gtk_window_move( GTK_WINDOW(parent_wid_ala), x, y);
}
}
else
gtk_widget_set_size_request( eve_vbox, eve_width, eve_height);
eve_displayed = 1;
wow = new CoWowGtk( parent_wid_ala);
*status = 1;
}
//
// Delete ev
//
EvEveGtk::~EvEveGtk()
{
if ( ala)
delete ala;
ala = NULL;
delete eve_methodtoolbar;
delete eve_sup_methodtoolbar;
if ( toplevel)
gtk_widget_destroy( toplevel);
}
void EvEveGtk::map_ala()
{
gtk_window_present( GTK_WINDOW(parent_wid_ala));
eve_displayed = 1;
}
void EvEveGtk::unmap_ala()
{
if ( eve_displayed) {
g_object_set( parent_wid_ala, "visible", FALSE, NULL);
eve_displayed = 0;
}
}
void EvEveGtk::set_title_ala( char *title)
{
if ( !(options & ev_mAlaOptions_Embedded))
g_object_set( parent_wid_ala, "title", title, NULL);
}
gboolean EvEveGtk::eve_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data)
{
EvEve *ev = (EvEve *)data;
if ( ev && ev->eve_displayed)
ev->ala->set_input_focus();
return FALSE;
}
void EvEveGtk::eve_activate_exit( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
// ev->unmap_ala();
// ev->eve_displayed = 0;
delete ev;
}
void EvEveGtk::eve_activate_print( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->eve_activate_print();
}
void EvEveGtk::eve_activate_shift_view( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->view_shift();
}
void EvEveGtk::eve_activate_select_flat( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->set_view(pwr_cNObjid);
}
void EvEveGtk::eve_activate_select_view1( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[0]);}
void EvEveGtk::eve_activate_select_view2( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[1]);}
void EvEveGtk::eve_activate_select_view3( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[2]);}
void EvEveGtk::eve_activate_select_view4( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[3]);}
void EvEveGtk::eve_activate_select_view5( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[4]);}
void EvEveGtk::eve_activate_select_view6( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[5]);}
void EvEveGtk::eve_activate_select_view7( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[6]);}
void EvEveGtk::eve_activate_select_view8( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[7]);}
void EvEveGtk::eve_activate_select_view9( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[8]);}
void EvEveGtk::eve_activate_select_view10( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[9]);}
void EvEveGtk::eve_activate_select_view11( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[10]);}
void EvEveGtk::eve_activate_select_view12( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[11]);}
void EvEveGtk::eve_activate_select_view13( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[12]);}
void EvEveGtk::eve_activate_select_view14( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[13]);}
void EvEveGtk::eve_activate_select_view15( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[14]);}
void EvEveGtk::eve_activate_select_view16( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[15]);}
void EvEveGtk::eve_activate_select_view17( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[16]);}
void EvEveGtk::eve_activate_select_view18( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[17]);}
void EvEveGtk::eve_activate_select_view19( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[18]);}
void EvEveGtk::eve_activate_select_view20( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[19]);}
void EvEveGtk::eve_activate_select_view21( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[20]);}
void EvEveGtk::eve_activate_select_view22( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[21]);}
void EvEveGtk::eve_activate_select_view23( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[22]);}
void EvEveGtk::eve_activate_select_view24( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[23]);}
void EvEveGtk::eve_activate_select_view25( GtkWidget *w, gpointer ev) { ((EvEve *)ev)->set_view(((EvEveGtk *)ev)->alarm_views[24]);}
void EvEveGtk::eve_activate_zoom_in( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->ala->zoom( 1.2);
}
void EvEveGtk::eve_activate_zoom_out( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->ala->zoom( 5.0/6);
}
void EvEveGtk::eve_activate_zoom_reset( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->ala->unzoom();
}
void EvEveGtk::eve_activate_open_plc( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->ala->start_trace();
}
void EvEveGtk::eve_activate_display_in_xnav( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->ala->display_in_xnav();
}
void EvEveGtk::eve_activate_disp_hundredth( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
int set = (int) gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(w));
ev->ala->set_display_hundredth( set);
}
void EvEveGtk::eve_activate_hide_object( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
int set = (int) gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(w));
ev->ala->set_hide_object( set);
}
void EvEveGtk::eve_activate_hide_text( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
int set = (int) gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(w));
ev->ala->set_hide_text( set);
}
void EvEveGtk::eve_activate_help( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->eve_activate_help();
}
void EvEveGtk::eve_activate_helpevent( GtkWidget *w, gpointer data)
{
EvEve *ev = (EvEve *)data;
ev->eve_activate_helpevent();
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef xtt_eveve_gtk_h
#define xtt_eveve_gtk_h
/* xtt_eveve_gtk.h -- Alarm window in xtt */
#ifndef xtt_eveve_h
# include "xtt_eveve.h"
#endif
class EvEveGtk : public EvEve {
public:
EvEveGtk(
void *ev_parent_ctx,
GtkWidget *ev_parent_wid,
char *eve_name,
pwr_tObjid ev_user,
int ev_eventname_seg,
int ev_width,
int ev_height,
int ev_x,
int ev_y,
pwr_tObjid ev_view,
unsigned int ev_options,
void *widget,
pwr_tStatus *status);
~EvEveGtk();
GtkWidget *parent_wid;
GtkWidget *parent_wid_ala;
GtkWidget *toplevel;
GtkWidget *eve_widget;
GtkWidget *eve_vbox;
pwr_tObjid alarm_views[25];
void map_ala();
void unmap_ala();
void set_title_ala( char *title);
GtkWidget *get_widget() { return eve_vbox;}
static gboolean eve_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void eve_activate_exit( GtkWidget *w, gpointer data);
static void eve_activate_print( GtkWidget *w, gpointer data);
static void eve_activate_zoom_in( GtkWidget *w, gpointer data);
static void eve_activate_zoom_out( GtkWidget *w, gpointer data);
static void eve_activate_zoom_reset( GtkWidget *w, gpointer data);
static void eve_activate_open_plc( GtkWidget *w, gpointer data);
static void eve_activate_display_in_xnav( GtkWidget *w, gpointer data);
static void eve_activate_disp_hundredth( GtkWidget *w, gpointer data);
static void eve_activate_hide_object( GtkWidget *w, gpointer data);
static void eve_activate_hide_text( GtkWidget *w, gpointer data);
static void eve_activate_help( GtkWidget *w, gpointer data);
static void eve_activate_helpevent( GtkWidget *w, gpointer data);
static void eve_activate_shift_view( GtkWidget *w, gpointer data);
static void eve_activate_select_flat( GtkWidget *w, gpointer data);
static void eve_activate_select_view1( GtkWidget *w, gpointer data);
static void eve_activate_select_view2( GtkWidget *w, gpointer data);
static void eve_activate_select_view3( GtkWidget *w, gpointer data);
static void eve_activate_select_view4( GtkWidget *w, gpointer data);
static void eve_activate_select_view5( GtkWidget *w, gpointer data);
static void eve_activate_select_view6( GtkWidget *w, gpointer data);
static void eve_activate_select_view7( GtkWidget *w, gpointer data);
static void eve_activate_select_view8( GtkWidget *w, gpointer data);
static void eve_activate_select_view9( GtkWidget *w, gpointer data);
static void eve_activate_select_view10( GtkWidget *w, gpointer data);
static void eve_activate_select_view11( GtkWidget *w, gpointer data);
static void eve_activate_select_view12( GtkWidget *w, gpointer data);
static void eve_activate_select_view13( GtkWidget *w, gpointer data);
static void eve_activate_select_view14( GtkWidget *w, gpointer data);
static void eve_activate_select_view15( GtkWidget *w, gpointer data);
static void eve_activate_select_view16( GtkWidget *w, gpointer data);
static void eve_activate_select_view17( GtkWidget *w, gpointer data);
static void eve_activate_select_view18( GtkWidget *w, gpointer data);
static void eve_activate_select_view19( GtkWidget *w, gpointer data);
static void eve_activate_select_view20( GtkWidget *w, gpointer data);
static void eve_activate_select_view21( GtkWidget *w, gpointer data);
static void eve_activate_select_view22( GtkWidget *w, gpointer data);
static void eve_activate_select_view23( GtkWidget *w, gpointer data);
static void eve_activate_select_view24( GtkWidget *w, gpointer data);
static void eve_activate_select_view25( GtkWidget *w, gpointer data);
};
#endif
......@@ -58,10 +58,11 @@ typedef void *Widget;
#include "xtt_ge_gtk.h"
#include "xtt_trend_gtk.h"
#include "xtt_sevhist_gtk.h"
#include "xtt_multiview_gtk.h"
#include "ge_graph_gtk.h"
#include "xtt_ev_gtk.h"
#include "xtt_evala_gtk.h"
#include "xtt_eveve_gtk.h"
#include "xtt_multiview_gtk.h"
#include "xtt_log.h"
#include "pwr_baseclasses.h"
#include "rt_xnav_msg.h"
......@@ -125,6 +126,10 @@ XttMultiViewGtk::~XttMultiViewGtk()
if ( sala[i])
delete sala[i];
}
for ( unsigned int i = 0; i < MV_SIZE; i++) {
if ( seve[i])
delete seve[i];
}
for ( unsigned int i = 0; i < MV_SIZE; i++) {
if ( gectx[i])
delete gectx[i];
......@@ -185,6 +190,7 @@ XttMultiViewGtk::XttMultiViewGtk( GtkWidget *mv_parent_wid, void *mv_parent_ctx,
memset( gectx, 0, sizeof(gectx));
memset( mvctx, 0, sizeof(mvctx));
memset( sala, 0, sizeof(sala));
memset( seve, 0, sizeof(seve));
memset( trend, 0, sizeof(trend));
memset( sevhist, 0, sizeof(sevhist));
memset( comp_widget, 0, sizeof(comp_widget));
......@@ -267,6 +273,17 @@ XttMultiViewGtk::XttMultiViewGtk( GtkWidget *mv_parent_wid, void *mv_parent_ctx,
}
break;
}
case pwr_eMultiViewContentEnum_EventList: {
if ( xnav->ev) {
seve[i*rows + j] = (EvEveGtk *)xnav->ev->open_eventlist_satellite( "No title",
&lsts, w, h, 0, 0, mv.Action[i*rows+j].Object.Objid, ev_mAlaOptions_Embedded, toplevel);
if ( !seve[i*rows + j])
continue;
comp_widget[i*rows + j] = seve[i*rows + j]->get_widget();
gtk_box_pack_start( GTK_BOX(row_widget), GTK_WIDGET(comp_widget[i*rows + j]), TRUE, TRUE, 0);
}
break;
}
case pwr_eMultiViewContentEnum_Graph:
case pwr_eMultiViewContentEnum_ObjectGraph: {
char *objectname_p = 0;
......
......@@ -48,6 +48,7 @@
# include "xtt_evala_gtk.h"
#endif
class EvEveGtk;
class XttTrendGtk;
class XttSevHistGtk;
......@@ -61,6 +62,7 @@ class XttMultiViewGtk : public XttMultiView {
XttGeGtk *gectx[MV_SIZE];
XttMultiViewGtk *mvctx[MV_SIZE];
EvAlaGtk *sala[MV_SIZE];
EvEveGtk *seve[MV_SIZE];
XttTrendGtk *trend[MV_SIZE];
XttSevHistGtk *sevhist[MV_SIZE];
CoWowFocusTimerGtk focustimer;
......
......@@ -81,7 +81,7 @@ Ev::Ev( void *ev_parent_ctx,
start_trace_cb(NULL), display_in_xnav_cb(NULL), update_info_cb(NULL),
help_cb(NULL), popup_menu_cb(0), sound_cb(0), pop_cb(0), is_authorized_cb(0), eve(NULL), ala(NULL),
blk(0), connected(0), ala_displayed(0), eve_displayed(0), beep(ev_beep), pop_mask(ev_pop_mask),
eventname_seg(ev_eventname_seg), sala_cnt(0)
eventname_seg(ev_eventname_seg), sala_cnt(0), seve_cnt(0)
{
}
......@@ -185,6 +185,8 @@ int Ev::sala_acknowledge_cb( void *ctx, mh_sEventId *id)
ev->eve->ack( id);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->ack( id);
for ( int i = 0; i < ev->seve_cnt; i++)
ev->seve[i]->ack( id);
mh_OutunitAck( &lid);
return 1;
}
......@@ -211,6 +213,43 @@ void Ev::sala_close_cb( void *ctx, EvAla *sala)
ev->sala_cnt--;
}
int Ev::seve_acknowledge_cb( void *ctx, mh_sEventId *id)
{
Ev *ev = (Ev *)ctx;
mh_sEventId lid = *id;
ev->ala->ack( id);
ev->eve->ack( id);
for ( int i = 0; i < ev->seve_cnt; i++)
ev->seve[i]->ack( id);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->ack( id);
mh_OutunitAck( &lid);
return 1;
}
void Ev::seve_copy_list_cb( void *ctx, EvList *evl)
{
Ev *ev = (Ev *)ctx;
ev->eve->copy_list( evl);
}
void Ev::seve_close_cb( void *ctx, EvEve *seve)
{
Ev *ev = (Ev *)ctx;
bool found = false;
for ( int i = 0; i < ev->seve_cnt; i++) {
if ( ev->seve[i] == seve)
found = true;
if ( found && i != ev->seve_cnt - 1)
ev->seve[i] = ev->seve[i+1];
}
if ( found)
ev->seve_cnt--;
}
void Ev::help_event_cb( void *ctx, void *item)
{
ItemAlarm *aitem = (ItemAlarm *)item;
......@@ -264,6 +303,8 @@ void Ev::eve_activate_ack_last()
eve->ack( id);
for ( int i = 0; i < sala_cnt; i++)
sala[i]->ack( id);
for ( int i = 0; i < seve_cnt; i++)
seve[i]->ack( id);
mh_OutunitAck( &lid);
}
......@@ -302,6 +343,8 @@ void Ev::ala_activate_ack_last()
eve->ack( id);
for ( int i = 0; i < sala_cnt; i++)
sala[i]->ack( id);
for ( int i = 0; i < seve_cnt; i++)
seve[i]->ack( id);
mh_OutunitAck( &lid);
}
......@@ -436,6 +479,8 @@ void Ev::ack_last_prio( unsigned long type, unsigned long prio)
eve->ack( id);
for ( int i = 0; i < sala_cnt; i++)
sala[i]->ack( id);
for ( int i = 0; i < seve_cnt; i++)
seve[i]->ack( id);
mh_OutunitAck( &lid);
}
}
......@@ -455,6 +500,8 @@ void Ev::ack_all()
eve->ack( id);
for ( int i = 0; i < sala_cnt; i++)
sala[i]->ack( id);
for ( int i = 0; i < seve_cnt; i++)
seve[i]->ack( id);
mh_OutunitAck( &lid);
sts = ala->get_last_not_acked( &id);
......@@ -534,6 +581,8 @@ pwr_tStatus Ev::mh_ack_bc( mh_sAck *MsgP)
{
// Insert in eve
ev->eve->event_ack( MsgP);
for ( int i = 0; i < ev->seve_cnt; i++)
ev->seve[i]->mh_ack( MsgP);
}
ev->ala->event_ack( MsgP);
for ( int i = 0; i < ev->sala_cnt; i++)
......@@ -550,6 +599,8 @@ pwr_tStatus Ev::mh_return_bc( mh_sReturn *MsgP)
{
// Insert in eve
ev->eve->event_return( MsgP);
for ( int i = 0; i < ev->seve_cnt; i++)
ev->seve[i]->mh_return( MsgP);
}
ev->ala->event_return( MsgP);
for ( int i = 0; i < ev->sala_cnt; i++)
......@@ -563,6 +614,8 @@ pwr_tStatus Ev::mh_return_bc( mh_sReturn *MsgP)
pwr_tStatus Ev::mh_alarm_bc( mh_sMessage *MsgP)
{
ev->eve->event_alarm( MsgP);
for ( int i = 0; i < ev->seve_cnt; i++)
ev->seve[i]->mh_alarm( MsgP);
ev->ala->event_alarm( MsgP);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->mh_alarm( MsgP);
......@@ -619,6 +672,8 @@ pwr_tStatus Ev::mh_cancel_bc( mh_sReturn *MsgP)
pwr_tStatus Ev::mh_info_bc( mh_sMessage *MsgP)
{
ev->eve->event_info( MsgP);
for ( int i = 0; i < ev->seve_cnt; i++)
ev->seve[i]->mh_info( MsgP);
ev->ala->event_info( MsgP);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->mh_info( MsgP);
......
......@@ -49,6 +49,9 @@
#ifndef xtt_evala
# include "xtt_evala.h"
#endif
#ifndef xtt_eveve
# include "xtt_eveve.h"
#endif
class CoWow;
class XttMethodToolbar;
......@@ -121,6 +124,8 @@ class Ev {
XttMethodToolbar *ala_sup_methodtoolbar;
EvAla *sala[20];
int sala_cnt;
EvEve *seve[20];
int seve_cnt;
virtual void map_eve( unsigned int options) {}
virtual void map_ala( unsigned int options) {}
......@@ -132,6 +137,9 @@ class Ev {
virtual EvAla *open_alarmlist_satellite( const char *title, pwr_tStatus *sts,
int width, int height, int x, int y,
pwr_tObjid view, unsigned int options = 0, void *widget = 0) {return 0;}
virtual EvEve *open_eventlist_satellite( const char *title, pwr_tStatus *sts,
int width, int height, int x, int y,
pwr_tObjid view, unsigned int options = 0, void *widget = 0) {return 0;}
int outunit_connect( pwr_tObjid user);
void update( double scantime);
......@@ -178,6 +186,9 @@ class Ev {
static int sala_acknowledge_cb( void *ctx, mh_sEventId *id);
static void sala_copy_list_cb( void *ctx, EvList *evl);
static void sala_close_cb( void *ctx, EvAla *sala);
static int seve_acknowledge_cb( void *ctx, mh_sEventId *id);
static void seve_copy_list_cb( void *ctx, EvList *evl);
static void seve_close_cb( void *ctx, EvEve *seve);
static void help_event_cb( void *ctx, void *item);
static pwr_tStatus mh_ack_bc( mh_sAck *MsgP);
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* xtt_eveve.cpp -- Alarm window in xtt */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include "pwr_privilege.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
#include "cow_wow.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "rt_mh.h"
#include "rt_mh_outunit.h"
#include "rt_mh_util.h"
#include "co_lng.h"
#include "xtt_eveve.h"
#include "xtt_methodtoolbar.h"
#include "rt_xnav_msg.h"
EvEve::EvEve( void *ev_parent_ctx,
char *eve_name,
pwr_tObjid ev_user,
int ev_eventname_seg,
int ev_width,
int ev_height,
int ev_x,
int ev_y,
pwr_tObjid ev_view,
unsigned int ev_options,
pwr_tStatus *status) :
parent_ctx(ev_parent_ctx), user(ev_user), eventname_seg(ev_eventname_seg),
width(ev_width), height(ev_height), x(ev_x), y(ev_y), view(ev_view), options(ev_options),
start_trace_cb(0), display_in_xnav_cb(0),
help_cb(0), popup_menu_cb(0), sound_cb(0), pop_cb(0), is_authorized_cb(0),
acknowledge_cb(0), name_to_alias_cb(0), copy_list_cb(0), close_cb(0), ala(NULL),
eve_displayed(0), list_copied(0)
{
}
//
// Delete ev
//
EvEve::~EvEve()
{
if ( close_cb)
close_cb( parent_ctx, this);
}
void EvEve::init()
{
if ( !list_copied && ala->browbase && copy_list_cb) {
list_copied = 1;
(copy_list_cb)( parent_ctx, ala);
if ( !cdh_ObjidIsNull(view))
set_view( view);
}
}
void EvEve::eve_init_cb( void *ctx)
{
EvEve *ev = (EvEve *)ctx;
if ( !ev->list_copied && ev->copy_list_cb) {
ev->list_copied = 1;
(ev->copy_list_cb)( ev->parent_ctx, ev->ala);
if ( !cdh_ObjidIsNull(ev->view))
ev->set_view( ev->view);
}
}
void EvEve::eve_start_trace_cb( void *ctx, pwr_tObjid objid, char *name)
{
if ( ((EvEve *)ctx)->start_trace_cb)
((EvEve *)ctx)->start_trace_cb( ((EvEve *)ctx)->parent_ctx, objid, name);
}
void EvEve::eve_popup_menu_cb( void *ctx, pwr_tAttrRef attrref,
unsigned long item_type, unsigned long utility,
char *arg, int x, int y)
{
if ( ((EvEve *)ctx)->popup_menu_cb)
(((EvEve *)ctx)->popup_menu_cb) ( ((EvEve *)ctx)->parent_ctx, attrref, item_type,
utility, arg, x, y);
}
int EvEve::eve_sound_cb( void *ctx, pwr_tAttrRef *attrref)
{
if ( ((EvEve *)ctx)->sound_cb)
return (((EvEve *)ctx)->sound_cb) ( ((EvEve *)ctx)->parent_ctx, attrref);
return 0;
}
void EvEve::eve_selection_changed_cb( void *ctx)
{
((EvEve *)ctx)->eve_methodtoolbar->set_sensitive();
((EvEve *)ctx)->eve_sup_methodtoolbar->set_sensitive();
}
void EvEve::eve_display_in_xnav_cb( void *ctx, pwr_tAttrRef *arp)
{
if ( ((EvEve *)ctx)->display_in_xnav_cb)
((EvEve *)ctx)->display_in_xnav_cb( ((EvEve *)ctx)->parent_ctx, arp);
}
char *EvEve::eve_name_to_alias_cb( void *ctx, char *name)
{
return ((EvEve *)ctx)->name_to_alias_cb( ((EvEve *)ctx)->parent_ctx, name);
}
void EvEve::help_event_cb( void *ctx, void *item)
{
ItemAlarm *aitem = (ItemAlarm *)item;
switch ( aitem->type) {
case evlist_eItemType_Alarm:
((EvEve *)ctx)->wow->DisplayText( "Event MoreText", aitem->eventmoretext);
break;
default:
return;
}
}
void EvEve::eve_activate_print()
{
char title[80];
strcpy( title, Lng::translate( "Event List"));
ala->print( title);
}
void EvEve::eve_activate_ack_last()
{
mh_sEventId *id;
int sts;
if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
return;
if ( ala->brow == ala->browbase) {
// Flat view, acknowledge last
sts = ala->get_last_not_acked( &id);
if ( EVEN(sts)) return;
}
else {
// Tree view, acknowledge selected
ItemAlarm *item;
pwr_tAName eventname;
sts = ala->get_selected_event( eventname, &item);
if ( EVEN(sts)) return;
switch ( item->type) {
case evlist_eItemType_Alarm:
id = &item->eventid;
break;
default:
return;
}
}
mh_sEventId lid = *id;
ala->ack( id);
acknowledge_cb( parent_ctx, &lid);
}
void EvEve::eve_activate_ack_all()
{
if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
return;
ack_all();
}
void EvEve::eve_activate_help()
{
if ( help_cb)
(help_cb)( parent_ctx, "opg_alarmlist");
}
void EvEve::eve_activate_helpevent()
{
char eventname[80];
int sts;
ItemAlarm *item;
if ( help_cb) {
sts = ala->get_selected_event( eventname, &item);
if( ODD(sts)) {
wow->DisplayText( eventname, item->eventmoretext);
}
}
}
void EvEve::update()
{
if ( ala->browbase)
ala->flash();
}
void EvEve::ack_last_prio( unsigned long type, unsigned long prio)
{
mh_sEventId *id;
int sts;
if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
return;
sts = ala->get_last_not_acked_prio( &id, type, prio);
if ( ODD(sts))
{
mh_sEventId lid = *id;
ala->ack( id);
acknowledge_cb( parent_ctx, &lid);
}
}
void EvEve::ack_all()
{
mh_sEventId *id;
int sts;
if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
return;
sts = ala->get_last_not_acked( &id);
while ( ODD(sts)) {
mh_sEventId lid = *id;
ala->ack( id);
acknowledge_cb( parent_ctx, &lid);
sts = ala->get_last_not_acked( &id);
}
}
int EvEve::get_last_not_acked_prio( mh_sEventId **id, unsigned long type,
unsigned long prio)
{
return ala->get_last_not_acked_prio( id, type, prio);
}
pwr_tStatus EvEve::mh_ack( mh_sAck *MsgP)
{
ala->event_ack( MsgP);
return 1;
}
pwr_tStatus EvEve::mh_return( mh_sReturn *MsgP)
{
ala->event_return( MsgP);
return 1;
}
pwr_tStatus EvEve::mh_alarm( mh_sMessage *MsgP)
{
ala->event_alarm( MsgP);
return 1;
}
pwr_tStatus EvEve::mh_cancel( mh_sReturn *MsgP)
{
ala->event_cancel( MsgP);
return 1;
}
pwr_tStatus EvEve::mh_info( mh_sMessage *MsgP)
{
ala->event_info( MsgP);
return 1;
}
pwr_tStatus EvEve::mh_clear_alarmlist( pwr_tNodeIndex nix)
{
ala->event_clear_alarmlist( nix);
return 1;
}
pwr_tStatus EvEve::set_view(pwr_tOid view)
{
pwr_tStatus sts;
sts = ala->set_view( view);
if ( ODD(sts)) {
pwr_tString80 name;
if ( cdh_ObjidIsNull( view)) {
strcpy( name, "Event List");
}
else {
pwr_tAttrRef name_ar, ar;
ar = cdh_ObjidToAref( view);
sts = gdh_ArefANameToAref( &ar, "Name", &name_ar);
if (EVEN(sts)) return sts;
sts = gdh_GetObjectInfoAttrref( &name_ar, name, sizeof(name));
if (EVEN(sts)) return sts;
}
set_title_ala( name);
}
return sts;
}
void EvEve::view_shift()
{
pwr_sClass_OpPlace *opp;
pwr_tStatus sts;
sts = gdh_ObjidToPointer( user, (pwr_tAddress *) &opp);
if ( EVEN(sts)) return;
if ( cdh_ObjidIsNull(ala->current_view)) {
set_view( opp->AlarmViews[0]);
}
else {
for ( unsigned int i = 0; i < sizeof(opp->AlarmViews)/sizeof(opp->AlarmViews[0]); i++) {
if ( cdh_ObjidIsEqual( ala->current_view, opp->AlarmViews[i])) {
if ( i == sizeof(opp->AlarmViews)/sizeof(opp->AlarmViews[0]) - 1)
set_view( pwr_cNObjid);
else
set_view( opp->AlarmViews[i+1]);
break;
}
}
}
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2012 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef xtt_eveve_h
#define xtt_eveve_h
/* xtt_eveve.h -- Alarm window in xtt */
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef xtt_evlist
# include "xtt_evlist.h"
#endif
class CoWow;
class XttMethodToolbar;
class EvEve {
public:
EvEve(
void *ev_parent_ctx,
char *eve_name,
pwr_tObjid ev_user,
int ev_eventname_seg,
int ev_width,
int ev_height,
int ev_x,
int ev_y,
pwr_tObjid ev_view,
unsigned int ev_options,
pwr_tStatus *status);
virtual ~EvEve();
void *parent_ctx;
char name[80];
pwr_tObjid user;
int eventname_seg;
int width;
int height;
int x;
int y;
pwr_tObjid view;
unsigned int options;
void (*start_trace_cb)( void *, pwr_tObjid, char *);
void (*display_in_xnav_cb)( void *, pwr_tAttrRef *);
void (*help_cb)( void *, const char *);
void (*popup_menu_cb)( void *, pwr_tAttrRef, unsigned long,
unsigned long, char *, int x, int y);
int (*sound_cb)( void *, pwr_tAttrRef *);
void (*pop_cb)( void *);
int (*is_authorized_cb)(void *, unsigned int);
int (*acknowledge_cb)(void *, mh_sEventId *);
char *(*name_to_alias_cb)( void *, char *);
void (*copy_list_cb)( void *, EvList *);
void (*close_cb)( void *, EvEve *);
EvList *ala;
int eve_displayed;
int eve_size;
CoWow *wow;
XttMethodToolbar *eve_methodtoolbar;
XttMethodToolbar *eve_sup_methodtoolbar;
int list_copied;
virtual void map_ala() {}
virtual void unmap_ala() {}
virtual void set_title_ala( char *title) {}
int is_mapped_ala() { return eve_displayed;};
pwr_tStatus set_view(pwr_tOid view);
void view_shift();
void update();
pwr_tStatus mh_ack( mh_sAck *MsgP);
pwr_tStatus mh_return( mh_sReturn *MsgP);
pwr_tStatus mh_alarm( mh_sMessage *MsgP);
pwr_tStatus mh_cancel( mh_sReturn *MsgP);
pwr_tStatus mh_info( mh_sMessage *MsgP);
pwr_tStatus mh_clear_alarmlist( pwr_tNodeIndex nix);
void init();
void eve_activate_print();
void eve_activate_ack_last();
void eve_activate_help();
void eve_activate_helpevent();
void eve_activate_ack_all();
void ack_last_prio( unsigned long type, unsigned long prio);
void ack_all();
void ack( mh_sEventId *id) { ala->ack(id);}
int get_last_not_acked_prio( mh_sEventId **id, unsigned long type,
unsigned long prio);
static void eve_display_in_xnav_cb( void *ctx, pwr_tAttrRef *arp);
static void eve_start_trace_cb( void *ctx, pwr_tObjid objid, char *name);
static void eve_popup_menu_cb( void *ctx, pwr_tAttrRef attrref,
unsigned long item_type, unsigned long utility,
char *arg, int x, int y);
static int eve_sound_cb( void *ctx, pwr_tAttrRef *attrref);
static void eve_selection_changed_cb( void *ctx);
static char *eve_name_to_alias_cb( void *ctx, char *name);
static void eve_init_cb( void *ctx);
static void help_event_cb( void *ctx, void *item);
};
#endif
......@@ -1901,6 +1901,8 @@ static int xnav_show_func( void *client_data,
}
else if ( cdh_NoCaseStrncmp( arg1_str, "EVENTLIST", strlen( arg1_str)) == 0)
{
char arg2_str[80];
int arg2_sts;
unsigned int options = 0;
if ( ODD( dcli_get_qualifier( "/FULLSCREEN", 0, 0)))
......@@ -1939,9 +1941,81 @@ static int xnav_show_func( void *client_data,
xnav->ev->pop_cb = xnav_ev_pop_cb;
xnav->ev->is_authorized_cb = xnav->is_authorized_cb;
}
arg2_sts = dcli_get_qualifier( "dcli_arg2", arg2_str, sizeof(arg2_str));
if ( ODD(arg2_sts)) {
if ( cdh_NoCaseStrncmp( arg2_str, "SATELLITE", strlen( arg2_str)) == 0) {
pwr_tOName alarmview_str;
char tmp_str[40];
pwr_tOid alarmview_oid = pwr_cNOid;
int width, height, x, y;
int nr;
if ( ODD( dcli_get_qualifier( "/ALARMVIEW", alarmview_str, sizeof(alarmview_str)))) {
sts = gdh_NameToObjid( alarmview_str, &alarmview_oid);
if ( EVEN(sts)) {
xnav->message('E', "Alarmview not found");
return XNAV__SUCCESS;
}
}
if ( ODD( dcli_get_qualifier( "/WIDTH", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%d", &width);
if ( nr != 1) {
xnav->message('E', "Syntax error in width");
return XNAV__HOLDCOMMAND;
}
}
else
width = 0;
if ( ODD( dcli_get_qualifier( "/HEIGHT", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%d", &height);
if ( nr != 1) {
xnav->message('E', "Syntax error in height");
return XNAV__HOLDCOMMAND;
}
}
else
height = 0;
if ( ODD( dcli_get_qualifier( "/XPOSITION", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%d", &x);
if ( nr != 1) {
xnav->message('E', "Syntax error in x coordinate");
return XNAV__HOLDCOMMAND;
}
}
else
x = 0;
if ( ODD( dcli_get_qualifier( "/YPOSITION", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%d", &y);
if ( nr != 1) {
xnav->message('E', "Syntax error in y coordinate");
return XNAV__HOLDCOMMAND;
}
}
else
y = 0;
if ( xnav->ev)
xnav->ev->open_eventlist_satellite("Eventlist Satellite", &sts,
width, height, x, y, alarmview_oid);
else {
xnav->message('E', "Eventlist not loaded");
return XNAV__HOLDCOMMAND;
}
}
else {
xnav->message('E', "Syntax error");
return XNAV__HOLDCOMMAND;
}
}
else {
xnav->ev->map_eve( options);
}
}
/*new code by Jonas Nylund 030122*/
else if ( cdh_NoCaseStrncmp( arg1_str, "HISTLIST", strlen( arg1_str)) == 0)
{
......
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