Commit e3b14589 authored by Claes Sjofors's avatar Claes Sjofors

jopg first commit

parent d33e3496
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* 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.
*/
package jpwr.jopg;
public class DynParsedAttrName {
public String name;
public boolean inverted;
public int elements;
public int type;
public int database;
public int bitmask;
}
/*
* 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.
*/
package jpwr.jopg;
public class Glow {
public static final int GLOW__TERMINATED = 21001;
public static final int GLOW__SUBTERMINATED = 21003;
public static final int DRAW_MP = 6;
public static final int DRAW_TYPE_SIZE = 9;
public static final int DRAW_FONT_SIZE = 9;
public static final int eType_Boolean = 0;
public static final int eType_Int = 1;
public static final int eType_Double = 2;
public static final int eType_String = 3;
public static final int eType_DynType1 = 4;
public static final int eType_ActionType1 = 5;
public static final int eType_Direction = 6;
public static final int eType_Color = 7;
public static final int eType_Tone = 8;
public static final int eType_ToneOrColor = 9;
public static final int eType_TraceColor = 10;
public static final int eType_Access = 11;
public static final int eType_Cycle = 12;
public static final int eType_MB3Action = 13;
public static final int eType_Relief = 14;
public static final int eType_InputFocusMark = 15;
public static final int eType_TextSize = 16;
public static final int eType_Adjustment = 17;
public static final int eType_Font = 18;
public static final int eType_Gradient = 19;
public static final int eType_HotIndication = 20;
public static final int eType_AnnotType = 21;
public static final int eType_DynType2 = 22;
public static final int eType_ActionType2 = 23;
public static final int eCtxType_Glow = 0;
public static final int eCtxType_Brow = 1;
public static final int eCtxType_Grow = 2;
public static final int eCtxType_ColPal = 3;
public static final int eCtxType_Curve = 4;
public static final int eSelectPolicy_Surround = 5;
public static final int eSelectPolicy_Partial = 6;
public static final int eSelectPolicy_Both = 7;
public static final int eMB3Action_No = 0;
public static final int eMB3Action_Close = 1;
public static final int eMB3Action_PopupMenu = 2;
public static final int eMB3Action_Both = 3;
public static final int eTextSize_8 = 0;
public static final int eTextSize_10 = 1;
public static final int eTextSize_12 = 2;
public static final int eTextSize_14 = 4;
public static final int eTextSize_18 = 6;
public static final int eTextSize_24 = 8;
public static final int eTextCoding_ISO8859_1 = 0;
public static final int eTextCoding_UTF_8 = 1;
public static final int eLineType_Solid = 0;
public static final int eLineType_Dashed1 = 1;
public static final int eLineType_Dashed2 = 2;
public static final int eLineType_Dashed3 = 3;
public static final int eLineType_Dotted = 4;
public static final int eLineType_DotDashed1 = 5;
public static final int eLineType_DotDashed2 = 6;
public static final int eObjectType_NoObject = 0;
public static final int eObjectType_Node = 1;
public static final int eObjectType_Con = 2;
public static final int eObjectType_Rect = 3;
public static final int eObjectType_Line = 4;
public static final int eObjectType_Arc = 5;
public static final int eObjectType_Text = 6;
public static final int eObjectType_ConPoint = 7;
public static final int eObjectType_Annot = 8;
public static final int eObjectType_NodeClass = 9;
public static final int eObjectType_ConClass = 10;
public static final int eObjectType_Arrow = 11;
public static final int eObjectType_Pixmap = 12;
public static final int eObjectType_AnnotPixmap = 13;
public static final int eObjectType_Radiobutton = 14;
public static final int eObjectType_Frame = 15;
public static final int eObjectType_GrowRect = 16;
public static final int eObjectType_GrowLine = 17;
public static final int eObjectType_GrowArc = 18;
public static final int eObjectType_GrowConPoint = 19;
public static final int eObjectType_GrowSubAnnot = 20;
public static final int eObjectType_PolyLine = 21;
public static final int eObjectType_GrowPolyLine = 22;
public static final int eObjectType_Point = 23;
public static final int eObjectType_GrowNode = 24;
public static final int eObjectType_GrowAnnot = 25;
public static final int eObjectType_GrowText = 26;
public static final int eObjectType_GrowBar = 27;
public static final int eObjectType_GrowTrend = 28;
public static final int eObjectType_GrowSlider = 29;
public static final int eObjectType_GrowImage = 30;
public static final int eObjectType_NodeGroup = 31;
public static final int eObjectType_GrowGroup = 32;
public static final int eObjectType_GrowAxis = 33;
public static final int eObjectType_GrowRectRounded = 34;
public static final int eObjectType_GrowConGlue = 35;
public static final int eObjectType_GrowMenu = 36;
public static final int eObjectType_GrowWindow = 37;
public static final int eObjectType_GrowScrollBar = 38;
public static final int eObjectType_GrowTable = 39;
public static final int eObjectType_GrowFolder = 40;
public static final int eObjectType_GrowXYCurve = 41;
public static final int eObjectType_GrowAxisArc = 42;
public static final int eObjectType_GrowPie = 43;
public static final int eObjectType_GrowBarChart = 44;
public static final int eDirection_Center = 0;
public static final int eDirection_Right = 1;
public static final int eDirection_Left = 2;
public static final int eDirection_Up = 3;
public static final int eDirection_Down = 4;
public static final int eAdjustment_Center = 0;
public static final int eAdjustment_Right = 1;
public static final int eAdjustment_Left = 2;
public static final int eDir_Vertical = 0;
public static final int eDir_Horizontal = 1;
public static final int eVis_Visible = 0;
public static final int eVis_Invisible = 1;
public static final int eVis_Dimmed = 2;
public static final int eNodeGroup_Common = 0;
public static final int eNodeGroup_Document = 1;
public static final int eNodeGroup_Trace = 2;
public static final int eConGroup_Common = 0;
public static final int eConGroup_Trace = 1;
public static final int eAnnotType_OneLine = 0;
public static final int eAnnotType_MultiLine = 1;
public static final int eCycle_Inherit = 0;
public static final int eCycle_Slow = 1;
public static final int eCycle_Fast = 2;
public static final int eConType_Straight = 0;
public static final int eConType_Fixed = 1;
public static final int eConType_AllFixed = 2;
public static final int eConType_Routed = 0;
public static final int eConType_StepDiv = 1;
public static final int eConType_StepConv = 2;
public static final int eConType_TransDiv = 3;
public static final int eConType_TransConv = 4;
public static final int eConType_StraightOneArrow = 5;
public static final int eConType_Reference = 6;
public static final int eCorner_Rounded = 7;
public static final int eCorner_Right = 8;
public static final int eVisible_Full = 0;
public static final int eVisible_Partial = 1;
public static final int eVisible_Top = 2;
public static final int eVisible_Bottom = 3;
public static final int eVisible_Left = 4;
public static final int eVisible_Right = 5;
public static final int eFont_Helvetica = 0;
public static final int eFont_Times = 1;
public static final int eFont_NewCenturySchoolbook = 2;
public static final int eFont_Courier = 3;
public static final int eFont_LucidaSans = 4;
public static final int eFont__ = 5;
public static final int eFont_No = 9999;
public static final int eRelief_Up = 0;
public static final int eRelief_Down = 1;
public static final int eGradient_No = 0;
public static final int eGradient_HorizontalUp = 1;
public static final int eGradient_HorizontalDown = 2;
public static final int eGradient_HorizontalTube1 = 3;
public static final int eGradient_HorizontalTube2 = 4;
public static final int eGradient_VerticalLeft = 5;
public static final int eGradient_VerticalRight = 6;
public static final int eGradient_VerticalTube1 = 7;
public static final int eGradient_VerticalTube2 = 8;
public static final int eGradient_DiagonalUpperLeft = 9;
public static final int eGradient_DiagonalLowerLeft = 10;
public static final int eGradient_DiagonalUpperRight = 11;
public static final int eGradient_DiagonalLowerRight = 12;
public static final int eGradient_DiagonalUpTube = 13;
public static final int eGradient_DiagonalDownTube = 14;
public static final int eGradient_Globe = 15;
public static final int eGradient_RadialCenter = 16;
public static final int eGradient_RadialUpperLeft = 17;
public static final int eGradient_RadialLowerLeft = 18;
public static final int eGradient_RadialUpperRight = 19;
public static final int eGradient_RadialLowerRight = 20;
public static final int eHotIndication_No = 0;
public static final int eHotIndication_LineWidth = 1;
public static final int eHotIndication_DarkColor = 2;
public static final int eHotIndication_LightColor = 3;
public static final int eDrawType_Line = 0;
public static final int eDrawType_LineRed = 1;
public static final int eDrawType_LineGray = 2;
public static final int eDrawType_Color4 = 3;
public static final int eDrawType_Color5 = 4;
public static final int eDrawType_Color6 = 5;
public static final int eDrawType_Color7 = 6;
public static final int eDrawType_Color8 = 7;
public static final int eDrawType_Color9 = 8;
public static final int eDrawType_Color10 = 9;
public static final int eDrawType_Color11 = 10;
public static final int eDrawType_Color12 = 11;
public static final int eDrawType_Color13 = 12;
public static final int eDrawType_Color14 = 13;
public static final int eDrawType_Color15 = 14;
public static final int eDrawType_Color16 = 15;
public static final int eDrawType_Color17 = 16;
public static final int eDrawType_Color18 = 17;
public static final int eDrawType_Color19 = 18;
public static final int eDrawType_Color20 = 19;
public static final int eDrawType_Color21 = 20;
public static final int eDrawType_Color22 = 21;
public static final int eDrawType_Color23 = 22;
public static final int eDrawType_Color24 = 23;
public static final int eDrawType_Color25 = 24;
public static final int eDrawType_Color26 = 25;
public static final int eDrawType_Color27 = 26;
public static final int eDrawType_Color28 = 27;
public static final int eDrawType_Color29 = 28;
public static final int eDrawType_Color30 = 29;
public static final int eDrawType_Color31 = 30;
public static final int eDrawType_Color32 = 31;
public static final int eDrawType_Color33 = 32;
public static final int eDrawType_Color34 = 33;
public static final int eDrawType_Color35 = 34;
public static final int eDrawType_Color36 = 35;
public static final int eDrawType_Color37 = 36;
public static final int eDrawType_Color38 = 37;
public static final int eDrawType_Color39 = 38;
public static final int eDrawType_Color40 = 39;
public static final int eDrawType_Color41 = 40;
public static final int eDrawType_Color42 = 41;
public static final int eDrawType_Color43 = 42;
public static final int eDrawType_Color44 = 43;
public static final int eDrawType_Color45 = 44;
public static final int eDrawType_Color46 = 45;
public static final int eDrawType_Color47 = 46;
public static final int eDrawType_Color48 = 47;
public static final int eDrawType_Color49 = 48;
public static final int eDrawType_Color50 = 49;
public static final int eDrawType_Color51 = 50;
public static final int eDrawType_Color52 = 51;
public static final int eDrawType_Color53 = 52;
public static final int eDrawType_Color54 = 53;
public static final int eDrawType_Color55 = 54;
public static final int eDrawType_Color56 = 55;
public static final int eDrawType_Color57 = 56;
public static final int eDrawType_Color58 = 57;
public static final int eDrawType_Color59 = 58;
public static final int eDrawType_Color60 = 59;
public static final int eDrawType_Color61 = 60;
public static final int eDrawType_Color62 = 61;
public static final int eDrawType_Color63 = 62;
public static final int eDrawType_Color64 = 63;
public static final int eDrawType_Color65 = 64;
public static final int eDrawType_Color66 = 65;
public static final int eDrawType_Color67 = 66;
public static final int eDrawType_Color68 = 67;
public static final int eDrawType_Color69 = 68;
public static final int eDrawType_Color70 = 69;
public static final int eDrawType_Color71 = 70;
public static final int eDrawType_Color72 = 71;
public static final int eDrawType_Color73 = 72;
public static final int eDrawType_Color74 = 73;
public static final int eDrawType_Color75 = 74;
public static final int eDrawType_Color76 = 75;
public static final int eDrawType_Color77 = 76;
public static final int eDrawType_Color78 = 77;
public static final int eDrawType_Color79 = 78;
public static final int eDrawType_Color80 = 79;
public static final int eDrawType_Color81 = 80;
public static final int eDrawType_Color82 = 81;
public static final int eDrawType_Color83 = 82;
public static final int eDrawType_Color84 = 83;
public static final int eDrawType_Color85 = 84;
public static final int eDrawType_Color86 = 85;
public static final int eDrawType_Color87 = 86;
public static final int eDrawType_Color88 = 87;
public static final int eDrawType_Color89 = 88;
public static final int eDrawType_Color90 = 89;
public static final int eDrawType_Color91 = 90;
public static final int eDrawType_Color92 = 91;
public static final int eDrawType_Color93 = 92;
public static final int eDrawType_Color94 = 93;
public static final int eDrawType_Color95 = 94;
public static final int eDrawType_Color96 = 95;
public static final int eDrawType_Color97 = 96;
public static final int eDrawType_Color98 = 97;
public static final int eDrawType_Color99 = 98;
public static final int eDrawType_Color100 = 99;
public static final int eDrawType_Color101 = 100;
public static final int eDrawType_Color102 = 101;
public static final int eDrawType_Color103 = 102;
public static final int eDrawType_Color104 = 103;
public static final int eDrawType_Color105 = 104;
public static final int eDrawType_Color106 = 105;
public static final int eDrawType_Color107 = 106;
public static final int eDrawType_Color108 = 107;
public static final int eDrawType_Color109 = 108;
public static final int eDrawType_Color110 = 109;
public static final int eDrawType_Color111 = 110;
public static final int eDrawType_Color112 = 111;
public static final int eDrawType_Color113 = 112;
public static final int eDrawType_Color114 = 113;
public static final int eDrawType_Color115 = 114;
public static final int eDrawType_Color116 = 115;
public static final int eDrawType_Color117 = 116;
public static final int eDrawType_Color118 = 117;
public static final int eDrawType_Color119 = 118;
public static final int eDrawType_Color120 = 119;
public static final int eDrawType_Color121 = 120;
public static final int eDrawType_Color122 = 121;
public static final int eDrawType_Color123 = 122;
public static final int eDrawType_Color124 = 123;
public static final int eDrawType_Color125 = 124;
public static final int eDrawType_Color126 = 125;
public static final int eDrawType_Color127 = 126;
public static final int eDrawType_Color128 = 127;
public static final int eDrawType_Color129 = 128;
public static final int eDrawType_Color130 = 129;
public static final int eDrawType_Color131 = 130;
public static final int eDrawType_Color132 = 131;
public static final int eDrawType_Color133 = 132;
public static final int eDrawType_Color134 = 133;
public static final int eDrawType_Color135 = 134;
public static final int eDrawType_Color136 = 135;
public static final int eDrawType_Color137 = 136;
public static final int eDrawType_Color138 = 137;
public static final int eDrawType_Color139 = 138;
public static final int eDrawType_Color140 = 139;
public static final int eDrawType_Color141 = 140;
public static final int eDrawType_Color142 = 141;
public static final int eDrawType_Color143 = 142;
public static final int eDrawType_Color144 = 143;
public static final int eDrawType_Color145 = 144;
public static final int eDrawType_Color146 = 145;
public static final int eDrawType_Color147 = 146;
public static final int eDrawType_Color148 = 147;
public static final int eDrawType_Color149 = 148;
public static final int eDrawType_Color150 = 149;
public static final int eDrawType_Color151 = 150;
public static final int eDrawType_Color152 = 151;
public static final int eDrawType_Color153 = 152;
public static final int eDrawType_Color154 = 153;
public static final int eDrawType_Color155 = 154;
public static final int eDrawType_Color156 = 155;
public static final int eDrawType_Color157 = 156;
public static final int eDrawType_Color158 = 157;
public static final int eDrawType_Color159 = 158;
public static final int eDrawType_Color160 = 159;
public static final int eDrawType_Color161 = 160;
public static final int eDrawType_Color162 = 161;
public static final int eDrawType_Color163 = 162;
public static final int eDrawType_Color164 = 163;
public static final int eDrawType_Color165 = 164;
public static final int eDrawType_Color166 = 165;
public static final int eDrawType_Color167 = 166;
public static final int eDrawType_Color168 = 167;
public static final int eDrawType_Color169 = 168;
public static final int eDrawType_Color170 = 169;
public static final int eDrawType_Color171 = 170;
public static final int eDrawType_Color172 = 171;
public static final int eDrawType_Color173 = 172;
public static final int eDrawType_Color174 = 173;
public static final int eDrawType_Color175 = 174;
public static final int eDrawType_Color176 = 175;
public static final int eDrawType_Color177 = 176;
public static final int eDrawType_Color178 = 177;
public static final int eDrawType_Color179 = 178;
public static final int eDrawType_Color180 = 179;
public static final int eDrawType_Color181 = 180;
public static final int eDrawType_Color182 = 181;
public static final int eDrawType_Color183 = 182;
public static final int eDrawType_Color184 = 183;
public static final int eDrawType_Color185 = 184;
public static final int eDrawType_Color186 = 185;
public static final int eDrawType_Color187 = 186;
public static final int eDrawType_Color188 = 187;
public static final int eDrawType_Color189 = 188;
public static final int eDrawType_Color190 = 189;
public static final int eDrawType_Color191 = 190;
public static final int eDrawType_Color192 = 191;
public static final int eDrawType_Color193 = 192;
public static final int eDrawType_Color194 = 193;
public static final int eDrawType_Color195 = 194;
public static final int eDrawType_Color196 = 195;
public static final int eDrawType_Color197 = 196;
public static final int eDrawType_Color198 = 197;
public static final int eDrawType_Color199 = 198;
public static final int eDrawType_Color200 = 199;
public static final int eDrawType_Color201 = 200;
public static final int eDrawType_Color202 = 201;
public static final int eDrawType_Color203 = 202;
public static final int eDrawType_Color204 = 203;
public static final int eDrawType_Color205 = 204;
public static final int eDrawType_Color206 = 205;
public static final int eDrawType_Color207 = 206;
public static final int eDrawType_Color208 = 207;
public static final int eDrawType_Color209 = 208;
public static final int eDrawType_Color210 = 209;
public static final int eDrawType_Color211 = 210;
public static final int eDrawType_Color212 = 211;
public static final int eDrawType_Color213 = 212;
public static final int eDrawType_Color214 = 213;
public static final int eDrawType_Color215 = 214;
public static final int eDrawType_Color216 = 215;
public static final int eDrawType_Color217 = 216;
public static final int eDrawType_Color218 = 217;
public static final int eDrawType_Color219 = 218;
public static final int eDrawType_Color220 = 219;
public static final int eDrawType_Color221 = 220;
public static final int eDrawType_Color222 = 221;
public static final int eDrawType_Color223 = 222;
public static final int eDrawType_Color224 = 223;
public static final int eDrawType_Color225 = 224;
public static final int eDrawType_Color226 = 225;
public static final int eDrawType_Color227 = 226;
public static final int eDrawType_Color228 = 227;
public static final int eDrawType_Color229 = 228;
public static final int eDrawType_Color230 = 229;
public static final int eDrawType_Color231 = 230;
public static final int eDrawType_Color232 = 231;
public static final int eDrawType_Color233 = 232;
public static final int eDrawType_Color234 = 233;
public static final int eDrawType_Color235 = 234;
public static final int eDrawType_Color236 = 235;
public static final int eDrawType_Color237 = 236;
public static final int eDrawType_Color238 = 237;
public static final int eDrawType_Color239 = 238;
public static final int eDrawType_Color240 = 239;
public static final int eDrawType_Color241 = 240;
public static final int eDrawType_Color242 = 241;
public static final int eDrawType_Color243 = 242;
public static final int eDrawType_Color244 = 243;
public static final int eDrawType_Color245 = 244;
public static final int eDrawType_Color246 = 245;
public static final int eDrawType_Color247 = 246;
public static final int eDrawType_Color248 = 247;
public static final int eDrawType_Color249 = 248;
public static final int eDrawType_Color250 = 249;
public static final int eDrawType_Color251 = 250;
public static final int eDrawType_Color252 = 251;
public static final int eDrawType_Color253 = 252;
public static final int eDrawType_Color254 = 253;
public static final int eDrawType_Color255 = 254;
public static final int eDrawType_Color256 = 255;
public static final int eDrawType_Color257 = 256;
public static final int eDrawType_Color258 = 257;
public static final int eDrawType_Color259 = 258;
public static final int eDrawType_Color260 = 259;
public static final int eDrawType_Color261 = 260;
public static final int eDrawType_Color262 = 261;
public static final int eDrawType_Color263 = 262;
public static final int eDrawType_Color264 = 263;
public static final int eDrawType_Color265 = 264;
public static final int eDrawType_Color266 = 265;
public static final int eDrawType_Color267 = 266;
public static final int eDrawType_Color268 = 267;
public static final int eDrawType_Color269 = 268;
public static final int eDrawType_Color270 = 269;
public static final int eDrawType_Color271 = 270;
public static final int eDrawType_Color272 = 271;
public static final int eDrawType_Color273 = 272;
public static final int eDrawType_Color274 = 273;
public static final int eDrawType_Color275 = 274;
public static final int eDrawType_Color276 = 275;
public static final int eDrawType_Color277 = 276;
public static final int eDrawType_Color278 = 277;
public static final int eDrawType_Color279 = 278;
public static final int eDrawType_Color280 = 279;
public static final int eDrawType_Color281 = 280;
public static final int eDrawType_Color282 = 281;
public static final int eDrawType_Color283 = 282;
public static final int eDrawType_Color284 = 283;
public static final int eDrawType_Color285 = 284;
public static final int eDrawType_Color286 = 285;
public static final int eDrawType_Color287 = 286;
public static final int eDrawType_Color288 = 287;
public static final int eDrawType_Color289 = 288;
public static final int eDrawType_Color290 = 289;
public static final int eDrawType_Color291 = 290;
public static final int eDrawType_Color292 = 291;
public static final int eDrawType_Color293 = 292;
public static final int eDrawType_Color294 = 293;
public static final int eDrawType_Color295 = 294;
public static final int eDrawType_Color296 = 295;
public static final int eDrawType_Color297 = 296;
public static final int eDrawType_Color298 = 297;
public static final int eDrawType_Color299 = 298;
public static final int eDrawType_Color300 = 299;
public static final int eDrawType_LineErase = 300;
public static final int eDrawType_LineDashed = 301;
public static final int eDrawType_LineDashedRed = 302;
public static final int eDrawType_TextHelvetica = 303;
public static final int eDrawType_TextHelveticaBold = 304;
public static final int eDrawType_TextHelveticaErase = 305;
public static final int eDrawType_TextHelveticaEraseBold = 306;
public static final int eDrawType__ = 307;
public static final int eDrawType_Inherit = 9999;
public static final int eDrawType_No = 10000;
public static final int eDrawType_FillHighlight = eDrawType_Color174;
public static final int eDrawType_LineHighlight = eDrawType_Color176;
public static final int eDrawType_ColorYellow = eDrawType_Color115;
public static final int eDrawType_ColorRed = eDrawType_Color177;
public static final int eDrawType_DarkGray = eDrawType_Color30;
public static final int eDrawType_MediumGray = eDrawType_Color25;
public static final int eDrawType_LightGray = eDrawType_Color21;
public static final int eDrawTone_No = 0;
public static final int eDrawTone_Gray = 1;
public static final int eDrawTone_YellowGreen = 2;
public static final int eDrawTone_Yellow = 3;
public static final int eDrawTone_Orange = 4;
public static final int eDrawTone_Red = 5;
public static final int eDrawTone_Magenta = 6;
public static final int eDrawTone_Blue = 7;
public static final int eDrawTone_Seablue = 8;
public static final int eDrawTone_Green = 9;
public static final int eDrawTone_DarkGray = 10;
public static final int eDrawTone_DarkYellowGreen = 11;
public static final int eDrawTone_DarkYellow = 12;
public static final int eDrawTone_DarkOrange = 13;
public static final int eDrawTone_DarkRed = 14;
public static final int eDrawTone_DarkMagenta = 15;
public static final int eDrawTone_DarkBlue = 16;
public static final int eDrawTone_DarkSeablue = 17;
public static final int eDrawTone_DarkGreen = 18;
public static final int eDrawTone_LightGray = 19;
public static final int eDrawTone_LightYellowGreen = 20;
public static final int eDrawTone_LightYellow = 21;
public static final int eDrawTone_LightOrange = 22;
public static final int eDrawTone_LightRed = 23;
public static final int eDrawTone_LightMagenta = 24;
public static final int eDrawTone_LightBlue = 25;
public static final int eDrawTone_LightSeablue = 26;
public static final int eDrawTone_LightGreen = 27;
public static final int eDrawTone_GrayHighSaturation = 28;
public static final int eDrawTone_YellowGreenHighSaturation = 29;
public static final int eDrawTone_YellowHighSaturation = 30;
public static final int eDrawTone_OrangeHighSaturation = 31;
public static final int eDrawTone_RedHighSaturation = 32;
public static final int eDrawTone_MagentaHighSaturation = 33;
public static final int eDrawTone_BlueHighSaturation = 34;
public static final int eDrawTone_SeablueHighSaturation = 35;
public static final int eDrawTone_GreenHighSaturation = 36;
public static final int eDrawTone_DarkGrayHighSaturation = 37;
public static final int eDrawTone_DarkYellowGreenHighSaturation = 38;
public static final int eDrawTone_DarkYellowHighSaturation = 39;
public static final int eDrawTone_DarkOrangeHighSaturation = 40;
public static final int eDrawTone_DarkRedHighSaturation = 41;
public static final int eDrawTone_DarkMagentaHighSaturation = 42;
public static final int eDrawTone_DarkBlueHighSaturation = 43;
public static final int eDrawTone_DarkSeablueHighSaturation = 44;
public static final int eDrawTone_DarkGreenHighSaturation = 45;
public static final int eDrawTone_LightGrayHighSaturation = 46;
public static final int eDrawTone_LightYellowGreenHighSaturation = 47;
public static final int eDrawTone_LightYellowHighSaturation = 48;
public static final int eDrawTone_LightOrangeHighSaturation = 49;
public static final int eDrawTone_LightRedHighSaturation = 50;
public static final int eDrawTone_LightMagentaHighSaturation = 51;
public static final int eDrawTone_LightBlueHighSaturation = 52;
public static final int eDrawTone_LightSeablueHighSaturation = 53;
public static final int eDrawTone_LightGreenHighSaturation = 54;
public static final int eDrawTone_GrayLowSaturation = 55;
public static final int eDrawTone_YellowGreenLowSaturation = 56;
public static final int eDrawTone_YellowLowSaturation = 57;
public static final int eDrawTone_OrangeLowSaturation = 58;
public static final int eDrawTone_RedLowSaturation = 59;
public static final int eDrawTone_MagentaLowSaturation = 60;
public static final int eDrawTone_BlueLowSaturation = 61;
public static final int eDrawTone_SeablueLowSaturation = 62;
public static final int eDrawTone_GreenLowSaturation = 63;
public static final int eDrawTone_DarkGrayLowSaturation = 64;
public static final int eDrawTone_DarkYellowGreenLowSaturation = 65;
public static final int eDrawTone_DarkYellowLowSaturation = 66;
public static final int eDrawTone_DarkOrangeLowSaturation = 67;
public static final int eDrawTone_DarkRedLowSaturation = 68;
public static final int eDrawTone_DarkMagentaLowSaturation = 69;
public static final int eDrawTone_DarkBlueLowSaturation = 70;
public static final int eDrawTone_DarkSeablueLowSaturation = 71;
public static final int eDrawTone_DarkGreenLowSaturation = 72;
public static final int eDrawTone_LightGrayLowSaturation = 73;
public static final int eDrawTone_LightYellowGreenLowSaturation = 74;
public static final int eDrawTone_LightYellowLowSaturation = 75;
public static final int eDrawTone_LightOrangeLowSaturation = 76;
public static final int eDrawTone_LightRedLowSaturation = 77;
public static final int eDrawTone_LightMagentaLowSaturation = 78;
public static final int eDrawTone_LightBlueLowSaturation = 79;
public static final int eDrawTone_LightSeablueLowSaturation = 80;
public static final int eDrawTone_LightGreenLowSaturation = 81;
public static final int eDrawTone__ = 82;
public static final int eScaleType_LowerLeft = 0;
public static final int eScaleType_LowerRight = 1;
public static final int eScaleType_UpperRight = 2;
public static final int eScaleType_UpperLeft = 3;
public static final int eScaleType_Left = 4;
public static final int eScaleType_Up = 5;
public static final int eScaleType_Right = 6;
public static final int eScaleType_Down = 7;
public static final int eScaleType_Center = 8;
public static final int eScaleType_FixPoint = 9;
public static final int eScaleType_No = 10;
public static final int eRotationPoint_LowerLeft = 0;
public static final int eRotationPoint_LowerRight = 1;
public static final int eRotationPoint_UpperRight = 2;
public static final int eRotationPoint_UpperLeft = 3;
public static final int eRotationPoint_Center = 4;
public static final int eRotationPoint_FixPoint = 5;
public static final int eRotationPoint_Zero = 6;
public static final int eTraceType_Boolean = 0;
public static final int eTraceType_Int32 = 1;
public static final int eTraceType_Float32 = 2;
public static final int eTraceType_User = 3;
public static final int eMenuItem_Button = 0;
public static final int eMenuItem_ButtonDisabled = 1;
public static final int eMenuItem_PulldownMenu = 2;
public static final int eUserdataCbType_Node = 0;
public static final int eUserdataCbType_Ctx = 1;
public static final int eUserdataCbType_NodeClass = 2;
public static final int eSaveMode_Edit = 0;
public static final int eSaveMode_Trace = 1;
public static final int eSaveMode_SubGraph = 2;
public static final int eSaveMode_ReadConfigOnly = 3;
public static final int eSave_Comment = 0;
public static final int eSave_Ctx = 1;
public static final int eSave_Array = 2;
public static final int eSave_NodeClass = 3;
public static final int eSave_ConClass = 4;
public static final int eSave_Rect = 5;
public static final int eSave_Line = 6;
public static final int eSave_Point = 7;
public static final int eSave_Arc = 8;
public static final int eSave_Text = 9;
public static final int eSave_Node = 10;
public static final int eSave_Con = 11;
public static final int eSave_ConPoint = 12;
public static final int eSave_Annot = 13;
public static final int eSave_Arrow = 14;
public static final int eSave_Pixmap = 15;
public static final int eSave_AnnotPixmap = 16;
public static final int eSave_Radiobutton = 17;
public static final int eSave_Frame = 18;
public static final int eSave_GrowRect = 19;
public static final int eSave_GrowLine = 20;
public static final int eSave_GrowConPoint = 21;
public static final int eSave_GrowCtx = 22;
public static final int eSave_GrowSubAnnot = 23;
public static final int eSave_GrowArc = 24;
public static final int eSave_PolyLine = 25;
public static final int eSave_GrowPolyLine = 26;
public static final int eSave_GrowNode = 27;
public static final int eSave_Transform = 28;
public static final int eSave_GrowAnnot = 29;
public static final int eSave_GrowText = 30;
public static final int eSave_GrowBar = 31;
public static final int eSave_GrowTrend = 32;
public static final int eSave_GrowSlider = 33;
public static final int eSave_GrowImage = 34;
public static final int eSave_GrowGroup = 35;
public static final int eSave_NodeGroup = 36;
public static final int eSave_GrowAxis = 37;
public static final int eSave_GrowRectRounded = 38;
public static final int eSave_GrowConGlue = 39;
public static final int eSave_GrowWindow = 40;
public static final int eSave_GrowFolder = 41;
public static final int eSave_GrowTable = 42;
public static final int eSave_GrowXYCurve = 43;
public static final int eSave_GrowAxisArc = 44;
public static final int eSave_GrowPie = 45;
public static final int eSave_GrowBarChart = 46;
public static final int eSave_End = 99;
public static final int eSave_Ctx_zoom_factor_x = 100;
public static final int eSave_Ctx_base_zoom_factor = 101;
public static final int eSave_Ctx_offset_x = 102;
public static final int eSave_Ctx_offset_y = 103;
public static final int eSave_Ctx_nav_zoom_factor_x = 104;
public static final int eSave_Ctx_print_zoom_factor = 105;
public static final int eSave_Ctx_nav_offset_x = 106;
public static final int eSave_Ctx_nav_offset_y = 107;
public static final int eSave_Ctx_x_right = 108;
public static final int eSave_Ctx_x_left = 109;
public static final int eSave_Ctx_y_high = 110;
public static final int eSave_Ctx_y_low = 111;
public static final int eSave_Ctx_window_width = 112;
public static final int eSave_Ctx_window_height = 113;
public static final int eSave_Ctx_nav_window_width = 114;
public static final int eSave_Ctx_nav_window_height = 115;
public static final int eSave_Ctx_nav_rect_ll_x = 116;
public static final int eSave_Ctx_nav_rect_ll_y = 117;
public static final int eSave_Ctx_nav_rect_ur_x = 118;
public static final int eSave_Ctx_nav_rect_ur_y = 119;
public static final int eSave_Ctx_nav_rect_hot = 120;
public static final int eSave_Ctx_name = 121;
public static final int eSave_Ctx_user_highlight = 122;
public static final int eSave_Ctx_a_nc = 123;
public static final int eSave_Ctx_a_cc = 124;
public static final int eSave_Ctx_a = 125;
public static final int eSave_Ctx_grid_size_x = 126;
public static final int eSave_Ctx_grid_size_y = 127;
public static final int eSave_Ctx_grid_on = 128;
public static final int eSave_Ctx_draw_delta = 129;
public static final int eSave_Ctx_refcon_width = 130;
public static final int eSave_Ctx_refcon_height = 131;
public static final int eSave_Ctx_refcon_textsize = 132;
public static final int eSave_Ctx_refcon_linewidth = 133;
public static final int eSave_Ctx_grow = 134;
public static final int eSave_Ctx_zoom_factor_y = 135;
public static final int eSave_Ctx_nav_zoom_factor_y = 136;
public static final int eSave_Ctx_version = 137;
public static final int eSave_Ctx_hot_indication = 138;
public static final int eSave_Ctx_tiptext_size = 139;
public static final int eSave_Ctx_comment = 199;
public static final int eSave_Array_a = 200;
public static final int eSave_NodeClass_nc_name = 300;
public static final int eSave_NodeClass_a = 301;
public static final int eSave_NodeClass_group = 302;
public static final int eSave_NodeClass_dynamic = 303;
public static final int eSave_NodeClass_dynamicsize = 304;
public static final int eSave_NodeClass_arg_cnt = 305;
public static final int eSave_NodeClass_argname = 306;
public static final int eSave_NodeClass_argtype = 307;
public static final int eSave_NodeClass_dyn_type1 = 308;
public static final int eSave_NodeClass_dyn_color1 = 309;
public static final int eSave_NodeClass_no_con_obstacle = 310;
public static final int eSave_NodeClass_slider = 311;
public static final int eSave_NodeClass_java_name = 312;
public static final int eSave_NodeClass_dyn_color2 = 313;
public static final int eSave_NodeClass_next_nodeclass = 314;
public static final int eSave_NodeClass_animation_count = 315;
public static final int eSave_NodeClass_cycle = 316;
public static final int eSave_NodeClass_y0 = 317;
public static final int eSave_NodeClass_y1 = 318;
public static final int eSave_NodeClass_x0 = 319;
public static final int eSave_NodeClass_x1 = 320;
public static final int eSave_NodeClass_dyn_action_type1 = 321;
public static final int eSave_NodeClass_dyn_color3 = 322;
public static final int eSave_NodeClass_dyn_color4 = 323;
public static final int eSave_NodeClass_dyn_attr1 = 324;
public static final int eSave_NodeClass_dyn_attr2 = 325;
public static final int eSave_NodeClass_dyn_attr3 = 326;
public static final int eSave_NodeClass_dyn_attr4 = 327;
public static final int eSave_NodeClass_input_focus_mark = 328;
public static final int eSave_NodeClass_userdata_cb = 329;
public static final int eSave_NodeClass_dyn_type2 = 330;
public static final int eSave_NodeClass_dyn_action_type2 = 331;
public static final int eSave_ConClass_cc_name = 400;
public static final int eSave_ConClass_con_type = 401;
public static final int eSave_ConClass_corner = 402;
public static final int eSave_ConClass_draw_type = 403;
public static final int eSave_ConClass_line_width = 404;
public static final int eSave_ConClass_arrow_width = 405;
public static final int eSave_ConClass_arrow_length = 406;
public static final int eSave_ConClass_round_corner_amount = 407;
public static final int eSave_ConClass_group = 408;
public static final int eSave_Rect_draw_type = 500;
public static final int eSave_Rect_line_width = 501;
public static final int eSave_Rect_ll = 502;
public static final int eSave_Rect_ur = 503;
public static final int eSave_Rect_display_level = 504;
public static final int eSave_Rect_fill = 505;
public static final int eSave_Line_draw_type = 600;
public static final int eSave_Line_line_width = 601;
public static final int eSave_Line_p1 = 602;
public static final int eSave_Line_p2 = 603;
public static final int eSave_Point_x = 700;
public static final int eSave_Point_y = 701;
public static final int eSave_Arc_angle1 = 800;
public static final int eSave_Arc_angle2 = 801;
public static final int eSave_Arc_draw_type = 802;
public static final int eSave_Arc_line_width = 803;
public static final int eSave_Arc_ll = 804;
public static final int eSave_Arc_ur = 805;
public static final int eSave_Arc_fill = 806;
public static final int eSave_Text_text_size = 900;
public static final int eSave_Text_draw_type = 901;
public static final int eSave_Text_text = 902;
public static final int eSave_Text_p = 903;
public static final int eSave_Text_color_drawtype = 904;
public static final int eSave_Node_nc = 1000;
public static final int eSave_Node_pos = 1001;
public static final int eSave_Node_n_name = 1002;
public static final int eSave_Node_annotsize = 1003;
public static final int eSave_Node_annotv = 1004;
public static final int eSave_Node_refcon_cnt = 1005;
public static final int eSave_Node_x_right = 1006;
public static final int eSave_Node_x_left = 1007;
public static final int eSave_Node_y_high = 1008;
public static final int eSave_Node_y_low = 1009;
public static final int eSave_Node_trace_data1 = 1010;
public static final int eSave_Node_trace_data2 = 1011;
public static final int eSave_Node_trace_attr_type = 1012;
public static final int eSave_Node_obst_x_right = 1013;
public static final int eSave_Node_obst_x_left = 1014;
public static final int eSave_Node_obst_y_high = 1015;
public static final int eSave_Node_obst_y_low = 1016;
public static final int eSave_Node_trace_color = 1017;
public static final int eSave_Node_trace_data3 = 1018;
public static final int eSave_Node_trace_data4 = 1019;
public static final int eSave_Node_trace_data5 = 1020;
public static final int eSave_Node_trace_data6 = 1021;
public static final int eSave_Node_trace_data7 = 1022;
public static final int eSave_Node_trace_data8 = 1023;
public static final int eSave_Node_trace_data9 = 1024;
public static final int eSave_Node_trace_data10 = 1025;
public static final int eSave_Node_access = 1026;
public static final int eSave_Node_trace_color2 = 1027;
public static final int eSave_Node_cycle = 1028;
public static final int eSave_Node_ref_object = 1029;
public static final int eSave_Con_x_right = 1100;
public static final int eSave_Con_x_left = 1101;
public static final int eSave_Con_y_high = 1102;
public static final int eSave_Con_y_low = 1103;
public static final int eSave_Con_cc = 1104;
public static final int eSave_Con_dest_node = 1105;
public static final int eSave_Con_source_node = 1106;
public static final int eSave_Con_dest_conpoint = 1107;
public static final int eSave_Con_source_conpoint = 1108;
public static final int eSave_Con_dest_direction = 1109;
public static final int eSave_Con_source_direction = 1110;
public static final int eSave_Con_line_a = 1111;
public static final int eSave_Con_arc_a = 1112;
public static final int eSave_Con_arrow_a = 1113;
public static final int eSave_Con_ref_a = 1114;
public static final int eSave_Con_p_num = 1115;
public static final int eSave_Con_l_num = 1116;
public static final int eSave_Con_a_num = 1117;
public static final int eSave_Con_arrow_num = 1118;
public static final int eSave_Con_ref_num = 1119;
public static final int eSave_Con_point_x = 1120;
public static final int eSave_Con_point_y = 1121;
public static final int eSave_Con_source_ref_cnt = 1122;
public static final int eSave_Con_dest_ref_cnt = 1123;
public static final int eSave_Con_c_name = 1124;
public static final int eSave_Con_trace_object = 1125;
public static final int eSave_Con_trace_attribute = 1126;
public static final int eSave_Con_trace_attr_type = 1127;
public static final int eSave_Con_temporary_ref = 1128;
public static final int eSave_Con_border = 1129;
public static final int eSave_Con_shadow = 1130;
public static final int eSave_ConPoint_number = 1200;
public static final int eSave_ConPoint_direction = 1201;
public static final int eSave_ConPoint_p = 1202;
public static final int eSave_ConPoint_trace_attribute = 1203;
public static final int eSave_ConPoint_trace_attr_type = 1204;
public static final int eSave_ConPoint_trf = 1205;
public static final int eSave_Annot_number = 1300;
public static final int eSave_Annot_draw_type = 1301;
public static final int eSave_Annot_text_size = 1302;
public static final int eSave_Annot_p = 1303;
public static final int eSave_Annot_annot_type = 1304;
public static final int eSave_Annot_display_level = 1305;
public static final int eSave_Annot_color_drawtype = 1306;
public static final int eSave_Annot_font = 1307;
public static final int eSave_Arrow_arrow_width = 1400;
public static final int eSave_Arrow_arrow_length = 1401;
public static final int eSave_Arrow_draw_type = 1402;
public static final int eSave_Arrow_line_width = 1403;
public static final int eSave_Arrow_p_dest = 1404;
public static final int eSave_Arrow_p1 = 1405;
public static final int eSave_Arrow_p2 = 1406;
public static final int eSave_GrowRect_x_right = 1900;
public static final int eSave_GrowRect_x_left = 1901;
public static final int eSave_GrowRect_y_high = 1902;
public static final int eSave_GrowRect_y_low = 1903;
public static final int eSave_GrowRect_n_name = 1904;
public static final int eSave_GrowRect_rect_part = 1905;
public static final int eSave_GrowRect_dynamic = 1906;
public static final int eSave_GrowRect_dynamicsize = 1907;
public static final int eSave_GrowRect_original_border_drawtype = 1908;
public static final int eSave_GrowRect_original_fill_drawtype = 1909;
public static final int eSave_GrowRect_fill_drawtype = 1910;
public static final int eSave_GrowRect_border = 1911;
public static final int eSave_GrowRect_trf = 1912;
public static final int eSave_GrowRect_shadow_width = 1913;
public static final int eSave_GrowRect_relief = 1914;
public static final int eSave_GrowRect_shadow = 1915;
public static final int eSave_GrowRect_shadow_contrast = 1916;
public static final int eSave_GrowRect_disable_shadow = 1917;
public static final int eSave_GrowRect_invisible = 1918;
public static final int eSave_GrowRect_fixcolor = 1919;
public static final int eSave_GrowRect_fixposition = 1920;
public static final int eSave_GrowRect_gradient = 1921;
public static final int eSave_GrowRect_gradient_contrast = 1922;
public static final int eSave_GrowRect_disable_gradient = 1923;
public static final int eSave_GrowLine_x_right = 2000;
public static final int eSave_GrowLine_x_left = 2001;
public static final int eSave_GrowLine_y_high = 2002;
public static final int eSave_GrowLine_y_low = 2003;
public static final int eSave_GrowLine_n_name = 2004;
public static final int eSave_GrowLine_line_part = 2005;
public static final int eSave_GrowLine_dynamic = 2006;
public static final int eSave_GrowLine_dynamicsize = 2007;
public static final int eSave_GrowLine_trf = 2008;
public static final int eSave_GrowLine_original_border_drawtype = 2009;
public static final int eSave_GrowLine_line_type = 2010;
public static final int eSave_GrowConPoint_x_right = 2100;
public static final int eSave_GrowConPoint_x_left = 2101;
public static final int eSave_GrowConPoint_y_high = 2102;
public static final int eSave_GrowConPoint_y_low = 2103;
public static final int eSave_GrowConPoint_n_name = 2104;
public static final int eSave_GrowConPoint_arc = 2105;
public static final int eSave_GrowConPoint_conpoint_part = 2106;
public static final int eSave_GrowCtx_conpoint_num_cnt = 2200;
public static final int eSave_GrowCtx_objectname_cnt = 2201;
public static final int eSave_GrowCtx_name = 2202;
public static final int eSave_GrowCtx_background_color = 2203;
public static final int eSave_GrowCtx_dynamic = 2204;
public static final int eSave_GrowCtx_dynamicsize = 2205;
public static final int eSave_GrowCtx_arg_cnt = 2206;
public static final int eSave_GrowCtx_argname = 2207;
public static final int eSave_GrowCtx_argtype = 2208;
public static final int eSave_GrowCtx_x0 = 2209;
public static final int eSave_GrowCtx_y0 = 2210;
public static final int eSave_GrowCtx_x1 = 2211;
public static final int eSave_GrowCtx_y1 = 2212;
public static final int eSave_GrowCtx_path_cnt = 2213;
public static final int eSave_GrowCtx_path = 2214;
public static final int eSave_GrowCtx_dyn_type1 = 2215;
public static final int eSave_GrowCtx_dyn_color1 = 2216;
public static final int eSave_GrowCtx_no_con_obstacle = 2217;
public static final int eSave_GrowCtx_slider = 2218;
public static final int eSave_GrowCtx_subgraph = 2219;
public static final int eSave_GrowCtx_java_name = 2220;
public static final int eSave_GrowCtx_dyn_color2 = 2221;
public static final int eSave_GrowCtx_next_subgraph = 2222;
public static final int eSave_GrowCtx_animation_count = 2223;
public static final int eSave_GrowCtx_scantime = 2224;
public static final int eSave_GrowCtx_animation_scantime = 2225;
public static final int eSave_GrowCtx_java_width = 2226;
public static final int eSave_GrowCtx_background_image = 2227;
public static final int eSave_GrowCtx_background_tiled = 2228;
public static final int eSave_GrowCtx_double_buffered = 2229;
public static final int eSave_GrowCtx_is_javaapplet = 2230;
public static final int eSave_GrowCtx_is_javaapplication = 2231;
public static final int eSave_GrowCtx_fast_scantime = 2232;
public static final int eSave_GrowCtx_cycle = 2233;
public static final int eSave_GrowCtx_mb3_action = 2234;
public static final int eSave_GrowCtx_translate_on = 2235;
public static final int eSave_GrowCtx_dyn_action_type1 = 2236;
public static final int eSave_GrowCtx_dyn_color3 = 2237;
public static final int eSave_GrowCtx_dyn_color4 = 2238;
public static final int eSave_GrowCtx_dyn_attr1 = 2239;
public static final int eSave_GrowCtx_dyn_attr2 = 2240;
public static final int eSave_GrowCtx_dyn_attr3 = 2241;
public static final int eSave_GrowCtx_dyn_attr4 = 2242;
public static final int eSave_GrowCtx_input_focus_mark = 2243;
public static final int eSave_GrowCtx_userdata_cb = 2244;
public static final int eSave_GrowCtx_bitmap_fonts = 2245;
public static final int eSave_GrowCtx_dyn_type2 = 2246;
public static final int eSave_GrowCtx_dyn_action_type2 = 2247;
public static final int eSave_GrowSubAnnot_x_right = 2300;
public static final int eSave_GrowSubAnnot_x_left = 2301;
public static final int eSave_GrowSubAnnot_y_high = 2302;
public static final int eSave_GrowSubAnnot_y_low = 2303;
public static final int eSave_GrowSubAnnot_n_name = 2304;
public static final int eSave_GrowSubAnnot_text = 2305;
public static final int eSave_GrowSubAnnot_rect = 2306;
public static final int eSave_GrowSubAnnot_annot_part = 2307;
public static final int eSave_GrowSubAnnot_trf = 2308;
public static final int eSave_GrowSubAnnot_adjustment = 2309;
public static final int eSave_GrowArc_x_right = 2400;
public static final int eSave_GrowArc_x_left = 2401;
public static final int eSave_GrowArc_y_high = 2402;
public static final int eSave_GrowArc_y_low = 2403;
public static final int eSave_GrowArc_n_name = 2404;
public static final int eSave_GrowArc_arc_part = 2405;
public static final int eSave_GrowArc_dynamic = 2406;
public static final int eSave_GrowArc_dynamicsize = 2407;
public static final int eSave_GrowArc_original_border_drawtype = 2408;
public static final int eSave_GrowArc_original_fill_drawtype = 2409;
public static final int eSave_GrowArc_fill_drawtype = 2410;
public static final int eSave_GrowArc_border = 2411;
public static final int eSave_GrowArc_trf = 2412;
public static final int eSave_GrowArc_shadow_width = 2413;
public static final int eSave_GrowArc_relief = 2414;
public static final int eSave_GrowArc_shadow = 2415;
public static final int eSave_GrowArc_shadow_contrast = 2416;
public static final int eSave_GrowArc_disable_shadow = 2417;
public static final int eSave_GrowArc_gradient = 2418;
public static final int eSave_GrowArc_gradient_contrast = 2419;
public static final int eSave_GrowArc_disable_gradient = 2420;
public static final int eSave_GrowArc_fixcolor = 2421;
public static final int eSave_GrowArc_fixposition = 2422;
public static final int eSave_PolyLine_draw_type = 2500;
public static final int eSave_PolyLine_line_width = 2501;
public static final int eSave_PolyLine_a_points = 2502;
public static final int eSave_PolyLine_fill = 2503;
public static final int eSave_PolyLine_closed_line = 2504;
public static final int eSave_GrowPolyLine_x_right = 2600;
public static final int eSave_GrowPolyLine_x_left = 2601;
public static final int eSave_GrowPolyLine_y_high = 2602;
public static final int eSave_GrowPolyLine_y_low = 2603;
public static final int eSave_GrowPolyLine_n_name = 2604;
public static final int eSave_GrowPolyLine_polyline_part = 2605;
public static final int eSave_GrowPolyLine_dynamic = 2606;
public static final int eSave_GrowPolyLine_dynamicsize = 2607;
public static final int eSave_GrowPolyLine_original_border_drawtype = 2608;
public static final int eSave_GrowPolyLine_original_fill_drawtype = 2609;
public static final int eSave_GrowPolyLine_fill_drawtype = 2610;
public static final int eSave_GrowPolyLine_border = 2611;
public static final int eSave_GrowPolyLine_trf = 2612;
public static final int eSave_GrowPolyLine_fill_eq_border = 2613;
public static final int eSave_GrowPolyLine_shadow_width = 2614;
public static final int eSave_GrowPolyLine_relief = 2615;
public static final int eSave_GrowPolyLine_shadow = 2616;
public static final int eSave_GrowPolyLine_shadow_contrast = 2617;
public static final int eSave_GrowPolyLine_disable_shadow = 2618;
public static final int eSave_GrowPolyLine_fill_eq_light = 2619;
public static final int eSave_GrowPolyLine_fill_eq_shadow = 2620;
public static final int eSave_GrowPolyLine_fixcolor = 2621;
public static final int eSave_GrowPolyLine_fixposition = 2622;
public static final int eSave_GrowPolyLine_gradient = 2623;
public static final int eSave_GrowPolyLine_gradient_contrast = 2624;
public static final int eSave_GrowPolyLine_disable_gradient = 2625;
public static final int eSave_GrowNode_node_part = 2700;
public static final int eSave_GrowNode_dynamic = 2701;
public static final int eSave_GrowNode_dynamicsize = 2702;
public static final int eSave_GrowNode_original_border_drawtype = 2703;
public static final int eSave_GrowNode_original_fill_drawtype = 2704;
public static final int eSave_GrowNode_fill_drawtype = 2705;
public static final int eSave_GrowNode_draw_type = 2706;
public static final int eSave_GrowNode_trf = 2707;
public static final int eSave_GrowNode_original_color_tone = 2708;
public static final int eSave_GrowNode_color_tone = 2709;
public static final int eSave_GrowNode_original_color_lightness = 2710;
public static final int eSave_GrowNode_color_lightness = 2711;
public static final int eSave_GrowNode_original_color_intensity = 2712;
public static final int eSave_GrowNode_color_intensity = 2713;
public static final int eSave_GrowNode_original_color_shift = 2714;
public static final int eSave_GrowNode_color_shift = 2715;
public static final int eSave_GrowNode_arg_cnt = 2716;
public static final int eSave_GrowNode_argv = 2717;
public static final int eSave_GrowNode_argsize = 2718;
public static final int eSave_GrowNode_line_width = 2719;
public static final int eSave_GrowNode_invisible = 2720;
public static final int eSave_GrowNode_userdata_cb = 2721;
public static final int eSave_GrowNode_original_text_drawtype = 2722;
public static final int eSave_GrowNode_text_drawtype = 2723;
public static final int eSave_GrowNode_shadow = 2724;
public static final int eSave_GrowNode_flip_horizontal = 2725;
public static final int eSave_GrowNode_flip_vertical = 2726;
public static final int eSave_GrowNode_gradient = 2727;
public static final int eSave_GrowNode_text_type = 2728;
public static final int eSave_GrowNode_text_font = 2729;
public static final int eSave_Transform_a11 = 2800;
public static final int eSave_Transform_a12 = 2801;
public static final int eSave_Transform_a13 = 2802;
public static final int eSave_Transform_a21 = 2803;
public static final int eSave_Transform_a22 = 2804;
public static final int eSave_Transform_a23 = 2805;
public static final int eSave_Transform_rotation = 2806;
public static final int eSave_GrowAnnot_adjustment = 2901;
public static final int eSave_GrowAnnot_annot_part = 2907;
public static final int eSave_GrowAnnot_trf = 2908;
public static final int eSave_GrowText_x_right = 3000;
public static final int eSave_GrowText_x_left = 3001;
public static final int eSave_GrowText_y_high = 3002;
public static final int eSave_GrowText_y_low = 3003;
public static final int eSave_GrowText_n_name = 3004;
public static final int eSave_GrowText_text_part = 3005;
public static final int eSave_GrowText_dynamic = 3006;
public static final int eSave_GrowText_dynamicsize = 3007;
public static final int eSave_GrowText_original_color_drawtype = 3008;
public static final int eSave_GrowText_trf = 3009;
public static final int eSave_GrowText_font = 3010;
public static final int eSave_GrowText_adjustment = 3011;
public static final int eSave_GrowBar_max_value = 3100;
public static final int eSave_GrowBar_min_value = 3101;
public static final int eSave_GrowBar_bar_value = 3102;
public static final int eSave_GrowBar_bar_drawtype = 3103;
public static final int eSave_GrowBar_direction = 3104;
public static final int eSave_GrowBar_rect_part = 3105;
public static final int eSave_GrowBar_trace_data1 = 3106;
public static final int eSave_GrowBar_trace_data2 = 3107;
public static final int eSave_GrowBar_trace_attr_type = 3108;
public static final int eSave_GrowBar_trace_color = 3109;
public static final int eSave_GrowBar_bar_bordercolor = 3110;
public static final int eSave_GrowBar_bar_borderwidth = 3111;
public static final int eSave_GrowBar_trace_data3 = 3112;
public static final int eSave_GrowBar_trace_data4 = 3113;
public static final int eSave_GrowBar_trace_data5 = 3114;
public static final int eSave_GrowBar_trace_data6 = 3115;
public static final int eSave_GrowBar_trace_data7 = 3116;
public static final int eSave_GrowBar_trace_data8 = 3117;
public static final int eSave_GrowBar_trace_data9 = 3118;
public static final int eSave_GrowBar_trace_data10 = 3119;
public static final int eSave_GrowBar_access = 3120;
public static final int eSave_GrowBar_cycle = 3121;
public static final int eSave_GrowBar_ref_object = 3122;
public static final int eSave_GrowBar_userdata_cb = 3123;
public static final int eSave_GrowTrend_y_max_value_0 = 3200;
public static final int eSave_GrowTrend_y_min_value_0 = 3201;
public static final int eSave_GrowTrend_curve_drawtype_0 = 3202;
public static final int eSave_GrowTrend_rect_part = 3203;
public static final int eSave_GrowTrend_trace_data1 = 3204;
public static final int eSave_GrowTrend_trace_data2 = 3205;
public static final int eSave_GrowTrend_trace_attr_type = 3206;
public static final int eSave_GrowTrend_trace_color = 3207;
public static final int eSave_GrowTrend_horizontal_lines = 3208;
public static final int eSave_GrowTrend_vertical_lines = 3209;
public static final int eSave_GrowTrend_fill_curve = 3210;
public static final int eSave_GrowTrend_curve_fill_drawtype_0 = 3211;
public static final int eSave_GrowTrend_no_of_points = 3212;
public static final int eSave_GrowTrend_curve_width = 3213;
public static final int eSave_GrowTrend_scan_time = 3214;
public static final int eSave_GrowTrend_y_max_value_1 = 3215;
public static final int eSave_GrowTrend_y_min_value_1 = 3216;
public static final int eSave_GrowTrend_curve_drawtype_1 = 3217;
public static final int eSave_GrowTrend_curve_fill_drawtype_1 = 3218;
public static final int eSave_GrowTrend_trace_data3 = 3219;
public static final int eSave_GrowTrend_trace_data4 = 3220;
public static final int eSave_GrowTrend_trace_data5 = 3221;
public static final int eSave_GrowTrend_trace_data6 = 3222;
public static final int eSave_GrowTrend_trace_data7 = 3223;
public static final int eSave_GrowTrend_trace_data8 = 3224;
public static final int eSave_GrowTrend_trace_data9 = 3225;
public static final int eSave_GrowTrend_trace_data10 = 3226;
public static final int eSave_GrowTrend_access = 3227;
public static final int eSave_GrowTrend_cycle = 3228;
public static final int eSave_GrowTrend_ref_object = 3229;
public static final int eSave_GrowTrend_userdata_cb = 3230;
public static final int eSave_GrowTrend_x_max_value_0 = 3231;
public static final int eSave_GrowTrend_x_min_value_0 = 3232;
public static final int eSave_GrowTrend_x_max_value_1 = 3233;
public static final int eSave_GrowTrend_x_min_value_1 = 3234;
public static final int eSave_GrowTrend_mode = 3235;
public static final int eSave_GrowSlider_grownode_part = 3300;
public static final int eSave_GrowSlider_direction = 3301;
public static final int eSave_GrowSlider_max_value = 3302;
public static final int eSave_GrowSlider_min_value = 3303;
public static final int eSave_GrowSlider_max_pos = 3304;
public static final int eSave_GrowSlider_min_pos = 3305;
public static final int eSave_GrowImage_x_right = 3400;
public static final int eSave_GrowImage_x_left = 3401;
public static final int eSave_GrowImage_y_high = 3402;
public static final int eSave_GrowImage_y_low = 3403;
public static final int eSave_GrowImage_n_name = 3404;
public static final int eSave_GrowImage_image_filename = 3405;
public static final int eSave_GrowImage_dynamic = 3406;
public static final int eSave_GrowImage_dynamicsize = 3407;
public static final int eSave_GrowImage_trf = 3408;
public static final int eSave_GrowImage_display_level = 3409;
public static final int eSave_GrowImage_ll = 3410;
public static final int eSave_GrowImage_ur = 3411;
public static final int eSave_GrowImage_color_tone = 3412;
public static final int eSave_GrowImage_color_lightness = 3413;
public static final int eSave_GrowImage_color_intensity = 3414;
public static final int eSave_GrowImage_color_shift = 3415;
public static final int eSave_GrowImage_fixposition = 3416;
public static final int eSave_GrowGroup_grownode_part = 3500;
public static final int eSave_GrowGroup_nc = 3501;
public static final int eSave_NodeGroup_nodeclass_part = 3600;
public static final int eSave_GrowAxis_max_value = 3700;
public static final int eSave_GrowAxis_min_value = 3701;
public static final int eSave_GrowAxis_rect_part = 3702;
public static final int eSave_GrowAxis_lines = 3703;
public static final int eSave_GrowAxis_longquotient = 3704;
public static final int eSave_GrowAxis_valuequotient = 3705;
public static final int eSave_GrowAxis_format = 3706;
public static final int eSave_GrowAxis_text_size = 3707;
public static final int eSave_GrowAxis_text_drawtype = 3708;
public static final int eSave_GrowAxis_text_color_drawtype = 3709;
public static final int eSave_GrowAxis_userdata_cb = 3710;
public static final int eSave_GrowRectRounded_x_right = 3800;
public static final int eSave_GrowRectRounded_x_left = 3801;
public static final int eSave_GrowRectRounded_y_high = 3802;
public static final int eSave_GrowRectRounded_y_low = 3803;
public static final int eSave_GrowRectRounded_n_name = 3804;
public static final int eSave_GrowRectRounded_rect_part = 3805;
public static final int eSave_GrowRectRounded_dynamic = 3806;
public static final int eSave_GrowRectRounded_dynamicsize = 3807;
public static final int eSave_GrowRectRounded_original_border_drawtype = 3808;
public static final int eSave_GrowRectRounded_original_fill_drawtype = 3809;
public static final int eSave_GrowRectRounded_fill_drawtype = 3810;
public static final int eSave_GrowRectRounded_border = 3811;
public static final int eSave_GrowRectRounded_trf = 3812;
public static final int eSave_GrowRectRounded_round_amount = 3813;
public static final int eSave_GrowRectRounded_shadow_width = 3814;
public static final int eSave_GrowRectRounded_relief = 3815;
public static final int eSave_GrowRectRounded_shadow = 3816;
public static final int eSave_GrowRectRounded_shadow_contrast = 3817;
public static final int eSave_GrowRectRounded_disable_shadow = 3818;
public static final int eSave_GrowRectRounded_gradient = 3819;
public static final int eSave_GrowRectRounded_gradient_contrast = 3820;
public static final int eSave_GrowRectRounded_disable_gradient = 3821;
public static final int eSave_GrowRectRounded_fixposition = 3822;
public static final int eSave_GrowConGlue_line_width_up = 3900;
public static final int eSave_GrowConGlue_line_width_down = 3901;
public static final int eSave_GrowConGlue_line_width_left = 3902;
public static final int eSave_GrowConGlue_line_width_right = 3903;
public static final int eSave_GrowConGlue_node_part = 3904;
public static final int eSave_GrowConGlue_border = 3905;
public static final int eSave_GrowWindow_file_name = 4000;
public static final int eSave_GrowWindow_rect_part = 4001;
public static final int eSave_GrowWindow_userdata_cb = 4002;
public static final int eSave_GrowWindow_scrollbar_width = 4003;
public static final int eSave_GrowWindow_vertical_scrollbar = 4004;
public static final int eSave_GrowWindow_horizontal_scrollbar = 4005;
public static final int eSave_GrowWindow_scrollbar_color = 4006;
public static final int eSave_GrowWindow_scrollbar_bg_color = 4007;
public static final int eSave_GrowWindow_window_scale = 4008;
public static final int eSave_GrowWindow_owner = 4009;
public static final int eSave_GrowFolder_folders = 4100;
public static final int eSave_GrowFolder_text_size = 4101;
public static final int eSave_GrowFolder_text_drawtype = 4102;
public static final int eSave_GrowFolder_text_color_drawtype = 4103;
public static final int eSave_GrowFolder_header_height = 4104;
public static final int eSave_GrowFolder_window_part = 4105;
public static final int eSave_GrowFolder_color_selected = 4106;
public static final int eSave_GrowFolder_color_unselected = 4107;
public static final int eSave_GrowFolder_folder_file_names1 = 4120;
public static final int eSave_GrowFolder_folder_text1 = 4121;
public static final int eSave_GrowFolder_folder_scale1 = 4122;
public static final int eSave_GrowFolder_folder_v_scrollbar1 = 4123;
public static final int eSave_GrowFolder_folder_h_scrollbar1 = 4124;
public static final int eSave_GrowFolder_folder_file_names2 = 4125;
public static final int eSave_GrowFolder_folder_text2 = 4126;
public static final int eSave_GrowFolder_folder_scale2 = 4127;
public static final int eSave_GrowFolder_folder_v_scrollbar2 = 4128;
public static final int eSave_GrowFolder_folder_h_scrollbar2 = 4129;
public static final int eSave_GrowFolder_folder_file_names3 = 4130;
public static final int eSave_GrowFolder_folder_text3 = 4131;
public static final int eSave_GrowFolder_folder_scale3 = 4132;
public static final int eSave_GrowFolder_folder_v_scrollbar3 = 4133;
public static final int eSave_GrowFolder_folder_h_scrollbar3 = 4134;
public static final int eSave_GrowFolder_folder_file_names4 = 4135;
public static final int eSave_GrowFolder_folder_text4 = 4136;
public static final int eSave_GrowFolder_folder_scale4 = 4137;
public static final int eSave_GrowFolder_folder_v_scrollbar4 = 4138;
public static final int eSave_GrowFolder_folder_h_scrollbar4 = 4139;
public static final int eSave_GrowFolder_folder_file_names5 = 4140;
public static final int eSave_GrowFolder_folder_text5 = 4141;
public static final int eSave_GrowFolder_folder_scale5 = 4142;
public static final int eSave_GrowFolder_folder_v_scrollbar5 = 4143;
public static final int eSave_GrowFolder_folder_h_scrollbar5 = 4144;
public static final int eSave_GrowFolder_folder_file_names6 = 4145;
public static final int eSave_GrowFolder_folder_text6 = 4146;
public static final int eSave_GrowFolder_folder_scale6 = 4147;
public static final int eSave_GrowFolder_folder_v_scrollbar6 = 4148;
public static final int eSave_GrowFolder_folder_h_scrollbar6 = 4149;
public static final int eSave_GrowFolder_folder_file_names7 = 4150;
public static final int eSave_GrowFolder_folder_text7 = 4151;
public static final int eSave_GrowFolder_folder_scale7 = 4152;
public static final int eSave_GrowFolder_folder_v_scrollbar7 = 4153;
public static final int eSave_GrowFolder_folder_h_scrollbar7 = 4154;
public static final int eSave_GrowFolder_folder_file_names8 = 4155;
public static final int eSave_GrowFolder_folder_text8 = 4156;
public static final int eSave_GrowFolder_folder_scale8 = 4157;
public static final int eSave_GrowFolder_folder_v_scrollbar8 = 4158;
public static final int eSave_GrowFolder_folder_h_scrollbar8 = 4159;
public static final int eSave_GrowFolder_folder_file_names9 = 4160;
public static final int eSave_GrowFolder_folder_text9 = 4161;
public static final int eSave_GrowFolder_folder_scale9 = 4162;
public static final int eSave_GrowFolder_folder_v_scrollbar9 = 4163;
public static final int eSave_GrowFolder_folder_h_scrollbar9 = 4164;
public static final int eSave_GrowFolder_folder_file_names10 = 4165;
public static final int eSave_GrowFolder_folder_text10 = 4166;
public static final int eSave_GrowFolder_folder_scale10 = 4167;
public static final int eSave_GrowFolder_folder_v_scrollbar10 = 4168;
public static final int eSave_GrowFolder_folder_h_scrollbar10 = 4169;
public static final int eSave_GrowFolder_folder_file_names11 = 4170;
public static final int eSave_GrowFolder_folder_text11 = 4171;
public static final int eSave_GrowFolder_folder_scale11 = 4172;
public static final int eSave_GrowFolder_folder_v_scrollbar11 = 4173;
public static final int eSave_GrowFolder_folder_h_scrollbar11 = 4174;
public static final int eSave_GrowFolder_folder_file_names12 = 4175;
public static final int eSave_GrowFolder_folder_text12 = 4176;
public static final int eSave_GrowFolder_folder_scale12 = 4177;
public static final int eSave_GrowFolder_folder_v_scrollbar12 = 4178;
public static final int eSave_GrowFolder_folder_h_scrollbar12 = 4179;
public static final int eSave_GrowFolder_folder_owner1 = 4180;
public static final int eSave_GrowFolder_folder_owner2 = 4181;
public static final int eSave_GrowFolder_folder_owner3 = 4182;
public static final int eSave_GrowFolder_folder_owner4 = 4183;
public static final int eSave_GrowFolder_folder_owner5 = 4184;
public static final int eSave_GrowFolder_folder_owner6 = 4185;
public static final int eSave_GrowFolder_folder_owner7 = 4186;
public static final int eSave_GrowFolder_folder_owner8 = 4187;
public static final int eSave_GrowFolder_folder_owner9 = 4188;
public static final int eSave_GrowFolder_folder_owner10 = 4189;
public static final int eSave_GrowFolder_folder_owner11 = 4190;
public static final int eSave_GrowFolder_folder_owner12 = 4191;
public static final int eSave_GrowTable_rect_part = 4200;
public static final int eSave_GrowTable_userdata_cb = 4202;
public static final int eSave_GrowTable_scrollbar_width = 4203;
public static final int eSave_GrowTable_vertical_scrollbar = 4204;
public static final int eSave_GrowTable_horizontal_scrollbar = 4205;
public static final int eSave_GrowTable_scrollbar_color = 4206;
public static final int eSave_GrowTable_scrollbar_bg_color = 4207;
public static final int eSave_GrowTable_window_scale = 4208;
public static final int eSave_GrowTable_rows = 4209;
public static final int eSave_GrowTable_columns = 4210;
public static final int eSave_GrowTable_header_row = 4211;
public static final int eSave_GrowTable_header_column = 4212;
public static final int eSave_GrowTable_text_size = 4213;
public static final int eSave_GrowTable_text_drawtype = 4214;
public static final int eSave_GrowTable_header_row_height = 4215;
public static final int eSave_GrowTable_row_height = 4216;
public static final int eSave_GrowTable_text_color_drawtype = 4217;
public static final int eSave_GrowTable_header_text_size = 4218;
public static final int eSave_GrowTable_header_text_drawtype = 4219;
public static final int eSave_GrowTable_header_text_color = 4220;
public static final int eSave_GrowTable_header_text_bold = 4221;
public static final int eSave_GrowTable_options = 4222;
public static final int eSave_GrowTable_font = 4223;
public static final int eSave_GrowTable_column_width1 = 4240;
public static final int eSave_GrowTable_header_text1 = 4241;
public static final int eSave_GrowTable_column_width2 = 4242;
public static final int eSave_GrowTable_header_text2 = 4243;
public static final int eSave_GrowTable_column_width3 = 4244;
public static final int eSave_GrowTable_header_text3 = 4245;
public static final int eSave_GrowTable_column_width4 = 4246;
public static final int eSave_GrowTable_header_text4 = 4247;
public static final int eSave_GrowTable_column_width5 = 4248;
public static final int eSave_GrowTable_header_text5 = 4249;
public static final int eSave_GrowTable_column_width6 = 4250;
public static final int eSave_GrowTable_header_text6 = 4251;
public static final int eSave_GrowTable_column_width7 = 4252;
public static final int eSave_GrowTable_header_text7 = 4253;
public static final int eSave_GrowTable_column_width8 = 4254;
public static final int eSave_GrowTable_header_text8 = 4255;
public static final int eSave_GrowTable_column_width9 = 4256;
public static final int eSave_GrowTable_header_text9 = 4257;
public static final int eSave_GrowTable_column_width10 = 4258;
public static final int eSave_GrowTable_header_text10 = 4259;
public static final int eSave_GrowTable_column_width11 = 4260;
public static final int eSave_GrowTable_header_text11 = 4261;
public static final int eSave_GrowTable_column_width12 = 4262;
public static final int eSave_GrowTable_header_text12 = 4263;
public static final int eSave_GrowTable_select_drawtype = 4264;
public static final int eSave_GrowTable_column_adjustment1 = 4265;
public static final int eSave_GrowTable_column_adjustment2 = 4266;
public static final int eSave_GrowTable_column_adjustment3 = 4267;
public static final int eSave_GrowTable_column_adjustment4 = 4268;
public static final int eSave_GrowTable_column_adjustment5 = 4269;
public static final int eSave_GrowTable_column_adjustment6 = 4270;
public static final int eSave_GrowTable_column_adjustment7 = 4271;
public static final int eSave_GrowTable_column_adjustment8 = 4272;
public static final int eSave_GrowTable_column_adjustment9 = 4273;
public static final int eSave_GrowTable_column_adjustment10 = 4274;
public static final int eSave_GrowTable_column_adjustment11 = 4275;
public static final int eSave_GrowTable_column_adjustment12 = 4276;
public static final int eSave_GrowXYCurve_trend_part = 4300;
public static final int eSave_GrowAxisArc_max_value = 4400;
public static final int eSave_GrowAxisArc_min_value = 4401;
public static final int eSave_GrowAxisArc_arc_part = 4402;
public static final int eSave_GrowAxisArc_lines = 4403;
public static final int eSave_GrowAxisArc_linelength = 4404;
public static final int eSave_GrowAxisArc_longquotient = 4405;
public static final int eSave_GrowAxisArc_valuequotient = 4406;
public static final int eSave_GrowAxisArc_format = 4407;
public static final int eSave_GrowAxisArc_text_size = 4408;
public static final int eSave_GrowAxisArc_text_drawtype = 4409;
public static final int eSave_GrowAxisArc_text_color_drawtype = 4410;
public static final int eSave_GrowAxisArc_userdata_cb = 4411;
public static final int eSave_GrowPie_arc_part = 4500;
public static final int eSave_GrowPie_sectors = 4501;
public static final int eSave_GrowPie_min_value = 4502;
public static final int eSave_GrowPie_max_value = 4503;
public static final int eSave_GrowPie_sector_color1 = 4504;
public static final int eSave_GrowPie_sector_color2 = 4505;
public static final int eSave_GrowPie_sector_color3 = 4506;
public static final int eSave_GrowPie_sector_color4 = 4507;
public static final int eSave_GrowPie_sector_color5 = 4508;
public static final int eSave_GrowPie_sector_color6 = 4509;
public static final int eSave_GrowPie_sector_color7 = 4510;
public static final int eSave_GrowPie_sector_color8 = 4511;
public static final int eSave_GrowPie_sector_color9 = 4512;
public static final int eSave_GrowPie_sector_color10 = 4513;
public static final int eSave_GrowPie_sector_color11 = 4514;
public static final int eSave_GrowPie_sector_color12 = 4515;
public static final int eSave_GrowPie_sector_size1 = 4516;
public static final int eSave_GrowPie_sector_size2 = 4517;
public static final int eSave_GrowPie_sector_size3 = 4518;
public static final int eSave_GrowPie_sector_size4 = 4519;
public static final int eSave_GrowPie_sector_size5 = 4520;
public static final int eSave_GrowPie_sector_size6 = 4521;
public static final int eSave_GrowPie_sector_size7 = 4522;
public static final int eSave_GrowPie_sector_size8 = 4523;
public static final int eSave_GrowPie_sector_size9 = 4524;
public static final int eSave_GrowPie_sector_size10 = 4525;
public static final int eSave_GrowPie_sector_size11 = 4526;
public static final int eSave_GrowPie_sector_size12 = 4527;
public static final int eSave_GrowPie_userdata_cb = 4528;
public static final int eSave_GrowBarChart_rect_part = 4600;
public static final int eSave_GrowBarChart_bars = 4601;
public static final int eSave_GrowBarChart_barsegments = 4602;
public static final int eSave_GrowBarChart_min_value = 4603;
public static final int eSave_GrowBarChart_max_value = 4604;
public static final int eSave_GrowBarChart_bar_color1 = 4605;
public static final int eSave_GrowBarChart_bar_color2 = 4606;
public static final int eSave_GrowBarChart_bar_color3 = 4607;
public static final int eSave_GrowBarChart_bar_color4 = 4608;
public static final int eSave_GrowBarChart_bar_color5 = 4609;
public static final int eSave_GrowBarChart_bar_color6 = 4610;
public static final int eSave_GrowBarChart_bar_color7 = 4611;
public static final int eSave_GrowBarChart_bar_color8 = 4612;
public static final int eSave_GrowBarChart_bar_color9 = 4613;
public static final int eSave_GrowBarChart_bar_color10 = 4614;
public static final int eSave_GrowBarChart_bar_color11 = 4615;
public static final int eSave_GrowBarChart_bar_color12 = 4616;
public static final int eSave_GrowBarChart_vertical_lines = 4617;
public static final int eSave_GrowBarChart_horizontal_lines = 4618;
public static final int eSave_GrowBarChart_userdata_cb = 4619;
public static final int eSave_GrowBarChart_line_color = 4620;
public static final int ePosition_Absolute = 0;
public static final int ePosition_Relative = 1;
public static final int eEvent_MB1Click = 0;
public static final int eEvent_MB1Up = 2;
public static final int eEvent_MB1Down = 3;
public static final int eEvent_MB1DoubleClick = 4;
public static final int eEvent_CursorMotion = 5;
public static final int eEvent_ValueChanged = 7;
}
/*
* 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.
*/
package jpwr.jopg;
public class GlowArrayElem {
public int type() {return 0;}
public void draw() {}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {}
public int eventHandler(GlowEvent e, double fx, double fy) {return 0;}
}
/*
* 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.
*/
package jpwr.jopg;
import java.text.*;
public class GlowCFormat {
public GlowCFormat( String format) {
int f_idx, p_idx;
try {
if ( (f_idx = format.indexOf('o')) != -1) {
if ( f_idx >= 1 && format.charAt(f_idx-1) == '1')
format_type = FRM_1O;
else if ( f_idx >= 1 && format.charAt(f_idx-1) == '2')
format_type = FRM_2O;
else
format_type = FRM_O;
}
else if ( (f_idx = format.indexOf('t')) != -1) {
if ( f_idx >= 1 && format.charAt(f_idx-1) == '1')
format_type = FRM_1T;
else if ( f_idx >= 1 && format.charAt(f_idx-1) == '2')
format_type = FRM_2T;
else if ( f_idx >= 1 && format.charAt(f_idx-1) == '3')
format_type = FRM_3T;
else
format_type = FRM_T;
}
else if ( (f_idx = format.indexOf('m')) != -1) {
if ( f_idx >= 1 && format.charAt(f_idx-1) == '1')
format_type = FRM_1M;
else
format_type = FRM_M;
}
else
pfo = new PrintfFormat( format);
}
catch ( NumberFormatException e) {
System.out.println( "NumberFormatException: " + format);
h = -1;
}
}
int d;
int h;
int no_space = 0;
int format_type;
PrintfFormat pfo;
public static final int FRM_S = 0; // String
public static final int FRM_O = 1; // Objid object name
public static final int FRM_1O = 2; // Objid path
public static final int FRM_2O = 3; // Objid volume and path
public static final int FRM_T = 4; // Time, date and time
public static final int FRM_1T = 5; // Time, only time, no hundredth
public static final int FRM_2T = 6; // Time, only time with hundreth
public static final int FRM_3T = 7; // Time, commpressed date and time, no hundredth
public static final int FRM_M = 8; // Message
public static final int FRM_1M = 9; // Message, text only
public static final int FRM_D = 10; // Integer
public static final int FRM_F = 11; // Float
public int type() {
return format_type;
}
public StringBuffer format( float value, StringBuffer buff) {
if ( pfo != null) {
try {
return pfo.sprintf( value, buff);
}
catch ( IllegalArgumentException e) {
buff.setLength(0);
buff.append("format error");
return buff;
}
}
else
return buff;
}
public StringBuffer format( int value, StringBuffer buff) {
if ( pfo != null) {
try {
return pfo.sprintf( value, buff);
}
catch ( IllegalArgumentException e) {
buff.setLength(0);
buff.append("format error");
return buff;
}
}
else
return buff;
}
public StringBuffer format( boolean value, StringBuffer buff) {
buff.setLength(0);
if ( value)
buff.append('1');
else
buff.append('0');
return buff;
}
public StringBuffer format( String value, StringBuffer buff) {
switch( format_type) {
case FRM_S: {
if ( pfo != null) {
try {
return pfo.sprintf( value, buff);
}
catch ( IllegalArgumentException e) {
buff.setLength(0);
buff.append("format error");
return buff;
}
}
else
return buff;
}
case FRM_O: {
int idx, j, len;
len = value.length();
idx = value.lastIndexOf('-');
if ( idx == -1)
idx = 0;
else
idx++;
buff.setLength(0);
for ( j = idx; j < len; j++)
buff.append(value.charAt(j));
return buff;
}
case FRM_1O:
case FRM_2O: {
int j, len;
len = value.length();
buff.setLength(0);
for ( j = 0; j < len; j++)
buff.append(value.charAt(j));
return buff;
}
case FRM_T:
case FRM_1T:
case FRM_2T:
case FRM_3T: {
int j, len;
len = value.length();
buff.setLength(0);
for ( j = 0; j < len; j++)
buff.append(value.charAt(j));
return buff;
}
case FRM_M:
case FRM_1M: {
int j, len;
len = value.length();
buff.setLength(0);
for ( j = 0; j < len; j++)
buff.append(value.charAt(j));
return buff;
}
}
buff.setLength(0);
return buff;
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowColor {
static final double gray_i0 = 0.32; // Gray min
static final double gray_i1 = 0.95; // Gray max
static class Sat {
public double s;
public double i_min;
public double i_max;
public double a;
public Sat() {}
public Sat(double s, double i_min, double i_max, double a) {
this.s = s;
this.i_min = i_min;
this.i_max = i_max;
this.a = a;
}
}
static class Hue {
public Hue(double h, double hk, Sat[] s) {
this.h = h;
this.hk = hk;
this.s = s;
}
public double h;
public double hk;
public Sat[] s;
}
static final Hue ctab[] = new Hue[]{
new Hue( 18, -20.0, new Sat[]{new Sat( 0.2, -1.4, 2.8, .9), new Sat( 0.5, -1.4, 3, .9), new Sat(1.5, -3.5, 5.0, 1.0)}),
new Hue( 28, 10.0, new Sat[]{new Sat( 0.2, -1.4, 2.8, .9), new Sat( 0.5, -1.4, 3, .9), new Sat(1.5, -3.5, 5.0, 1.0)}), // Yellow
new Hue( 45, 20.0, new Sat[]{new Sat( 0.2, -1.3, 2.8, .9), new Sat( 0.5, -1.3, 3, .9), new Sat(1.5, -3.5, 4.5, 1.0)}), // Orange
new Hue( 90, 0.0, new Sat[]{new Sat( 0.2, -1.1, 2.8, .9), new Sat( 0.5, -1.1, 3, .9), new Sat(1.5, -4.5, 4.5, 0.8)}), // Red
new Hue( 150, 0.0, new Sat[]{new Sat( 0.2, -1., 2.8, .9), new Sat( 0.5, -1., 3, .9), new Sat(1.5, -3.5, 5.9, 1.0)}), // Violet
new Hue( 240, 0.0, new Sat[]{new Sat( 0.2, -1., 2.8, .9), new Sat( 0.4, -1., 3, .9), new Sat(1.5, -3.5, 5.5, 0.8)}), // Blue
new Hue( 280, 0.0, new Sat[]{new Sat( 0.2, -1., 2.8, .9), new Sat( 0.4, -1., 3, .9), new Sat(1.5, -3.5, 5.5, 1.2)}), // Seablue
new Hue( 355,-20.0, new Sat[]{new Sat( 0.2, -1., 2.8, .9), new Sat( 0.4, -1., 3, .9), new Sat(1.5, -4.5, 3.5, 1.0)}) // Green
};
static class Rgb {
public double r;
public double g;
public double b;
public Rgb(double r, double g, double b) {
this.r = r;
this.g = g;
this.b = b;
}
}
static Rgb[] rgbtab = new Rgb[] {
new Rgb( 0.254, 0.329, 0), // YellowGreen
new Rgb( 0.357, 0.459, 0),
new Rgb( 0.498, 0.639, 0),
new Rgb( 0.624, 0.800, 0),
new Rgb( 0.764, 0.976, 0),
new Rgb( 0.808, 1.000, 0.129),
new Rgb( 0.847, 1.000, 0.310),
new Rgb( 0.898, 1.000, 0.537),
new Rgb( 0.933, 1.000, 0.710),
new Rgb( 0.949, 1.000, 0.776),
new Rgb( 0., 0., 0), // Yellow
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0), // Orange
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 0., 0., 0),
new Rgb( 1.000, 0.725, 0.420),
new Rgb( 1.000, 0.796, 0.569),
new Rgb( 1.000, 0.886, 0.667),
new Rgb( 1.000, 0.937, 0.820)
};
public static int shift_drawtype( int dt, int shift, Object node) {
int incr;
int base_drawtype;
int drawtype;
if ( node != null && ((GrowNode)node).color_inverse != 0)
shift = - shift;
if ( dt >= 20) {
base_drawtype = (int)(dt / 10 * 10);
incr = shift + dt - base_drawtype;
if ( incr < 0)
drawtype = Glow.eDrawType_Color4; // White
else if ( incr >= 10)
drawtype = Glow.eDrawType_Color30; // DarkGrey
else
drawtype = (int)(base_drawtype + incr);
}
else
drawtype = dt;
return drawtype;
}
public static int get_drawtype( int local_drawtype,
int highlight_drawtype, int highlight, Object node,
int fill, int highlight_disabled) {
int drawtype;
int base_drawtype;
int incr;
int lightness = 0;
int intensity = 0;
if ( node != null) {
lightness = ((GrowNode)node).color_lightness;
intensity = ((GrowNode)node).color_intensity;
}
if ( highlight != 0 && highlight_disabled == 0) {
drawtype = highlight_drawtype;
}
else if ( highlight != 0 && highlight_disabled != 0 && fill== 0 && local_drawtype ==
Glow.eDrawType_Line) {
drawtype = highlight_drawtype;
}
else {
if ( node != null && ((GrowNode)node).color_tone != Glow.eDrawTone_No) {
int tone = ((GrowNode)node).color_tone;
if ( local_drawtype > 30) {
if ( tone == Glow.eDrawTone_LightGrayHighSaturation)
drawtype = Glow.eDrawType_Color31; // GrayLow1
else if ( tone == Glow.eDrawTone_DarkGrayHighSaturation)
drawtype = Glow.eDrawType_Color30; // DarkGrey
else {
if ( tone >= Glow.eDrawTone_GrayHighSaturation &&
tone < Glow.eDrawTone_GrayLowSaturation) {
tone = tone - 27;
intensity += 2;
}
else if ( tone >= Glow.eDrawTone_GrayLowSaturation) {
tone = tone - 2 * 27;
intensity -= 1;
}
if ( tone >= Glow.eDrawTone_DarkGray &&
tone < Glow.eDrawTone_LightGray) {
tone = ( tone - 9);
lightness -= 2;
}
else if ( tone >= Glow.eDrawTone_LightGray) {
tone = tone - 18;
lightness += 2;
}
drawtype = local_drawtype - local_drawtype / 30 * 30 +
30 * tone;
}
}
else
drawtype = local_drawtype;
}
else if ( node != null && fill == 1 && ((GrowNode)node).fill_drawtype != Glow.eDrawType_No) {
drawtype = ((GrowNode)node).fill_drawtype;
}
else if ( node != null && fill == 2 && ((GrowNode)node).text_drawtype != Glow.eDrawType_No) {
drawtype = ((GrowNode)node).text_drawtype;
}
else if ( node != null && fill == 0 && ((GrowNode)node).draw_type != Glow.eDrawType_No) {
drawtype = ((GrowNode)node).draw_type;
}
else
drawtype = local_drawtype;
if ( node != null && lightness != 0) {
if ( local_drawtype >= 30) {
base_drawtype = drawtype / 10 * 10;
incr = -lightness + drawtype - base_drawtype;
if ( incr < 0)
drawtype = Glow.eDrawType_Color4; // White
else if ( incr >= 10)
drawtype = Glow.eDrawType_Color30; // DarkGrey
else
drawtype = base_drawtype + incr;
}
}
if ( node != null && intensity != 0) {
if ( drawtype >= 60) {
base_drawtype = drawtype / 30 * 30;
incr = drawtype - base_drawtype;
drawtype = ( drawtype + Math.min( 2 - incr / 10, intensity) * 10);
if ( drawtype < base_drawtype)
drawtype = ( Glow.eDrawType_Color41 + incr);
}
}
if ( node != null && ((GrowNode)node).color_shift != 0) {
if ( drawtype >= 60) {
incr = ((GrowNode)node).color_shift -
((GrowNode)node).color_shift / 8 * 8;
if ( incr < 0)
incr += 8;
incr = drawtype + incr * 30;
if ( incr >= 300)
incr -= 240;
drawtype = incr;
}
}
if ( node != null && ((GrowNode)node).color_inverse != 0) {
if ( drawtype >= 30)
drawtype = drawtype + 10 - 2 * (drawtype % 10) - 1;
}
if ( node != null && ((GrowNode)node).dimmed != 0) {
if ( drawtype == 0)
drawtype = 25;
else if ( 26 <= drawtype && drawtype <= 29)
drawtype = ( drawtype - 4);
else if ( 36 <= drawtype && drawtype <= 39)
drawtype = ( drawtype - 4);
else if ( 46 <= drawtype && drawtype <= 49)
drawtype = ( drawtype - 4);
else if ( 56 <= drawtype && drawtype <= 59)
drawtype = ( drawtype - 4);
}
}
if ( drawtype < 0 || drawtype >= 301) {
System.out.println("** Invalid drawtype : " + drawtype);
drawtype = Glow.eDrawType_Line;
}
return drawtype;
}
public static GlowColorRgb rgb_color( int idx) {
double h1, i1, s1;
int i, j, k;
double r = 0;
double g = 0;
double b = 0;
if ( idx == 300)
idx = 31;
if ( idx == 3) // White
r = g = b = 1.0;
else if ( idx == 2) // Gray
r = g = b = 0.75;
else if ( idx == 1) { // Red
r = 1.0;
g = b = 0;
}
else if ( idx == 0) // Black
r = g = b = 0;
else if ( idx < 20) {
// Sixteen colors of different hue
h1 = 360. * (idx - 4) / 16;
s1 = 1.5;
i1 = 1;
return his_to_rgb( h1, i1, s1);
}
else if ( idx < 60) {
// Four sets of gray
double i0 = gray_i0;
if ( idx < 30 || (50 <= idx && idx < 60))
i0 = 0.25;
r = g = b = i0 + (gray_i1 - i0) * Math.pow( (double)(9 - idx % 10) / 9, 0.9);
}
else if ( idx < 300) {
i = (idx - 60) / 30;
j = (idx - 60 - i * 30) / 10;
k = 9 - (idx - 60 - i * 30 - j * 10);
if ( (i == 0 && j == 2) ||
(i == 2 && j == 2 && k > 5)) {
// Formula doesn't work for yellow...
r = rgbtab[ i * 10 + k].r;
g = rgbtab[ i * 10 + k].g;
b = rgbtab[ i * 10 + k].b;
}
else {
s1 = ctab[i].s[j].s;
i1 = ctab[i].s[j].i_min + (ctab[i].s[j].i_max - ctab[i].s[j].i_min) *
Math.pow((double)(k)/9, ctab[i].s[j].a);
h1 = ctab[i].h + ctab[i].hk * k / 9;
return his_to_rgb( h1, i1, s1);
}
}
return new GlowColorRgb(r, g, b);
}
public static GlowColorRgb his_to_rgb( double h, double i, double s) {
double m1, m2, i1;
double r, g, b;
m1 = s * Math.sin( h * Math.PI/180);
m2 = s * Math.cos( h * Math.PI/180);
i1 = i / Math.sqrt(3);
r = m1 * 2 / Math.sqrt(6) + i1 / Math.sqrt(3);
g = - m1 / Math.sqrt(6) + m2 / Math.sqrt(2) + i1 / Math.sqrt(3);
b = - m1 / Math.sqrt(6) - m2 / Math.sqrt(2) + i1 / Math.sqrt(3);
r = r / 2 + 0.5;
g = g / 2 + 0.5;
b = b / 2 + 0.5;
if ( r > 1) r = 1;
if ( r < 0) r = 0;
if ( g > 1) g = 1;
if ( g < 0) g = 0;
if ( b > 1) b = 1;
if ( b < 0) b = 0;
return new GlowColorRgb(r, g, b);
}
}
/*
* 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.
*/
package jpwr.jopg;
public class GlowColorRgb {
public double r;
public double g;
public double b;
public GlowColorRgb(double r, double g, double b) {
this.r = r;
this.g = g;
this.b = b;
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowConClass {
GrowCmn cmn;
public GlowConClass(GrowCmn cmn) {
this.cmn = cmn;
}
public void open(BufferedReader reader) {
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowConPoint extends GlowArrayElem {
GrowCmn cmn;
GlowPoint p;
int number;
int direction;
String trace_attribute;
int trace_attr_type;
GlowTransform trf;
public GlowConPoint(GrowCmn cmn) {
this.cmn = cmn;
p = new GlowPoint(cmn);
trf = new GlowTransform();
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowConPoint : " + line);
switch ( key) {
case Glow.eSave_ConPoint:
break;
case Glow.eSave_ConPoint_number:
number = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_ConPoint_direction:
number = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_ConPoint_p:
p.open(reader);
break;
case Glow.eSave_ConPoint_trace_attr_type:
trace_attr_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_ConPoint_trace_attribute:
if ( token.hasMoreTokens())
trace_attribute = token.nextToken();
break;
case Glow.eSave_ConPoint_trf:
trf.open(reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowConPoint");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowConPoint");
}
}
}
/*
* 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.
*/
package jpwr.jopg;
public class GlowDimension {
public int width;
public int height;
}
\ No newline at end of file
/*
* 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.
*/
package jpwr.jopg;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.awt.font.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
public class GlowDraw implements GlowDrawIfc {
Graphics2D g2;
boolean nodraw;
Font fonts[] = new Font[9];
public void setNodraw(boolean nodraw) {
this.nodraw = nodraw;
}
public void setGraphics( Graphics2D g2) {
this.g2 = g2;
}
public void rect(int border, int fill, double x, double y, double width, double height) {
Rectangle2D r = new Rectangle2D.Double(x, y, width, height);
g2.setPaint(Color.black);
g2.setStroke(new BasicStroke(1));
g2.draw(r);
}
public void rect(int x, int y, int width, int height, int gc_type, int idx, int highlight) {
if ( nodraw)
return;
if ( gc_type == Glow.eDrawType_LineGray && highlight != 0)
gc_type = Glow.eDrawType_Line;
Color color = getColor(gc_type);
Rectangle2D r = new Rectangle2D.Float((float)x, (float)y, (float)width, (float)height);
g2.setPaint(color);
g2.setStroke(new BasicStroke(1));
g2.draw(r);
}
public void fill_rect(int x, int y, int width, int height, int gc_type) {
if ( nodraw)
return;
Color color = getColor(gc_type);
Rectangle2D r = new Rectangle2D.Float((float)x, (float)y, (float)width, (float)height);
g2.setPaint(color);
g2.fill(r);
}
public void gradient_fill_rect(int x, int y, int width, int height, int gc_type, int f1, int f2, int gradient) {
if ( nodraw)
return;
Rectangle2D r = new Rectangle2D.Float((float)x, (float)y, (float)width, (float)height);
setGradient( gradient, f1, f2, (float)x, (float)y, (float)width, (float)height);
g2.fill(r);
}
public void arc(int x, int y, int width, int height, int angle1, int angle2, int gc_type, int idx, int highlight) {
if ( nodraw)
return;
if ( gc_type == Glow.eDrawType_LineGray && highlight != 0)
gc_type = Glow.eDrawType_Line;
Color color = getColor(gc_type);
Arc2D a = new Arc2D.Float((float)x, (float)y, (float)width, (float)height, angle1, angle2, Arc2D.OPEN);
g2.setPaint(color);
g2.setStroke(new BasicStroke(1));
g2.draw(a);
}
public void fill_arc(int x, int y, int width, int height, int angle1, int angle2, int gc_type) {
if ( nodraw)
return;
Color color = getColor(gc_type);
Arc2D a = new Arc2D.Float((float)x, (float)y, (float)width, (float)height, angle1, angle2, Arc2D.PIE);
g2.setPaint(color);
g2.fill(a);
}
public void gradient_fill_arc(int x, int y, int width, int height, int angle1, int angle2, int gc_type, int f1, int f2, int gradient) {
if ( nodraw)
return;
Arc2D a = new Arc2D.Float((float)x, (float)y, (float)width, (float)height, angle1, angle2, Arc2D.PIE);
setGradient( gradient, f1, f2, (float)x, (float)y, (float)width, (float)height);
g2.fill(a);
}
public void line(int x1, int y1, int x2, int y2, int gc_type, int idx, int highlight) {
if ( nodraw)
return;
Color color = getColor(gc_type);
Line2D l = new Line2D.Float((float)x1, (float)y1, (float)x2, (float)y2);
g2.setPaint(color);
g2.setStroke(new BasicStroke(idx+1));
g2.draw(l);
}
public void line_dashed(int x1, int y1, int x2, int y2, int gc_type, int idx, int highlight, int line_type) {
if ( nodraw)
return;
Color color = getColor(gc_type);
Line2D l = new Line2D.Float((float)x1, (float)y1, (float)x2, (float)y2);
float[] dash = null;
switch ( line_type) {
case Glow.eLineType_Solid:
break;
case Glow.eLineType_Dashed1:
dash = new float[] {(float)idx, (float)idx};
break;
case Glow.eLineType_Dashed2:
dash = new float[] {(float)idx * 2, (float)idx * 2};
break;
case Glow.eLineType_Dashed3:
dash = new float[] {(float)idx * 4, (float)idx * 4};
break;
case Glow.eLineType_Dotted:
dash = new float[] {(float)idx, (float)idx * 6};
break;
case Glow.eLineType_DotDashed1:
dash = new float[] {(float)idx * 1, (float)idx * 2, (float)idx * 4, (float)idx * 2};
break;
case Glow.eLineType_DotDashed2:
dash = new float[] {(float)idx, (float)idx * 4, (float)idx * 8, (float)idx * 4};
break;
}
if ( dash == null)
g2.setStroke(new BasicStroke(idx+1));
else
g2.setStroke( new BasicStroke((float)idx, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_BEVEL, 0, dash, 0));
g2.setPaint(color);
g2.draw(l);
}
public void polyline(GlowPointX[] points, int point_cnt, int gc_type, int idx, int highlight) {
if ( nodraw)
return;
Color color = getColor(gc_type);
GeneralPath path = new GeneralPath();
path.moveTo((float)points[0].x, (float)points[0].y);
for ( int i = 1; i < point_cnt; i++)
path.lineTo((float)points[i].x, (float)points[i].y);
g2.setStroke(new BasicStroke(idx+1));
g2.setPaint(color);
g2.draw(path);
}
public void fill_polyline(GlowPointX[] points, int point_cnt, int gc_type, int highlight) {
if ( nodraw)
return;
Color color = getColor(gc_type);
GeneralPath path = new GeneralPath();
path.moveTo((float)points[0].x, (float)points[0].y);
for ( int i = 1; i < point_cnt; i++)
path.lineTo((float)points[i].x, (float)points[i].y);
g2.setPaint(color);
g2.fill(path);
}
public void gradient_fill_polyline(GlowPointX[] points, int point_cnt, int gc_type, int f1, int f2, int gradient) {
if ( nodraw)
return;
int x_low = Integer.MAX_VALUE;
int x_high = -Integer.MAX_VALUE;
int y_low = Integer.MAX_VALUE;
int y_high = -Integer.MAX_VALUE;
GeneralPath path = new GeneralPath();
path.moveTo((float)points[0].x, (float)points[0].y);
for ( int i = 1; i < point_cnt; i++) {
path.lineTo((float)points[i].x, (float)points[i].y);
if ( points[i].x > x_high)
x_high = points[i].x;
if ( points[i].x < x_low)
x_low = points[i].x;
if ( points[i].y > y_high)
y_high = points[i].y;
if ( points[i].y < y_low)
y_low = points[i].y;
}
setGradient( gradient, f1, f2, (float)x_low, (float)y_low, (float)(x_high - x_low), (float)(y_high - y_low));
g2.fill(path);
}
public void text( int x, int y, String text, int gc_type, int color, int idx, int highlight, int line,
int font_idx, double size, int rot) {
Color c = getColor(color);
g2.setFont(getFont(font_idx, idx));
g2.setPaint(c);
g2.drawString(text, x, y);
}
public Color getColor(int gc_type) {
GlowColorRgb rgb = GlowColor.rgb_color(gc_type);
return new Color((float)rgb.r, (float)rgb.g, (float)rgb.b);
}
public int gradient_rotate(double rotate, int gradient) {
return gradient;
}
public void setGradient( int gradient, int f1, int f2,
float x, float y, float w, float h) {
float gx0 = 0;
float gy0 = 0;
float gx1 = 0;
float gy1 = 0;
float gr = 0;
switch ( gradient) {
case Glow.eGradient_HorizontalUp:
gx0 = x;
gy0 = y;
gx1 = x;
gy1 = y + h;
break;
case Glow.eGradient_HorizontalDown:
gx0 = x;
gy0 = y + h;
gx1 = x;
gy1 = y;
break;
case Glow.eGradient_HorizontalTube1:
gx0 = x;
gy0 = y + 0.5F * h;
gx1 = x;
gy1 = y;
break;
case Glow.eGradient_HorizontalTube2:
gx0 = x;
gy0 = y + 0.3F * h;
gx1 = x;
gy1 = y + h;
break;
case Glow.eGradient_VerticalLeft:
gx0 = x;
gy0 = y;
gx1 = x + w;
gy1 = y;
break;
case Glow.eGradient_VerticalRight:
gx0 = x + w;
gy0 = y;
gx1 = x;
gy1 = y;
break;
case Glow.eGradient_VerticalTube1:
gx0 = x + 0.5F * w;
gy0 = y;
gx1 = x;
gy1 = y;
break;
case Glow.eGradient_VerticalTube2:
gx0 = x + 0.3F * w;
gy0 = y;
gx1 = x + w;
gy1 = y;
break;
case Glow.eGradient_DiagonalUpperLeft:
gx0 = x;
gy0 = y;
gx1 = x + w;
gy1 = y + h;
break;
case Glow.eGradient_DiagonalLowerLeft:
gx0 = x;
gy0 = y + h;
gx1 = x + w;
gy1 = y;
break;
case Glow.eGradient_DiagonalUpperRight:
gx0 = x + w;
gy0 = y;
gx1 = x;
gy1 = y + h;
break;
case Glow.eGradient_DiagonalLowerRight:
gx0 = x + w;
gy0 = y + h;
gx1 = x;
gy1 = y;
break;
case Glow.eGradient_DiagonalUpTube:
gx0 = x + 0.5F * w;
gy0 = y + 0.5F * h;
gx1 = x + w;
gy1 = y + h;
break;
case Glow.eGradient_DiagonalDownTube:
gx0 = x + 0.5F * w;
gy0 = y + 0.5F * h;
gx1 = x;
gy1 = y + h;
break;
case Glow.eGradient_Globe:
gx0 = x + 0.3F * w;
gy0 = y + 0.3F * h;
gx1 = x + w;
gy1 = y + h;
gr = (float) Math.sqrt( w*w/4+h*h/4);
break;
case Glow.eGradient_RadialCenter:
gx0 = x + 0.5F * w;
gy0 = y + 0.5F * h;
gx1 = x + w;
gy1 = y + h;
gr = (float) Math.sqrt( w*w/4F+h*h/4F);
break;
case Glow.eGradient_RadialUpperLeft:
gx0 = x;
gy0 = y;
gx1 = x + w;
gy1 = y + h;
gr = (float) Math.sqrt( w*w+h*h);
break;
case Glow.eGradient_RadialLowerLeft:
gx0 = x;
gy0 = y + h;
gx1 = x + w;
gy1 = y;
gr = (float) Math.sqrt( w*w+h*h);
break;
case Glow.eGradient_RadialUpperRight:
gx0 = x + w;
gy0 = y;
gx1 = x;
gy1 = y + h;
gr = (float) Math.sqrt( w*w+h*h);
break;
case Glow.eGradient_RadialLowerRight:
gx0 = x + w;
gy0 = y + h;
gx1 = x;
gy1 = y;
gr = (float) Math.sqrt( w*w+h*h);
break;
default: ;
}
switch ( gradient) {
case Glow.eGradient_HorizontalUp:
case Glow.eGradient_HorizontalDown:
case Glow.eGradient_HorizontalTube1:
case Glow.eGradient_HorizontalTube2:
case Glow.eGradient_VerticalLeft:
case Glow.eGradient_VerticalRight:
case Glow.eGradient_VerticalTube1:
case Glow.eGradient_VerticalTube2:
case Glow.eGradient_DiagonalUpperLeft:
case Glow.eGradient_DiagonalLowerLeft:
case Glow.eGradient_DiagonalUpperRight:
case Glow.eGradient_DiagonalLowerRight:
case Glow.eGradient_DiagonalUpTube:
case Glow.eGradient_DiagonalDownTube: {
GradientPaint gp = new GradientPaint( gx0, gy0,
getColor(f2),
gx1, gy1,
getColor(f1),true);
g2.setPaint(gp);
break;
}
case Glow.eGradient_Globe:
case Glow.eGradient_RadialCenter:
case Glow.eGradient_RadialUpperLeft:
case Glow.eGradient_RadialLowerLeft:
case Glow.eGradient_RadialUpperRight:
case Glow.eGradient_RadialLowerRight:{
RadialGradientPaint gp = new RadialGradientPaint( new Point2D.Float(gx0,gy0), gr, new float[] {0F,1F}, new Color[] { getColor(f2), getColor(f1)});
g2.setPaint(gp);
break;
}
default: ;
}
}
public GlowDimension getTextExtent( String text, int idx, int type) {
FontMetrics metrics = g2.getFontMetrics( getFont( type, idx));
GlowDimension dim = new GlowDimension();
dim.height = metrics.getHeight();
dim.width = metrics.stringWidth(text);
return dim;
}
public Font getFont( int type, int idx) {
if ( fonts[idx] == null) {
int text_size;
switch ( idx) {
case 0: text_size = 8; break;
case 1: text_size = 10; break;
case 2: text_size = 12; break;
case 3: text_size = 14; break;
case 4: text_size = 16; break;
case 5: text_size = 18; break;
case 6: text_size = 20; break;
case 7: text_size = 22; break;
default: text_size = 24;
}
text_size *= 0.8;
fonts[idx] = new Font("Helvetica", Font.PLAIN, text_size);
}
return fonts[idx];
}
}
/*
* 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.
*/
package jpwr.jopg;
import java.awt.*;
public interface GlowDrawIfc {
public void rect(int border, int fill, double x, double y, double witdh, double height);
public void rect(int x, int y, int width, int height, int gc_type, int idx, int highlight);
public void fill_rect(int x, int y, int width, int height, int gc_type);
public void gradient_fill_rect(int x, int y, int width, int height, int gc_type, int f1, int f2, int gradient);
public void arc(int x, int y, int width, int height, int angle1, int angle2, int gc_type, int idx, int highlight);
public void fill_arc(int x, int y, int width, int height, int angle1, int angle2, int gc_type);
public void gradient_fill_arc(int x, int y, int width, int height, int angle1, int angle2, int gc_type, int f1, int f2, int gradient);
public void line(int x1, int y1, int x2, int y2, int gc_type, int idx, int highlight);
public void line_dashed(int x1, int y1, int x2, int y2, int gc_type, int idx, int highlight, int line_type);
public void polyline(GlowPointX[] points, int point_cnt, int gc_type, int idx, int highlight);
public void fill_polyline(GlowPointX[] points, int point_cnt, int gc_type, int highlight);
public void gradient_fill_polyline(GlowPointX[] points, int point_cnt, int gc_type, int f1, int f2, int gradient);
public void text( int x, int y, String text, int gc_type, int color, int idx, int highlight, int line,
int font_idx, double size, int rot);
public int gradient_rotate(double rotate, int gradient);
public GlowDimension getTextExtent( String text, int idx, int type);
public Color getColor(int gc_type);
}
/*
* 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.
*/
package jpwr.jopg;
public class GlowEvent {
public int type;
public double x;
public double y;
Object object;
public GlowEvent() {}
}
\ No newline at end of file
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowNodeClass extends GlowArrayElem {
GrowCmn cmn;
Vector<GlowArrayElem> a = new Vector<GlowArrayElem>();
String nc_name;
int group;
int slider;
String next_nodeclass;
int animation_count;
int cycle;
double x0;
double y0;
double x1;
double y1;
int input_focus_mark;
int dynamicsize;
Object userdata;
public int dyn_type1;
public int dyn_type2;
public int action_type1;
public int action_type2;
public int[] dyn_color = new int[4];
String[] dyn_attr = new String[4];
GlowArrayElem next_nc;
GlowArrayElem prev_nc;
public GlowNodeClass(GrowCmn cmn) {
this.cmn = cmn;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowNodeClass : " + line);
switch ( key) {
case Glow.eSave_NodeClass:
break;
case Glow.eSave_NodeClass_nc_name:
nc_name = token.nextToken();
break;
case Glow.eSave_NodeClass_a:
GlowVector.open(reader, cmn, a);
break;
case Glow.eSave_NodeClass_group:
group = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_arg_cnt:
case Glow.eSave_NodeClass_argname:
case Glow.eSave_NodeClass_argtype:
case Glow.eSave_NodeClass_no_con_obstacle:
break;
case Glow.eSave_NodeClass_dyn_type1:
dyn_type1 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_type2:
dyn_type2 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_action_type1:
action_type1 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_action_type2:
action_type2 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_color1:
dyn_color[0] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_color2:
dyn_color[1] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_color3:
dyn_color[2] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_color4:
if ( token.hasMoreTokens())
dyn_color[3] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dyn_attr1:
if ( token.hasMoreTokens())
dyn_attr[0] = token.nextToken();
break;
case Glow.eSave_NodeClass_dyn_attr2:
if ( token.hasMoreTokens())
dyn_attr[1] = token.nextToken();
break;
case Glow.eSave_NodeClass_dyn_attr3:
if ( token.hasMoreTokens())
dyn_attr[2] = token.nextToken();
break;
case Glow.eSave_NodeClass_dyn_attr4:
if ( token.hasMoreTokens())
dyn_attr[3] = token.nextToken();
break;
case Glow.eSave_NodeClass_java_name:
break;
case Glow.eSave_NodeClass_slider:
slider = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_next_nodeclass:
if ( token.hasMoreTokens())
next_nodeclass = token.nextToken();
break;
case Glow.eSave_NodeClass_animation_count:
animation_count = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_cycle:
cycle = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_y0:
y0 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_NodeClass_y1:
y1 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_NodeClass_x0:
x0 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_NodeClass_x1:
x1 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_NodeClass_input_focus_mark:
input_focus_mark = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dynamic:
if ( cmn.dynamicsize > 0) {
for ( int j = 0; j < cmn.dynamicsize; j++)
line = reader.readLine(); // TODO handle backslash and citationmarks
}
break;
case Glow.eSave_NodeClass_userdata_cb:
if ( cmn.appl != null)
userdata = cmn.appl.growUserdataOpen( reader, this, Glow.eUserdataCbType_NodeClass);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowNodeClass");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowNodeClass");
}
if (next_nodeclass != null && !next_nodeclass.equals("")) {
next_nc = (GlowNodeClass)cmn.ctx.get_nodeclass_from_name( next_nodeclass);
if ( next_nc == null) {
System.out.println( "GlowNode:next_nodeclass not found: " + nc_name + " " +
next_nodeclass);
System.out.println( "Note! nodeclass has to be intern");
}
else if ( ((GlowNodeClass)next_nc).prev_nc != null) {
next_nc = null;
System.out.println( "GlowNode:next_nodeclass already chained: " + nc_name + " " +
next_nodeclass);
}
else
((GlowNodeClass)next_nc).prev_nc = (GlowArrayElem) this;
}
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
for ( int i = 0; i < a.size(); i++)
a.get(i).draw(t, highlight, hot, node, colornode);
}
public int eventHandler( GlowEvent event, double fx, double fy) {
int sts;
for ( int i = 0; i < a.size(); i++) {
sts = a.get(i).eventHandler(event, fx, fy);
if ( sts != 0)
return sts;
}
return 0;
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowNodeGroup extends GlowNodeClass {
public GlowNodeGroup(GrowCmn cmn) {
super(cmn);
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowNodeGroup : " + line);
switch ( key) {
case Glow.eSave_NodeGroup:
break;
case Glow.eSave_NodeGroup_nodeclass_part:
super.open(reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowNodeGroup");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowNodeGroup");
}
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowPoint {
GrowCmn cmn;
public double x;
public double y;
public GlowPoint(GrowCmn cmn) {
this.cmn = cmn;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowPoint : " + line);
switch ( key) {
case Glow.eSave_Point:
break;
case Glow.eSave_Point_x:
x = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Point_y:
y = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowPoint");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowPoint");
}
}
}
/*
* 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.
*/
package jpwr.jopg;
public class GlowPointX {
public int x;
public int y;
}
\ No newline at end of file
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowTransform {
double a11;
double a12;
double a13;
double a21;
double a22;
double a23;
double rotation;
double s_a11;
double s_a12;
double s_a13;
double s_a21;
double s_a22;
double s_a23;
double s_rotation;
boolean stored;
public GlowTransform() {
}
public void store() {
s_a11=a11;
s_a12=a12;
s_a13=a13;
s_a21=a21;
s_a22=a22;
s_a23=a23;
s_rotation=rotation;
stored=true;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
// if ( cmn.debug) System.out.println( "GlowTransform : " + line);
switch ( key) {
case Glow.eSave_Transform: break;
case Glow.eSave_Transform_a11:
a11 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a12:
a12 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a13:
a13 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a21:
a21 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a22:
a22 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_a23:
a23 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Transform_rotation:
rotation = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowTransform");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowTransform");
}
}
public double rot( GlowTransform t) {
return t.rotation + rotation;
}
public double rot() {
return rotation;
}
public double x( double x1, double y1) {
return x1 * a11 + y1 * a12 + a13;
}
public double y( double x1, double y1) {
return x1 * a21 + y1 * a22 + a23;
}
public GlowTransform multiply(GlowTransform p) {
GlowTransform tmp = new GlowTransform();
tmp.a11 = a11 * p.a11 + a12 * p.a21;
tmp.a12 = a11 * p.a12 + a12 * p.a22;
tmp.a13 = a11 * p.a13 + a12 * p.a23 + a13;
tmp.a21 = a21 * p.a11 + a22 * p.a21;
tmp.a22 = a21 * p.a12 + a22 * p.a22;
tmp.a23 = a21 * p.a13 + a22 * p.a23 + a23;
tmp.rotation = rotation + p.rotation;
return tmp;
}
public void set_from_stored( GlowTransform t) {
a11 = t.a11 * s_a11 + t.a12 * s_a21;
a12 = t.a11 * s_a12 + t.a12 * s_a22;
a13 = t.a11 * s_a13 + t.a12 * s_a23 + t.a13;
a21 = t.a21 * s_a11 + t.a22 * s_a21;
a22 = t.a21 * s_a12 + t.a22 * s_a22;
a23 = t.a21 * s_a13 + t.a22 * s_a23 + t.a23;
rotation = s_rotation + t.rotation;
}
public void scale( double sx, double sy, double x0, double y0) {
a13 = a13 * sx + x0 * ( 1 - sx);
a23 = a23 * sy + y0 * ( 1 - sy);
a11 *= sx;
a12 *= sx;
a21 *= sy;
a22 *= sy;
}
public void scale_from_stored( double sx, double sy, double x0, double y0) {
a13 = s_a13 * sx + x0 * ( 1 - sx);
a23 = s_a23 * sy + y0 * ( 1 - sy);
a11 = s_a11 * sx;
a12 = s_a12 * sx;
a21 = s_a21 * sy;
a22 = s_a22 * sy;
}
public void rotate( double angle, double x0, double y0) {
double sin_a;
double cos_a;
GlowTransform tmp = new GlowTransform();
tmp.a11 = a11;
tmp.a12 = a12;
tmp.a13 = a13;
tmp.a21 = a21;
tmp.a22 = a22;
tmp.a23 = a23;
tmp.rotation = rotation;
if ( -90.01 < angle && angle < -89.99) {
sin_a = -1.0;
cos_a = 0.0;
}
else {
sin_a = Math.sin( angle/180*3.14159);
cos_a = Math.cos( angle/180*3.14159);
}
a11 = tmp.a11 * cos_a - tmp.a21 * sin_a;
a12 = tmp.a12 * cos_a - tmp.a22 * sin_a;
a13 = tmp.a13 * cos_a - tmp.a23 * sin_a + x0 * ( 1 - cos_a) + y0 * sin_a;
a21 = tmp.a11 * sin_a + tmp.a21 * cos_a;
a22 = tmp.a21 * sin_a + tmp.a22 * cos_a;
a23 = tmp.a13 * sin_a + tmp.a23 * cos_a + y0 * ( 1 - cos_a) - x0 * sin_a;
rotation += angle;
}
public void rotate_from_stored( double angle, double x0, double y0) {
double sin_a;
double cos_a;
if ( -90.01 < s_rotation + angle && s_rotation + angle < -89.99) {
sin_a = -1.0;
cos_a = 0.0;
}
else {
sin_a = Math.sin( (s_rotation + angle)/180*3.14159);
cos_a = Math.cos( (s_rotation + angle)/180*3.14159);
}
a11 = s_a11 * cos_a - s_a21 * sin_a;
a12 = s_a12 * cos_a - s_a22 * sin_a;
a13 = s_a13 * cos_a - s_a23 * sin_a + x0 * ( 1 - cos_a) + y0 * sin_a;
a21 = s_a11 * sin_a + s_a21 * cos_a;
a22 = s_a21 * sin_a + s_a22 * cos_a;
a23 = s_a13 * sin_a + s_a23 * cos_a + y0 * ( 1 - cos_a) - x0 * sin_a;
rotation = s_rotation + angle;
}
public void move( double x0, double y0) {
a13 += x0;
a23 += y0;
}
public void move_from_stored( double x0, double y0) {
a13 = s_a13 + x0;
a23 = s_a23 + y0;
}
public void posit( double x0, double y0) {
a13 = x0;
a23 = y0;
}
public double x( GlowTransform t, double x1, double y1) {
GlowTransform tmp = t.multiply(this);
return tmp.x( x1, y1);
}
public double y( GlowTransform t, double x1, double y1) {
GlowTransform tmp = t.multiply(this);
return tmp.y( x1, y1);
}
public GlowPoint reverse( double x, double y) {
GlowPoint p = new GlowPoint(null);
if ( a11 == 0 || ( a12 * a21 - a11 * a22) == 0) {
if ( a11 == 0 && a22 == 0 && a12 != 0 && a21 != 0) {
p.y = (x - a13) / a12;
p.x = (y - a23) / a21;
return p;
}
else {
p.y = p.x = 0;
return p;
}
}
p.y = ( a11 * ( a23 - y) - a21 * ( a13 - x)) / ( a12 * a21 - a11 * a22);
p.x = ( x - a12 * p.y - a13) / a11;
return p;
}
public double vertical_scale( GlowTransform t) {
if ( t == null)
return Math.sqrt( a12*a12 + a22*a22);
GlowTransform tmp = t.multiply(this);
return Math.sqrt( tmp.a12*tmp.a12 + tmp.a22*tmp.a22);
}
}
\ No newline at end of file
/*
* 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.
*/
package jpwr.jopg;
import java.io.*;
import java.util.*;
public class GlowVector {
public GlowVector() {
}
//public static void open( BufferedReader reader, GrowCmn cmn, Vector<Object> a) {
public static void open( BufferedReader reader, GrowCmn cmn, Vector a) {
String line;
StringTokenizer token;
boolean end = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowVector : " + line);
switch ( key) {
case Glow.eSave_Array:
break;
case Glow.eSave_NodeClass: {
System.out.println("GlowVector: GlowNodeClass");
GlowNodeClass nc = new GlowNodeClass( cmn);
nc.open( reader);
a.add( (Object) nc);
break;
}
case Glow.eSave_NodeGroup: {
System.out.println("GlowVector: GlowNodeGroup");
GlowNodeGroup nc = new GlowNodeGroup( cmn);
nc.open( reader);
a.add( (Object) nc);
break;
}
case Glow.eSave_ConClass:
GlowConClass cc = new GlowConClass( cmn);
cc.open( reader);
a.add( (Object) cc);
break;
case Glow.eSave_GrowNode: {
GrowNode n = new GrowNode( cmn);
n.open( reader);
a.add( n);
break;
}
case Glow.eSave_GrowGroup: {
GrowGroup n = new GrowGroup( cmn);
n.open( reader);
a.add( n);
break;
}
case Glow.eSave_GrowRect: {
GrowRect c = new GrowRect( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowArc: {
GrowArc c = new GrowArc( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowLine: {
GrowLine c = new GrowLine( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowPolyLine: {
GrowPolyline c = new GrowPolyline( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowText: {
GrowText c = new GrowText( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_ConPoint: {
GlowConPoint c = new GlowConPoint( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowAnnot: {
GrowAnnot c = new GrowAnnot( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_Point: {
GlowPoint c = new GlowPoint( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_End:
end = true;
break;
default:
System.out.println( "Syntax error in GlowVector");
break;
}
if ( end)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowVector");
}
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
public class Graph implements GraphIfc, GrowApplIfc {
public static final int eType_Bit = (1 << 15) + 1;
public GrowCmn cmn;
public GrowCtx ctx;
public GlowDraw gdraw;
public GraphApplIfc appl;
public Gdh gdh;
public GraphLocalDb ldb;
public Graph(GraphApplIfc appl, Gdh gdh) {
this.appl = appl;
this.gdh = gdh;
ldb = new GraphLocalDb();
ctx = new GrowCtx(this);
gdraw = new GlowDraw();
cmn = ctx.getCmn();
cmn.setGdraw(gdraw);
}
public Gdh getGdh() {
return gdh;
}
public GraphLocalDb getLdb() {
return ldb;
}
public GrowCtx getCtx() {
return ctx;
}
void open(BufferedReader reader) {
ctx.open( reader);
ctx.traceConnect();
}
public void traceConnect(GrowNode object) {
Dyn dyn = (Dyn)object.getUserData();
dyn.connect(object);
}
public void traceDisconnect(GrowNode object) {
Dyn dyn = (Dyn)object.getUserData();
dyn.disconnect();
}
public void traceScan(GrowNode object) {
Dyn dyn = (Dyn)object.getUserData();
dyn.scan(object);
}
int stringToType( String str) {
if ( str.equalsIgnoreCase("boolean"))
return Pwr.eType_Boolean;
if ( str.equalsIgnoreCase("float32"))
return Pwr.eType_Float32;
if ( str.equalsIgnoreCase("float64"))
return Pwr.eType_Float64;
if ( str.equalsIgnoreCase("char"))
return Pwr.eType_Char;
if ( str.equalsIgnoreCase("int8"))
return Pwr.eType_Int8;
if ( str.equalsIgnoreCase("int16"))
return Pwr.eType_Int16;
if ( str.equalsIgnoreCase("int32"))
return Pwr.eType_Int32;
if ( str.equalsIgnoreCase("int64"))
return Pwr.eType_Int64;
if ( str.equalsIgnoreCase("uint8"))
return Pwr.eType_UInt8;
if ( str.equalsIgnoreCase("uint16"))
return Pwr.eType_UInt16;
if ( str.equalsIgnoreCase("uint32"))
return Pwr.eType_UInt32;
if ( str.equalsIgnoreCase("uint64"))
return Pwr.eType_UInt64;
if ( str.equalsIgnoreCase("objid"))
return Pwr.eType_Objid;
if ( str.equalsIgnoreCase("time"))
return Pwr.eType_Time;
if ( str.equalsIgnoreCase("deltatime"))
return Pwr.eType_DeltaTime;
if ( str.equalsIgnoreCase("attrref"))
return Pwr.eType_AttrRef;
if ( str.equalsIgnoreCase("status"))
return Pwr.eType_Status;
if ( str.equalsIgnoreCase("netstatus"))
return Pwr.eType_NetStatus;
if ( str.equalsIgnoreCase("enum"))
return Pwr.eType_Enum;
if ( str.equalsIgnoreCase("mask"))
return Pwr.eType_Mask;
if ( str.equalsIgnoreCase("bit"))
return Graph.eType_Bit;
return 0;
}
int stringToElements( String str) {
int idx1, idx2;
int elements;
if ( (idx1 = str.indexOf('[')) != -1 &&
(idx2 = str.indexOf(']')) != -1 &&
idx2 > idx1) {
try {
System.out.println("Elements: " + str.substring(idx1+1, idx2));
elements = new Integer(str.substring(idx1+1, idx2)).intValue();
}
catch( NumberFormatException e) {
System.out.println("Element syntax error, " + str);
return 1;
}
return elements;
}
return 1;
}
public DynParsedAttrName parseAttrName( String name) {
int idx, tidx, eidx;
DynParsedAttrName pname = new DynParsedAttrName();
String str = name.trim();
if ( (idx = str.indexOf('[')) != -1 &&
(eidx = str.lastIndexOf('#')) != -1 &&
str.charAt(eidx-1) != '#') {
pname.elements = stringToElements(str);
str = str.substring(0, idx-1);
}
else
pname.elements = 1;
if ( (tidx = str.indexOf("##")) != -1) {
if ( str.toLowerCase().startsWith("bit", tidx+2)) {
String typestr = str.substring(tidx+2);
int bit = stringToElements(str);
pname.bitmask = 1 << bit;
str = str.substring(0, tidx+5);
}
pname.type = stringToType( str.substring(tidx+2));
str = str.substring(0, tidx);
}
else
pname.type = 0;
if ( str.startsWith("!")) {
str = str.substring(1);
str = str.trim();
pname.inverted = true;
}
else
pname.inverted = false;
pname.database = Graph.eDatabase_Gdh;
pname.name = str;
System.out.println( "ParsedName: " + name + " " + pname.name + " type: " + pname.type + " elements: " + pname.elements + " bitm: " + pname.bitmask);
return pname;
}
public Object growUserdataOpen( BufferedReader reader, Object object, int type) {
switch ( type) {
case Glow.eUserdataCbType_Ctx:
break;
case Glow.eUserdataCbType_Node: {
Dyn dyn = new Dyn(this);
dyn.open(reader);
return dyn;
}
case Glow.eUserdataCbType_NodeClass: {
Dyn dyn = new Dyn(this);
dyn.open(reader);
return dyn;
}
}
return null;
}
public void eventHandler(GlowEvent e) {
if ( e.object != null) {
int sts;
Dyn dyn = (Dyn)((GrowNode)e.object).getUserData();
sts = dyn.action((GrowNode)e.object, e);
}
}
public int command(String cmd) {
if ( appl != null)
return appl.command(cmd);
return 0;
}
public void openConfirmDialog(Object dyn, String text, Object object) {
if ( appl != null)
appl.openConfirmDialog(dyn, text, object);
}
public String get_reference_name(String name) {
// TODO
return null;
}
}
/*
* 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.
*/
package jpwr.jopg;
public interface GraphApplIfc {
public int command(String cmd);
public void openConfirmDialog( Object dyn, String text, Object object);
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
public interface GraphIfc {
public static final int eDatabase_Gdh = 0;
public static final int eDatabase_User = 1;
public static final int eDatabase_Local = 2;
public static final int eDatabase_Ccm = 3;
public DynParsedAttrName parseAttrName( String name);
public Gdh getGdh();
public GraphLocalDb getLdb();
public GrowCtx getCtx();
public int command(String cmd);
public void openConfirmDialog(Object dyn, String text, Object object);
public String get_reference_name(String name);
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.util.*;
import java.io.*;
/**
* Description of the Class
*
*@author cs
*@created July 12, 2004
*@version 1.0
*/
public class GraphLocalDb {
private class LocalSub {
public float valueFloat = 0;
public int valueInt = 0;
public boolean valueBoolean = false;
public String valueString = null;
String name;
boolean occupied = false;
int typeId;
int refId;
Object owner;
int refCount = 0;
public LocalSub( Object owner, String name, int typeId, int refId) {
this.owner = owner;
this.name = name;
this.typeId = typeId;
this.refId = refId;
this.occupied = true;
}
public void ref() {
refCount++;
}
public void unref() {
refCount--;
}
public int getRefCount() {
return refCount;
}
}
//Vector<LocalSub> subscriptions = new Vector<LocalSub>();
Vector subscriptions = new Vector();
int subscriptionCount = 1;
public GraphLocalDb() {
// Insert dummy first
subscriptions.insertElementAt(null, 0);
}
public GdhrRefObjectInfo refObjectInfo( Object owner, String attributeName) {
int typeId = getTypeId(attributeName);
String name = getName(attributeName);
if ( typeId == 0) {
return new GdhrRefObjectInfo(null, 0, 0, 0);
}
int p = nameToId( owner, name);
if ( p == -1) {
PwrtRefId refid = new PwrtRefId( subscriptionCount, 0);
int id = subscriptionCount;
LocalSub sub = new LocalSub( owner, name, typeId, subscriptionCount);
sub.ref();
subscriptions.insertElementAt(sub, subscriptionCount);
subscriptionCount++;
return new GdhrRefObjectInfo(refid, id, 1, typeId);
}
else {
PwrtRefId refid = new PwrtRefId( p, 0);
LocalSub sub = (LocalSub) subscriptions.elementAt(p);
sub.ref();
return new GdhrRefObjectInfo( refid, p, 1, typeId);
}
}
public void unrefObjectInfo( int id) {
LocalSub sub = (LocalSub) subscriptions.elementAt(id);
if ( sub == null)
return;
sub.unref();
if ( sub.getRefCount() <= 0)
subscriptions.setElementAt( null, id);
}
public float getObjectRefInfoFloat(int id) {
try {
LocalSub sub = (LocalSub) subscriptions.elementAt(id);
if ( sub == null)
return 0F;
return sub.valueFloat;
}
catch(ArrayIndexOutOfBoundsException e) {
return 0F;
}
}
public int getObjectRefInfoInt(int id) {
try {
LocalSub sub = (LocalSub) subscriptions.elementAt(id);
if ( sub == null)
return 0;
return sub.valueInt;
}
catch(ArrayIndexOutOfBoundsException e) {
return 0;
}
}
public boolean getObjectRefInfoBoolean(int id) {
try {
LocalSub sub = (LocalSub) subscriptions.elementAt(id);
if ( sub == null)
return false;
return sub.valueBoolean;
}
catch(ArrayIndexOutOfBoundsException e) {
return false;
}
}
public String getObjectRefInfoString(int id, int typeid) {
try {
LocalSub sub = (LocalSub) subscriptions.elementAt(id);
if ( sub != null && sub.valueString != null)
return sub.valueString;
else
return new String();
}
catch(ArrayIndexOutOfBoundsException e) {
return new String();
}
}
public CdhrBoolean getObjectInfoBoolean(Object owner, String attributeName) {
String name = getName( attributeName);
int id = nameToId( owner, name);
if ( id == -1)
return new CdhrBoolean( false, 0);
return new CdhrBoolean( ((LocalSub)subscriptions.elementAt(id)).valueBoolean, 1);
}
public CdhrInt getObjectInfoInt(Object owner, String attributeName) {
String name = getName( attributeName);
int id = nameToId( owner, name);
if ( id == -1)
return new CdhrInt( 0, 2);
return new CdhrInt( ((LocalSub)subscriptions.elementAt(id)).valueInt, 1);
}
public CdhrFloat getObjectInfoFloat(Object owner, String attributeName) {
String name = getName( attributeName);
int id = nameToId( owner, name);
if ( id == -1)
return new CdhrFloat( 0F, 2);
return new CdhrFloat( ((LocalSub)subscriptions.elementAt(id)).valueFloat, 1);
}
public CdhrString getObjectInfoString(Object owner, String attributeName) {
String name = getName( attributeName);
int id = nameToId( owner, name);
if ( id == -1)
return new CdhrString( "", 2);
return new CdhrString( ((LocalSub)subscriptions.elementAt(id)).valueString, 1);
}
public PwrtStatus setObjectInfo( Object owner, String attributeName, boolean value) {
String name = getName( attributeName);
int id = nameToId( owner, name);
if ( id == -1)
return new PwrtStatus(2);
((LocalSub)subscriptions.elementAt(id)).valueBoolean = value;
return new PwrtStatus(1);
}
public PwrtStatus toggleObjectInfo( Object owner, String attributeName) {
String name = getName( attributeName);
int id = nameToId( owner, name);
if ( id == -1)
return new PwrtStatus(2);
((LocalSub)subscriptions.elementAt(id)).valueBoolean =
!((LocalSub)subscriptions.elementAt(id)).valueBoolean;
return new PwrtStatus(1);
}
public PwrtStatus setObjectInfo( Object owner, String attributeName, int value) {
String name = getName( attributeName);
int id = nameToId( owner, name);
if ( id == -1)
return new PwrtStatus(2);
((LocalSub)subscriptions.elementAt(id)).valueInt = value;
return new PwrtStatus(1);
}
public PwrtStatus setObjectInfo( Object owner, String attributeName, float value) {
String name = getName( attributeName);
int id = nameToId( owner, name);
if ( id == -1)
return new PwrtStatus(2);
((LocalSub)subscriptions.elementAt(id)).valueFloat = value;
return new PwrtStatus(1);
}
public PwrtStatus setObjectInfo( Object owner, String attributeName, String value) {
String name = getName( attributeName);
int id = nameToId( owner, name);
if ( id == -1)
return new PwrtStatus(2);
((LocalSub)subscriptions.elementAt(id)).valueString = value;
return new PwrtStatus(1);
}
private int nameToId( Object owner, String name) {
for ( int i = 0; i < subscriptions.size(); i++) {
LocalSub sub = (LocalSub)subscriptions.elementAt(i);
if ( sub != null && owner == sub.owner && name.equalsIgnoreCase( sub.name))
return i;
}
return -1;
}
private String getName(String attrName) {
if ( attrName.startsWith("$local."))
attrName = attrName.substring(7);
int idx1 = attrName.indexOf("##");
if ( idx1 != -1)
return attrName.substring(0, idx1);
return attrName;
}
private int getTypeId(String attrName) {
String suffix;
int idx1 = attrName.indexOf("##");
if(idx1 < 0)
{
return Pwr.eType_Boolean;
}
idx1 += 2;
int idx2 = attrName.indexOf('#', idx1);
if(idx2 < 0)
{
suffix = attrName.substring(idx1).toUpperCase();
}
else
{
suffix = attrName.substring(idx1, idx2).toUpperCase();
}
if(suffix.compareTo("BOOLEAN") == 0)
{
return Pwr.eType_Boolean;
}
if(suffix.compareTo("FLOAT32") == 0)
{
return Pwr.eType_Float32;
}
if(suffix.compareTo("INT32") == 0)
{
return Pwr.eType_Int32;
}
if(suffix.compareTo("UINT32") == 0)
{
return Pwr.eType_UInt32;
}
if(suffix.compareTo("INT16") == 0)
{
return Pwr.eType_Int16;
}
if(suffix.compareTo("UINT16") == 0)
{
return Pwr.eType_UInt16;
}
if(suffix.compareTo("INT8") == 0)
{
return Pwr.eType_Int8;
}
if(suffix.compareTo("UINT8") == 0)
{
return Pwr.eType_UInt8;
}
if(suffix.compareTo("CHAR") == 0)
{
return Pwr.eType_Char;
}
if(suffix.compareTo("FLOAT64") == 0)
{
return Pwr.eType_Float64;
}
if(suffix.compareTo("OBJID") == 0)
{
return Pwr.eType_Objid;
}
if(suffix.compareTo("STRING") == 0)
{
return Pwr.eType_String;
}
if(suffix.compareTo("TIME") == 0)
{
return Pwr.eType_Time;
}
if(suffix.compareTo("DELTATIME") == 0)
{
return Pwr.eType_DeltaTime;
}
if(suffix.compareTo("ATTRREF") == 0)
{
return Pwr.eType_AttrRef;
}
if(suffix.substring(0, 6).compareTo("STRING") == 0)
{
return Pwr.eType_String;
}
return 0;
}
};
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowAnnot extends GlowArrayElem {
GrowCmn cmn;
GlowPoint p;
int adjustment;
GlowTransform trf;
int number;
int draw_type;
int color_drawtype;
int text_size;
int display_level;
int annot_type;
int font;
public GrowAnnot(GrowCmn cmn) {
this.cmn = cmn;
p = new GlowPoint(cmn);
trf = new GlowTransform();
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowAnnot : " + line);
switch ( key) {
case Glow.eSave_GrowAnnot:
break;
case Glow.eSave_GrowAnnot_adjustment:
adjustment = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowAnnot_annot_part:
glowannot_open(reader);
break;
case Glow.eSave_GrowAnnot_trf:
trf.open(reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowAnnot");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowAnnot");
}
}
public void glowannot_open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowAnnot : " + line);
switch ( key) {
case Glow.eSave_Annot:
break;
case Glow.eSave_Annot_number:
number = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_color_drawtype:
color_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_text_size:
text_size = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_display_level:
display_level = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_p:
p.open( reader);
break;
case Glow.eSave_Annot_annot_type:
annot_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Annot_font:
font = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowAnnot");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowAnnot");
}
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
int x1, y1;
if ( ((GrowNode)node).annotv[number] == null)
return;
int color;
int rot;
double trf_scale = trf.vertical_scale( t);
int idx = (int)( trf_scale * cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (text_size +4) - 4);
double tsize = trf_scale * cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (8+2*text_size);
if ( idx < 0)
return;
idx = Math.min( idx, Glow.DRAW_TYPE_SIZE-1);
int lfont;
int ldraw_type;
if ( node != null && ((GrowNode)node).text_font != Glow.eFont_No) {
lfont = ((GrowNode)node).text_font;
ldraw_type = ((GrowNode)node).text_type;
}
else {
lfont = font;
ldraw_type = draw_type;
}
if ( t == null) {
x1 = (int)( trf.x( p.x, p.y) * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
y1 = (int)( trf.y( p.x, p.y) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
rot = (int) trf.rot();
}
else {
x1 = (int)( trf.x( t, p.x, p.y) * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
y1 = (int)( trf.y( t, p.x, p.y) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
rot = (int) trf.rot( t);
}
rot = rot < 0 ? rot % 360 + 360 : rot % 360;
switch ( annot_type) {
case Glow.eAnnotType_OneLine: {
int width = 0;
int height = 0;
int descent = 0;
color = GlowColor.get_drawtype( color_drawtype, Glow.eDrawType_LineHighlight,
highlight, colornode, 2, 0);
if ( ((rot < 45 || rot >= 315) &&
( ((GrowNode)node).annotv_inputmode[number] != 0 &&
((GrowNode)node).input_selected != 0)) ||
( !(rot < 45 || rot >= 315)) ||
adjustment == Glow.eAdjustment_Right ||
adjustment == Glow.eAdjustment_Center) {
GlowDimension d = cmn.gdraw.getTextExtent( ((GrowNode)node).annotv[number], idx, ldraw_type);
width = d.width;
height = d.height;
descent = height/4;
}
switch ( adjustment) {
case Glow.eAdjustment_Left:
break;
case Glow.eAdjustment_Right:
x1 -= width;
break;
case Glow.eAdjustment_Center:
x1 -= width /2;
break;
}
if ( rot < 45 || rot >= 315) {
if ( ((GrowNode)node).annotv_inputmode[number] != 0 &&
((GrowNode)node).input_selected != 0) {
cmn.gdraw.fill_rect( x1, y1 - height + descent, width, height,
Glow.eDrawType_MediumGray);
}
}
else {
// Text is rotated, adjust the coordinates
if ( adjustment == Glow.eAdjustment_Center) {
// Only center adjustment supports text rotation
if ( 45 <= rot && rot < 135) {
x1 += width/2;
y1 += width/2;
}
else if ( 135 <= rot && rot < 225) {
y1 += height - descent;
}
else if ( 225 <= rot && rot < 315) {
x1 += width/2 - height + descent;
y1 -= width/2 - height + descent;
}
else {
x1 -= width;
}
}
else {
if ( 45 <= rot && rot < 135) {
y1 += height - descent;
}
else if ( 135 <= rot && rot < 225) {
x1 -= width;
y1 += height - descent;
}
else {
x1 -= width;
}
rot = 0;
}
}
cmn.gdraw.text( x1, y1,
((GrowNode)node).annotv[number],
ldraw_type, color, idx,
highlight, 0, lfont, tsize, rot);
if ( ((GrowNode)node).annotv_inputmode[number] != 0) {
/*
ctx->gdraw->text_cursor( w, x1, y1,
((GlowNode *) node)->annotv[number],
strlen(((GlowNode *) node)->annotv[number]),
ldraw_type, color, idx, highlight,
((GrowNode *)node)->input_position, lfont, tsize);
*/
}
break;
}
case Glow.eAnnotType_MultiLine: {
/*
int z_width, z_height, z_descent;
int len = 0;
int line_cnt = 0;
String line = new String(((GrowNode)node).annotv[number]);
char *s;
color = GlowColor.get_drawtype( color_drawtype, Glow.eDrawType_LineHighlight,
highlight, colornode, 2, 0);
GlowDimension d = cmn.gdraw.getTextExtent( "", 0, idx, ldraw_type);
z_width = d.width;
z_height = d.height;
x_descent = z_height/4;
for ( s = ((GlowNode *) ((GrowNode)node).annotv[number]; *s; s++) {
if ( *s == 10) {
if ( len) {
*s = 0;
ctx->gdraw->text( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, color, idx, highlight, 0, lfont, tsize, 0);
*s = 10;
}
len = 0;
line = s+1;
line_cnt++;
}
else
len++;
}
if ( len)
ctx->gdraw->text( w, x1, y1 + line_cnt * z_height, line,
len, ldraw_type, color, idx, highlight, 0, lfont, tsize, 0);
*/
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.
*/
package jpwr.jopg;
import java.io.*;
public interface GrowApplIfc {
public Object growUserdataOpen( BufferedReader reader, Object object, int type);
public void traceConnect(GrowNode object);
public void traceDisconnect(GrowNode object);
public void traceScan(GrowNode object);
public void eventHandler(GlowEvent e);
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowArc extends GlowArrayElem {
GrowCmn cmn;
String n_name;
double x_right;
double x_left;
double y_high;
double y_low;
int original_border_drawtype;
int original_fill_drawtype;
int fill_drawtype;
int border;
double shadow_width;
int shadow_contrast;
int shadow;
int relief;
int disable_shadow;
int fixcolor;
int fixposition;
int gradient;
int gradient_contrast;
int disable_gradient;
int dynamicsize;
GlowTransform trf;
GlowPoint ll;
GlowPoint ur;
int draw_type;
int angle1;
int angle2;
int line_width;
int display_level;
int fill;
public GrowArc(GrowCmn cmn) {
this.cmn = cmn;
trf = new GlowTransform();
ll = new GlowPoint(cmn);
ur = new GlowPoint(cmn);
}
public int type() {
return Glow.eObjectType_GrowArc;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowArc : " + line);
switch ( key) {
case Glow.eSave_GrowArc:
break;
case Glow.eSave_GrowArc_n_name:
n_name = token.nextToken();
break;
case Glow.eSave_GrowArc_x_right:
x_right = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowArc_x_left:
x_left = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowArc_y_high:
y_high = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowArc_y_low:
y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowArc_original_border_drawtype:
original_border_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_original_fill_drawtype:
original_fill_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_fill_drawtype:
fill_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_border:
border = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_shadow_width:
shadow_width = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowArc_shadow_contrast:
shadow_contrast = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_shadow:
shadow = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_relief:
relief = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_disable_shadow:
disable_shadow = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_fixcolor:
fixcolor = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_fixposition:
fixposition = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_gradient:
gradient = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_gradient_contrast:
gradient_contrast = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_disable_gradient:
disable_gradient = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowArc_dynamic:
if ( cmn.dynamicsize > 0) {
for ( int j = 0; j < cmn.dynamicsize; j++)
line = reader.readLine(); // TODO handle backslash and citationmarks
}
break;
case Glow.eSave_GrowArc_arc_part:
glowarc_open( reader);
break;
case Glow.eSave_GrowArc_trf:
trf.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowArc");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowArc");
}
}
public void glowarc_open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowArc : " + line);
switch ( key) {
case Glow.eSave_Arc:
break;
case Glow.eSave_Arc_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Arc_angle1:
angle1 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Arc_angle2:
angle2 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Arc_line_width:
line_width = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Arc_fill:
fill = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Arc_ll:
ll.open( reader);
break;
case Glow.eSave_Arc_ur:
ur.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowArc");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowArc");
}
}
public int eventHandler( GlowEvent event, double fx, double fy) {
GlowPoint rp;
switch ( event.type) {
case Glow.eEvent_CursorMotion:
return 0;
default: ;
}
rp = trf.reverse( fx, fy);
//rp = new GlowPoint(null);
//rp.x = fx;
//rp.y = fy;
System.out.println( "Event handler: " + fx + " " + fy + " reverse: " + rp.x + " " + rp.y);
System.out.println( " ll: " + ll.x + " " + ll.y + " ur: " + ur.x + " " + ur.y);
if ( ll.x <= rp.x && rp.x <= ur.x &&
ll.y <= rp.y && rp.y <= ur.y) {
System.out.println( "Event handler: Hit in arc");
return 1;
}
else
return 0;
}
public void draw() {
draw( null, 0, 0, null, null);
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
int drawtype;
int idx;
int chot = 0;
if ( cmn.hot_indication == Glow.eHotIndication_No)
hot = 0;
else if ( cmn.hot_indication == Glow.eHotIndication_DarkColor) {
chot = hot;
hot = 0;
}
else if ( cmn.hot_indication == Glow.eHotIndication_LightColor) {
chot = -hot;
hot = 0;
}
if ( fixcolor != 0)
colornode = null;
if ( node != null && ((GrowNode)node).line_width != 0)
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor *
((GrowNode)node).line_width - 1);
else
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * line_width - 1);
idx += hot;
idx = Math.max( 0, idx);
idx = Math.min( idx, Glow.DRAW_TYPE_SIZE-1);
int x1, y1, x2, y2, ll_x, ll_y, ur_x, ur_y, rot;
if ( t == null) {
x1 = (int)( trf.x( ll.x, ll.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y1 = (int)( trf.y( ll.x, ll.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
x2 = (int)( trf.x( ur.x, ur.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y2 = (int)( trf.y( ur.x, ur.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
rot = (int)( trf.rot());
}
else {
x1 = (int)( trf.x( t, ll.x, ll.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y1 = (int)( trf.y( t, ll.x, ll.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
x2 = (int)( trf.x( t, ur.x, ur.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y2 = (int)( trf.y( t, ur.x, ur.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
rot = (int)( trf.rot( t));
}
if ( rot % 90 != 0 && Math.abs((ur.x - ll.x) - (ur.y - ll.y)) < Float.MIN_VALUE) {
double scale;
double x_c;
double y_c;
if ( t == null) {
scale = trf.vertical_scale( trf);
x_c = ((trf.x( ll.x, ll.y) * cmn.mw.zoom_factor_x - cmn.mw.offset_x) +
(trf.x( ur.x, ur.y) * cmn.mw.zoom_factor_x - cmn.mw.offset_x)) / 2;
y_c = ((trf.y( ll.x, ll.y) * cmn.mw.zoom_factor_y - cmn.mw.offset_y) +
(trf.y( ur.x, ur.y) * cmn.mw.zoom_factor_y - cmn.mw.offset_y)) / 2;
}
else {
GlowTransform tmp = t.multiply( trf);
scale = trf.vertical_scale( tmp);
x_c = ((trf.x( t, ll.x, ll.y) * cmn.mw.zoom_factor_x - cmn.mw.offset_x) +
(trf.x( t, ur.x, ur.y) * cmn.mw.zoom_factor_x - cmn.mw.offset_x)) / 2;
y_c = ((trf.y( t, ll.x, ll.y) * cmn.mw.zoom_factor_y - cmn.mw.offset_y) +
(trf.y( t, ur.x, ur.y) * cmn.mw.zoom_factor_y - cmn.mw.offset_y)) / 2;
}
x1 = (int)(-scale * ((double)(ur.x - ll.x)/2 * cmn.mw.zoom_factor_x) + x_c + 0.5);
y1 = (int)(-scale * ((double)(ur.y - ll.y)/2 * cmn.mw.zoom_factor_y) + y_c + 0.5);
x2 = (int)(scale * ((double)(ur.x - ll.x)/2 * cmn.mw.zoom_factor_x) + x_c + 0.5);
y2 = (int)(scale * ((double)(ur.y - ll.y)/2 * cmn.mw.zoom_factor_y) + y_c + 0.5);
}
ll_x = Math.min( x1, x2);
ur_x = Math.max( x1, x2);
ll_y = Math.min( y1, y2);
ur_y = Math.max( y1, y2);
if ( fill != 0) {
boolean display_shadow = ((node != null && ((GrowNode)node).shadow != 0) || shadow != 0) && disable_shadow == 0;
int fillcolor = GlowColor.get_drawtype( fill_drawtype, Glow.eDrawType_FillHighlight,
highlight, colornode, 1, 0);
int grad = gradient;
if ( gradient == Glow.eGradient_No &&
(node != null && ((GrowNode)node).gradient != Glow.eGradient_No) && disable_gradient == 0)
grad = ((GrowNode)node).gradient;
if ( !display_shadow || shadow_width == 0 || angle2 != 360) {
if ( grad == Glow.eGradient_No || fillcolor == Glow.eDrawType_ColorRed) {
if ( chot != 0)
drawtype = GlowColor.shift_drawtype( fillcolor, chot, null);
else
drawtype = fillcolor;
cmn.gdraw.fill_arc( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
angle1 - rot, angle2, drawtype);
}
else {
int f1, f2;
if ( gradient_contrast >= 0) {
f2 = GlowColor.shift_drawtype( fillcolor, -gradient_contrast/2 + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, (int)((float)(gradient_contrast)/2+0.6) + chot, null);
}
else {
f2 = GlowColor.shift_drawtype( fillcolor, -(int)((float)(gradient_contrast)/2-0.6) + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, gradient_contrast/2 + chot, null);
}
cmn.gdraw.gradient_fill_arc( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, angle1 - rot,
angle2, fillcolor, f1, f2, grad);
}
}
else {
int ish = (int)( shadow_width / 100 * Math.min(ur_x - ll_x, ur_y - ll_y) + 0.5);
int drawtype_incr = shadow_contrast;
if ( relief == Glow.eRelief_Down)
drawtype_incr = -shadow_contrast;
if ( grad == Glow.eGradient_No || fillcolor == Glow.eDrawType_ColorRed) {
// Draw light shadow
drawtype = GlowColor.shift_drawtype( fillcolor, -drawtype_incr + chot, colornode);
cmn.gdraw.fill_arc( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
35, 140, drawtype);
// Draw dark shadow
drawtype = GlowColor.shift_drawtype( fillcolor, drawtype_incr + chot, colornode);
cmn.gdraw.fill_arc( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
215, 140, drawtype);
// Draw medium shadow and body
if ( chot != 0)
drawtype = GlowColor.shift_drawtype( fillcolor, chot, null);
else
drawtype = fillcolor;
cmn.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
-5, 40, drawtype);
cmn.gdraw.fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
175, 40, drawtype);
cmn.gdraw.fill_arc(ll_x + ish, ll_y + ish, ur_x - ll_x - 2*ish, ur_y - ll_y - 2*ish,
angle1 - rot, angle2, drawtype);
}
else {
int f1, f2;
// Draw shadow
f1 = GlowColor.shift_drawtype( fillcolor, -drawtype_incr + chot, colornode);
f2 = GlowColor.shift_drawtype( fillcolor, drawtype_incr + chot, colornode);
cmn.gdraw.gradient_fill_arc( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
angle1 - rot, angle2, fillcolor, f2, f1, Glow.eGradient_DiagonalUpperLeft);
// Draw circle
if ( gradient_contrast >= 0) {
f2 = GlowColor.shift_drawtype( fillcolor, -gradient_contrast/2 + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, (int)((float)(gradient_contrast)/2+0.6) + chot, null);
}
else {
f2 = GlowColor.shift_drawtype( fillcolor, -(int)((float)(gradient_contrast)/2-0.6) + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, gradient_contrast/2 + chot, null);
}
cmn.gdraw.gradient_fill_arc( ll_x + ish, ll_y + ish, ur_x - ll_x - 2*ish, ur_y - ll_y - 2*ish,
angle1 - rot, angle2, fillcolor, f1, f2, grad);
}
}
}
if ( border != 0 || fill == 0) {
drawtype = GlowColor.get_drawtype( draw_type, Glow.eDrawType_LineHighlight,
highlight, colornode, 0, 0);
cmn.gdraw.arc( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
angle1 - rot, angle2, drawtype, idx, 0);
}
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowCmn {
GlowDrawIfc gdraw;
public class GrowWindow {
public double zoom_factor_x;
public double zoom_factor_y;
public double base_zoom_factor;
public int offset_x;
public int offset_y;
}
public GrowApplIfc appl;
boolean debug;
boolean antiAliasing;
public GrowCtxIfc ctx;
GrowWindow mw = new GrowWindow();
double x_right;
double x_left;
double y_high;
double y_low;
String name;
int version;
int background_color;
int dynamicsize;
int arg_cnt;
String argname[] = new String[20];
int argtype[] = new int[20];
double x0;
double y0;
double x1;
double y1;
int path_cnt;
String path[] = new String[10];
int dyn_type1;
int dyn_type2;
int dyn_action_type1;
int dyn_action_type2;
int[] dyn_color = new int[4];
int[] dyn_attr = new int[4];
int slider;
int subgraph;
double scantime;
double fast_scantime;
double animation_scantime;
int java_width;
String background_image;
int background_tiled;
int double_buffered;
int cycle;
int mb3_action;
int translate_on;
int input_focus_mark;
int hot_indication;
Object userdata;
GlowArrayElem callback_object;
Vector<GlowArrayElem> a = new Vector<GlowArrayElem>();
Vector<GlowArrayElem> a_nc = new Vector<GlowArrayElem>();
Vector<GlowArrayElem> a_cc = new Vector<GlowArrayElem>();
public GrowCmn( GrowCtxIfc ctx, GrowApplIfc appl) {
this.ctx = ctx;
this.appl = appl;
this.debug = true;
this.antiAliasing = true;
}
public void setGdraw(GlowDrawIfc gdraw) {
this.gdraw = gdraw;
}
}
/*
* 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.
*/
package jpwr.jopg;
import java.io.*;
import java.util.*;
import jpwr.rt.*;
public class GrowCtx implements GrowCtxIfc {
GrowCmn cmn;
String name;
public GrowCtx(GrowApplIfc appl) {
cmn = new GrowCmn( this, appl);
}
public GrowCmn getCmn() {
return cmn;
}
public void open( BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
boolean zoom_y_found = false;
boolean grow_loaded = false;
try {
while( (line = reader.readLine()) != null) {
if ( line.length() > 2 && line.substring(0,2).equals("0!"))
continue;
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowCtx : " + line);
System.out.println("GrowCtx key: " + key);
switch ( key) {
case Glow.eSave_Ctx:
break;
case Glow.eSave_Ctx_zoom_factor_x:
cmn.mw.zoom_factor_x = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Ctx_zoom_factor_y:
cmn.mw.zoom_factor_y = new Double(token.nextToken()).doubleValue();
zoom_y_found = true;
break;
case Glow.eSave_Ctx_base_zoom_factor:
cmn.mw.base_zoom_factor = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Ctx_offset_x:
cmn.mw.offset_x = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Ctx_offset_y:
cmn.mw.offset_y = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Ctx_nav_zoom_factor_x:
case Glow.eSave_Ctx_nav_zoom_factor_y:
case Glow.eSave_Ctx_print_zoom_factor:
case Glow.eSave_Ctx_nav_offset_x:
case Glow.eSave_Ctx_nav_offset_y:
break;
case Glow.eSave_Ctx_x_right:
cmn.x_right = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Ctx_x_left:
cmn.x_left = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Ctx_y_high:
cmn.y_high = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Ctx_y_low:
cmn.y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Ctx_nav_rect_ll_x:
case Glow.eSave_Ctx_nav_rect_ll_y:
case Glow.eSave_Ctx_nav_rect_ur_x:
case Glow.eSave_Ctx_nav_rect_ur_y:
case Glow.eSave_Ctx_nav_rect_hot:
break;
case Glow.eSave_Ctx_name:
cmn.name = token.nextToken();
break;
case Glow.eSave_Ctx_user_highlight:
case Glow.eSave_Ctx_grid_size_x:
case Glow.eSave_Ctx_grid_size_y:
case Glow.eSave_Ctx_grid_on:
case Glow.eSave_Ctx_draw_delta:
case Glow.eSave_Ctx_refcon_width:
case Glow.eSave_Ctx_refcon_height:
case Glow.eSave_Ctx_refcon_textsize:
case Glow.eSave_Ctx_refcon_linewidth:
break;
case Glow.eSave_Ctx_version:
cmn.version = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Ctx_hot_indication:
cmn.hot_indication = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Ctx_tiptext_size:
break;
case Glow.eSave_Ctx_grow:
open_grow( reader);
grow_loaded = true;
break;
case Glow.eSave_Ctx_a_nc:
GlowVector.open( reader, cmn, cmn.a_nc);
break;
case Glow.eSave_Ctx_a_cc:
GlowVector.open( reader, cmn, cmn.a_cc);
break;
case Glow.eSave_Ctx_a:
GlowVector.open( reader, cmn, cmn.a);
break;
case Glow.eSave_Ctx_comment:
open_comment( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
case Glow.eSave_Comment:
break;
default:
System.out.println( "Syntax error in GlowCtx");
break;
}
if ( end_found)
break;
}
if ( !zoom_y_found)
cmn.mw.zoom_factor_y = cmn.mw.zoom_factor_x;
} catch ( Exception e) {
System.out.println( "IOException GlowCtx");
}
}
public void open_comment( BufferedReader reader) {
}
public void open_grow( BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowCtx : " + line);
switch ( key) {
case Glow.eSave_GrowCtx:
break;
case Glow.eSave_GrowCtx_conpoint_num_cnt:
case Glow.eSave_GrowCtx_objectname_cnt:
case Glow.eSave_GrowCtx_name:
cmn.name = token.nextToken();
break;
case Glow.eSave_GrowCtx_background_color:
cmn.background_color = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dynamicsize:
cmn.dynamicsize = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dynamic:
if ( cmn.dynamicsize > 0) {
for ( int j = 0; j < cmn.dynamicsize; j++)
line = reader.readLine();
}
break;
case Glow.eSave_GrowCtx_arg_cnt:
cmn.arg_cnt = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_argname:
for ( int i = 0; i < cmn.arg_cnt; i++)
cmn.argname[i] = reader.readLine();
break;
case Glow.eSave_GrowCtx_argtype:
for ( int i = 0; i < cmn.arg_cnt; i++)
cmn.argtype[i] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_x0:
cmn.x0 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowCtx_y0:
cmn.y0 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowCtx_x1:
cmn.x1 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowCtx_y1:
cmn.y1 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_End:
end_found = true;
break;
case Glow.eSave_GrowCtx_path_cnt:
cmn.path_cnt = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_path:
for ( int i = 0; i < cmn.path_cnt; i++)
cmn.path[i] = reader.readLine();
break;
case Glow.eSave_GrowCtx_dyn_type1:
cmn.dyn_type1 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_type2:
cmn.dyn_type2 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_action_type1:
cmn.dyn_action_type1 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_action_type2:
cmn.dyn_action_type2 = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_color1:
cmn.dyn_color[0] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_color2:
cmn.dyn_color[1] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_color3:
cmn.dyn_color[2] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_color4:
cmn.dyn_color[3] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_attr1:
cmn.dyn_attr[0] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_attr2:
cmn.dyn_attr[1] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_attr3:
cmn.dyn_attr[2] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_dyn_attr4:
cmn.dyn_attr[3] = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_no_con_obstacle:
break;
case Glow.eSave_GrowCtx_slider:
cmn.slider = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_subgraph:
cmn.subgraph = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_java_name:
case Glow.eSave_GrowCtx_is_javaapplet:
case Glow.eSave_GrowCtx_is_javaapplication:
case Glow.eSave_GrowCtx_next_subgraph:
case Glow.eSave_GrowCtx_animation_count:
break;
case Glow.eSave_GrowCtx_scantime:
cmn.scantime = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowCtx_fast_scantime:
cmn.fast_scantime = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowCtx_animation_scantime:
cmn.animation_scantime = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowCtx_java_width:
cmn.java_width = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_background_image:
if ( token.hasMoreTokens())
cmn.background_image = token.nextToken();
break;
case Glow.eSave_GrowCtx_background_tiled:
cmn.background_tiled = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_double_buffered:
cmn.double_buffered = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_cycle:
cmn.cycle = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_mb3_action:
cmn.mb3_action = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_translate_on:
cmn.translate_on = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_input_focus_mark:
cmn.input_focus_mark = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowCtx_userdata_cb:
if ( cmn.appl != null)
cmn.userdata = cmn.appl.growUserdataOpen(reader, cmn, Glow.eUserdataCbType_Ctx);
break;
case Glow.eSave_GrowCtx_bitmap_fonts:
break;
default:
System.out.println( "Syntax error in GrowCtx");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowCtx");
}
}
public void draw() {
for ( int i = 0; i < cmn.a.size(); i++) {
((GlowArrayElem)cmn.a.get(i)).draw();
}
}
public void draw( double ll_x, double ll_y, double ur_x, double ur_y) {
// TODO
for ( int i = 0; i < cmn.a.size(); i++) {
((GlowArrayElem)cmn.a.get(i)).draw();
}
}
public void register_callback_object(GlowArrayElem o) {
cmn.callback_object = o;
}
public void eventHandler(GlowEvent e) {
int sts = 0;
cmn.callback_object = null;
for ( int i = cmn.a.size() - 1; i >= 0; i--) {
sts = ((GlowArrayElem)cmn.a.get(i)).eventHandler(e, e.x, e.y);
if ( sts == 1) {
break;
}
}
if ( sts == 1 && cmn.appl != null) {
e.object = cmn.callback_object;
cmn.appl.eventHandler(e);
}
}
public void traceConnect() {
int sts;
for ( int i = 0; i < cmn.a.size(); i++) {
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowNode ||
cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
cmn.appl.traceConnect((GrowNode)cmn.a.get(i));
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) {
if ( ((GrowNode)cmn.a.get(i)).nc.a.get(j).type() == Glow.eObjectType_GrowNode ||
((GrowNode)cmn.a.get(i)).nc.a.get(j).type() == Glow.eObjectType_GrowGroup) {
cmn.appl.traceConnect((GrowNode)((GrowNode)cmn.a.get(i)).nc.a.get(j));
}
}
}
}
}
}
public void traceDisconnect() {
int sts;
for ( int i = 0; i < cmn.a.size(); i++) {
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowNode ||
cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
cmn.appl.traceDisconnect((GrowNode)cmn.a.get(i));
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) {
if ( ((GrowNode)cmn.a.get(i)).nc.a.get(j).type() == Glow.eObjectType_GrowNode ||
((GrowNode)cmn.a.get(i)).nc.a.get(j).type() == Glow.eObjectType_GrowGroup) {
cmn.appl.traceDisconnect((GrowNode)((GrowNode)cmn.a.get(i)).nc.a.get(j));
}
}
}
}
}
}
public void traceScan() {
int sts;
for ( int i = 0; i < cmn.a.size(); i++) {
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowNode ||
cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
cmn.appl.traceScan((GrowNode)cmn.a.get(i));
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) {
if ( ((GrowNode)cmn.a.get(i)).nc.a.get(j).type() == Glow.eObjectType_GrowNode ||
((GrowNode)cmn.a.get(i)).nc.a.get(j).type() == Glow.eObjectType_GrowGroup) {
cmn.appl.traceScan((GrowNode)((GrowNode)cmn.a.get(i)).nc.a.get(j));
}
}
}
}
}
}
public GlowArrayElem get_nodeclass_from_name(String name) {
for ( int i = 0; i < cmn.a_nc.size(); i++) {
if ( name.equals(((GlowNodeClass)cmn.a_nc.get(i)).nc_name))
return (GlowNodeClass)cmn.a_nc.get(i);
}
return null;
}
public GlowArrayElem get_object_group( GlowArrayElem object) {
int sts;
GlowArrayElem group;
for ( int i = 0; i < cmn.a.size(); i++) {
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
group = ((GrowGroup)cmn.a.get(i)).get_object_group( object);
if (group != null)
return group;
}
}
return null;
}
}
/*
* 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.
*/
package jpwr.jopg;
public interface GrowCtxIfc {
public GlowArrayElem get_nodeclass_from_name(String name);
public GlowArrayElem get_object_group( GlowArrayElem object);
public void draw();
public void draw( double ll_x, double ll_y, double ur_x, double ur_y);
public void register_callback_object(GlowArrayElem o);
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.jop.*;
import jpwr.rt.*;
import java.io.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.awt.font.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.net.*;
import java.applet.*;
public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
JScrollPane scrollPane;
JPanel contentPane;
LocalPanel localPanel = new LocalPanel();
BorderLayout borderLayout1 = new BorderLayout();
Dimension size;
Object root;
Graph graph;
Timer timer;
int scanTime = 1000;
int scanCount = 0;
JDialog confirmDia = null;
JLabel confirmLabel;
Object confirmDyn;
Object confirmObject;
public GrowFrame( String file) {
root = (Object) this;
init( file);
}
private void init( String file) {
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
contentPane.add(localPanel, BorderLayout.CENTER);
contentPane.setOpaque(true);
localPanel.setLayout(null);
localPanel.setOpaque(true);
localPanel.setBackground( Color.white);
this.setTitle("GrowFrame");
size = new Dimension( 1100, 900);
setSize( size);
String filename;
BufferedReader reader = null;
String fname = file;
if ( root != null && root instanceof JopApplet) {
try {
URL current = ((JApplet) root).getCodeBase();
String current_str = current.toString();
int idx1 = current_str.lastIndexOf('/');
int idx2 = current_str.lastIndexOf(':');
int idx = idx1;
if ( idx2 > idx)
idx = idx2;
String path = current_str.substring(0,idx + 1);
filename = path + fname;
System.out.println( "Opening file " + filename);
URL fileURL = new URL( filename);
InputStream in = fileURL.openStream();
// in = new BufferedInputStream(in);
InputStreamReader r2 = new InputStreamReader(in);
reader = new BufferedReader( r2);
}
catch ( Exception e) {
System.out.println( "Unable to open file");
}
}
else {
filename = "$pwrp_exe/" + fname;
filename = Gdh.translateFilename( filename);
System.out.println( "Fname: " + filename);
try {
reader = new BufferedReader(new FileReader(filename));
}
catch ( Exception e) {
System.out.println( "Unable to open file " + filename);
return;
}
}
Gdh gdh = new Gdh(this);
graph = new Graph(this, gdh);
graph.open(reader);
setSize();
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
setDefaultCloseOperation( DISPOSE_ON_CLOSE);
localPanel.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
System.out.println("MouseListener");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
event.type = Glow.eEvent_MB1Click;
graph.ctx.eventHandler( event);
}
public void mousePressed(MouseEvent e) {
System.out.println("MouseListener");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
event.type = Glow.eEvent_MB1Down;
graph.ctx.eventHandler( event);
}
public void mouseReleased(MouseEvent e) {
System.out.println("MouseListener");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
event.type = Glow.eEvent_MB1Up;
graph.ctx.eventHandler( event);
}
public void mouseMoved(MouseEvent e) {
System.out.println("MouseListener");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
event.type = Glow.eEvent_CursorMotion;
graph.ctx.eventHandler( event);
}
});
timer = new Timer( scanTime, this);
timer.start();
}
public void actionPerformed( ActionEvent e) {
scanCount++;
if ( scanCount == 1)
graph.gdh.getObjectRefInfoAll();
graph.ctx.traceScan();
localPanel.repaint();
}
void setSize() {
size = new Dimension( (int)((graph.ctx.cmn.x_right - graph.ctx.cmn.x_left) * graph.ctx.cmn.mw.zoom_factor_x) + Flow.DRAWOFFSET * 2,
(int)((graph.ctx.cmn.y_high - graph.ctx.cmn.y_low) * graph.ctx.cmn.mw.zoom_factor_y) + Flow.DRAWOFFSET * 2);
localPanel.setPreferredSize( size);
localPanel.revalidate();
}
class LocalPanel extends JPanel {
public LocalPanel() {}
public Dimension getPreferredSize() { return size;}
public Dimension getMinimumSize() { return size;}
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
g2.setPaint(graph.ctx.cmn.gdraw.getColor(graph.ctx.cmn.background_color));
g2.fill(new Rectangle2D.Double(0,0,getWidth(),getHeight()));
graph.gdraw.setGraphics(g2);
graph.ctx.draw();
}
}
public void closeGrow() {
}
// Exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
closeGrow();
}
}
public int command(String cmd) {
System.out.println("Ge command : " + cmd);
return 1;
}
public void confirmNo() {}
public void confirmYes() {
((Dyn)confirmDyn).confirmedAction( Glow.eEvent_MB1Click, confirmObject);
}
public void openConfirmDialog( Object dyn, String text, Object object) {
JLabel label = null;
confirmDyn = dyn;
confirmObject = object;
if ( confirmDia == null) {
confirmDia = new JDialog();
confirmDia.setTitle("Confirm");
confirmDia.setResizable(false);
confirmDia.setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE);
confirmDia.setSize( 400, 150);
confirmLabel = new JLabel( text, JLabel.CENTER);
confirmDia.getContentPane().setLayout( new BorderLayout());
confirmDia.getContentPane().add( confirmLabel, BorderLayout.CENTER);
JButton buttonYes = new JButton("Yes");
buttonYes.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ev) {
confirmYes();
confirmDia.dispose();
}
});
JButton buttonNo = new JButton("No");
buttonNo.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ev) {
confirmNo();
confirmDia.dispose();
}
});
JButton buttonCancel = new JButton("Cancel");
buttonCancel.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ev) {
confirmNo();
confirmDia.dispose();
}
});
JPanel panel = new JPanel();
panel.add( buttonYes);
panel.add( buttonNo);
panel.add( buttonCancel);
confirmDia.getContentPane().add( panel, BorderLayout.SOUTH);
// confirmDia.setLocationRelativeTo( par);
confirmDia.setVisible( true);
}
else {
// confirmDia.setLocationRelativeTo( par);
confirmLabel.setText( text);
confirmDia.setVisible( true);
}
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowGroup extends GrowNode {
public GrowGroup(GrowCmn cmn) {
super(cmn);
}
public int type() {
return Glow.eObjectType_GrowGroup;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowGroup : " + line);
switch ( key) {
case Glow.eSave_GrowGroup:
break;
case Glow.eSave_GrowGroup_grownode_part:
super.open(reader);
break;
case Glow.eSave_GrowGroup_nc:
nc = new GlowNodeGroup(cmn);
nc.open(reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowGroup");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowGroup");
}
}
public GlowArrayElem get_object_group( GlowArrayElem object) {
int sts;
GlowArrayElem group;
for ( int i = 0; i < nc.a.size(); i++) {
if ( nc.a.get(i).type() == Glow.eObjectType_GrowGroup) {
group = ((GrowGroup)nc.a.get(i)).get_object_group( object);
if ( group != null)
return group;
}
else if ( nc.a.get(i) == object) {
return this;
}
}
return null;
}
public Vector<GlowArrayElem> get_object_list() {
return nc.a;
}
public void draw() {
super.draw();
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowLine extends GlowArrayElem {
GrowCmn cmn;
String n_name;
double x_right;
double x_left;
double y_high;
double y_low;
int line_type;
int original_border_drawtype;
int dynamicsize;
GlowTransform trf;
GlowPoint p1;
GlowPoint p2;
int draw_type;
int line_width;
public GrowLine(GrowCmn cmn) {
this.cmn = cmn;
trf = new GlowTransform();
p1 = new GlowPoint(cmn);
p2 = new GlowPoint(cmn);
}
public int type() {
return Glow.eObjectType_GrowLine;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowLine : " + line);
switch ( key) {
case Glow.eSave_GrowLine:
break;
case Glow.eSave_GrowLine_n_name:
n_name = token.nextToken();
break;
case Glow.eSave_GrowLine_x_right:
x_right = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowLine_x_left:
x_left = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowLine_y_high:
y_high = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowLine_y_low:
y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowLine_line_type:
line_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowLine_original_border_drawtype:
original_border_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowLine_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowLine_dynamic:
if ( cmn.dynamicsize > 0) {
for ( int j = 0; j < cmn.dynamicsize; j++)
line = reader.readLine(); // TODO handle backslash and citationmarks
}
break;
case Glow.eSave_GrowLine_line_part:
glowline_open( reader);
break;
case Glow.eSave_GrowLine_trf:
trf.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowLine");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowLine");
}
}
public void glowline_open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowRect : " + line);
switch ( key) {
case Glow.eSave_Line:
break;
case Glow.eSave_Line_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Line_line_width:
line_width = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Line_p1:
p1.open( reader);
break;
case Glow.eSave_Line_p2:
p2.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowLine");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowLine");
}
}
public int eventHandler( GlowEvent event, double fx, double fy) {
/*
GlowPoint rp;
switch ( event.type) {
case Glow.eEvent_CursorMotion:
return 0;
default: ;
}
rp = trf.reverse( fx, fy);
System.out.println( "Event handler: " + fx + " " + fy + " reverse: " + rp.x + " " + rp.y);
System.out.println( " ll: " + ll.x + " " + ll.y + " ur: " + ur.x + " " + ur.y);
if ( ll.x <= rp.x && rp.x <= ur.x &&
ll.y <= rp.y && rp.y <= ur.y) {
System.out.println( "Event handler: Hit in rect");
return 1;
}
else
*/
return 0;
}
public void draw() {
draw( null, 0, 0, null, null);
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
if ( hot != 9 &&
cmn.hot_indication != Glow.eHotIndication_LineWidth)
hot = 0;
int drawtype;
int idx;
if ( node != null && ((GrowNode)node).line_width != 0)
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor *
((GrowNode)node).line_width - 1);
else
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * line_width - 1);
idx += hot;
idx = Math.max( 0, idx);
idx = Math.min( idx, Glow.DRAW_TYPE_SIZE-1);
int x1, y1, x2, y2;
if (t == null) {
x1 = (int)( trf.x( p1.x, p1.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y1 = (int)( trf.y( p1.x, p1.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
x2 = (int)( trf.x( p2.x, p2.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y2 = (int)( trf.y( p2.x, p2.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
}
else {
x1 = (int)( trf.x( t, p1.x, p1.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y1 = (int)( trf.y( t, p1.x, p1.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
x2 = (int)( trf.x( t, p2.x, p2.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y2 = (int)( trf.y( t, p2.x, p2.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
}
if ( x1 == x2 && y1 == y2)
return;
drawtype = GlowColor.get_drawtype( draw_type, Glow.eDrawType_LineHighlight,
highlight, colornode, 0, 0);
if ( line_type == Glow.eLineType_Solid)
cmn.gdraw.line( x1, y1, x2, y2, drawtype, idx, 0);
else
cmn.gdraw.line_dashed( x1, y1, x2, y2, drawtype, idx, 0, line_type);
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowNode extends GlowArrayElem {
public static final int MAX_CONPOINTS = 32;
public int original_border_drawtype;
public int border_drawtype;
public int original_fill_drawtype;
public int fill_drawtype;
public int text_drawtype;
public int original_text_drawtype;
public int draw_type;
public int original_color_tone;
public int color_tone;
public int original_color_lightness;
public int color_lightness;
public int original_color_intensity;
public int color_intensity;
public int original_color_shift;
public int color_shift;
public int invisible;
int flip_horizontal;
int flip_vertical;
int dynamicsize;
GlowTransform trf = new GlowTransform();
int arg_cnt;
public int line_width;
public int shadow;
public int gradient;
public int text_type;
public int text_font;
String nc_name;
GlowNodeClass nc;
GlowNodeClass nc_root;
String n_name;
double x_right;
double x_left;
double y_high;
double y_low;
int annotsize[] = new int[10];
public String annotv[] = new String[10];
GlowPoint pos;
public int access;
public int cycle;
String ref_object;
Object userdata;
public int dimmed;
public int visible;
public int highlight;
public int hot;
public int color_inverse;
public int input_selected;
public int annotv_inputmode[] = new int[10];
public double fill_level = 1;
GrowCmn cmn;
public GrowNode(GrowCmn cmn) {
this.cmn = cmn;
pos = new GlowPoint(cmn);
visible = 1;
}
public int type() {
return Glow.eObjectType_GrowNode;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowNode : " + line);
switch ( key) {
case Glow.eSave_GrowNode:
break;
case Glow.eSave_GrowNode_original_border_drawtype:
original_border_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_original_fill_drawtype:
original_fill_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_fill_drawtype:
fill_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_text_drawtype:
text_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_original_text_drawtype:
original_text_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_original_color_tone:
original_color_tone = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_color_tone:
color_tone = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_original_color_lightness:
original_color_lightness = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_color_lightness:
color_lightness = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_original_color_intensity:
original_color_intensity = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_color_intensity:
color_intensity = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_original_color_shift:
original_color_shift = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_color_shift:
color_shift = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_invisible:
invisible = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_flip_horizontal:
flip_horizontal = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_flip_vertical:
flip_vertical = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_dynamic:
if ( dynamicsize > 0) {
for ( int j = 0; j < cmn.dynamicsize; j++)
reader.readLine(); // TODO handle backslash and citationmarks
}
break;
case Glow.eSave_GrowNode_node_part:
glownode_open( reader);
break;
case Glow.eSave_GrowNode_trf:
trf.open( reader);
break;
case Glow.eSave_GrowNode_arg_cnt:
arg_cnt = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_argsize:
for ( int j = 0; j < arg_cnt; j++)
reader.readLine();
break;
case Glow.eSave_GrowNode_argv:
for ( int j = 0; j < arg_cnt; j++)
reader.readLine();
break;
case Glow.eSave_GrowNode_line_width:
line_width = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_shadow:
shadow = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_gradient:
gradient = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_text_type:
text_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_text_font:
text_font = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowNode_userdata_cb:
if ( cmn.appl != null)
userdata = cmn.appl.growUserdataOpen( reader, this, Glow.eUserdataCbType_Node);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowNode");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowNode");
}
}
public void glownode_open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowNode : " + line);
switch ( key) {
case Glow.eSave_Node:
break;
case Glow.eSave_Node_nc:
nc_name = token.nextToken();
nc = (GlowNodeClass)cmn.ctx.get_nodeclass_from_name( nc_name);
nc_root = nc;
break;
case Glow.eSave_Node_n_name:
n_name = token.nextToken();
break;
case Glow.eSave_Node_refcon_cnt:
for ( int i = 0; i < MAX_CONPOINTS; i++)
reader.readLine();
break;
case Glow.eSave_Node_x_right:
x_right = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Node_x_left:
x_left = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Node_y_high:
y_high = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Node_y_low:
y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Node_obst_x_right:
case Glow.eSave_Node_obst_x_left:
case Glow.eSave_Node_obst_y_high:
case Glow.eSave_Node_obst_y_low:
break;
case Glow.eSave_Node_annotsize:
for ( int i = 0; i < 10; i++) {
line = reader.readLine();
token = new StringTokenizer(line);
annotsize[i] = new Integer(token.nextToken()).intValue();
if (cmn.debug)
System.out.println("GlowNode annotsize: " + annotsize[i]);
}
break;
case Glow.eSave_Node_annotv:
for ( int i = 0; i < 10; i++) {
if ( annotsize[i] != 0) {
line = reader.readLine();
annotv[i] = line.substring(1, line.length()-1);
if ( cmn.debug)
System.out.println("GrowNode annotv: " + annotv[i]);
}
}
break;
case Glow.eSave_Node_pos:
pos.open( reader);
break;
case Glow.eSave_Node_trace_data1:
case Glow.eSave_Node_trace_data2:
case Glow.eSave_Node_trace_data3:
case Glow.eSave_Node_trace_data4:
case Glow.eSave_Node_trace_data5:
case Glow.eSave_Node_trace_data6:
case Glow.eSave_Node_trace_data7:
case Glow.eSave_Node_trace_data8:
case Glow.eSave_Node_trace_data9:
case Glow.eSave_Node_trace_data10:
case Glow.eSave_Node_trace_attr_type:
case Glow.eSave_Node_trace_color:
case Glow.eSave_Node_trace_color2:
break;
case Glow.eSave_Node_access:
access = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Node_cycle:
cycle = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Node_ref_object:
if ( token.hasMoreTokens())
ref_object = token.nextToken();
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowNode");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowNode");
}
}
public int eventHandler( GlowEvent event, double fx, double fy) {
GlowPoint rp;
int sts;
switch ( event.type) {
case Glow.eEvent_CursorMotion:
return 0;
default: ;
}
rp = trf.reverse( fx, fy);
sts = nc.eventHandler(event, rp.x, rp.y);
if ( sts != 0) {
System.out.println( "Hit in node " + sts);
if ( type() != Glow.eObjectType_GrowGroup)
cmn.ctx.register_callback_object(this);
return sts;
}
/*
System.out.println( "Event handler: " + fx + " " + fy + " reverse: " + rp.x + " " + rp.y);
System.out.println( " ll: " + ll.x + " " + ll.y + " ur: " + ur.x + " " + ur.y);
if ( ll.x <= rp.x && rp.x <= ur.x &&
ll.y <= rp.y && rp.y <= ur.y) {
System.out.println( "Event handler: Hit in rect");
return 1;
}
else
*/
return 0;
}
public void draw() {
if ( visible != 0)
nc.draw( trf, highlight, hot, this, this);
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
if ( node == null)
node = this;
if ( colornode == null)
colornode = this;
else if ( ((GrowNode)colornode).fill_drawtype == Glow.eDrawType_No &&
((GrowNode)colornode).color_tone == Glow.eDrawTone_No)
colornode = this;
if ( ((GrowNode)node).invisible != 0 || invisible != 0)
return;
if ( fill_level == 1) {
if ( t != null) {
GlowTransform trf_tot = t.multiply(trf);
nc.draw( trf_tot, highlight, hot, this, this);
}
else
nc.draw( trf, highlight, hot, node, node);
}
}
public int getClassTraceColor1() {
return nc.dyn_color[0];
}
public int getClassTraceColor2() {
return nc.dyn_color[1];
}
public int getClassDynType1() {
return nc.dyn_type1;
}
public int getClassDynType2() {
return nc.dyn_type2;
}
public int getClassActionType1() {
return nc.action_type1;
}
public int getClassActionType2() {
return nc.action_type2;
}
public int getClassCycle() {
return nc.cycle;
}
public Object getUserData() {
return userdata;
}
public void setColorTone(int color_tone) {
this.color_tone = color_tone;
}
public void resetColorTone() {
color_tone = original_color_tone;
}
public void setFillColor(int fill_drawtype) {
this.fill_drawtype = fill_drawtype;
}
public void resetFillColor() {
fill_drawtype = original_fill_drawtype;
}
public void setBorderColor(int draw_type) {
this.draw_type = draw_type;
}
public void resetBorderColor() {
draw_type = original_border_drawtype;
}
public void setColorInverse(int color_inverse) {
this.color_inverse = color_inverse;
}
public String getAnnotation(int number) {
return annotv[number];
}
public void setAnnotation(int number, String annot) {
annotv[number] = annot;
}
public void setVisibility( int visibility) {
switch ( visibility) {
case Glow.eVis_Visible:
visible = 1;
dimmed = 0;
break;
case Glow.eVis_Invisible:
visible = 0;
dimmed = 0;
draw();
break;
case Glow.eVis_Dimmed:
visible = 1;
dimmed = 1;
draw();
break;
}
}
void setRotation( double angel, double x0, double y0, int type) {
double old_x_left, old_x_right, old_y_low, old_y_high;
GlowTransform t = new GlowTransform();
if ( Math.abs( angel - trf.rotation + trf.s_rotation) < Float.MIN_VALUE)
return;
switch( type) {
case Glow.eRotationPoint_LowerLeft:
x0 = x_left;
y0 = y_low;
break;
case Glow.eRotationPoint_LowerRight:
x0 = x_right;
y0 = y_low;
break;
case Glow.eRotationPoint_UpperRight:
x0 = x_right;
y0 = y_high;
break;
case Glow.eRotationPoint_UpperLeft:
x0 = x_left;
y0 = y_high;
break;
case Glow.eRotationPoint_Center:
x0 = (x_left + x_right) / 2;
y0 = (y_high + y_low) / 2;
break;
case Glow.eRotationPoint_Zero:
x0 = trf.s_a13;
y0 = trf.s_a23;
break;
default:
;
}
old_x_left = x_left;
old_x_right = x_right;
old_y_low = y_low;
old_y_high = y_high;
System.out.println("Trf rotate " + angel + " x0 " + x0 + " y0 " + y0);
t.rotate( angel, x0, y0);
trf.set_from_stored( t);
get_node_borders();
}
void storeTransform() {
trf.store();
}
void get_node_borders() {
}
int set_next_nodeclass() {
if ( nc.next_nc != null) {
set_nodeclass( (GlowNodeClass)nc.next_nc);
return 1;
}
return 0;
}
void set_last_nodeclass() {
GlowArrayElem next;
for ( next = nc_root;
((GlowNodeClass)next).next_nc != null;
next = ((GlowNodeClass)next).next_nc)
;
if ( next != nc)
set_nodeclass( (GlowNodeClass)next);
}
int set_nodeclass_by_index( int idx) {
GlowArrayElem next;
int i;
next = nc_root;
for ( i = 0; i < idx; i++) {
if ( ((GlowNodeClass)next).next_nc == null)
return 0;
next = ((GlowNodeClass)next).next_nc;
}
if ( next != nc)
set_nodeclass( (GlowNodeClass)next);
return 1;
}
int set_previous_nodeclass() {
if ( nc.prev_nc != null) {
set_nodeclass( (GlowNodeClass)nc.prev_nc);
return 1;
}
return 0;
}
void set_root_nodeclass() {
if ( nc_root != nc)
set_nodeclass( nc_root);
}
void set_nodeclass( GlowNodeClass new_nc) {
double old_x_left, old_x_right, old_y_low, old_y_high;
old_x_left = x_left;
old_x_right = x_right;
old_y_low = y_low;
old_y_high = y_high;
nc = new_nc;
get_node_borders();
old_x_left = Math.min( old_x_left, x_left);
old_x_right = Math.max( old_x_right, x_right);
old_y_low = Math.min( old_y_low, y_low);
old_y_high = Math.max( old_y_high, y_high);
cmn.ctx.draw( old_x_left * cmn.mw.zoom_factor_x - cmn.mw.offset_x - Glow.DRAW_MP,
old_y_low * cmn.mw.zoom_factor_y - cmn.mw.offset_y - Glow.DRAW_MP,
old_x_right * cmn.mw.zoom_factor_x - cmn.mw.offset_x + Glow.DRAW_MP,
old_y_high * cmn.mw.zoom_factor_y - cmn.mw.offset_y + Glow.DRAW_MP);
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowPolyline extends GlowArrayElem {
GrowCmn cmn;
String n_name;
double x_right;
double x_left;
double y_high;
double y_low;
int original_border_drawtype;
int original_fill_drawtype;
int fill_drawtype;
int border;
int fill_eq_border;
double shadow_width;
int shadow_contrast;
int shadow;
int relief;
int disable_shadow;
int fixcolor;
int fixposition;
int gradient;
int gradient_contrast;
int disable_gradient;
int fill_eq_light;
int fill_eq_shadow;
int dynamicsize;
GlowTransform trf;
Vector<GlowPoint> a_points = new Vector<GlowPoint>();
GlowPointX[] points;
int draw_type;
int line_width;
int fill;
int closed_line;
public class GlowShadowInfo {
public int drawtype;
public int x;
public int y;
public GlowShadowInfo() {}
}
public GrowPolyline(GrowCmn cmn) {
this.cmn = cmn;
trf = new GlowTransform();
}
public int type() {
return Glow.eObjectType_GrowPolyLine;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowPolyline : " + line);
switch ( key) {
case Glow.eSave_GrowPolyLine:
break;
case Glow.eSave_GrowPolyLine_n_name:
n_name = token.nextToken();
break;
case Glow.eSave_GrowPolyLine_x_right:
x_right = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowPolyLine_x_left:
x_left = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowPolyLine_y_high:
y_high = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowPolyLine_y_low:
y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowPolyLine_original_border_drawtype:
original_border_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_original_fill_drawtype:
original_fill_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_fill_drawtype:
fill_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_border:
border = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_shadow_width:
shadow_width = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowPolyLine_shadow_contrast:
shadow_contrast = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_shadow:
shadow = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_relief:
relief = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_disable_shadow:
disable_shadow = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_fixcolor:
fixcolor = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_fixposition:
fixposition = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_gradient:
gradient = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_gradient_contrast:
gradient_contrast = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_disable_gradient:
disable_gradient = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_fill_eq_border:
fill_eq_border = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_fill_eq_light:
fill_eq_light = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_fill_eq_shadow:
fill_eq_shadow = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowPolyLine_dynamic:
if ( cmn.dynamicsize > 0) {
for ( int j = 0; j < cmn.dynamicsize; j++)
line = reader.readLine(); // TODO handle backslash and citationmarks
}
break;
case Glow.eSave_GrowPolyLine_polyline_part:
glowpolyline_open( reader);
break;
case Glow.eSave_GrowPolyLine_trf:
trf.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowPolyline");
break;
}
if ( end_found)
break;
}
points = new GlowPointX[a_points.size()];
for ( int i = 0; i < a_points.size(); i++)
points[i] = new GlowPointX();
} catch ( Exception e) {
System.out.println( "IOException GrowPolyline");
}
}
public void glowpolyline_open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowPolyline : " + line);
switch ( key) {
case Glow.eSave_PolyLine:
break;
case Glow.eSave_PolyLine_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_PolyLine_line_width:
line_width = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_PolyLine_fill:
fill = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_PolyLine_closed_line:
closed_line = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_PolyLine_a_points:
GlowVector.open( reader, cmn, a_points);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowPolyline");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowPolyline");
}
}
public int eventHandler( GlowEvent event, double fx, double fy) {
/*
GlowPoint rp;
switch ( event.type) {
case Glow.eEvent_CursorMotion:
return 0;
default: ;
}
rp = trf.reverse( fx, fy);
//rp = new GlowPoint(null);
//rp.x = fx;
//rp.y = fy;
System.out.println( "Event handler: " + fx + " " + fy + " reverse: " + rp.x + " " + rp.y);
System.out.println( " ll: " + ll.x + " " + ll.y + " ur: " + ur.x + " " + ur.y);
if ( ll.x <= rp.x && rp.x <= ur.x &&
ll.y <= rp.y && rp.y <= ur.y) {
System.out.println( "Event handler: Hit in polyline");
return 1;
}
else
*/
return 0;
}
public void draw() {
draw( null, 0, 0, null, null);
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
int chot = 0;
if ( hot != 0) {
if ( cmn.hot_indication == Glow.eHotIndication_No)
hot = 0;
else if ( cmn.hot_indication == Glow.eHotIndication_DarkColor) {
chot = hot;
hot = 0;
}
else if ( cmn.hot_indication == Glow.eHotIndication_LightColor) {
chot = -hot;
hot = 0;
}
}
int i;
int drawtype;
int idx;
if ( fixcolor != 0)
colornode = null;
if ( node != null && ((GrowNode)node).line_width != 0)
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor *
((GrowNode)node).line_width - 1);
else
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * line_width - 1);
idx += hot;
idx = Math.max( 0, idx);
idx = Math.min( idx, Glow.DRAW_TYPE_SIZE-1);
double x1, y1;
for ( i = 0; i < a_points.size(); i++) {
if (t == null) {
x1 = trf.x( a_points.get(i).x, a_points.get(i).y);
y1 = trf.y( a_points.get(i).x, a_points.get(i).y);
}
else {
x1 = trf.x( t, a_points.get(i).x, a_points.get(i).y);
y1 = trf.y( t, a_points.get(i).x, a_points.get(i).y);
}
points[i].x = (int)( x1 * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
points[i].y = (int)( y1 * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
}
if ( fill != 0) {
int grad = gradient;
if ( gradient == Glow.eGradient_No &&
(node != null && ((GrowNode)node).gradient != Glow.eGradient_No) && disable_gradient == 0)
grad = ((GrowNode)node).gradient;
if ( fill_eq_border != 0)
drawtype = GlowColor.get_drawtype( draw_type, Glow.eDrawType_LineHighlight,
highlight, colornode, 0, 0);
else
drawtype = GlowColor.get_drawtype( fill_drawtype, Glow.eDrawType_FillHighlight,
highlight, colornode, 1, 0);
if ( fill_eq_light != 0 && node != null && ((GrowNode)node).shadow != 0)
drawtype = GlowColor.shift_drawtype( drawtype, -shadow_contrast + chot,
colornode);
else if ( fill_eq_shadow != 0 && node != null && ((GrowNode)node).shadow != 0)
drawtype = GlowColor.shift_drawtype( drawtype, shadow_contrast + chot,
colornode);
else if ( chot != 0)
drawtype = GlowColor.shift_drawtype( drawtype, chot, null);
if ( grad == Glow.eGradient_No || drawtype == Glow.eDrawType_ColorRed)
cmn.gdraw.fill_polyline( points, a_points.size(), drawtype, 0);
else {
int f1, f2;
double rotation;
if ( t != null)
rotation = trf.rot( t);
else
rotation = trf.rot();
if ( gradient_contrast >= 0) {
f2 = GlowColor.shift_drawtype( drawtype, -gradient_contrast/2, null);
f1 = GlowColor.shift_drawtype( drawtype, (int)((float)(gradient_contrast)/2+0.6), null);
}
else {
f2 = GlowColor.shift_drawtype( drawtype, -(int)((float)(gradient_contrast)/2-0.6), null);
f1 = GlowColor.shift_drawtype( drawtype, gradient_contrast/2, null);
}
cmn.gdraw.gradient_fill_polyline( points, a_points.size(),
drawtype, f1, f2, cmn.gdraw.gradient_rotate( rotation, grad));
}
}
boolean display_shadow = ((node != null && ((GrowNode)node).shadow != 0) || shadow != 0) && disable_shadow == 0 &&
fill_eq_light == 0 && fill_eq_shadow == 0;
if ( display_shadow && shadow_width != 0) {
GlowShadowInfo[] sp;
int p_num;
double trf_scale = trf.vertical_scale( t);
int ish = (int)( shadow_width / 100 * trf_scale *
Math.min((x_right - x_left)*cmn.mw.zoom_factor_x, (y_high - y_low)*cmn.mw.zoom_factor_y) + 0.5);
if ( ish >= 1) {
sp = calculate_shadow( ish, highlight, colornode, 0, chot);
p_num = sp.length;
GlowPointX[] p = new GlowPointX[4];
p[0] = new GlowPointX();
p[1] = new GlowPointX();
p[2] = new GlowPointX();
p[3] = new GlowPointX();
for ( i = 0; i < p_num - 1; i++) {
p[0].x = points[i].x;
p[0].y = points[i].y;
p[1].x = sp[i].x;
p[1].y = sp[i].y;
p[3].x = points[i+1].x;
p[3].y = points[i+1].y;
p[2].x = sp[i+1].x;
p[2].y = sp[i+1].y;
cmn.gdraw.fill_polyline( p, 4, sp[i].drawtype, 0);
}
}
}
if ( border != 0 || !(fill != 0 || (display_shadow && shadow_width != 0))) {
drawtype = GlowColor.get_drawtype( draw_type, Glow.eDrawType_LineHighlight,
highlight, colornode, 0, 0);
cmn.gdraw.polyline( points, a_points.size(), drawtype, idx, 0);
}
}
GlowShadowInfo[] calculate_shadow( int ish, int highlight,
Object colornode, int javaexport, int chot) {
GlowShadowInfo sp[];
double x;
int pos01;
int pos12;
int i;
int light_drawtype;
int dark_drawtype;
int p_num = a_points.size();
if ( points[0].x == points[p_num-1].x && points[0].y == points[p_num-1].y)
p_num--;
if ( points[0].x == points[a_points.size()-1].x && points[0].y == points[a_points.size()-1].y)
sp = new GlowShadowInfo[p_num + 1];
else
sp = new GlowShadowInfo[p_num];
int fillcolor = GlowColor.get_drawtype( fill_drawtype, Glow.eDrawType_FillHighlight,
highlight, colornode, 1, 0);
int drawtype_incr = shadow_contrast;
if ( relief == Glow.eRelief_Down)
drawtype_incr = -shadow_contrast;
light_drawtype = GlowColor.shift_drawtype( fillcolor, -drawtype_incr + chot,
colornode);
dark_drawtype = GlowColor.shift_drawtype( fillcolor, drawtype_incr + chot,
colornode);
pos01 = shadow_direction();
for ( i = 0; i < p_num; i++) {
double sx0, sx1, sx2, sy0, sy1, sy2;
double k01, m01, k12, m12;
sp[i] = new GlowShadowInfo();
if ( i == 0) {
sx0 = points[p_num - 1].x;
sy0 = points[p_num - 1].y;
}
else {
sx0 = points[i-1].x;
sy0 = points[i-1].y;
}
sx1 = points[i].x;
sy1 = points[i].y;
if ( i == p_num - 1) {
sx2 = points[0].x;
sy2 = points[0].y;
}
else {
sx2 = points[i+1].x;
sy2 = points[i+1].y;
}
pos12 = pos01;
if ( i == -1) {
}
else {
if ( Math.abs( sx0 - sx1) < Double.MIN_VALUE) {
if (sx1 > sx2 && sy1 < sy0)
pos12 = - pos01;
else if ( sx1 < sx2 && sy1 > sy0)
pos12 = - pos01;
}
else if ( Math.abs( sx1 - sx2) < Double.MIN_VALUE) {
if ( sx0 < sx1 && sy2 > sy1)
pos12 = - pos01;
else if ( sx0 > sx1 && sy2 < sy1)
pos12 = - pos01;
}
else if ( sx1 > sx0 && sx2 < sx1)
pos12 = -pos01;
else if ( sx1 < sx0 && sx2 > sx1)
pos12 = -pos01;
}
if ( Math.abs( sx0 - sx1) < Double.MIN_VALUE) {
if ( Math.abs( sx1 - sx2) < Double.MIN_VALUE) {
x = sx1 + pos01 * ish;
sp[i].x = (int)( x + 0.5);
sp[i].y = (int)( sy1 + 0.5);
}
else {
k12 = (sy2 - sy1)/(sx2 - sx1);
m12 = sy1 - sx1 * k12 + pos12 * ish / Math.abs(Math.cos(Math.atan(k12)));
x = sx1 + pos01 * ish;
sp[i].x = (int)( x + 0.5);
sp[i].y = (int)( k12 * x + m12 + 0.5);
}
}
else if ( Math.abs( sx1 - sx2) < Double.MIN_VALUE) {
k01 = (sy1 - sy0)/(sx1 - sx0);
m01 = sy0 - sx0 * k01 + pos01 * ish / Math.abs(Math.cos(Math.atan(k01)));
x = sx1 + pos12 * ish;
sp[i].x = (int)( x + 0.5);
sp[i].y = (int)( k01 * x + m01 + 0.5);
}
else {
k01 = (sy1 - sy0)/(sx1 - sx0);
k12 = (sy2 - sy1)/(sx2 - sx1);
m01 = sy0 - sx0 * k01 + pos01 * ish / Math.abs(Math.cos(Math.atan(k01)));
m12 = sy1 - sx1 * k12 + pos12 * ish / Math.abs(Math.cos(Math.atan(k12)));
if ( Math.abs( k01 - k12) < Double.MIN_VALUE) {
// Identical lines
if ( Math.abs( k01) < Double.MIN_VALUE) {
sp[i].x = (int)( sx1 + 0.5);
sp[i].y = (int)( m01 + 0.5);
}
else {
k12 = -k12;
m12 = sy2 - k12 * sx2;
x = (m12 - m01)/(k01 - k12);
sp[i].x = (int)( x + 0.5);
sp[i].y = (int)( k12 * x + m12 + 0.5);
k12 = k01;
m12 = m01;
}
}
else {
x = (m12 - m01)/(k01 - k12);
sp[i].x = (int)( x + 0.5);
sp[i].y = (int)( k12 * x + m12 + 0.5);
}
}
if ( pos12 == 1)
sp[i].drawtype = light_drawtype;
else
sp[i].drawtype = dark_drawtype;
pos01 = pos12;
}
if ( points[0].x == points[a_points.size()-1].x && points[0].y == points[a_points.size()-1].y) {
sp[p_num] = new GlowShadowInfo();
sp[p_num].x = sp[0].x;
sp[p_num].y = sp[0].y;
}
return sp;
}
public int shadow_direction() {
double a1, a2, a1_old, a0_old;
double a_sum1 = 0;
double a_sum2 = 0;
int p_num = a_points.size();
a1_old = 0;
a0_old = 0;
if ( (points[p_num - 1].x == points[0].x && points[p_num - 1].y == points[0].y))
p_num--;
for ( int i = 0; i < p_num; i++) {
if ( i == p_num - 1) {
if ( points[0].x == points[i].x) {
a1 = 90;
if ( points[0].y < points[i].y)
a1 += 180;
}
else
a1 = Math.atan((double)(points[0].y - points[i].y)/(points[0].x - points[i].x)) * 180 / Math.PI;
if ( points[0].x < points[i].x)
a1 += 180;
}
else {
if ( points[i+1].x == points[i].x) {
a1 = 90;
if ( points[i+1].y < points[i].y)
a1 += 180;
}
else
a1 = Math.atan((double)(points[i+1].y - points[i].y)/(points[i+1].x - points[i].x)) * 180 / Math.PI;
if ( points[i+1].x < points[i].x)
a1 += 180;
}
if ( i == 0) {
a0_old = a1;
}
else if ( i > 0) {
a2 = a1 - (a1_old - 180);
if ( a2 < 0)
a2 += 360;
else if ( a2 >= 360)
a2 -= 360;
a_sum1 += a2;
a_sum2 += 360 - a2;
}
if ( i == p_num - 1) {
a2 = a0_old - (a1 - 180);
if ( a2 < 0)
a2 += 360;
else if ( a2 >= 360)
a2 -= 360;
a_sum1 += a2;
a_sum2 += 360 - a2;
}
a1_old = a1;
}
int dir;
GlowPointX last_point;
if ( points[0].x == points[a_points.size()-1].x && points[0].y == points[a_points.size()-1].y)
last_point = points[a_points.size()-2];
else
last_point = points[a_points.size()-1];
if ( a_sum2 - a_sum1 < 0) {
if ( points[0].x == last_point.x) {
if ( points[0].x < points[1].x)
dir = 1;
else
dir = -1;
}
else if ( points[0].x > last_point.x)
dir = 1;
else
dir = -1;
}
else {
if ( points[0].x == last_point.x) {
if ( points[0].x < points[1].x)
dir = 1;
else
dir = -1;
}
else if ( points[0].x < last_point.x)
dir = 1;
else
dir = -1;
}
return dir;
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowRect extends GlowArrayElem {
GrowCmn cmn;
String n_name;
double x_right;
double x_left;
double y_high;
double y_low;
int original_border_drawtype;
int original_fill_drawtype;
int fill_drawtype;
int border;
double shadow_width;
int shadow_contrast;
int shadow;
int relief;
int disable_shadow;
int invisible;
int fixcolor;
int fixposition;
int gradient;
int gradient_contrast;
int disable_gradient;
int dynamicsize;
GlowTransform trf;
GlowPoint ll;
GlowPoint ur;
int draw_type;
int line_width;
int display_level;
int fill;
public GrowRect(GrowCmn cmn) {
this.cmn = cmn;
trf = new GlowTransform();
ll = new GlowPoint(cmn);
ur = new GlowPoint(cmn);
}
public int type() {
return Glow.eObjectType_GrowRect;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowRect : " + line);
switch ( key) {
case Glow.eSave_GrowRect:
break;
case Glow.eSave_GrowRect_n_name:
n_name = token.nextToken();
break;
case Glow.eSave_GrowRect_x_right:
x_right = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowRect_x_left:
x_left = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowRect_y_high:
y_high = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowRect_y_low:
y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowRect_original_border_drawtype:
original_border_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_original_fill_drawtype:
original_fill_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_fill_drawtype:
fill_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_border:
border = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_shadow_width:
shadow_width = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowRect_shadow_contrast:
shadow_contrast = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_shadow:
shadow = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_relief:
relief = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_disable_shadow:
disable_shadow = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_invisible:
invisible = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_fixcolor:
fixcolor = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_fixposition:
fixposition = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_gradient:
gradient = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_gradient_contrast:
gradient_contrast = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_disable_gradient:
disable_gradient = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowRect_dynamic:
if ( cmn.dynamicsize > 0) {
for ( int j = 0; j < cmn.dynamicsize; j++)
line = reader.readLine(); // TODO handle backslash and citationmarks
}
break;
case Glow.eSave_GrowRect_rect_part:
glowrect_open( reader);
break;
case Glow.eSave_GrowRect_trf:
trf.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowRect");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowRect");
}
}
public void glowrect_open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowRect : " + line);
switch ( key) {
case Glow.eSave_Rect:
break;
case Glow.eSave_Rect_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Rect_line_width:
line_width = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Rect_display_level:
display_level = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Rect_fill:
fill = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Rect_ll:
ll.open( reader);
break;
case Glow.eSave_Rect_ur:
ur.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowRect");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowRect");
}
}
public int eventHandler( GlowEvent event, double fx, double fy) {
GlowPoint rp;
switch ( event.type) {
case Glow.eEvent_CursorMotion:
return 0;
default: ;
}
rp = trf.reverse( fx, fy);
//rp = new GlowPoint(null);
//rp.x = fx;
//rp.y = fy;
System.out.println( "Event handler: " + fx + " " + fy + " reverse: " + rp.x + " " + rp.y);
System.out.println( " ll: " + ll.x + " " + ll.y + " ur: " + ur.x + " " + ur.y);
if ( ll.x <= rp.x && rp.x <= ur.x &&
ll.y <= rp.y && rp.y <= ur.y) {
System.out.println( "Event handler: Hit in rect");
return 1;
}
else
return 0;
}
public void draw() {
draw( null, 0, 0, null, null);
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
if ( invisible != 0 && !(highlight != 0 && node == null))
return;
int chot = 0;
int idx;
int drawtype;
if ( fixcolor != 0)
colornode = null;
if ( node != null && ((GrowNode)node).line_width != 0)
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor *
((GrowNode)node).line_width - 1);
else
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * line_width - 1);
idx += hot;
idx = Math.max( 0, idx);
idx = Math.min( idx, Glow.DRAW_TYPE_SIZE-1);
int x1, y1, x2, y2, ll_x, ll_y, ur_x, ur_y;
if (t == null) {
x1 = (int)( trf.x( ll.x, ll.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y1 = (int)( trf.y( ll.x, ll.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
x2 = (int)( trf.x( ur.x, ur.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y2 = (int)( trf.y( ur.x, ur.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
}
else {
x1 = (int)( trf.x( t, ll.x, ll.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y1 = (int)( trf.y( t, ll.x, ll.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
x2 = (int)( trf.x( t, ur.x, ur.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y2 = (int)( trf.y( t, ur.x, ur.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
}
ll_x = Math.min( x1, x2);
ur_x = Math.max( x1, x2);
ll_y = Math.min( y1, y2);
ur_y = Math.max( y1, y2);
int ish = (int)( shadow_width / 100 * Math.min(ur_x - ll_x, ur_y - ll_y) + 0.5);
boolean display_shadow = ((node != null && ((GrowNode)node).shadow != 0) || shadow != 0) && disable_shadow == 0;
int fillcolor = GlowColor.get_drawtype( fill_drawtype, Glow.eDrawType_FillHighlight,
highlight, colornode, 1, 0);
int grad = gradient;
if ( gradient == Glow.eGradient_No &&
(node != null && ((GrowNode)node).gradient != Glow.eGradient_No) && disable_gradient == 0)
grad = ((GrowNode)node).gradient;
if ( display_shadow && ish != 0) {
GlowPointX[] points = new GlowPointX[7];
for ( int i = 0; i < 7; i++)
points[i] = new GlowPointX();
// Draw light shadow
int drawtype_incr = shadow_contrast;
if ( relief == Glow.eRelief_Down)
drawtype_incr = -shadow_contrast;
drawtype = GlowColor.shift_drawtype( fillcolor, -drawtype_incr + chot, colornode);
points[0].x = ll_x;
points[0].y = ll_y;
points[1].x = ur_x;
points[1].y = ll_y;
points[2].x = ur_x - ish;
points[2].y = ll_y + ish;
points[3].x = ll_x + ish;
points[3].y = ll_y + ish;
points[4].x = ll_x + ish;
points[4].y = ur_y - ish;
points[5].x = ll_x;
points[5].y = ur_y;
points[6].x = ll_x;
points[6].y = ll_y;
cmn.gdraw.fill_polyline(points, 7, drawtype, 0);
// Draw dark shadow
drawtype = GlowColor.shift_drawtype( fillcolor, drawtype_incr + chot, colornode);
points[0].x = ur_x;
points[0].y = ur_y;
points[1].x = ll_x;
points[1].y = ur_y;
points[2].x = ll_x + ish;
points[2].y = ur_y - ish;
points[3].x = ur_x - ish;
points[3].y = ur_y - ish;
points[4].x = ur_x - ish;
points[4].y = ll_y + ish;
points[5].x = ur_x;
points[5].y = ll_y;
points[6].x = ur_x;
points[6].y = ur_y;
cmn.gdraw.fill_polyline(points, 7, drawtype, 0);
}
if ( fill != 0) {
if ( display_shadow && ish != 0) {
if ( grad == Glow.eGradient_No || fillcolor == Glow.eDrawType_ColorRed) {
if ( chot != 0)
drawtype = GlowColor.shift_drawtype( fillcolor, chot, null);
else
drawtype = fillcolor;
cmn.gdraw.fill_rect( ll_x + ish, ll_y + ish, ur_x - ll_x - 2 * ish, ur_y - ll_y - 2 * ish,
drawtype);
}
else {
int f1, f2;
double rotation;
if ( t != null)
rotation = trf.rot( t);
else
rotation = trf.rot();
if ( gradient_contrast >= 0) {
f2 = GlowColor.shift_drawtype( fillcolor, -gradient_contrast/2 + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, (int)((float)(gradient_contrast)/2+0.6) + chot, null);
}
else {
f2 = GlowColor.shift_drawtype( fillcolor, -(int)((float)(gradient_contrast)/2-0.6) + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, gradient_contrast/2 + chot, null);
}
cmn.gdraw.gradient_fill_rect( ll_x + ish, ll_y + ish, ur_x - ll_x - 2 * ish, ur_y - ll_y - 2 * ish,
fillcolor, f1, f2, cmn.gdraw.gradient_rotate( rotation, grad));
}
}
else {
if ( grad == Glow.eGradient_No || fillcolor == Glow.eDrawType_ColorRed) {
if ( chot!= 0)
drawtype = GlowColor.shift_drawtype( fillcolor, chot, null);
else
drawtype = fillcolor;
cmn.gdraw.fill_rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype);
}
else {
int f1, f2;
double rotation;
if ( t!= null)
rotation = trf.rot( t);
else
rotation = trf.rot();
if ( gradient_contrast >= 0) {
f2 = GlowColor.shift_drawtype( fillcolor, -gradient_contrast/2 + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, (int)((float)(gradient_contrast)/2+0.6) + chot, null);
}
else {
f2 = GlowColor.shift_drawtype( fillcolor, -(int)((float)(gradient_contrast)/2-0.6) + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, gradient_contrast/2, null);
}
cmn.gdraw.gradient_fill_rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fillcolor, f1, f2, cmn.gdraw.gradient_rotate( rotation, grad));
}
}
}
if ( border != 0|| !(fill != 0 || (display_shadow && shadow_width != 0))) {
drawtype = GlowColor.get_drawtype( draw_type, Glow.eDrawType_LineHighlight,
highlight, colornode, 0, 0);
cmn.gdraw.rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx, 0);
}
}
}
/*
* 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.
*/
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowText extends GlowArrayElem {
GrowCmn cmn;
String n_name;
double x_right;
double x_left;
double y_high;
double y_low;
int original_color_drawtype;
int font;
int adjustment;
int dynamicsize;
GlowTransform trf;
GlowPoint p;
String text;
int draw_type;
int text_size;
int display_level;
int color_drawtype;
public GrowText(GrowCmn cmn) {
this.cmn = cmn;
trf = new GlowTransform();
p = new GlowPoint(cmn);
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GrowText : " + line);
switch ( key) {
case Glow.eSave_GrowText:
break;
case Glow.eSave_GrowText_n_name:
n_name = token.nextToken();
break;
case Glow.eSave_GrowText_x_right:
x_right = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowText_x_left:
x_left = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowText_y_high:
y_high = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowText_y_low:
y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowText_original_color_drawtype:
original_color_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowText_font:
font = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowText_adjustment:
adjustment = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowText_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowText_dynamic:
if ( cmn.dynamicsize > 0) {
for ( int j = 0; j < cmn.dynamicsize; j++)
line = reader.readLine(); // TODO handle backslash and citationmarks
}
break;
case Glow.eSave_GrowText_text_part:
glowtext_open( reader);
break;
case Glow.eSave_GrowText_trf:
trf.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowText");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowText");
}
}
public void glowtext_open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( cmn.debug) System.out.println( "GlowText : " + line);
switch ( key) {
case Glow.eSave_Text:
break;
case Glow.eSave_Text_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Text_text_size:
text_size = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Text_color_drawtype:
color_drawtype = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_Text_text:
text = token.nextToken();
break;
case Glow.eSave_Text_p:
p.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowText");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowText");
}
}
public int eventHandler( GlowEvent event, double fx, double fy) {
/*
GlowPoint rp;
switch ( event.type) {
case Glow.eEvent_CursorMotion:
return 0;
default: ;
}
rp = trf.reverse( fx, fy);
System.out.println( "Event handler: " + fx + " " + fy + " reverse: " + rp.x + " " + rp.y);
System.out.println( " p: " + p.x + " " + p.y);
if ( ll.x <= rp.x && rp.x <= ur.x &&
ll.y <= rp.y && rp.y <= ur.y) {
System.out.println( "Event handler: Hit in text");
return 1;
}
else
*/
return 0;
}
public void draw() {
draw( null, 0, 0, null, null);
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
int x1, y1, rx1, ry1;
int z_width, z_height, z_descent;
int rot;
double trf_scale = trf.vertical_scale( t);
int idx = (int)( trf_scale * cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (text_size +4) - 4);
double tsize = trf_scale * cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (8+2*text_size);
idx = Math.min( idx, Glow.DRAW_TYPE_SIZE-1);
int highl = highlight;
if ( node != null)
highl = ((GrowNode)node).highlight;
int lfont;
int ldraw_type;
if ( node != null && ((GrowNode)node).text_font != Glow.eFont_No) {
lfont = ((GrowNode)node).text_font;
ldraw_type = ((GrowNode)node).text_type;
}
else {
lfont = font;
ldraw_type = draw_type;
}
rx1 = ry1 = z_width = z_height = 0;
if ( t == null) {
x1 = (int)( trf.x( p.x, p.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y1 = (int)( trf.y( p.x, p.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
rot = (int) trf.rot();
}
else {
x1 = (int)( trf.x( t, p.x, p.y) * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
y1 = (int)( trf.y( t, p.x, p.y) * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
rot = (int) trf.rot( t);
}
if ( adjustment == Glow.eAdjustment_Center)
rot = rot < 0 ? rot % 360 + 360 : rot % 360;
else
rot = 0;
if ( !text.equals("")) {
if ( highl != 0 || (hot != 0 && node == null) || adjustment != Glow.eAdjustment_Left) {
GlowDimension dim = cmn.gdraw.getTextExtent( text, Math.max( 0, idx), lfont);
z_width = dim.width;
z_height = dim.height;
z_descent = z_height/4;
switch ( adjustment) {
case Glow.eAdjustment_Left:
rx1 = x1;
ry1 = y1 - (z_height-z_descent);
break;
case Glow.eAdjustment_Right:
x1 -= z_width;
rx1 = x1;
ry1 = y1 - (z_height-z_descent);
break;
case Glow.eAdjustment_Center:
switch ( rot) {
case 90:
rx1 = x1 - z_width / 2;
ry1 = y1 - z_height / 2;
x1 -= z_width / 2;
y1 += z_height / 2;
break;
case 270:
rx1 = x1 - z_width / 2;
ry1 = y1 - z_height / 2;
x1 -= z_width / 2;
y1 -= z_height / 2 - z_width /2 ;
break;
default:
rx1 = x1 - z_width / 2;
ry1 = y1 - z_height / 2;
x1 -= z_width / 2;
y1 += z_height / 2 - z_descent;
}
break;
}
}
if ( highl != 0) {
cmn.gdraw.rect( rx1, ry1, z_width, z_height,
Glow.eDrawType_FillHighlight, Math.max( 1, Math.min( idx + hot, 2)), 0);
}
else if ( hot != 0 && node == null) {
cmn.gdraw.rect( rx1, ry1, z_width, z_height,
Glow.eDrawType_LineGray, Math.max( Math.min(idx,2), 1), 0);
}
if ( idx >= 0) {
int color = GlowColor.get_drawtype( color_drawtype, Glow.eDrawType_LineHighlight,
highlight, colornode, 2, 0);
cmn.gdraw.text( x1, y1, text, ldraw_type, color, idx, highlight,
0, lfont, tsize, rot);
}
}
else if ( idx >= 0) {
GlowDimension dim = cmn.gdraw.getTextExtent( "A", Math.max( 0, idx), font);
z_width = dim.width;
z_height = dim.height;
z_descent = z_height/4;
cmn.gdraw.rect( x1, y1 - (z_height-z_descent), z_width, z_height,
Glow.eDrawType_LineGray, idx, 0);
}
}
}
//
// (c) 2000 Sun Microsystems, Inc.
// ALL RIGHTS RESERVED
//
// License Grant-
//
//
// Permission to use, copy, modify, and distribute this Software and its
// documentation for NON-COMMERCIAL or COMMERCIAL purposes and without fee is
// hereby granted.
//
// This Software is provided "AS IS". All express warranties, including any
// implied warranty of merchantability, satisfactory quality, fitness for a
// particular purpose, or non-infringement, are disclaimed, except to the extent
// that such disclaimers are held to be legally invalid.
//
// You acknowledge that Software is not designed, licensed or intended for use in
// the design, construction, operation or maintenance of any nuclear facility
// ("High Risk Activities"). Sun disclaims any express or implied warranty of
// fitness for such uses.
//
// Please refer to the file http://www.sun.com/policies/trademarks/ for further
// important trademark information and to
// http://java.sun.com/nav/business/index.html for further important licensing
// information for the Java Technology.
//
package jpwr.jopg;
import java.util.Enumeration;
import java.util.Vector;
import java.util.Locale;
import java.text.DecimalFormatSymbols;
/**
* PrintfFormat allows the formatting of an array of
* objects embedded within a string. Primitive types
* must be passed using wrapper types. The formatting
* is controlled by a control string.
*<p>
* A control string is a Java string that contains a
* control specification. The control specification
* starts at the first percent sign (%) in the string,
* provided that this percent sign
*<ol>
*<li>is not escaped protected by a matching % or is
* not an escape % character,
*<li>is not at the end of the format string, and
*<li>precedes a sequence of characters that parses as
* a valid control specification.
*</ol>
*</p><p>
* A control specification usually takes the form:
*<pre> % ['-+ #0]* [0..9]* { . [0..9]* }+
* { [hlL] }+ [idfgGoxXeEcs]
*</pre>
* There are variants of this basic form that are
* discussed below.</p>
*<p>
* The format is composed of zero or more directives
* defined as follows:
*<ul>
*<li>ordinary characters, which are simply copied to
* the output stream;
*<li>escape sequences, which represent non-graphic
* characters; and
*<li>conversion specifications, each of which
* results in the fetching of zero or more arguments.
*</ul></p>
*<p>
* The results are undefined if there are insufficient
* arguments for the format. Usually an unchecked
* exception will be thrown. If the format is
* exhausted while arguments remain, the excess
* arguments are evaluated but are otherwise ignored.
* In format strings containing the % form of
* conversion specifications, each argument in the
* argument list is used exactly once.</p>
* <p>
* Conversions can be applied to the <code>n</code>th
* argument after the format in the argument list,
* rather than to the next unused argument. In this
* case, the conversion characer % is replaced by the
* sequence %<code>n</code>$, where <code>n</code> is
* a decimal integer giving the position of the
* argument in the argument list.</p>
* <p>
* In format strings containing the %<code>n</code>$
* form of conversion specifications, each argument
* in the argument list is used exactly once.</p>
*
*<h4>Escape Sequences</h4>
*<p>
* The following table lists escape sequences and
* associated actions on display devices capable of
* the action.
*<table>
*<tr><th align=left>Sequence</th>
* <th align=left>Name</th>
* <th align=left>Description</th></tr>
*<tr><td>\\</td><td>backlash</td><td>None.
*</td></tr>
*<tr><td>\a</td><td>alert</td><td>Attempts to alert
* the user through audible or visible
* notification.
*</td></tr>
*<tr><td>\b</td><td>backspace</td><td>Moves the
* printing position to one column before
* the current position, unless the
* current position is the start of a line.
*</td></tr>
*<tr><td>\f</td><td>form-feed</td><td>Moves the
* printing position to the initial
* printing position of the next logical
* page.
*</td></tr>
*<tr><td>\n</td><td>newline</td><td>Moves the
* printing position to the start of the
* next line.
*</td></tr>
*<tr><td>\r</td><td>carriage-return</td><td>Moves
* the printing position to the start of
* the current line.
*</td></tr>
*<tr><td>\t</td><td>tab</td><td>Moves the printing
* position to the next implementation-
* defined horizontal tab position.
*</td></tr>
*<tr><td>\v</td><td>vertical-tab</td><td>Moves the
* printing position to the start of the
* next implementation-defined vertical
* tab position.
*</td></tr>
*</table></p>
*<h4>Conversion Specifications</h4>
*<p>
* Each conversion specification is introduced by
* the percent sign character (%). After the character
* %, the following appear in sequence:</p>
*<p>
* Zero or more flags (in any order), which modify the
* meaning of the conversion specification.</p>
*<p>
* An optional minimum field width. If the converted
* value has fewer characters than the field width, it
* will be padded with spaces by default on the left;
* t will be padded on the right, if the left-
* adjustment flag (-), described below, is given to
* the field width. The field width takes the form
* of a decimal integer. If the conversion character
* is s, the field width is the the minimum number of
* characters to be printed.</p>
*<p>
* An optional precision that gives the minumum number
* of digits to appear for the d, i, o, x or X
* conversions (the field is padded with leading
* zeros); the number of digits to appear after the
* radix character for the e, E, and f conversions,
* the maximum number of significant digits for the g
* and G conversions; or the maximum number of
* characters to be written from a string is s and S
* conversions. The precision takes the form of an
* optional decimal digit string, where a null digit
* string is treated as 0. If a precision appears
* with a c conversion character the precision is
* ignored.
* </p>
*<p>
* An optional h specifies that a following d, i, o,
* x, or X conversion character applies to a type
* short argument (the argument will be promoted
* according to the integral promotions and its value
* converted to type short before printing).</p>
*<p>
* An optional l (ell) specifies that a following
* d, i, o, x, or X conversion character applies to a
* type long argument.</p>
*<p>
* A field width or precision may be indicated by an
* asterisk (*) instead of a digit string. In this
* case, an integer argument supplised the field width
* precision. The argument that is actually converted
* is not fetched until the conversion letter is seen,
* so the the arguments specifying field width or
* precision must appear before the argument (if any)
* to be converted. If the precision argument is
* negative, it will be changed to zero. A negative
* field width argument is taken as a - flag, followed
* by a positive field width.</p>
* <p>
* In format strings containing the %<code>n</code>$
* form of a conversion specification, a field width
* or precision may be indicated by the sequence
* *<code>m</code>$, where m is a decimal integer
* giving the position in the argument list (after the
* format argument) of an integer argument containing
* the field width or precision.</p>
* <p>
* The format can contain either numbered argument
* specifications (that is, %<code>n</code>$ and
* *<code>m</code>$), or unnumbered argument
* specifications (that is % and *), but normally not
* both. The only exception to this is that %% can
* be mixed with the %<code>n</code>$ form. The
* results of mixing numbered and unnumbered argument
* specifications in a format string are undefined.</p>
*
*<h4>Flag Characters</h4>
*<p>
* The flags and their meanings are:</p>
*<dl>
* <dt>'<dd> integer portion of the result of a
* decimal conversion (%i, %d, %f, %g, or %G) will
* be formatted with thousands' grouping
* characters. For other conversions the flag
* is ignored. The non-monetary grouping
* character is used.
* <dt>-<dd> result of the conversion is left-justified
* within the field. (It will be right-justified
* if this flag is not specified).</td></tr>
* <dt>+<dd> result of a signed conversion always
* begins with a sign (+ or -). (It will begin
* with a sign only when a negative value is
* converted if this flag is not specified.)
* <dt>&lt;space&gt;<dd> If the first character of a
* signed conversion is not a sign, a space
* character will be placed before the result.
* This means that if the space character and +
* flags both appear, the space flag will be
* ignored.
* <dt>#<dd> value is to be converted to an alternative
* form. For c, d, i, and s conversions, the flag
* has no effect. For o conversion, it increases
* the precision to force the first digit of the
* result to be a zero. For x or X conversion, a
* non-zero result has 0x or 0X prefixed to it,
* respectively. For e, E, f, g, and G
* conversions, the result always contains a radix
* character, even if no digits follow the radix
* character (normally, a decimal point appears in
* the result of these conversions only if a digit
* follows it). For g and G conversions, trailing
* zeros will not be removed from the result as
* they normally are.
* <dt>0<dd> d, i, o, x, X, e, E, f, g, and G
* conversions, leading zeros (following any
* indication of sign or base) are used to pad to
* the field width; no space padding is
* performed. If the 0 and - flags both appear,
* the 0 flag is ignored. For d, i, o, x, and X
* conversions, if a precision is specified, the
* 0 flag will be ignored. For c conversions,
* the flag is ignored.
*</dl>
*
*<h4>Conversion Characters</h4>
*<p>
* Each conversion character results in fetching zero
* or more arguments. The results are undefined if
* there are insufficient arguments for the format.
* Usually, an unchecked exception will be thrown.
* If the format is exhausted while arguments remain,
* the excess arguments are ignored.</p>
*
*<p>
* The conversion characters and their meanings are:
*</p>
*<dl>
* <dt>d,i<dd>The int argument is converted to a
* signed decimal in the style [-]dddd. The
* precision specifies the minimum number of
* digits to appear; if the value being
* converted can be represented in fewer
* digits, it will be expanded with leading
* zeros. The default precision is 1. The
* result of converting 0 with an explicit
* precision of 0 is no characters.
* <dt>o<dd> The int argument is converted to unsigned
* octal format in the style ddddd. The
* precision specifies the minimum number of
* digits to appear; if the value being
* converted can be represented in fewer
* digits, it will be expanded with leading
* zeros. The default precision is 1. The
* result of converting 0 with an explicit
* precision of 0 is no characters.
* <dt>x<dd> The int argument is converted to unsigned
* hexadecimal format in the style dddd; the
* letters abcdef are used. The precision
* specifies the minimum numberof digits to
* appear; if the value being converted can be
* represented in fewer digits, it will be
* expanded with leading zeros. The default
* precision is 1. The result of converting 0
* with an explicit precision of 0 is no
* characters.
* <dt>X<dd> Behaves the same as the x conversion
* character except that letters ABCDEF are
* used instead of abcdef.
* <dt>f<dd> The floating point number argument is
* written in decimal notation in the style
* [-]ddd.ddd, where the number of digits after
* the radix character (shown here as a decimal
* point) is equal to the precision
* specification. A Locale is used to determine
* the radix character to use in this format.
* If the precision is omitted from the
* argument, six digits are written after the
* radix character; if the precision is
* explicitly 0 and the # flag is not specified,
* no radix character appears. If a radix
* character appears, at least 1 digit appears
* before it. The value is rounded to the
* appropriate number of digits.
* <dt>e,E<dd>The floating point number argument is
* written in the style [-]d.ddde{+-}dd
* (the symbols {+-} indicate either a plus or
* minus sign), where there is one digit before
* the radix character (shown here as a decimal
* point) and the number of digits after it is
* equal to the precision. A Locale is used to
* determine the radix character to use in this
* format. When the precision is missing, six
* digits are written after the radix character;
* if the precision is 0 and the # flag is not
* specified, no radix character appears. The
* E conversion will produce a number with E
* instead of e introducing the exponent. The
* exponent always contains at least two digits.
* However, if the value to be written requires
* an exponent greater than two digits,
* additional exponent digits are written as
* necessary. The value is rounded to the
* appropriate number of digits.
* <dt>g,G<dd>The floating point number argument is
* written in style f or e (or in sytle E in the
* case of a G conversion character), with the
* precision specifying the number of
* significant digits. If the precision is
* zero, it is taken as one. The style used
* depends on the value converted: style e
* (or E) will be used only if the exponent
* resulting from the conversion is less than
* -4 or greater than or equal to the precision.
* Trailing zeros are removed from the result.
* A radix character appears only if it is
* followed by a digit.
* <dt>c,C<dd>The integer argument is converted to a
* char and the result is written.
*
* <dt>s,S<dd>The argument is taken to be a string and
* bytes from the string are written until the
* end of the string or the number of bytes
* indicated by the precision specification of
* the argument is reached. If the precision
* is omitted from the argument, it is taken to
* be infinite, so all characters up to the end
* of the string are written.
* <dt>%<dd>Write a % character; no argument is
* converted.
*</dl>
*<p>
* If a conversion specification does not match one of
* the above forms, an IllegalArgumentException is
* thrown and the instance of PrintfFormat is not
* created.</p>
*<p>
* If a floating point value is the internal
* representation for infinity, the output is
* [+]Infinity, where Infinity is either Infinity or
* Inf, depending on the desired output string length.
* Printing of the sign follows the rules described
* above.</p>
*<p>
* If a floating point value is the internal
* representation for "not-a-number," the output is
* [+]NaN. Printing of the sign follows the rules
* described above.</p>
*<p>
* In no case does a non-existent or small field width
* cause truncation of a field; if the result of a
* conversion is wider than the field width, the field
* is simply expanded to contain the conversion result.
*</p>
*<p>
* The behavior is like printf. One exception is that
* the minimum number of exponent digits is 3 instead
* of 2 for e and E formats when the optional L is used
* before the e, E, g, or G conversion character. The
* optional L does not imply conversion to a long long
* double. </p>
* <p>
* The biggest divergence from the C printf
* specification is in the use of 16 bit characters.
* This allows the handling of characters beyond the
* small ASCII character set and allows the utility to
* interoperate correctly with the rest of the Java
* runtime environment.</p>
*<p>
* Omissions from the C printf specification are
* numerous. All the known omissions are present
* because Java never uses bytes to represent
* characters and does not have pointers:</p>
*<ul>
* <li>%c is the same as %C.
* <li>%s is the same as %S.
* <li>u, p, and n conversion characters.
* <li>%ws format.
* <li>h modifier applied to an n conversion character.
* <li>l (ell) modifier applied to the c, n, or s
* conversion characters.
* <li>ll (ell ell) modifier to d, i, o, u, x, or X
* conversion characters.
* <li>ll (ell ell) modifier to an n conversion
* character.
* <li>c, C, d,i,o,u,x, and X conversion characters
* apply to Byte, Character, Short, Integer, Long
* types.
* <li>f, e, E, g, and G conversion characters apply
* to Float and Double types.
* <li>s and S conversion characters apply to String
* types.
* <li>All other reference types can be formatted
* using the s or S conversion characters only.
*</ul>
* <p>
* Most of this specification is quoted from the Unix
* man page for the sprintf utility.</p>
*
* @author Allan Jacobs
* @version 1
* Release 1: Initial release.
* Release 2: Asterisk field widths and precisions
* %n$ and *m$
* Bug fixes
* g format fix (2 digits in e form corrupt)
* rounding in f format implemented
* round up when digit not printed is 5
* formatting of -0.0f
* round up/down when last digits are 50000...
*/
public class PrintfFormat {
/**
* Constructs an array of control specifications
* possibly preceded, separated, or followed by
* ordinary strings. Control strings begin with
* unpaired percent signs. A pair of successive
* percent signs designates a single percent sign in
* the format.
* @param fmtArg Control string.
* @exception IllegalArgumentException if the control
* string is null, zero length, or otherwise
* malformed.
*/
public PrintfFormat(String fmtArg)
throws IllegalArgumentException {
this(Locale.getDefault(),fmtArg);
}
/**
* Constructs an array of control specifications
* possibly preceded, separated, or followed by
* ordinary strings. Control strings begin with
* unpaired percent signs. A pair of successive
* percent signs designates a single percent sign in
* the format.
* @param fmtArg Control string.
* @exception IllegalArgumentException if the control
* string is null, zero length, or otherwise
* malformed.
*/
public PrintfFormat(Locale locale,String fmtArg)
throws IllegalArgumentException {
dfs = new DecimalFormatSymbols(locale);
int ePos=0;
ConversionSpecification sFmt=null;
String unCS = this.nonControl(fmtArg,0);
if (unCS!=null) {
sFmt = new ConversionSpecification();
sFmt.setLiteral(unCS);
vFmt.addElement(sFmt);
}
while(cPos!=-1 && cPos<fmtArg.length()) {
for (ePos=cPos+1; ePos<fmtArg.length();
ePos++) {
char c=0;
c = fmtArg.charAt(ePos);
if (c == 'i') break;
if (c == 'd') break;
if (c == 'f') break;
if (c == 'g') break;
if (c == 'G') break;
if (c == 'o') break;
if (c == 'x') break;
if (c == 'X') break;
if (c == 'e') break;
if (c == 'E') break;
if (c == 'c') break;
if (c == 's') break;
if (c == '%') break;
}
ePos=Math.min(ePos+1,fmtArg.length());
sFmt = new ConversionSpecification(
fmtArg.substring(cPos,ePos));
vFmt.addElement(sFmt);
unCS = this.nonControl(fmtArg,ePos);
if (unCS!=null) {
sFmt = new ConversionSpecification();
sFmt.setLiteral(unCS);
vFmt.addElement(sFmt);
}
}
}
/**
* Return a substring starting at
* <code>start</code> and ending at either the end
* of the String <code>s</code>, the next unpaired
* percent sign, or at the end of the String if the
* last character is a percent sign.
* @param s Control string.
* @param start Position in the string
* <code>s</code> to begin looking for the start
* of a control string.
* @return the substring from the start position
* to the beginning of the control string.
*/
private String nonControl(String s,int start) {
String ret="";
cPos=s.indexOf("%",start);
if (cPos==-1) cPos=s.length();
return s.substring(start,cPos);
}
/**
* Format an array of objects. Byte, Short,
* Integer, Long, Float, Double, and Character
* arguments are treated as wrappers for primitive
* types.
* @param o The array of objects to format.
* @return The formatted String.
*/
public StringBuffer sprintf(Object[] o, StringBuffer sb) {
Enumeration e = vFmt.elements();
ConversionSpecification cs = null;
char c = 0;
int i=0;
sb.setLength(0);
while (e.hasMoreElements()) {
cs = (ConversionSpecification)
e.nextElement();
c = cs.getConversionCharacter();
if (c=='\0') sb.append(cs.getLiteral());
else if (c=='%') sb.append("%");
else {
if (cs.isPositionalSpecification()) {
i=cs.getArgumentPosition()-1;
if (cs.isPositionalFieldWidth()) {
int ifw=cs.getArgumentPositionForFieldWidth()-1;
cs.setFieldWidthWithArg(((Integer)o[ifw]).intValue());
}
if (cs.isPositionalPrecision()) {
int ipr=cs.getArgumentPositionForPrecision()-1;
cs.setPrecisionWithArg(((Integer)o[ipr]).intValue());
}
}
else {
if (cs.isVariableFieldWidth()) {
cs.setFieldWidthWithArg(((Integer)o[i]).intValue());
i++;
}
if (cs.isVariablePrecision()) {
cs.setPrecisionWithArg(((Integer)o[i]).intValue());
i++;
}
}
if (o[i] instanceof Byte)
sb.append(cs.internalsprintf(
((Byte)o[i]).byteValue()));
else if (o[i] instanceof Short)
sb.append(cs.internalsprintf(
((Short)o[i]).shortValue()));
else if (o[i] instanceof Integer)
sb.append(cs.internalsprintf(
((Integer)o[i]).intValue()));
else if (o[i] instanceof Long)
sb.append(cs.internalsprintf(
((Long)o[i]).longValue()));
else if (o[i] instanceof Float)
sb.append(cs.internalsprintf(
((Float)o[i]).floatValue()));
else if (o[i] instanceof Double)
sb.append(cs.internalsprintf(
((Double)o[i]).doubleValue()));
else if (o[i] instanceof Character)
sb.append(cs.internalsprintf(
((Character)o[i]).charValue()));
else if (o[i] instanceof String)
sb.append(cs.internalsprintf(
(String)o[i]));
else
sb.append(cs.internalsprintf(
o[i]));
if (!cs.isPositionalSpecification())
i++;
}
}
return sb;
}
/**
* Format nothing. Just use the control string.
* @return the formatted String.
*/
public StringBuffer sprintf( StringBuffer sb) {
Enumeration e = vFmt.elements();
ConversionSpecification cs = null;
char c = 0;
sb.setLength(0);
while (e.hasMoreElements()) {
cs = (ConversionSpecification)
e.nextElement();
c = cs.getConversionCharacter();
if (c=='\0') sb.append(cs.getLiteral());
else if (c=='%') sb.append("%");
}
return sb;
}
/**
* Format an int.
* @param x The int to format.
* @return The formatted String.
* @exception IllegalArgumentException if the
* conversion character is f, e, E, g, G, s,
* or S.
*/
public StringBuffer sprintf(int x, StringBuffer sb)
throws IllegalArgumentException {
Enumeration e = vFmt.elements();
ConversionSpecification cs = null;
char c = 0;
sb.setLength(0);
while (e.hasMoreElements()) {
cs = (ConversionSpecification)
e.nextElement();
c = cs.getConversionCharacter();
if (c=='\0') sb.append(cs.getLiteral());
else if (c=='%') sb.append("%");
else sb.append(cs.internalsprintf(x));
}
return sb;
}
/**
* Format an long.
* @param x The long to format.
* @return The formatted String.
* @exception IllegalArgumentException if the
* conversion character is f, e, E, g, G, s,
* or S.
*/
public StringBuffer sprintf(long x, StringBuffer sb)
throws IllegalArgumentException {
Enumeration e = vFmt.elements();
ConversionSpecification cs = null;
char c = 0;
sb.setLength(0);
while (e.hasMoreElements()) {
cs = (ConversionSpecification)
e.nextElement();
c = cs.getConversionCharacter();
if (c=='\0') sb.append(cs.getLiteral());
else if (c=='%') sb.append("%");
else sb.append(cs.internalsprintf(x));
}
return sb;
}
/**
* Format a double.
* @param x The double to format.
* @return The formatted String.
* @exception IllegalArgumentException if the
* conversion character is c, C, s, S,
* d, d, x, X, or o.
*/
public StringBuffer sprintf(double x, StringBuffer sb)
throws IllegalArgumentException {
Enumeration e = vFmt.elements();
ConversionSpecification cs = null;
char c = 0;
sb.setLength(0);
while (e.hasMoreElements()) {
cs = (ConversionSpecification)
e.nextElement();
c = cs.getConversionCharacter();
if (c=='\0') sb.append(cs.getLiteral());
else if (c=='%') sb.append("%");
else sb.append(cs.internalsprintf(x));
}
return sb;
}
/**
* Format a String.
* @param x The String to format.
* @return The formatted String.
* @exception IllegalArgumentException if the
* conversion character is neither s nor S.
*/
public StringBuffer sprintf(String x, StringBuffer sb)
throws IllegalArgumentException {
Enumeration e = vFmt.elements();
ConversionSpecification cs = null;
char c = 0;
sb.setLength(0);
while (e.hasMoreElements()) {
cs = (ConversionSpecification)
e.nextElement();
c = cs.getConversionCharacter();
if (c=='\0') sb.append(cs.getLiteral());
else if (c=='%') sb.append("%");
else sb.append(cs.internalsprintf(x));
}
return sb;
}
/**
* Format an Object. Convert wrapper types to
* their primitive equivalents and call the
* appropriate internal formatting method. Convert
* Strings using an internal formatting method for
* Strings. Otherwise use the default formatter
* (use toString).
* @param x the Object to format.
* @return the formatted String.
* @exception IllegalArgumentException if the
* conversion character is inappropriate for
* formatting an unwrapped value.
*/
public StringBuffer sprintf(Object x, StringBuffer sb)
throws IllegalArgumentException {
Enumeration e = vFmt.elements();
ConversionSpecification cs = null;
char c = 0;
sb.setLength(0);
while (e.hasMoreElements()) {
cs = (ConversionSpecification)
e.nextElement();
c = cs.getConversionCharacter();
if (c=='\0') sb.append(cs.getLiteral());
else if (c=='%') sb.append("%");
else {
if (x instanceof Byte)
sb.append(cs.internalsprintf(
((Byte)x).byteValue()));
else if (x instanceof Short)
sb.append(cs.internalsprintf(
((Short)x).shortValue()));
else if (x instanceof Integer)
sb.append(cs.internalsprintf(
((Integer)x).intValue()));
else if (x instanceof Long)
sb.append(cs.internalsprintf(
((Long)x).longValue()));
else if (x instanceof Float)
sb.append(cs.internalsprintf(
((Float)x).floatValue()));
else if (x instanceof Double)
sb.append(cs.internalsprintf(
((Double)x).doubleValue()));
else if (x instanceof Character)
sb.append(cs.internalsprintf(
((Character)x).charValue()));
else if (x instanceof String)
sb.append(cs.internalsprintf(
(String)x));
else
sb.append(cs.internalsprintf(x));
}
}
return sb;
}
/**
*<p>
* ConversionSpecification allows the formatting of
* a single primitive or object embedded within a
* string. The formatting is controlled by a
* format string. Only one Java primitive or
* object can be formatted at a time.
*<p>
* A format string is a Java string that contains
* a control string. The control string starts at
* the first percent sign (%) in the string,
* provided that this percent sign
*<ol>
*<li>is not escaped protected by a matching % or
* is not an escape % character,
*<li>is not at the end of the format string, and
*<li>precedes a sequence of characters that parses
* as a valid control string.
*</ol>
*<p>
* A control string takes the form:
*<pre> % ['-+ #0]* [0..9]* { . [0..9]* }+
* { [hlL] }+ [idfgGoxXeEcs]
*</pre>
*<p>
* The behavior is like printf. One (hopefully the
* only) exception is that the minimum number of
* exponent digits is 3 instead of 2 for e and E
* formats when the optional L is used before the
* e, E, g, or G conversion character. The
* optional L does not imply conversion to a long
* long double.
*/
private class ConversionSpecification {
/**
* Constructor. Used to prepare an instance
* to hold a literal, not a control string.
*/
ConversionSpecification() { }
/**
* Constructor for a conversion specification.
* The argument must begin with a % and end
* with the conversion character for the
* conversion specification.
* @param fmtArg String specifying the
* conversion specification.
* @exception IllegalArgumentException if the
* input string is null, zero length, or
* otherwise malformed.
*/
ConversionSpecification(String fmtArg)
throws IllegalArgumentException {
if (fmtArg==null)
throw new NullPointerException();
if (fmtArg.length()==0)
throw new IllegalArgumentException(
"Control strings must have positive"+
" lengths.");
if (fmtArg.charAt(0)=='%') {
fmt = fmtArg;
pos=1;
setArgPosition();
setFlagCharacters();
setFieldWidth();
setPrecision();
setOptionalHL();
if (setConversionCharacter()) {
if (pos==fmtArg.length()) {
if(leadingZeros&&leftJustify)
leadingZeros=false;
if(precisionSet&&leadingZeros){
if(conversionCharacter=='d'
||conversionCharacter=='i'
||conversionCharacter=='o'
||conversionCharacter=='x')
{
leadingZeros=false;
}
}
}
else
throw new IllegalArgumentException(
"Malformed conversion specification="+
fmtArg);
}
else
throw new IllegalArgumentException(
"Malformed conversion specification="+
fmtArg);
}
else
throw new IllegalArgumentException(
"Control strings must begin with %.");
}
/**
* Set the String for this instance.
* @param s the String to store.
*/
void setLiteral(String s) {
fmt = s;
}
/**
* Get the String for this instance. Translate
* any escape sequences.
*
* @return s the stored String.
*/
String getLiteral() {
StringBuffer sb=new StringBuffer();
int i=0;
while (i<fmt.length()) {
if (fmt.charAt(i)=='\\') {
i++;
if (i<fmt.length()) {
char c=fmt.charAt(i);
switch(c) {
case 'a':
sb.append((char)0x07);
break;
case 'b':
sb.append('\b');
break;
case 'f':
sb.append('\f');
break;
case 'n':
sb.append(System.getProperty("line.separator"));
break;
case 'r':
sb.append('\r');
break;
case 't':
sb.append('\t');
break;
case 'v':
sb.append((char)0x0b);
break;
case '\\':
sb.append('\\');
break;
}
i++;
}
else
sb.append('\\');
}
else
i++;
}
return fmt;
}
/**
* Get the conversion character that tells what
* type of control character this instance has.
*
* @return the conversion character.
*/
char getConversionCharacter() {
return conversionCharacter;
}
/**
* Check whether the specifier has a variable
* field width that is going to be set by an
* argument.
* @return <code>true</code> if the conversion
* uses an * field width; otherwise
* <code>false</code>.
*/
boolean isVariableFieldWidth() {
return variableFieldWidth;
}
/**
* Set the field width with an argument. A
* negative field width is taken as a - flag
* followed by a positive field width.
* @param fw the field width.
*/
void setFieldWidthWithArg(int fw) {
if (fw<0) leftJustify = true;
fieldWidthSet = true;
fieldWidth = Math.abs(fw);
}
/**
* Check whether the specifier has a variable
* precision that is going to be set by an
* argument.
* @return <code>true</code> if the conversion
* uses an * precision; otherwise
* <code>false</code>.
*/
boolean isVariablePrecision() {
return variablePrecision;
}
/**
* Set the precision with an argument. A
* negative precision will be changed to zero.
* @param pr the precision.
*/
void setPrecisionWithArg(int pr) {
precisionSet = true;
precision = Math.max(pr,0);
}
/**
* Format an int argument using this conversion
* specification.
* @param s the int to format.
* @return the formatted String.
* @exception IllegalArgumentException if the
* conversion character is f, e, E, g, or G.
*/
String internalsprintf(int s)
throws IllegalArgumentException {
String s2 = "";
switch(conversionCharacter) {
case 'd':
case 'i':
if (optionalh)
s2 = printDFormat((short)s);
else if (optionall)
s2 = printDFormat((long)s);
else
s2 = printDFormat(s);
break;
case 'x':
case 'X':
if (optionalh)
s2 = printXFormat((short)s);
else if (optionall)
s2 = printXFormat((long)s);
else
s2 = printXFormat(s);
break;
case 'o':
if (optionalh)
s2 = printOFormat((short)s);
else if (optionall)
s2 = printOFormat((long)s);
else
s2 = printOFormat(s);
break;
case 'c':
case 'C':
s2 = printCFormat((char)s);
break;
default:
throw new IllegalArgumentException(
"Cannot format a int with a format using a "+
conversionCharacter+
" conversion character.");
}
return s2;
}
/**
* Format a long argument using this conversion
* specification.
* @param s the long to format.
* @return the formatted String.
* @exception IllegalArgumentException if the
* conversion character is f, e, E, g, or G.
*/
String internalsprintf(long s)
throws IllegalArgumentException {
String s2 = "";
switch(conversionCharacter) {
case 'd':
case 'i':
if (optionalh)
s2 = printDFormat((short)s);
else if (optionall)
s2 = printDFormat(s);
else
s2 = printDFormat((int)s);
break;
case 'x':
case 'X':
if (optionalh)
s2 = printXFormat((short)s);
else if (optionall)
s2 = printXFormat(s);
else
s2 = printXFormat((int)s);
break;
case 'o':
if (optionalh)
s2 = printOFormat((short)s);
else if (optionall)
s2 = printOFormat(s);
else
s2 = printOFormat((int)s);
break;
case 'c':
case 'C':
s2 = printCFormat((char)s);
break;
default:
throw new IllegalArgumentException(
"Cannot format a long with a format using a "+
conversionCharacter+" conversion character.");
}
return s2;
}
/**
* Format a double argument using this conversion
* specification.
* @param s the double to format.
* @return the formatted String.
* @exception IllegalArgumentException if the
* conversion character is c, C, s, S, i, d,
* x, X, or o.
*/
String internalsprintf(double s)
throws IllegalArgumentException {
String s2 = "";
switch(conversionCharacter) {
case 'f':
s2 = printFFormat(s);
break;
case 'E':
case 'e':
s2 = printEFormat(s);
break;
case 'G':
case 'g':
s2 = printGFormat(s);
break;
default:
throw new IllegalArgumentException("Cannot "+
"format a double with a format using a "+
conversionCharacter+" conversion character.");
}
return s2;
}
/**
* Format a String argument using this conversion
* specification.
* @param s the String to format.
* @return the formatted String.
* @exception IllegalArgumentException if the
* conversion character is neither s nor S.
*/
String internalsprintf(String s)
throws IllegalArgumentException {
String s2 = "";
if(conversionCharacter=='s'
|| conversionCharacter=='S')
s2 = printSFormat(s);
else
throw new IllegalArgumentException("Cannot "+
"format a String with a format using a "+
conversionCharacter+" conversion character.");
return s2;
}
/**
* Format an Object argument using this conversion
* specification.
* @param s the Object to format.
* @return the formatted String.
* @exception IllegalArgumentException if the
* conversion character is neither s nor S.
*/
String internalsprintf(Object s) {
String s2 = "";
if(conversionCharacter=='s'
|| conversionCharacter=='S')
s2 = printSFormat(s.toString());
else
throw new IllegalArgumentException(
"Cannot format a String with a format using"+
" a "+conversionCharacter+
" conversion character.");
return s2;
}
/**
* For f format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. '+' character means that the conversion
* will always begin with a sign (+ or -). The
* blank flag character means that a non-negative
* input will be preceded with a blank. If both
* a '+' and a ' ' are specified, the blank flag
* is ignored. The '0' flag character implies that
* padding to the field width will be done with
* zeros instead of blanks.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the number of digits
* to appear after the radix character. Padding is
* with trailing 0s.
*/
private char[] fFormatDigits(double x) {
// int defaultDigits=6;
String sx,sxOut;
int i,j,k;
int n1In,n2In;
int expon=0;
boolean minusSign=false;
if (x>0.0)
sx = Double.toString(x);
else if (x<0.0) {
sx = Double.toString(-x);
minusSign=true;
}
else {
sx = Double.toString(x);
if (sx.charAt(0)=='-') {
minusSign=true;
sx=sx.substring(1);
}
}
int ePos = sx.indexOf('E');
int rPos = sx.indexOf('.');
if (rPos!=-1) n1In=rPos;
else if (ePos!=-1) n1In=ePos;
else n1In=sx.length();
if (rPos!=-1) {
if (ePos!=-1) n2In = ePos-rPos-1;
else n2In = sx.length()-rPos-1;
}
else
n2In = 0;
if (ePos!=-1) {
int ie=ePos+1;
expon=0;
if (sx.charAt(ie)=='-') {
for (++ie; ie<sx.length(); ie++)
if (sx.charAt(ie)!='0') break;
if (ie<sx.length())
expon=-Integer.parseInt(sx.substring(ie));
}
else {
if (sx.charAt(ie)=='+') ++ie;
for (; ie<sx.length(); ie++)
if (sx.charAt(ie)!='0') break;
if (ie<sx.length())
expon=Integer.parseInt(sx.substring(ie));
}
}
int p;
if (precisionSet) p = precision;
else p = defaultDigits-1;
char[] ca1 = sx.toCharArray();
char[] ca2 = new char[n1In+n2In];
char[] ca3,ca4,ca5;
for (j=0; j<n1In; j++)
ca2[j] = ca1[j];
i = j+1;
for (k=0; k<n2In; j++,i++,k++)
ca2[j] = ca1[i];
if (n1In+expon<=0) {
ca3 = new char[-expon+n2In];
for (j=0,k=0; k<(-n1In-expon); k++,j++)
ca3[j]='0';
for (i=0; i<(n1In+n2In); i++,j++)
ca3[j]=ca2[i];
}
else
ca3 = ca2;
boolean carry=false;
if (p<-expon+n2In) {
if (expon<0) i = p;
else i = p+n1In;
carry=checkForCarry(ca3,i);
if (carry)
carry=startSymbolicCarry(ca3,i-1,0);
}
if (n1In+expon<=0) {
ca4 = new char[2+p];
if (!carry) ca4[0]='0';
else ca4[0]='1';
if(alternateForm||!precisionSet||precision!=0){
ca4[1]='.';
for(i=0,j=2;i<Math.min(p,ca3.length);i++,j++)
ca4[j]=ca3[i];
for (; j<ca4.length; j++) ca4[j]='0';
}
}
else {
if (!carry) {
if(alternateForm||!precisionSet
||precision!=0)
ca4 = new char[n1In+expon+p+1];
else
ca4 = new char[n1In+expon];
j=0;
}
else {
if(alternateForm||!precisionSet
||precision!=0)
ca4 = new char[n1In+expon+p+2];
else
ca4 = new char[n1In+expon+1];
ca4[0]='1';
j=1;
}
for (i=0; i<Math.min(n1In+expon,ca3.length); i++,j++)
ca4[j]=ca3[i];
for (; i<n1In+expon; i++,j++)
ca4[j]='0';
if(alternateForm||!precisionSet||precision!=0){
ca4[j]='.'; j++;
for (k=0; i<ca3.length && k<p; i++,j++,k++)
ca4[j]=ca3[i];
for (; j<ca4.length; j++) ca4[j]='0';
}
}
int nZeros=0;
if (!leftJustify && leadingZeros) {
int xThousands=0;
if (thousands) {
int xlead=0;
if (ca4[0]=='+'||ca4[0]=='-'||ca4[0]==' ')
xlead=1;
int xdp=xlead;
for (; xdp<ca4.length; xdp++)
if (ca4[xdp]=='.') break;
xThousands=(xdp-xlead)/3;
}
if (fieldWidthSet)
nZeros = fieldWidth-ca4.length;
if ((!minusSign&&(leadingSign||leadingSpace))||minusSign)
nZeros--;
nZeros-=xThousands;
if (nZeros<0) nZeros=0;
}
j=0;
if ((!minusSign&&(leadingSign||leadingSpace))||minusSign) {
ca5 = new char[ca4.length+nZeros+1];
j++;
}
else
ca5 = new char[ca4.length+nZeros];
if (!minusSign) {
if (leadingSign) ca5[0]='+';
if (leadingSpace) ca5[0]=' ';
}
else
ca5[0]='-';
for (i=0; i<nZeros; i++,j++)
ca5[j]='0';
for (i=0; i<ca4.length; i++,j++) ca5[j]=ca4[i];
int lead=0;
if (ca5[0]=='+'||ca5[0]=='-'||ca5[0]==' ')
lead=1;
int dp=lead;
for (; dp<ca5.length; dp++)
if (ca5[dp]=='.') break;
int nThousands=(dp-lead)/3;
// Localize the decimal point.
if (dp<ca5.length)
ca5[dp]=dfs.getDecimalSeparator();
char[] ca6 = ca5;
if (thousands && nThousands>0) {
ca6 = new char[ca5.length+nThousands+lead];
ca6[0]=ca5[0];
for (i=lead,k=lead; i<dp; i++) {
if (i>0 && (dp-i)%3==0) {
// ca6[k]=',';
ca6[k]=dfs.getGroupingSeparator();
ca6[k+1]=ca5[i];
k+=2;
}
else {
ca6[k]=ca5[i]; k++;
}
}
for (; i<ca5.length; i++,k++) {
ca6[k]=ca5[i];
}
}
return ca6;
}
/**
* An intermediate routine on the way to creating
* an f format String. The method decides whether
* the input double value is an infinity,
* not-a-number, or a finite double and formats
* each type of input appropriately.
* @param x the double value to be formatted.
* @return the converted double value.
*/
private String fFormatString(double x) {
boolean noDigits=false;
char[] ca6,ca7;
if (Double.isInfinite(x)) {
if (x==Double.POSITIVE_INFINITY) {
if (leadingSign) ca6 = "+Inf".toCharArray();
else if (leadingSpace)
ca6 = " Inf".toCharArray();
else ca6 = "Inf".toCharArray();
}
else
ca6 = "-Inf".toCharArray();
noDigits = true;
}
else if (Double.isNaN(x)) {
if (leadingSign) ca6 = "+NaN".toCharArray();
else if (leadingSpace)
ca6 = " NaN".toCharArray();
else ca6 = "NaN".toCharArray();
noDigits = true;
}
else
ca6 = fFormatDigits(x);
ca7 = applyFloatPadding(ca6,false);
return new String(ca7);
}
/**
* For e format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. '+' character means that the conversion
* will always begin with a sign (+ or -). The
* blank flag character means that a non-negative
* input will be preceded with a blank. If both a
* '+' and a ' ' are specified, the blank flag is
* ignored. The '0' flag character implies that
* padding to the field width will be done with
* zeros instead of blanks.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear after the radix character.
* Padding is with trailing 0s.
*
* The behavior is like printf. One (hopefully the
* only) exception is that the minimum number of
* exponent digits is 3 instead of 2 for e and E
* formats when the optional L is used before the
* e, E, g, or G conversion character. The optional
* L does not imply conversion to a long long
* double.
*/
private char[] eFormatDigits(double x,char eChar) {
char[] ca1,ca2,ca3;
// int defaultDigits=6;
String sx,sxOut;
int i,j,k,p;
int n1In,n2In;
int expon=0;
int ePos,rPos,eSize;
boolean minusSign=false;
if (x>0.0)
sx = Double.toString(x);
else if (x<0.0) {
sx = Double.toString(-x);
minusSign=true;
}
else {
sx = Double.toString(x);
if (sx.charAt(0)=='-') {
minusSign=true;
sx=sx.substring(1);
}
}
ePos = sx.indexOf('E');
if (ePos==-1) ePos = sx.indexOf('e');
rPos = sx.indexOf('.');
if (rPos!=-1) n1In=rPos;
else if (ePos!=-1) n1In=ePos;
else n1In=sx.length();
if (rPos!=-1) {
if (ePos!=-1) n2In = ePos-rPos-1;
else n2In = sx.length()-rPos-1;
}
else
n2In = 0;
if (ePos!=-1) {
int ie=ePos+1;
expon=0;
if (sx.charAt(ie)=='-') {
for (++ie; ie<sx.length(); ie++)
if (sx.charAt(ie)!='0') break;
if (ie<sx.length())
expon=-Integer.parseInt(sx.substring(ie));
}
else {
if (sx.charAt(ie)=='+') ++ie;
for (; ie<sx.length(); ie++)
if (sx.charAt(ie)!='0') break;
if (ie<sx.length())
expon=Integer.parseInt(sx.substring(ie));
}
}
if (rPos!=-1) expon += rPos-1;
if (precisionSet) p = precision;
else p = defaultDigits-1;
if (rPos!=-1 && ePos!=-1)
ca1=(sx.substring(0,rPos)+
sx.substring(rPos+1,ePos)).toCharArray();
else if (rPos!=-1)
ca1 = (sx.substring(0,rPos)+
sx.substring(rPos+1)).toCharArray();
else if (ePos!=-1)
ca1 = sx.substring(0,ePos).toCharArray();
else
ca1 = sx.toCharArray();
boolean carry=false;
int i0=0;
if (ca1[0]!='0')
i0 = 0;
else
for (i0=0; i0<ca1.length; i0++)
if (ca1[i0]!='0') break;
if (i0+p<ca1.length-1) {
carry=checkForCarry(ca1,i0+p+1);
if (carry)
carry = startSymbolicCarry(ca1,i0+p,i0);
if (carry) {
ca2 = new char[i0+p+1];
ca2[i0]='1';
for (j=0; j<i0; j++) ca2[j]='0';
for (i=i0,j=i0+1; j<p+1; i++,j++)
ca2[j] = ca1[i];
expon++;
ca1 = ca2;
}
}
if (Math.abs(expon)<100 && !optionalL) eSize=4;
else eSize=5;
if (alternateForm||!precisionSet||precision!=0)
ca2 = new char[2+p+eSize];
else
ca2 = new char[1+eSize];
if (ca1[0]!='0') {
ca2[0] = ca1[0];
j=1;
}
else {
for (j=1; j<(ePos==-1?ca1.length:ePos); j++)
if (ca1[j]!='0') break;
if ((ePos!=-1 && j<ePos)||
(ePos==-1 && j<ca1.length)) {
ca2[0] = ca1[j];
expon -= j;
j++;
}
else {
ca2[0]='0';
j=2;
}
}
if (alternateForm||!precisionSet||precision!=0) {
ca2[1] = '.';
i=2;
}
else
i=1;
for (k=0; k<p && j<ca1.length; j++,i++,k++)
ca2[i] = ca1[j];
for (;i<ca2.length-eSize; i++)
ca2[i] = '0';
ca2[i++] = eChar;
if (expon<0) ca2[i++]='-';
else ca2[i++]='+';
expon = Math.abs(expon);
if (expon>=100) {
switch(expon/100) {
case 1: ca2[i]='1'; break;
case 2: ca2[i]='2'; break;
case 3: ca2[i]='3'; break;
case 4: ca2[i]='4'; break;
case 5: ca2[i]='5'; break;
case 6: ca2[i]='6'; break;
case 7: ca2[i]='7'; break;
case 8: ca2[i]='8'; break;
case 9: ca2[i]='9'; break;
}
i++;
}
switch((expon%100)/10) {
case 0: ca2[i]='0'; break;
case 1: ca2[i]='1'; break;
case 2: ca2[i]='2'; break;
case 3: ca2[i]='3'; break;
case 4: ca2[i]='4'; break;
case 5: ca2[i]='5'; break;
case 6: ca2[i]='6'; break;
case 7: ca2[i]='7'; break;
case 8: ca2[i]='8'; break;
case 9: ca2[i]='9'; break;
}
i++;
switch(expon%10) {
case 0: ca2[i]='0'; break;
case 1: ca2[i]='1'; break;
case 2: ca2[i]='2'; break;
case 3: ca2[i]='3'; break;
case 4: ca2[i]='4'; break;
case 5: ca2[i]='5'; break;
case 6: ca2[i]='6'; break;
case 7: ca2[i]='7'; break;
case 8: ca2[i]='8'; break;
case 9: ca2[i]='9'; break;
}
int nZeros=0;
if (!leftJustify && leadingZeros) {
int xThousands=0;
if (thousands) {
int xlead=0;
if (ca2[0]=='+'||ca2[0]=='-'||ca2[0]==' ')
xlead=1;
int xdp=xlead;
for (; xdp<ca2.length; xdp++)
if (ca2[xdp]=='.') break;
xThousands=(xdp-xlead)/3;
}
if (fieldWidthSet)
nZeros = fieldWidth-ca2.length;
if ((!minusSign&&(leadingSign||leadingSpace))||minusSign)
nZeros--;
nZeros-=xThousands;
if (nZeros<0) nZeros=0;
}
j=0;
if ((!minusSign&&(leadingSign || leadingSpace))||minusSign) {
ca3 = new char[ca2.length+nZeros+1];
j++;
}
else
ca3 = new char[ca2.length+nZeros];
if (!minusSign) {
if (leadingSign) ca3[0]='+';
if (leadingSpace) ca3[0]=' ';
}
else
ca3[0]='-';
for (k=0; k<nZeros; j++,k++)
ca3[j]='0';
for (i=0; i<ca2.length && j<ca3.length; i++,j++)
ca3[j]=ca2[i];
int lead=0;
if (ca3[0]=='+'||ca3[0]=='-'||ca3[0]==' ')
lead=1;
int dp=lead;
for (; dp<ca3.length; dp++)
if (ca3[dp]=='.') break;
int nThousands=dp/3;
// Localize the decimal point.
if (dp < ca3.length)
ca3[dp] = dfs.getDecimalSeparator();
char[] ca4 = ca3;
if (thousands && nThousands>0) {
ca4 = new char[ca3.length+nThousands+lead];
ca4[0]=ca3[0];
for (i=lead,k=lead; i<dp; i++) {
if (i>0 && (dp-i)%3==0) {
// ca4[k]=',';
ca4[k]=dfs.getGroupingSeparator();
ca4[k+1]=ca3[i];
k+=2;
}
else {
ca4[k]=ca3[i]; k++;
}
}
for (; i<ca3.length; i++,k++)
ca4[k]=ca3[i];
}
return ca4;
}
/**
* Check to see if the digits that are going to
* be truncated because of the precision should
* force a round in the preceding digits.
* @param ca1 the array of digits
* @param icarry the index of the first digit that
* is to be truncated from the print
* @return <code>true</code> if the truncation forces
* a round that will change the print
*/
private boolean checkForCarry(char[] ca1,int icarry) {
boolean carry=false;
if (icarry<ca1.length) {
if (ca1[icarry]=='6'||ca1[icarry]=='7'
||ca1[icarry]=='8'||ca1[icarry]=='9') carry=true;
else if (ca1[icarry]=='5') {
int ii=icarry+1;
for (;ii<ca1.length; ii++)
if (ca1[ii]!='0') break;
carry=ii<ca1.length;
if (!carry&&icarry>0) {
carry=(ca1[icarry-1]=='1'||ca1[icarry-1]=='3'
||ca1[icarry-1]=='5'||ca1[icarry-1]=='7'
||ca1[icarry-1]=='9');
}
}
}
return carry;
}
/**
* Start the symbolic carry process. The process
* is not quite finished because the symbolic
* carry may change the length of the string and
* change the exponent (in e format).
* @param cLast index of the last digit changed
* by the round
* @param cFirst index of the first digit allowed
* to be changed by this phase of the round
* @return <code>true</code> if the carry forces
* a round that will change the print still
* more
*/
private boolean startSymbolicCarry(
char[] ca,int cLast,int cFirst) {
boolean carry=true;
for (int i=cLast; carry && i>=cFirst; i--) {
carry = false;
switch(ca[i]) {
case '0': ca[i]='1'; break;
case '1': ca[i]='2'; break;
case '2': ca[i]='3'; break;
case '3': ca[i]='4'; break;
case '4': ca[i]='5'; break;
case '5': ca[i]='6'; break;
case '6': ca[i]='7'; break;
case '7': ca[i]='8'; break;
case '8': ca[i]='9'; break;
case '9': ca[i]='0'; carry=true; break;
}
}
return carry;
}
/**
* An intermediate routine on the way to creating
* an e format String. The method decides whether
* the input double value is an infinity,
* not-a-number, or a finite double and formats
* each type of input appropriately.
* @param x the double value to be formatted.
* @param eChar an 'e' or 'E' to use in the
* converted double value.
* @return the converted double value.
*/
private String eFormatString(double x,char eChar) {
boolean noDigits=false;
char[] ca4,ca5;
if (Double.isInfinite(x)) {
if (x==Double.POSITIVE_INFINITY) {
if (leadingSign) ca4 = "+Inf".toCharArray();
else if (leadingSpace)
ca4 = " Inf".toCharArray();
else ca4 = "Inf".toCharArray();
}
else
ca4 = "-Inf".toCharArray();
noDigits = true;
}
else if (Double.isNaN(x)) {
if (leadingSign) ca4 = "+NaN".toCharArray();
else if (leadingSpace)
ca4 = " NaN".toCharArray();
else ca4 = "NaN".toCharArray();
noDigits = true;
}
else
ca4 = eFormatDigits(x,eChar);
ca5 = applyFloatPadding(ca4,false);
return new String(ca5);
}
/**
* Apply zero or blank, left or right padding.
* @param ca4 array of characters before padding is
* finished
* @param noDigits NaN or signed Inf
* @return a padded array of characters
*/
private char[] applyFloatPadding(
char[] ca4,boolean noDigits) {
char[] ca5 = ca4;
if (fieldWidthSet) {
int i,j,nBlanks;
if (leftJustify) {
nBlanks = fieldWidth-ca4.length;
if (nBlanks > 0) {
ca5 = new char[ca4.length+nBlanks];
for (i=0; i<ca4.length; i++)
ca5[i] = ca4[i];
for (j=0; j<nBlanks; j++,i++)
ca5[i] = ' ';
}
}
else if (!leadingZeros || noDigits) {
nBlanks = fieldWidth-ca4.length;
if (nBlanks > 0) {
ca5 = new char[ca4.length+nBlanks];
for (i=0; i<nBlanks; i++)
ca5[i] = ' ';
for (j=0; j<ca4.length; i++,j++)
ca5[i] = ca4[j];
}
}
else if (leadingZeros) {
nBlanks = fieldWidth-ca4.length;
if (nBlanks > 0) {
ca5 = new char[ca4.length+nBlanks];
i=0; j=0;
if (ca4[0]=='-') { ca5[0]='-'; i++; j++; }
for (int k=0; k<nBlanks; i++,k++)
ca5[i] = '0';
for (; j<ca4.length; i++,j++)
ca5[i] = ca4[j];
}
}
}
return ca5;
}
/**
* Format method for the f conversion character.
* @param x the double to format.
* @return the formatted String.
*/
private String printFFormat(double x) {
return fFormatString(x);
}
/**
* Format method for the e or E conversion
* character.
* @param x the double to format.
* @return the formatted String.
*/
private String printEFormat(double x) {
if (conversionCharacter=='e')
return eFormatString(x,'e');
else
return eFormatString(x,'E');
}
/**
* Format method for the g conversion character.
*
* For g format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. '+' character means that the conversion
* will always begin with a sign (+ or -). The
* blank flag character means that a non-negative
* input will be preceded with a blank. If both a
* '+' and a ' ' are specified, the blank flag is
* ignored. The '0' flag character implies that
* padding to the field width will be done with
* zeros instead of blanks.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear after the radix character.
* Padding is with trailing 0s.
* @param x the double to format.
* @return the formatted String.
*/
private String printGFormat(double x) {
String sx,sy,sz,ret;
int savePrecision=precision;
int i;
char[] ca4,ca5;
boolean noDigits=false;
if (Double.isInfinite(x)) {
if (x==Double.POSITIVE_INFINITY) {
if (leadingSign) ca4 = "+Inf".toCharArray();
else if (leadingSpace)
ca4 = " Inf".toCharArray();
else ca4 = "Inf".toCharArray();
}
else
ca4 = "-Inf".toCharArray();
noDigits = true;
}
else if (Double.isNaN(x)) {
if (leadingSign) ca4 = "+NaN".toCharArray();
else if (leadingSpace)
ca4 = " NaN".toCharArray();
else ca4 = "NaN".toCharArray();
noDigits = true;
}
else {
if (!precisionSet) precision=defaultDigits;
if (precision==0) precision=1;
int ePos=-1;
if (conversionCharacter=='g') {
sx = eFormatString(x,'e').trim();
ePos=sx.indexOf('e');
}
else {
sx = eFormatString(x,'E').trim();
ePos=sx.indexOf('E');
}
i=ePos+1;
int expon=0;
if (sx.charAt(i)=='-') {
for (++i; i<sx.length(); i++)
if (sx.charAt(i)!='0') break;
if (i<sx.length())
expon=-Integer.parseInt(sx.substring(i));
}
else {
if (sx.charAt(i)=='+') ++i;
for (; i<sx.length(); i++)
if (sx.charAt(i)!='0') break;
if (i<sx.length())
expon=Integer.parseInt(sx.substring(i));
}
// Trim trailing zeros.
// If the radix character is not followed by
// a digit, trim it, too.
if (!alternateForm) {
if (expon>=-4 && expon<precision)
sy = fFormatString(x).trim();
else
sy = sx.substring(0,ePos);
i=sy.length()-1;
for (; i>=0; i--)
if (sy.charAt(i)!='0') break;
if (i>=0 && sy.charAt(i)=='.') i--;
if (i==-1) sz="0";
else if (!Character.isDigit(sy.charAt(i)))
sz=sy.substring(0,i+1)+"0";
else sz=sy.substring(0,i+1);
if (expon>=-4 && expon<precision)
ret=sz;
else
ret=sz+sx.substring(ePos);
}
else {
if (expon>=-4 && expon<precision)
ret = fFormatString(x).trim();
else
ret = sx;
}
// leading space was trimmed off during
// construction
if (leadingSpace) if (x>=0) ret = " "+ret;
ca4 = ret.toCharArray();
}
// Pad with blanks or zeros.
ca5 = applyFloatPadding(ca4,false);
precision=savePrecision;
return new String(ca5);
}
/**
* Format method for the d conversion specifer and
* short argument.
*
* For d format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. A '+' character means that the conversion
* will always begin with a sign (+ or -). The
* blank flag character means that a non-negative
* input will be preceded with a blank. If both a
* '+' and a ' ' are specified, the blank flag is
* ignored. The '0' flag character implies that
* padding to the field width will be done with
* zeros instead of blanks.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear. Padding is with leading 0s.
* @param x the short to format.
* @return the formatted String.
*/
private String printDFormat(short x) {
return printDFormat(Short.toString(x));
}
/**
* Format method for the d conversion character and
* long argument.
*
* For d format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. A '+' character means that the conversion
* will always begin with a sign (+ or -). The
* blank flag character means that a non-negative
* input will be preceded with a blank. If both a
* '+' and a ' ' are specified, the blank flag is
* ignored. The '0' flag character implies that
* padding to the field width will be done with
* zeros instead of blanks.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear. Padding is with leading 0s.
* @param x the long to format.
* @return the formatted String.
*/
private String printDFormat(long x) {
return printDFormat(Long.toString(x));
}
/**
* Format method for the d conversion character and
* int argument.
*
* For d format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. A '+' character means that the conversion
* will always begin with a sign (+ or -). The
* blank flag character means that a non-negative
* input will be preceded with a blank. If both a
* '+' and a ' ' are specified, the blank flag is
* ignored. The '0' flag character implies that
* padding to the field width will be done with
* zeros instead of blanks.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear. Padding is with leading 0s.
* @param x the int to format.
* @return the formatted String.
*/
private String printDFormat(int x) {
return printDFormat(Integer.toString(x));
}
/**
* Utility method for formatting using the d
* conversion character.
* @param sx the String to format, the result of
* converting a short, int, or long to a
* String.
* @return the formatted String.
*/
private String printDFormat(String sx) {
int nLeadingZeros=0;
int nBlanks=0,n=0;
int i=0,jFirst=0;
boolean neg = sx.charAt(0)=='-';
if (sx.equals("0")&&precisionSet&&precision==0)
sx="";
if (!neg) {
if (precisionSet && sx.length() < precision)
nLeadingZeros = precision-sx.length();
}
else {
if (precisionSet&&(sx.length()-1)<precision)
nLeadingZeros = precision-sx.length()+1;
}
if (nLeadingZeros<0) nLeadingZeros=0;
if (fieldWidthSet) {
nBlanks = fieldWidth-nLeadingZeros-sx.length();
if (!neg&&(leadingSign||leadingSpace))
nBlanks--;
}
if (nBlanks<0) nBlanks=0;
if (leadingSign) n++;
else if (leadingSpace) n++;
n += nBlanks;
n += nLeadingZeros;
n += sx.length();
char[] ca = new char[n];
if (leftJustify) {
if (neg) ca[i++] = '-';
else if (leadingSign) ca[i++] = '+';
else if (leadingSpace) ca[i++] = ' ';
char[] csx = sx.toCharArray();
jFirst = neg?1:0;
for (int j=0; j<nLeadingZeros; i++,j++)
ca[i]='0';
for (int j=jFirst; j<csx.length; j++,i++)
ca[i] = csx[j];
for (int j=0; j<nBlanks; i++,j++)
ca[i] = ' ';
}
else {
if (!leadingZeros) {
for (i=0; i<nBlanks; i++)
ca[i] = ' ';
if (neg) ca[i++] = '-';
else if (leadingSign) ca[i++] = '+';
else if (leadingSpace) ca[i++] = ' ';
}
else {
if (neg) ca[i++] = '-';
else if (leadingSign) ca[i++] = '+';
else if (leadingSpace) ca[i++] = ' ';
for (int j=0; j<nBlanks; j++,i++)
ca[i] = '0';
}
for (int j=0; j<nLeadingZeros; j++,i++)
ca[i] = '0';
char[] csx = sx.toCharArray();
jFirst = neg?1:0;
for (int j=jFirst; j<csx.length; j++,i++)
ca[i] = csx[j];
}
return new String(ca);
}
/**
* Format method for the x conversion character and
* short argument.
*
* For x format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. The '#' flag character means to lead with
* '0x'.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear. Padding is with leading 0s.
* @param x the short to format.
* @return the formatted String.
*/
private String printXFormat(short x) {
String sx=null;
if (x == Short.MIN_VALUE)
sx = "8000";
else if (x < 0) {
String t;
if (x==Short.MIN_VALUE)
t = "0";
else {
t = Integer.toString(
(~(-x-1))^Short.MIN_VALUE,16);
if (t.charAt(0)=='F'||t.charAt(0)=='f')
t = t.substring(16,32);
}
switch (t.length()) {
case 1:
sx = "800"+t;
break;
case 2:
sx = "80"+t;
break;
case 3:
sx = "8"+t;
break;
case 4:
switch (t.charAt(0)) {
case '1':
sx = "9"+t.substring(1,4);
break;
case '2':
sx = "a"+t.substring(1,4);
break;
case '3':
sx = "b"+t.substring(1,4);
break;
case '4':
sx = "c"+t.substring(1,4);
break;
case '5':
sx = "d"+t.substring(1,4);
break;
case '6':
sx = "e"+t.substring(1,4);
break;
case '7':
sx = "f"+t.substring(1,4);
break;
}
break;
}
}
else
sx = Integer.toString((int)x,16);
return printXFormat(sx);
}
/**
* Format method for the x conversion character and
* long argument.
*
* For x format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. The '#' flag character means to lead with
* '0x'.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear. Padding is with leading 0s.
* @param x the long to format.
* @return the formatted String.
*/
private String printXFormat(long x) {
String sx=null;
if (x == Long.MIN_VALUE)
sx = "8000000000000000";
else if (x < 0) {
String t = Long.toString(
(~(-x-1))^Long.MIN_VALUE,16);
switch (t.length()) {
case 1:
sx = "800000000000000"+t;
break;
case 2:
sx = "80000000000000"+t;
break;
case 3:
sx = "8000000000000"+t;
break;
case 4:
sx = "800000000000"+t;
break;
case 5:
sx = "80000000000"+t;
break;
case 6:
sx = "8000000000"+t;
break;
case 7:
sx = "800000000"+t;
break;
case 8:
sx = "80000000"+t;
break;
case 9:
sx = "8000000"+t;
break;
case 10:
sx = "800000"+t;
break;
case 11:
sx = "80000"+t;
break;
case 12:
sx = "8000"+t;
break;
case 13:
sx = "800"+t;
break;
case 14:
sx = "80"+t;
break;
case 15:
sx = "8"+t;
break;
case 16:
switch (t.charAt(0)) {
case '1':
sx = "9"+t.substring(1,16);
break;
case '2':
sx = "a"+t.substring(1,16);
break;
case '3':
sx = "b"+t.substring(1,16);
break;
case '4':
sx = "c"+t.substring(1,16);
break;
case '5':
sx = "d"+t.substring(1,16);
break;
case '6':
sx = "e"+t.substring(1,16);
break;
case '7':
sx = "f"+t.substring(1,16);
break;
}
break;
}
}
else
sx = Long.toString(x,16);
return printXFormat(sx);
}
/**
* Format method for the x conversion character and
* int argument.
*
* For x format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. The '#' flag character means to lead with
* '0x'.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear. Padding is with leading 0s.
* @param x the int to format.
* @return the formatted String.
*/
private String printXFormat(int x) {
String sx=null;
if (x == Integer.MIN_VALUE)
sx = "80000000";
else if (x < 0) {
String t = Integer.toString(
(~(-x-1))^Integer.MIN_VALUE,16);
switch (t.length()) {
case 1:
sx = "8000000"+t;
break;
case 2:
sx = "800000"+t;
break;
case 3:
sx = "80000"+t;
break;
case 4:
sx = "8000"+t;
break;
case 5:
sx = "800"+t;
break;
case 6:
sx = "80"+t;
break;
case 7:
sx = "8"+t;
break;
case 8:
switch (t.charAt(0)) {
case '1':
sx = "9"+t.substring(1,8);
break;
case '2':
sx = "a"+t.substring(1,8);
break;
case '3':
sx = "b"+t.substring(1,8);
break;
case '4':
sx = "c"+t.substring(1,8);
break;
case '5':
sx = "d"+t.substring(1,8);
break;
case '6':
sx = "e"+t.substring(1,8);
break;
case '7':
sx = "f"+t.substring(1,8);
break;
}
break;
}
}
else
sx = Integer.toString(x,16);
return printXFormat(sx);
}
/**
* Utility method for formatting using the x
* conversion character.
* @param sx the String to format, the result of
* converting a short, int, or long to a
* String.
* @return the formatted String.
*/
private String printXFormat(String sx) {
int nLeadingZeros = 0;
int nBlanks = 0;
if (sx.equals("0")&&precisionSet&&precision==0)
sx="";
if (precisionSet)
nLeadingZeros = precision-sx.length();
if (nLeadingZeros<0) nLeadingZeros=0;
if (fieldWidthSet) {
nBlanks = fieldWidth-nLeadingZeros-sx.length();
if (alternateForm) nBlanks = nBlanks - 2;
}
if (nBlanks<0) nBlanks=0;
int n=0;
if (alternateForm) n+=2;
n += nLeadingZeros;
n += sx.length();
n += nBlanks;
char[] ca = new char[n];
int i=0;
if (leftJustify) {
if (alternateForm) {
ca[i++]='0'; ca[i++]='x';
}
for (int j=0; j<nLeadingZeros; j++,i++)
ca[i]='0';
char[] csx = sx.toCharArray();
for (int j=0; j<csx.length; j++,i++)
ca[i] = csx[j];
for (int j=0; j<nBlanks; j++,i++)
ca[i] = ' ';
}
else {
if (!leadingZeros)
for (int j=0; j<nBlanks; j++,i++)
ca[i] = ' ';
if (alternateForm) {
ca[i++]='0'; ca[i++]='x';
}
if (leadingZeros)
for (int j=0; j<nBlanks; j++,i++)
ca[i] = '0';
for (int j=0; j<nLeadingZeros; j++,i++)
ca[i]='0';
char[] csx = sx.toCharArray();
for (int j=0; j<csx.length; j++,i++)
ca[i] = csx[j];
}
String caReturn=new String(ca);
if (conversionCharacter=='X')
caReturn = caReturn.toUpperCase();
return caReturn;
}
/**
* Format method for the o conversion character and
* short argument.
*
* For o format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. The '#' flag character means that the
* output begins with a leading 0 and the precision
* is increased by 1.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear. Padding is with leading 0s.
* @param x the short to format.
* @return the formatted String.
*/
private String printOFormat(short x) {
String sx=null;
if (x == Short.MIN_VALUE)
sx = "100000";
else if (x < 0) {
String t = Integer.toString(
(~(-x-1))^Short.MIN_VALUE,8);
switch (t.length()) {
case 1:
sx = "10000"+t;
break;
case 2:
sx = "1000"+t;
break;
case 3:
sx = "100"+t;
break;
case 4:
sx = "10"+t;
break;
case 5:
sx = "1"+t;
break;
}
}
else
sx = Integer.toString((int)x,8);
return printOFormat(sx);
}
/**
* Format method for the o conversion character and
* long argument.
*
* For o format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. The '#' flag character means that the
* output begins with a leading 0 and the precision
* is increased by 1.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear. Padding is with leading 0s.
* @param x the long to format.
* @return the formatted String.
*/
private String printOFormat(long x) {
String sx=null;
if (x == Long.MIN_VALUE)
sx = "1000000000000000000000";
else if (x < 0) {
String t = Long.toString(
(~(-x-1))^Long.MIN_VALUE,8);
switch (t.length()) {
case 1:
sx = "100000000000000000000"+t;
break;
case 2:
sx = "10000000000000000000"+t;
break;
case 3:
sx = "1000000000000000000"+t;
break;
case 4:
sx = "100000000000000000"+t;
break;
case 5:
sx = "10000000000000000"+t;
break;
case 6:
sx = "1000000000000000"+t;
break;
case 7:
sx = "100000000000000"+t;
break;
case 8:
sx = "10000000000000"+t;
break;
case 9:
sx = "1000000000000"+t;
break;
case 10:
sx = "100000000000"+t;
break;
case 11:
sx = "10000000000"+t;
break;
case 12:
sx = "1000000000"+t;
break;
case 13:
sx = "100000000"+t;
break;
case 14:
sx = "10000000"+t;
break;
case 15:
sx = "1000000"+t;
break;
case 16:
sx = "100000"+t;
break;
case 17:
sx = "10000"+t;
break;
case 18:
sx = "1000"+t;
break;
case 19:
sx = "100"+t;
break;
case 20:
sx = "10"+t;
break;
case 21:
sx = "1"+t;
break;
}
}
else
sx = Long.toString(x,8);
return printOFormat(sx);
}
/**
* Format method for the o conversion character and
* int argument.
*
* For o format, the flag character '-', means that
* the output should be left justified within the
* field. The default is to pad with blanks on the
* left. The '#' flag character means that the
* output begins with a leading 0 and the precision
* is increased by 1.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is to
* add no padding. Padding is with blanks by
* default.
*
* The precision, if set, is the minimum number of
* digits to appear. Padding is with leading 0s.
* @param x the int to format.
* @return the formatted String.
*/
private String printOFormat(int x) {
String sx=null;
if (x == Integer.MIN_VALUE)
sx = "20000000000";
else if (x < 0) {
String t = Integer.toString(
(~(-x-1))^Integer.MIN_VALUE,8);
switch (t.length()) {
case 1:
sx = "2000000000"+t;
break;
case 2:
sx = "200000000"+t;
break;
case 3:
sx = "20000000"+t;
break;
case 4:
sx = "2000000"+t;
break;
case 5:
sx = "200000"+t;
break;
case 6:
sx = "20000"+t;
break;
case 7:
sx = "2000"+t;
break;
case 8:
sx = "200"+t;
break;
case 9:
sx = "20"+t;
break;
case 10:
sx = "2"+t;
break;
case 11:
sx = "3"+t.substring(1);
break;
}
}
else
sx = Integer.toString(x,8);
return printOFormat(sx);
}
/**
* Utility method for formatting using the o
* conversion character.
* @param sx the String to format, the result of
* converting a short, int, or long to a
* String.
* @return the formatted String.
*/
private String printOFormat(String sx) {
int nLeadingZeros = 0;
int nBlanks = 0;
if (sx.equals("0")&&precisionSet&&precision==0)
sx="";
if (precisionSet)
nLeadingZeros = precision-sx.length();
if (alternateForm) nLeadingZeros++;
if (nLeadingZeros<0) nLeadingZeros=0;
if (fieldWidthSet)
nBlanks = fieldWidth-nLeadingZeros-sx.length();
if (nBlanks<0) nBlanks=0;
int n=nLeadingZeros+sx.length()+nBlanks;
char[] ca = new char[n];
int i;
if (leftJustify) {
for (i=0; i<nLeadingZeros; i++) ca[i]='0';
char[] csx = sx.toCharArray();
for (int j=0; j<csx.length; j++,i++)
ca[i] = csx[j];
for (int j=0; j<nBlanks; j++,i++) ca[i] = ' ';
}
else {
if (leadingZeros)
for (i=0; i<nBlanks; i++) ca[i]='0';
else
for (i=0; i<nBlanks; i++) ca[i]=' ';
for (int j=0; j<nLeadingZeros; j++,i++)
ca[i]='0';
char[] csx = sx.toCharArray();
for (int j=0; j<csx.length; j++,i++)
ca[i] = csx[j];
}
return new String(ca);
}
/**
* Format method for the c conversion character and
* char argument.
*
* The only flag character that affects c format is
* the '-', meaning that the output should be left
* justified within the field. The default is to
* pad with blanks on the left.
*
* The field width is treated as the minimum number
* of characters to be printed. Padding is with
* blanks by default. The default width is 1.
*
* The precision, if set, is ignored.
* @param x the char to format.
* @return the formatted String.
*/
private String printCFormat(char x) {
int nPrint = 1;
int width = fieldWidth;
if (!fieldWidthSet) width = nPrint;
char[] ca = new char[width];
int i=0;
if (leftJustify) {
ca[0] = x;
for (i=1; i<=width-nPrint; i++) ca[i]=' ';
}
else {
for (i=0; i<width-nPrint; i++) ca[i]=' ';
ca[i] = x;
}
return new String(ca);
}
/**
* Format method for the s conversion character and
* String argument.
*
* The only flag character that affects s format is
* the '-', meaning that the output should be left
* justified within the field. The default is to
* pad with blanks on the left.
*
* The field width is treated as the minimum number
* of characters to be printed. The default is the
* smaller of the number of characters in the the
* input and the precision. Padding is with blanks
* by default.
*
* The precision, if set, specifies the maximum
* number of characters to be printed from the
* string. A null digit string is treated
* as a 0. The default is not to set a maximum
* number of characters to be printed.
* @param x the String to format.
* @return the formatted String.
*/
private String printSFormat(String x) {
int nPrint = x.length();
int width = fieldWidth;
if (precisionSet && nPrint>precision)
nPrint=precision;
if (!fieldWidthSet) width = nPrint;
int n=0;
if (width>nPrint) n+=width-nPrint;
if (nPrint>=x.length()) n+= x.length();
else n+= nPrint;
char[] ca = new char[n];
int i=0;
if (leftJustify) {
if (nPrint>=x.length()) {
char[] csx = x.toCharArray();
for (i=0; i<x.length(); i++) ca[i]=csx[i];
}
else {
char[] csx =
x.substring(0,nPrint).toCharArray();
for (i=0; i<nPrint; i++) ca[i]=csx[i];
}
for (int j=0; j<width-nPrint; j++,i++)
ca[i]=' ';
}
else {
for (i=0; i<width-nPrint; i++) ca[i]=' ';
if (nPrint>=x.length()) {
char[] csx = x.toCharArray();
for (int j=0; j<x.length(); i++,j++)
ca[i]=csx[j];
}
else {
char[] csx =
x.substring(0,nPrint).toCharArray();
for (int j=0; j<nPrint; i++,j++)
ca[i]=csx[j];
}
}
return new String(ca);
}
/**
* Check for a conversion character. If it is
* there, store it.
* @param x the String to format.
* @return <code>true</code> if the conversion
* character is there, and
* <code>false</code> otherwise.
*/
private boolean setConversionCharacter() {
/* idfgGoxXeEcs */
boolean ret = false;
conversionCharacter='\0';
if (pos < fmt.length()) {
char c = fmt.charAt(pos);
if (c=='i'||c=='d'||c=='f'||c=='g'||c=='G'
|| c=='o' || c=='x' || c=='X' || c=='e'
|| c=='E' || c=='c' || c=='s' || c=='%') {
conversionCharacter = c;
pos++;
ret = true;
}
}
return ret;
}
/**
* Check for an h, l, or L in a format. An L is
* used to control the minimum number of digits
* in an exponent when using floating point
* formats. An l or h is used to control
* conversion of the input to a long or short,
* respectively, before formatting. If any of
* these is present, store them.
*/
private void setOptionalHL() {
optionalh=false;
optionall=false;
optionalL=false;
if (pos < fmt.length()) {
char c = fmt.charAt(pos);
if (c=='h') { optionalh=true; pos++; }
else if (c=='l') { optionall=true; pos++; }
else if (c=='L') { optionalL=true; pos++; }
}
}
/**
* Set the precision.
*/
private void setPrecision() {
int firstPos = pos;
precisionSet = false;
if (pos<fmt.length()&&fmt.charAt(pos)=='.') {
pos++;
if ((pos < fmt.length())
&& (fmt.charAt(pos)=='*')) {
pos++;
if (!setPrecisionArgPosition()) {
variablePrecision = true;
precisionSet = true;
}
return;
}
else {
while (pos < fmt.length()) {
char c = fmt.charAt(pos);
if (Character.isDigit(c)) pos++;
else break;
}
if (pos > firstPos+1) {
String sz = fmt.substring(firstPos+1,pos);
precision = Integer.parseInt(sz);
precisionSet = true;
}
}
}
}
/**
* Set the field width.
*/
private void setFieldWidth() {
int firstPos = pos;
fieldWidth = 0;
fieldWidthSet = false;
if ((pos < fmt.length())
&& (fmt.charAt(pos)=='*')) {
pos++;
if (!setFieldWidthArgPosition()) {
variableFieldWidth = true;
fieldWidthSet = true;
}
}
else {
while (pos < fmt.length()) {
char c = fmt.charAt(pos);
if (Character.isDigit(c)) pos++;
else break;
}
if (firstPos<pos && firstPos < fmt.length()) {
String sz = fmt.substring(firstPos,pos);
fieldWidth = Integer.parseInt(sz);
fieldWidthSet = true;
}
}
}
/**
* Store the digits <code>n</code> in %n$ forms.
*/
private void setArgPosition() {
int xPos;
for (xPos=pos; xPos<fmt.length(); xPos++) {
if (!Character.isDigit(fmt.charAt(xPos)))
break;
}
if (xPos>pos && xPos<fmt.length()) {
if (fmt.charAt(xPos)=='$') {
positionalSpecification = true;
argumentPosition=
Integer.parseInt(fmt.substring(pos,xPos));
pos=xPos+1;
}
}
}
/**
* Store the digits <code>n</code> in *n$ forms.
*/
private boolean setFieldWidthArgPosition() {
boolean ret=false;
int xPos;
for (xPos=pos; xPos<fmt.length(); xPos++) {
if (!Character.isDigit(fmt.charAt(xPos)))
break;
}
if (xPos>pos && xPos<fmt.length()) {
if (fmt.charAt(xPos)=='$') {
positionalFieldWidth = true;
argumentPositionForFieldWidth=
Integer.parseInt(fmt.substring(pos,xPos));
pos=xPos+1;
ret=true;
}
}
return ret;
}
/**
* Store the digits <code>n</code> in *n$ forms.
*/
private boolean setPrecisionArgPosition() {
boolean ret=false;
int xPos;
for (xPos=pos; xPos<fmt.length(); xPos++) {
if (!Character.isDigit(fmt.charAt(xPos)))
break;
}
if (xPos>pos && xPos<fmt.length()) {
if (fmt.charAt(xPos)=='$') {
positionalPrecision = true;
argumentPositionForPrecision=
Integer.parseInt(fmt.substring(pos,xPos));
pos=xPos+1;
ret=true;
}
}
return ret;
}
boolean isPositionalSpecification() {
return positionalSpecification;
}
int getArgumentPosition() { return argumentPosition; }
boolean isPositionalFieldWidth() {
return positionalFieldWidth;
}
int getArgumentPositionForFieldWidth() {
return argumentPositionForFieldWidth;
}
boolean isPositionalPrecision() {
return positionalPrecision;
}
int getArgumentPositionForPrecision() {
return argumentPositionForPrecision;
}
/**
* Set flag characters, one of '-+#0 or a space.
*/
private void setFlagCharacters() {
/* '-+ #0 */
thousands = false;
leftJustify = false;
leadingSign = false;
leadingSpace = false;
alternateForm = false;
leadingZeros = false;
for ( ; pos < fmt.length(); pos++) {
char c = fmt.charAt(pos);
if (c == '\'') thousands = true;
else if (c == '-') {
leftJustify = true;
leadingZeros = false;
}
else if (c == '+') {
leadingSign = true;
leadingSpace = false;
}
else if (c == ' ') {
if (!leadingSign) leadingSpace = true;
}
else if (c == '#') alternateForm = true;
else if (c == '0') {
if (!leftJustify) leadingZeros = true;
}
else break;
}
}
/**
* The integer portion of the result of a decimal
* conversion (i, d, u, f, g, or G) will be
* formatted with thousands' grouping characters.
* For other conversions the flag is ignored.
*/
private boolean thousands = false;
/**
* The result of the conversion will be
* left-justified within the field.
*/
private boolean leftJustify = false;
/**
* The result of a signed conversion will always
* begin with a sign (+ or -).
*/
private boolean leadingSign = false;
/**
* Flag indicating that left padding with spaces is
* specified.
*/
private boolean leadingSpace = false;
/**
* For an o conversion, increase the precision to
* force the first digit of the result to be a
* zero. For x (or X) conversions, a non-zero
* result will have 0x (or 0X) prepended to it.
* For e, E, f, g, or G conversions, the result
* will always contain a radix character, even if
* no digits follow the point. For g and G
* conversions, trailing zeros will not be removed
* from the result.
*/
private boolean alternateForm = false;
/**
* Flag indicating that left padding with zeroes is
* specified.
*/
private boolean leadingZeros = false;
/**
* Flag indicating that the field width is *.
*/
private boolean variableFieldWidth = false;
/**
* If the converted value has fewer bytes than the
* field width, it will be padded with spaces or
* zeroes.
*/
private int fieldWidth = 0;
/**
* Flag indicating whether or not the field width
* has been set.
*/
private boolean fieldWidthSet = false;
/**
* The minimum number of digits to appear for the
* d, i, o, u, x, or X conversions. The number of
* digits to appear after the radix character for
* the e, E, and f conversions. The maximum number
* of significant digits for the g and G
* conversions. The maximum number of bytes to be
* printed from a string in s and S conversions.
*/
private int precision = 0;
/** Default precision. */
private final static int defaultDigits=6;
/**
* Flag indicating that the precision is *.
*/
private boolean variablePrecision = false;
/**
* Flag indicating whether or not the precision has
* been set.
*/
private boolean precisionSet = false;
/*
*/
private boolean positionalSpecification=false;
private int argumentPosition=0;
private boolean positionalFieldWidth=false;
private int argumentPositionForFieldWidth=0;
private boolean positionalPrecision=false;
private int argumentPositionForPrecision=0;
/**
* Flag specifying that a following d, i, o, u, x,
* or X conversion character applies to a type
* short int.
*/
private boolean optionalh = false;
/**
* Flag specifying that a following d, i, o, u, x,
* or X conversion character applies to a type lont
* int argument.
*/
private boolean optionall = false;
/**
* Flag specifying that a following e, E, f, g, or
* G conversion character applies to a type double
* argument. This is a noop in Java.
*/
private boolean optionalL = false;
/** Control string type. */
private char conversionCharacter = '\0';
/**
* Position within the control string. Used by
* the constructor.
*/
private int pos = 0;
/** Literal or control format string. */
private String fmt;
}
/** Vector of control strings and format literals. */
private Vector vFmt = new Vector();
/** Character position. Used by the constructor. */
private int cPos=0;
/** Character position. Used by the constructor. */
private DecimalFormatSymbols dfs=null;
}
include $(pwre_dir_symbols)
local_java_sources := \
Glow.java,\
PrintfFormat.java,\
GlowCFormat.java,\
GlowEvent.java,\
GlowPointX.java,\
GlowDimension.java,\
GrowApplIfc.java,\
GlowColorRgb.java,\
GlowColor.java,\
GlowDrawIfc.java,\
GlowDraw.java,\
GrowNodeIfc.java,\
GlowArrayElem.java,\
GrowCtxIfc.java,\
GrowCmn.java,\
GlowTransform.java,\
GlowPoint.java,\
GlowNodeClass.java,\
GlowNodeGroup.java,\
GlowConClass.java,\
GlowConPoint.java,\
GrowNode.java,\
GrowGroup.java,\
GrowRect.java,\
GrowArc.java,\
GrowLine.java,\
GrowPolyline.java,\
GrowText.java,\
GrowAnnot.java,\
GlowVector.java,\
GrowCtx.java,\
DynParsedAttrName.java,\
GraphLocalDb.java,\
GraphIfc.java,\
Dyn.java,\
GraphApplIfc.java,\
Graph.java,\
GrowFrame.java
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
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