Commit df2e6c43 authored by Claes Sjofors's avatar Claes Sjofors

jopg fourth commit

parent 5431ccb1
......@@ -2386,7 +2386,7 @@ static void gdh_crr_insert_cb( void *ctx, void *parent_node,
case navc_eItemType_Crossref:
if ( strcmp( crrctx->buf, "") != 0) {
strcat( crrctx->buf, "\n");
crrctx->len++;x
crrctx->len++;
}
switch ( write) {
case 0:
......
......@@ -48,7 +48,7 @@ import java.awt.event.*;
import java.net.*;
import java.applet.*;
public class FlowFrame extends JFrame implements JopUtilityIfc {
public class FlowFrame extends JFrame implements JopUtilityIfc, GdhApplIfc {
JScrollPane scrollPane;
JPanel contentPane;
JMenuBar menuBar;
......@@ -62,7 +62,7 @@ public class FlowFrame extends JFrame implements JopUtilityIfc {
PwrtObjid utilityObjid;
public FlowFrame( PwrtObjid oid, String center) {
engine = new JopEngine( 1000, (Object)this);
engine = new JopEngine( 1000, this);
session = new JopSession( engine, (Object)this);
session.addUtility( this);
root = (Object) this;
......@@ -352,6 +352,11 @@ public class FlowFrame extends JFrame implements JopUtilityIfc {
closeFlow();
}
}
// GdhApplIfc function
public String getPwrHost() {
return (String)null;
}
}
......
......@@ -56,7 +56,7 @@ import java.applet.Applet;
*strings.
*/
public class HistSearch extends JFrame implements ActionListener
public class HistSearch extends JFrame implements ActionListener, GdhApplIfc
{
public JopEngine engine;
......@@ -161,7 +161,7 @@ public class HistSearch extends JFrame implements ActionListener
//Default constructor
public HistSearch(){
engine = new JopEngine( 1000, (Object)this);
engine = new JopEngine( 1000, this);
session = new JopSession( engine, (Object)this);
root = (Object) this;
setup();
......@@ -744,6 +744,10 @@ public class HistSearch extends JFrame implements ActionListener
}
// GdhApplIfc function
public String getPwrHost() {
return (String)null;
}
//Testprogram
public static void main(String args[]){
......
......@@ -49,9 +49,10 @@ import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.applet.*;
import java.net.*;
import jpwr.rt.*;
public class JopApplet extends JApplet
public class JopApplet extends JApplet implements GdhApplIfc
{
public JopSession session;
public JopEngine engine;
......@@ -66,7 +67,7 @@ public class JopApplet extends JApplet
pwrHost = getParameter( "pwrhost");
System.out.println( "Parameter pwrhost: " + pwrHost);
engine = new JopEngine(1000, (Object)this);
engine = new JopEngine(1000, this);
session = new JopSession( engine, (Object)this);
if ( instance != null && instance.length() != 0) {
// Substitutes for åäö because of mozilla...
......@@ -93,6 +94,10 @@ public class JopApplet extends JApplet
return null;
}
public String getPwrHost() {
if ( pwrHost == null) {
URL url = getDocumentBase();
pwrHost = url.getHost();
}
return pwrHost;
}
}
......@@ -49,7 +49,7 @@ import javax.swing.border.*;
import java.net.URL;
import jpwr.rt.*;
public class JopCurve extends JFrame
public class JopCurve extends JFrame implements GdhApplIfc
{
static final int COLUMN_COLOR = 0;
......@@ -94,7 +94,7 @@ public class JopCurve extends JFrame
this.caller = caller;
this.gcd = gcd;
engine = new JopEngine( 1000, (Object)this);
engine = new JopEngine( 1000, this);
session = new JopSession( engine, (Object)this);
init();
......@@ -857,5 +857,10 @@ public class JopCurve extends JFrame
}
// GdhApplIfc function
public String getPwrHost() {
return (String)null;
}
}
......@@ -67,7 +67,7 @@ public class JopEngine implements ActionListener {
boolean closingDown = false;
String instance = null;
public JopEngine( int scantime, Object root) {
public JopEngine( int scantime, GdhApplIfc root) {
scanTime = scantime;
animationScanTime = scantime;
//updateVector = new Vector<Object>( 50, 50);
......
......@@ -50,7 +50,7 @@ import java.awt.event.*;
import java.awt.*;
import jpwr.rt.*;
public class JopFrame extends JFrame
public class JopFrame extends JFrame implements GdhApplIfc
{
public JopSession session;
public JopEngine engine;
......@@ -81,7 +81,7 @@ public class JopFrame extends JFrame
}
private void jbInit() throws Exception {
engine = new JopEngine(1000, (Object)this);
engine = new JopEngine(1000, this);
session = new JopSession( engine, (Object) this);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
setDefaultCloseOperation( DISPOSE_ON_CLOSE);
......@@ -98,6 +98,10 @@ public class JopFrame extends JFrame
}
}
// GdhApplIfc function
public String getPwrHost() {
return (String)null;
}
}
......
......@@ -44,7 +44,7 @@ import java.awt.font.*;
import javax.swing.*;
import java.awt.event.*;
public class JopLoginApplet extends JApplet {
public class JopLoginApplet extends JApplet implements GdhApplIfc {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
BorderLayout borderLayout3 = new BorderLayout();
......@@ -172,4 +172,8 @@ public class JopLoginApplet extends JApplet {
textPassword.setText("");
}
}
public String getPwrHost() {
return new String("");
}
}
......@@ -48,7 +48,7 @@ import java.awt.event.*;
import java.net.*;
import java.applet.*;
public class JopOpWindowFrame extends JFrame {
public class JopOpWindowFrame extends JFrame implements GdhApplIfc {
JScrollPane scrollPane;
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
......@@ -60,7 +60,7 @@ public class JopOpWindowFrame extends JFrame {
PwrtObjid utilityObjid;
public JopOpWindowFrame() {
engine = new JopEngine( 1000, (Object)this);
engine = new JopEngine( 1000, this);
session = new JopSession( engine, (Object)this);
root = (Object) this;
localPanel = new JopOpWindow( session, (Object)this);
......@@ -98,6 +98,11 @@ public class JopOpWindowFrame extends JFrame {
// System.exit(0);
}
}
// GdhApplIfc function
public String getPwrHost() {
return (String)null;
}
}
......@@ -197,6 +197,9 @@ public class JopSessionRep implements JopSessionIfc {
if ( gcret.value > 0)
suffix = Integer.toString(gcret.value);
}
if (sret.str.startsWith("$"))
name = "pwr_c_" + sret.str.toLowerCase().substring(1) + ".pwg"; // Pwg test
else
name = "pwr_c_" + sret.str.toLowerCase() + ".pwg"; // Pwg test
int pwgidx = name.lastIndexOf( ".pwg");
if ( pwgidx == -1) {
......
......@@ -78,7 +78,7 @@ public class JopSpider {
public JopSpider( int op_qcom_qix) {
JopSpider.op_qcom_qix = op_qcom_qix;
engine = new JopEngine( 1000, (Object)null);
engine = new JopEngine( 1000, (GdhApplIfc)null);
session = new JopSession( engine, (Object)this);
// Attatch to qcom
......@@ -343,14 +343,22 @@ System.out.println( "qcom put finished");
}
}
if ( !classGraph) {
if ( ! cli.qualifierFound("cli_arg2")) {
System.out.println("Syntax error");
return 0;
if ( cli.qualifierFound("/FILE")) {
frameName = cli.getQualValue("/FILE");
if ( frameName.indexOf(".pwg") == -1)
frameName = frameName + ".pwg";
}
else if ( cli.qualifierFound("cli_arg2")) {
frameName = cli.getQualValue("cli_arg2").toLowerCase();
frameName = frameName.substring(0,1).toUpperCase() +
frameName.substring(1);
}
else {
System.out.println("Syntax error");
return 0;
}
System.out.println( "Open frame " + frameName);
}
session.openGraphFrame( frameName, instanceValue, scrollbar, classGraph);
......
......@@ -92,7 +92,7 @@ public class JopSpiderFrame {
catch(Exception e) {
e.printStackTrace();
}
new Gdh( (Object)null);
new Gdh( (GdhApplIfc)null);
new JopSpiderFrame("Frame");
}
......
......@@ -50,7 +50,7 @@ import javax.swing.Timer;
import java.net.URL;
import jpwr.rt.*;
public class JopXttFast implements ActionListener, JopCurveIfc {
public class JopXttFast implements ActionListener, JopCurveIfc, GdhApplIfc {
public static final int XTT_FAST_MAX = 20;
public static final int FAST_CURVES = 10;
......@@ -89,7 +89,7 @@ public class JopXttFast implements ActionListener, JopCurveIfc {
boolean oldNewCurve;
public JopXttFast( String fastObject) {
engine = new JopEngine( 1000, (Object)this);
engine = new JopEngine( 1000, this);
session = new JopSession( engine, (Object)this);
this.fastObject = fastObject;
......@@ -315,6 +315,11 @@ public class JopXttFast implements ActionListener, JopCurveIfc {
}
}
// GdhApplIfc function
public String getPwrHost() {
return (String)null;
}
public static void main(String[] args)
{
......
......@@ -53,7 +53,7 @@ import jpwr.rt.*;
*@author JN3920
*@created November 12, 2002
*/
public class JopXttFrame extends JFrame
public class JopXttFrame extends JFrame implements GdhApplIfc
{
JopSession session;
JopEngine engine;
......@@ -62,7 +62,7 @@ public class JopXttFrame extends JFrame
/** Description of the Method */
public JopXttFrame()
{
engine = new JopEngine( 1000, (Object)this);
engine = new JopEngine( 1000, this);
session = new JopSession( engine, (Object)this);
root = (Object) this;
init((PwrtObjid)null);
......@@ -103,6 +103,11 @@ public class JopXttFrame extends JFrame
}
}
// GdhApplIfc function
public String getPwrHost() {
return (String)null;
}
public static void main(String[] args)
{
boolean debug = false;
......
......@@ -50,7 +50,7 @@ import javax.swing.Timer;
import java.net.URL;
import jpwr.rt.*;
public class JopXttTrend implements ActionListener, JopCurveIfc {
public class JopXttTrend implements ActionListener, JopCurveIfc, GdhApplIfc {
public static final int XTT_TREND_MAX = 20;
JopSession session;
......@@ -109,7 +109,7 @@ public class JopXttTrend implements ActionListener, JopCurveIfc {
}
public JopXttTrend( String[] trendList) {
engine = new JopEngine( 1000, (Object)this);
engine = new JopEngine( 1000, this);
session = new JopSession( engine, (Object)this);
init( trendList);
......@@ -663,6 +663,10 @@ public class JopXttTrend implements ActionListener, JopCurveIfc {
}
}
// GdhApplIfc function
public String getPwrHost() {
return (String)null;
}
public static void main(String[] args)
{
......
......@@ -59,8 +59,7 @@ import java.awt.event.*;
*@author JN3920
*@created November 12, 2002
*/
public class MhFrame extends JFrame
{
public class MhFrame extends JFrame implements GdhApplIfc {
JopSession session;
JopEngine engine;
XttTree xttTree;
......@@ -114,7 +113,7 @@ public class MhFrame extends JFrame
public MhFrame()
{
engine = new JopEngine( 1000, (Object)this);
engine = new JopEngine( 1000, this);
session = new JopSession( engine, (Object)this);
root = (Object) this;
init();
......@@ -191,6 +190,11 @@ public class MhFrame extends JFrame
*/
this.labelMessage.setText(mess);
}
public String getPwrHost() {
return new String("");
}
public static void main(String[] args)
{
boolean debug = false;
......
This diff is collapsed.
......@@ -39,6 +39,7 @@ package jpwr.jopg;
public class DynParsedAttrName {
public String name;
public String tname;
public boolean inverted;
public int elements;
public int type;
......
......@@ -47,6 +47,7 @@ public class Glow {
public static final int DRAW_FONT_SIZE = 9;
public static final int DRAWOFFSET = 2;
public static final int TREND_MAX_CURVES = 11;
public static final int TABLE_MAX_COL = 30;
public static final int eType_Boolean = 0;
public static final int eType_Int = 1;
......@@ -186,17 +187,16 @@ public class Glow {
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 = 3;
public static final int eConType_StepDiv = 4;
public static final int eConType_StepConv = 5;
public static final int eConType_TransDiv = 6;
public static final int eConType_TransConv = 7;
public static final int eConType_StraightOneArrow = 8;
public static final int eConType_Reference = 9;
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 eCorner_Rounded = 0;
public static final int eCorner_Right = 1;
public static final int eVisible_Full = 0;
public static final int eVisible_Partial = 1;
......
/*
* 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 GlowArc extends GlowArrayElem {
GrowCmn cmn;
GlowPoint ll;
GlowPoint ur;
int draw_type;
int angle1;
int angle2;
int line_width;
int display_level;
int fill;
public GlowArc(GrowCmn cmn) {
this.cmn = cmn;
ll = new GlowPoint();
ur = new GlowPoint();
}
public int type() {
return Glow.eObjectType_Arc;
}
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 = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowArc : " + line);
switch ( key) {
case Glow.eSave_Arc:
break;
case Glow.eSave_Arc_draw_type:
draw_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arc_angle1:
angle1 = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arc_angle2:
angle2 = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arc_line_width:
line_width = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arc_fill:
fill = Integer.valueOf(token.nextToken());
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 void draw( int hightlight, int hot) {
if ( cmn.nodraw != 0)
return;
int ll_x, ll_y, ur_x, ur_y;
ll_x = (int)(ll.x * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
ll_y = (int)(ll.y * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
ur_x = (int)(ur.x * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
ur_y = (int)(ur.y * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
if ( ll_x == ur_x && ll_y == ur_y)
return;
int 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);
cmn.gdraw.arc( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, angle1, angle2, draw_type, idx, hightlight);
}
public void draw_shadow( int border, int shadow, int highlight, int hot) {
if ( cmn.nodraw != 0)
return;
int ll_x, ll_y, ur_x, ur_y;
ll_x = (int)(ll.x * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
ll_y = (int)(ll.y * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
ur_x = (int)(ur.x * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
ur_y = (int)(ur.y * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
int 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 ish = 1;
int offs = border;
if ( shadow != 0 && idx > 2) {
if ( angle1 == 0) {
cmn.gdraw.arc( ll_x + idx/2 - idx + offs,
ll_y + idx/2 - idx + offs,
ur_x - ll_x + idx - offs*2, ur_y - ll_y + idx - offs*2, angle1 + 45, angle2 - 45,
GlowColor.shift_drawtype( draw_type, -2, null), ish-1, highlight);
cmn.gdraw.arc( ll_x + idx/2 - idx + offs,
ll_y + idx/2 - idx + offs,
ur_x - ll_x + idx - offs*2, ur_y - ll_y + idx - offs*2, angle1, angle2 - 45,
GlowColor.shift_drawtype( draw_type, 2, null), ish-1, highlight);
cmn.gdraw.arc( ll_x + idx/2 - offs,
ll_y + idx/2 - offs,
Math.max( 0, ur_x - ll_x - idx + offs*2), Math.max( 0, ur_y - ll_y - idx + offs*2), angle1 + 45, angle2 - 45,
GlowColor.shift_drawtype( draw_type, 2, null), ish-1, highlight);
cmn.gdraw.arc( ll_x + idx/2 - offs,
ll_y + idx/2 - offs,
Math.max( 0, ur_x - ll_x - idx + offs*2), Math.max( 0, ur_y - ll_y - idx + offs*2), angle1, angle2 - 45,
GlowColor.shift_drawtype( draw_type, -2, null), ish-1, highlight);
}
else if ( angle1 == 90) {
cmn.gdraw.arc( ll_x + idx/2 - idx + offs,
ll_y + idx/2 - idx + offs,
ur_x - ll_x + idx - offs*2, ur_y - ll_y + idx - offs*2, angle1, angle2,
GlowColor.shift_drawtype( draw_type, -2, null), ish-1, highlight);
cmn.gdraw.arc( ll_x + idx/2 - offs,
ll_y + idx/2 - offs,
Math.max( 0, ur_x - ll_x - idx + offs*2), Math.max( 0, ur_y - ll_y - idx + offs*2), angle1, angle2,
GlowColor.shift_drawtype( draw_type, 2, null), ish-1, highlight);
}
else if ( angle1 == 180) {
cmn.gdraw.arc( ll_x + idx/2 - idx + offs,
ll_y + idx/2 - idx + offs,
ur_x - ll_x + idx - offs*2, ur_y - ll_y + idx - offs*2, angle1 + 45, angle2 - 45,
GlowColor.shift_drawtype( draw_type, 2, null), ish-1, highlight);
cmn.gdraw.arc( ll_x + idx/2 - idx + offs,
ll_y + idx/2 - idx + offs,
ur_x - ll_x + idx - offs*2, ur_y - ll_y + idx - offs*2, angle1, angle2 - 45,
GlowColor.shift_drawtype( draw_type, -2, null), ish-1, highlight);
cmn.gdraw.arc( ll_x + idx/2 - offs,
ll_y + idx/2 - offs,
Math.max( 0, ur_x - ll_x - idx + offs*2), Math.max( 0, ur_y - ll_y - idx + offs*2), angle1 + 45, angle2 - 45,
GlowColor.shift_drawtype( draw_type, -2, null), ish-1, highlight);
cmn.gdraw.arc( ll_x + idx/2 - offs,
ll_y + idx/2 - offs,
Math.max( 0, ur_x - ll_x - idx + offs*2), Math.max( 0, ur_y - ll_y - idx + offs*2), angle1, angle2 - 45,
GlowColor.shift_drawtype( draw_type, 2, null), ish-1, highlight);
}
else if ( angle1 == 270) {
cmn.gdraw.arc( ll_x + idx/2 - idx + offs,
ll_y + idx/2 - idx + offs,
ur_x - ll_x + idx - offs*2, ur_y - ll_y + idx - offs*2, angle1, angle2,
GlowColor.shift_drawtype( draw_type, 2, null), ish-1, highlight);
cmn.gdraw.arc( ll_x + idx/2 - offs,
ll_y + idx/2 - offs,
Math.max( 0, ur_x - ll_x - idx + offs*2), Math.max( 0, ur_y - ll_y - idx + offs*2), angle1, angle2,
GlowColor.shift_drawtype( draw_type, -2, null), ish-1, highlight);
}
}
if ( border != 0) {
cmn.gdraw.arc( ll_x + idx/2 - idx,
ll_y + idx/2 - idx,
ur_x - ll_x + idx, ur_y - ll_y + idx, angle1, angle2,
Glow.eDrawType_Line, 0, highlight);
if ( idx > 0)
cmn.gdraw.arc( ll_x + idx/2,
ll_y + idx/2,
Math.max( 0, ur_x - ll_x - idx), Math.max( 0, ur_y - ll_y - idx), angle1, angle2,
Glow.eDrawType_Line, 0, highlight);
}
}
}
......@@ -45,10 +45,11 @@ public class GlowArrayElem {
public int eventHandler(GlowEvent e, double fx, double fy) {return 0;}
public Object getUserData() { return null;}
public void get_borders( GlowTransform t, GlowGeometry g) {}
public int get_background_object_limits(GlowTransform t, int type, double x, double y, GlowBackgroundObject b) {return 0;}
public int get_background_object_limits(GlowTransform t, int type, double x, double y, Object b) {return 0;}
public int getClassDynType1() { return 0;}
public int getClassDynType2() { return 0;}
public int getClassActionType1() { return 0;}
public int getClassActionType2() { return 0;}
public int getClassCycle() { return 0;}
public void setColorInverse(int color_inverse) {}
}
/*
* 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 GlowArrow extends GlowArrayElem {
GrowCmn cmn;
GlowPoint p1;
GlowPoint p2;
GlowPoint p_dest;
int draw_type;
int line_width;
double arrow_width;
double arrow_length;
public GlowArrow(GrowCmn cmn) {
this.cmn = cmn;
p1 = new GlowPoint();
p2 = new GlowPoint();
p_dest = new GlowPoint();
}
public int type() {
return Glow.eObjectType_Arrow;
}
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 = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "Glowrrow : " + line);
switch ( key) {
case Glow.eSave_Arrow:
break;
case Glow.eSave_Arrow_draw_type:
draw_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arrow_line_width:
line_width = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arrow_arrow_width:
arrow_width = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Arrow_arrow_length:
arrow_length = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Arrow_p1:
p1.open( reader);
break;
case Glow.eSave_Arrow_p2:
p2.open( reader);
break;
case Glow.eSave_Arrow_p_dest:
p_dest.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowArrow");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowArrow");
}
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
}
public void draw( int hightlight, int hot) {
}
}
......@@ -130,7 +130,7 @@ public class GlowColor {
int base_drawtype;
int drawtype;
if ( node != null && ((GrowNode)node).color_inverse != 0)
if ( node != null && ((GlowColorNode)node).getColorInverse() != 0)
shift = - shift;
if ( dt >= 20) {
......@@ -159,8 +159,8 @@ public class GlowColor {
int intensity = 0;
if ( node != null) {
lightness = ((GrowNode)node).color_lightness;
intensity = ((GrowNode)node).color_intensity;
lightness = ((GlowColorNode)node).getColorLightness();
intensity = ((GlowColorNode)node).getColorIntensity();
}
if ( highlight != 0 && highlight_disabled == 0) {
......@@ -171,8 +171,8 @@ public class GlowColor {
drawtype = highlight_drawtype;
}
else {
if ( node != null && ((GrowNode)node).color_tone != Glow.eDrawTone_No) {
int tone = ((GrowNode)node).color_tone;
if ( node != null && ((GlowColorNode)node).getColorTone() != Glow.eDrawTone_No) {
int tone = ((GlowColorNode)node).getColorTone();
if ( local_drawtype > 30) {
if ( tone == Glow.eDrawTone_LightGrayHighSaturation)
......@@ -206,14 +206,14 @@ public class GlowColor {
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 == 1 && ((GlowColorNode)node).getFillDrawtype() != Glow.eDrawType_No) {
drawtype = ((GlowColorNode)node).getFillDrawtype();
}
else if ( node != null && fill == 2 && ((GrowNode)node).text_drawtype != Glow.eDrawType_No) {
drawtype = ((GrowNode)node).text_drawtype;
else if ( node != null && fill == 2 && ((GlowColorNode)node).getTextDrawtype() != Glow.eDrawType_No) {
drawtype = ((GlowColorNode)node).getTextDrawtype();
}
else if ( node != null && fill == 0 && ((GrowNode)node).draw_type != Glow.eDrawType_No) {
drawtype = ((GrowNode)node).draw_type;
else if ( node != null && fill == 0 && ((GlowColorNode)node).getDrawtype() != Glow.eDrawType_No) {
drawtype = ((GlowColorNode)node).getDrawtype();
}
else
drawtype = local_drawtype;
......@@ -239,10 +239,10 @@ public class GlowColor {
drawtype = ( Glow.eDrawType_Color41 + incr);
}
}
if ( node != null && ((GrowNode)node).color_shift != 0) {
if ( node != null && ((GlowColorNode)node).getColorShift() != 0) {
if ( drawtype >= 60) {
incr = ((GrowNode)node).color_shift -
((GrowNode)node).color_shift / 8 * 8;
incr = ((GlowColorNode)node).getColorShift() -
((GlowColorNode)node).getColorShift() / 8 * 8;
if ( incr < 0)
incr += 8;
......@@ -252,11 +252,11 @@ public class GlowColor {
drawtype = incr;
}
}
if ( node != null && ((GrowNode)node).color_inverse != 0) {
if ( node != null && ((GlowColorNode)node).getColorInverse() != 0) {
if ( drawtype >= 30)
drawtype = drawtype + 10 - 2 * (drawtype % 10) - 1;
}
if ( node != null && ((GrowNode)node).dimmed != 0) {
if ( node != null && ((GlowColorNode)node).getDimmed() != 0) {
if ( drawtype == 0)
drawtype = 25;
else if ( 26 <= drawtype && drawtype <= 29)
......
/*
* 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 interface GlowColorNode {
public int getColorInverse();
public int getColorLightness();
public int getColorIntensity();
public int getColorShift();
public int getColorTone();
public int getFillDrawtype();
public int getTextDrawtype();
public int getDrawtype();
public int getDimmed();
}
\ 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 GlowCon extends GlowArrayElem {
public static final int MAX_POINT = 8;
GrowCmn cmn;
String cc_name;
GlowConClass cc;
String c_name;
double x_right;
double x_left;
double y_high;
double y_low;
GrowNode dest_node;
GrowNode source_node;
int dest_conpoint;
int source_conpoint;
int source_direction;
int dest_direction;
int p_num;
int l_num;
int a_num;
int arrow_num;
int ref_num;
double[] point_x = new double[MAX_POINT];
double[] point_y = new double[MAX_POINT];
Vector<GlowArrayElem> line_a = new Vector<GlowArrayElem>();
Vector<GlowArrayElem> arc_a = new Vector<GlowArrayElem>();
Vector<GlowArrayElem> arrow_a = new Vector<GlowArrayElem>();
Vector<GlowArrayElem> ref_a = new Vector<GlowArrayElem>();
int temporary_ref;
int source_ref_cnt;
int dest_ref_cnt;
String trace_object;
String trace_attribute;
int trace_attr_type;
int border;
int shadow;
int highlight;
int hot;
public GlowCon(GrowCmn cmn) {
this.cmn = cmn;
}
public int type() {
return Glow.eObjectType_Con;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
String name;
int i;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowCon : " + line);
switch ( key) {
case Glow.eSave_Con:
break;
case Glow.eSave_Con_cc:
cc_name = token.nextToken();
cc = (GlowConClass)cmn.ctx.get_conclass_from_name( cc_name);
break;
case Glow.eSave_Con_c_name:
if ( token.hasMoreTokens())
c_name = token.nextToken();
break;
case Glow.eSave_Con_x_right:
x_right = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Con_x_left:
x_left = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Con_y_high:
y_high = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Con_y_low:
y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_Con_dest_node:
if ( token.hasMoreTokens()) {
name = token.nextToken();
dest_node = (GrowNode) cmn.ctx.get_node_from_name( name);
if ( dest_node == null)
System.out.println("GlowCon:dest_node not found");
}
break;
case Glow.eSave_Con_source_node:
if ( token.hasMoreTokens()) {
name = token.nextToken();
source_node = (GrowNode) cmn.ctx.get_node_from_name( name);
if ( source_node == null)
System.out.println("GlowCon:source_node not found");
}
break;
case Glow.eSave_Con_dest_conpoint:
dest_conpoint = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_source_conpoint:
source_conpoint = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_dest_direction:
dest_direction = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_source_direction:
source_direction = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_line_a:
cmn.ctx.openVector( reader, cmn, line_a);
break;
case Glow.eSave_Con_arc_a:
cmn.ctx.openVector( reader, cmn, arc_a);
break;
case Glow.eSave_Con_arrow_a:
cmn.ctx.openVector( reader, cmn, arrow_a);
break;
case Glow.eSave_Con_ref_a:
cmn.ctx.openVector( reader, cmn, ref_a);
break;
case Glow.eSave_Con_p_num:
p_num = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_l_num:
l_num = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_a_num:
a_num = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_arrow_num:
arrow_num = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_ref_num:
ref_num = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_point_x:
for ( i = 0; i < p_num; i++) {
reader.readLine();
point_x[i] = new Double(line).doubleValue();
}
break;
case Glow.eSave_Con_point_y:
for ( i = 0; i < p_num; i++) {
reader.readLine();
point_y[i] = new Double(line).doubleValue();
}
break;
case Glow.eSave_Con_source_ref_cnt:
source_ref_cnt = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_dest_ref_cnt:
dest_ref_cnt = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_trace_object:
if ( token.hasMoreTokens())
trace_object = token.nextToken();
break;
case Glow.eSave_Con_trace_attribute:
if ( token.hasMoreTokens())
trace_attribute = token.nextToken();
break;
case Glow.eSave_Con_trace_attr_type:
trace_attr_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_temporary_ref:
temporary_ref = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_border:
border = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Con_shadow:
shadow = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowCon");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowCon");
}
}
public void draw() {
draw(null, highlight, hot, null, null);
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
if ( cmn.nodraw != 0)
return;
int tmp;
int i;
if ( temporary_ref != 0 || cc.con_type == Glow.eConType_Reference) {
// ref_a.draw( w, &cc->zero, highlight, hot, NULL);
}
else {
for ( i = 0; i < line_a.size(); i++)
((GlowLine)line_a.get(i)).draw( highlight, hot);
for ( i = 0; i < arc_a.size(); i++)
((GlowArc)arc_a.get(i)).draw( highlight, hot);
// arrow_a.draw( highlight, hot);
if ( (shadow != 0 || border != 0) && cc.con_type == Glow.eConType_Routed && cc.corner == Glow.eCorner_Rounded) {
for ( i = 0; i < line_a.size(); i++)
((GlowLine)line_a.get(i)).draw_shadow( border, shadow, highlight, hot);
for ( i = 0; i < arc_a.size(); i++)
((GlowArc)arc_a.get(i)).draw_shadow( border, shadow, highlight, hot);
}
}
}
}
......@@ -39,13 +39,80 @@ import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GlowConClass {
public class GlowConClass extends GlowArrayElem {
GrowCmn cmn;
String cc_name;
int con_type;
int corner;
int draw_type;
int line_width;
double arrow_width;
double arrow_length;
double round_corner_amount;
int group;
public GlowConClass(GrowCmn cmn) {
this.cmn = cmn;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
String name;
int i;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowConClass : " + line);
switch ( key) {
case Glow.eSave_ConClass:
break;
case Glow.eSave_ConClass_cc_name:
if ( token.hasMoreTokens())
cc_name = token.nextToken();
break;
case Glow.eSave_ConClass_con_type:
con_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_ConClass_corner:
corner = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_ConClass_draw_type:
draw_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_ConClass_line_width:
line_width = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_ConClass_arrow_width:
arrow_width = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_ConClass_arrow_length:
arrow_length = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_ConClass_round_corner_amount:
round_corner_amount = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_ConClass_group:
group = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GlowConClass");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GlowConClass");
}
}
}
......@@ -50,7 +50,7 @@ public class GlowConPoint extends GlowArrayElem {
public GlowConPoint(GrowCmn cmn) {
this.cmn = cmn;
p = new GlowPoint(cmn);
p = new GlowPoint();
trf = new GlowTransform();
}
......@@ -62,23 +62,23 @@ public class GlowConPoint extends GlowArrayElem {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key =Integer.valueOf(token.nextToken());
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();
number =Integer.valueOf(token.nextToken());
break;
case Glow.eSave_ConPoint_direction:
number = new Integer(token.nextToken()).intValue();
number =Integer.valueOf(token.nextToken());
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();
trace_attr_type =Integer.valueOf(token.nextToken());
break;
case Glow.eSave_ConPoint_trace_attribute:
if ( token.hasMoreTokens())
......
......@@ -60,6 +60,9 @@ public class GlowDraw implements GlowDrawIfc {
}
public void rect(int border, int fill, double x, double y, double width, double height) {
if ( nodraw)
return;
Rectangle2D r = new Rectangle2D.Double(x, y, width, height);
g2.setPaint(Color.black);
g2.setStroke(new BasicStroke(1));
......@@ -111,7 +114,7 @@ public class GlowDraw implements GlowDrawIfc {
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.setStroke(new BasicStroke(idx+1));
g2.draw(a);
}
......@@ -177,7 +180,7 @@ public class GlowDraw implements GlowDrawIfc {
dash = new float[] {(float)idx, (float)idx * 4, (float)idx * 8, (float)idx * 4};
break;
}
if ( dash == null)
if ( dash == null || idx == 0)
g2.setStroke(new BasicStroke(idx+1));
else
g2.setStroke( new BasicStroke((float)idx, BasicStroke.CAP_BUTT,
......@@ -466,7 +469,7 @@ public class GlowDraw implements GlowDrawIfc {
}
public int set_clip_rectangle( int x1, int y1, int x2, int y2) {
g2.setClip(new Rectangle2D.Float((float)x1, (float)y1, (float)x2, (float)y2));
g2.setClip(new Rectangle2D.Float((float)x1, (float)y1, (float)(x2-x1), (float)(y2-y1)));
return 1;
}
......
......@@ -41,7 +41,7 @@ public class GlowEvent {
public int type;
public double x;
public double y;
public GlowArrayElem object;
public Object object;
public int object_type;
public GlowEvent() {}
......
/*
* 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 GlowLine extends GlowArrayElem {
GrowCmn cmn;
GlowPoint p1;
GlowPoint p2;
int draw_type;
int line_width;
public GlowLine(GrowCmn cmn) {
this.cmn = cmn;
p1 = new GlowPoint();
p2 = new GlowPoint();
}
public int type() {
return Glow.eObjectType_Line;
}
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 = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowRect : " + line);
switch ( key) {
case Glow.eSave_Line:
break;
case Glow.eSave_Line_draw_type:
draw_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Line_line_width:
line_width = Integer.valueOf(token.nextToken());
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 void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
}
public void draw( int hightlight, int hot) {
if ( cmn.nodraw != 0)
return;
int p1_x, p1_y, p2_x, p2_y;
p1_x = (int)(p1.x * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
p1_y = (int)(p1.y * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
p2_x = (int)(p2.x * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
p2_y = (int)(p2.y * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
if ( p1_x == p2_x && p1_y == p2_y)
return;
int 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);
cmn.gdraw.line( p1_x, p1_y, p2_x, p2_y, draw_type, idx, hightlight);
}
public void draw_shadow( int border, int shadow, int hightlight, int hot) {
if ( cmn.nodraw != 0)
return;
int p1_x, p1_y, p2_x, p2_y;
p1_x = (int)(p1.x * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
p1_y = (int)(p1.y * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
p2_x = (int)(p2.x * cmn.mw.zoom_factor_x + 0.5) - cmn.mw.offset_x;
p2_y = (int)(p2.y * cmn.mw.zoom_factor_y + 0.5) - cmn.mw.offset_y;
if ( p1_x == p2_x && p1_y == p2_y)
return;
int 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 ish = 1;
int offs = border;
if ( shadow != 0 && idx > 2) {
if ( p1_x == p2_x) {
// Vertical line
cmn.gdraw.line( p1_x + idx/2 - idx + offs,
p1_y,
p2_x + idx/2 - idx + offs,
p2_y,
GlowColor.shift_drawtype( draw_type, -2, null), ish-1, hightlight);
cmn.gdraw.line( p1_x + idx/2 - offs,
p1_y,
p2_x + idx/2 - offs,
p2_y,
GlowColor.shift_drawtype( draw_type, 2, null), ish-1, hightlight);
}
else {
// Horizontal line
cmn.gdraw.line( p1_x,
p1_y + idx/2 - idx + offs,
p2_x,
p2_y + idx/2 - idx + offs,
GlowColor.shift_drawtype( draw_type, -2, null), ish-1, hightlight);
cmn.gdraw.line( p1_x,
p1_y + idx/2 - offs,
p2_x,
p2_y + idx/2 - offs,
GlowColor.shift_drawtype( draw_type, 2, null), ish-1, hightlight);
}
}
if ( border != 0) {
if ( p1_x == p2_x) {
// Vertical line
cmn.gdraw.line( p1_x + idx/2 - idx,
p1_y,
p2_x + idx/2 - idx,
p2_y,
Glow.eDrawType_Line, 0, hightlight);
if ( idx > 0)
cmn.gdraw.line( p1_x + idx/2,
p1_y,
p2_x + idx/2,
p2_y,
Glow.eDrawType_Line, 0, hightlight);
}
else {
// Horizontal line
cmn.gdraw.line( p1_x,
p1_y+ idx/2 - idx,
p2_x,
p2_y + idx/2 - idx,
Glow.eDrawType_Line, 0, hightlight);
if ( idx > 0)
cmn.gdraw.line( p1_x,
p1_y + idx/2,
p2_x,
p2_y + idx/2,
Glow.eDrawType_Line, 0, hightlight);
}
}
}
}
......@@ -78,7 +78,7 @@ public class GlowNodeClass extends GlowArrayElem {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowNodeClass : " + line);
switch ( key) {
......@@ -88,10 +88,10 @@ public class GlowNodeClass extends GlowArrayElem {
nc_name = token.nextToken();
break;
case Glow.eSave_NodeClass_a:
GlowVector.open(reader, cmn, a);
cmn.ctx.openVector(reader, cmn, a);
break;
case Glow.eSave_NodeClass_group:
group = new Integer(token.nextToken()).intValue();
group = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_arg_cnt:
case Glow.eSave_NodeClass_argname:
......@@ -99,29 +99,29 @@ public class GlowNodeClass extends GlowArrayElem {
case Glow.eSave_NodeClass_no_con_obstacle:
break;
case Glow.eSave_NodeClass_dyn_type1:
dyn_type1 = new Integer(token.nextToken()).intValue();
dyn_type1 = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dyn_type2:
dyn_type2 = new Integer(token.nextToken()).intValue();
dyn_type2 = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dyn_action_type1:
action_type1 = new Integer(token.nextToken()).intValue();
action_type1 = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dyn_action_type2:
action_type2 = new Integer(token.nextToken()).intValue();
action_type2 = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dyn_color1:
dyn_color[0] = new Integer(token.nextToken()).intValue();
dyn_color[0] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dyn_color2:
dyn_color[1] = new Integer(token.nextToken()).intValue();
dyn_color[1] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dyn_color3:
dyn_color[2] = new Integer(token.nextToken()).intValue();
dyn_color[2] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dyn_color4:
if ( token.hasMoreTokens())
dyn_color[3] = new Integer(token.nextToken()).intValue();
dyn_color[3] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dyn_attr1:
if ( token.hasMoreTokens())
......@@ -142,17 +142,17 @@ public class GlowNodeClass extends GlowArrayElem {
case Glow.eSave_NodeClass_java_name:
break;
case Glow.eSave_NodeClass_slider:
slider = new Integer(token.nextToken()).intValue();
slider = Integer.valueOf(token.nextToken());
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();
animation_count = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_cycle:
cycle = new Integer(token.nextToken()).intValue();
cycle = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_y0:
y0 = new Double(token.nextToken()).doubleValue();
......@@ -167,13 +167,13 @@ public class GlowNodeClass extends GlowArrayElem {
x1 = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_NodeClass_input_focus_mark:
input_focus_mark = new Integer(token.nextToken()).intValue();
input_focus_mark = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_recursive_trace:
recursive_trace = new Integer(token.nextToken()).intValue();
recursive_trace = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
dynamicsize = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_NodeClass_dynamic:
if ( cmn.dynamicsize > 0) {
......
......@@ -53,7 +53,7 @@ public class GlowNodeGroup extends GlowNodeClass {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowNodeGroup : " + line);
switch ( key) {
......
......@@ -40,17 +40,14 @@ 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 GlowPoint() {
}
public GlowPoint(GlowPoint p) {
cmn = p.cmn;
x = p.x;
y = p.y;
}
......@@ -67,8 +64,8 @@ public class GlowPoint {
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);
int key = Integer.valueOf(token.nextToken());
// if ( cmn.debug) System.out.println( "GlowPoint : " + line);
switch ( key) {
case Glow.eSave_Point:
......
/*
* 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 GlowTableInfo {
public int columns;
public int rows;
public int[] column_size = new int[Glow.TABLE_MAX_COL];
}
......@@ -78,12 +78,13 @@ public class GlowTransform {
String line;
StringTokenizer token;
boolean end_found = false;
boolean debug = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
if ( true) System.out.println( "GlowTransform : " + line);
int key = Integer.valueOf(token.nextToken());
if ( debug) System.out.println( "GlowTransform : " + line);
switch ( key) {
case Glow.eSave_Transform: break;
......@@ -261,7 +262,7 @@ public class GlowTransform {
}
public GlowPoint reverse( double x, double y) {
GlowPoint p = new GlowPoint(null);
GlowPoint p = new GlowPoint();
if ( a11 == 0 || ( a12 * a21 - a11 * a22) == 0) {
if ( a11 == 0 && a22 == 0 && a12 != 0 && a21 != 0) {
p.y = (x - a13) / a12;
......
......@@ -53,7 +53,7 @@ public class GlowVector {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowVector : " + line);
switch ( key) {
......@@ -78,9 +78,18 @@ public class GlowVector {
cc.open( reader);
a.add( (Object) cc);
break;
case Glow.eSave_Con: {
GlowCon c = new GlowCon( cmn);
c.open( reader);
a.add( (Object) c);
break;
}
case Glow.eSave_GrowNode: {
GrowNode n = new GrowNode( cmn);
n.open( reader);
if ( n.nc == null)
break;
a.add( n);
break;
}
......@@ -96,12 +105,36 @@ public class GlowVector {
a.add( n);
break;
}
case Glow.eSave_GrowConGlue: {
GrowConGlue n = new GrowConGlue( 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_Line: {
GlowLine c = new GlowLine( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_Arc: {
GlowArc c = new GlowArc( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_Arrow: {
GlowArrow c = new GlowArrow( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowArc: {
GrowArc c = new GrowArc( cmn);
c.open( reader);
......@@ -150,8 +183,20 @@ public class GlowVector {
a.add( c);
break;
}
case Glow.eSave_GrowTable: {
GrowTable c = new GrowTable( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowAxis: {
GrowAxis c = new GrowAxis( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_Point: {
GlowPoint c = new GlowPoint( cmn);
GlowPoint c = new GlowPoint();
c.open( reader);
a.add( c);
break;
......
......@@ -41,7 +41,6 @@ import java.io.*;
import java.util.*;
public class Graph implements GraphIfc, GrowApplIfc {
public static final int eType_Bit = (1 << 15) + 1;
public GrowCmn cmn;
......@@ -80,7 +79,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
return ctx;
}
void open(BufferedReader reader) {
public void open(BufferedReader reader) {
ctx.open( reader);
ctx.traceConnect();
}
......@@ -104,6 +103,10 @@ public class Graph implements GraphIfc, GrowApplIfc {
}
int stringToType( String str) {
int idx;
if ( (idx = str.indexOf('#')) != -1)
str = str.substring(0, idx);
System.out.println("type: " + str);
if ( str.equalsIgnoreCase("boolean"))
return Pwr.eType_Boolean;
if ( str.equalsIgnoreCase("float32"))
......@@ -145,7 +148,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
if ( str.equalsIgnoreCase("mask"))
return Pwr.eType_Mask;
if ( str.equalsIgnoreCase("bit"))
return Graph.eType_Bit;
return GraphIfc.eType_Bit;
if ( str.substring(0,6).equalsIgnoreCase("string"))
return Pwr.eType_String;
return 0;
......@@ -206,6 +209,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
pname.inverted = false;
pname.database = GraphIfc.eDatabase_Local;
pname.tname = new String(name);
return pname;
}
......@@ -233,6 +237,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
pname.inverted = false;
pname.database = GraphIfc.eDatabase_Ccm;
pname.tname = new String(pname.name);
return pname;
}
......@@ -245,6 +250,8 @@ public class Graph implements GraphIfc, GrowApplIfc {
}
}
pname.tname = new String(str);
if ( (idx = str.indexOf('[')) != -1 &&
(eidx = str.lastIndexOf('#')) != -1 &&
str.charAt(eidx-1) != '#') {
......@@ -272,6 +279,8 @@ public class Graph implements GraphIfc, GrowApplIfc {
str = str.substring(1);
str = str.trim();
pname.inverted = true;
pname.tname = pname.tname.substring(1);
pname.tname = pname.tname.trim();
}
else
pname.inverted = false;
......@@ -320,7 +329,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
switch ( e.event) {
case Glow.eEvent_MB1Click:
if ( e.object_type == Glow.eObjectType_NoObject ||
e.object.type() != Glow.eObjectType_GrowMenu) {
((GlowArrayElem)e.object).type() != Glow.eObjectType_GrowMenu) {
// Close any open menu, if not click in menu
GlowEventMenu event = new GlowEventMenu();
event.event = Glow.eEvent_MenuDelete;
......
......@@ -44,6 +44,8 @@ public interface GraphIfc {
public static final int eDatabase_Local = 2;
public static final int eDatabase_Ccm = 3;
public static final int eType_Bit = (1 << 15) + 1;
public DynParsedAttrName parseAttrName( String name);
public Gdh getGdh();
public GraphLocalDb getLdb();
......
......@@ -55,7 +55,7 @@ public class GrowAnnot extends GlowArrayElem {
public GrowAnnot(GrowCmn cmn) {
this.cmn = cmn;
p = new GlowPoint(cmn);
p = new GlowPoint();
trf = new GlowTransform();
}
......@@ -67,14 +67,14 @@ public class GrowAnnot extends GlowArrayElem {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
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();
adjustment = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowAnnot_annot_part:
glowannot_open(reader);
......@@ -107,7 +107,7 @@ public class GrowAnnot extends GlowArrayElem {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowAnnot : " + line);
switch ( key) {
......@@ -115,28 +115,28 @@ public class GrowAnnot extends GlowArrayElem {
case Glow.eSave_Annot:
break;
case Glow.eSave_Annot_number:
number = new Integer(token.nextToken()).intValue();
number = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Annot_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
draw_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Annot_color_drawtype:
color_drawtype = new Integer(token.nextToken()).intValue();
color_drawtype = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Annot_text_size:
text_size = new Integer(token.nextToken()).intValue();
text_size = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Annot_display_level:
display_level = new Integer(token.nextToken()).intValue();
display_level = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Annot_p:
p.open( reader);
break;
case Glow.eSave_Annot_annot_type:
annot_type = new Integer(token.nextToken()).intValue();
annot_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Annot_font:
font = new Integer(token.nextToken()).intValue();
font = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_End:
end_found = true;
......
......@@ -75,8 +75,8 @@ public class GrowArc extends GlowArrayElem {
public GrowArc(GrowCmn cmn) {
this.cmn = cmn;
trf = new GlowTransform();
ll = new GlowPoint(cmn);
ur = new GlowPoint(cmn);
ll = new GlowPoint();
ur = new GlowPoint();
}
public int type() {
......@@ -91,7 +91,7 @@ public class GrowArc extends GlowArrayElem {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GrowArc : " + line);
switch ( key) {
......@@ -114,49 +114,49 @@ public class GrowArc extends GlowArrayElem {
y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowArc_original_border_drawtype:
original_border_drawtype = new Integer(token.nextToken()).intValue();
original_border_drawtype = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_original_fill_drawtype:
original_fill_drawtype = new Integer(token.nextToken()).intValue();
original_fill_drawtype = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_fill_drawtype:
fill_drawtype = new Integer(token.nextToken()).intValue();
fill_drawtype = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_border:
border = new Integer(token.nextToken()).intValue();
border = Integer.valueOf(token.nextToken());
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();
shadow_contrast = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_shadow:
shadow = new Integer(token.nextToken()).intValue();
shadow = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_relief:
relief = new Integer(token.nextToken()).intValue();
relief = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_disable_shadow:
disable_shadow = new Integer(token.nextToken()).intValue();
disable_shadow = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_fixcolor:
fixcolor = new Integer(token.nextToken()).intValue();
fixcolor = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_fixposition:
fixposition = new Integer(token.nextToken()).intValue();
fixposition = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_gradient:
gradient = new Integer(token.nextToken()).intValue();
gradient = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_gradient_contrast:
gradient_contrast = new Integer(token.nextToken()).intValue();
gradient_contrast = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_disable_gradient:
disable_gradient = new Integer(token.nextToken()).intValue();
disable_gradient = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
dynamicsize = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowArc_dynamic:
if ( cmn.dynamicsize > 0) {
......@@ -194,7 +194,7 @@ public class GrowArc extends GlowArrayElem {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowArc : " + line);
switch ( key) {
......@@ -202,19 +202,19 @@ public class GrowArc extends GlowArrayElem {
case Glow.eSave_Arc:
break;
case Glow.eSave_Arc_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
draw_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arc_angle1:
angle1 = new Integer(token.nextToken()).intValue();
angle1 = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arc_angle2:
angle2 = new Integer(token.nextToken()).intValue();
angle2 = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arc_line_width:
line_width = new Integer(token.nextToken()).intValue();
line_width = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arc_fill:
fill = new Integer(token.nextToken()).intValue();
fill = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Arc_ll:
ll.open( reader);
......@@ -249,7 +249,7 @@ public class GrowArc extends GlowArrayElem {
}
rp = trf.reverse( fx, fy);
//rp = new GlowPoint(null);
//rp = new GlowPoint();
//rp.x = fx;
//rp.y = fy;
if ( ll.x <= rp.x && rp.x <= ur.x &&
......@@ -267,6 +267,8 @@ public class GrowArc extends GlowArrayElem {
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
if ( cmn.nodraw != 0)
return;
int drawtype;
int idx;
......
This diff is collapsed.
......@@ -82,7 +82,7 @@ public class GrowBar extends GrowRect {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GrowBar : " + line);
switch ( key) {
......@@ -99,13 +99,13 @@ public class GrowBar extends GrowRect {
bar_value = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowBar_bar_bordercolor:
bar_bordercolor = new Integer(token.nextToken()).intValue();
bar_bordercolor = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowBar_bar_borderwidth:
bar_borderwidth = new Integer(token.nextToken()).intValue();
bar_borderwidth = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowBar_bar_drawtype:
bar_drawtype = new Integer(token.nextToken()).intValue();
bar_drawtype = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowBar_rect_part:
super.open( reader);
......@@ -151,16 +151,16 @@ public class GrowBar extends GrowRect {
trace.data[9] = token.nextToken();
break;
case Glow.eSave_GrowBar_trace_attr_type:
trace.attr_type = new Integer(token.nextToken()).intValue();
trace.attr_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowBar_trace_color:
trace.color = new Integer(token.nextToken()).intValue();
trace.color = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowBar_access:
trace.access = new Integer(token.nextToken()).intValue();
trace.access = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowBar_cycle:
trace.cycle = new Integer(token.nextToken()).intValue();
trace.cycle = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowBar_ref_object:
if ( token.hasMoreTokens())
......@@ -188,6 +188,9 @@ public class GrowBar extends GrowRect {
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
if ( cmn.nodraw != 0)
return;
int idx;
int drawtype;
double rotation;
......
......@@ -42,7 +42,7 @@ import java.util.*;
public class GrowCmn {
GlowDrawIfc gdraw;
public GlowDrawIfc gdraw;
public class GrowWindow {
public double zoom_factor_x;
public double zoom_factor_y;
......@@ -60,14 +60,14 @@ public class GrowCmn {
boolean antiAliasing;
public GrowCtxIfc ctx;
GrowWindow mw = new GrowWindow();
public GrowWindow mw = new GrowWindow();
double x_right;
double x_left;
double y_high;
double y_low;
String name;
int version;
int background_color;
public int background_color;
int dynamicsize;
int arg_cnt;
String argname[] = new String[20];
......@@ -132,5 +132,12 @@ public class GrowCmn {
public void setGdraw(GlowDrawIfc gdraw) {
this.gdraw = gdraw;
}
public void setNodraw() {
nodraw++;
}
public void resetNodraw() {
if ( nodraw > 0)
nodraw--;
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -36,10 +36,13 @@
package jpwr.jopg;
import java.util.*;
import java.io.*;
public interface GrowCtxIfc {
public GlowArrayElem get_nodeclass_from_name(String name);
public GlowArrayElem get_conclass_from_name(String name);
public GlowArrayElem get_node_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);
......@@ -52,4 +55,6 @@ public interface GrowCtxIfc {
public Vector<GlowArrayElem> get_object_list();
public GlowBackgroundObject getBackgroundObjectLimits(int type, double x, double y);
public void setMoveRestrictions( int restriction, double max_limit, double min_limit, GlowArrayElem object);
public void zoom( double factor);
public void openVector( BufferedReader reader, Object cmn, Vector a);
}
......@@ -112,8 +112,12 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
}
}
else {
if ( fname.lastIndexOf('/') == -1)
if ( fname.lastIndexOf('/') == -1) {
if ( fname.startsWith("pwr_c_"))
filename = "$pwr_exe/" + fname;
else
filename = "$pwrp_exe/" + fname;
}
else
filename = fname;
filename = Gdh.translateFilename( filename);
......@@ -151,8 +155,8 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
}
}
if ( gdh == null)
gdh = new Gdh(this);
// if ( gdh == null)
// gdh = new Gdh(this);
graph = new Graph(this, gdh);
graph.open(reader);
......
......@@ -57,7 +57,7 @@ public class GrowGroup extends GrowNode {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GrowGroup : " + line);
switch ( key) {
......
......@@ -59,8 +59,8 @@ public class GrowLine extends GlowArrayElem {
public GrowLine(GrowCmn cmn) {
this.cmn = cmn;
trf = new GlowTransform();
p1 = new GlowPoint(cmn);
p2 = new GlowPoint(cmn);
p1 = new GlowPoint();
p2 = new GlowPoint();
}
public int type() {
......@@ -75,7 +75,7 @@ public class GrowLine extends GlowArrayElem {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GrowLine : " + line);
switch ( key) {
......@@ -98,13 +98,13 @@ public class GrowLine extends GlowArrayElem {
y_low = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowLine_line_type:
line_type = new Integer(token.nextToken()).intValue();
line_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowLine_original_border_drawtype:
original_border_drawtype = new Integer(token.nextToken()).intValue();
original_border_drawtype = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowLine_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
dynamicsize = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowLine_dynamic:
if ( cmn.dynamicsize > 0) {
......@@ -142,7 +142,7 @@ public class GrowLine extends GlowArrayElem {
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GlowRect : " + line);
switch ( key) {
......@@ -150,10 +150,10 @@ public class GrowLine extends GlowArrayElem {
case Glow.eSave_Line:
break;
case Glow.eSave_Line_draw_type:
draw_type = new Integer(token.nextToken()).intValue();
draw_type = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Line_line_width:
line_width = new Integer(token.nextToken()).intValue();
line_width = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Line_p1:
p1.open( reader);
......@@ -205,6 +205,9 @@ public class GrowLine extends GlowArrayElem {
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
if ( cmn.nodraw != 0)
return;
if ( hot != 9 &&
cmn.hot_indication != Glow.eHotIndication_LineWidth)
hot = 0;
......
......@@ -85,6 +85,9 @@ public class GrowMenu extends GrowRect {
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
if ( cmn.nodraw != 0)
return;
int idx;
int text_idx = (int)( trf.vertical_scale(t) * cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (text_size +4) - 4);
double tsize = trf.vertical_scale(t) * cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (8+2*text_size);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment