Commit b835884f authored by Claes Sjofors's avatar Claes Sjofors

Safety level enum added to some object, and warning triangle in plcpgm

parent 8b7f9256
...@@ -1059,6 +1059,7 @@ int CnvWblToH::check_typename( char *type_volume, char *type_name) ...@@ -1059,6 +1059,7 @@ int CnvWblToH::check_typename( char *type_volume, char *type_name)
"pwr_tDataRef", "pwr_tDataRef",
"pwr_tVoid", "pwr_tVoid",
"pwr_tConfigStatusEnum", "pwr_tConfigStatusEnum",
"pwr_tSafetyLevelEnum",
""}; ""};
for ( name = valid_names[0]; strcmp(name,"") != 0; for ( name = valid_names[0]; strcmp(name,"") != 0;
......
...@@ -624,6 +624,18 @@ typedef pwr_tMask pwr_tPrivMask; ...@@ -624,6 +624,18 @@ typedef pwr_tMask pwr_tPrivMask;
*/ */
typedef pwr_tEnum pwr_tConfigStatusEnum; typedef pwr_tEnum pwr_tConfigStatusEnum;
/*_*
@aref safetylevelenum SafetyLevelEnum
*/
typedef pwr_tEnum pwr_tSafetyLevelEnum;
typedef enum {
pwr_eSafetyLevel_None,
pwr_eSafetyLevel_Low,
pwr_eSafetyLevel_High
} pwr_eSafetyLevel;
/* Operating system. */ /* Operating system. */
/*_* /*_*
@aref opsys OpSys @aref opsys OpSys
...@@ -1054,6 +1066,7 @@ struct pwr_s_PlantHier { ...@@ -1054,6 +1066,7 @@ struct pwr_s_PlantHier {
pwr_tURL CircuitDiagram pwr_dAlignW; pwr_tURL CircuitDiagram pwr_dAlignW;
pwr_tURL Photo pwr_dAlignW; pwr_tURL Photo pwr_dAlignW;
pwr_tConfigStatusEnum ConfigurationStatus pwr_dAlignW; pwr_tConfigStatusEnum ConfigurationStatus pwr_dAlignW;
pwr_tSafetyLevelEnum SafetyLevel pwr_dAlignW;
}; };
/* Node defining classes. */ /* Node defining classes. */
...@@ -1123,6 +1136,7 @@ struct pwr_s_LibHier { ...@@ -1123,6 +1136,7 @@ struct pwr_s_LibHier {
struct pwr_s_NodeHier { struct pwr_s_NodeHier {
pwr_tString80 Description pwr_dAlignLW; pwr_tString80 Description pwr_dAlignLW;
pwr_tConfigStatusEnum ConfigurationStatus pwr_dAlignW; pwr_tConfigStatusEnum ConfigurationStatus pwr_dAlignW;
pwr_tSafetyLevelEnum SafetyLevel pwr_dAlignW;
}; };
struct pwr_s_RootVolume { struct pwr_s_RootVolume {
......
...@@ -117,6 +117,19 @@ SObject pwrb:Class ...@@ -117,6 +117,19 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$ConfigStatusEnum" Attr TypeRef = "pwrs:Type-$ConfigStatusEnum"
EndBody EndBody
EndObject EndObject
!/**
! @Summary Safety level.
! Safety level.
! Safety level in the development environment for an hierarchy,
! plcprogram or process graph, set by the designer to indicate
! the level. If a level is set for an object, it is marked with
! a warning trangle.
!*/
Object SafetyLevel $Intern 5
Body SysBody
Attr TypeRef = "pwrs:Type-$SafetyLevelEnum"
EndBody
EndObject
EndObject EndObject
Object DevBody $ObjBodyDef 2 Object DevBody $ObjBodyDef 2
Object ScanTime $Intern 1 Object ScanTime $Intern 1
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2015 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_redwarning.wb_load -- Defines the class RedWarning.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Plc,PlcEdit
! @Summary Red warning triangle
! Red warning triangle.
!*/
Object RedWarning $ClassDef 675
Body SysBody
Attr Flags |= pwr_mClassDef_DevOnly
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_DevBodyOnly
EndBody
Object DevBody $ObjBodyDef 2
Object PlcNode $Buffer 1
Body SysBody
Attr Class = pwr_eClass_PlcNode
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode
Body SysBody
Attr object_type = 11
Attr parameters[0] = 0
Attr parameters[1] = 0
Attr parameters[2] = 0
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 4
Attr graphindex = 49
Attr default_mask[0] = 0
Attr default_mask[1] = 0
Attr segname_annotation = 0
Attr devbody_annotation = 0
Attr compmethod = 2
Attr compindex = 0
Attr tracemethod = 0
Attr traceindex = 0
Attr objname = "RedWarning"
Attr graphname = "RedWarning"
Attr debugpar = ""
EndBody
EndObject
EndObject
EndSObject
...@@ -212,6 +212,19 @@ SObject pwrb:Class ...@@ -212,6 +212,19 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$ConfigStatusEnum" Attr TypeRef = "pwrs:Type-$ConfigStatusEnum"
EndBody EndBody
EndObject EndObject
!/**
! @Summary Safety level.
! Safety level.
! Safety level in the development environment for an hierarchy,
! plcprogram or process graph, set by the designer to indicate
! the level. If a level is set for an object, it is marked with
! a warning trangle.
!*/
Object SafetyLevel $Attribute 17
Body SysBody
Attr TypeRef = "pwrs:Type-$SafetyLevelEnum"
EndBody
EndObject
EndObject EndObject
Object Template XttGraph Object Template XttGraph
Body RtBody Body RtBody
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2015 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_yellowwarning.wb_load -- Defines the class YellowWarning.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Plc,PlcEdit
! @Summary Red warning triangle
! Red warning triangle.
!*/
Object YellowWarning $ClassDef 676
Body SysBody
Attr Flags |= pwr_mClassDef_DevOnly
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_DevBodyOnly
EndBody
Object DevBody $ObjBodyDef 2
Object PlcNode $Buffer 1
Body SysBody
Attr Class = pwr_eClass_PlcNode
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode
Body SysBody
Attr object_type = 11
Attr parameters[0] = 0
Attr parameters[1] = 0
Attr parameters[2] = 0
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 4
Attr graphindex = 48
Attr default_mask[0] = 0
Attr default_mask[1] = 0
Attr segname_annotation = 0
Attr devbody_annotation = 0
Attr compmethod = 2
Attr compindex = 0
Attr tracemethod = 0
Attr traceindex = 0
Attr objname = "YellowWarning"
Attr graphname = "YellowWarning"
Attr debugpar = ""
EndBody
EndObject
EndObject
EndSObject
...@@ -102,6 +102,19 @@ SObject pwrs:Class ...@@ -102,6 +102,19 @@ SObject pwrs:Class
Attr TypeRef = "pwrs:Type-$ConfigStatusEnum" Attr TypeRef = "pwrs:Type-$ConfigStatusEnum"
EndBody EndBody
EndObject EndObject
!/**
! @Summary Safety level.
! Safety level.
! Safety level in the development environment for an hierarchy,
! plcprogram or process graph, set by the designer to indicate
! the level. If a level is set for an object, it is marked with
! a warning trangle.
!*/
Object SafetyLevel $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$SafetyLevelEnum"
EndBody
EndObject
EndObject EndObject
Object NavigatorPosnn $Menu Object NavigatorPosnn $Menu
Object Pointed $Menu Object Pointed $Menu
......
...@@ -155,6 +155,19 @@ SObject pwrs:Class ...@@ -155,6 +155,19 @@ SObject pwrs:Class
Attr TypeRef = "pwrs:Type-$ConfigStatusEnum" Attr TypeRef = "pwrs:Type-$ConfigStatusEnum"
EndBody EndBody
EndObject EndObject
!/**
! @Summary Safety level.
! Safety level.
! Safety level in the development environment for an hierarchy,
! plcprogram or process graph, set by the designer to indicate
! the level. If a level is set for an object, it is marked with
! a warning trangle.
!*/
Object SafetyLevel $Attribute 9
Body SysBody
Attr TypeRef = "pwrs:Type-$SafetyLevelEnum"
EndBody
EndObject
EndObject EndObject
Object NavigatorPosnn $Menu Object NavigatorPosnn $Menu
Object Pointed $Menu Object Pointed $Menu
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2015 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.
!
! pwrs_td_safetylevelenum.wb_load -- Defines the enum type SafetyLevel
!
SObject pwrs:Type
!/**
! @Version 1.0
! @Group Types
! Enumeration for safety level.
!*/
Object $SafetyLevelEnum $TypeDef 25
Body SysBody
Attr TypeRef = "pwrs:Type-$Enum"
Attr PgmName = "SafetyLevelEnum"
EndBody
!/**
! None.
!*/
Object None $Value
Body SysBody
Attr PgmName = "None"
Attr Text = "None"
Attr Value = 0
EndBody
EndObject
!/**
! Low.
!*/
Object Low $Value
Body SysBody
Attr PgmName = "Low"
Attr Text = "Low"
Attr Value = 1
EndBody
EndObject
!/**
! High.
!*/
Object High $Value
Body SysBody
Attr PgmName = "High"
Attr Text = "High"
Attr Value = 2
EndBody
EndObject
EndObject
EndSObject
...@@ -811,9 +811,11 @@ palette PlcEditorPalette ...@@ -811,9 +811,11 @@ palette PlcEditorPalette
class HelpText class HelpText
class HelpTextL class HelpTextL
class Point class Point
class RedWarning
class ShowPlcAttr class ShowPlcAttr
class Text class Text
class Title class Title
class YellowWarning
} }
menu Grafcet menu Grafcet
{ {
......
...@@ -276,6 +276,13 @@ int goen_create_nodetype_m3( ...@@ -276,6 +276,13 @@ int goen_create_nodetype_m3(
flow_CreateNodeClass( ctx, name, flow_eNodeGroup_Common, flow_CreateNodeClass( ctx, name, flow_eNodeGroup_Common,
&nc); &nc);
if ( graph_index == 3) {
flow_AddFilledTriangle( nc, f_delta, -f_yoffs, GOEN_F_GRID,
GOEN_F_GRID, flow_eDrawType_LineRed, flow_mDisplayLevel_1);
flow_AddTriangle( nc, f_delta, -f_yoffs, GOEN_F_GRID,
GOEN_F_GRID, flow_eDrawType_Line, line_width, flow_mDisplayLevel_1);
}
if ( ! (frame_width == 0.0 && frame_height == 0.0)) if ( ! (frame_width == 0.0 && frame_height == 0.0))
{ {
/* Draw a rectangle that is 'hot' only on the lines */ /* Draw a rectangle that is 'hot' only on the lines */
......
...@@ -79,7 +79,9 @@ typedef enum { ...@@ -79,7 +79,9 @@ typedef enum {
goen_eGraphIndex_StoDTgeneric = 44, goen_eGraphIndex_StoDTgeneric = 44,
goen_eGraphIndex_True = 45, goen_eGraphIndex_True = 45,
goen_eGraphIndex_False = 46, goen_eGraphIndex_False = 46,
goen_eGraphIndex_IOSimulFlag = 47 goen_eGraphIndex_IOSimulFlag = 47,
goen_eGraphIndex_YellowWarning = 48,
goen_eGraphIndex_RedWarning = 49
} goen_eGraphIndex; } goen_eGraphIndex;
static float f_pinlength = GOEN_F_PINLENGTH; static float f_pinlength = GOEN_F_PINLENGTH;
...@@ -144,7 +146,14 @@ int goen_create_nodetype_m4( ...@@ -144,7 +146,14 @@ int goen_create_nodetype_m4(
sizeof( annot_str)/sizeof(annot_str[0]), sizeof( annot_str[0])); sizeof( annot_str)/sizeof(annot_str[0]), sizeof( annot_str[0]));
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
flow_CreateNodeClass( ctx, name, flow_eNodeGroup_Common, &nc); switch ( graph_index) {
case goen_eGraphIndex_RedWarning:
case goen_eGraphIndex_YellowWarning:
flow_CreateNodeClass( ctx, name, flow_eNodeGroup_Safety, &nc);
break;
default:
flow_CreateNodeClass( ctx, name, flow_eNodeGroup_Common, &nc);
}
switch ( graph_index) switch ( graph_index)
{ {
...@@ -545,6 +554,24 @@ int goen_create_nodetype_m4( ...@@ -545,6 +554,24 @@ int goen_create_nodetype_m4(
flow_eDrawType_TextHelvetica, GOEN_F_TEXTSIZE); flow_eDrawType_TextHelvetica, GOEN_F_TEXTSIZE);
break; break;
} }
case goen_eGraphIndex_RedWarning:
case goen_eGraphIndex_YellowWarning:
{
flow_eDrawType draw_type;
f_width = GOEN_F_GRID * 2;
f_height = GOEN_F_GRID * 2;
if ( graph_index == goen_eGraphIndex_RedWarning)
draw_type = flow_eDrawType_LineRed;
else
draw_type = flow_eDrawType_Yellow;
flow_AddFilledTriangle( nc, 0, GOEN_F_GRID/2, f_width, f_height, draw_type, flow_mDisplayLevel_1);
flow_AddTriangle( nc, 0, GOEN_F_GRID/2, f_width, f_height, flow_eDrawType_Line, 1, flow_mDisplayLevel_1);
break;
}
} }
*node_class = nc; *node_class = nc;
return GOEN__SUCCESS; return GOEN__SUCCESS;
......
...@@ -1009,154 +1009,99 @@ void WNavBrow::create_nodeclasses() ...@@ -1009,154 +1009,99 @@ void WNavBrow::create_nodeclasses()
brow_AddFrame( nc_object, 0, 0, 20, 0.83, flow_eDrawType_LineGray, -1, 1); brow_AddFrame( nc_object, 0, 0, 20, 0.83, flow_eDrawType_LineGray, -1, 1);
// Create multi object class // Create multi object class
for ( int i = 0; i < wnav_eMultiobject_; i++) {
brow_CreateNodeClass( ctx, "NavigatorObject", char name[20];
flow_eNodeGroup_Common, &nc_multiobject); flow_eDrawType square_drawtype;
brow_AddAnnotPixmap( nc_multiobject, 0, 0.2, 0.1, flow_eDrawType_Line, 2, 0); flow_eDrawType triangle_drawtype;
brow_AddAnnotPixmap( nc_multiobject, 1, 1.1, 0.1, flow_eDrawType_Line, 2, 0);
brow_AddAnnot( nc_multiobject, 2, 0.6, 0, sprintf( name, "NavigatorObject%d", i);
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
0); brow_CreateNodeClass( ctx, name, flow_eNodeGroup_Common, &nc_multiobject[i]);
brow_AddAnnot( nc_multiobject, 7, 0.6, 1, brow_AddAnnotPixmap( nc_multiobject[i], 0, 0.2, 0.1, flow_eDrawType_Line, 2, 0);
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, brow_AddAnnotPixmap( nc_multiobject[i], 1, 1.1, 0.1, flow_eDrawType_Line, 2, 0);
1);
brow_AddAnnot( nc_multiobject, 11, 0.6, 2, switch ( i) {
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, case wnav_eMultiobject_Normal:
1); square_drawtype = flow_eDrawType__;
brow_AddAnnot( nc_multiobject, 15, 0.6, 3, triangle_drawtype = flow_eDrawType__;
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, break;
1); case wnav_eMultiobject_RedSquare:
brow_AddAnnotPixmap( nc_multiobject, 2, 12.2, 0.1, flow_eDrawType_Line, 2, 1); square_drawtype = flow_eDrawType_LineRed;
brow_AddAnnot( nc_multiobject, 12.7, 0.6, 4, triangle_drawtype = flow_eDrawType__;
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, break;
1); case wnav_eMultiobject_YellowSquare:
brow_AddAnnotPixmap( nc_multiobject, 3, 14.2, 0.1, flow_eDrawType_Line, 2, 1); square_drawtype = flow_eDrawType_Yellow;
brow_AddAnnot( nc_multiobject, 14.7, 0.6, 5, triangle_drawtype = flow_eDrawType__;
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, break;
1); case wnav_eMultiobject_GreenSquare:
brow_AddAnnotPixmap( nc_multiobject, 4, 16.2, 0.1, flow_eDrawType_Line, 2, 1); square_drawtype = flow_eDrawType_Green;
brow_AddAnnot( nc_multiobject, 16.7, 0.6, 6, triangle_drawtype = flow_eDrawType__;
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, break;
1); case wnav_eMultiobject_RedTriangle:
brow_AddAnnotPixmap( nc_multiobject, 5, 18.2, 0.1, flow_eDrawType_Line, 2, 1); square_drawtype = flow_eDrawType__;
brow_AddAnnot( nc_multiobject, 18.7, 0.6, 7, triangle_drawtype = flow_eDrawType_LineRed;
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, break;
1); case wnav_eMultiobject_RedSquare_RedTriangle:
brow_AddFrame( nc_multiobject, 0, 0, 20, 0.83, flow_eDrawType_LineGray, -1, 1); square_drawtype = flow_eDrawType_LineRed;
triangle_drawtype = flow_eDrawType_LineRed;
// Create multi object class with red indication break;
case wnav_eMultiobject_YellowSquare_RedTriangle:
brow_CreateNodeClass( ctx, "NavigatorObjectRed", square_drawtype = flow_eDrawType_Yellow;
flow_eNodeGroup_Common, &nc_multiobject_red); triangle_drawtype = flow_eDrawType_LineRed;
brow_AddAnnotPixmap( nc_multiobject_red, 0, 0.2, 0.1, flow_eDrawType_Line, 2, 0); break;
brow_AddAnnotPixmap( nc_multiobject_red, 1, 1.1, 0.1, flow_eDrawType_Line, 2, 0); case wnav_eMultiobject_GreenSquare_RedTriangle:
brow_AddFilledRect( nc_multiobject_red, 1.3, 0.15, 0.4, 0.4, flow_eDrawType_LineRed); square_drawtype = flow_eDrawType_Green;
brow_AddRect( nc_multiobject_red, 1.3, 0.15, 0.4, 0.4, flow_eDrawType_Line, 0, 0); triangle_drawtype = flow_eDrawType_LineRed;
brow_AddAnnot( nc_multiobject_red, 2, 0.6, 0, break;
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, case wnav_eMultiobject_YellowTriangle:
0); square_drawtype = flow_eDrawType__;
brow_AddAnnot( nc_multiobject_red, 7, 0.6, 1, triangle_drawtype = flow_eDrawType_Yellow;
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, break;
1); case wnav_eMultiobject_RedSquare_YellowTriangle:
brow_AddAnnot( nc_multiobject_red, 11, 0.6, 2, square_drawtype = flow_eDrawType_LineRed;
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, triangle_drawtype = flow_eDrawType_Yellow;
1); break;
brow_AddAnnot( nc_multiobject_red, 15, 0.6, 3, case wnav_eMultiobject_YellowSquare_YellowTriangle:
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, square_drawtype = flow_eDrawType_Yellow;
1); triangle_drawtype = flow_eDrawType_Yellow;
brow_AddAnnotPixmap( nc_multiobject_red, 2, 12.2, 0.1, flow_eDrawType_Line, 2, 1); break;
brow_AddAnnot( nc_multiobject_red, 12.7, 0.6, 4, case wnav_eMultiobject_GreenSquare_YellowTriangle:
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, square_drawtype = flow_eDrawType_Green;
1); triangle_drawtype = flow_eDrawType_Yellow;
brow_AddAnnotPixmap( nc_multiobject_red, 3, 14.2, 0.1, flow_eDrawType_Line, 2, 1); break;
brow_AddAnnot( nc_multiobject_red, 14.7, 0.6, 5, }
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1); if ( square_drawtype != flow_eDrawType__) {
brow_AddAnnotPixmap( nc_multiobject_red, 4, 16.2, 0.1, flow_eDrawType_Line, 2, 1); brow_AddFilledRect( nc_multiobject[i], 1.3, 0.15, 0.4, 0.4, square_drawtype);
brow_AddAnnot( nc_multiobject_red, 16.7, 0.6, 6, brow_AddRect( nc_multiobject[i], 1.3, 0.15, 0.4, 0.4, flow_eDrawType_Line, 0, 0);
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, }
1); if ( triangle_drawtype != flow_eDrawType__) {
brow_AddAnnotPixmap( nc_multiobject_red, 5, 18.2, 0.1, flow_eDrawType_Line, 2, 1); brow_AddFilledTriangle( nc_multiobject[i], 1.9, 0.05, 0.5, 0.5, triangle_drawtype);
brow_AddAnnot( nc_multiobject_red, 18.7, 0.6, 7, brow_AddTriangle( nc_multiobject[i], 1.9, 0.05, 0.5, 0.5, flow_eDrawType_Line, 0, 0);
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, }
1);
brow_AddFrame( nc_multiobject_red, 0, 0, 20, 0.83, flow_eDrawType_LineGray, -1, 1); brow_AddAnnot( nc_multiobject[i], 2.77, 0.6, 0,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, 0);
// Create multi object class with yellow indication brow_AddAnnot( nc_multiobject[i], 7.7, 0.6, 1,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, 1);
brow_CreateNodeClass( ctx, "NavigatorObjectYellow", brow_AddAnnot( nc_multiobject[i], 11.7, 0.6, 2,
flow_eNodeGroup_Common, &nc_multiobject_yellow); flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, 1);
brow_AddAnnotPixmap( nc_multiobject_yellow, 0, 0.2, 0.1, flow_eDrawType_Line, 2, 0); brow_AddAnnot( nc_multiobject[i], 15.7, 0.6, 3,
brow_AddAnnotPixmap( nc_multiobject_yellow, 1, 1.1, 0.1, flow_eDrawType_Line, 2, 0); flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, 1);
brow_AddFilledRect( nc_multiobject_yellow, 1.3, 0.15, 0.4, 0.4, flow_eDrawType_Yellow); brow_AddAnnotPixmap( nc_multiobject[i], 2, 12.9, 0.1, flow_eDrawType_Line, 2, 1);
brow_AddRect( nc_multiobject_yellow, 1.3, 0.15, 0.4, 0.4, flow_eDrawType_Line, 0, 0); brow_AddAnnot( nc_multiobject[i], 13.4, 0.6, 4,
brow_AddAnnot( nc_multiobject_yellow, 2, 0.6, 0, flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, 1);
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, brow_AddAnnotPixmap( nc_multiobject[i], 3, 14.9, 0.1, flow_eDrawType_Line, 2, 1);
0); brow_AddAnnot( nc_multiobject[i], 15.4, 0.6, 5,
brow_AddAnnot( nc_multiobject_yellow, 7, 0.6, 1, flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, 1);
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, brow_AddAnnotPixmap( nc_multiobject[i], 4, 16.9, 0.1, flow_eDrawType_Line, 2, 1);
1); brow_AddAnnot( nc_multiobject[i], 17.4, 0.6, 6,
brow_AddAnnot( nc_multiobject_yellow, 11, 0.6, 2, flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, 1);
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, brow_AddAnnotPixmap( nc_multiobject[i], 5, 18.9, 0.1, flow_eDrawType_Line, 2, 1);
1); brow_AddAnnot( nc_multiobject[i], 19.4, 0.6, 7,
brow_AddAnnot( nc_multiobject_yellow, 15, 0.6, 3, flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, 1);
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine, brow_AddFrame( nc_multiobject[i], 0, 0, 20, 0.83, flow_eDrawType_LineGray, -1, 1);
1); }
brow_AddAnnotPixmap( nc_multiobject_yellow, 2, 12.2, 0.1, flow_eDrawType_Line, 2, 1);
brow_AddAnnot( nc_multiobject_yellow, 12.7, 0.6, 4,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddAnnotPixmap( nc_multiobject_yellow, 3, 14.2, 0.1, flow_eDrawType_Line, 2, 1);
brow_AddAnnot( nc_multiobject_yellow, 14.7, 0.6, 5,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddAnnotPixmap( nc_multiobject_yellow, 4, 16.2, 0.1, flow_eDrawType_Line, 2, 1);
brow_AddAnnot( nc_multiobject_yellow, 16.7, 0.6, 6,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddAnnotPixmap( nc_multiobject_yellow, 5, 18.2, 0.1, flow_eDrawType_Line, 2, 1);
brow_AddAnnot( nc_multiobject_yellow, 18.7, 0.6, 7,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddFrame( nc_multiobject_yellow, 0, 0, 20, 0.83, flow_eDrawType_LineGray, -1, 1);
// Create multi object class with green indication
brow_CreateNodeClass( ctx, "NavigatorObjectGreen",
flow_eNodeGroup_Common, &nc_multiobject_green);
brow_AddAnnotPixmap( nc_multiobject_green, 0, 0.2, 0.1, flow_eDrawType_Line, 2, 0);
brow_AddAnnotPixmap( nc_multiobject_green, 1, 1.1, 0.1, flow_eDrawType_Line, 2, 0);
brow_AddFilledRect( nc_multiobject_green, 1.3, 0.15, 0.4, 0.4, flow_eDrawType_Green);
brow_AddRect( nc_multiobject_green, 1.3, 0.15, 0.4, 0.4, flow_eDrawType_Line, 0, 0);
brow_AddAnnot( nc_multiobject_green, 2, 0.6, 0,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
0);
brow_AddAnnot( nc_multiobject_green, 7, 0.6, 1,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddAnnot( nc_multiobject_green, 11, 0.6, 2,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddAnnot( nc_multiobject_green, 15, 0.6, 3,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddAnnotPixmap( nc_multiobject_green, 2, 12.2, 0.1, flow_eDrawType_Line, 2, 1);
brow_AddAnnot( nc_multiobject_green, 12.7, 0.6, 4,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddAnnotPixmap( nc_multiobject_green, 3, 14.2, 0.1, flow_eDrawType_Line, 2, 1);
brow_AddAnnot( nc_multiobject_green, 14.7, 0.6, 5,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddAnnotPixmap( nc_multiobject_green, 4, 16.2, 0.1, flow_eDrawType_Line, 2, 1);
brow_AddAnnot( nc_multiobject_green, 16.7, 0.6, 6,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddAnnotPixmap( nc_multiobject_green, 5, 18.2, 0.1, flow_eDrawType_Line, 2, 1);
brow_AddAnnot( nc_multiobject_green, 18.7, 0.6, 7,
flow_eDrawType_TextHelvetica, 2, flow_eAnnotType_OneLine,
1);
brow_AddFrame( nc_multiobject_green, 0, 0, 20, 0.83, flow_eDrawType_LineGray, -1, 1);
// Create attribute nodeclass // Create attribute nodeclass
......
...@@ -54,10 +54,26 @@ ...@@ -54,10 +54,26 @@
#endif #endif
typedef enum { typedef enum {
wnav_eBrowType_Volume, wnav_eBrowType_Volume,
wnav_eBrowType_Setup, wnav_eBrowType_Setup,
wnav_eBrowType_Other wnav_eBrowType_Other
} wnav_eBrowType; } wnav_eBrowType;
typedef enum {
wnav_eMultiobject_Normal,
wnav_eMultiobject_RedSquare,
wnav_eMultiobject_YellowSquare,
wnav_eMultiobject_GreenSquare,
wnav_eMultiobject_RedTriangle,
wnav_eMultiobject_RedSquare_RedTriangle,
wnav_eMultiobject_YellowSquare_RedTriangle,
wnav_eMultiobject_GreenSquare_RedTriangle,
wnav_eMultiobject_YellowTriangle,
wnav_eMultiobject_RedSquare_YellowTriangle,
wnav_eMultiobject_YellowSquare_YellowTriangle,
wnav_eMultiobject_GreenSquare_YellowTriangle,
wnav_eMultiobject_
} wnav_eMultiobject;
class WNavBrow { class WNavBrow {
public: public:
...@@ -73,10 +89,14 @@ class WNavBrow { ...@@ -73,10 +89,14 @@ class WNavBrow {
BrowCtx *ctx; BrowCtx *ctx;
void *userdata; void *userdata;
brow_tNodeClass nc_object; brow_tNodeClass nc_object;
brow_tNodeClass nc_multiobject; brow_tNodeClass nc_multiobject[wnav_eMultiobject_];
brow_tNodeClass nc_multiobject_red; brow_tNodeClass nc_multiobject_red;
brow_tNodeClass nc_multiobject_yellow; brow_tNodeClass nc_multiobject_yellow;
brow_tNodeClass nc_multiobject_green; brow_tNodeClass nc_multiobject_green;
brow_tNodeClass nc_multiobject_warn;
brow_tNodeClass nc_multiobject_red_warn;
brow_tNodeClass nc_multiobject_yellow_warn;
brow_tNodeClass nc_multiobject_green_warn;
brow_tNodeClass nc_attr; brow_tNodeClass nc_attr;
brow_tNodeClass nc_attr_full; brow_tNodeClass nc_attr_full;
brow_tNodeClass nc_attr_input; brow_tNodeClass nc_attr_input;
......
...@@ -89,7 +89,8 @@ WItemObject::WItemObject( WNav *wnav, pwr_tObjid item_objid, ...@@ -89,7 +89,8 @@ WItemObject::WItemObject( WNav *wnav, pwr_tObjid item_objid,
char segname[120]; char segname[120];
pwr_tObjid child; pwr_tObjid child;
pwr_tClassId classid; pwr_tClassId classid;
pwr_tEnum *config_status; pwr_tEnum *config_status_p, *safety_level_p;
pwr_tEnum config_status, safety_level;
char *descr; char *descr;
char descr_str[200]; char descr_str[200];
int size; int size;
...@@ -110,6 +111,7 @@ WItemObject::WItemObject( WNav *wnav, pwr_tObjid item_objid, ...@@ -110,6 +111,7 @@ WItemObject::WItemObject( WNav *wnav, pwr_tObjid item_objid,
segname, sizeof(segname), &size); segname, sizeof(segname), &size);
// Get ConfigStatus // Get ConfigStatus
config_status = 0;
for ( int i = 0; i < 3; i++) { for ( int i = 0; i < 3; i++) {
switch ( i) { switch ( i) {
case 0: case 0:
...@@ -123,57 +125,117 @@ WItemObject::WItemObject( WNav *wnav, pwr_tObjid item_objid, ...@@ -123,57 +125,117 @@ WItemObject::WItemObject( WNav *wnav, pwr_tObjid item_objid,
break; break;
} }
sts = ldh_GetObjectPar( wnav->ldhses, objid, body, "ConfigurationStatus", sts = ldh_GetObjectPar( wnav->ldhses, objid, body, "ConfigurationStatus",
(char **)&config_status, &size); (char **)&config_status_p, &size);
if ( ODD(sts)) break; if ( ODD(sts)) {
config_status = *config_status_p;
free((char *) config_status_p);
break;
}
} }
if ( EVEN(sts)) { // Get SafetyLevel
nc = wnav->brow->nc_multiobject; safety_level = 0;
for ( int i = 0; i < 3; i++) {
switch ( i) {
case 0:
strcpy( body, "DevBody");
break;
case 1:
strcpy( body, "SysBody");
break;
case 2:
strcpy( body, "RtBody");
break;
}
sts = ldh_GetObjectPar( wnav->ldhses, objid, body, "SafetyLevel",
(char **)&safety_level_p, &size);
if ( ODD(sts)) {
safety_level = *safety_level_p;
free( (char *)safety_level_p);
break;
}
}
if ( config_status == 0) {
switch ( safety_level) {
case pwr_eSafetyLevel_None:
nc = wnav->brow->nc_multiobject[wnav_eMultiobject_Normal];
break;
case pwr_eSafetyLevel_Low:
nc = wnav->brow->nc_multiobject[wnav_eMultiobject_YellowTriangle];
break;
case pwr_eSafetyLevel_High:
nc = wnav->brow->nc_multiobject[wnav_eMultiobject_RedTriangle];
break;
}
strcpy( descr_str, ""); strcpy( descr_str, "");
} }
else { else {
// Evaluate config status // Get enum text
if ( *config_status == 0) { ldh_sParDef adef;
nc = wnav->brow->nc_multiobject; ldh_sValueDef *vd;
strcpy( descr_str, ""); int rows;
}
else { sts = ldh_GetAttrDef( wnav->ldhses, classid, body, "ConfigurationStatus", &adef);
// Get enum text if ( EVEN(sts)) return;
ldh_sParDef adef;
ldh_sValueDef *vd;
int rows;
sts = ldh_GetAttrDef( wnav->ldhses, classid, body, "ConfigurationStatus", &adef);
if ( EVEN(sts)) return;
sts = ldh_GetEnumValueDef( wnav->ldhses, adef.Par->Param.TypeRef, &vd, &rows);
if ( EVEN(sts)) return;
bool found = false; sts = ldh_GetEnumValueDef( wnav->ldhses, adef.Par->Param.TypeRef, &vd, &rows);
int i; if ( EVEN(sts)) return;
for ( i = 0; i < rows; i++) {
if ( vd[i].Value.Value == *config_status) { bool found = false;
found = true; int i;
for ( i = 0; i < rows; i++) {
if ( vd[i].Value.Value == config_status) {
found = true;
break;
}
}
if ( found) {
if ( config_status < 100) {
switch ( safety_level) {
case pwr_eSafetyLevel_None:
nc = wnav->brow->nc_multiobject[wnav_eMultiobject_RedSquare];
break; break;
} case pwr_eSafetyLevel_Low:
nc = wnav->brow->nc_multiobject[wnav_eMultiobject_RedSquare_YellowTriangle];
break;
case pwr_eSafetyLevel_High:
nc = wnav->brow->nc_multiobject[wnav_eMultiobject_RedSquare_RedTriangle];
break;
}
} }
else if ( config_status < 200) {
if ( found) { switch ( safety_level) {
if ( *config_status < 100) case pwr_eSafetyLevel_None:
nc = wnav->brow->nc_multiobject_red; nc = wnav->brow->nc_multiobject[wnav_eMultiobject_YellowSquare];
else if ( *config_status < 200) break;
nc = wnav->brow->nc_multiobject_yellow; case pwr_eSafetyLevel_Low:
else nc = wnav->brow->nc_multiobject[wnav_eMultiobject_YellowSquare_YellowTriangle];
nc = wnav->brow->nc_multiobject_green break;
; case pwr_eSafetyLevel_High:
sprintf( descr_str, "<%s> ", vd[i].Value.Text); nc = wnav->brow->nc_multiobject[wnav_eMultiobject_YellowSquare_RedTriangle];
break;
}
} }
else { else {
nc = wnav->brow->nc_multiobject_red; switch ( safety_level) {
strcpy( descr_str, "<Unknown status> "); case pwr_eSafetyLevel_None:
nc = wnav->brow->nc_multiobject[wnav_eMultiobject_GreenSquare];
break;
case pwr_eSafetyLevel_Low:
nc = wnav->brow->nc_multiobject[wnav_eMultiobject_GreenSquare_YellowTriangle];
break;
case pwr_eSafetyLevel_High:
nc = wnav->brow->nc_multiobject[wnav_eMultiobject_GreenSquare_RedTriangle];
break;
}
} }
free( (char *)vd); sprintf( descr_str, "<%s> ", vd[i].Value.Text);
} }
free((char *) config_status); else {
nc = wnav->brow->nc_multiobject_red;
strcpy( descr_str, "<Unknown status> ");
}
free( (char *)vd);
} }
brow_CreateNode( wnav->brow->ctx, segname, nc, dest, dest_code, (void *) this, brow_CreateNode( wnav->brow->ctx, segname, nc, dest, dest_code, (void *) this,
......
...@@ -1045,6 +1045,69 @@ int FlowDrawGtk::nav_rect_erase( FlowCtx *ctx, int x, int y, int width, int heig ...@@ -1045,6 +1045,69 @@ int FlowDrawGtk::nav_rect_erase( FlowCtx *ctx, int x, int y, int width, int heig
return 1; return 1;
} }
int FlowDrawGtk::triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight, int dimmed)
{
if ( ctx->nodraw) return 1;
if ( gc_type == flow_eDrawType_LineGray && highlight)
gc_type = flow_eDrawType_Line;
GdkPoint p[4] = {{x,y+height},{x+width/2,y},{x+width,y+height},{x,y+height}};
gdk_draw_polygon( window,
gcs[gc_type+highlight][idx], 0, p, 4);
return 1;
}
int FlowDrawGtk::triangle_erase( FlowCtx *ctx, int x, int y, int width, int height,
int idx)
{
if ( ctx->nodraw) return 1;
GdkPoint p[4] = {{x,y+height},{x+width/2,y},{x+width,y+height},{x,y+height}};
gdk_draw_polygon( window,
gcs[flow_eDrawType_LineErase][idx], 0,
p, 4);
return 1;
}
int FlowDrawGtk::nav_triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight)
{
if ( ctx->no_nav || ctx->nodraw) return 1;
if ( gc_type == flow_eDrawType_LineGray && highlight)
gc_type = flow_eDrawType_Line;
GdkPoint p[4] = {{x,y+height},{x+width/2,y},{x+width,y+height},{x,y+height}};
gdk_draw_polygon( nav_window,
gcs[gc_type+highlight][idx], 0, p, 4);
return 1;
}
int FlowDrawGtk::nav_fill_triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type)
{
if ( ctx->no_nav || ctx->nodraw || gc_type != flow_eDrawType_LineRed) return 1;
GdkPoint p[4] = {{x,y+height},{x+width/2,y},{x+width,y+height},{x,y+height}};
gdk_draw_polygon( nav_window,
gcs[gc_type][0], 1, p, 4);
return 1;
}
int FlowDrawGtk::nav_triangle_erase( FlowCtx *ctx, int x, int y, int width, int height,
int idx)
{
if ( ctx->no_nav || ctx->nodraw) return 1;
GdkPoint p[4] = {{x,y+height},{x+width/2,y},{x+width,y+height},{x,y+height}};
gdk_draw_polygon( nav_window,
gcs[flow_eDrawType_LineErase][idx], 0,
p, 4);
return 1;
}
int FlowDrawGtk::arrow( FlowCtx *ctx, int x1, int y1, int x2, int y2, int FlowDrawGtk::arrow( FlowCtx *ctx, int x1, int y1, int x2, int y2,
int x3, int y3, int x3, int y3,
flow_eDrawType gc_type, int idx, int highlight) flow_eDrawType gc_type, int idx, int highlight)
...@@ -1592,6 +1655,23 @@ int FlowDrawGtk::fill_rect( FlowCtx *ctx, int x, int y, int w, int h, ...@@ -1592,6 +1655,23 @@ int FlowDrawGtk::fill_rect( FlowCtx *ctx, int x, int y, int w, int h,
return 1; return 1;
} }
int FlowDrawGtk::fill_triangle( FlowCtx *ctx, int x, int y, int w, int h,
flow_eDrawType gc_type)
{
if ( ctx->nodraw) return 1;
GdkPoint p[4] = {{x,y+h},{x+w/2,y},{x+w,y+h},{x,y+h}};
if ( gc_type == flow_eDrawType_Green)
gdk_draw_polygon( window, gc_green, 1, p, 4);
else if ( gc_type == flow_eDrawType_Yellow)
gdk_draw_polygon( window, gc_yellow, 1, p, 4);
else if ( gc_type == flow_eDrawType_DarkGray)
gdk_draw_polygon( window, gc_darkgray, 1, p, 4);
else
gdk_draw_polygon( window, gcs[gc_type][0], 1, p, 4);
return 1;
}
int FlowDrawGtk::image( FlowCtx *ctx, int x, int y, int width, int height, int FlowDrawGtk::image( FlowCtx *ctx, int x, int y, int width, int height,
flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask) flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask)
{ {
......
...@@ -95,6 +95,16 @@ class FlowDrawGtk : public FlowDraw { ...@@ -95,6 +95,16 @@ class FlowDrawGtk : public FlowDraw {
flow_eDrawType gc_type, int idx, int highlight); flow_eDrawType gc_type, int idx, int highlight);
int nav_rect_erase( FlowCtx *ctx, int x, int y, int width, int height, int nav_rect_erase( FlowCtx *ctx, int x, int y, int width, int height,
int idx); int idx);
int triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight, int dimmed);
int triangle_erase( FlowCtx *ctx, int x, int y, int width, int height,
int idx);
int nav_triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight);
int nav_fill_triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type);
int nav_triangle_erase( FlowCtx *ctx, int x, int y, int width, int height,
int idx);
int arrow( FlowCtx *ctx, int x1, int y1, int x2, int y2, int arrow( FlowCtx *ctx, int x1, int y1, int x2, int y2,
int x3, int y3, int x3, int y3,
flow_eDrawType gc_type, int idx, int highlight); flow_eDrawType gc_type, int idx, int highlight);
...@@ -139,6 +149,8 @@ class FlowDrawGtk : public FlowDraw { ...@@ -139,6 +149,8 @@ class FlowDrawGtk : public FlowDraw {
flow_eDrawType gc_type, int idx, int line, double size); flow_eDrawType gc_type, int idx, int line, double size);
int fill_rect( FlowCtx *ctx, int x, int y, int width, int height, int fill_rect( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type); flow_eDrawType gc_type);
int fill_triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type);
int image( FlowCtx *ctx, int x, int y, int width, int height, int image( FlowCtx *ctx, int x, int y, int width, int height,
flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask); flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask);
int pixmaps_create( FlowCtx *ctx, flow_sPixmapData *pixmap_data, int pixmaps_create( FlowCtx *ctx, flow_sPixmapData *pixmap_data,
......
...@@ -113,7 +113,8 @@ typedef enum { ...@@ -113,7 +113,8 @@ typedef enum {
flow_eObjectType_Radiobutton, flow_eObjectType_Radiobutton,
flow_eObjectType_Frame, flow_eObjectType_Frame,
flow_eObjectType_Image, flow_eObjectType_Image,
flow_eObjectType_AnnotPixmapButton flow_eObjectType_AnnotPixmapButton,
flow_eObjectType_Triangle
} flow_eObjectType; } flow_eObjectType;
typedef enum { typedef enum {
...@@ -132,7 +133,8 @@ typedef enum { ...@@ -132,7 +133,8 @@ typedef enum {
typedef enum { typedef enum {
flow_eNodeGroup_Common, flow_eNodeGroup_Common,
flow_eNodeGroup_Document, flow_eNodeGroup_Document,
flow_eNodeGroup_Trace flow_eNodeGroup_Trace,
flow_eNodeGroup_Safety
} flow_eNodeGroup; } flow_eNodeGroup;
typedef enum { typedef enum {
...@@ -417,6 +419,7 @@ typedef enum { ...@@ -417,6 +419,7 @@ typedef enum {
flow_eSave_Radiobutton = 17, flow_eSave_Radiobutton = 17,
flow_eSave_Frame = 18, flow_eSave_Frame = 18,
flow_eSave_AnnotPixmapButton = 19, flow_eSave_AnnotPixmapButton = 19,
flow_eSave_Triangle = 20,
flow_eSave_End = 99, flow_eSave_End = 99,
flow_eSave_Ctx_zoom_factor = 100, flow_eSave_Ctx_zoom_factor = 100,
flow_eSave_Ctx_base_zoom_factor = 101, flow_eSave_Ctx_base_zoom_factor = 101,
...@@ -472,6 +475,7 @@ typedef enum { ...@@ -472,6 +475,7 @@ typedef enum {
flow_eSave_Rect_ll = 502, flow_eSave_Rect_ll = 502,
flow_eSave_Rect_ur = 503, flow_eSave_Rect_ur = 503,
flow_eSave_Rect_display_level = 504, flow_eSave_Rect_display_level = 504,
flow_eSave_Rect_fill = 505,
flow_eSave_Line_draw_type = 600, flow_eSave_Line_draw_type = 600,
flow_eSave_Line_line_width = 601, flow_eSave_Line_line_width = 601,
flow_eSave_Line_p1 = 602, flow_eSave_Line_p1 = 602,
...@@ -552,7 +556,8 @@ typedef enum { ...@@ -552,7 +556,8 @@ typedef enum {
flow_eSave_Arrow_line_width = 1403, flow_eSave_Arrow_line_width = 1403,
flow_eSave_Arrow_p_dest = 1404, flow_eSave_Arrow_p_dest = 1404,
flow_eSave_Arrow_p1 = 1405, flow_eSave_Arrow_p1 = 1405,
flow_eSave_Arrow_p2 = 1406 flow_eSave_Arrow_p2 = 1406,
flow_eSave_Triangle_rect_part = 2000
} flow_eSave; } flow_eSave;
typedef enum { typedef enum {
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include "flow_annot.h" #include "flow_annot.h"
#include "flow_draw.h" #include "flow_draw.h"
#include "flow_tiptext.h" #include "flow_tiptext.h"
#include "flow_triangle.h"
#include "flow_api.h" #include "flow_api.h"
int flow_Save( flow_tCtx ctx, char *filename) int flow_Save( flow_tCtx ctx, char *filename)
...@@ -377,6 +378,25 @@ void flow_AddFilledRect( flow_tNodeClass nc, double x, double y, ...@@ -377,6 +378,25 @@ void flow_AddFilledRect( flow_tNodeClass nc, double x, double y,
((FlowNodeClass *)nc)->insert( rect); ((FlowNodeClass *)nc)->insert( rect);
} }
void flow_AddTriangle( flow_tNodeClass nc, double x, double y,
double width, double height,
flow_eDrawType draw_type, int line_width, flow_mDisplayLevel display_level)
{
FlowTriangle *triangle = new FlowTriangle( ((FlowNodeClass *)nc)->ctx, x, y,
width, height, draw_type, line_width, 0, display_level);
((FlowNodeClass *)nc)->insert( triangle);
}
void flow_AddFilledTriangle( flow_tNodeClass nc, double x, double y,
double width, double height,
flow_eDrawType draw_type, flow_mDisplayLevel display_level)
{
FlowTriangle *triangle = new FlowTriangle( ((FlowNodeClass *)nc)->ctx, x, y,
width, height, draw_type, 0, 0, display_level, 1);
((FlowNodeClass *)nc)->insert( triangle);
}
void flow_AddLine( flow_tNodeClass nc, double x1, double y1, void flow_AddLine( flow_tNodeClass nc, double x1, double y1,
double x2, double y2, double x2, double y2,
flow_eDrawType draw_type, int line_width) flow_eDrawType draw_type, int line_width)
......
...@@ -177,6 +177,12 @@ void flow_AddRect( flow_tNodeClass nc, double x, double y, ...@@ -177,6 +177,12 @@ void flow_AddRect( flow_tNodeClass nc, double x, double y,
void flow_AddFilledRect( flow_tNodeClass nc, double x, double y, void flow_AddFilledRect( flow_tNodeClass nc, double x, double y,
double width, double height, double width, double height,
flow_eDrawType draw_type, flow_mDisplayLevel display_level); flow_eDrawType draw_type, flow_mDisplayLevel display_level);
void flow_AddTriangle( flow_tNodeClass nc, double x, double y,
double width, double height,
flow_eDrawType draw_type, int line_width, flow_mDisplayLevel display_level);
void flow_AddFilledTriangle( flow_tNodeClass nc, double x, double y,
double width, double height,
flow_eDrawType draw_type, flow_mDisplayLevel display_level);
void flow_AddLine( flow_tNodeClass nc, double x1, double y1, void flow_AddLine( flow_tNodeClass nc, double x1, double y1,
double x2, double y2, double x2, double y2,
flow_eDrawType draw_type, int line_width); flow_eDrawType draw_type, int line_width);
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "flow_ctx.h" #include "flow_ctx.h"
#include "flow_point.h" #include "flow_point.h"
#include "flow_rect.h" #include "flow_rect.h"
#include "flow_triangle.h"
#include "flow_node.h" #include "flow_node.h"
#include "flow_con.h" #include "flow_con.h"
#include "flow_nodeclass.h" #include "flow_nodeclass.h"
...@@ -181,6 +182,12 @@ void FlowArray::copy_from( const FlowArray& array) ...@@ -181,6 +182,12 @@ void FlowArray::copy_from( const FlowArray& array)
insert( n); insert( n);
break; break;
} }
case flow_eObjectType_Triangle:
{
FlowTriangle *n = new FlowTriangle(*(FlowTriangle *)array.a[i]);
insert( n);
break;
}
case flow_eObjectType_Text: case flow_eObjectType_Text:
{ {
FlowText *n = new FlowText(*(FlowText *)array.a[i]); FlowText *n = new FlowText(*(FlowText *)array.a[i]);
...@@ -753,6 +760,13 @@ void FlowArray::open( void *ctx, ifstream& fp) ...@@ -753,6 +760,13 @@ void FlowArray::open( void *ctx, ifstream& fp)
insert( n); insert( n);
break; break;
} }
case flow_eSave_Triangle:
{
FlowTriangle *n = new FlowTriangle( (FlowCtx *) ctx);
n->open( fp);
insert( n);
break;
}
case flow_eSave_Node: case flow_eSave_Node:
{ {
FlowNode *n = new FlowNode( (FlowCtx *) ctx, "", 0, 0, 0); FlowNode *n = new FlowNode( (FlowCtx *) ctx, "", 0, 0, 0);
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include "flow_conpoint.h" #include "flow_conpoint.h"
#include "flow_annot.h" #include "flow_annot.h"
#include "flow_radiobutton.h" #include "flow_radiobutton.h"
#include "flow_triangle.h"
#include "flow_tiptext.h" #include "flow_tiptext.h"
#include "flow_draw.h" #include "flow_draw.h"
#include "flow_browapi.h" #include "flow_browapi.h"
...@@ -351,6 +352,26 @@ void brow_AddFilledRect( brow_tNodeClass nc, double x, double y, ...@@ -351,6 +352,26 @@ void brow_AddFilledRect( brow_tNodeClass nc, double x, double y,
} }
void brow_AddTriangle( brow_tNodeClass nc, double x, double y,
double width, double height,
flow_eDrawType draw_type, int line_width, int fix_line_width)
{
FlowTriangle *rect = new FlowTriangle( ((FlowNodeClass *)nc)->ctx, x, y,
width, height, draw_type, line_width, fix_line_width);
((FlowNodeClass *)nc)->insert( rect);
}
void brow_AddFilledTriangle( brow_tNodeClass nc, double x, double y,
double width, double height,
flow_eDrawType draw_type)
{
FlowTriangle *rect = new FlowTriangle( ((FlowNodeClass *)nc)->ctx, x, y,
width, height, draw_type, 1, 0, flow_mDisplayLevel_1, 1);
((FlowNodeClass *)nc)->insert( rect);
}
void brow_AddFrame( brow_tNodeClass nc, double x, double y, void brow_AddFrame( brow_tNodeClass nc, double x, double y,
double width, double height, double width, double height,
flow_eDrawType draw_type, int line_width, int fix_line_width) flow_eDrawType draw_type, int line_width, int fix_line_width)
......
...@@ -149,6 +149,12 @@ void brow_AddRect( brow_tNodeClass nc, double x, double y, ...@@ -149,6 +149,12 @@ void brow_AddRect( brow_tNodeClass nc, double x, double y,
void brow_AddFilledRect( brow_tNodeClass nc, double x, double y, void brow_AddFilledRect( brow_tNodeClass nc, double x, double y,
double width, double height, double width, double height,
flow_eDrawType draw_type); flow_eDrawType draw_type);
void brow_AddTriangle( brow_tNodeClass nc, double x, double y,
double width, double height,
flow_eDrawType draw_type, int line_width, int fix_line_width);
void brow_AddFilledTriangle( brow_tNodeClass nc, double x, double y,
double width, double height,
flow_eDrawType draw_type);
void brow_AddFrame( brow_tNodeClass nc, double x, double y, void brow_AddFrame( brow_tNodeClass nc, double x, double y,
double width, double height, double width, double height,
flow_eDrawType draw_type, int line_width, int fix_line_width); flow_eDrawType draw_type, int line_width, int fix_line_width);
......
...@@ -68,6 +68,16 @@ class FlowDraw { ...@@ -68,6 +68,16 @@ class FlowDraw {
flow_eDrawType gc_type, int idx, int highlight) {return 1;} flow_eDrawType gc_type, int idx, int highlight) {return 1;}
virtual int nav_rect_erase( FlowCtx *ctx, int x, int y, int width, int height, virtual int nav_rect_erase( FlowCtx *ctx, int x, int y, int width, int height,
int idx) {return 1;} int idx) {return 1;}
virtual int triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight, int dimmed) {return 1;}
virtual int triangle_erase( FlowCtx *ctx, int x, int y, int width, int height,
int idx) {return 1;}
virtual int nav_triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type, int idx, int highlight) {return 1;}
virtual int nav_fill_triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type) {return 1;}
virtual int nav_triangle_erase( FlowCtx *ctx, int x, int y, int width, int height,
int idx) {return 1;}
virtual int arrow( FlowCtx *ctx, int x1, int y1, int x2, int y2, virtual int arrow( FlowCtx *ctx, int x1, int y1, int x2, int y2,
int x3, int y3, int x3, int y3,
flow_eDrawType gc_type, int idx, int highlight) {return 1;} flow_eDrawType gc_type, int idx, int highlight) {return 1;}
...@@ -115,6 +125,8 @@ class FlowDraw { ...@@ -115,6 +125,8 @@ class FlowDraw {
flow_eDrawType gc_type, int idx, int line, double size) {return 1;} flow_eDrawType gc_type, int idx, int line, double size) {return 1;}
virtual int fill_rect( FlowCtx *ctx, int x, int y, int width, int height, virtual int fill_rect( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type) {return 1;} flow_eDrawType gc_type) {return 1;}
virtual int fill_triangle( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type) {return 1;}
virtual int image( FlowCtx *ctx, int x, int y, int width, int height, virtual int image( FlowCtx *ctx, int x, int y, int width, int height,
flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask) {return 1;} flow_tImImage image, flow_tPixmap pixmap, flow_tPixmap clip_mask) {return 1;}
virtual int pixmaps_create( FlowCtx *ctx, flow_sPixmapData *pixmap_data, virtual int pixmaps_create( FlowCtx *ctx, flow_sPixmapData *pixmap_data,
......
...@@ -503,7 +503,7 @@ void FlowNode::nav_draw( int ll_x, int ll_y, int ur_x, int ur_y) ...@@ -503,7 +503,7 @@ void FlowNode::nav_draw( int ll_x, int ll_y, int ur_x, int ur_y)
y_high_pix >= ll_y && y_high_pix >= ll_y &&
y_low_pix <= ur_y) y_low_pix <= ur_y)
{ {
if ( x_right_pix - x_left_pix < 10 && y_high_pix - y_low_pix < 10) if ( x_right_pix - x_left_pix < 10 && y_high_pix - y_low_pix < 10 && nc->group != flow_eNodeGroup_Safety)
ctx->fdraw->nav_rect( ctx, x_left_pix, y_low_pix, ctx->fdraw->nav_rect( ctx, x_left_pix, y_low_pix,
x_right_pix - x_left_pix, y_high_pix - y_low_pix, x_right_pix - x_left_pix, y_high_pix - y_low_pix,
flow_eDrawType_Line, 0, highlight); flow_eDrawType_Line, 0, highlight);
......
...@@ -132,6 +132,20 @@ int FlowPdf::filled_rect( double x, double y, double width, double height, ...@@ -132,6 +132,20 @@ int FlowPdf::filled_rect( double x, double y, double width, double height,
return 1; return 1;
} }
int FlowPdf::triangle( double x, double y, double width, double height, flow_eDrawType type,
double idx, int highlight)
{
topdf->draw_triangle( idx, x - offset_x, offset_y - y - height, width, height);
return 1;
}
int FlowPdf::filled_triangle( double x, double y, double width, double height,
flow_eDrawType type, double idx)
{
topdf->draw_filled_triangle( type, x - offset_x, offset_y - y - height, width, height);
return 1;
}
int FlowPdf::arc( double x, double y, double width, double height, int angle1, int angle2, int FlowPdf::arc( double x, double y, double width, double height, int angle1, int angle2,
flow_eDrawType type, double idx, int highlight) flow_eDrawType type, double idx, int highlight)
{ {
......
...@@ -51,6 +51,8 @@ class FlowPdf : public FlowPrint { ...@@ -51,6 +51,8 @@ class FlowPdf : public FlowPrint {
int print_page( double ll_x, double ll_y, double ur_x, double ur_y); int print_page( double ll_x, double ll_y, double ur_x, double ur_y);
int rect( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight); int rect( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight);
int filled_rect( double x, double y, double width, double height, flow_eDrawType type, double idx); int filled_rect( double x, double y, double width, double height, flow_eDrawType type, double idx);
int triangle( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight);
int filled_triangle( double x, double y, double width, double height, flow_eDrawType type, double idx);
int arc( double x, double y, double width, double height, int angel1, int angel2, int arc( double x, double y, double width, double height, int angel1, int angel2,
flow_eDrawType type, double idx, int highlight); flow_eDrawType type, double idx, int highlight);
int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight); int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight);
......
...@@ -55,6 +55,8 @@ class FlowPrint { ...@@ -55,6 +55,8 @@ class FlowPrint {
virtual int print_page( double ll_x, double ll_y, double ur_x, double ur_y) {return 1;} virtual int print_page( double ll_x, double ll_y, double ur_x, double ur_y) {return 1;}
virtual int rect( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight) { return 1;} virtual int rect( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight) { return 1;}
virtual int filled_rect( double x, double y, double width, double height, flow_eDrawType type, double idx) {return 1;} virtual int filled_rect( double x, double y, double width, double height, flow_eDrawType type, double idx) {return 1;}
virtual int triangle( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight) { return 1;}
virtual int filled_triangle( double x, double y, double width, double height, flow_eDrawType type, double idx) {return 1;}
virtual int arc( double x, double y, double width, double height, int angle1, int angle2, virtual int arc( double x, double y, double width, double height, int angle1, int angle2,
flow_eDrawType type, double idx, int highlight) {return 1;} flow_eDrawType type, double idx, int highlight) {return 1;}
virtual int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight) {return 1;} virtual int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight) {return 1;}
......
...@@ -198,6 +198,64 @@ int FlowPscript::filled_rect( double x, double y, double width, double height, f ...@@ -198,6 +198,64 @@ int FlowPscript::filled_rect( double x, double y, double width, double height, f
return 1; return 1;
} }
int FlowPscript::triangle( double x, double y, double width, double height, flow_eDrawType type,
double idx, int highlight)
{
idx = MAX( 0.5, idx);
if ( type == flow_eDrawType_LineGray) {
fprintf( file, "gsave\n");
fprintf( file, "0.5 setgray\n");
}
if ( highlight && show_red) {
fprintf( file, "gsave\n");
fprintf( file, "0 1 1 0 setcmykcolor\n");
}
setlinewidth( idx);
fprintf( file, "newpath\n");
fprintf( file, "%f %f moveto\n", x-offset_x, offset_y-(y+height));
fprintf( file, "%f %f lineto\n", (x+width/2)-offset_x, offset_y-y);
fprintf( file, "%f %f lineto\n", (x+width)-offset_x, offset_y-(y+height));
fprintf( file, "%f %f lineto\n", x-offset_x, offset_y-(y+height));
fprintf( file, "closepath\n");
fprintf( file, "stroke\n");
if ( type == flow_eDrawType_LineGray)
fprintf( file, "grestore\n");
if ( highlight && show_red)
fprintf( file, "grestore\n");
return 1;
}
int FlowPscript::filled_triangle( double x, double y, double width, double height, flow_eDrawType type,
double idx)
{
if ( type == flow_eDrawType_LineRed) {
fprintf( file, "gsave\n");
fprintf( file, "1.0 0.2 0.2 setrgbcolor\n");
}
else if ( type == flow_eDrawType_Yellow) {
fprintf( file, "gsave\n");
fprintf( file, "1.0 1.0 0.0 setrgbcolor\n");
}
setlinewidth( idx);
fprintf( file, "newpath\n");
fprintf( file, "%f %f moveto\n", x-offset_x, offset_y-(y+height));
fprintf( file, "%f %f lineto\n", (x+width/2)-offset_x, offset_y-y);
fprintf( file, "%f %f lineto\n", (x+width)-offset_x, offset_y-(y+height));
fprintf( file, "%f %f lineto\n", x-offset_x, offset_y-(y+height));
fprintf( file, "closepath\n");
fprintf( file, "fill\n");
if ( type == flow_eDrawType_LineRed || type == flow_eDrawType_Yellow)
fprintf( file, "grestore\n");
return 1;
}
int FlowPscript::arc( double x, double y, double width, double height, int angle1, int angle2, int FlowPscript::arc( double x, double y, double width, double height, int angle1, int angle2,
flow_eDrawType type, double idx, int highlight) flow_eDrawType type, double idx, int highlight)
{ {
......
...@@ -49,6 +49,8 @@ class FlowPscript : public FlowPrint { ...@@ -49,6 +49,8 @@ class FlowPscript : public FlowPrint {
int print_page( double ll_x, double ll_y, double ur_x, double ur_y); int print_page( double ll_x, double ll_y, double ur_x, double ur_y);
int rect( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight); int rect( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight);
int filled_rect( double x, double y, double width, double height, flow_eDrawType type, double idx); int filled_rect( double x, double y, double width, double height, flow_eDrawType type, double idx);
int triangle( double x, double y, double width, double height, flow_eDrawType type, double idx, int highlight);
int filled_triangle( double x, double y, double width, double height, flow_eDrawType type, double idx);
int arc( double x, double y, double width, double height, int angle1, int angle2, int arc( double x, double y, double width, double height, int angle1, int angle2,
flow_eDrawType type, double idx, int highlight); flow_eDrawType type, double idx, int highlight);
int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight); int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight);
......
...@@ -96,6 +96,7 @@ void FlowRect::save( ofstream& fp, flow_eSaveMode mode) ...@@ -96,6 +96,7 @@ void FlowRect::save( ofstream& fp, flow_eSaveMode mode)
fp << int(flow_eSave_Rect_draw_type) << FSPACE << int(draw_type) << endl; fp << int(flow_eSave_Rect_draw_type) << FSPACE << int(draw_type) << endl;
fp << int(flow_eSave_Rect_line_width) << FSPACE << line_width << endl; fp << int(flow_eSave_Rect_line_width) << FSPACE << line_width << endl;
fp << int(flow_eSave_Rect_display_level) << FSPACE << int(display_level) << endl; fp << int(flow_eSave_Rect_display_level) << FSPACE << int(display_level) << endl;
fp << int(flow_eSave_Rect_fill) << FSPACE << fill << endl;
fp << int(flow_eSave_Rect_ll) << endl; fp << int(flow_eSave_Rect_ll) << endl;
ll.save( fp, mode); ll.save( fp, mode);
fp << int(flow_eSave_Rect_ur) << endl; fp << int(flow_eSave_Rect_ur) << endl;
...@@ -118,6 +119,7 @@ void FlowRect::open( ifstream& fp) ...@@ -118,6 +119,7 @@ void FlowRect::open( ifstream& fp)
case flow_eSave_Rect_draw_type: fp >> tmp; draw_type = (flow_eDrawType)tmp; break; case flow_eSave_Rect_draw_type: fp >> tmp; draw_type = (flow_eDrawType)tmp; break;
case flow_eSave_Rect_line_width: fp >> line_width; break; case flow_eSave_Rect_line_width: fp >> line_width; break;
case flow_eSave_Rect_display_level: fp >> tmp; display_level = (flow_mDisplayLevel)tmp; break; case flow_eSave_Rect_display_level: fp >> tmp; display_level = (flow_mDisplayLevel)tmp; break;
case flow_eSave_Rect_fill: fp >> fill; break;
case flow_eSave_Rect_ll: ll.open( fp); break; case flow_eSave_Rect_ll: ll.open( fp); break;
case flow_eSave_Rect_ur: ur.open( fp); break; case flow_eSave_Rect_ur: ur.open( fp); break;
case flow_eSave_End: end_found = 1; break; case flow_eSave_End: end_found = 1; break;
......
...@@ -63,14 +63,14 @@ class FlowRect : public FlowArrayElem { ...@@ -63,14 +63,14 @@ class FlowRect : public FlowArrayElem {
int event_handler( void *pos, flow_eEvent event, int x, int y, void *node); int event_handler( void *pos, flow_eEvent event, int x, int y, void *node);
void conpoint_select( void *pos, int x, int y, double *distance, void conpoint_select( void *pos, int x, int y, double *distance,
void **cp) {}; void **cp) {};
void print( void *pos, void *node, int highlight); virtual void print( void *pos, void *node, int highlight);
void save( ofstream& fp, flow_eSaveMode mode); virtual void save( ofstream& fp, flow_eSaveMode mode);
void open( ifstream& fp); virtual void open( ifstream& fp);
void draw( void *pos, int hightlight, int dimmed, int hot, void *node); virtual void draw( void *pos, int hightlight, int dimmed, int hot, void *node);
void nav_draw( void *pos, int highlight, void *node); virtual void nav_draw( void *pos, int highlight, void *node);
void draw_inverse( void *pos, int hot, void *node); void draw_inverse( void *pos, int hot, void *node);
void erase( void *pos, int hot, void *node); virtual void erase( void *pos, int hot, void *node);
void nav_erase( void *pos, void *node); virtual void nav_erase( void *pos, void *node);
void get_borders( double pos_x, double pos_y, double *x_right, void get_borders( double pos_x, double pos_y, double *x_right,
double *x_left, double *y_high, double *y_low, void *node); double *x_left, double *y_high, double *y_low, void *node);
void move( void *pos, double x, double y, int highlight, int dimmed, int hot); void move( void *pos, double x, double y, int highlight, int dimmed, int hot);
......
...@@ -519,6 +519,53 @@ void CnvToPdf::draw_rect( double lw, double x, double y, double w, double h) ...@@ -519,6 +519,53 @@ void CnvToPdf::draw_rect( double lw, double x, double y, double w, double h)
" " << x << " " << y << " " << w << " " << h << " re S" << endl; " " << x << " " << y << " " << w << " " << h << " re S" << endl;
} }
void CnvToPdf::draw_triangle( double lw, double x, double y, double w, double h)
{
fp[cf] <<
" " << lw << " w" << endl <<
" " << x << " " << y << " m" << endl <<
" " << x+w/2 << " " << y+h << " l" << endl <<
" " << x+w << " " << y << " l" << endl <<
" " << x << " " << y << " l" << endl <<
" S" << endl;
}
void CnvToPdf::draw_filled_triangle( flow_eDrawType color, double x, double y, double w, double h)
{
float r, g, b;
if ( color == flow_eDrawType_LineRed || color == flow_eDrawType_Yellow) {
if ( color == flow_eDrawType_LineRed) {
r = 1;
g = 0.2;
b = 0.2;
}
else if ( color == flow_eDrawType_Yellow) {
r = 1;
g = 1;
b = 0;
}
fp[cf] <<
" /DeviceRGB cs" << endl <<
" " << r << " " << g << " " << b << " sc" << endl;
}
fp[cf] <<
" " << x << " " << y << " m" << endl <<
" " << x+w/2 << " " << y+h << " l" << endl <<
" " << x+w << " " << y << " l" << endl <<
" " << x << " " << y << " l" << endl <<
" f" << endl;
if ( color == flow_eDrawType_LineRed || color == flow_eDrawType_Yellow) {
r = 0;
g = 0;
b = 0;
fp[cf] <<
" " << r << " " << g << " " << b << " sc" << endl;
}
}
void CnvToPdf::draw_arc( double lw, double x, double y, double w, double h, void CnvToPdf::draw_arc( double lw, double x, double y, double w, double h,
int angle1, int angle2) int angle1, int angle2)
{ {
......
...@@ -45,6 +45,7 @@ using namespace std; ...@@ -45,6 +45,7 @@ using namespace std;
#include <vector> #include <vector>
#include <string> #include <string>
#include "pwr.h" #include "pwr.h"
#include "flow.h"
//#include "cnv_style.h" //#include "cnv_style.h"
//#include "cnv_content.h" //#include "cnv_content.h"
...@@ -262,6 +263,8 @@ class CnvToPdf { ...@@ -262,6 +263,8 @@ class CnvToPdf {
void close(); void close();
void print_text( char *text, CnvStyle& style, int mode = pdf_mPrintMode_Pos); void print_text( char *text, CnvStyle& style, int mode = pdf_mPrintMode_Pos);
void draw_rect( double lw, double x, double y, double w, double h); void draw_rect( double lw, double x, double y, double w, double h);
void draw_triangle( double lw, double x, double y, double w, double h);
void draw_filled_triangle( flow_eDrawType color, double x, double y, double w, double h);
void draw_arc( double lw, double x, double y, double w, double h, void draw_arc( double lw, double x, double y, double w, double h,
int angle1, int angle2); int angle1, int angle2);
void draw_line( double lw, double x1, double y1, double x2, double y2, void draw_line( double lw, double x1, double y1, double x2, double y2,
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 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 "flow_std.h"
#include <iostream>
#include "flow_triangle.h"
#include "flow_draw.h"
#include "flow_node.h"
void FlowTriangle::save( ofstream& fp, flow_eSaveMode mode)
{
fp << int(flow_eSave_Triangle) << endl;
fp << int(flow_eSave_Triangle_rect_part) << endl;
FlowRect::save( fp, mode);
fp << int(flow_eSave_End) << endl;
}
void FlowTriangle::open( ifstream& fp)
{
int type;
int end_found = 0;
char dummy[40];
for (;;)
{
fp >> type;
switch( type) {
case flow_eSave_Triangle: break;
case flow_eSave_Triangle_rect_part:
FlowRect::open( fp);
break;
case flow_eSave_End: end_found = 1; break;
default:
cout << "FlowTriangle:open syntax error" << endl;
fp.getline( dummy, sizeof(dummy));
}
if ( end_found)
break;
}
}
void FlowTriangle::draw( void *pos, int highlight, int dimmed, int hot, void *node)
{
if ( !(display_level & ctx->display_level))
return;
int idx;
if ( fix_line_width)
{
idx = line_width;
idx += hot;
if ( idx < 0)
{
erase( pos, hot, node);
return;
}
}
else
{
idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
}
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
ctx->fdraw->triangle( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x, ll.z_y +
((FlowPoint *)pos)->z_y - ctx->offset_y,
ur.z_x - ll.z_x, ur.z_y - ll.z_y, draw_type, idx, highlight, dimmed);
else {
flow_eDrawType dtype;
if ( node && ((FlowNode *)node)->fill_color != flow_eDrawType_Inherit)
dtype = ((FlowNode *)node)->fill_color;
else
dtype = draw_type;
ctx->fdraw->fill_triangle( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x, ll.z_y +
((FlowPoint *)pos)->z_y - ctx->offset_y,
ur.z_x - ll.z_x, ur.z_y - ll.z_y, dtype);
}
}
void FlowTriangle::erase( void *pos, int hot, void *node)
{
if ( !(display_level & ctx->display_level))
return;
int idx;
if ( fix_line_width)
{
idx = line_width;
idx += hot;
if ( idx < 0) return;
}
else
{
idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
}
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
ctx->fdraw->triangle_erase( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x, ll.z_y +
((FlowPoint *)pos)->z_y - ctx->offset_y,
ur.z_x - ll.z_x, ur.z_y - ll.z_y, idx);
else
ctx->fdraw->fill_triangle( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x, ll.z_y +
((FlowPoint *)pos)->z_y - ctx->offset_y,
ur.z_x - ll.z_x, ur.z_y - ll.z_y, flow_eDrawType_LineErase);
}
void FlowTriangle::nav_draw( void *pos, int highlight, void *node)
{
if ( !(display_level & ctx->display_level))
return;
int idx;
if ( fix_line_width)
{
idx = line_width;
if ( idx < 0) return;
}
else
{
idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
}
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
ctx->fdraw->nav_triangle( ctx, ll.nav_z_x + ((FlowPoint *)pos)->nav_z_x -
ctx->nav_offset_x, ll.nav_z_y +
((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
ur.nav_z_x - ll.nav_z_x, ur.nav_z_y - ll.nav_z_y,
draw_type, idx, highlight);
else {
ctx->fdraw->nav_fill_triangle( ctx, ll.nav_z_x + ((FlowPoint *)pos)->nav_z_x -
ctx->nav_offset_x, ll.nav_z_y +
((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
ur.nav_z_x - ll.nav_z_x, ur.nav_z_y - ll.nav_z_y,
draw_type);
}
}
void FlowTriangle::nav_erase( void *pos, void *node)
{
if ( !(display_level & ctx->display_level))
return;
int idx;
if ( fix_line_width)
{
idx = line_width;
if ( idx < 0) return;
}
else
{
idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
}
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
ctx->fdraw->nav_triangle_erase( ctx, ll.nav_z_x + ((FlowPoint *)pos)->nav_z_x -
ctx->nav_offset_x, ll.nav_z_y +
((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
ur.nav_z_x - ll.nav_z_x, ur.nav_z_y - ll.nav_z_y,
idx);
else
ctx->fdraw->nav_fill_triangle( ctx, ll.nav_z_x + ((FlowPoint *)pos)->nav_z_x -
ctx->nav_offset_x, ll.nav_z_y +
((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
ur.nav_z_x - ll.nav_z_x, ur.nav_z_y - ll.nav_z_y,
flow_eDrawType_LineErase);
}
void FlowTriangle::print( void *pos, void *node, int highlight)
{
if ( !(display_level & ctx->display_level))
return;
if ( fix_line_width && line_width < 0)
return;
if ( draw_type == flow_eDrawType_LineErase)
return;
double idx = ctx->print_zoom_factor / ctx->base_zoom_factor * line_width;
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
ctx->current_print->triangle( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
ur.print_z_x - ll.print_z_x, ur.print_z_y - ll.print_z_y,
draw_type, idx, highlight);
else
ctx->current_print->filled_triangle( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
ur.print_z_x - ll.print_z_x, ur.print_z_y - ll.print_z_y,
draw_type, idx);
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2015 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 flow_triangle_h
#define flow_triangle_h
#include <iostream>
#include <fstream>
#include "flow.h"
#include "flow_ctx.h"
#include "flow_point.h"
#include "flow_array_elem.h"
#include "flow_rect.h"
class FlowTriangle : public FlowRect {
public:
FlowTriangle( FlowCtx *flow_ctx, double x = 0, double y = 0, double w = 0,
double h = 0, flow_eDrawType d_type = flow_eDrawType_Line,
int line_w = 1, int fix_line_w = 0,
flow_mDisplayLevel display_lev = flow_mDisplayLevel_1,
int fill_triangle = 0) :
FlowRect(flow_ctx, x, y, w, h, d_type, line_w, fix_line_w, display_lev, fill_triangle) {}
virtual ~FlowTriangle() {}
void save( ofstream& fp, flow_eSaveMode mode);
void open( ifstream& fp);
void draw( void *pos, int hightlight, int dimmed, int hot, void *node);
void nav_draw( void *pos, int highlight, void *node);
void erase( void *pos, int hot, void *node);
void nav_erase( void *pos, void *node);
void print( void *pos, void *node, int highlight);
};
#endif
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