Commit f1019d94 authored by Claes Sjofors's avatar Claes Sjofors

Xtt multiview windows, alarmlist satellites and runtime priviliges for plc, navigator and alarm ack

parent 3fade0fe
......@@ -1547,6 +1547,7 @@ logout <t>User logout <LINK> logout
logging <t>Logg attributes to file <LINK> logging
open fileview <t>Open a fileview <LINK> open fileview
open graph <t>Open a graph <LINK> open graph
open multiview <t>Open a multiview <LINK> open multiview
open jgraph <t>Open a java graph <LINK> open jgraph
open navigator <t>Open the navigator <LINK> open navigator
open operatorwindow<t>Open the operator window <LINK> open operatorwindow
......@@ -2063,6 +2064,19 @@ a XttGraph object.
/pinstance <t>Instance name for the pwindow graph, if pwindow is an object
<t>graph.
</TOPIC>
Command open multiview
Open a multiview window specified by an XttMultiView object.
<B>xtt> open multiview 'objectname' /width= /height= /xposition= /yposition=
<t><t>/fullscreen /maximize /fullmaximize /iconify /hide
/width <t>Window width in pixels.
/height <t>Window height in pixels.
/xposition <t>Window x position in pixels.
/yposition <t>Window y position in pixels.
</TOPIC>
<TOPIC> open jgraph <style> function
Command open jgraph
......@@ -2332,8 +2346,18 @@ and then pressing return.
Command show alarmlist
Open the alarmlist window.
With the 'show alarmlist satellite' command multiple alarmlists can
be opened with differnt alarmview.
<B>xtt> show alarmlist
<B>xtt> show alarmlist satellite [/alarmview=] [/width=] [/height=]
<t><t>[/xposition=] [/yposition=]
/alarmaview <t>Name of an AlarmView object.
/width <t>Window width in pixels.
/height <t>Window height in pixels.
/xposition <t>Window x position in pixels.
/yposition <t>Window y position in pixels.
</TOPIC>
<TOPIC> show eventlist <style> function
......
......@@ -54,19 +54,19 @@ dcli_tCmdTable user_command_table[] = {
{ "dcli_arg1", "dcli_arg2", "/user", "/group",
"/password", "/privilege" , "/description", "/fullname",
"/email", "/phone", "/sms",
"/rtread", "/rtwrite", "/rtevents", "/system",
"/rtread", "/rtwrite", "/rteventsblock", "/rteventsack", "/rtplc", "/rtnavigator", "/system",
"/maintenance", "/process", "/instrument",
"/operator1", "/operator2", "/operator3",
"/operator4", "/operator5", "/operator6",
"/operator7", "/operator8", "/operator9",
"/operator7", /* "/operator8", "/operator9",*/
/* "/oper10",*/ "/devread", "/devplc",
"/devconfig", "/devclass", "/sevread", "/sevadmin",
"/nortread", "/nortwrite", "/nortevents",
"/nortread", "/nortwrite", "/norteventsblock", "/norteventsack", "/nortplc", "/nortnavigator",
"/nosystem",
"/nomaintenance", "/noprocess", "/noinstrument",
"/nooperator1", "/nooperator2", "/nooperator3",
"/nooperator4", "/nooperator5", "/nooperator6",
"/nooperator7", "/nooperator8", "/nooperator9",
"/nooperator7", /* "/nooperator8", "/nooperator9", */
/* "/nooper10",*/ "/nodevread", "/nodevplc",
"/nodevconfig", "/nodevclass", "/nosevread", "/nosevadmin",
"/nouserinherit", "/userinherit",
......@@ -78,7 +78,7 @@ dcli_tCmdTable user_command_table[] = {
{ "dcli_arg1", "dcli_arg2", "/user", "/group",
"/password", "/privilege" , "/fullname", "/description",
"/email", "/phone", "/sms",
"/rtread", "/rtwrite", "/rtevents", "/system",
"/rtread", "/rtwrite", "/rteventsblock", "/rteventsack", "/rtplc", "/rtnavigator", "/system",
"/maintenance", "/process", "/instrument",
"/operator1", "/operator2", "/operator3",
"/operator4", "/operator5", "/operator6",
......@@ -193,7 +193,8 @@ static int user_help_func( void *client_data,
"add group 'systemgroup' /userinherit Add system group." << endl <<
"add user 'user' /group= /password= Add user." << endl <<
" /fullname= /description= /email= /phone= /sms=" << endl <<
" /rtread /rtwrite /rtevents /system /maintenance" << endl <<
" /rtread /rtwrite /rteventsblock /rteventsack /rtplc /rtnavigator" <<
" /system /maintenance" << endl <<
" /process /instrument /operator1 /operator2" << endl <<
" /operator3 /operator4 /operator5 /operator6" << endl <<
" /operator7 /operator8 /operator9 /oper10" << endl <<
......@@ -213,7 +214,8 @@ static int user_help_func( void *client_data,
"pwr_user help" << endl << endl <<
"modify user 'user' /group= /password= Modify user." << endl <<
" /fullname= /description= /email= /phone= /sms=" << endl <<
" /rtread /rtwrite /rtevents /system /maintenance" << endl <<
" /rtread /rtwrite /rteventsblock /rteventsack /rtplc /rtnavigator" <<
" /system /maintenance" << endl <<
" /process /instrument /operator1 /operator2" << endl <<
" /operator3 /operator4 /operator5 /operator6" << endl <<
" /operator7 /operator8 /operator9 /oper10" << endl <<
......@@ -367,8 +369,14 @@ static int user_add_func( void *client_data,
privilege |= pwr_mPrv_RtRead;
if ( ODD( dcli_get_qualifier( "/rtwrite", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtWrite;
if ( ODD( dcli_get_qualifier( "/rtevents", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtEvents;
if ( ODD( dcli_get_qualifier( "/rteventsblock", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtEventsBlock;
if ( ODD( dcli_get_qualifier( "/rteventsack", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtEventsAck;
if ( ODD( dcli_get_qualifier( "/rtplc", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtPlc;
if ( ODD( dcli_get_qualifier( "/rtnavigator", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtNavigator;
if ( ODD( dcli_get_qualifier( "/system", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_System;
if ( ODD( dcli_get_qualifier( "/maintenance", privilege_str, sizeof(privilege_str))))
......@@ -600,8 +608,14 @@ static int user_modify_func( void *client_data,
privilege |= pwr_mPrv_RtRead;
if ( ODD( dcli_get_qualifier( "/rtwrite", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtWrite;
if ( ODD( dcli_get_qualifier( "/rtevents", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtEvents;
if ( ODD( dcli_get_qualifier( "/rteventsblock", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtEventsBlock;
if ( ODD( dcli_get_qualifier( "/rteventsack", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtEventsAck;
if ( ODD( dcli_get_qualifier( "/rtplc", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtPlc;
if ( ODD( dcli_get_qualifier( "/rtnavigator", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_RtNavigator;
if ( ODD( dcli_get_qualifier( "/system", privilege_str, sizeof(privilege_str))))
privilege |= pwr_mPrv_System;
if ( ODD( dcli_get_qualifier( "/maintenance", privilege_str, sizeof(privilege_str))))
......@@ -647,8 +661,14 @@ static int user_modify_func( void *client_data,
privilege &= ~pwr_mPrv_RtRead;
if ( ODD( dcli_get_qualifier( "/nortwrite", privilege_str, sizeof(privilege_str))))
privilege &= ~pwr_mPrv_RtWrite;
if ( ODD( dcli_get_qualifier( "/nortevents", privilege_str, sizeof(privilege_str))))
privilege &= ~pwr_mPrv_RtEvents;
if ( ODD( dcli_get_qualifier( "/norteventsblock", privilege_str, sizeof(privilege_str))))
privilege &= ~pwr_mPrv_RtEventsBlock;
if ( ODD( dcli_get_qualifier( "/norteventsack", privilege_str, sizeof(privilege_str))))
privilege &= ~pwr_mPrv_RtEventsAck;
if ( ODD( dcli_get_qualifier( "/nortplc", privilege_str, sizeof(privilege_str))))
privilege &= ~pwr_mPrv_RtPlc;
if ( ODD( dcli_get_qualifier( "/nortnavigator", privilege_str, sizeof(privilege_str))))
privilege &= ~pwr_mPrv_RtNavigator;
if ( ODD( dcli_get_qualifier( "/nosystem", privilege_str, sizeof(privilege_str))))
privilege &= ~pwr_mPrv_System;
if ( ODD( dcli_get_qualifier( "/nomaintenance", privilege_str, sizeof(privilege_str))))
......
......@@ -59,11 +59,14 @@ typedef enum {
pwr_mPrv_Operator8 = 1 << 13,
pwr_mPrv_Operator9 = 1 << 14,
pwr_mPrv_Operator10 = 1 << 15,
pwr_mPrv_RtEventsAck = 1 << 18,
pwr_mPrv_RtPlc = 1 << 19,
pwr_mPrv_RtNavigator = 1 << 20,
pwr_mPrv_DevRead = 1 << 21,
pwr_mPrv_DevPlc = 1 << 22,
pwr_mPrv_DevConfig = 1 << 23,
pwr_mPrv_DevClass = 1 << 24,
pwr_mPrv_RtEvents = 1 << 25,
pwr_mPrv_RtEventsBlock = 1 << 25,
pwr_mPrv_Administrator = 1 << 26,
pwr_mPrv_SevRead = 1 << 27,
pwr_mPrv_SevAdmin = 1 << 28
......@@ -86,14 +89,20 @@ typedef enum {
pwr_mAccess_Operator8 = pwr_mPrv_Operator8,
pwr_mAccess_Operator9 = pwr_mPrv_Operator9,
pwr_mAccess_Operator10 = pwr_mPrv_Operator10,
pwr_mAccess_RtEvents = pwr_mPrv_RtEvents,
pwr_mAccess_RtEventsBlock = pwr_mPrv_RtEventsBlock,
pwr_mAccess_RtEventsAck = pwr_mPrv_RtEventsAck,
pwr_mAccess_RtPlc = pwr_mPrv_RtPlc,
pwr_mAccess_RtNavigator = pwr_mPrv_RtNavigator,
pwr_mAccess_AllRt = pwr_mPrv_System |
pwr_mPrv_Maintenance |
pwr_mPrv_Process |
pwr_mPrv_Instrument |
pwr_mPrv_RtRead |
pwr_mPrv_RtWrite |
pwr_mPrv_RtEvents |
pwr_mPrv_RtEventsBlock |
pwr_mPrv_RtEventsAck |
pwr_mPrv_RtPlc |
pwr_mPrv_RtNavigator |
pwr_mPrv_Operator1 |
pwr_mPrv_Operator2 |
pwr_mPrv_Operator3 |
......@@ -108,7 +117,10 @@ typedef enum {
pwr_mPrv_Maintenance |
pwr_mPrv_Process |
pwr_mPrv_Instrument |
pwr_mPrv_RtEvents |
pwr_mPrv_RtEventsBlock |
pwr_mPrv_RtEventsAck |
pwr_mPrv_RtPlc |
pwr_mPrv_RtNavigator |
pwr_mPrv_Operator1 |
pwr_mPrv_Operator2 |
pwr_mPrv_Operator3 |
......
......@@ -1123,7 +1123,10 @@ void GeUser::priv_to_string( unsigned int priv, char *str, int size)
buff[0] = 0;
if ( priv & pwr_mPrv_RtRead) strcat(buff, "RtRead ");
if ( priv & pwr_mPrv_RtWrite) strcat(buff, "RtWrite ");
if ( priv & pwr_mPrv_RtEvents) strcat(buff, "RtEvents ");
if ( priv & pwr_mPrv_RtEventsBlock) strcat(buff, "RtEventsBlock ");
if ( priv & pwr_mPrv_RtEventsAck) strcat(buff, "RtEventsAck ");
if ( priv & pwr_mPrv_RtPlc) strcat(buff, "RtPlc ");
if ( priv & pwr_mPrv_RtNavigator) strcat(buff, "RtNavigator ");
if ( priv & pwr_mPrv_System) strcat(buff, "System ");
if ( priv & pwr_mPrv_Maintenance) strcat(buff, "Maintenance ");
if ( priv & pwr_mPrv_Process) strcat(buff, "Process ");
......@@ -1156,7 +1159,10 @@ void GeUser::rt_priv_to_string( unsigned int priv, char *str, int size)
buff[0] = 0;
if ( priv & pwr_mPrv_RtRead) strcat(buff, "RtRead ");
if ( priv & pwr_mPrv_RtWrite) strcat(buff, "RtWrite ");
if ( priv & pwr_mPrv_RtEvents) strcat(buff, "RtEvents ");
if ( priv & pwr_mPrv_RtEventsBlock) strcat(buff, "RtEventsBlock ");
if ( priv & pwr_mPrv_RtEventsAck) strcat(buff, "RtEventsAck ");
if ( priv & pwr_mPrv_RtPlc) strcat(buff, "RtPlc ");
if ( priv & pwr_mPrv_RtNavigator) strcat(buff, "RtNavigator ");
if ( priv & pwr_mPrv_System) strcat(buff, "System ");
if ( priv & pwr_mPrv_Maintenance) strcat(buff, "Maintenance ");
if ( priv & pwr_mPrv_Process) strcat(buff, "Process ");
......
!
! 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.
!
! pwrb_c_a_multiviewelement.wb_load -- Defines the class MultiViewElement.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Operator,NodeConfiguration
!
! Definition of an array element in a XttMultiView object, describing
! the content of one part of the view.
!
! @b See also
! @classlink XttMultiView pwrb_xttmultiview.html
!*/
!
Object MultiViewElement $ClassDef 605
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "MultiViewElement"
EndBody
!/**
! Optional name that it used to reference the element
! from for example xtt command 'set subwindow'.
!*/
Object Name $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
!/**
! Content type.
! - Graph A Ge graph.
! - ObjectGraph A Ge object or hierarchy graph.(NYI)
! - AlarmList An alarm list
!*/
Object Type $Attribute 2
Body SysBody
Attr TypeRef = "pwrb:Type-MultiViewContentEnum"
EndBody
EndObject
!/**
! @Summary Action to be performed.
! Action to be performed
! - Graph, the name of the pwg-file for the graph, for example "my_graph.pwg"
! - ObjectGraph, not used,
! - Alarm list, not used.
!*/
Object Action $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! X position in pixel for the window.
! Only used for Fix layout.
!*/
Object X $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Y position in pixel for the window.
! Only used for Fix layout.
!*/
Object Y $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Width of the window in pixel.
!*/
Object Width $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Height of the window in pixel.
!*/
Object Height $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Name of an object, if action is opening a class graph for a
! specific object.
! For an alarm list element, this can be an AlarmView object.
!*/
Object Object $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
EndBody
EndObject
!/**
! Element options.
! - Menu, a menu is created. For window managers with one
! common menu row, only one menu is displayed.
! - Scrollbars, scrollbars are viewed.
! - Excangable, a Ge graph can be exchanged with the 'set subwindow' command (NYI).
!*/
Object Options $Attribute 9
Body SysBody
Attr TypeRef = "pwrb:Type-MultiViewElemOptionsMask"
EndBody
EndObject
EndObject
EndObject
EndSObject
!
! 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.
!
! pwrb_c_xttgraph.wb_load -- Defines the class XttGraph.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Operator,NodeConfiguration
! @Summary Defines the action of a pushbutton in the operator window
! The XttMultiView object defines a xtt window that is built by a number
! Ge graphs and alarm windows.
! The window is structured as a table with rows and columns.
! The content and layout of each table cell is specified in the Action array.
! Each element in the action array correspons to a cell in the table where
! index 0 is the top cell in the first column, index 1 the second row in
! the first column etc.
!
! For ge graps the pwg-file for the graph is specified, and, if the graph
! is an object graph or hierarchy graph, also the object is specified.
! For alarm windows an alarm view can be specified in the Object attribute.
!
! The multiwiew are opened by the xtt command
!
! > open multiview 'object' [/width=] [/height=] [/xpos=] [/ypos=]
!
! This command can be inserted into an XttGraph object and thus be opened
! as a fast avail or startup application.
!
! @b See also
! @classlink OpPlace pwrb_opplace.html
!*/
!
Object XttMultiView $ClassDef 606
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "XttMultiView"
EndBody
!/**
! Description of the object.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Layout management.
! - Box
! - Fix (NYI)
! - Table (NYI)
!*/
Object Layout $Attribute 2
Body SysBody
Attr TypeRef = "pwrb:Type-MultiViewLayoutEnum"
Attr Flags = 0
EndBody
EndObject
!/**
! Number of columns.
!*/
Object Columns $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags = 0
EndBody
EndObject
!/**
! Number of rows.
!*/
Object Rows $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Array with actions for each element of the view.
!*/
Object Action $Attribute 5
Body SysBody
Attr TypeRef = "pwrb:Class-MultiViewElement"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_CLASS
Attr Elements = 25
EndBody
EndObject
!/**
! Title of the window.
!*/
Object Title $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
!/**
! Text of the pushbutton in the operator window (NYI).
!*/
Object ButtonText $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
!/**
! X position in pixel for the window.
!*/
Object X $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags = 0
EndBody
EndObject
!/**
! Y position in pixel for the window.
!*/
Object Y $Attribute 9
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags = 0
EndBody
EndObject
!/**
! Width of the window in pixel.
!*/
Object Width $Attribute 10
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags = 0
EndBody
EndObject
!/**
! Height of the window in pixel.
!*/
Object Height $Attribute 11
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags = 0
EndBody
EndObject
!/**
! Options for the graph.
!
! - FullScreen Open the graph as full screen without frame.
! - Maximize Open the graph maximized, not covering the operator window (NYI).
! - FullMaximize Open the graph maximized, covering the operator window.
! - Iconify Open the graph iconified.
! - ColumnSeparators Vertical separators between the columns added.
! - RowSeparators Horizontal separators between the rows added.
!*/
Object Options $Attribute 12
Body SysBody
Attr TypeRef = "pwrb:Type-MultiViewOptionsMask"
Attr Flags = 0
EndBody
EndObject
!/**
! @Summary Configuration status.
! Configuration status.
! Status in the development environment for an hierarchy,
! plcprogram or process graph, set by the designer to indicate
! the current state. If a status is set for an object, it is
! marked red, yellow or green in the configurator. Also the
! status text if viewed surrounded by angel brackets.
!*/
Object ConfigurationStatus $Attribute 13
Body SysBody
Attr TypeRef = "pwrs:Type-$ConfigStatusEnum"
EndBody
EndObject
EndObject
Object Template XttMultiView
Body RtBody
EndBody
EndObject
EndObject
EndSObject
!
! 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.
!
! pwrb_webtargetenum.wb_load -- Defines the enum type WebTargetEnum
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Content of XttMultiView element.
!
! @b See also
! @classlink XttMultiView pwrb_xttmultiview.html
!*/
Object MultiViewContentEnum $TypeDef 68
Body SysBody
Attr TypeRef = "pwrs:Type-$Enum"
Attr PgmName = "MultiViewContentEnum"
EndBody
!/**
! Graph.
!*/
Object Graph $Value
Body SysBody
Attr PgmName = "Graph"
Attr Text = "Graph"
Attr Value = 0
EndBody
EndObject
!/**
! Object graph.
!*/
Object ObjectGraph $Value
Body SysBody
Attr PgmName = "ObjectGraph"
Attr Text = "ObjectGraph"
Attr Value = 1
EndBody
EndObject
!/**
! Alarm list.
!*/
Object AlarmList $Value
Body SysBody
Attr PgmName = "AlarmList"
Attr Text = "AlarmList"
Attr Value = 2
EndBody
EndObject
!/**
! Multiview.
!*/
Object MultiView $Value
Body SysBody
Attr PgmName = "MultiView"
Attr Text = "MultiView"
Attr Value = 3
EndBody
EndObject
EndObject
EndSObject
!
! 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.
!
! pwrb_multiviewelemoptionsmask.wb_load -- Defines the mask type MultiViewElemOptionsMask
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Bitmask for xtt multiview element options.
!
! @b See also
! @classlink XttMultiView pwrb_xttmultiview.html
!*/
Object MultiViewElemOptionsMask $TypeDef 71
Body SysBody
Attr Type = pwr_eType_Mask
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Mask"
Attr Elements = 1
EndBody
!/**
! Menu.
!*/
Object Menu $Bit
Body SysBody
Attr PgmName = "Menu"
Attr Text = "Menu"
Attr Value = 1
EndBody
EndObject
!/**
! Scrollbars.
!*/
Object Scrollbars $Bit
Body SysBody
Attr PgmName = "Scrollbars"
Attr Text = "Scrollbars"
Attr Value = 2
EndBody
EndObject
!/**
! Exchangable.
!*/
Object Exchangable $Bit
Body SysBody
Attr PgmName = "Exchangeable"
Attr Text = "Exchangeable"
Attr Value = 4
EndBody
EndObject
EndObject
EndSObject
!
! 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.
!
! pwrb_multiviewlayoutenum.wb_load -- Defines the enum type MultiViewLayout
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Layout of an XttMultiView window.
!
! @b See also
! @classlink XttMultiView pwrb_xttmultiview.html
!*/
Object MultiViewLayoutEnum $TypeDef 69
Body SysBody
Attr TypeRef = "pwrs:Type-$Enum"
Attr PgmName = "MultiViewLayoutEnum"
EndBody
!/**
! Box layout.
!*/
Object Box $Value
Body SysBody
Attr PgmName = "Box"
Attr Text = "Box"
Attr Value = 0
EndBody
EndObject
!/**
! Fix layout.
!*/
Object Fix $Value
Body SysBody
Attr PgmName = "Fix"
Attr Text = "Fix"
Attr Value = 1
EndBody
EndObject
!/**
! Table layout.
!*/
Object Table $Value
Body SysBody
Attr PgmName = "Table"
Attr Text = "Table"
Attr Value = 2
EndBody
EndObject
EndObject
EndSObject
!
! 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.
!
! pwrb_multiviewoptionsmask.wb_load -- Defines the mask type MultiViewOptionsMask
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Bitmask for xtt multiview options.
!
! @b See also
! @classlink XttMultiView pwrb_xttmultiview.html
!*/
Object MultiViewOptionsMask $TypeDef 70
Body SysBody
Attr Type = pwr_eType_Mask
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Mask"
Attr Elements = 1
EndBody
!/**
! Full screen.
!*/
Object FullSceen $Bit
Body SysBody
Attr PgmName = "FullScreen"
Attr Text = "FullScreen"
Attr Value = 1
EndBody
EndObject
!/**
! Maximize.
!*/
Object Maximize $Bit
Body SysBody
Attr PgmName = "Maximize"
Attr Text = "Maximize"
Attr Value = 2
EndBody
EndObject
!/**
! Full maximize.
!*/
Object FullMaximize $Bit
Body SysBody
Attr PgmName = "FullMaximize"
Attr Text = "FullMaximize"
Attr Value = 4
EndBody
EndObject
!/**
! Iconify.
!*/
Object Iconify $Bit
Body SysBody
Attr PgmName = "Iconify"
Attr Text = "Iconify"
Attr Value = 8
EndBody
EndObject
!/**
! Column separators.
!*/
Object ColumnSeparators $Bit
Body SysBody
Attr PgmName = "ColumnSeparators"
Attr Text = "ColumnSeparators"
Attr Value = 16
EndBody
EndObject
!/**
! RowSeparators.
!*/
Object RowSeparators $Bit
Body SysBody
Attr PgmName = "RowSeparators"
Attr Text = "RowSeparators"
Attr Value = 64
EndBody
EndObject
EndObject
EndSObject
......@@ -72,7 +72,7 @@ SObject pwrb:Type
EndBody
EndObject
!/**
! Hide Status bar.
! Full maximize.
!*/
Object FullMaximize $Bit
Body SysBody
......
......@@ -211,6 +211,36 @@ SObject pwrs:Type
EndBody
EndObject
!/**
! Event acknowledge privilege
!*/
Object RtEventsAck $Bit
Body SysBody
Attr PgmName = "RtEventsAck"
Attr Text = "RtEventsAck"
Attr Value = 262144
EndBody
EndObject
!/**
! Runtime Plc priviledge
!*/
Object RtPlc $Bit
Body SysBody
Attr PgmName = "RtPlc"
Attr Text = "RtPlc"
Attr Value = 524288
EndBody
EndObject
!/**
! Runtime navigator priviledge
!*/
Object RtNavigator $Bit
Body SysBody
Attr PgmName = "RtNavigator"
Attr Text = "RtNavigator"
Attr Value = 1048576
EndBody
EndObject
!/**
! Read access in development environment
!*/
Object DevRead $Bit
......@@ -253,10 +283,10 @@ SObject pwrs:Type
!/**
! Event blocking privilege
!*/
Object RtEvents $Bit
Object RtEventsBlock $Bit
Body SysBody
Attr PgmName = "RtEvents"
Attr Text = "RtEvents"
Attr PgmName = "RtEventsBlock"
Attr Text = "RtEventsBlock"
Attr Value = 33554432
EndBody
EndObject
......
......@@ -1433,10 +1433,11 @@ int FlowDrawGtk::pixmaps_create( FlowCtx *ctx, flow_sPixmapData *pixmap_data,
pms = (draw_sPixmap *) calloc( 1, sizeof( *pms));
for ( i = 0; i < DRAW_PIXMAP_SIZE; i++) {
if ( i == 0 ||
(i > 0 && pdata->bits != prev_pdata->bits))
(i > 0 && pdata->bits != prev_pdata->bits)) {
pms->pixmap[i] = gdk_pixmap_create_from_data(
window, pdata->bits, pdata->width,
pdata->height, 1, &foreground, &background);
}
else
pms->pixmap[i] = pms->pixmap[i-1];
prev_pdata = pdata;
......@@ -1454,8 +1455,9 @@ void FlowDrawGtk::pixmaps_delete( FlowCtx *ctx, void *pixmaps)
pms = (draw_sPixmap *) pixmaps;
for ( i = 0; i < DRAW_PIXMAP_SIZE; i++) {
if ( i == 0 ||
(i > 0 && pms->pixmap[i] != pms->pixmap[i-1]))
(i > 0 && pms->pixmap[i] != pms->pixmap[i-1])) {
g_object_unref( pms->pixmap[i]);
}
}
free ( pixmaps);
}
......
......@@ -832,3 +832,8 @@ void brow_SetTextCoding( brow_tCtx ctx, flow_eTextCoding coding)
ctx->set_text_coding( coding);
}
void brow_ChangeObjectNodeClass( brow_tObject object, brow_tNodeClass new_nc)
{
((FlowNode *)object)->change_nodeclass( (FlowNodeClass *)new_nc);
}
......@@ -267,6 +267,7 @@ void brow_SetTipText( brow_tCtx ctx, brow_tObject object, char *text, int x, int
void brow_SetInverseColor( brow_tCtx ctx, flow_eDrawType color);
int brow_GetObjectLevel( brow_tObject object);
void brow_SetTextCoding( brow_tCtx ctx, flow_eTextCoding coding);
void brow_ChangeObjectNodeClass( brow_tObject object, brow_tNodeClass new_nc);
#if defined __cplusplus
}
......
......@@ -173,6 +173,7 @@ void BrowCtx::zoom( double factor)
clear();
draw( 0, 0, window_width, window_height);
nav_zoom();
a_nc.zoom(); // Zoom inactive nodeclasses
change_scrollbar();
}
......
......@@ -1084,3 +1084,13 @@ int FlowNode::get_next_conpoint( int cp_num, flow_eDirection dir, double x0, dou
{
return nc->get_next_conpoint( cp_num, dir, x0 - pos.x, y0 - pos.y, next_cp_num);
}
void FlowNode::change_nodeclass( FlowNodeClass *new_nc)
{
erase();
nc = new_nc;
if ( !inverse)
nc->draw( &pos, highlight, hot, (void *)this);
else
draw_inverse();
}
......@@ -104,6 +104,7 @@ class FlowNode : public FlowArrayElem {
int nodraw);
void get_annot_pixmap( int num, flow_sAnnotPixmap **pixmap);
void remove_annot_pixmap( int num);
void change_nodeclass( FlowNodeClass *new_nc);
double x_right;
double x_left;
double y_high;
......
......@@ -6574,6 +6574,11 @@ void GeTrend::get_attributes( attr_sItem *attrinfo, int *item_count)
attrinfo[i].type = glow_eType_String;
attrinfo[i++].size = sizeof( maxvalue_attr2);
strcpy( attrinfo[i].name, "Trend.HoldAttr");
attrinfo[i].value = hold_attr;
attrinfo[i].type = glow_eType_String;
attrinfo[i++].size = sizeof( hold_attr);
*item_count = i;
}
......@@ -6607,6 +6612,7 @@ void GeTrend::replace_attribute( char *from, char *to, int *cnt, int strict)
GeDyn::replace_attribute( maxvalue_attr1, sizeof(maxvalue_attr1), from, to, cnt, strict);
GeDyn::replace_attribute( minvalue_attr2, sizeof(minvalue_attr2), from, to, cnt, strict);
GeDyn::replace_attribute( maxvalue_attr2, sizeof(maxvalue_attr2), from, to, cnt, strict);
GeDyn::replace_attribute( hold_attr, sizeof(hold_attr), from, to, cnt, strict);
}
void GeTrend::save( ofstream& fp)
......@@ -6618,6 +6624,7 @@ void GeTrend::save( ofstream& fp)
fp << int(ge_eSave_Trend_maxvalue_attr1) << FSPACE << maxvalue_attr1 << endl;
fp << int(ge_eSave_Trend_minvalue_attr2) << FSPACE << minvalue_attr2 << endl;
fp << int(ge_eSave_Trend_maxvalue_attr2) << FSPACE << maxvalue_attr2 << endl;
fp << int(ge_eSave_Trend_hold_attr) << FSPACE << hold_attr << endl;
fp << int(ge_eSave_End) << endl;
}
......@@ -6663,6 +6670,10 @@ void GeTrend::open( ifstream& fp)
fp.get();
fp.getline( maxvalue_attr2, sizeof(maxvalue_attr2));
break;
case ge_eSave_Trend_hold_attr:
fp.get();
fp.getline( hold_attr, sizeof(hold_attr));
break;
case ge_eSave_End: end_found = 1; break;
default:
cout << "GeTrend:open syntax error" << endl;
......@@ -6762,6 +6773,24 @@ int GeTrend::connect( grow_tObject object, glow_sTraceData *trace_data)
&max_value_subid2, attr_size);
}
hold_p = 0;
hold_db = dyn->parse_attr_name( hold_attr, parsed_name,
&inverted, &attr_type, &attr_size);
if ( strcmp( parsed_name,"") != 0 && attr_type == pwr_eType_Boolean) {
switch ( hold_db) {
case graph_eDatabase_Gdh:
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&hold_p,
&hold_subid, attr_size);
if ( EVEN(sts)) return sts;
break;
case graph_eDatabase_Local:
hold_p = (pwr_tBoolean *) dyn->graph->localdb_ref_or_create( parsed_name, attr_type);
break;
default:
;
}
}
trace_data->p = &pdummy;
first_scan = true;
return 1;
......@@ -6791,6 +6820,10 @@ int GeTrend::disconnect( grow_tObject object)
gdh_UnrefObjectInfo( max_value_subid2);
max_value2_p = 0;
}
if ( hold_p && hold_db == graph_eDatabase_Gdh) {
gdh_UnrefObjectInfo( hold_subid);
hold_p = 0;
}
return 1;
}
......@@ -6798,6 +6831,8 @@ int GeTrend::scan( grow_tObject object)
{
if ( !p1 && !p2)
return 1;
if ( hold_p)
trend_hold = *hold_p;
if ( trend_hold)
return 1;
......
......@@ -412,6 +412,7 @@
ge_eSave_Trend_maxvalue_attr1 = 2303,
ge_eSave_Trend_minvalue_attr2 = 2304,
ge_eSave_Trend_maxvalue_attr2 = 2305,
ge_eSave_Trend_hold_attr = 2306,
ge_eSave_DigFlash_attribute = 2600,
ge_eSave_DigFlash_color = 2601,
ge_eSave_DigFlash_color2 = 2602,
......@@ -2194,6 +2195,7 @@ class GeTrend : public GeDynElem {
pwr_tAName maxvalue_attr1;
pwr_tAName minvalue_attr2;
pwr_tAName maxvalue_attr2;
pwr_tAName hold_attr;
bool first_scan;
double scan_time;
......@@ -2221,19 +2223,25 @@ class GeTrend : public GeDynElem {
pwr_tFloat32 old_max_value2;
pwr_tSubid min_value_subid2;
pwr_tSubid max_value_subid2;
pwr_tBoolean *hold_p;
graph_eDatabase hold_db;
pwr_tSubid hold_subid;
GeTrend( GeDyn *e_dyn) :
GeDynElem(e_dyn, ge_mDynType1_Trend, ge_mDynType2_No, ge_mActionType1_No, ge_mActionType2_No, ge_eDynPrio_Trend),
min_value1_p(0), max_value1_p(0), old_min_value1(0), old_max_value1(0),
min_value2_p(0), max_value2_p(0), old_min_value2(0), old_max_value2(0)
min_value2_p(0), max_value2_p(0), old_min_value2(0), old_max_value2(0),
hold_p(0)
{ strcpy( attribute1, ""); strcpy( attribute2, "");
strcpy( minvalue_attr1, ""); strcpy( maxvalue_attr1, "");
strcpy( minvalue_attr2, ""); strcpy( maxvalue_attr2, "");}
strcpy( minvalue_attr2, ""); strcpy( maxvalue_attr2, "");
strcpy( hold_attr, "");}
GeTrend( const GeTrend& x) :
GeDynElem(x.dyn,x.dyn_type1,x.dyn_type2,x.action_type1,x.action_type2,x.prio)
{ strcpy( attribute1, x.attribute1); strcpy( attribute2, x.attribute2);
strcpy( minvalue_attr1, x.minvalue_attr1); strcpy( maxvalue_attr1, x.maxvalue_attr1);
strcpy( minvalue_attr2, x.minvalue_attr2); strcpy( maxvalue_attr2, x.maxvalue_attr2);}
strcpy( minvalue_attr2, x.minvalue_attr2); strcpy( maxvalue_attr2, x.maxvalue_attr2);
strcpy( hold_attr, x.hold_attr);}
void get_attributes( attr_sItem *attrinfo, int *item_count);
void save( ofstream& fp);
void open( ifstream& fp);
......
......@@ -66,7 +66,6 @@ static int graph_attr_boolean( Graph *graph, pwr_sAttrRef *attrref);
static int graph_object_ix( Graph *graph, pwr_sAttrRef *attrref);
static int graph_object_ax( Graph *graph, pwr_sAttrRef *attrref);
static int graph_object_dx( Graph *graph, pwr_sAttrRef *attrref);
static int graph_object_chanxx( Graph *graph, pwr_sAttrRef *attrref);
static int graph_object_PID( Graph *graph, pwr_sAttrRef *attrref);
static int graph_object_PlcThread( Graph *graph, pwr_sAttrRef *attrref);
static int graph_object_collect( Graph *graph, pwr_sAttrRef *attrref);
......@@ -82,12 +81,6 @@ static graph_sObjectFunction graph_object_functions[] = {
{ pwr_cClass_Dv, &graph_object_dx},
{ pwr_cClass_Di, &graph_object_dx},
{ pwr_cClass_Do, &graph_object_dx},
{ pwr_cClass_ChanAi, &graph_object_chanxx},
{ pwr_cClass_ChanAo, &graph_object_chanxx},
{ pwr_cClass_ChanIi, &graph_object_chanxx},
{ pwr_cClass_ChanIo, &graph_object_chanxx},
{ pwr_cClass_ChanDi, &graph_object_chanxx},
{ pwr_cClass_ChanDo, &graph_object_chanxx},
{ pwr_cClass_pid, &graph_object_PID},
{ /* pwr_cClass_CompPID */ 656576UL, &graph_object_PID},
{ pwr_cClass_PlcThread, &graph_object_PlcThread},
......@@ -841,51 +834,6 @@ static int graph_object_dx( Graph *graph, pwr_sAttrRef *arp)
}
//
// Graph for channel
//
static int graph_object_chanxx( Graph *graph, pwr_sAttrRef *arp)
{
pwr_sAttrRef attrref;
int sts;
pwr_tClassId classid;
pwr_sAttrRef sigchancon;
pwr_tClassId signal_classid;
char classname[40];
char signal_name[120];
char cmd[200];
sts = gdh_GetAttrRefTid( arp, &classid);
if ( EVEN(sts)) return sts;
// Add command to open signal graph
sts = gdh_ArefANameToAref( arp, "SigChanCon", &attrref);
if ( ODD(sts)) {
sts = gdh_GetObjectInfoAttrref( &attrref, (void *)&sigchancon, sizeof(sigchancon));
if ( EVEN(sts)) return sts;
sts = gdh_AttrrefToName( &sigchancon, signal_name, sizeof(signal_name),
cdh_mNName);
if ( ODD(sts))
{
sts = gdh_GetAttrRefTid( &sigchancon, &signal_classid);
if ( EVEN(sts)) return sts;
sts = gdh_ObjidToName( cdh_ClassIdToObjid( signal_classid),
classname, sizeof(classname), cdh_mName_object);
if ( EVEN(sts)) return sts;
cdh_ToLower( classname, classname);
sprintf( cmd, "ope gr pwr_c_%s/ins=%s/nam=\"%s\"",
classname, signal_name, signal_name);
sts = graph->set_button_command( "OpenSignal", cmd);
}
}
return 1;
}
//
// Object graph for PID
//
......
......@@ -208,7 +208,7 @@ BlockGtk::BlockGtk( void *b_parent_ctx,
gtk_container_add( GTK_CONTAINER(toplevel), vbox);
gtk_widget_show_all( toplevel);
if ( !(priv & pwr_mPrv_RtEvents ||
if ( !(priv & pwr_mPrv_RtEventsBlock ||
priv & pwr_mPrv_System)) {
gtk_widget_set_sensitive( buttonOk, FALSE);
gtk_widget_set_sensitive( buttonApply, FALSE);
......@@ -293,7 +293,7 @@ BlockGtk::BlockGtk( void *b_parent_ctx,
XtPopup( parent_wid, XtGrabNone);
if ( !(priv & pwr_mPrv_RtEvents ||
if ( !(priv & pwr_mPrv_RtEventsBlock ||
priv & pwr_mPrv_System)) {
Arg sensitive[1];
// No access to block
......
This diff is collapsed.
......@@ -76,6 +76,7 @@ class EvGtk : public Ev {
GtkWidget *eve_widget;
GtkWidget *ala_widget;
GtkWidget *blk_widget;
pwr_tObjid alarm_views[25];
void map_eve();
void map_ala();
......@@ -83,6 +84,10 @@ class EvGtk : public Ev {
void unmap_eve();
void unmap_ala();
void unmap_blk();
void set_title_ala( char *title);
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);
static gboolean eve_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static gboolean ala_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
......@@ -123,6 +128,33 @@ class EvGtk : public Ev {
static void blk_activate_help( GtkWidget *w, gpointer data);
static void eve_activate_helpevent( GtkWidget *w, gpointer data);
static void ala_activate_helpevent( GtkWidget *w, gpointer data);
static void ala_activate_shift_view( GtkWidget *w, gpointer data);
static void ala_activate_select_flat( GtkWidget *w, gpointer data);
static void ala_activate_select_view1( GtkWidget *w, gpointer data);
static void ala_activate_select_view2( GtkWidget *w, gpointer data);
static void ala_activate_select_view3( GtkWidget *w, gpointer data);
static void ala_activate_select_view4( GtkWidget *w, gpointer data);
static void ala_activate_select_view5( GtkWidget *w, gpointer data);
static void ala_activate_select_view6( GtkWidget *w, gpointer data);
static void ala_activate_select_view7( GtkWidget *w, gpointer data);
static void ala_activate_select_view8( GtkWidget *w, gpointer data);
static void ala_activate_select_view9( GtkWidget *w, gpointer data);
static void ala_activate_select_view10( GtkWidget *w, gpointer data);
static void ala_activate_select_view11( GtkWidget *w, gpointer data);
static void ala_activate_select_view12( GtkWidget *w, gpointer data);
static void ala_activate_select_view13( GtkWidget *w, gpointer data);
static void ala_activate_select_view14( GtkWidget *w, gpointer data);
static void ala_activate_select_view15( GtkWidget *w, gpointer data);
static void ala_activate_select_view16( GtkWidget *w, gpointer data);
static void ala_activate_select_view17( GtkWidget *w, gpointer data);
static void ala_activate_select_view18( GtkWidget *w, gpointer data);
static void ala_activate_select_view19( GtkWidget *w, gpointer data);
static void ala_activate_select_view20( GtkWidget *w, gpointer data);
static void ala_activate_select_view21( GtkWidget *w, gpointer data);
static void ala_activate_select_view22( GtkWidget *w, gpointer data);
static void ala_activate_select_view23( GtkWidget *w, gpointer data);
static void ala_activate_select_view24( GtkWidget *w, gpointer data);
static void ala_activate_select_view25( GtkWidget *w, gpointer data);
};
#endif
......
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_evala_gtk_h
#define xtt_evala_gtk_h
/* xtt_evala_gtk.h -- Alarm window in xtt */
#ifndef xtt_evala_h
# include "xtt_evala.h"
#endif
class EvAlaGtk : public EvAla {
public:
EvAlaGtk(
void *ev_parent_ctx,
GtkWidget *ev_parent_wid,
char *ala_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);
~EvAlaGtk();
GtkWidget *parent_wid;
GtkWidget *parent_wid_ala;
GtkWidget *toplevel;
GtkWidget *ala_widget;
GtkWidget *ala_vbox;
pwr_tObjid alarm_views[25];
void map_ala();
void unmap_ala();
void set_title_ala( char *title);
GtkWidget *get_widget() { return ala_vbox;}
static gboolean ala_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void ala_activate_exit( GtkWidget *w, gpointer data);
static void ala_activate_print( GtkWidget *w, gpointer data);
static void ala_activate_ack_last( GtkWidget *w, gpointer data);
static void ala_activate_ack_all( GtkWidget *w, gpointer data);
static void ala_activate_zoom_in( GtkWidget *w, gpointer data);
static void ala_activate_zoom_out( GtkWidget *w, gpointer data);
static void ala_activate_zoom_reset( GtkWidget *w, gpointer data);
static void ala_activate_open_plc( GtkWidget *w, gpointer data);
static void ala_activate_display_in_xnav( GtkWidget *w, gpointer data);
static void ala_activate_disp_hundredth( GtkWidget *w, gpointer data);
static void ala_activate_hide_object( GtkWidget *w, gpointer data);
static void ala_activate_hide_text( GtkWidget *w, gpointer data);
static void ala_activate_help( GtkWidget *w, gpointer data);
static void ala_activate_helpevent( GtkWidget *w, gpointer data);
static void ala_activate_shift_view( GtkWidget *w, gpointer data);
static void ala_activate_select_flat( GtkWidget *w, gpointer data);
static void ala_activate_select_view1( GtkWidget *w, gpointer data);
static void ala_activate_select_view2( GtkWidget *w, gpointer data);
static void ala_activate_select_view3( GtkWidget *w, gpointer data);
static void ala_activate_select_view4( GtkWidget *w, gpointer data);
static void ala_activate_select_view5( GtkWidget *w, gpointer data);
static void ala_activate_select_view6( GtkWidget *w, gpointer data);
static void ala_activate_select_view7( GtkWidget *w, gpointer data);
static void ala_activate_select_view8( GtkWidget *w, gpointer data);
static void ala_activate_select_view9( GtkWidget *w, gpointer data);
static void ala_activate_select_view10( GtkWidget *w, gpointer data);
static void ala_activate_select_view11( GtkWidget *w, gpointer data);
static void ala_activate_select_view12( GtkWidget *w, gpointer data);
static void ala_activate_select_view13( GtkWidget *w, gpointer data);
static void ala_activate_select_view14( GtkWidget *w, gpointer data);
static void ala_activate_select_view15( GtkWidget *w, gpointer data);
static void ala_activate_select_view16( GtkWidget *w, gpointer data);
static void ala_activate_select_view17( GtkWidget *w, gpointer data);
static void ala_activate_select_view18( GtkWidget *w, gpointer data);
static void ala_activate_select_view19( GtkWidget *w, gpointer data);
static void ala_activate_select_view20( GtkWidget *w, gpointer data);
static void ala_activate_select_view21( GtkWidget *w, gpointer data);
static void ala_activate_select_view22( GtkWidget *w, gpointer data);
static void ala_activate_select_view23( GtkWidget *w, gpointer data);
static void ala_activate_select_view24( GtkWidget *w, gpointer data);
static void ala_activate_select_view25( GtkWidget *w, gpointer data);
};
#endif
......@@ -63,8 +63,10 @@ EvListGtk::EvListGtk( void *ev_parent_ctx,
ev_eType ev_type,
int ev_size,
int ev_eventname_seg,
GtkWidget **w) :
EvList( ev_parent_ctx, ev_type, ev_size, ev_eventname_seg), parent_wid(ev_parent_wid)
GtkWidget **w,
void (*ev_init_cb)(void *)) :
EvList( ev_parent_ctx, ev_type, ev_size, ev_eventname_seg, ev_init_cb),
parent_wid(ev_parent_wid)
{
form_widget = scrolledbrowwidgetgtk_new( init_brow_cb, this, &brow_widget);
......@@ -79,7 +81,14 @@ EvListGtk::EvListGtk( void *ev_parent_ctx,
//
EvListGtk::~EvListGtk()
{
if ( browtree)
delete browtree->ctx;
if ( browtree && browtree != brow)
delete browtree;
if ( browbase && browbase != brow)
delete browbase;
delete brow;
gtk_widget_destroy( form_widget);
}
......
......@@ -51,7 +51,8 @@ class EvListGtk : public EvList {
ev_eType ev_type,
int ev_size,
int ev_evenname_seg,
GtkWidget **w);
GtkWidget **w,
void (*ev_init_cb)(void *) = 0);
~EvListGtk();
GtkWidget *parent_wid;
......
......@@ -203,7 +203,8 @@ void XttGeGtk::activate_exit( GtkWidget *w, gpointer data)
{
XttGe *ge = (XttGe *)data;
delete ge;
if ( !(ge->options & ge_mOptions_Embedded))
delete ge;
}
void XttGeGtk::activate_zoom_in( GtkWidget *w, gpointer data)
......@@ -235,7 +236,7 @@ void XttGeGtk::activate_help( GtkWidget *w, gpointer data)
if ( ge->help_cb) {
cdh_ToLower( key, ge->name);
(ge->help_cb)( ge, key);
(ge->help_cb)( ge->parent_ctx, key);
}
}
......@@ -250,13 +251,14 @@ void XttGeGtk::action_resize( GtkWidget *w, GtkAllocation *allocation, gpointer
XttGeGtk::~XttGeGtk()
{
if ( close_cb)
(close_cb)( this);
(close_cb)( parent_ctx, this);
if ( confirm_widget)
gtk_widget_destroy( confirm_widget);
if ( nav_shell)
gtk_widget_destroy( nav_shell);
delete graph;
gtk_widget_destroy( toplevel);
if ( !(options & ge_mOptions_Embedded))
gtk_widget_destroy( toplevel);
}
void XttGeGtk::pop()
......@@ -285,11 +287,11 @@ XttGeGtk::XttGeGtk( GtkWidget *xg_parent_wid, void *xg_parent_ctx, const char *x
int xg_width, int xg_height, int x, int y, double scan_time,
const char *object_name, int use_default_access, unsigned int access,
unsigned int options, void *basewidget,
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int)) :
XttGe( xg_parent_ctx, xg_name, xg_filename, xg_scrollbar, xg_menu, xg_navigator, xg_width,
xg_height, x, y, scan_time, object_name, use_default_access, access,
xg_height, x, y, scan_time, object_name, use_default_access, access, options,
xg_command_cb, xg_get_current_objects_cb, xg_is_authorized_cb),
parent_wid(xg_parent_wid), nav_shell(0), value_dialog(0), confirm_widget(0), message_dia_widget(0)
{
......@@ -315,26 +317,32 @@ XttGeGtk::XttGeGtk( GtkWidget *xg_parent_wid, void *xg_parent_ctx, const char *x
char *titleutf8 = g_convert( title, -1, "UTF-8", "ISO8859-1", NULL, NULL, NULL);
// Gtk
toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", window_height,
"default-width", window_width,
"title", titleutf8,
NULL);
g_free( titleutf8);
geometry.min_aspect = gdouble(window_width)/window_height;
geometry.max_aspect = gdouble(window_width)/window_height * 1.02;
gtk_window_set_geometry_hints( GTK_WINDOW(toplevel), GTK_WIDGET(toplevel),
&geometry, GDK_HINT_ASPECT);
g_signal_connect( toplevel, "delete_event", G_CALLBACK(delete_event), this);
g_signal_connect( toplevel, "destroy", G_CALLBACK(destroy_event), this);
g_signal_connect( toplevel, "focus-in-event", G_CALLBACK(action_inputfocus), this);
CoWowGtk::SetWindowIcon( toplevel);
if ( basewidget) {
gtk_window_set_transient_for(GTK_WINDOW(toplevel), GTK_WINDOW(basewidget));
if ( !(options & ge_mOptions_Embedded)) {
toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", window_height,
"default-width", window_width,
"title", titleutf8,
NULL);
g_free( titleutf8);
geometry.min_aspect = gdouble(window_width)/window_height;
geometry.max_aspect = gdouble(window_width)/window_height * 1.02;
gtk_window_set_geometry_hints( GTK_WINDOW(toplevel), GTK_WIDGET(toplevel),
&geometry, GDK_HINT_ASPECT);
g_signal_connect( toplevel, "delete_event", G_CALLBACK(delete_event), this);
g_signal_connect( toplevel, "destroy", G_CALLBACK(destroy_event), this);
g_signal_connect( toplevel, "focus-in-event", G_CALLBACK(action_inputfocus), this);
CoWowGtk::SetWindowIcon( toplevel);
if ( basewidget) {
gtk_window_set_transient_for(GTK_WINDOW(toplevel), GTK_WINDOW(basewidget));
}
}
else {
toplevel = parent_wid;
}
if ( xg_menu) {
......@@ -416,43 +424,49 @@ XttGeGtk::XttGeGtk( GtkWidget *xg_parent_wid, void *xg_parent_ctx, const char *x
gtk_box_pack_start( GTK_BOX(graph_form), GTK_WIDGET(menu_bar), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(graph_form), GTK_WIDGET(grow_widget), TRUE, TRUE, 0);
gtk_container_add( GTK_CONTAINER(toplevel), graph_form);
if ( !(options & ge_mOptions_Embedded)) {
gtk_container_add( GTK_CONTAINER(toplevel), graph_form);
gtk_widget_show_all( toplevel);
gtk_widget_show_all( toplevel);
if ( navigator) {
// Create navigator popup
nav_shell = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", 200,
"default-width", 200,
"title", "Navigator",
NULL);
g_signal_connect( nav_shell, "delete_event", G_CALLBACK(nav_delete_event), this);
if ( navigator) {
// Create navigator popup
nav_shell = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", 200,
"default-width", 200,
"title", "Navigator",
NULL);
g_signal_connect( nav_shell, "delete_event", G_CALLBACK(nav_delete_event), this);
((GraphGtk *)graph)->create_navigator( nav_shell);
gtk_container_add( GTK_CONTAINER(nav_shell), ((GraphGtk *)graph)->nav_widget);
((GraphGtk *)graph)->create_navigator( nav_shell);
gtk_container_add( GTK_CONTAINER(nav_shell), ((GraphGtk *)graph)->nav_widget);
gtk_widget_show_all( nav_shell);
((Graph *)graph)->set_nav_background_color();
}
gtk_widget_show_all( nav_shell);
((Graph *)graph)->set_nav_background_color();
}
if ( !(x == 0 && y == 0)) {
// Set position
gtk_window_move( GTK_WINDOW(toplevel), x, y);
}
if ( !(x == 0 && y == 0)) {
// Set position
gtk_window_move( GTK_WINDOW(toplevel), x, y);
if ( options & ge_mOptions_FullScreen)
gtk_window_fullscreen( GTK_WINDOW(toplevel));
else if ( options & ge_mOptions_Maximize)
gtk_window_maximize( GTK_WINDOW(toplevel)); // TODO
else if ( options & ge_mOptions_FullMaximize)
gtk_window_maximize( GTK_WINDOW(toplevel));
else if ( options & ge_mOptions_Iconify)
gtk_window_iconify( GTK_WINDOW(toplevel));
else if ( options & ge_mOptions_Iconify)
gtk_window_iconify( GTK_WINDOW(toplevel));
else if ( options & ge_mOptions_Invisible)
g_object_set( toplevel, "visible", FALSE, NULL);
}
else {
gtk_widget_set_size_request( graph_form, window_width, window_height);
}
if ( options & ge_mOptions_FullScreen)
gtk_window_fullscreen( GTK_WINDOW(toplevel));
else if ( options & ge_mOptions_Maximize)
gtk_window_maximize( GTK_WINDOW(toplevel)); // TODO
else if ( options & ge_mOptions_FullMaximize)
gtk_window_maximize( GTK_WINDOW(toplevel));
else if ( options & ge_mOptions_Iconify)
gtk_window_iconify( GTK_WINDOW(toplevel));
else if ( options & ge_mOptions_Iconify)
gtk_window_iconify( GTK_WINDOW(toplevel));
else if ( options & ge_mOptions_Invisible)
g_object_set( toplevel, "visible", FALSE, NULL);
}
static gint confirm_delete_event( GtkWidget *w, GdkEvent *event, gpointer ge)
......
......@@ -67,7 +67,7 @@ class XttGeGtk : public XttGe {
int scrollbar, int menu, int navigator, int width, int height,
int x, int y, double scan_time, const char *object_name, int use_default_access,
unsigned int access, unsigned int options, void *basewidget,
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
~XttGeGtk();
......@@ -77,6 +77,7 @@ class XttGeGtk : public XttGe {
void create_confirm_dialog();
void confirm_reply( int ok);
void *get_widget() { return toplevel;}
GtkWidget *get_graph_widget() { return graph_form;}
static void ge_change_value_cb( void *ge_ctx, void *value_object, char *text);
static void confirm_cb( void *ge_ctx, void *confirm_object, char *text);
......
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_multiview_gtk_h
#define xtt_multiview_gtk_h
#ifndef xtt_multiview_h
# include "xtt_multiview.h"
#endif
#ifndef cow_wow_gtk_h
# include "cow_wow_gtk.h"
#endif
#ifndef xtt_evala_gtk_h
# include "xtt_evala_gtk.h"
#endif
class XttMultiViewGtk : public XttMultiView {
public:
GtkWidget *parent_wid;
GtkWidget *comp_widget[MV_SIZE];
GtkWidget *exchange_widget[MV_SIZE];
GtkWidget *box_widget;
GtkWidget *toplevel;
XttGeGtk *gectx[MV_SIZE];
XttMultiViewGtk *mvctx[MV_SIZE];
EvAlaGtk *sala[MV_SIZE];
CoWowFocusTimerGtk focustimer;
XttMultiViewGtk( GtkWidget *parent_wid, void *parent_ctx, const char *name, pwr_tAttrRef *aref,
int width, int height, int x, int y, unsigned int options, pwr_tStatus *sts,
int (*mv_command_cb) (void *, char *, void *),
int (*mv_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*mv_is_authorized_cb) (void *, unsigned int));
~XttMultiViewGtk();
void pop();
void set_size( int width, int height);
void create_confirm_dialog();
void confirm_reply( int ok);
void *get_widget();
int set_subwindow_source( const char *name, char *source, char *object, int insert = 1);
static void ge_change_value_cb( void *ge_ctx, void *value_object, char *text);
static void confirm_cb( void *ge_ctx, void *confirm_object, char *text);
static void message_dialog_cb( void *ge_ctx, const char *text);
static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void activate_value_input( GtkWidget *w, gpointer data);
static void activate_confirm_ok( GtkWidget *w, gpointer data);
static void activate_confirm_cancel( GtkWidget *w, gpointer data);
static void activate_exit( GtkWidget *w, gpointer data);
static void activate_zoom_in( GtkWidget *w, gpointer data);
static void activate_zoom_out( GtkWidget *w, gpointer data);
static void activate_zoom_reset( GtkWidget *w, gpointer data);
static void activate_help( GtkWidget *w, gpointer data);
static void create_graph_form( GtkWidget *w, gpointer data);
static void create_message_dia( GtkWidget *w, gpointer data);
static void create_menu( GtkWidget *w, gpointer data);
static void create_value_input( GtkWidget *w, gpointer data);
static void action_resize( GtkWidget *w, GtkAllocation *allocation, gpointer data);
};
#endif
......@@ -76,6 +76,7 @@ typedef void *Widget;
#include "xtt_xcrr_gtk.h"
#include "xtt_xcolwind_gtk.h"
#include "xtt_ge_gtk.h"
#include "xtt_multiview_gtk.h"
#include "xtt_block_gtk.h"
#include "xtt_trend_gtk.h"
#include "xtt_sevhist_gtk.h"
......@@ -287,7 +288,7 @@ XttGe *XNavGtk::xnav_ge_new( const char *name, const char *filename, int scrollb
double scan_time, const char *object_name,
int use_default_access, unsigned int access,
unsigned int options, void *basewidget,
int (*command_cb) (XttGe *, char *, void *),
int (*command_cb) (void *, char *, void *),
int (*get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*is_authorized_cb) (void *, unsigned int))
{
......@@ -296,6 +297,18 @@ XttGe *XNavGtk::xnav_ge_new( const char *name, const char *filename, int scrollb
access, options, basewidget, command_cb, get_current_objects_cb, is_authorized_cb);
}
XttMultiView *XNavGtk::multiview_new( const char *name, pwr_tAttrRef *aref,
int width, int height, int x, int y, unsigned int options,
pwr_tStatus *sts,
int (*command_cb) (void *, char *, void *),
int (*get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*is_authorized_cb) (void *, unsigned int))
{
return new XttMultiViewGtk( parent_wid, this, name, aref,
width, height, x, y, options, sts, command_cb,
get_current_objects_cb, is_authorized_cb);
}
GeCurve *XNavGtk::gecurve_new( char *name, char *filename, GeCurveData *data,
int pos_right)
{
......
......@@ -90,9 +90,15 @@ class XNavGtk : public XNav {
double scan_time, const char *object_name,
int use_default_access, unsigned int access, unsigned int options,
void *basewidget,
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
XttMultiView *multiview_new( const char *name, pwr_tAttrRef *aref,
int width, int height, int x, int y, unsigned int options,
pwr_tStatus *sts,
int (*command_cb) (void *, char *, void *),
int (*get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*is_authorized_cb) (void *, unsigned int));
GeCurve *gecurve_new( char *name, char *filename, GeCurveData *data,
int pos_right);
XttFileview *fileview_new( pwr_tOid oid, char *title, char *dir, char *pattern,
......
......@@ -249,7 +249,7 @@ BlockMotif::BlockMotif( void *b_parent_ctx,
XtPopup( parent_wid, XtGrabNone);
if ( !(priv & pwr_mPrv_RtEvents ||
if ( !(priv & pwr_mPrv_RtEventsBlock ||
priv & pwr_mPrv_System)) {
Arg sensitive[1];
// No access to block
......
/*
* 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_applist_h
#define xtt_applist_h
typedef enum {
applist_eType_Trace,
applist_eType_Graph,
applist_eType_Attr,
applist_eType_AttrOne,
applist_eType_Trend,
applist_eType_Crossref,
applist_eType_Hist,
applist_eType_Fast,
applist_eType_MultiView
} applist_eType;
class ApplListElem {
public:
ApplListElem( applist_eType al_type, void *al_ctx, pwr_sAttrRef *al_arp,
const char *al_name, const char *al_instance);
~ApplListElem() { log_delete();}
applist_eType type;
void *ctx;
pwr_sAttrRef aref;
char name[80];
pwr_tAName instance;
ApplListElem *next;
void log_new();
void log_delete();
};
class ApplList {
public:
ApplList() :
root(NULL) {};
~ApplList() {
ApplListElem *elem, *next;
for ( elem = root; elem; elem = next) {
next = elem->next;
delete elem;
}
}
ApplListElem *root;
void insert( applist_eType type, void *ctx,
pwr_sAttrRef *arp, const char *name, const char *instance);
void insert( applist_eType type, void *ctx,
pwr_tObjid objid, const char *name, const char *instance);
void remove( void *ctx);
int find( applist_eType type, const char *name, const char *instance, void **ctx);
int find( applist_eType type, pwr_sAttrRef *arp, void **ctx);
int find( applist_eType type, pwr_tObjid objid, void **ctx);
int find( applist_eType type, void *ctx, char *name, char *instance);
int find_graph( const char *name, const char *instance, void **ctx);
void swap( int mode);
};
#endif
......@@ -159,6 +159,9 @@ static pwr_tStatus HistEventFilter( xmenu_sMenuCall *ip)
{
pwr_sAttrRef *objar;
if ( !((XNav *)ip->EditorContext)->eventlog_enabled())
return XNAV__INVISIBLE;
if (!ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid))
objar = &ip->Pointed;
else
......@@ -190,6 +193,9 @@ static pwr_tStatus OpenTrace( xmenu_sMenuCall *ip)
else
objar = &ip->ItemList[ip->ChosenItem].CurrentObject;
if ( !((XNav *)ip->EditorContext)->is_authorized( pwr_mAccess_RtPlc | pwr_mAccess_System, 0))
return 1;
// Check if object reside in plc
for ( sts = gdh_GetParent( objar->Objid, &parent);
ODD(sts);
......@@ -246,6 +252,9 @@ static pwr_tStatus OpenTraceFilter( xmenu_sMenuCall *ip)
ip->Caller == xmenu_mUtility_Simulate)
return XNAV__INVISIBLE;
if ( !((XNav *)ip->EditorContext)->is_authorized( pwr_mAccess_RtPlc | pwr_mAccess_System, 0))
return XNAV__INVISIBLE;
for ( sts = gdh_GetParent( objar->Objid, &parent);
ODD(sts);
sts = gdh_GetParent( parent, &parent)) {
......@@ -739,6 +748,9 @@ static pwr_tStatus RtNavigator( xmenu_sMenuCall *ip)
{
pwr_sAttrRef *objar;
if ( !((XNav *)ip->EditorContext)->is_authorized( pwr_mAccess_RtNavigator | pwr_mAccess_System, 0))
return 1;
if (!ip->ItemList || cdh_ObjidIsNull( ip->ItemList[ip->ChosenItem].CurrentObject.Objid))
objar = &ip->Pointed;
else
......@@ -753,6 +765,8 @@ static pwr_tStatus RtNavigator( xmenu_sMenuCall *ip)
// Open runtime navigator filter
static pwr_tStatus RtNavigatorFilter( xmenu_sMenuCall *ip)
{
if ( !((XNav *)ip->EditorContext)->is_authorized( pwr_mAccess_RtNavigator | pwr_mAccess_System, 0))
return XNAV__INVISIBLE;
if ( ip->Caller == xmenu_mUtility_XNav &&
cdh_ObjidIsEqual( ip->Pointed.Objid,
......@@ -1337,6 +1351,9 @@ static pwr_tStatus BlockEvents( xmenu_sMenuCall *ip)
// Block Events Filter
static pwr_tStatus BlockEventsFilter( xmenu_sMenuCall *ip)
{
if ( !((XNav *)ip->EditorContext)->is_authorized( pwr_mAccess_RtEventsBlock | pwr_mAccess_System, 0))
return XNAV__INVISIBLE;
return XNAV__SUCCESS;
}
......@@ -1940,6 +1957,9 @@ static pwr_tStatus IsURLAttribute( xmenu_sMenuCall *ip)
// Open trace
static pwr_tStatus CrrOpenTrace( xmenu_sMenuCall *ip)
{
if ( !((XNav *)ip->EditorContext)->is_authorized( pwr_mAccess_RtPlc | pwr_mAccess_System, 0))
return XNAV__INVISIBLE;
((XNav *)ip->EditorContext)->start_trace( ip->Pointed.Objid, ip->Arg);
return XNAV__SUCCESS;
}
......@@ -1951,6 +1971,9 @@ static pwr_tStatus CrrOpenTraceFilter( xmenu_sMenuCall *ip)
pwr_tStatus sts;
pwr_tCid cid;
if ( !((XNav *)ip->EditorContext)->is_authorized( pwr_mAccess_RtPlc | pwr_mAccess_System, 0))
return XNAV__INVISIBLE;
sts = gdh_GetObjectClass( ip->Pointed.Objid, &cid);
if ( ODD(sts) && cid == pwr_cClass_XttGraph)
return XNAV__INVISIBLE;
......
......@@ -41,6 +41,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "pwr_privilege.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
......@@ -78,9 +79,9 @@ Ev::Ev( void *ev_parent_ctx,
user(ev_user), eve_display_ack(display_ack),
eve_display_return(display_return),
start_trace_cb(NULL), display_in_xnav_cb(NULL), update_info_cb(NULL),
help_cb(NULL), popup_menu_cb(0), sound_cb(0), eve(NULL), ala(NULL),
connected(0), ala_displayed(0), eve_displayed(0), beep(ev_beep), pop_mask(ev_pop_mask),
eventname_seg(ev_eventname_seg)
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)
{
}
......@@ -161,6 +162,55 @@ void Ev::blk_display_in_xnav_cb( void *ctx, pwr_tAttrRef *arp)
((Ev *)ctx)->display_in_xnav_cb( ((Ev *)ctx)->parent_ctx, arp);
}
void Ev::ala_help_cb( void *ctx, const char *key)
{
if ( ((Ev *)ctx)->help_cb)
((Ev *)ctx)->help_cb( ((Ev *)ctx)->parent_ctx, key);
}
int Ev::ala_is_authorized_cb( void *ctx, unsigned int access)
{
if ( ((Ev *)ctx)->is_authorized_cb)
return ((Ev *)ctx)->is_authorized_cb( ((Ev *)ctx)->parent_ctx, access);
return 0;
}
int Ev::sala_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->sala_cnt; i++)
ev->sala[i]->ack( id);
mh_OutunitAck( &lid);
return 1;
}
void Ev::sala_copy_list_cb( void *ctx, EvList *evl)
{
Ev *ev = (Ev *)ctx;
ev->ala->copy_list( evl);
}
void Ev::sala_close_cb( void *ctx, EvAla *sala)
{
Ev *ev = (Ev *)ctx;
bool found = false;
for ( int i = 0; i < ev->sala_cnt; i++) {
if ( ev->sala[i] == sala)
found = true;
if ( found && i != ev->sala_cnt - 1)
ev->sala[i] = ev->sala[i+1];
}
if ( found)
ev->sala_cnt--;
}
void Ev::eve_activate_print()
{
char title[80];
......@@ -190,17 +240,63 @@ void Ev::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;
sts = ala->get_last_not_acked( &id);
if ( EVEN(sts)) return;
mh_sEventId lid = *id;
ala->ack( id);
eve->ack( id);
for ( int i = 0; i < sala_cnt; i++)
sala[i]->ack( id);
mh_OutunitAck( &lid);
}
void Ev::ala_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);
eve->ack( id);
for ( int i = 0; i < sala_cnt; i++)
sala[i]->ack( id);
mh_OutunitAck( &lid);
}
void Ev::eve_activate_ack_all()
{
if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
return;
ack_all();
}
......@@ -303,6 +399,9 @@ void Ev::update( double scantime)
ala->reset_nodraw();
}
ala->flash();
for ( int i = 0; i < sala_cnt; i++)
sala[i]->update();
if ( beep)
ala->beep( scantime);
}
......@@ -312,6 +411,9 @@ void Ev::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))
{
......@@ -319,6 +421,8 @@ void Ev::ack_last_prio( unsigned long type, unsigned long prio)
ala->ack( id);
eve->ack( id);
for ( int i = 0; i < sala_cnt; i++)
sala[i]->ack( id);
mh_OutunitAck( &lid);
}
}
......@@ -328,11 +432,16 @@ void Ev::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);
eve->ack( id);
for ( int i = 0; i < sala_cnt; i++)
sala[i]->ack( id);
mh_OutunitAck( &lid);
sts = ala->get_last_not_acked( &id);
......@@ -414,6 +523,8 @@ pwr_tStatus Ev::mh_ack_bc( mh_sAck *MsgP)
ev->eve->event_ack( MsgP);
}
ev->ala->event_ack( MsgP);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->mh_ack( MsgP);
if ( ev->update_info_cb)
ev->update_info_cb( ev->parent_ctx);
......@@ -428,6 +539,8 @@ pwr_tStatus Ev::mh_return_bc( mh_sReturn *MsgP)
ev->eve->event_return( MsgP);
}
ev->ala->event_return( MsgP);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->mh_return( MsgP);
if ( ev->update_info_cb)
ev->update_info_cb( ev->parent_ctx);
......@@ -438,6 +551,8 @@ pwr_tStatus Ev::mh_alarm_bc( mh_sMessage *MsgP)
{
ev->eve->event_alarm( MsgP);
ev->ala->event_alarm( MsgP);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->mh_alarm( MsgP);
if ( ev->update_info_cb)
ev->update_info_cb( ev->parent_ctx);
if ( ev->pop_cb) {
......@@ -480,6 +595,9 @@ pwr_tStatus Ev::mh_block_bc( mh_sBlock *MsgP)
pwr_tStatus Ev::mh_cancel_bc( mh_sReturn *MsgP)
{
ev->ala->event_cancel( MsgP);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->mh_cancel( MsgP);
if ( ev->update_info_cb)
ev->update_info_cb( ev->parent_ctx);
return 1;
......@@ -489,6 +607,8 @@ pwr_tStatus Ev::mh_info_bc( mh_sMessage *MsgP)
{
ev->eve->event_info( MsgP);
ev->ala->event_info( MsgP);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->mh_info( MsgP);
if ( ev->update_info_cb)
ev->update_info_cb( ev->parent_ctx);
if ( ev->pop_mask & pwr_mOpWindPopMask_InfoMsg)
......@@ -500,6 +620,8 @@ pwr_tStatus Ev::mh_info_bc( mh_sMessage *MsgP)
pwr_tStatus Ev::mh_clear_alarmlist_bc( pwr_tNodeIndex nix)
{
ev->ala->event_clear_alarmlist( nix);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->mh_clear_alarmlist( nix);
return 1;
}
......@@ -509,4 +631,52 @@ pwr_tStatus Ev::mh_clear_blocklist_bc( pwr_tNodeIndex nix)
return 1;
}
pwr_tStatus Ev::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, "Alarm 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 Ev::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;
}
}
}
}
......@@ -46,6 +46,9 @@
#ifndef xtt_evlist
# include "xtt_evlist.h"
#endif
#ifndef xtt_evala
# include "xtt_evala.h"
#endif
class CoWow;
class XttMethodToolbar;
......@@ -55,6 +58,10 @@ typedef struct {
char Alias[8];
} ev_sAlias;
typedef enum {
ev_mAlaOptions_Embedded = 1 << 0
} ev_mAlaOptions;
class Ev {
public:
Ev(
......@@ -87,6 +94,7 @@ class Ev {
unsigned long, char *, int x, int y);
int (*sound_cb)( void *, pwr_tAttrRef *);
void (*pop_cb)( void *);
int (*is_authorized_cb)(void *, unsigned int);
EvList *eve;
EvList *ala;
EvList *blk;
......@@ -107,6 +115,8 @@ class Ev {
XttMethodToolbar *ala_methodtoolbar;
XttMethodToolbar *eve_sup_methodtoolbar;
XttMethodToolbar *ala_sup_methodtoolbar;
EvAla *sala[20];
int sala_cnt;
virtual void map_eve() {}
virtual void map_ala() {}
......@@ -114,6 +124,10 @@ class Ev {
virtual void unmap_eve() {}
virtual void unmap_ala() {}
virtual void unmap_blk() {}
virtual void set_title_ala( char *title) {}
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;}
int outunit_connect( pwr_tObjid user);
void update( double scantime);
......@@ -127,10 +141,13 @@ class Ev {
unsigned long prio);
void create_aliaslist( void *up);
char *name_to_alias( char *name);
pwr_tStatus set_view(pwr_tOid view);
void view_shift();
void eve_activate_print();
void ala_activate_print();
void blk_activate_print();
void ala_activate_ack_last();
void eve_activate_ack_last();
void eve_activate_ack_all();
void eve_activate_help();
......@@ -152,6 +169,12 @@ class Ev {
static int ev_sound_cb( void *ctx, pwr_tAttrRef *attrref);
static void eve_selection_changed_cb( void *ctx);
static void ala_selection_changed_cb( void *ctx);
static void ala_help_cb( void *ctx, const char *key);
static int ala_is_authorized_cb( void *ctx, unsigned int access);
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 pwr_tStatus mh_ack_bc( mh_sAck *MsgP);
static pwr_tStatus mh_return_bc( mh_sReturn *MsgP);
static pwr_tStatus mh_alarm_bc( mh_sMessage *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_evala.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_evala.h"
#include "xtt_methodtoolbar.h"
#include "rt_xnav_msg.h"
EvAla::EvAla( void *ev_parent_ctx,
char *ala_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),
ala_displayed(0), list_copied(0)
{
}
//
// Delete ev
//
EvAla::~EvAla()
{
if ( close_cb)
close_cb( parent_ctx, this);
}
void EvAla::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 EvAla::ala_init_cb( void *ctx)
{
EvAla *ev = (EvAla *)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 EvAla::ala_start_trace_cb( void *ctx, pwr_tObjid objid, char *name)
{
if ( ((EvAla *)ctx)->start_trace_cb)
((EvAla *)ctx)->start_trace_cb( ((EvAla *)ctx)->parent_ctx, objid, name);
}
void EvAla::ala_popup_menu_cb( void *ctx, pwr_tAttrRef attrref,
unsigned long item_type, unsigned long utility,
char *arg, int x, int y)
{
if ( ((EvAla *)ctx)->popup_menu_cb)
(((EvAla *)ctx)->popup_menu_cb) ( ((EvAla *)ctx)->parent_ctx, attrref, item_type,
utility, arg, x, y);
}
int EvAla::ala_sound_cb( void *ctx, pwr_tAttrRef *attrref)
{
if ( ((EvAla *)ctx)->sound_cb)
return (((EvAla *)ctx)->sound_cb) ( ((EvAla *)ctx)->parent_ctx, attrref);
return 0;
}
void EvAla::ala_selection_changed_cb( void *ctx)
{
((EvAla *)ctx)->ala_methodtoolbar->set_sensitive();
((EvAla *)ctx)->ala_sup_methodtoolbar->set_sensitive();
}
void EvAla::ala_display_in_xnav_cb( void *ctx, pwr_tAttrRef *arp)
{
if ( ((EvAla *)ctx)->display_in_xnav_cb)
((EvAla *)ctx)->display_in_xnav_cb( ((EvAla *)ctx)->parent_ctx, arp);
}
char *EvAla::ala_name_to_alias_cb( void *ctx, char *name)
{
return ((EvAla *)ctx)->name_to_alias_cb( ((EvAla *)ctx)->parent_ctx, name);
}
void EvAla::ala_activate_print()
{
char title[80];
strcpy( title, Lng::translate( "Alarm List"));
ala->print( title);
}
void EvAla::ala_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 EvAla::ala_activate_ack_all()
{
if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
return;
ack_all();
}
void EvAla::ala_activate_help()
{
if ( help_cb)
(help_cb)( parent_ctx, "opg_alarmlist");
}
void EvAla::ala_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 EvAla::update()
{
if ( ala->browbase)
ala->flash();
}
void EvAla::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 EvAla::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 EvAla::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 EvAla::mh_ack( mh_sAck *MsgP)
{
ala->event_ack( MsgP);
return 1;
}
pwr_tStatus EvAla::mh_return( mh_sReturn *MsgP)
{
ala->event_return( MsgP);
return 1;
}
pwr_tStatus EvAla::mh_alarm( mh_sMessage *MsgP)
{
ala->event_alarm( MsgP);
return 1;
}
pwr_tStatus EvAla::mh_cancel( mh_sReturn *MsgP)
{
ala->event_cancel( MsgP);
return 1;
}
pwr_tStatus EvAla::mh_info( mh_sMessage *MsgP)
{
ala->event_info( MsgP);
return 1;
}
pwr_tStatus EvAla::mh_clear_alarmlist( pwr_tNodeIndex nix)
{
ala->event_clear_alarmlist( nix);
return 1;
}
pwr_tStatus EvAla::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, "Alarm 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 EvAla::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_evala_h
#define xtt_evala_h
/* xtt_evala.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 EvAla {
public:
EvAla(
void *ev_parent_ctx,
char *ala_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 ~EvAla();
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 *, EvAla *);
EvList *ala;
int ala_displayed;
int ala_size;
CoWow *wow;
XttMethodToolbar *ala_methodtoolbar;
XttMethodToolbar *ala_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 ala_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 ala_activate_print();
void ala_activate_ack_last();
void ala_activate_help();
void ala_activate_helpevent();
void ala_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 ala_display_in_xnav_cb( void *ctx, pwr_tAttrRef *arp);
static void ala_start_trace_cb( void *ctx, pwr_tObjid objid, char *name);
static void ala_popup_menu_cb( void *ctx, pwr_tAttrRef attrref,
unsigned long item_type, unsigned long utility,
char *arg, int x, int y);
static int ala_sound_cb( void *ctx, pwr_tAttrRef *attrref);
static void ala_selection_changed_cb( void *ctx);
static char *ala_name_to_alias_cb( void *ctx, char *name);
static void ala_init_cb( void *ctx);
};
#endif
This diff is collapsed.
......@@ -121,12 +121,18 @@ typedef enum {
} evlist_eEventType;
typedef enum {
evlist_eItemType_Alarm
evlist_eItemType_Alarm,
evlist_eItemType_Category
} evlist_eItemType;
typedef enum {
evlist_mOpen_All = ~0,
evlist_mOpen_Children = 1 << 0
} evlist_mOpen;
class EvListBrow {
public:
EvListBrow( BrowCtx *brow_ctx, void *evl) : ctx(brow_ctx), evlist(evl) {};
EvListBrow( BrowCtx *brow_ctx, void *evl) : ctx(brow_ctx), evlist(evl) {};
~EvListBrow();
BrowCtx *ctx;
......@@ -135,6 +141,13 @@ class EvListBrow {
brow_tNodeClass nc_a_alarm;
brow_tNodeClass nc_b_alarm;
brow_tNodeClass nc_info;
brow_tNodeClass nc_category;
brow_tNodeClass nc_category_a;
brow_tNodeClass nc_category_b;
brow_tNodeClass nc_category_c;
brow_tNodeClass nc_category_d;
brow_tNodeClass nc_category_i;
brow_tNodeClass nc_category_flash;
flow_sAnnotPixmap *pixmap_leaf;
flow_sAnnotPixmap *pixmap_map;
flow_sAnnotPixmap *pixmap_openmap;
......@@ -159,12 +172,15 @@ class EvList {
EvList( void *ev_parent_ctx,
ev_eType ev_type,
int ev_size,
int ev_eventname_seg);
int ev_eventname_seg,
void (*ev_init_cb)( void *) = 0);
virtual ~EvList();
void *parent_ctx;
ev_eType type;
EvListBrow *brow;
EvListBrow *browbase;
EvListBrow *browtree;
int size;
int max_size;
int display_hundredth;
......@@ -177,6 +193,7 @@ class EvList {
char *(*name_to_alias_cb)( void *, char *);
int (*sound_cb)( void *, pwr_tAttrRef *);
void (*selection_changed_cb)( void *);
void (*init_cb)( void *);
double acc_beep_time;
double beep_interval;
pwr_tAttrRef aalarm_sound;
......@@ -185,6 +202,8 @@ class EvList {
pwr_tAttrRef dalarm_sound;
pwr_tAttrRef info_sound;
int eventname_seg;
pwr_tObjid current_view;
bool flash_value;
virtual void set_input_focus() {}
virtual void bell() {}
......@@ -220,15 +239,28 @@ class EvList {
int get_destination( pwr_tTime time, void **dest);
void block_remove();
void print_nodia( char *filename);
pwr_tStatus set_view(pwr_tOid view);
pwr_tStatus view_init( pwr_tOid view);
void view_configure();
void view_alarm( ItemAlarm *alarm_item);
void flash();
void copy_list( EvList* evl);
static int init_brow_cb( FlowCtx *fctx, void *client_data);
static int init_browtree_cb( BrowCtx *fctx, void *client_data);
static int brow_cb( FlowCtx *ctx, flow_tEvent event);
static int browtree_cb( FlowCtx *ctx, flow_tEvent event);
static int get_select( void *ctx, pwr_tAttrRef *attrref, int *is_attr);
static int get_select_supobject( void *ctx, pwr_tAttrRef *attrref, int *is_attr);
};
class ItemAlarm {
class ItemEvBase {
public:
evlist_eItemType type;
};
class ItemAlarm : public ItemEvBase {
public:
ItemAlarm( EvList *evlist, const char *item_name, pwr_tTime item_time,
const char *item_eventtext, char *item_eventname, int item_eventflags,
......@@ -237,10 +269,10 @@ class ItemAlarm {
char *item_eventmoretext,unsigned long item_status,
evlist_eEventType item_event_type, pwr_tAttrRef *item_supobject,
brow_tNode dest, flow_eDest dest_code, int *rsts);
evlist_eItemType type;
evlist_eEventType event_type;
EvList *evlist;
brow_tNode node;
brow_tNode tree_node;
char name[40];
pwr_tTime time;
char eventtext[80];
......@@ -255,7 +287,29 @@ class ItemAlarm {
pwr_tText256 eventmoretext;
pwr_tAttrRef supobject;
void update_text();
void update_text(int tree_node);
};
class ItemCategory : public ItemEvBase {
public:
ItemCategory( EvList *evlist, const char *item_name, pwr_sClass_AlarmCategory *cop,
brow_tNode dest, flow_eDest dest_code, int *rsts);
EvList *evlist;
brow_tNode node;
char name[80];
char text[80];
unsigned int prio;
unsigned int event_priority;
pwr_tAName members[100];
int member_cnt;
brow_tNodeClass base_nc;
int notacked_child;
int open_children( EvList *evlist, double x, double y);
void close( EvList *evlist, double x, double y);
void configure( EvList *evlist);
void alarm( EvList *evlist, ItemAlarm *alarm);
void flash( EvList *evlist);
};
#endif
......@@ -97,7 +97,7 @@ int XttGe::ge_command_cb( void *ge_ctx, char *cmd)
if ( ge->command_cb)
{
sts = (ge->command_cb)( ge, cmd, ge_ctx);
sts = (ge->command_cb)( ge->parent_ctx, cmd, ge_ctx);
return sts;
}
return 0;
......@@ -246,8 +246,8 @@ void XttGe::event_exec( int type, void *event, unsigned int size)
XttGe::XttGe( void *xg_parent_ctx, const char *xg_name, const char *xg_filename,
int xg_scrollbar, int xg_menu, int xg_navigator, int xg_width, int xg_height,
int x, int y, double scan_time, const char *object_name,
int use_default_access, unsigned int access,
int (*xg_command_cb) (XttGe *, char *, void *),
int use_default_access, unsigned int access, unsigned int xg_options,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int)) :
parent_ctx(xg_parent_ctx), scrollbar(xg_scrollbar),
......@@ -256,7 +256,7 @@ XttGe::XttGe( void *xg_parent_ctx, const char *xg_name, const char *xg_filename,
command_cb(xg_command_cb), close_cb(0), help_cb(0), display_in_xnav_cb(0),
is_authorized_cb(xg_is_authorized_cb), popup_menu_cb(0), call_method_cb(0),
get_current_objects_cb(xg_get_current_objects_cb), sound_cb(0), eventlog_cb(0),
width(xg_width), height(xg_height)
width(xg_width), height(xg_height), options(xg_options)
{
strcpy( filename, xg_filename);
strcpy( name, xg_name);
......
......@@ -57,9 +57,9 @@ class XttGe {
void *current_confirm_object;
int value_input_open;
int confirm_open;
int (*command_cb)(XttGe *, char *, void *);
void (*close_cb)(XttGe *);
void (*help_cb)(XttGe *, const char *key);
int (*command_cb)(void *, char *, void *);
void (*close_cb)(void *, void *);
void (*help_cb)(void *, const char *key);
void (*display_in_xnav_cb)(void *, pwr_sAttrRef *);
int (*is_authorized_cb)(void *, unsigned int);
void (*popup_menu_cb)(void *, pwr_sAttrRef, unsigned long,
......@@ -71,12 +71,13 @@ class XttGe {
void (*eventlog_cb)(void *, void *, int, void *, unsigned int);
int width;
int height;
unsigned int options;
XttGe( void *parent_ctx, const char *name, const char *filename,
int scrollbar, int menu, int navigator, int width, int height,
int x, int y, double scan_time, const char *object_name, int use_default_access,
unsigned int access,
int (*xg_command_cb) (XttGe *, char *, void *),
unsigned int access, unsigned int options,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
virtual ~XttGe();
......
/*
* 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.
*/
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include "glow.h"
#include "xtt_xnav.h"
#include "rt_gdh.h"
#include "rt_gdh_msg.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "glow_growctx.h"
#include "glow_growapi.h"
#include "co_lng.h"
#include "xtt_ge.h"
#include "xtt_multiview.h"
#include "xtt_log.h"
void MVRecall::insert( char *str, char *obj)
{
if ( current_idx == -1) {
current_idx = 0;
first_idx = 0;
last_idx = 0;
}
else {
current_idx++;
if ( current_idx >= MV_RECALL_SIZE)
current_idx = 0;
last_idx = current_idx;
if ( current_idx == first_idx) {
first_idx++;
if ( first_idx >= MV_RECALL_SIZE)
last_idx = 0;
}
}
strncpy( buff[current_idx], str, sizeof(buff[0]));
if ( obj)
strncpy( object[current_idx], obj, sizeof(object[0]));
else
strcpy( object[current_idx], "");
}
int MVRecall::get_previous()
{
if ( current_idx == first_idx)
return -1;
current_idx--;
if ( current_idx < 0)
current_idx = MV_RECALL_SIZE - 1;
return current_idx;
}
int MVRecall::get_next()
{
if ( current_idx == last_idx)
return -1;
current_idx++;
if ( current_idx >= MV_RECALL_SIZE)
current_idx = 0;
return current_idx;
}
void XttMultiView::eventlog_enable( int enable)
{
// Graph::eventlog_enable( enable);
}
void XttMultiView::multiview_ge_close_cb( void *parent_ctx, void *client_data)
{
}
int XttMultiView::multiview_ge_command_cb( void *multiview_ctx, char *cmd, void *caller)
{
XttMultiView *multiview = (XttMultiView *) multiview_ctx;
int sts;
if ( multiview->command_cb) {
sts = (multiview->command_cb)( multiview->parent_ctx, cmd, multiview_ctx);
return sts;
}
return 0;
}
int XttMultiView::multiview_ge_sound_cb( void *multiview_ctx, pwr_tAttrRef *aref)
{
XttMultiView *multiview = (XttMultiView *)multiview_ctx;
if ( multiview->sound_cb)
return (multiview->sound_cb)( multiview->parent_ctx, aref);
return 0;
}
void XttMultiView::multiview_ge_display_in_xnav_cb( void *multiview_ctx, pwr_sAttrRef *arp)
{
XttMultiView *multiview = (XttMultiView *)multiview_ctx;
if ( multiview->display_in_xnav_cb)
(multiview->display_in_xnav_cb)( multiview->parent_ctx, arp);
}
void XttMultiView::multiview_ge_popup_menu_cb( void *multiview_ctx, pwr_sAttrRef attrref,
unsigned long item_type, unsigned long utility,
char *arg, int x, int y)
{
XttMultiView *multiview = (XttMultiView *)multiview_ctx;
if ( multiview->popup_menu_cb)
(multiview->popup_menu_cb)( multiview->parent_ctx, attrref, item_type, utility,
arg, x, y);
}
int XttMultiView::multiview_ge_call_method_cb( void *multiview_ctx, const char *method, const char *filter,
pwr_sAttrRef attrref, unsigned long item_type,
unsigned long utility, char *arg)
{
XttMultiView *multiview = (XttMultiView *)multiview_ctx;
if ( multiview->call_method_cb)
return (multiview->call_method_cb)( multiview->parent_ctx, method, filter, attrref, item_type, utility,
arg);
else return 0;
}
int XttMultiView::multiview_ge_is_authorized_cb( void *multiview_ctx, unsigned int access)
{
XttMultiView *multiview = (XttMultiView *)multiview_ctx;
if ( multiview->is_authorized_cb)
return (multiview->is_authorized_cb)( multiview->parent_ctx, access);
return 0;
}
int XttMultiView::multiview_ge_get_current_objects_cb( void *multiview_ctx, pwr_sAttrRef **alist,
int **is_alist)
{
XttMultiView *multiview = (XttMultiView *)multiview_ctx;
if ( multiview->get_current_objects_cb)
return (multiview->get_current_objects_cb)( multiview->parent_ctx, alist, is_alist);
return 0;
}
void XttMultiView::multiview_ge_eventlog_cb( void *multiview_ctx, void *gectx, int category,
void *data, unsigned int size)
{
XttMultiView *multiview = (XttMultiView *)multiview_ctx;
if ( multiview->eventlog_cb)
(multiview->eventlog_cb)( multiview->parent_ctx, gectx, category, data, size);
}
void XttMultiView::multiview_ge_help_cb( void *multiview_ctx, const char *key)
{
XttMultiView *multiview = (XttMultiView *)multiview_ctx;
if ( multiview->help_cb)
(multiview->help_cb)( multiview->parent_ctx, key);
}
void XttMultiView::message_cb( void *ctx, char severity, const char *msg)
{
((XttMultiView *)ctx)->message( severity, msg);
}
void XttMultiView::message( char severity, const char *msg)
{
if ( strcmp( msg, "") != 0)
printf("** XttMultiView: %s\n", msg);
}
int XttMultiView::set_object_focus( const char *name, int empty)
{
return 1; // graph->set_object_focus( name, empty);
}
int XttMultiView::set_folder_index( const char *name, int idx)
{
return 1; // graph->set_folder_index( name, idx);
}
XttMultiView::~XttMultiView()
{
}
void XttMultiView::swap( int mode)
{
}
int XttMultiView::find_graph( const char *name, const char *instance, void **ctx)
{
return appl.find_graph( name, instance, ctx);
}
int XttMultiView::name_to_idx( const char *name)
{
pwr_sClass_XttMultiView mv;
pwr_tStatus sts;
sts = gdh_GetObjectInfoAttrref( &aref, &mv, sizeof(mv));
if ( EVEN(sts)) return sts;
for ( int i = 0; i < cols; i++) {
for ( int j = 0; j < rows; j++) {
if ( cdh_NoCaseStrcmp( name, mv.Action[i*rows+j].Name) == 0)
return i*rows+j;
}
}
return -1;
}
int XttMultiView::set_subwindow_next( const char *name) {
int i = name_to_idx( name);
if ( i < 0)
return 0;
int next = recall_buffer[i].get_next();
if ( next < 0)
return 0;
char *op = 0;
if ( strcmp(recall_buffer[i].object[next], "") != 0)
op = recall_buffer[i].object[next];
return set_subwindow_source( name, (char *)recall_buffer[i].buff[next], op, 0);
}
int XttMultiView::set_subwindow_prev( const char *name) {
int i = name_to_idx( name);
if ( i < 0)
return 0;
int prev = recall_buffer[i].get_previous();
if ( prev < 0)
return 0;
char *op = 0;
if ( strcmp(recall_buffer[i].object[prev], "") != 0)
op = recall_buffer[i].object[prev];
return set_subwindow_source( name, (char *)recall_buffer[i].buff[prev], op, 0);
}
XNav *XttMultiView::get_xnav()
{
if ( options & ge_mOptions_Embedded)
return ((XttMultiView *)parent_ctx)->get_xnav();
else
return (XNav *)parent_ctx;
}
XttMultiView::XttMultiView( void *mv_parent_ctx, const char *mv_name,
pwr_tAttrRef *mv_aref, int mv_width, int mv_height,
int mv_x, int mv_y, unsigned int mv_options,
int (*mv_command_cb) (void *, char *, void *),
int (*mv_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*mv_is_authorized_cb) (void *, unsigned int)) :
parent_ctx(mv_parent_ctx), options(mv_options),
command_cb(mv_command_cb), close_cb(0), help_cb(0), display_in_xnav_cb(0),
is_authorized_cb(mv_is_authorized_cb), popup_menu_cb(0), call_method_cb(0),
get_current_objects_cb(mv_get_current_objects_cb), sound_cb(0), eventlog_cb(0),
width(mv_width), height(mv_height)
{
strcpy( name, mv_name);
aref = *mv_aref;
}
/*
* 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_multiview_h
#define xtt_multiview_h
#ifndef pwr_h
# include "pwr.h"
#endif
#include "glow.h"
#ifndef xtt_applist_h
#include "xtt_applist.h"
#endif
#define MV_SIZE 25
#define MV_RECALL_SIZE 10
class Graph;
class XNav;
class MVRecall {
public:
MVRecall() : current_idx(-1), first_idx(0), last_idx(0) {}
pwr_tFileName buff[MV_RECALL_SIZE];
pwr_tAName object[MV_RECALL_SIZE];
int current_idx;
int first_idx;
int last_idx;
void insert( char *str, char *object);
int get_previous();
int get_next();
};
class XttMultiView {
public:
void *parent_ctx;
pwr_tAttrRef aref;
pwr_tAName name;
unsigned int options;
int (*command_cb)(void *, char *, void *);
void (*close_cb)(void *, void *);
void (*help_cb)(void *, const char *key);
void (*display_in_xnav_cb)(void *, pwr_sAttrRef *);
int (*is_authorized_cb)(void *, unsigned int);
void (*popup_menu_cb)(void *, pwr_sAttrRef, unsigned long,
unsigned long, char *, int x, int y);
int (*call_method_cb)(void *, const char *, const char *, pwr_sAttrRef,
unsigned long, unsigned long, char *);
int (*get_current_objects_cb)(void *, pwr_sAttrRef **, int **);
int (*sound_cb)(void *, pwr_tAttrRef *);
void (*eventlog_cb)(void *, void *, int, void *, unsigned int);
int width;
int height;
int rows;
int cols;
ApplList appl;
MVRecall recall_buffer[MV_SIZE];
XttMultiView( void *parent_ctx, const char *name,
pwr_tAttrRef *aref, int width, int height,
int x, int y, unsigned int options,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
virtual ~XttMultiView();
virtual void pop() {}
virtual void set_size( int width, int height) {}
virtual void *get_widget() { return 0;}
virtual int set_subwindow_source( const char *name, char *source, char *object, int insert = 1) {return 0;}
void message( char severity, const char *msg);
int set_object_focus( const char *name, int empty);
int set_folder_index( const char *name, int idx);
void swap( int mode);
void event_exec( int type, void *event, unsigned int size);
int find_graph( const char *name, const char *instance, void **ctx);
int name_to_idx( const char *name);
int set_subwindow_next( const char *name);
int set_subwindow_prev( const char *name);
XNav *get_xnav();
static void multiview_ge_close_cb( void *parent_ctx, void *client_data);
static int multiview_ge_command_cb( void *multiview_ctx, char *command, void *caller);
static int multiview_ge_sound_cb( void *multiview_ctx, pwr_tAttrRef *aref);
static void multiview_ge_display_in_xnav_cb( void *multiview_ctx, pwr_sAttrRef *arp);
static void multiview_ge_popup_menu_cb( void *multiview_ctx, pwr_sAttrRef attrref,
unsigned long item_type, unsigned long utility,
char *arg, int x, int y);
static int multiview_ge_call_method_cb( void *multiview_ctx, const char *method, const char *filter,
pwr_sAttrRef attrref, unsigned long item_type,
unsigned long utility, char *arg);
static int multiview_ge_is_authorized_cb( void *multiview_ctx, unsigned int access);
static int multiview_ge_get_current_objects_cb( void *multiview_ctx, pwr_sAttrRef **alist,
int **is_alist);
static void multiview_ge_eventlog_cb( void *multiview_ctx, void *gectx, int category,
void *value, unsigned int size);
static void multiview_ge_help_cb( void *multiview_ctx, const char *key);
static void message_cb( void *ctx, char severity, const char *msg);
static void eventlog_enable( int enable);
};
#endif
......@@ -41,6 +41,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "pwr_privilege.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_syi.h"
......@@ -64,7 +65,8 @@ Op::Op( void *op_parent_ctx,
pwr_tStatus *status) :
parent_ctx(op_parent_ctx), start_jop(0),
jop(NULL), command_cb(NULL), map_cb(NULL), help_cb(NULL),
close_cb(NULL), get_alarm_info_cb(NULL), ack_last_cb(NULL), wow(0), sup_timerid(0)
close_cb(NULL), get_alarm_info_cb(NULL), ack_last_cb(NULL), is_authorized_cb(0),
wow(0), sup_timerid(0)
{
sup_init();
}
......@@ -190,7 +192,10 @@ void Op::activate_graph()
}
void Op::activate_navigator()
{
{
if (is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtNavigator | pwr_mAccess_System))
return;
if ( map_cb)
map_cb( parent_ctx);
}
......@@ -371,7 +376,8 @@ void Op::appl_startup()
if ( command_cb) {
if ( layout_mask & pwr_mOpWindLayoutMask_HideNavigator) {
if ( layout_mask & pwr_mOpWindLayoutMask_HideNavigator ||
(is_authorized_cb && !is_authorized_cb( parent_ctx, pwr_mAccess_RtNavigator | pwr_mAccess_System))) {
strcpy( cmd, "close navigator");
command_cb( parent_ctx, cmd);
}
......
......@@ -106,6 +106,7 @@ class Op {
void (*close_cb)( void *);
int (*get_alarm_info_cb)( void *, evlist_sAlarmInfo *);
void (*ack_last_cb)( void *, unsigned long, unsigned long);
int (*is_authorized_cb)(void *, unsigned int);
CoWow *wow;
pwr_tMask layout_mask;
vector<OpSup> sup_vect;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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