Commit 07d9763a authored by claes's avatar claes

Alarm blocking implemented

parent ce6ab3f9
...@@ -74,9 +74,10 @@ static XtActionsRec HotkeyActions[] = { ...@@ -74,9 +74,10 @@ static XtActionsRec HotkeyActions[] = {
}; };
static xnav_sStartMenu alarm_menu[] = { static xnav_sStartMenu alarm_menu[] = {
{ "Alarm list", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show alarm"}, { "Alarm List", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show alarm"},
{ "Event list", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show event"}, { "Event List", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show event"},
{ "Historical list", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show hist"}, { "Blocked Alarms", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show block"},
{ "Historical List", xnav_eItemType_Command, menu_ePixmap_List, (void *) "show hist"},
{ "", 0, 0, NULL}}; { "", 0, 0, NULL}};
static xnav_sStartMenu nethandler_menu[] = { static xnav_sStartMenu nethandler_menu[] = {
{ "Link", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show link"}, { "Link", xnav_eItemType_Command, menu_ePixmap_Map, (void *) "show link"},
......
/* xtt_bloc.cpp -- Alarm blocking window in xtt.
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
*/
#include "pwr_class.h"
#include "pwr_privilege.h"
#include "rt_gdh.h"
#include "rt_mh_outunit.h"
#include "co_cdh.h"
#include <Xm/Xm.h>
#include <Xm/XmP.h>
#include <Xm/Text.h>
#include <Mrm/MrmPublic.h>
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <Xm/ToggleB.h>
#include "flow_x.h"
#include "xtt_block.h"
#include "co_lng.h"
#include "co_wow.h"
#include "co_msg.h"
int Block::execute()
{
mh_eEventPrio prio;
pwr_tStatus sts;
if (XmToggleButtonGetState( toggleA))
prio = mh_eEventPrio_A;
else if (XmToggleButtonGetState( toggleB))
prio = mh_eEventPrio_B;
else if (XmToggleButtonGetState( toggleC))
prio = mh_eEventPrio_C;
else if (XmToggleButtonGetState( toggleD))
prio = mh_eEventPrio_D;
else
prio = (mh_eEventPrio) 0;
sts = mh_OutunitBlock( oar.Objid, prio);
if (EVEN(sts)) {
char msg[80];
msg_GetMsg( sts, msg, sizeof(msg));
wow_DisplayError( toplevel, "Block Error", msg);
}
return sts;
}
void Block::update()
{
pwr_tStatus sts;
mh_uEventInfo block_level;
sts = gdh_GetAlarmInfo( oar.Objid, NULL, NULL, (pwr_tUInt32 *) &block_level,
NULL, NULL);
switch ( block_level.Event.Prio) {
case mh_eEventPrio_A:
XmToggleButtonSetState( toggleA, 1, 1);
break;
case mh_eEventPrio_B:
XmToggleButtonSetState( toggleB, 1, 1);
break;
case mh_eEventPrio_C:
XmToggleButtonSetState( toggleC, 1, 1);
break;
case mh_eEventPrio_D:
XmToggleButtonSetState( toggleD, 1, 1);
break;
case 0:
XmToggleButtonSetState( toggleNo, 1, 1);
break;
default:
break;
}
}
void Block::create_ok( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
blk->buttonOk = w;
}
void Block::create_apply( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
blk->buttonApply = w;
}
void Block::create_toggleA( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
blk->toggleA = w;
}
void Block::create_toggleB( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
blk->toggleB = w;
}
void Block::create_toggleC( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
blk->toggleC = w;
}
void Block::create_toggleD( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
blk->toggleD = w;
}
void Block::create_toggleNo( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
blk->toggleNo = w;
}
void Block::activate_apply( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
blk->execute();
}
void Block::activate_ok( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
pwr_tStatus sts;
sts = blk->execute();
if ( ODD(sts))
delete blk;
}
void Block::activate_cancel( Widget w, Block *blk,
XmAnyCallbackStruct *data)
{
delete blk;
}
Block::~Block()
{
XtDestroyWidget( parent_wid);
}
Block::Block( void *b_parent_ctx,
Widget b_parent_wid,
pwr_sAttrRef *b_oar,
char *name,
unsigned int priv,
pwr_tStatus *sts):
parent_ctx(b_parent_ctx), parent_wid(b_parent_wid), oar(*b_oar)
{
char uid_filename[120] = {"xtt_block.uid"};
char *uid_filename_p = uid_filename;
Arg args[20];
int msts;
int i;
MrmHierarchy s_DRMh;
MrmType dclass;
char title[200];
pwr_tOName aname;
static MrmRegisterArg reglist[] = {
{ "blk_ctx", 0 },
{"blk_activate_cancel",(caddr_t)activate_cancel },
{"blk_activate_ok",(caddr_t)activate_ok },
{"blk_activate_apply",(caddr_t)activate_apply },
{"blk_create_ok",(caddr_t)create_ok },
{"blk_create_apply",(caddr_t)create_apply },
{"blk_create_toggleA",(caddr_t)create_toggleA },
{"blk_create_toggleB",(caddr_t)create_toggleB },
{"blk_create_toggleC",(caddr_t)create_toggleC },
{"blk_create_toggleD",(caddr_t)create_toggleD },
{"blk_create_toggleNo",(caddr_t)create_toggleNo }
};
static int reglist_num = (sizeof reglist / sizeof reglist[0]);
*sts = 1;
Lng::get_uid( uid_filename, uid_filename);
*sts = gdh_AttrrefToName( &oar, aname, sizeof(aname), cdh_mNName);
if ( EVEN(*sts)) return;
strcpy( title, name);
strcat( title, " ");
strcat( title, aname);
reglist[0].value = (caddr_t) this;
// Motif
MrmInitialize();
// Save the context structure in the widget
i = 0;
XtSetArg(args[i], XmNuserData, (unsigned int) this);i++;
XtSetArg(args[i], XmNdeleteResponse, XmDO_NOTHING);i++;
msts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh);
if (msts != MrmSUCCESS) printf("can't open %s\n", uid_filename);
MrmRegisterNames(reglist, reglist_num);
parent_wid = XtCreatePopupShell( title,
topLevelShellWidgetClass, parent_wid, args, i);
msts = MrmFetchWidgetOverride( s_DRMh, "blk_window", parent_wid,
name, args, 1, &toplevel, &dclass);
if (msts != MrmSUCCESS) printf("can't fetch %s\n", name);
MrmCloseHierarchy(s_DRMh);
i = 0;
XtSetArg(args[i],XmNwidth,500);i++;
XtSetArg(args[i],XmNheight,200);i++;
XtSetValues( toplevel, args, i);
XtManageChild( toplevel);
XtPopup( parent_wid, XtGrabNone);
if ( !(priv & pwr_mPrv_RtEvents ||
priv & pwr_mPrv_System)) {
Arg sensitive[1];
// No access to block
// XtUnmanageChild( ok);
// XtUnmanageChild( apply);
XtSetArg( sensitive[0],XmNsensitive, 0);
XtSetValues( buttonOk, sensitive, 1);
XtSetValues( buttonApply, sensitive, 1);
XtSetValues( toggleA, sensitive, 1);
XtSetValues( toggleB, sensitive, 1);
XtSetValues( toggleC, sensitive, 1);
XtSetValues( toggleD, sensitive, 1);
XtSetValues( toggleNo, sensitive, 1);
}
update();
// Connect the window manager close-button to exit
flow_AddCloseVMProtocolCb( parent_wid,
(XtCallbackProc)activate_cancel, this);
}
#ifndef xtt_block_h
#define xtt_block_h
/* xtt_block.h -- Alarm blocking window
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#ifndef pwr_h
# include "pwr.h"
#endif
#if defined __cplusplus
}
#endif
class Block {
public:
Block(
void *b_parent_ctx,
Widget b_parent_wid,
pwr_sAttrRef *b_oar,
char *name,
unsigned int priv,
pwr_tStatus *status);
~Block();
int execute();
void update();
void *parent_ctx;
Widget parent_wid;
Widget toplevel;
Widget form;
Widget toggleA;
Widget toggleB;
Widget toggleC;
Widget toggleD;
Widget toggleNo;
Widget buttonOk;
Widget buttonApply;
pwr_sAttrRef oar;
static void create_ok( Widget w, Block *blk,
XmAnyCallbackStruct *data);
static void create_apply( Widget w, Block *blk,
XmAnyCallbackStruct *data);
static void create_toggleA( Widget w, Block *blk,
XmAnyCallbackStruct *data);
static void create_toggleB( Widget w, Block *blk,
XmAnyCallbackStruct *data);
static void create_toggleC( Widget w, Block *blk,
XmAnyCallbackStruct *data);
static void create_toggleD( Widget w, Block *blk,
XmAnyCallbackStruct *data);
static void create_toggleNo( Widget w, Block *blk,
XmAnyCallbackStruct *data);
static void activate_ok( Widget w, Block *blk,
XmAnyCallbackStruct *data);
static void activate_cancel( Widget w, Block *blk,
XmAnyCallbackStruct *data);
static void activate_apply( Widget w, Block *blk,
XmAnyCallbackStruct *data);
};
#endif
...@@ -37,7 +37,7 @@ extern "C" { ...@@ -37,7 +37,7 @@ extern "C" {
static pwr_tStatus OpenObject( xmenu_sMenuCall *ip) static pwr_tStatus OpenObject( xmenu_sMenuCall *ip)
{ {
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -67,7 +67,7 @@ static pwr_tStatus OpenObjectFilter( xmenu_sMenuCall *ip) ...@@ -67,7 +67,7 @@ static pwr_tStatus OpenObjectFilter( xmenu_sMenuCall *ip)
static pwr_tStatus OpenCrossref( xmenu_sMenuCall *ip) static pwr_tStatus OpenCrossref( xmenu_sMenuCall *ip)
{ {
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -83,7 +83,7 @@ static pwr_tStatus OpenCrossrefFilter( xmenu_sMenuCall *ip) ...@@ -83,7 +83,7 @@ static pwr_tStatus OpenCrossrefFilter( xmenu_sMenuCall *ip)
pwr_tClassId classid; pwr_tClassId classid;
pwr_tStatus sts; pwr_tStatus sts;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -105,7 +105,7 @@ static pwr_tStatus HistEvent( xmenu_sMenuCall *ip) ...@@ -105,7 +105,7 @@ static pwr_tStatus HistEvent( xmenu_sMenuCall *ip)
char name[120]; char name[120];
int sts; int sts;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -125,7 +125,7 @@ static pwr_tStatus HistEvent( xmenu_sMenuCall *ip) ...@@ -125,7 +125,7 @@ static pwr_tStatus HistEvent( xmenu_sMenuCall *ip)
static pwr_tStatus HistEventFilter( xmenu_sMenuCall *ip) static pwr_tStatus HistEventFilter( xmenu_sMenuCall *ip)
{ {
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -149,7 +149,7 @@ static pwr_tStatus OpenTrace( xmenu_sMenuCall *ip) ...@@ -149,7 +149,7 @@ static pwr_tStatus OpenTrace( xmenu_sMenuCall *ip)
pwr_tCid classid; pwr_tCid classid;
pwr_sAttrRef plcconnect; pwr_sAttrRef plcconnect;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -199,7 +199,7 @@ static pwr_tStatus OpenTraceFilter( xmenu_sMenuCall *ip) ...@@ -199,7 +199,7 @@ static pwr_tStatus OpenTraceFilter( xmenu_sMenuCall *ip)
pwr_sAttrRef plcconnect; pwr_sAttrRef plcconnect;
char name[240]; char name[240];
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -247,7 +247,7 @@ static pwr_tStatus OpenTrend( xmenu_sMenuCall *ip) ...@@ -247,7 +247,7 @@ static pwr_tStatus OpenTrend( xmenu_sMenuCall *ip)
int found; int found;
pwr_sAttrRef deftrend; pwr_sAttrRef deftrend;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -328,7 +328,7 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip) ...@@ -328,7 +328,7 @@ static pwr_tStatus OpenTrendFilter( xmenu_sMenuCall *ip)
pwr_sAttrRef deftrend; pwr_sAttrRef deftrend;
char name[120]; char name[120];
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -384,7 +384,7 @@ static pwr_tStatus OpenFast( xmenu_sMenuCall *ip) ...@@ -384,7 +384,7 @@ static pwr_tStatus OpenFast( xmenu_sMenuCall *ip)
int found; int found;
pwr_sAttrRef deffast; pwr_sAttrRef deffast;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -465,7 +465,7 @@ static pwr_tStatus OpenFastFilter( xmenu_sMenuCall *ip) ...@@ -465,7 +465,7 @@ static pwr_tStatus OpenFastFilter( xmenu_sMenuCall *ip)
pwr_sAttrRef deffast; pwr_sAttrRef deffast;
char name[120]; char name[120];
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -511,7 +511,7 @@ static pwr_tStatus OpenFastFilter( xmenu_sMenuCall *ip) ...@@ -511,7 +511,7 @@ static pwr_tStatus OpenFastFilter( xmenu_sMenuCall *ip)
static pwr_tStatus RtNavigator( xmenu_sMenuCall *ip) static pwr_tStatus RtNavigator( xmenu_sMenuCall *ip)
{ {
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -540,7 +540,7 @@ static pwr_tStatus OpenClassGraph( xmenu_sMenuCall *ip) ...@@ -540,7 +540,7 @@ static pwr_tStatus OpenClassGraph( xmenu_sMenuCall *ip)
char cmd[200]; char cmd[200];
pwr_sAttrRef aref; pwr_sAttrRef aref;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -571,7 +571,7 @@ static pwr_tStatus OpenClassGraphFilter( xmenu_sMenuCall *ip) ...@@ -571,7 +571,7 @@ static pwr_tStatus OpenClassGraphFilter( xmenu_sMenuCall *ip)
char fname[120]; char fname[120];
char found_file[120]; char found_file[120];
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -612,7 +612,7 @@ static pwr_tStatus OpenGraph( xmenu_sMenuCall *ip) ...@@ -612,7 +612,7 @@ static pwr_tStatus OpenGraph( xmenu_sMenuCall *ip)
pwr_tClassId classid; pwr_tClassId classid;
char cmd[200]; char cmd[200];
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -663,7 +663,7 @@ static pwr_tStatus OpenGraphFilter( xmenu_sMenuCall *ip) ...@@ -663,7 +663,7 @@ static pwr_tStatus OpenGraphFilter( xmenu_sMenuCall *ip)
char action[80]; char action[80];
char *s; char *s;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -716,7 +716,7 @@ static pwr_tStatus Collect( xmenu_sMenuCall *ip) ...@@ -716,7 +716,7 @@ static pwr_tStatus Collect( xmenu_sMenuCall *ip)
int sts; int sts;
pwr_sAttrRef aref; pwr_sAttrRef aref;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -737,7 +737,7 @@ static pwr_tStatus CollectFilter( xmenu_sMenuCall *ip) ...@@ -737,7 +737,7 @@ static pwr_tStatus CollectFilter( xmenu_sMenuCall *ip)
int sts; int sts;
pwr_sAttrRef aref; pwr_sAttrRef aref;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -760,7 +760,7 @@ static pwr_tStatus Help( xmenu_sMenuCall *ip) ...@@ -760,7 +760,7 @@ static pwr_tStatus Help( xmenu_sMenuCall *ip)
pwr_tString40 helptopic; pwr_tString40 helptopic;
char cmd[200]; char cmd[200];
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -789,7 +789,7 @@ static pwr_tStatus HelpFilter( xmenu_sMenuCall *ip) ...@@ -789,7 +789,7 @@ static pwr_tStatus HelpFilter( xmenu_sMenuCall *ip)
char name[140]; char name[140];
pwr_tString40 helptopic; pwr_tString40 helptopic;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -814,7 +814,7 @@ static pwr_tStatus DataSheet( xmenu_sMenuCall *ip) ...@@ -814,7 +814,7 @@ static pwr_tStatus DataSheet( xmenu_sMenuCall *ip)
char name[140]; char name[140];
pwr_tURL datasheet; pwr_tURL datasheet;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -840,7 +840,7 @@ static pwr_tStatus DataSheetFilter( xmenu_sMenuCall *ip) ...@@ -840,7 +840,7 @@ static pwr_tStatus DataSheetFilter( xmenu_sMenuCall *ip)
char name[140]; char name[140];
pwr_tURL datasheet; pwr_tURL datasheet;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -865,7 +865,7 @@ static pwr_tStatus Photo( xmenu_sMenuCall *ip) ...@@ -865,7 +865,7 @@ static pwr_tStatus Photo( xmenu_sMenuCall *ip)
char name[140]; char name[140];
pwr_tURL photo; pwr_tURL photo;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -898,7 +898,7 @@ static pwr_tStatus PhotoFilter( xmenu_sMenuCall *ip) ...@@ -898,7 +898,7 @@ static pwr_tStatus PhotoFilter( xmenu_sMenuCall *ip)
char name[140]; char name[140];
pwr_tURL photo; pwr_tURL photo;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -925,7 +925,7 @@ static pwr_tStatus CircuitDiagram( xmenu_sMenuCall *ip) ...@@ -925,7 +925,7 @@ static pwr_tStatus CircuitDiagram( xmenu_sMenuCall *ip)
pwr_tObjid objid; pwr_tObjid objid;
bool is_parent = false; bool is_parent = false;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -964,7 +964,7 @@ static pwr_tStatus CircuitDiagramFilter( xmenu_sMenuCall *ip) ...@@ -964,7 +964,7 @@ static pwr_tStatus CircuitDiagramFilter( xmenu_sMenuCall *ip)
pwr_tObjid objid; pwr_tObjid objid;
bool is_parent = false; bool is_parent = false;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -993,6 +993,72 @@ static pwr_tStatus CircuitDiagramFilter( xmenu_sMenuCall *ip) ...@@ -993,6 +993,72 @@ static pwr_tStatus CircuitDiagramFilter( xmenu_sMenuCall *ip)
return XNAV__INVISIBLE; return XNAV__INVISIBLE;
} }
// Note
static pwr_tStatus Note( xmenu_sMenuCall *ip)
{
int sts;
char name[140];
char cmd[200];
pwr_sAttrRef *objar =
!ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
sts = gdh_AttrrefToName( objar, name, sizeof(name),
cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
sprintf( cmd, "open attr/bypass/name= %s.Note", name);
sts = ((XNav *)ip->EditorContext)->command( cmd);
// xnav_edit_attribute( name, value);
return XNAV__SUCCESS;
}
// Note filter
static pwr_tStatus NoteFilter( xmenu_sMenuCall *ip)
{
int sts;
char name[140];
pwr_tURL datasheet;
pwr_sAttrRef *objar =
!ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
sts = gdh_AttrrefToName( objar, name, sizeof(name),
cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
strcat( name, ".Note");
sts = gdh_GetObjectInfo( name, (void *)datasheet, sizeof(datasheet));
if ( EVEN(sts)) return XNAV__INVISIBLE;
return XNAV__SUCCESS;
}
// Block Events
static pwr_tStatus BlockEvents( xmenu_sMenuCall *ip)
{
pwr_tCmd cmd;
pwr_tOName name;
pwr_tStatus sts;
sts = gdh_ObjidToName( ip->Pointed.Objid, name, sizeof(name),
cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
sprintf( cmd, "event block/name=%s", name);
sts = ((XNav *)ip->EditorContext)->command( cmd);
return XNAV__SUCCESS;
}
// Block Events Filter
static pwr_tStatus BlockEventsFilter( xmenu_sMenuCall *ip)
{
return XNAV__SUCCESS;
}
// Help Class // Help Class
static pwr_tStatus HelpClass( xmenu_sMenuCall *ip) static pwr_tStatus HelpClass( xmenu_sMenuCall *ip)
{ {
...@@ -1001,7 +1067,7 @@ static pwr_tStatus HelpClass( xmenu_sMenuCall *ip) ...@@ -1001,7 +1067,7 @@ static pwr_tStatus HelpClass( xmenu_sMenuCall *ip)
char classname[80]; char classname[80];
char cmd[200]; char cmd[200];
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -1028,7 +1094,7 @@ static pwr_tStatus HelpClassFilter( xmenu_sMenuCall *ip) ...@@ -1028,7 +1094,7 @@ static pwr_tStatus HelpClassFilter( xmenu_sMenuCall *ip)
int sts; int sts;
pwr_tClassId classid; pwr_tClassId classid;
pwr_sAttrRef *objar = pwr_sAttrRef *objar =
cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ? !ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid) ?
objar = &ip->Pointed : objar = &ip->Pointed :
objar = &ip->ItemList[ip->ChosenItem].CurrentObject; objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
...@@ -1434,6 +1500,10 @@ pwr_dExport pwr_BindXttMethods($Object) = { ...@@ -1434,6 +1500,10 @@ pwr_dExport pwr_BindXttMethods($Object) = {
pwr_BindXttMethod(PhotoFilter), pwr_BindXttMethod(PhotoFilter),
pwr_BindXttMethod(CircuitDiagram), pwr_BindXttMethod(CircuitDiagram),
pwr_BindXttMethod(CircuitDiagramFilter), pwr_BindXttMethod(CircuitDiagramFilter),
pwr_BindXttMethod(Note),
pwr_BindXttMethod(NoteFilter),
pwr_BindXttMethod(BlockEvents),
pwr_BindXttMethod(BlockEventsFilter),
pwr_BindXttMethod(HelpClass), pwr_BindXttMethod(HelpClass),
pwr_BindXttMethod(HelpClassFilter), pwr_BindXttMethod(HelpClassFilter),
pwr_BindXttMethod(OpenTypeGraph), pwr_BindXttMethod(OpenTypeGraph),
......
...@@ -53,6 +53,8 @@ extern "C" { ...@@ -53,6 +53,8 @@ extern "C" {
#include "xnav_bitmap_eventalarm12.h" #include "xnav_bitmap_eventalarm12.h"
#include "xnav_bitmap_eventacked12.h" #include "xnav_bitmap_eventacked12.h"
#include "xnav_bitmap_eventreturn12.h" #include "xnav_bitmap_eventreturn12.h"
#include "xnav_bitmap_blockr_12.h"
#include "xnav_bitmap_blockl_12.h"
typedef union alau_Event ala_uEvent; typedef union alau_Event ala_uEvent;
union alau_Event union alau_Event
...@@ -80,6 +82,8 @@ void EvListBrow::free_pixmaps() ...@@ -80,6 +82,8 @@ void EvListBrow::free_pixmaps()
brow_FreeAnnotPixmap( ctx, pixmap_eventalarm); brow_FreeAnnotPixmap( ctx, pixmap_eventalarm);
brow_FreeAnnotPixmap( ctx, pixmap_eventacked); brow_FreeAnnotPixmap( ctx, pixmap_eventacked);
brow_FreeAnnotPixmap( ctx, pixmap_eventreturn); brow_FreeAnnotPixmap( ctx, pixmap_eventreturn);
brow_FreeAnnotPixmap( ctx, pixmap_blockr);
brow_FreeAnnotPixmap( ctx, pixmap_blockl);
} }
// //
...@@ -179,6 +183,24 @@ void EvListBrow::allocate_pixmaps() ...@@ -179,6 +183,24 @@ void EvListBrow::allocate_pixmaps()
} }
brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_eventreturn); brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_eventreturn);
for ( i = 0; i < 9; i++)
{
pixmap_data[i].width =xnav_bitmap_blockr_12_width;
pixmap_data[i].height =xnav_bitmap_blockr_12_height;
pixmap_data[i].bits = (char *)xnav_bitmap_blockr_12_bits;
}
brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_blockr);
for ( i = 0; i < 9; i++)
{
pixmap_data[i].width =xnav_bitmap_blockl_12_width;
pixmap_data[i].height =xnav_bitmap_blockl_12_height;
pixmap_data[i].bits = (char *)xnav_bitmap_blockl_12_bits;
}
brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_blockl);
} }
// //
...@@ -341,8 +363,18 @@ EvList::EvList( ...@@ -341,8 +363,18 @@ EvList::EvList(
start_trace_cb(NULL), display_in_xnav_cb(NULL), acc_beep_time(0), start_trace_cb(NULL), display_in_xnav_cb(NULL), acc_beep_time(0),
beep_interval(4) beep_interval(4)
{ {
if ( max_size <= 0) if ( max_size <= 0) {
max_size = 100; switch ( type) {
case ev_eType_AlarmList:
max_size = 1000;
break;
case ev_eType_BlockList:
max_size = 200;
break;
default:
max_size = 500;
}
}
form_widget = ScrolledBrowCreate( parent_wid, "EvList", NULL, 0, form_widget = ScrolledBrowCreate( parent_wid, "EvList", NULL, 0,
evlist_init_brow_cb, this, (Widget *)&brow_widget); evlist_init_brow_cb, this, (Widget *)&brow_widget);
XtManageChild( form_widget); XtManageChild( form_widget);
...@@ -449,6 +481,162 @@ void EvList::event_alarm( mh_sMessage *msg) ...@@ -449,6 +481,162 @@ void EvList::event_alarm( mh_sMessage *msg)
size++; size++;
} }
void EvList::event_block( mh_sBlock *msg)
{
ala_uEvent *event = (ala_uEvent *) msg;
int sts;
if ( type == ev_eType_BlockList) {
switch( msg->Info.EventType) {
case mh_eEvent_Block:
case mh_eEvent_Reblock: {
ItemAlarm *item;
ItemAlarm *dest;
flow_eDest dest_code;
brow_tNode dest_node;
char name[80];
char text[100];
if ( oid_to_item( msg->Info.Object, (void **)&item)) {
brow_DeleteNode( brow->ctx, item->node);
size--;
}
sts = get_destination( event->Info.EventTime, (void **)&dest);
if ( EVEN(sts)) {
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
}
else {
dest_code = flow_eDest_Before;
dest_node = dest->node;
}
sts = gdh_ObjidToName( msg->Outunit, name, sizeof(name),
cdh_mName_path | cdh_mName_object);
if ( ODD(sts)) {
strcpy( text, "User: ");
strcat( text, name);
}
else
strcpy( text, "Unknown");
new ItemAlarm( this, "Alarm",
event->Info.EventTime, event->Info.EventName,
text, event->Info.EventFlags,
event->Info.EventPrio, event->Info.Id,
event->Info.Object, 0, evlist_eEventType_Block,
dest_node, dest_code);
size++;
break;
}
case mh_eEvent_CancelBlock:
case mh_eEvent_Unblock: {
ItemAlarm *item;
if ( !oid_to_item( msg->Info.Object, (void **)&item))
break;
brow_DeleteNode( brow->ctx, item->node);
size--;
break;
}
default:
;
}
}
else if ( type == ev_eType_EventList) {
char text[100];
char name[80];
flow_eDest dest_code;
brow_tNode dest_node;
sts = gdh_ObjidToName( msg->Outunit, name, sizeof(name),
cdh_mName_path | cdh_mName_object);
if ( EVEN(sts))
strcpy( name, "");
switch( msg->Info.EventType) {
case mh_eEvent_Block:
strcpy( text, "Blocked by: ");
break;
case mh_eEvent_Reblock:
strcpy( text, "Reblocked by: ");
break;
case mh_eEvent_CancelBlock:
strcpy( text, "CancelBlocked by: ");
break;
case mh_eEvent_Unblock:
strcpy( text, "Unblocked by: ");
break;
default:
strcpy( text, "Unknown ");
}
strcat( text, name);
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
ItemAlarm *item = new ItemAlarm( this, "Alarm",
event->Info.EventTime, text,
event->Info.EventName, event->Info.EventFlags,
event->Info.EventPrio, event->Info.Id,
event->Info.Object, 0, evlist_eEventType_Block,
dest_node, dest_code);
switch( msg->Info.EventType) {
case mh_eEvent_Block:
case mh_eEvent_Reblock:
brow_SetAnnotPixmap( item->node, 0, brow->pixmap_blockr);
break;
case mh_eEvent_CancelBlock:
case mh_eEvent_Unblock:
brow_SetAnnotPixmap( item->node, 0, brow->pixmap_blockl);
break;
default: ;
}
size++;
}
}
void EvList::block_remove()
{
brow_tNode *node_list;
int node_count;
ItemAlarm *item;
mh_eEventPrio prio = (mh_eEventPrio) 0;
pwr_tStatus sts;
brow_GetSelectedNodes( brow->ctx, &node_list, &node_count);
if ( !node_count)
return;
for ( int i = 0; i < node_count; i++) {
brow_GetUserData( node_list[i], (void **)&item);
switch( item->type) {
case evlist_eItemType_Alarm:
sts = mh_OutunitBlock( item->object, prio);
break;
default: ;
}
}
free( node_list);
}
void EvList::event_cancel( mh_sReturn *msg)
{
if ( type != ev_eType_AlarmList)
return;
ItemAlarm *item;
if ( !id_to_item( &msg->TargetId, (void **)&item))
return;
brow_DeleteNode( brow->ctx, item->node);
size--;
}
void EvList::event_ack( mh_sAck *msg) void EvList::event_ack( mh_sAck *msg)
{ {
ala_uEvent *event = (ala_uEvent *) msg; ala_uEvent *event = (ala_uEvent *) msg;
...@@ -731,7 +919,7 @@ void EvList::display_in_xnav() ...@@ -731,7 +919,7 @@ void EvList::display_in_xnav()
if ( cdh_ObjidIsNull( item->object)) if ( cdh_ObjidIsNull( item->object))
return; return;
if ( display_in_xnav_cb) { if ( display_in_xnav_cb) {
aref.Objid = item->object; aref = cdh_ObjidToAref( item->object);
(display_in_xnav_cb)( parent_ctx, &aref); (display_in_xnav_cb)( parent_ctx, &aref);
} }
break; break;
...@@ -870,9 +1058,7 @@ static int evlist_brow_cb( FlowCtx *ctx, flow_tEvent event) ...@@ -870,9 +1058,7 @@ static int evlist_brow_cb( FlowCtx *ctx, flow_tEvent event)
if ( evlist->popup_menu_cb) { if ( evlist->popup_menu_cb) {
brow_GetUserData( event->object.object, (void **)&item); brow_GetUserData( event->object.object, (void **)&item);
if ( cdh_ObjidIsNotNull( item->object)) { if ( cdh_ObjidIsNotNull( item->object)) {
pwr_sAttrRef attrref; pwr_sAttrRef attrref = cdh_ObjidToAref( item->object);
memset( &attrref, 0, sizeof(attrref));
attrref.Objid = item->object;
(evlist->popup_menu_cb)( evlist->parent_ctx, attrref, (evlist->popup_menu_cb)( evlist->parent_ctx, attrref,
(unsigned long)xmenu_eItemType_Object, (unsigned long)xmenu_eItemType_Object,
(unsigned long)xmenu_mUtility_EventList, NULL, &popup); (unsigned long)xmenu_mUtility_EventList, NULL, &popup);
...@@ -986,6 +1172,7 @@ ItemAlarm::ItemAlarm( EvList *item_evlist, char *item_name, pwr_tTime item_time, ...@@ -986,6 +1172,7 @@ ItemAlarm::ItemAlarm( EvList *item_evlist, char *item_name, pwr_tTime item_time,
eventid(item_eventid), object(item_object), status(item_status) eventid(item_eventid), object(item_object), status(item_status)
{ {
type = evlist_eItemType_Alarm; type = evlist_eItemType_Alarm;
brow_tNodeClass nc;
strcpy( name, item_name); strcpy( name, item_name);
strncpy( eventtext, item_eventtext, sizeof(eventtext)); strncpy( eventtext, item_eventtext, sizeof(eventtext));
...@@ -993,29 +1180,31 @@ ItemAlarm::ItemAlarm( EvList *item_evlist, char *item_name, pwr_tTime item_time, ...@@ -993,29 +1180,31 @@ ItemAlarm::ItemAlarm( EvList *item_evlist, char *item_name, pwr_tTime item_time,
strncpy( eventname, item_eventname, sizeof(eventname)); strncpy( eventname, item_eventname, sizeof(eventname));
eventname[sizeof(eventname)-1] = 0; eventname[sizeof(eventname)-1] = 0;
if ( event_type == evlist_eEventType_Alarm && switch ( event_type) {
eventprio == mh_eEventPrio_A) case evlist_eEventType_Alarm:
{ case evlist_eEventType_Block:
brow_CreateNode( evlist->brow->ctx, item_name, evlist->brow->nc_a_alarm, switch ( eventprio) {
dest, dest_code, (void *) this, 1, &node); case mh_eEventPrio_A:
} nc = evlist->brow->nc_a_alarm;
else if ( event_type == evlist_eEventType_Alarm && break;
eventprio == mh_eEventPrio_B) case mh_eEventPrio_B:
{ nc = evlist->brow->nc_b_alarm;
brow_CreateNode( evlist->brow->ctx, item_name, evlist->brow->nc_b_alarm, break;
dest, dest_code, (void *) this, 1, &node); default:
} nc = evlist->brow->nc_event;
else if ( event_type == evlist_eEventType_Info) }
{ break;
brow_CreateNode( evlist->brow->ctx, item_name, evlist->brow->nc_info, case evlist_eEventType_Info:
dest, dest_code, (void *) this, 1, &node); nc = evlist->brow->nc_info;
} break;
else default:
{ nc = evlist->brow->nc_event;
brow_CreateNode( evlist->brow->ctx, item_name, evlist->brow->nc_event, break;
dest, dest_code, (void *) this, 1, &node);
} }
brow_CreateNode( evlist->brow->ctx, item_name, nc,
dest, dest_code, (void *) this, 1, &node);
// brow_SetAnnotPixmap( node, 0, evlist->brow->pixmap_leaf); // brow_SetAnnotPixmap( node, 0, evlist->brow->pixmap_leaf);
update_text(); update_text();
...@@ -1066,6 +1255,8 @@ void ItemAlarm::update_text() ...@@ -1066,6 +1255,8 @@ void ItemAlarm::update_text()
case evlist_eEventType_Alarm: case evlist_eEventType_Alarm:
brow_SetAnnotPixmap( node, 0, evlist->brow->pixmap_eventalarm); brow_SetAnnotPixmap( node, 0, evlist->brow->pixmap_eventalarm);
break; break;
case evlist_eEventType_Block:
break;
default: default:
; ;
} }
...@@ -1077,6 +1268,7 @@ void ItemAlarm::update_text() ...@@ -1077,6 +1268,7 @@ void ItemAlarm::update_text()
strcpy( type_str, "I"); strcpy( type_str, "I");
brow_SetAnnotation( node, 1, type_str, strlen(type_str)); brow_SetAnnotation( node, 1, type_str, strlen(type_str));
break; break;
case evlist_eEventType_Block:
case evlist_eEventType_Alarm: case evlist_eEventType_Alarm:
switch ( eventprio) switch ( eventprio)
{ {
...@@ -1322,18 +1514,27 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info) ...@@ -1322,18 +1514,27 @@ int EvList::get_alarm_info( evlist_sAlarmInfo *info)
void EvList::set_display_hundredth( int value) void EvList::set_display_hundredth( int value)
{ {
if ( type == ev_eType_BlockList)
return;
display_hundredth = value; display_hundredth = value;
update_text(); update_text();
} }
void EvList::set_hide_object( int value) void EvList::set_hide_object( int value)
{ {
if ( type == ev_eType_BlockList)
return;
hide_object = value; hide_object = value;
update_text(); update_text();
} }
void EvList::set_hide_text( int value) void EvList::set_hide_text( int value)
{ {
if ( type == ev_eType_BlockList)
return;
hide_text = value; hide_text = value;
update_text(); update_text();
} }
...@@ -1371,21 +1572,44 @@ int EvList::id_to_item( mh_sEventId *id, void **item) ...@@ -1371,21 +1572,44 @@ int EvList::id_to_item( mh_sEventId *id, void **item)
ItemAlarm *object_item; ItemAlarm *object_item;
brow_GetObjectList( brow->ctx, &object_list, &object_cnt); brow_GetObjectList( brow->ctx, &object_list, &object_cnt);
for ( i = 0; i < object_cnt; i++)
{ for ( i = 0; i < object_cnt; i++) {
brow_GetUserData( object_list[i], (void **)&object_item); brow_GetUserData( object_list[i], (void **)&object_item);
switch( object_item->type) switch( object_item->type) {
{ case evlist_eItemType_Alarm:
case evlist_eItemType_Alarm: if ( memcmp( &object_item->eventid, id, sizeof(object_item->eventid))
if ( memcmp( &object_item->eventid, id, sizeof(object_item->eventid)) == 0) {
== 0) *item = (void *)object_item;
{ return 1;
*item = (void *)object_item; }
return 1; break;
} default:
break; ;
default: }
; }
return 0;
}
int EvList::oid_to_item( pwr_tOid oid, void **item)
{
int i;
brow_tObject *object_list;
int object_cnt;
ItemAlarm *object_item;
brow_GetObjectList( brow->ctx, &object_list, &object_cnt);
for ( i = 0; i < object_cnt; i++) {
brow_GetUserData( object_list[i], (void **)&object_item);
switch( object_item->type) {
case evlist_eItemType_Alarm:
if ( cdh_ObjidIsEqual( object_item->object, oid)) {
*item = (void *)object_item;
return 1;
}
break;
default:
;
} }
} }
return 0; return 0;
......
...@@ -72,14 +72,17 @@ typedef struct { ...@@ -72,14 +72,17 @@ typedef struct {
typedef enum { typedef enum {
ev_eType_AlarmList, ev_eType_AlarmList,
ev_eType_EventList, ev_eType_EventList,
ev_eType_HistList ev_eType_HistList,
ev_eType_BlockList
} ev_eType; } ev_eType;
typedef enum { typedef enum {
evlist_eEventType_Info, evlist_eEventType_Info,
evlist_eEventType_Return, evlist_eEventType_Return,
evlist_eEventType_Ack, evlist_eEventType_Ack,
evlist_eEventType_Alarm evlist_eEventType_Alarm,
evlist_eEventType_Block,
evlist_eEventType_Cancel
} evlist_eEventType; } evlist_eEventType;
typedef enum { typedef enum {
...@@ -107,6 +110,8 @@ class EvListBrow { ...@@ -107,6 +110,8 @@ class EvListBrow {
flow_sAnnotPixmap *pixmap_eventalarm; flow_sAnnotPixmap *pixmap_eventalarm;
flow_sAnnotPixmap *pixmap_eventacked; flow_sAnnotPixmap *pixmap_eventacked;
flow_sAnnotPixmap *pixmap_eventreturn; flow_sAnnotPixmap *pixmap_eventreturn;
flow_sAnnotPixmap *pixmap_blockr;
flow_sAnnotPixmap *pixmap_blockl;
void free_pixmaps(); void free_pixmaps();
void allocate_pixmaps(); void allocate_pixmaps();
...@@ -145,12 +150,15 @@ class EvList { ...@@ -145,12 +150,15 @@ class EvList {
void event_info( mh_sMessage *msg); void event_info( mh_sMessage *msg);
void event_alarm( mh_sMessage *msg); void event_alarm( mh_sMessage *msg);
void event_block( mh_sBlock *msg);
void event_cancel( mh_sReturn *msg);
void event_ack( mh_sAck *msg); void event_ack( mh_sAck *msg);
void event_return( mh_sReturn *msg); void event_return( mh_sReturn *msg);
void event_clear_alarmlist( pwr_tNodeIndex nix); void event_clear_alarmlist( pwr_tNodeIndex nix);
int get_last_not_acked( mh_sEventId **id); int get_last_not_acked( mh_sEventId **id);
int get_last_not_acked_beep( mh_sEventId **id); int get_last_not_acked_beep( mh_sEventId **id);
int id_to_item( mh_sEventId *id, void **item); int id_to_item( mh_sEventId *id, void **item);
int oid_to_item( pwr_tOid oid, void **item);
void ack( mh_sEventId *id); void ack( mh_sEventId *id);
void set_input_focus(); void set_input_focus();
void zoom( double zoom_factor); void zoom( double zoom_factor);
...@@ -168,6 +176,7 @@ class EvList { ...@@ -168,6 +176,7 @@ class EvList {
int get_last_not_acked_prio( mh_sEventId **id, unsigned long type, unsigned long prio); int get_last_not_acked_prio( mh_sEventId **id, unsigned long type, unsigned long prio);
int get_selected_event( char *eventname); int get_selected_event( char *eventname);
int get_destination( pwr_tTime time, void **dest); int get_destination( pwr_tTime time, void **dest);
void block_remove();
}; };
class ItemAlarm { class ItemAlarm {
......
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