Commit 0201bd6b authored by Claes Sjofors's avatar Claes Sjofors

jopg third commit

parent 2fe7f512
......@@ -197,32 +197,45 @@ public class JopSessionRep implements JopSessionIfc {
if ( gcret.value > 0)
suffix = Integer.toString(gcret.value);
}
if ( coid.objid.vid < Cdh.cUserClassVolMin ||
(coid.objid.vid >= Cdh.cManufactClassVolMin &&
coid.objid.vid <= Cdh.cManufactClassVolMax)) {
// Class is a base class, java classname starts with JopC
if ( coid.objid.vid == 1)
name = "jpwr.jopc.Jopc" + sret.str.substring(1,2).toUpperCase() +
sret.str.substring(2).toLowerCase() + suffix;
else if ( coid.objid.vid == 64002)
name = "jpwr.abb.Jopc" + sret.str.substring(0,1).toUpperCase() +
sret.str.substring(1).toLowerCase() + suffix;
else if ( coid.objid.vid == 10) {
if ( sret.str.startsWith( "BaseFcPPO"))
name = "jpwr.bcompfc.Jopc" + sret.str.substring(0,1).toUpperCase() +
sret.str.substring(1).toLowerCase() + suffix;
name = "pwr_c_" + sret.str.toLowerCase() + ".pwg"; // Pwg test
int pwgidx = name.lastIndexOf( ".pwg");
if ( pwgidx == -1) {
if ( coid.objid.vid < Cdh.cUserClassVolMin ||
(coid.objid.vid >= Cdh.cManufactClassVolMin &&
coid.objid.vid <= Cdh.cManufactClassVolMax)) {
// Class is a base class, java classname starts with JopC
if ( coid.objid.vid == 1)
name = "jpwr.jopc.Jopc" + sret.str.substring(1,2).toUpperCase() +
sret.str.substring(2).toLowerCase() + suffix;
else if ( coid.objid.vid == 64002)
name = "jpwr.abb.Jopc" + sret.str.substring(0,1).toUpperCase() +
sret.str.substring(1).toLowerCase() + suffix;
else if ( coid.objid.vid == 10) {
if ( sret.str.startsWith( "BaseFcPPO"))
name = "jpwr.bcompfc.Jopc" + sret.str.substring(0,1).toUpperCase() +
sret.str.substring(1).toLowerCase() + suffix;
else
name = "jpwr.bcomp.Jopc" + sret.str.substring(0,1).toUpperCase() +
sret.str.substring(1).toLowerCase() + suffix;
}
else
name = "jpwr.jopc.Jopc" + sret.str.substring(0,1).toUpperCase() +
sret.str.substring(1).toLowerCase() + suffix;
}
else
name = "jpwr.bcomp.Jopc" + sret.str.substring(0,1).toUpperCase() +
sret.str.substring(1).toLowerCase() + suffix;
}
else
name = "jpwr.jopc.Jopc" + sret.str.substring(0,1).toUpperCase() +
sret.str.substring(1).toLowerCase() + suffix;
// Java name equals class name
name = sret.str.substring(0,1).toUpperCase() + sret.str.substring(1).toLowerCase() +
suffix;
}
else {
if ( coid.objid.vid < Cdh.cUserClassVolMin ||
(coid.objid.vid >= Cdh.cManufactClassVolMin &&
coid.objid.vid <= Cdh.cManufactClassVolMax)) {
name = "$pwr_exe/" + name;
}
if ( suffix.length() > 0)
name = name.substring(0, pwgidx) + suffix + name.substring(pwgidx+1);
}
else
// Java name equals class name
name = sret.str.substring(0,1).toUpperCase() + sret.str.substring(1).toLowerCase() +
suffix;
JopLog.log("openGraphFrame classgraph " + name);
Object graph;
......
......@@ -45,6 +45,7 @@ import java.applet.*;
import java.util.*;
import jpwr.rt.*;
import java.awt.event.*;
import jpwr.jopg.*;
public class JopSpider {
int qcom_qix;
......@@ -59,6 +60,20 @@ public class JopSpider {
static String methObject;
static PwrtAttrRef methAref;
static int methClassId;
static JopSpider spider;
private static class GrowFrameCb implements GrowFrameApplIfc {
JopSession session;
GrowFrameCb( JopSession session) {
this.session = session;
}
public int command( String cmd) {
System.out.println("JopSpider command callback : " + cmd);
return JopSpider.command( session, cmd);
}
}
public JopSpider( int op_qcom_qix) {
JopSpider.op_qcom_qix = op_qcom_qix;
......@@ -760,44 +775,53 @@ System.out.println( "JopSpiderCmd start");
public static Object loadFrame( JopSession session, String className,
String instance, boolean scrollbar) throws ClassNotFoundException {
Object frame;
if ( instance == null)
instance = "";
if ( className.indexOf(".pwg") != -1) {
GrowFrame frame = new GrowFrame(className, session.getGdh(), instance, new GrowFrameCb(session));
frame.validate();
frame.setVisible(true);
}
else {
Object frame;
if ( instance == null)
instance = "";
JopLog.log("JopSpider.loadFrame: Loading frame \"" + className + "\" instance \"" + instance + "\"");
try {
Class clazz = Class.forName( className);
try {
Class argTypeList[] = new Class[] { session.getClass(), instance.getClass(),
boolean.class};
Object argList[] = new Object[] { session, instance, new Boolean(scrollbar)};
System.out.println( "JopSpider.loadFrame getConstructor");
Constructor constructor = clazz.getConstructor( argTypeList);
try {
frame = constructor.newInstance( argList);
}
catch ( Exception e) {
System.out.println("Class instanciation error: " + className + " " + e.getMessage() + " " + constructor);
JopLog.log("JopSpider.loadFrame: Loading frame \"" + className + "\" instance \"" + instance + "\"");
try {
Class clazz = Class.forName( className);
try {
Class argTypeList[] = new Class[] { session.getClass(), instance.getClass(),
boolean.class};
Object argList[] = new Object[] { session, instance, new Boolean(scrollbar)};
System.out.println( "JopSpider.loadFrame getConstructor");
Constructor constructor = clazz.getConstructor( argTypeList);
try {
frame = constructor.newInstance( argList);
}
catch ( Exception e) {
System.out.println("Class instanciation error: " + className + " " + e.getMessage() + " " + constructor);
return null;
}
// frame = clazz.newInstance();
JopLog.log( "JopSpider.loadFrame openFrame");
openFrame( frame);
return frame;
}
catch ( NoSuchMethodException e) {
System.out.println("NoSuchMethodException: Unable to get frame constructor " + className);
}
catch ( Exception e) {
System.out.println("Exception: Unable to get frame class " + className + " " + e.getMessage());
}
}
catch (ClassNotFoundException e) {
System.out.println("Class not found: " + className);
throw new ClassNotFoundException();
}
return null;
}
// frame = clazz.newInstance();
JopLog.log( "JopSpider.loadFrame openFrame");
openFrame( frame);
return frame;
}
catch ( NoSuchMethodException e) {
System.out.println("NoSuchMethodException: Unable to get frame constructor " + className);
}
catch ( Exception e) {
System.out.println("Exception: Unable to get frame class " + className + " " + e.getMessage());
}
}
catch (ClassNotFoundException e) {
System.out.println("Class not found: " + className);
throw new ClassNotFoundException();
}
return null;
return null;
}
public static void openFrame( Object frame) {
......@@ -1027,6 +1051,7 @@ System.out.println( "JopSpiderCmd start");
}
return null;
}
}
......
This diff is collapsed.
......@@ -45,6 +45,9 @@ public class Glow {
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 DRAWOFFSET = 2;
public static final int TREND_MAX_CURVES = 11;
public static final int eType_Boolean = 0;
public static final int eType_Int = 1;
public static final int eType_Double = 2;
......@@ -803,6 +806,7 @@ public class Glow {
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_NodeClass_recursive_trace = 332;
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;
......@@ -1008,6 +1012,7 @@ public class Glow {
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_GrowCtx_recursive_trace = 2248;
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;
......@@ -1467,6 +1472,10 @@ public class Glow {
public static final int ePosition_Absolute = 0;
public static final int ePosition_Relative = 1;
public static final int eMoveRestriction_VerticalSlider = 0;
public static final int eMoveRestriction_HorizontalSlider = 1;
public static final int eMoveRestriction_Disable = 2;
public static final int eEventType_Object = 0;
public static final int eEventType_Menu = 1;
......@@ -1475,8 +1484,12 @@ public class Glow {
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_ButtonMotion = 6;
public static final int eEvent_ValueChanged = 7;
public static final int eEvent_MenuCreate = 8;
public static final int eEvent_MenuActivated = 9;
public static final int eEvent_MenuDelete = 10;
public static final int eEvent_SliderMoveStart = 11;
public static final int eEvent_SliderMoved = 12;
public static final int eEvent_SliderMoveEnd = 13;
}
......@@ -44,4 +44,11 @@ public class GlowArrayElem {
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {}
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 getClassDynType1() { return 0;}
public int getClassDynType2() { return 0;}
public int getClassActionType1() { return 0;}
public int getClassActionType2() { return 0;}
public int getClassCycle() { 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;
public class GlowBackgroundObject {
public GlowArrayElem background;
public int direction;
public double max;
public double min;
public int sts;
}
\ No newline at end of file
......@@ -46,7 +46,7 @@ import java.awt.event.*;
public class GlowDraw implements GlowDrawIfc {
Graphics2D g2;
boolean nodraw;
boolean nodraw = true;
Font fonts[] = new Font[9];
......@@ -56,6 +56,7 @@ public class GlowDraw implements GlowDrawIfc {
public void setGraphics( Graphics2D g2) {
this.g2 = g2;
nodraw = false;
}
public void rect(int border, int fill, double x, double y, double width, double height) {
......@@ -244,6 +245,8 @@ public class GlowDraw implements GlowDrawIfc {
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) {
if ( nodraw)
return;
Color c = getColor(color);
......
......@@ -64,6 +64,7 @@ public class GlowNodeClass extends GlowArrayElem {
String[] dyn_attr = new String[4];
GlowArrayElem next_nc;
GlowArrayElem prev_nc;
int recursive_trace;
public GlowNodeClass(GrowCmn cmn) {
this.cmn = cmn;
......@@ -168,6 +169,9 @@ public class GlowNodeClass extends GlowArrayElem {
case Glow.eSave_NodeClass_input_focus_mark:
input_focus_mark = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_recursive_trace:
recursive_trace = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_NodeClass_dynamicsize:
dynamicsize = new Integer(token.nextToken()).intValue();
break;
......@@ -215,8 +219,9 @@ public class GlowNodeClass extends GlowArrayElem {
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
for ( int i = 0; i < a.size(); i++)
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) {
......@@ -229,4 +234,55 @@ public class GlowNodeClass extends GlowArrayElem {
}
return 0;
}
public void get_borders( GlowTransform t, GlowGeometry g) {
GlowNodeClass base = get_base_nc();
if ( (t == null || ( t != null && Math.abs( t.rotation/90 - (int)(t.rotation/90)) < Double.MIN_VALUE)) &&
!(Math.abs( base.x0 - base.x1) < Double.MIN_VALUE ||
Math.abs( base.y0 - base.y1) < Double.MIN_VALUE)) {
// Borders are given i x0, y0, x1, y1
// Will not work in rotated nodes
double ll_x, ur_x, ll_y, ur_y, kx1, kx2, ky1, ky2;
if ( t != null) {
kx1 = t.x( base.x0, base.y0);
kx2 = t.x( base.x1, base.y1);
ky1 = t.y( base.x0, base.y0);
ky2 = t.y( base.x1, base.y1);
}
else {
kx1 = base.x0;
kx2 = base.x1;
ky1 = base.y0;
ky2 = base.y1;
}
ll_x = Math.min( kx1, kx2);
ur_x = Math.max( kx1, kx2);
ll_y = Math.min( ky1, ky2);
ur_y = Math.max( ky1, ky2);
if ( ll_x < g.ll_x)
g.ll_x = ll_x;
if ( ur_x > g.ur_x)
g.ur_x = ur_x;
if ( ll_y < g.ll_y)
g.ll_y = ll_y;
if ( ur_y > g.ur_y)
g.ur_y = ur_y;
}
else {
for ( int i = 0; i < a.size(); i++)
a.get(i).get_borders(t, g);
}
}
GlowNodeClass get_base_nc() {
GlowNodeClass base;
for ( base = this; base.prev_nc != null; base = (GlowNodeClass)base.prev_nc)
;
return base;
}
}
......@@ -49,6 +49,12 @@ public class GlowPoint {
this.cmn = cmn;
}
public GlowPoint(GlowPoint p) {
cmn = p.cmn;
x = p.x;
y = p.y;
}
public void posit(double x, double y) {
this.x = x;
this.y = y;
......
/*
* 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 GlowSliderInfo {
public int direction;
public double max_value;
public double min_value;
public double max_position;
public double min_position;
}
\ No newline at end of file
......@@ -83,7 +83,7 @@ public class GlowTransform {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = new Integer(token.nextToken()).intValue();
// if ( cmn.debug) System.out.println( "GlowTransform : " + line);
if ( true) System.out.println( "GlowTransform : " + line);
switch ( key) {
case Glow.eSave_Transform: break;
......@@ -287,4 +287,8 @@ public class GlowTransform {
return Math.sqrt( tmp.a12*tmp.a12 + tmp.a22*tmp.a22);
}
public boolean is_stored() {
return stored;
}
}
\ No newline at end of file
......@@ -84,6 +84,12 @@ public class GlowVector {
a.add( n);
break;
}
case Glow.eSave_GrowSlider: {
GrowSlider n = new GrowSlider( cmn);
n.open( reader);
a.add( n);
break;
}
case Glow.eSave_GrowGroup: {
GrowGroup n = new GrowGroup( cmn);
n.open( reader);
......@@ -132,6 +138,18 @@ public class GlowVector {
a.add( c);
break;
}
case Glow.eSave_GrowBar: {
GrowBar c = new GrowBar( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_GrowTrend: {
GrowTrend c = new GrowTrend( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_Point: {
GlowPoint c = new GlowPoint( cmn);
c.open( reader);
......
......@@ -50,6 +50,8 @@ public class Graph implements GraphIfc, GrowApplIfc {
public GraphApplIfc appl;
public Gdh gdh;
public GraphLocalDb ldb;
public GrowSlider currentSlider;
public double scan_time = 1;
public Graph(GraphApplIfc appl, Gdh gdh) {
this.appl = appl;
......@@ -83,19 +85,22 @@ public class Graph implements GraphIfc, GrowApplIfc {
ctx.traceConnect();
}
public void traceConnect(GrowNode object) {
public void traceConnect(GlowArrayElem object) {
Dyn dyn = (Dyn)object.getUserData();
dyn.connect(object);
if ( dyn != null)
dyn.connect(object);
}
public void traceDisconnect(GrowNode object) {
public void traceDisconnect(GlowArrayElem object) {
Dyn dyn = (Dyn)object.getUserData();
dyn.disconnect();
if ( dyn != null)
dyn.disconnect();
}
public void traceScan(GrowNode object) {
public void traceScan(GlowArrayElem object) {
Dyn dyn = (Dyn)object.getUserData();
dyn.scan(object);
if ( dyn != null)
dyn.scan(object);
}
int stringToType( String str) {
......@@ -141,6 +146,8 @@ public class Graph implements GraphIfc, GrowApplIfc {
return Pwr.eType_Mask;
if ( str.equalsIgnoreCase("bit"))
return Graph.eType_Bit;
if ( str.substring(0,6).equalsIgnoreCase("string"))
return Pwr.eType_String;
return 0;
}
......@@ -172,7 +179,72 @@ public class Graph implements GraphIfc, GrowApplIfc {
DynParsedAttrName pname = new DynParsedAttrName();
String str = name.trim();
if ( (idx = str.indexOf("$local.")) != -1) {
if ( (tidx = str.indexOf('#')) == -1)
pname.name = str.substring(idx+1);
else {
pname.name = str.substring(idx+7, tidx);
String type = str.substring(tidx);
if ( type.equals("##Float32"))
pname.type = Pwr.eType_Float32;
else if ( type.equals("##Float64"))
pname.type = Pwr.eType_Float64;
else if ( type.equals("##Int32"))
pname.type = Pwr.eType_Int32;
else if ( type.equals("##Boolean"))
pname.type = Pwr.eType_Boolean;
else
pname.type = Pwr.eType_String;
}
if ( str.startsWith("!")) {
str = str.substring(1);
str = str.trim();
pname.inverted = true;
}
else
pname.inverted = false;
pname.database = GraphIfc.eDatabase_Local;
return pname;
}
if ( (idx = str.indexOf("$ccm.")) != -1) {
if ( (tidx = str.indexOf('#')) == -1)
pname.name = str.substring(idx+1);
else {
pname.name = str.substring(idx+5, tidx);
String type = str.substring(tidx);
if ( type.equals("##Float32"))
pname.type = Pwr.eType_Float32;
else if ( type.equals("##Int32"))
pname.type = Pwr.eType_Int32;
else if ( type.equals("##Boolean"))
pname.type = Pwr.eType_Boolean;
else
pname.type = Pwr.eType_String;
}
if ( str.startsWith("!")) {
str = str.substring(1);
str = str.trim();
pname.inverted = true;
}
else
pname.inverted = false;
pname.database = GraphIfc.eDatabase_Ccm;
return pname;
}
if ( (idx = str.indexOf("$object")) != -1) {
if ( appl != null) {
String oname = appl.getObject();
str = str.substring(0, idx) + oname + str.substring(idx+7);
System.out.println("Parse name $object " + oname + " str " + str);
}
}
if ( (idx = str.indexOf('[')) != -1 &&
(eidx = str.lastIndexOf('#')) != -1 &&
str.charAt(eidx-1) != '#') {
......@@ -212,6 +284,19 @@ public class Graph implements GraphIfc, GrowApplIfc {
return pname;
}
public String getCommand(String cmd) {
String str = new String(cmd);
int idx;
while ( (idx = str.indexOf("$object")) != -1) {
if ( appl != null) {
String oname = appl.getObject();
str = str.substring(0, idx) + oname + str.substring(idx+7);
}
}
return str;
}
public Object growUserdataOpen( BufferedReader reader, Object object, int type) {
switch ( type) {
......@@ -264,6 +349,9 @@ public class Graph implements GraphIfc, GrowApplIfc {
case Glow.eEvent_MB1Up:
case Glow.eEvent_MB1Down:
case Glow.eEvent_ValueChanged:
case Glow.eEvent_SliderMoveStart:
case Glow.eEvent_SliderMoveEnd:
case Glow.eEvent_SliderMoved:
if ( e.object != null) {
int sts;
Dyn dyn = (Dyn)((GlowArrayElem)e.object).getUserData();
......@@ -317,4 +405,19 @@ public class Graph implements GraphIfc, GrowApplIfc {
// TODO
return null;
}
public GrowSlider getCurrentSlider() {
return currentSlider;
}
public void setCurrentSlider(GrowSlider currentSlider) {
this.currentSlider = currentSlider;
}
public boolean isAuthorized(int access) {
return true;
}
public double getScanTime() {
return scan_time;
}
}
......@@ -41,4 +41,5 @@ public interface GraphApplIfc {
public void openConfirmDialog( Object dyn, String text, Object object);
public int getWidth();
public int getHeight();
public String getObject();
}
......@@ -51,4 +51,9 @@ public interface GraphIfc {
public int command(String cmd);
public void openConfirmDialog(Object dyn, String text, Object object);
public String get_reference_name(String name);
public Object getCurrentSlider();
public void setCurrentSlider(GrowSlider currentSlider);
public boolean isAuthorized(int access);
public double getScanTime();
public String getCommand(String cmd);
}
......@@ -158,6 +158,8 @@ public class GrowAnnot extends GlowArrayElem {
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
int x1, y1;
if ( cmn.nodraw != 0)
return;
if ( ((GrowNode)node).annotv[number] == null)
return;
......
......@@ -39,9 +39,9 @@ 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 traceConnect(GlowArrayElem object);
public void traceDisconnect(GlowArrayElem object);
public void traceScan(GlowArrayElem object);
public void eventHandler(GlowEvent e);
public int getWidth();
public int getHeight();
......
......@@ -98,7 +98,8 @@ public class GrowArc extends GlowArrayElem {
case Glow.eSave_GrowArc:
break;
case Glow.eSave_GrowArc_n_name:
n_name = token.nextToken();
if ( token.hasMoreTokens())
n_name = token.nextToken();
break;
case Glow.eSave_GrowArc_x_right:
x_right = new Double(token.nextToken()).doubleValue();
......
This diff is collapsed.
......@@ -103,7 +103,13 @@ public class GrowCmn {
int callback_object_type;
int hot_mode;
int hot_found;
GlowArrayElem restriction_object;
int move_restriction;
double restriction_max_limit;
double restriction_min_limit;
int recursive_trace;
public int nodraw;
Vector<GlowArrayElem> a = new Vector<GlowArrayElem>();
Vector<GlowArrayElem> a_nc = new Vector<GlowArrayElem>();
Vector<GlowArrayElem> a_cc = new Vector<GlowArrayElem>();
......
This diff is collapsed.
......@@ -50,4 +50,6 @@ public interface GrowCtxIfc {
public void remove(GlowArrayElem e);
public void pop(GlowArrayElem e);
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);
}
......@@ -36,7 +36,6 @@
package jpwr.jopg;
import jpwr.jop.*;
import jpwr.rt.*;
import java.io.*;
import java.awt.*;
......@@ -64,13 +63,17 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
JLabel confirmLabel;
Object confirmDyn;
Object confirmObject;
String instance;
GrowFrameApplIfc appl;
public GrowFrame( String file) {
public GrowFrame( String file, Gdh gdh, String instance, GrowFrameApplIfc appl) {
root = (Object) this;
init( file);
this.instance = instance;
this.appl = appl;
init( file, gdh);
}
private void init( String file) {
private void init( String file, Gdh gdh) {
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
contentPane.add(localPanel, BorderLayout.CENTER);
......@@ -86,7 +89,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
BufferedReader reader = null;
String fname = file;
if ( root != null && root instanceof JopApplet) {
if ( root != null && root instanceof JApplet) {
try {
URL current = ((JApplet) root).getCodeBase();
String current_str = current.toString();
......@@ -109,7 +112,10 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
}
}
else {
filename = "$pwrp_exe/" + fname;
if ( fname.lastIndexOf('/') == -1)
filename = "$pwrp_exe/" + fname;
else
filename = fname;
filename = Gdh.translateFilename( filename);
System.out.println( "Fname: " + filename);
......@@ -120,9 +126,33 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
System.out.println( "Unable to open file " + filename);
return;
}
// Read size info
String line;
int defaultWidth = 0;
int defaultHeight = 0;
try {
for ( int i = 0; i < 2; i++) {
line = reader.readLine();
if ( line == null || !line.startsWith("0! "))
break;
if ( line.substring(3, 15).equals("DefaultWidth"))
defaultWidth = new Integer(line.substring(16)).intValue();
else if ( line.substring(3, 16).equals("DefaultHeight"))
defaultHeight = new Integer(line.substring(17)).intValue();
}
} catch ( Exception e) {
System.out.println( "IOException GlowFrame");
}
System.out.println("GraphFrame size " + defaultWidth + " " + defaultHeight);
if ( defaultWidth != 0 && defaultHeight != 0) {
size = new Dimension( defaultWidth + 5, defaultHeight + 40);
setSize( size);
}
}
Gdh gdh = new Gdh(this);
if ( gdh == null)
gdh = new Gdh(this);
graph = new Graph(this, gdh);
graph.open(reader);
......@@ -162,6 +192,13 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
event.event = Glow.eEvent_CursorMotion;
graph.ctx.eventHandler( event);
}
public void mouseDragged(MouseEvent e) {
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.event = Glow.eEvent_ButtonMotion;
graph.ctx.eventHandler( event);
}
};
localPanel.addMouseListener(adapter);
......@@ -173,10 +210,10 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
public int getWidth() {
return localPanel.getWidth();
return localPanel.getWidth() + 5;
}
public int getHeight() {
return localPanel.getHeight();
return localPanel.getHeight() + 40;
}
public void actionPerformed( ActionEvent e) {
......@@ -189,8 +226,8 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
}
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);
size = new Dimension( (int)((graph.ctx.cmn.x_right - graph.ctx.cmn.x_left) * graph.ctx.cmn.mw.zoom_factor_x) + Glow.DRAWOFFSET * 2,
(int)((graph.ctx.cmn.y_high - graph.ctx.cmn.y_low) * graph.ctx.cmn.mw.zoom_factor_y) + Glow.DRAWOFFSET * 2);
localPanel.setPreferredSize( size);
localPanel.revalidate();
}
......@@ -224,7 +261,9 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
public int command(String cmd) {
System.out.println("Ge command : " + cmd);
return 1;
if ( appl != null)
return appl.command(cmd);
return 0;
}
public void confirmNo() {}
......@@ -281,7 +320,9 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
}
}
public String getObject() {
return instance;
}
}
......
/*
* 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 GrowFrameApplIfc {
public int command(String cmd);
}
......@@ -82,7 +82,8 @@ public class GrowLine extends GlowArrayElem {
case Glow.eSave_GrowLine:
break;
case Glow.eSave_GrowLine_n_name:
n_name = token.nextToken();
if ( token.hasMoreTokens())
n_name = token.nextToken();
break;
case Glow.eSave_GrowLine_x_right:
x_right = new Double(token.nextToken()).doubleValue();
......
......@@ -134,15 +134,15 @@ public class GrowMenu extends GrowRect {
// Outside window border
ur_y = cmn.getHeight() + cmn.mw.subwindow_y;
ll_y = ur_y - (int)(tot_z_height);
ll.posit( ll.x, ll_y * cmn.mw.zoom_factor_x + cmn.mw.offset_y);
ur.posit( ur.x, ur_y * cmn.mw.zoom_factor_y + cmn.mw.offset_y); // Might not always be correct?
ll.posit( ll.x, (ll_y + cmn.mw.offset_y) / cmn.mw.zoom_factor_x);
ur.posit( ur.x, (ur_y + cmn.mw.offset_y) / cmn.mw.zoom_factor_y); // Might not always be correct?
ll_x = (int)( ll.x * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
ll_y = (int)( ll.y * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
ur_x = ll_x + max_z_width + 15 + (int)(pulldown_found * arrow_size);
ur_y = ll_y + (int)(tot_z_height);
}
else
ur.posit( ur_x * cmn.mw.zoom_factor_x + cmn.mw.offset_x, ur_y *cmn.mw.zoom_factor_y + cmn.mw.offset_y);
ur.posit( (ur_x + cmn.mw.offset_x)/ cmn.mw.zoom_factor_x, (ur_y + cmn.mw.offset_y)/ cmn.mw.zoom_factor_y);
ll_y = (int)( ll.y * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
get_node_borders();
System.out.println("Menu borders: (" + x_left + "," + y_low + ") (" + x_right + "," + y_high + ")");
......
......@@ -256,7 +256,8 @@ public class GrowNode extends GlowArrayElem {
nc_root = nc;
break;
case Glow.eSave_Node_n_name:
n_name = token.nextToken();
if ( token.hasMoreTokens())
n_name = token.nextToken();
break;
case Glow.eSave_Node_refcon_cnt:
for ( int i = 0; i < MAX_CONPOINTS; i++)
......@@ -668,10 +669,34 @@ public class GrowNode extends GlowArrayElem {
get_node_borders();
}
void storeTransform() {
public void storeTransform() {
trf.store();
}
public boolean transformIsStored() {
return trf.is_stored();
}
void get_node_borders() {
GlowGeometry g = new GlowGeometry();
g.ur_x = 10e-37;
g.ll_x = 10e37;
g.ur_y = 10e-37;
g.ll_y = 10e37;
nc.get_borders( trf, g);
x_left = g.ll_x;
x_right = g.ur_x;
y_low = g.ll_y;
y_high = g.ur_y;
}
public void get_borders( GlowTransform t, GlowGeometry g) {
if ( t != null) {
GlowTransform t2 = t.multiply(trf);
nc.get_borders(t2, g);
}
else
nc.get_borders(trf, g);
}
int set_next_nodeclass() {
......@@ -799,4 +824,140 @@ public class GrowNode extends GlowArrayElem {
return geom;
}
public void move_to( double x, double y) {
double old_x_left = x_left;
double old_x_right = x_right;
double old_y_low = y_low;
double old_y_high = y_high;
trf.move( x - x_left, y - y_low);
get_node_borders();
//draw();
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);
cmn.ctx.draw( x_left * cmn.mw.zoom_factor_x - cmn.mw.offset_x - Glow.DRAW_MP,
y_low * cmn.mw.zoom_factor_y - cmn.mw.offset_y - Glow.DRAW_MP,
x_right * cmn.mw.zoom_factor_x - cmn.mw.offset_x + Glow.DRAW_MP,
y_high * cmn.mw.zoom_factor_y - cmn.mw.offset_y + Glow.DRAW_MP);
}
public void move( double x, double y) {
double old_x_left = x_left;
double old_x_right = x_right;
double old_y_low = y_low;
double old_y_high = y_high;
trf.move( x, y);
get_node_borders();
//draw();
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);
cmn.ctx.draw( x_left * cmn.mw.zoom_factor_x - cmn.mw.offset_x - Glow.DRAW_MP,
y_low * cmn.mw.zoom_factor_y - cmn.mw.offset_y - Glow.DRAW_MP,
x_right * cmn.mw.zoom_factor_x - cmn.mw.offset_x + Glow.DRAW_MP,
y_high * cmn.mw.zoom_factor_y - cmn.mw.offset_y + Glow.DRAW_MP);
}
public void set_position( double x, double y) {
double old_x_left, old_x_right, old_y_low, old_y_high;
if ( trf.a13 == trf.s_a13 + x && trf.a23 == trf.s_a23 + y)
return;
old_x_left = x_left;
old_x_right = x_right;
old_y_low = y_low;
old_y_high = y_high;
trf.move_from_stored( x, y);
get_node_borders();
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);
cmn.ctx.draw( x_left * cmn.mw.zoom_factor_x - cmn.mw.offset_x - Glow.DRAW_MP,
y_low * cmn.mw.zoom_factor_y - cmn.mw.offset_y - Glow.DRAW_MP,
x_right * cmn.mw.zoom_factor_x - cmn.mw.offset_x + Glow.DRAW_MP,
y_high * cmn.mw.zoom_factor_y - cmn.mw.offset_y + Glow.DRAW_MP);
}
public int get_background_object_limits(GlowTransform t, int type, double x, double y, GlowBackgroundObject b) {
int dyn_type;
GlowNodeClass base_nc = nc.get_base_nc();
dyn_type = base_nc.dyn_type1;
if ( (type & dyn_type) == 0)
return 0;
if ( nc.y0 == 0 && nc.y1 == 0)
return 0;
double x1, x2, y1, y2;
double rotation;
GlowGeometry g = new GlowGeometry();
g.ur_x = 10e-37;
g.ll_x = 10e37;
g.ur_y = 10e-37;
g.ll_y = 10e37;
get_borders( t, g);
double x1_right = g.ur_x;
double x1_left = g.ll_x;
double y1_high = g.ur_y;
double y1_low = g.ll_y;
System.out.println("Slider background: ("+x+","+y+") ("+x1_left+","+y1_low+") ("+x1_right+","+y1_high+")");
if ( x <= x1_right && x >= x1_left && y <= y1_high && y >= y1_low) {
// Hit, calculate max and min koordinates
if (t == null) {
x1 = trf.x( 0, nc.y0);
y1 = trf.y( 0, nc.y0);
x2 = trf.x( 0, nc.y1);
y2 = trf.y( 0, nc.y1);
}
else {
x1 = trf.x( t, 0, nc.y0);
y1 = trf.y( t, 0, nc.y0);
x2 = trf.x( t, 0, nc.y1);
y2 = trf.y( t, 0, nc.y1);
}
if ( t != null)
rotation = (trf.rot( t) / 360 - Math.floor( trf.rot( t) / 360)) * 360;
else {
rotation = (trf.rot() / 360 - Math.floor( trf.rot() / 360)) * 360;
System.out.println("trf.rotation" + trf.rotation + " floor: " + Math.floor( trf.rot() / 360));
}
if ( 45 >= rotation || rotation > 315) {
b.direction = Glow.eDirection_Down;
b.min = y1;
b.max = y2;
}
else if ( 45 < rotation && rotation <= 135) {
b.direction = Glow.eDirection_Left;
b.min = x2;
b.max = x1;
}
else if ( 135 < rotation && rotation <= 225) {
b.direction = Glow.eDirection_Up;
b.min = y2;
b.max = y1;
}
else if ( 225 < rotation && rotation <= 315) {
b.direction = Glow.eDirection_Right;
b.min = x1;
b.max = x2;
}
b.background = this;
System.out.println("Background limits (" + g.ll_x + "," + g.ll_y + ") (" + g.ur_x + "," + g.ur_y + ") rot " + rotation);
return 1;
}
return 0;
}
}
......@@ -86,6 +86,37 @@ public class GrowPolyline extends GlowArrayElem {
trf = new GlowTransform();
}
public GrowPolyline( GrowCmn cmn, String name,
GlowPoint[] pointarray, int point_cnt,
int border_d_type, int line_w,
int fix_line_w, int fill, int display_border, int display_shadow,
int fill_d_type) {
this.cmn = cmn;
original_border_drawtype = border_d_type;
fill_drawtype = fill_d_type;
border = display_border;
shadow = display_shadow;
shadow_width = 5;
relief = Glow.eRelief_Up;
shadow_contrast = 2;
gradient = Glow.eGradient_No;
gradient_contrast = 4;
n_name = name;
draw_type = border_d_type;
line_width = line_w;
this.fill = fill;
for ( int i = 0; i < point_cnt; i++)
a_points.add(new GlowPoint(pointarray[i]));
points = new GlowPointX[a_points.size()];
for ( int i = 0; i < a_points.size(); i++)
points[i] = new GlowPointX();
trf = new GlowTransform();
}
public int type() {
return Glow.eObjectType_GrowPolyLine;
}
......@@ -105,7 +136,8 @@ public class GrowPolyline extends GlowArrayElem {
case Glow.eSave_GrowPolyLine:
break;
case Glow.eSave_GrowPolyLine_n_name:
n_name = token.nextToken();
if ( token.hasMoreTokens())
n_name = token.nextToken();
break;
case Glow.eSave_GrowPolyLine_x_right:
x_right = new Double(token.nextToken()).doubleValue();
......@@ -282,7 +314,6 @@ public class GrowPolyline extends GlowArrayElem {
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)
......@@ -322,7 +353,6 @@ public class GrowPolyline extends GlowArrayElem {
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;
}
......@@ -647,4 +677,68 @@ public class GrowPolyline extends GlowArrayElem {
}
return dir;
}
public void add_and_shift_y_value( double value) {
for ( int i = a_points.size() - 1; i > 0; i--) {
a_points.get(i).y = a_points.get(i-1).y;
}
a_points.get(0).y = value;
}
public void add_and_shift_y_value_filled( double value) {
for ( int i = a_points.size() - 2; i > 1; i--) {
a_points.get(i).y = a_points.get(i-1).y;
}
a_points.get(1).y = value;
}
public void get_borders( GlowTransform t, GlowGeometry g) {
int i;
double x1, y1, x2=0, y2=0;
for ( i = 0; i < a_points.size() - 1; i++) {
if ( t != null) {
if ( i == 0) {
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);
}
else {
x1 = x2;
y1 = y2;
}
x2 = trf.x( t, a_points.get(i).x, a_points.get(i).y);
y2 = trf.y( t, a_points.get(i).x, a_points.get(i).y);
}
else {
if ( i == 0) {
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 = x2;
y1 = y2;
}
x2 = trf.x( a_points.get(i+1).x, a_points.get(i+1).y);
y2 = trf.y( a_points.get(i+1).x, a_points.get(i+1).y);
}
if ( x1 < g.ll_x)
g.ll_x = x1;
if ( x2 < g.ll_x)
g.ll_x = x2;
if ( x1 > g.ur_x)
g.ur_x = x1;
if ( x2 > g.ur_x)
g.ur_x = x2;
if ( y1 < g.ll_y)
g.ll_y = y1;
if ( y2 < g.ll_y)
g.ll_y = y2;
if ( y1 > g.ur_y)
g.ur_y = y1;
if ( y2 > g.ur_y)
g.ur_y = y2;
}
}
}
......@@ -124,7 +124,8 @@ public class GrowRect extends GlowArrayElem {
case Glow.eSave_GrowRect:
break;
case Glow.eSave_GrowRect_n_name:
n_name = token.nextToken();
if ( token.hasMoreTokens())
n_name = token.nextToken();
break;
case Glow.eSave_GrowRect_x_right:
x_right = new Double(token.nextToken()).doubleValue();
......
/*
* 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 GrowSlider extends GrowNode {
int direction;
double max_value;
double min_value;
double max_pos;
double min_pos;
public GrowSlider(GrowCmn cmn) {
super(cmn);
}
public int type() {
return Glow.eObjectType_GrowSlider;
}
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( "GrowSlider : " + line);
switch ( key) {
case Glow.eSave_GrowSlider:
break;
case Glow.eSave_GrowSlider_direction:
direction = new Integer(token.nextToken()).intValue();
break;
case Glow.eSave_GrowSlider_max_value:
max_value = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowSlider_min_value:
min_value = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowSlider_max_pos:
max_pos = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowSlider_min_pos:
min_pos = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowSlider_grownode_part:
super.open(reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowSlider");
break;
}
if ( end_found)
break;
}
} catch ( Exception e) {
System.out.println( "IOException GrowSlider");
}
}
public void draw() {
super.draw();
}
public double get_origo( int direction) {
GlowTransform t = new GlowTransform();
GlowGeometry g = new GlowGeometry();
g.ur_x = 10e-37;
g.ll_x = 10e37;
g.ur_y = 10e-37;
g.ll_y = 10e37;
double pos;
// Get borders in the nodeclass coordinates
nc.get_borders( t, g);
switch ( direction) {
case Glow.eDirection_Down:
case Glow.eDirection_Up:
if ( Math.abs(g.ur_y - g.ll_y) < Double.MIN_VALUE)
pos = y_low;
else
pos = (nc.y0 - g.ll_y) * (y_high - y_low) / (g.ur_y - g.ll_y);
break;
case Glow.eDirection_Left:
case Glow.eDirection_Right:
if ( Math.abs(g.ur_y - g.ll_y) < Double.MIN_VALUE)
pos = y_low;
else
pos = (nc.y0 - g.ll_y) * (x_right - x_left) / (g.ur_y - g.ll_y);
break;
default:
pos = 0;
}
return pos;
}
public GlowSliderInfo get_info() {
GlowSliderInfo info = new GlowSliderInfo();
info.direction = direction;
info.max_value = max_value;
info.min_value = min_value;
info.max_position = max_pos;
info.min_position = min_pos;
return info;
}
public void set_info(GlowSliderInfo info) {
direction = info.direction;
max_value = info.max_value;
min_value = info.min_value;
max_pos = info.max_position;
min_pos = info.min_position;
}
}
......@@ -48,7 +48,7 @@ public class GrowText extends GlowArrayElem {
double y_low;
int original_color_drawtype;
int font;
int adjustment;
int adjustment = Glow.eAdjustment_Left;
int dynamicsize;
GlowTransform trf;
......@@ -80,7 +80,8 @@ public class GrowText extends GlowArrayElem {
case Glow.eSave_GrowText:
break;
case Glow.eSave_GrowText_n_name:
n_name = token.nextToken();
if ( token.hasMoreTokens())
n_name = token.nextToken();
break;
case Glow.eSave_GrowText_x_right:
x_right = new Double(token.nextToken()).doubleValue();
......
This diff is collapsed.
......@@ -8,6 +8,8 @@ local_java_sources := \
GlowGeometry.java,\
GlowPointX.java,\
GlowDimension.java,\
GlowSliderInfo.java,\
GlowBackgroundObject.java,\
GlowMenuInfo.java,\
GrowApplIfc.java,\
GlowColorRgb.java,\
......@@ -27,6 +29,7 @@ local_java_sources := \
GlowConPoint.java,\
GrowNode.java,\
GrowGroup.java,\
GrowSlider.java,\
GrowRect.java,\
GrowArc.java,\
GrowLine.java,\
......@@ -34,6 +37,8 @@ local_java_sources := \
GrowText.java,\
GrowAnnot.java,\
GrowMenu.java,\
GrowBar.java,\
GrowTrend.java,\
GlowVector.java,\
GrowCtx.java,\
DynParsedAttrName.java,\
......@@ -42,6 +47,7 @@ local_java_sources := \
Dyn.java,\
GraphApplIfc.java,\
Graph.java,\
GrowFrameApplIfc.java,\
GrowFrame.java
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
......
......@@ -23,6 +23,6 @@ done < $bootfile
echo $systemname
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar:$pwr_lib/pwr_jopc.jar:$pwr_lib/pwr_bcomp.jar:$pwr_lib/pwr_bcompfc.jar:$pwr_lib/pwr_abb.jar:$pwrp_lib/pwrp_$systemname.jar
export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwr_lib/pwr_jop.jar:$pwr_lib/pwr_jopg.jar:$pwr_lib/pwr_jopc.jar:$pwr_lib/pwr_bcomp.jar:$pwr_lib/pwr_bcompfc.jar:$pwr_lib/pwr_abb.jar:$pwrp_lib/pwrp_$systemname.jar
export LD_LIBRARY_PATH=$pwr_exe
$jdk/bin/java jpwr.jop.JopOp
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