Commit d5f0d143 authored by Claes Sjofors's avatar Claes Sjofors

Merge branch 'master' of pwrcvs:/data1/git/pwr

parents f8058b5f 1b641e47
......@@ -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);
......
This diff is collapsed.
/*
* 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