Commit 44d9a058 authored by Claes Sjofors's avatar Claes Sjofors

Java android app work

parent 2f691c46
......@@ -70,11 +70,13 @@ public class AXtt {
PlowRect r1 = new PlowRect(cmn, 0D, 0D, 50D, 1.5D, Plow.COLOR_WHITE, Plow.COLOR_BLACK,true,false,false);
PlowAnnot a1 = new PlowAnnot(cmn, 3D, 1.1D, 12, Plow.COLOR_BLACK, 0, PlowAnnot.NEXT_RELATIVE_POSITION, 0);
PlowAnnot a11 = new PlowAnnot(cmn, 9D, 1.1D, 12, Plow.COLOR_BLACK, 0, PlowAnnot.RELATIVE_POSITION, 1);
PlowAnnot a12 = new PlowAnnot(cmn, 15D, 1.1D, 12, Plow.COLOR_BLACK, 0, PlowAnnot.RELATIVE_POSITION, 2);
PlowAnnotPixmap p1 = new PlowAnnotPixmap(cmn, 1D, 0.28D, 0);
ncObject = new PlowNodeClass(cmn);
ncObject.insert(r1);
ncObject.insert(a1);
ncObject.insert(a11);
ncObject.insert(a12);
ncObject.insert(p1);
cmn.insert_nc(ncObject);
}
......
......@@ -53,6 +53,11 @@ public class AXttItemObject extends AXttItemBase {
node.setAnnotPixmap(0, axtt.iconLeaf);
node.setAnnotation(0, ret.str, 22);
node.setAnnotation(1, cnameret.str, 11);
ret = axtt.gdh.getObjectInfoString( fullName + ".Description");
if ( ret.oddSts())
node.setAnnotation(2, ret.str, 0);
axtt.cmn.insertNode(node, destination, destCode);
y += 1.5D;
......
......@@ -67,6 +67,8 @@ public class FlowCmn implements PlowCmnIfc {
FlowNode selectedNode;
boolean opened = false;
Object userData;
double storedScrollX = 0;
double storedScrollY = 0;
Vector<FlowArrayElem> a = new Vector<FlowArrayElem>();
Vector<FlowArrayElem> a_nc = new Vector<FlowArrayElem>();
......@@ -106,6 +108,20 @@ public class FlowCmn implements PlowCmnIfc {
zoom_factor *= factor;
draw();
}
@Override
public void zoom(double factor, double x, double y) {
double scrollX = (x + offset_x) * factor - (x + offset_x) + storedScrollX;
double scrollY = (y + offset_y) * factor - (y + offset_y) + storedScrollY;
storedScrollX = scrollX - (double)((int)scrollX);
storedScrollY = scrollY - (double)((int)scrollY);
zoom_factor *= factor;
scroll( (int)scrollX, (int)scrollY);
draw();
}
@Override
public void scroll( int x, int y) {
offset_y += y;
......
......@@ -33,7 +33,12 @@ public class GraphCmn implements PlowCmnIfc {
public void zoom(double factor) {
graph.ctx.zoom(factor);
}
public void scroll( int x, int y) {}
public void zoom(double factor, double x, double y) {
graph.ctx.zoom(factor, x, y);
}
public void scroll( int x, int y) {
graph.ctx.scroll( x, y);
}
public void pageUp() {}
public void pageDown() {}
public synchronized void eventHandler(int action, double fx, double fy) {
......
......@@ -86,6 +86,7 @@ public class OpwinCmn implements PlowCmnIfc {
public void setNodraw() {}
public void resetNodraw() {}
public void zoom(double factor) {}
public void zoom(double factor, double x, double y) {}
public void scroll( int x, int y) {
if ( borderY < canvasHeight)
return;
......
......@@ -110,13 +110,21 @@ public class PlowCmn implements PlowCmnIfc {
zoom_factor *= factor;
draw();
}
public void zoom(double factor, double x, double y) {
zoom_factor *= factor;
scroll( 0, (int)((y + offset_y) * factor - (y + offset_y)));
draw();
}
public void scroll( int x, int y) {
offset_y += y;
// offset_x += x;
if ( offset_y < borders.y_low * zoom_factor)
offset_y = (int)(borders.y_low * zoom_factor);
if ( offset_y > borders.y_high * zoom_factor - canvasHeight + 80)
if ( offset_y > borders.y_high * zoom_factor - canvasHeight + 80) {
offset_y = (int)(borders.y_high * zoom_factor - canvasHeight + 80);
if ( offset_y < borders.y_low * zoom_factor)
offset_y = (int)(borders.y_low * zoom_factor);
}
}
public void pageUp() {
offset_y -= canvasHeight * 0.8;
......@@ -166,6 +174,10 @@ public class PlowCmn implements PlowCmnIfc {
}
public void setCanvas(Canvas canvas) {
gdraw.setCanvas(canvas);
if ( canvasWidth == 0) {
canvasWidth = gdraw.getCanvasWidth();
canvasHeight = gdraw.getCanvasHeight();
}
}
public Object getFirst() {
return a.get_first();
......
......@@ -16,6 +16,7 @@ public interface PlowCmnIfc {
public void setNodraw();
public void resetNodraw();
public void zoom(double factor);
public void zoom(double factor, double x, double y);
public void scroll( int x, int y);
public void pageUp();
public void pageDown();
......
......@@ -61,11 +61,15 @@ public class GlowDraw implements GlowDrawIfc {
Activity activity;
Canvas canvas;
Paint paint;
int clip_x1[] = new int[10];
int clip_y1[] = new int[10];
int clip_x2[] = new int[10];
int clip_y2[] = new int[10];
int clipCount = 0;
public GlowDraw() {
paint = new Paint();
}
public void setActivity(Activity activity) {
......@@ -511,11 +515,39 @@ public class GlowDraw implements GlowDrawIfc {
}
public int set_clip_rectangle( int x1, int y1, int x2, int y2) {
if ( clipCount > 0) {
if ( clipCount >= 10)
return 0;
if ( x1 < clip_x1[clipCount-1])
x1 = clip_x1[clipCount-1];
if ( y1 < clip_y1[clipCount-1])
y1 = clip_y1[clipCount-1];
if ( x2 > clip_x2[clipCount-1])
x2 = clip_x2[clipCount-1];
if ( y2 > clip_y2[clipCount-1])
y2 = clip_y2[clipCount-1];
}
clip_x1[clipCount] = x1;
clip_y1[clipCount] = y1;
clip_x2[clipCount] = x2;
clip_y2[clipCount] = y2;
clipCount++;
canvas.clipRect(x1, y1, x2, y2, Region.Op.REPLACE);
return 1;
}
public void reset_clip_rectangle() {
canvas.clipRect(0, 0, canvas.getWidth(), canvas.getHeight(), Region.Op.REPLACE);
if ( clipCount == 0) {
System.out.println("Clip mismatch");
return;
}
clipCount--;
if ( clipCount > 0) {
canvas.clipRect( clip_x1[clipCount-1], clip_y1[clipCount-1],
clip_x2[clipCount-1], clip_y2[clipCount-1], Region.Op.REPLACE);
}
else
canvas.clipRect(0, 0, canvas.getWidth(), canvas.getHeight(), Region.Op.REPLACE);
}
}
......@@ -38,8 +38,8 @@
package jpwr.jopg;
import jpwr.rt.*;
import java.io.*;
import java.awt.*;
import java.awt.font.*;
//import java.awt.*;
//import java.awt.font.*;
import java.net.*;
public class GrowFrame implements GraphApplIfc {
......@@ -326,6 +326,10 @@ public class GrowFrame implements GraphApplIfc {
public String getObject() {
return instance;
}
public Object loadGrowCtx( String fname) {
return null;
}
public void closeGraph() {}
}
......
......@@ -54,6 +54,7 @@ extern_java_sources := \
GrowTable.java,\
GrowImage.java,\
GrowWindow.java,\
GrowFolder.java,\
GrowConGlue.java,\
GlowVector.java,\
GrowCtx.java,\
......
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2013 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.jop;
import jpwr.rt.*;
import jpwr.jopg.*;
import java.io.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.awt.font.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.net.*;
import java.applet.*;
public class JopGrowFrame extends GrowFrame implements JopUtilityIfc {
String utilityName;
PwrtAttrRef utilityAref;
public JopGrowFrame( String file, Gdh gdh, String instance, GrowFrameApplIfc appl, Object root) {
super(file, gdh, instance, appl, root);
utilityName = JopUtility.fileToName( file);
if ( instance != null && !instance.equals("")) {
CdhrAttrRef oret = gdh.nameToAttrRef( instance);
if ( oret.oddSts()) {
utilityAref = oret.aref;
}
}
}
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.out.println("JopGrowFrame closing");
getAppl().frameClosed( (Object)this);
}
}
// JopUtility interface
public int getUtilityType() {
return JopUtility.GRAPH;
}
public PwrtObjid getUtilityObjid() {
return null;
}
public PwrtAttrRef getUtilityAttrRef() {
return utilityAref;
}
public String getUtilityName() {
return utilityName;
}
}
......@@ -168,6 +168,10 @@ public class JopSession {
public void openFast( String fastObject) {
((JopSessionIfc) sessionRep).openFast( fastObject);
}
public Object getUtility( int type, PwrtObjid objid, String name) {
return ((JopSessionIfc) sessionRep).getUtility( type, objid, name);
}
}
......
......@@ -66,4 +66,5 @@ public interface JopSessionIfc {
public void setOpWindowLanguage( int language );
public void openTrend( String[] trendList);
public void openFast( String fastObject);
public Object getUtility( int type, PwrtObjid objid, String name);
}
......@@ -275,9 +275,9 @@ public class JopSessionRep implements JopSessionIfc {
else {
Object graph;
if ( aref == null)
graph = getUtility( JopUtility.GRAPH, (PwrtObjid)null, name);
graph = getUtility( JopUtility.GRAPH, (PwrtObjid)null, JopUtility.fileToName(name));
else
graph = getUtility( JopUtility.GRAPH, aref.aref, name);
graph = getUtility( JopUtility.GRAPH, aref.aref, JopUtility.fileToName(name));
if ( graph != null) {
((JFrame)graph).setState(Frame.NORMAL);
((JFrame)graph).toFront();
......@@ -285,6 +285,8 @@ public class JopSessionRep implements JopSessionIfc {
else {
try {
graph = JopSpider.loadFrame( session, name, instance, scrollbar);
System.out.println("openGraphFrame graph: " + graph);
if ( graph != null) {
addUtility( graph);
System.out.println( "Add utility graph " + name);
......@@ -294,6 +296,7 @@ public class JopSessionRep implements JopSessionIfc {
}
}
}
System.out.println("openGraphFrame end");
}
public void openCrrFrame( String name) {
......@@ -343,6 +346,7 @@ public class JopSessionRep implements JopSessionIfc {
return o;
}
else {
System.out.println( "Utility: " + utilityName);
if ( ((JopUtilityIfc) o).getUtilityType() == type &&
utilityName.equals( name))
return o;
......
......@@ -73,7 +73,10 @@ public class JopSpider {
System.out.println("JopSpider command callback : " + cmd);
return JopSpider.command( session, cmd);
}
}
public void frameClosed( Object utility) {
session.removeUtility( utility);
}
}
public JopSpider( int op_qcom_qix) {
JopSpider.op_qcom_qix = op_qcom_qix;
......@@ -122,12 +125,11 @@ System.out.println( "qcom put finished");
new CliTable( "HELP", new String[] {"cli_arg1", "cli_arg2", "cli_arg3",
"cli_arg4", "/HELPFILE", "/POPNAVIGATOR", "/BOOKMARK", "/INDEX",
"/BASE", "/RETURNCOMMAND", "/WIDTH", "/HEIGHT", "/VERSION"}),
new CliTable( "SET", new String[] {"cli_arg1",
"/NAME", "/VALUE", "/BYPASS"}),
new CliTable( "SET", new String[] {"cli_arg1", "cli_arg2", "/NAME",
"/SOURCE", "/OBJECT", "/VALUE", "/BYPASS"}),
new CliTable( "EXAMPLE", new String[] {"/NAME", "/HIERARCHY"}),
new CliTable( "CHECK", new String[] {"cli_arg1", "/METHOD", "/OBJECT"}),
new CliTable( "CALL", new String[] {"cli_arg1", "/METHOD", "/OBJECT"}),
new CliTable( "SET", new String[] {"cli_arg1", "dcli_arg2"})
new CliTable( "CALL", new String[] {"cli_arg1", "/METHOD", "/OBJECT"})
};
static int command( JopSession session, String cmd) {
......@@ -594,6 +596,56 @@ System.out.println( "qcom put finished");
System.out.println( "setObjectInfoError " + sts);
}
}
String subwindow = "SUBWINDOW";
if ( subwindow.length() >= cli_arg1.length() &&
subwindow.substring(0,cli_arg1.length()).equals(cli_arg1)) {
// Command is "SET SUBWINDOW"
String name;
String graphstr;
String source;
String object;
PwrtStatus sts;
System.out.println("Command: set subwindow");
local_cmd = true;
if ( cli.qualifierFound("/NAME"))
name = cli.getQualValue("/NAME");
else {
System.out.println( "Cmd: name is missing\n");
return 0;
}
if ( cli.qualifierFound("/SOURCE"))
source = cli.getQualValue("/SOURCE");
else {
System.out.println( "Cmd: source is missing\n");
return 0;
}
if ( cli.qualifierFound("/OBJECT"))
object = cli.getQualValue("/OBJECT");
else
object = null;
if ( cli.qualifierFound("cli_arg2"))
graphstr = cli.getQualValue("cli_arg2").toLowerCase();
else {
System.out.println("Syntax error");
return 0;
}
if ( source.indexOf('.') == -1)
source = source + ".pwg";
Object graph = session.getUtility( JopUtility.GRAPH, (PwrtObjid)null, JopUtility.fileToName(graphstr));
if ( graph != null) {
System.out.println("JopSpider, " + graphstr + " found");
((JopGrowFrame)graph).setSubwindowSource( name, source, object);
}
else {
System.out.println("Graph " + graphstr + " is not opened");
return 0;
}
}
}
}
else if ( command.equals("CHECK")) {
......@@ -835,10 +887,11 @@ System.out.println( "JopSpiderCmd start");
String instance, boolean scrollbar) throws ClassNotFoundException {
if ( className.indexOf(".pwg") != -1) {
GrowFrame frame = new GrowFrame(className, session.getGdh(), instance, new GrowFrameCb(session),
session.getRoot());
JopGrowFrame frame = new JopGrowFrame(className, session.getGdh(), instance, new GrowFrameCb(session),
session.getRoot());
frame.validate();
frame.setVisible(true);
return frame;
}
else {
Object frame;
......@@ -880,7 +933,6 @@ System.out.println( "JopSpiderCmd start");
}
return null;
}
return null;
}
public static void openFrame( Object frame) {
......
......@@ -42,4 +42,18 @@ public class JopUtility {
public static final int GRAPH = 2;
public static final int NAVIGATOR = 3;
public static final int ALARMLIST = 4;
public static String fileToName( String file) {
String name;
int idx = file.lastIndexOf('/');
if ( idx == -1)
name = file;
else
name = file.substring(idx+1);
idx = name.indexOf('.');
if ( idx != -1)
name = name.substring( 0, idx);
return name;
}
}
......@@ -21,6 +21,7 @@ local_java_sources := \
JopConfirm.java \
JopConfirmDialog.java \
JopFrame.java \
JopGrowFrame.java \
JopApplet.java \
JopSpider.java \
Jop.java \
......
This diff is collapsed.
......@@ -44,6 +44,7 @@ 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 setUserData( Object userdata) {}
public void get_borders( GlowTransform t, GlowGeometry g) {}
public int get_background_object_limits(GlowTransform t, int type, double x, double y, Object b) {return 0;}
public int getClassDynType1() { return 0;}
......@@ -52,4 +53,6 @@ public class GlowArrayElem {
public int getClassActionType2() { return 0;}
public int getClassCycle() { return 0;}
public void setColorInverse(int color_inverse) {}
public Object getCmn() { return null;}
public String getName() { return null;}
}
......@@ -49,6 +49,11 @@ public class GlowDraw implements GlowDrawIfc {
Graphics2D g2;
boolean nodraw = true;
Font fonts[] = new Font[DRAW_FONT_SIZE * 2];
int clip_x1[] = new int[10];
int clip_y1[] = new int[10];
int clip_x2[] = new int[10];
int clip_y2[] = new int[10];
int clipCount = 0;
public void setNodraw(boolean nodraw) {
......@@ -488,11 +493,40 @@ 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-x1), (float)(y2-y1)));
if ( clipCount > 0) {
if ( clipCount >= 10)
return 0;
if ( x1 < clip_x1[clipCount-1])
x1 = clip_x1[clipCount-1];
if ( y1 < clip_y1[clipCount-1])
y1 = clip_y1[clipCount-1];
if ( x2 > clip_x2[clipCount-1])
x2 = clip_x2[clipCount-1];
if ( y2 > clip_y2[clipCount-1])
y2 = clip_y2[clipCount-1];
}
clip_x1[clipCount] = x1;
clip_y1[clipCount] = y1;
clip_x2[clipCount] = x2;
clip_y2[clipCount] = y2;
clipCount++;
g2.setClip(new Rectangle2D.Float((float)x1, (float)y1, (float)(x2-x1+1), (float)(y2-y1+1)));
return 1;
}
public void reset_clip_rectangle() {
g2.setClip(null);
if ( clipCount == 0) {
System.out.println("Clip mismatch");
return;
}
clipCount--;
if ( clipCount > 0) {
g2.setClip(new Rectangle2D.Float((float)clip_x1[clipCount-1], (float)clip_y1[clipCount-1],
(float)(clip_x2[clipCount-1]-clip_x1[clipCount-1]),
(float)(clip_y2[clipCount-1]-clip_y1[clipCount-1])));
}
else
g2.setClip(null);
}
}
......@@ -225,6 +225,12 @@ public class GlowVector {
a.add( c);
break;
}
case Glow.eSave_GrowFolder: {
GrowFolder c = new GrowFolder( cmn);
c.open( reader);
a.add( c);
break;
}
case Glow.eSave_Point: {
GlowPoint c = new GlowPoint();
c.open( reader);
......
......@@ -51,6 +51,8 @@ public class Graph implements GraphIfc, GrowApplIfc {
public GraphLocalDb ldb;
public GrowSlider currentSlider;
public double scan_time = 1;
GrowCmn[] cmnStack = new GrowCmn[10];
int cmnStackCnt = 0;
public Graph(GraphApplIfc appl, Gdh gdh) {
this.appl = appl;
......@@ -78,6 +80,9 @@ public class Graph implements GraphIfc, GrowApplIfc {
public GrowCtx getCtx() {
return ctx;
}
public GrowCmn getCmn() {
return cmn;
}
public void open(BufferedReader reader) {
ctx.open( reader);
......@@ -85,9 +90,46 @@ public class Graph implements GraphIfc, GrowApplIfc {
}
public void traceConnect(GlowArrayElem object) {
boolean cmn_popped = false;
// Check if new ctx
GrowCmn ocmn = (GrowCmn)object.getCmn();
if ( cmn != ocmn) {
cmnPop( ocmn);
cmn_popped = true;
}
Dyn dyn = (Dyn)object.getUserData();
if ( dyn != null)
dyn.connect(object);
if ( dyn == null) {
if ( cmn_popped)
cmnPush();
return;
}
if ( object.type() == Glow.eObjectType_GrowNode && dyn != null) {
int dyn_type1 = ((GrowNode)object).getClassDynType1();
if ( (((dyn_type1 & Dyn.mDynType1_HostObject) != 0 &&
(dyn.dyn_type1 & Dyn.mDynType1_Inherit) != 0)) ||
(dyn.dyn_type1 & Dyn.mDynType1_HostObject) != 0) {
Dyn nodeclass_dyn = (Dyn)((GrowNode)object).getClassUserData();
dyn.setTotal(null);
if ( nodeclass_dyn != null) {
Dyn old_dyn = dyn;
dyn = new Dyn( nodeclass_dyn);
dyn.merge( old_dyn);
object.setUserData( dyn);
dyn.setTotal(object);
}
}
}
System.out.println("before connect total_dyn_type1 : " + dyn.total_dyn_type1);
dyn.connect(object);
if ( cmn_popped)
cmnPush();
}
public void traceDisconnect(GlowArrayElem object) {
......@@ -244,7 +286,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
if ( (idx = str.indexOf("$object")) != -1) {
if ( appl != null) {
String oname = appl.getObject();
String oname = cmn.getOwner();
str = str.substring(0, idx) + oname + str.substring(idx+7);
System.out.println("Parse name $object " + oname + " str " + str);
}
......@@ -326,6 +368,18 @@ public class Graph implements GraphIfc, GrowApplIfc {
}
public void eventHandler(GlowEvent e) {
boolean cmn_popped = false;
if (e.object_type != Glow.eObjectType_NoObject &&
e.object != null) {
GrowCmn ocmn = (GrowCmn)((GlowArrayElem)e.object).getCmn();
if ( ocmn != null && cmn != ocmn) {
cmnPop( ocmn);
cmn_popped = true;
}
}
switch ( e.event) {
case Glow.eEvent_MB1Click:
if ( e.object_type == Glow.eObjectType_NoObject ||
......@@ -335,7 +389,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
event.event = Glow.eEvent_MenuDelete;
event.type = Glow.eEventType_Menu;
event.object = null;
System.out.println("Graph: delete any menu");
Vector<GlowArrayElem> list = ctx.get_object_list();
for ( int i = 0; i < list.size(); i++) {
GlowArrayElem o = list.get(i);
......@@ -398,6 +452,22 @@ public class Graph implements GraphIfc, GrowApplIfc {
break;
}
}
if ( cmn_popped)
cmnPush();
}
public Object loadCtx( String file) {
return appl.loadGrowCtx( file);
}
public Object loadGrowCtx( BufferedReader reader) {
GrowCtx ctx = new GrowCtx(this);
GrowCmn cmn = ctx.getCmn();
cmn.setGdraw(gdraw);
ctx.open( reader);
ctx.traceConnect();
return ctx;
}
public int command(String cmd) {
......@@ -405,6 +475,12 @@ public class Graph implements GraphIfc, GrowApplIfc {
return appl.command(cmd);
return 0;
}
public void closeGraph() {
if ( appl != null)
appl.closeGraph();
}
public void openConfirmDialog(Object dyn, String text, Object object) {
if ( appl != null)
appl.openConfirmDialog(dyn, text, object);
......@@ -434,4 +510,32 @@ public class Graph implements GraphIfc, GrowApplIfc {
public double getScanTime() {
return scan_time;
}
public void setOwner( String owner) {
cmn.setOwner( owner);
}
public void setSubwindowSource( String name, String source, String owner) {
GrowCtxIfc ctx = cmn.ctx;
if ( cmnStackCnt > 0)
ctx = cmnStack[cmnStackCnt-1].ctx;
ctx.setSubwindowSource( name, source, owner);
}
public void cmnPop( GrowCmn ncmn) {
if ( cmnStackCnt >= 10) {
System.out.println("** Graph cmn stack overflow");
return;
}
cmnStack[cmnStackCnt++] = cmn;
cmn = ncmn;
ctx = (GrowCtx)cmn.ctx;
}
public void cmnPush() {
if ( cmnStackCnt > 0) {
cmn = cmnStack[--cmnStackCnt];
ctx = (GrowCtx)cmn.ctx;
}
}
}
......@@ -43,4 +43,6 @@ public interface GraphApplIfc {
public int getWidth();
public int getHeight();
public String getObject();
public Object loadGrowCtx( String file);
public void closeGraph();
}
......@@ -50,7 +50,11 @@ public interface GraphIfc {
public Gdh getGdh();
public GraphLocalDb getLdb();
public GrowCtx getCtx();
public GrowCmn getCmn();
public void cmnPop( GrowCmn cmn);
public void cmnPush();
public int command(String cmd);
public void closeGraph();
public void openConfirmDialog(Object dyn, String text, Object object);
public void openValueInputDialog(Object dyn, String text, Object object);
public String get_reference_name(String name);
......
......@@ -45,4 +45,5 @@ public interface GrowApplIfc {
public void eventHandler(GlowEvent e);
public int getWidth();
public int getHeight();
public Object loadCtx( String file);
}
......@@ -442,4 +442,8 @@ public class GrowArc extends GlowArrayElem {
}
}
public String getName() {
return n_name;
}
}
......@@ -53,6 +53,7 @@ public class GrowCmn {
public int window_height;
public int subwindow_x;
public int subwindow_y;
public double subwindow_scale = 1;
}
public GrowApplIfc appl;
......@@ -109,6 +110,7 @@ public class GrowCmn {
double restriction_min_limit;
int recursive_trace;
public int nodraw;
public String owner = new String();
Vector<GlowArrayElem> a = new Vector<GlowArrayElem>();
Vector<GlowArrayElem> a_nc = new Vector<GlowArrayElem>();
......@@ -117,7 +119,7 @@ public class GrowCmn {
public GrowCmn( GrowCtxIfc ctx, GrowApplIfc appl) {
this.ctx = ctx;
this.appl = appl;
this.debug = true;
this.debug = false;
this.antiAliasing = true;
mw.window_width = getWidth();
mw.window_height = getHeight();
......@@ -140,4 +142,10 @@ public class GrowCmn {
nodraw--;
}
public void setOwner( String owner) {
this.owner = owner;
}
public String getOwner() {
return owner;
}
}
......@@ -49,6 +49,7 @@ public class GrowCtx implements GrowCtxIfc {
double node_move_last_x;
double node_move_last_y;
double slider_cursor_offset;
boolean trace_started = false;
public GrowCtx(GrowApplIfc appl) {
cmn = new GrowCmn( this, appl);
......@@ -411,7 +412,11 @@ public class GrowCtx implements GrowCtxIfc {
return 1;
}
public void eventHandler(GlowEvent e) {
public int eventHandler(GlowEvent e, double fx, double fy) {
return eventHandler( e);
}
public int eventHandler(GlowEvent e) {
int sts = 0;
double x = e.x * cmn.mw.zoom_factor_x - cmn.mw.offset_x;
double y = e.y * cmn.mw.zoom_factor_y - cmn.mw.offset_y;
......@@ -583,6 +588,7 @@ public class GrowCtx implements GrowCtxIfc {
e.object_type = cmn.callback_object_type;
cmn.appl.eventHandler(e);
}
return sts;
}
public void traceConnect() {
......@@ -594,7 +600,9 @@ public class GrowCtx implements GrowCtxIfc {
cmn.a.get(i).type() == Glow.eObjectType_GrowBar ||
cmn.a.get(i).type() == Glow.eObjectType_GrowTrend ||
cmn.a.get(i).type() == Glow.eObjectType_GrowTable ||
cmn.a.get(i).type() == Glow.eObjectType_GrowSlider) {
cmn.a.get(i).type() == Glow.eObjectType_GrowSlider ||
cmn.a.get(i).type() == Glow.eObjectType_GrowWindow ||
cmn.a.get(i).type() == Glow.eObjectType_GrowFolder) {
System.out.println("GrowCtx connect " + i + " (" + cmn.a.size() + ") " + cmn.a.get(i));
cmn.appl.traceConnect(cmn.a.get(i));
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
......@@ -606,20 +614,28 @@ public class GrowCtx implements GrowCtxIfc {
}
}
else if ( cmn.a.get(i).type() == Glow.eObjectType_GrowWindow ||
cmn.a.get(i).type() == Glow.eObjectType_GrowFolder) {
((GrowWindow)cmn.a.get(i)).traceConnect();
}
}
}
cmn.nodraw--;
trace_started = true;
}
public void traceDisconnect() {
int sts;
trace_started = false;
for ( int i = 0; i < cmn.a.size(); i++) {
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowNode ||
cmn.a.get(i).type() == Glow.eObjectType_GrowGroup ||
cmn.a.get(i).type() == Glow.eObjectType_GrowBar ||
cmn.a.get(i).type() == Glow.eObjectType_GrowTrend ||
cmn.a.get(i).type() == Glow.eObjectType_GrowTable ||
cmn.a.get(i).type() == Glow.eObjectType_GrowSlider) {
cmn.a.get(i).type() == Glow.eObjectType_GrowSlider ||
cmn.a.get(i).type() == Glow.eObjectType_GrowWindow ||
cmn.a.get(i).type() == Glow.eObjectType_GrowFolder) {
cmn.appl.traceDisconnect(cmn.a.get(i));
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) {
......@@ -630,6 +646,10 @@ public class GrowCtx implements GrowCtxIfc {
}
}
else if ( cmn.a.get(i).type() == Glow.eObjectType_GrowWindow ||
cmn.a.get(i).type() == Glow.eObjectType_GrowFolder) {
((GrowWindow)cmn.a.get(i)).traceDisconnect();
}
}
}
}
......@@ -641,7 +661,9 @@ public class GrowCtx implements GrowCtxIfc {
cmn.a.get(i).type() == Glow.eObjectType_GrowBar ||
cmn.a.get(i).type() == Glow.eObjectType_GrowTrend ||
cmn.a.get(i).type() == Glow.eObjectType_GrowTable ||
cmn.a.get(i).type() == Glow.eObjectType_GrowSlider) {
cmn.a.get(i).type() == Glow.eObjectType_GrowSlider ||
cmn.a.get(i).type() == Glow.eObjectType_GrowWindow ||
cmn.a.get(i).type() == Glow.eObjectType_GrowFolder) {
cmn.appl.traceScan(cmn.a.get(i));
if ( cmn.a.get(i).type() == Glow.eObjectType_GrowGroup) {
for ( int j = 0; j < ((GrowNode)cmn.a.get(i)).nc.a.size(); j++) {
......@@ -652,10 +674,18 @@ public class GrowCtx implements GrowCtxIfc {
}
}
else if ( cmn.a.get(i).type() == Glow.eObjectType_GrowWindow ||
cmn.a.get(i).type() == Glow.eObjectType_GrowFolder) {
((GrowWindow)cmn.a.get(i)).traceScan();
}
}
}
}
public boolean traceStarted() {
return trace_started;
}
public GlowArrayElem get_nodeclass_from_name(String name) {
for ( int i = 0; i < cmn.a_nc.size(); i++) {
if ( name.equals(((GlowNodeClass)cmn.a_nc.get(i)).nc_name))
......@@ -740,10 +770,62 @@ public class GrowCtx implements GrowCtxIfc {
draw();
}
public void zoom( double factor, double x, double y) {
if ( Math.abs(factor) < Double.MIN_VALUE)
return;
double scrollX = (x + cmn.mw.offset_x) * factor - (x + cmn.mw.offset_x);
double scrollY = (y + cmn.mw.offset_y) * factor - (y + cmn.mw.offset_y);
cmn.mw.zoom_factor_x *= factor;
cmn.mw.zoom_factor_y *= factor;
scroll( (int)scrollX, (int)scrollY);
draw();
}
public void scroll( int delta_x, int delta_y) {
cmn.mw.offset_x += delta_x;
cmn.mw.offset_y += delta_y;
if ( !((cmn.x0 == 0 && cmn.x1 == 0) || (cmn.y0 == 0 && cmn.y1 == 0)
|| cmn.mw.window_width == 0 || cmn.mw.window_height == 0)) {
if ( cmn.mw.offset_x + cmn.mw.window_width > cmn.x1 * cmn.mw.zoom_factor_x)
cmn.mw.offset_x = (int)(cmn.x1 * cmn.mw.zoom_factor_x - cmn.mw.window_width);
if ( cmn.mw.offset_x < cmn.x0 * cmn.mw.zoom_factor_x)
cmn.mw.offset_x = (int)(cmn.x0 * cmn.mw.zoom_factor_x);
if ( cmn.mw.offset_y + cmn.mw.window_height > cmn.y1 * cmn.mw.zoom_factor_y)
cmn.mw.offset_y = (int)(cmn.y1 * cmn.mw.zoom_factor_y - cmn.mw.window_height);
if ( cmn.mw.offset_y < cmn.y0 * cmn.mw.zoom_factor_y)
cmn.mw.offset_y = (int)(cmn.y0 * cmn.mw.zoom_factor_y);
}
System.out.println("Scroll: offset (" + cmn.mw.offset_x + "," + cmn.mw.offset_y + ") window (" + cmn.mw.window_width + "," + cmn.mw.window_height);
draw();
}
public void openVector( BufferedReader reader, Object cmn, Vector a) {
GlowVector.open(reader, (GrowCmn)cmn, a);
}
public GlowArrayElem findByName( String name) {
for ( int i = 0; i < cmn.a.size(); i++) {
System.out.println("findByName: " + ((GlowArrayElem)cmn.a.get(i)).getName());
if ( ((GlowArrayElem)cmn.a.get(i)).getName().equalsIgnoreCase(name))
return (GlowArrayElem)cmn.a.get(i);
}
return null;
}
public void setSubwindowSource( String name, String source, String owner) {
GrowWindow e = (GrowWindow)findByName( name);
if ( e == null || e.type() != Glow.eObjectType_GrowWindow) {
System.out.println("Window " + name + " not found " + e);
return;
}
e.setSource( source, owner);
}
}
......
......@@ -56,5 +56,14 @@ public interface GrowCtxIfc {
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 zoom( double factor, double x, double y);
public void scroll( int delta_x, int delta_y);
public void openVector( BufferedReader reader, Object cmn, Vector a);
public int eventHandler(GlowEvent e, double fx, double fy);
public GrowCmn getCmn();
public void traceConnect();
public void traceDisconnect();
public void traceScan();
public boolean traceStarted();
public void setSubwindowSource( String name, String source, String owner);
}
This diff is collapsed.
......@@ -89,7 +89,7 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
localPanel.setLayout(null);
localPanel.setOpaque(true);
localPanel.setBackground( Color.white);
this.setTitle("GrowFrame");
setTitle( file, instance);
size = new Dimension( 1100, 900);
setSize( size);
......@@ -192,6 +192,8 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
// if ( gdh == null)
// gdh = new Gdh(this);
graph = new Graph(this, gdh);
if ( instance != null)
graph.setOwner( instance);
graph.open(reader);
setSize();
......@@ -200,7 +202,6 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
MouseAdapter adapter = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
System.out.println("MouseListener");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
......@@ -208,7 +209,6 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
graph.ctx.eventHandler( event);
}
public void mousePressed(MouseEvent e) {
System.out.println("MouseListener");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
......@@ -216,7 +216,6 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
graph.ctx.eventHandler( event);
}
public void mouseReleased(MouseEvent e) {
System.out.println("MouseListener");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
......@@ -305,6 +304,10 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
return 0;
}
public void closeGraph() {
dispatchEvent(new WindowEvent( this, WindowEvent.WINDOW_CLOSING));
}
public void confirmNo() {}
public void confirmYes() {
((Dyn)confirmDyn).confirmedAction( Glow.eEvent_MB1Click, confirmObject);
......@@ -472,6 +475,81 @@ public class GrowFrame extends JFrame implements GraphApplIfc, ActionListener {
public String getObject() {
return instance;
}
public Object loadGrowCtx( String fname) {
String filename;
BufferedReader reader = null;
if ( root != null && root instanceof JApplet) {
try {
URL current = ((JApplet) root).getCodeBase();
String current_str = current.toString();
int idx1 = current_str.lastIndexOf('/');
int idx2 = current_str.lastIndexOf(':');
int idx = idx1;
if ( idx2 > idx)
idx = idx2;
String path = current_str.substring(0,idx + 1);
filename = path + fname;
System.out.println( "Opening file " + filename);
URL fileURL = new URL( filename);
InputStream in = fileURL.openStream();
// in = new BufferedInputStream(in);
InputStreamReader r2 = new InputStreamReader(in);
reader = new BufferedReader( r2);
}
catch ( Exception e) {
System.out.println( "Unable to open file");
}
}
else {
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);
System.out.println( "Fname: " + filename);
try {
reader = new BufferedReader(new FileReader(filename));
}
catch ( Exception e) {
System.out.println( "Unable to open file " + filename);
return null;
}
}
return graph.loadGrowCtx( reader);
}
public void setTitle( String file, String instance) {
if ( instance != null)
super.setTitle( instance);
else {
String name;
int idx = file.lastIndexOf('/');
if ( idx == -1)
name = file;
else
name = file.substring(idx+1);
idx = name.lastIndexOf('.');
if ( idx != -1)
name = name.substring(0, idx);
super.setTitle(name);
}
}
public void setSubwindowSource( String name, String source, String object) {
graph.setSubwindowSource( name, source, object);
}
public GrowFrameApplIfc getAppl() {
return appl;
}
}
......
......@@ -39,4 +39,5 @@ package jpwr.jopg;
public interface GrowFrameApplIfc {
public int command(String cmd);
public void frameClosed( Object utility);
}
......@@ -362,4 +362,8 @@ public class GrowImage extends GlowArrayElem {
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 String getName() {
return n_name;
}
}
......@@ -248,5 +248,8 @@ public class GrowLine extends GlowArrayElem {
}
public String getName() {
return n_name;
}
}
......@@ -179,6 +179,8 @@ public class GrowMenu extends GrowRect {
if ( info.item[i].type == Glow.eMenuItem_PulldownMenu) {
// Draw arrow
GlowPointX[] p = new GlowPointX[4];
for ( int j = 0; j < 4; j++)
p[j] = new GlowPointX();
p[0].x = ur_x - arrow_size - 2;
p[0].y = (int)(ll_y + item_idx * item_height + item_height/2 - arrow_size/2);
p[1].x = ur_x - 2;
......
......@@ -108,6 +108,9 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
public int type() {
return Glow.eObjectType_GrowNode;
}
public Object getCmn() {
return cmn;
}
public void open(BufferedReader reader) {
String line;
......@@ -319,7 +322,7 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
case Glow.eSave_Node_trace_color2:
break;
case Glow.eSave_Node_access:
access = Integer.valueOf(token.nextToken());
access = Long.valueOf(token.nextToken()).intValue();
break;
case Glow.eSave_Node_cycle:
cycle = Integer.valueOf(token.nextToken());
......@@ -349,6 +352,9 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
GlowPointDX rp;
int sts;
if ( visible == 0 || dimmed != 0)
return 0;
switch ( event.event) {
case Glow.eEvent_CursorMotion:
return 0;
......@@ -358,7 +364,6 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
rp = trf.reverse( fx, fy);
sts = nc.eventHandler(event, rp.x, rp.y);
if ( sts != 0) {
System.out.println( "Hit in node " + sts);
if ( !(type() == Glow.eObjectType_GrowGroup && cmn.callback_object != null))
cmn.ctx.register_callback_object(Glow.eObjectType_Node, this);
return sts;
......@@ -566,9 +571,15 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
public int getClassCycle() {
return nc.cycle;
}
public Object getClassUserData() {
return nc.userdata;
}
public Object getUserData() {
return userdata;
}
public void setUserData( Object userdata) {
this.userdata = userdata;
}
public void setColorTone(int color_tone) {
this.color_tone = color_tone;
}
......@@ -995,4 +1006,7 @@ public class GrowNode extends GlowArrayElem implements GlowColorNode {
return dimmed;
}
public String getName() {
return n_name;
}
}
......@@ -744,4 +744,7 @@ public class GrowPolyline extends GlowArrayElem {
}
}
public String getName() {
return n_name;
}
}
......@@ -109,6 +109,10 @@ public class GrowRect extends GlowArrayElem {
return Glow.eObjectType_GrowRect;
}
public Object getCmn() {
return cmn;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
......@@ -280,7 +284,6 @@ public class GrowRect extends GlowArrayElem {
//rp.y = fy;
if ( ll.x <= rp.x && rp.x <= ur.x &&
ll.y <= rp.y && rp.y <= ur.y) {
System.out.println( "Event handler: Hit in rect");
return 1;
}
else
......@@ -574,4 +577,8 @@ public class GrowRect extends GlowArrayElem {
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 String getName() {
return n_name;
}
}
......@@ -314,7 +314,7 @@ public class GrowRectRounded extends GlowArrayElem {
if ( !display_shadow && ish == 0) {
if ( grad == Glow.eGradient_No) {
if ( chot != 0)
drawtype = GlowColor.shift_drawtype( fillcolor, chot, 0);
drawtype = GlowColor.shift_drawtype( fillcolor, chot, null);
else
drawtype = fillcolor;
......@@ -339,12 +339,12 @@ public class GrowRectRounded extends GlowArrayElem {
rotation = trf.rot();
if ( gradient_contrast >= 0) {
f2 = GlowColor.shift_drawtype( fillcolor, -gradient_contrast/2 + chot, 0);
f1 = GlowColor.shift_drawtype( fillcolor, (int)((float)(gradient_contrast)/2+0.6) + chot, 0);
f2 = GlowColor.shift_drawtype( fillcolor, -gradient_contrast/2 + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, (int)((float)(gradient_contrast)/2+0.6) + chot, null);
}
else {
f2 = GlowColor.shift_drawtype( fillcolor, -(int)((float)(gradient_contrast)/2-0.6) + chot, 0);
f1 = GlowColor.shift_drawtype( fillcolor, gradient_contrast/2 + chot, 0);
f2 = GlowColor.shift_drawtype( fillcolor, -(int)((float)(gradient_contrast)/2-0.6) + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, gradient_contrast/2 + chot, null);
}
cmn.gdraw.gradient_fill_rectrounded( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, amount,
fillcolor, f1, f2, cmn.gdraw.gradient_rotate( rotation, grad));
......@@ -379,7 +379,7 @@ public class GrowRectRounded extends GlowArrayElem {
if ( grad == Glow.eGradient_No) {
if ( chot != 0)
drawtype = GlowColor.shift_drawtype( fillcolor, chot, 0);
drawtype = GlowColor.shift_drawtype( fillcolor, chot, null);
else
drawtype = fillcolor;
......@@ -410,12 +410,12 @@ public class GrowRectRounded extends GlowArrayElem {
rotation = trf.rot();
if ( gradient_contrast >= 0) {
f2 = GlowColor.shift_drawtype( fillcolor, -gradient_contrast/2 + chot, 0);
f1 = GlowColor.shift_drawtype( fillcolor, (int)((float)(gradient_contrast)/2+0.6) + chot, 0);
f2 = GlowColor.shift_drawtype( fillcolor, -gradient_contrast/2 + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, (int)((float)(gradient_contrast)/2+0.6) + chot, null);
}
else {
f2 = GlowColor.shift_drawtype( fillcolor, -(int)((float)(gradient_contrast)/2-0.6) + chot, 0);
f1 = GlowColor.shift_drawtype( fillcolor, gradient_contrast/2 + chot, 0);
f2 = GlowColor.shift_drawtype( fillcolor, -(int)((float)(gradient_contrast)/2-0.6) + chot, null);
f1 = GlowColor.shift_drawtype( fillcolor, gradient_contrast/2 + chot, null);
}
cmn.gdraw.gradient_fill_rectrounded( ll_x + ish, ll_y + ish, ur_x - ll_x - 2 * ish, ur_y - ll_y - 2 * ish,
amount - ish, fillcolor, f1, f2, cmn.gdraw.gradient_rotate( rotation, grad));
......@@ -561,4 +561,8 @@ public class GrowRectRounded extends GlowArrayElem {
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 String getName() {
return n_name;
}
}
......@@ -109,15 +109,14 @@ public class GrowScrollBar extends GrowRect {
// System.out.println("ScrollBar bdraw: (" + ll_x + "," + ll_y + ") w: " + (ur_x-ll_x) + " h: " + (ur_y-ll_y) + " color: " + fdrawtype);
cmn.gdraw.fill_rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fdrawtype);
if ( shadow != 0) {
shift_drawtype = GlowColor.shift_drawtype( fill_drawtype, 2, 0); // Dark
shift_drawtype = GlowColor.shift_drawtype( fill_drawtype, 2, null); // Dark
cmn.gdraw.line( ll_x+1, ll_y+1, ll_x+1, ur_y-1, shift_drawtype, 0, 0);
cmn.gdraw.line( ll_x+1, ll_y+1, ur_x-1, ll_y+1, shift_drawtype, 0, 0);
shift_drawtype = GlowColor.shift_drawtype( fill_drawtype, -2, 0); // Light
shift_drawtype = GlowColor.shift_drawtype( fill_drawtype, -2, null); // Light
cmn.gdraw.line( ll_x+1, ur_y-1, ur_x-1, ur_y-1, shift_drawtype, 0, 0);
cmn.gdraw.line( ur_x-1, ll_y+1, ur_x-1, ur_y-1, shift_drawtype, 0, 0);
}
System.out.println("ScrollBar direction: " + direction + " max-min: " + (max_value - min_value));
if ( max_value != min_value) {
switch ( direction) {
......@@ -142,10 +141,10 @@ public class GrowScrollBar extends GrowRect {
// System.out.println("ScrollBar fdraw: (" + x0 + "," + y0 + ") w: " + width + " h: " + height + " color: " + bar_color);
cmn.gdraw.fill_rect( x0, y0, width, height, bar_color);
if ( shadow != 0) {
shift_drawtype = GlowColor.shift_drawtype( bar_color, -2, 0); // Light
shift_drawtype = GlowColor.shift_drawtype( bar_color, -2, null); // Light
cmn.gdraw.line( x0+1, y0+1, x0+1, y0+height-1, shift_drawtype, 0, 0);
cmn.gdraw.line( x0+1, y0+1, x0+width-1, y0+1, shift_drawtype, 0, 0);
shift_drawtype = GlowColor.shift_drawtype( bar_color, 2, 0); // Dark
shift_drawtype = GlowColor.shift_drawtype( bar_color, 2, null); // Dark
cmn.gdraw.line( x0+1, y0+height-1, x0+width-1, y0+height-1, shift_drawtype, 0, 0);
cmn.gdraw.line( x0+width-1, y0+1, x0+width-1, y0+height-1, shift_drawtype, 0, 0);
}
......
......@@ -318,5 +318,8 @@ public class GrowText extends GlowArrayElem {
}
public String getName() {
return n_name;
}
}
......@@ -288,12 +288,12 @@ public class GrowTrend extends GrowRect {
else
rotation = trf.rot();
if ( gradient_contrast >= 0) {
f2 = GlowColor.shift_drawtype( drawtype, -gradient_contrast/2, 0);
f1 = GlowColor.shift_drawtype( drawtype, (int)((float)(gradient_contrast)/2+0.6), 0);
f2 = GlowColor.shift_drawtype( drawtype, -gradient_contrast/2, null);
f1 = GlowColor.shift_drawtype( drawtype, (int)((float)(gradient_contrast)/2+0.6), null);
}
else {
f2 = GlowColor.shift_drawtype( drawtype, -(int)((float)(gradient_contrast)/2-0.6), 0);
f1 = GlowColor.shift_drawtype( drawtype, gradient_contrast/2, 0);
f2 = GlowColor.shift_drawtype( drawtype, -(int)((float)(gradient_contrast)/2-0.6), null);
f1 = GlowColor.shift_drawtype( drawtype, gradient_contrast/2, null);
}
cmn.gdraw.gradient_fill_rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, f1, f2, cmn.gdraw.gradient_rotate( rotation, grad));
}
......
This diff is collapsed.
......@@ -56,6 +56,7 @@ local_java_sources := \
GrowConGlue.java,\
GrowImage.java,\
GrowWindow.java,\
GrowFolder.java,\
GlowVector.java,\
GrowCtx.java,\
DynParsedAttrName.java,\
......
......@@ -311,7 +311,6 @@ public class Cli {
if ( verb[0].length() > cliTable[i].command.length())
continue;
if ( verb[0].equals( cliTable[i].command.substring( 0, verb[0].length()))) {
// System.out.println("Verb found: " + cliTable[i].command);
verb[0] = cliTable[i].command;
found = true;
break;
......@@ -349,7 +348,6 @@ public class Cli {
if ( qualifier[j].length() > cliTable[cliTableIndex].qualifier[i].length())
continue;
if ( qualifier[j].equals( cliTable[cliTableIndex].qualifier[i].substring( 0, qualifier[j].length()))) {
// System.out.println("Qualifier found: " + cliTable[cliTableIndex].qualifier[i]);
cliQualifierIndex[j] = i;
found = true;
qualifier[j] = cliTable[cliTableIndex].qualifier[i];
......
......@@ -132,15 +132,37 @@ public class Pwr {
public static final int mPrv_Operator8 = 1 << 13;
public static final int mPrv_Operator9 = 1 << 14;
public static final int mPrv_Operator10 = 1 << 15;
public static final int mPrv_RtEventsAck = 1 << 18;
public static final int mPrv_RtPlc = 1 << 19;
public static final int mPrv_RtNavigator = 1 << 20;
public static final int mPrv_DevRead = 1 << 21;
public static final int mPrv_DevPlc = 1 << 22;
public static final int mPrv_DevConfig = 1 << 23;
public static final int mPrv_DevClass = 1 << 24;
public static final int mPrv_RtEventsBlock = 1 << 25;
public static final int mPrv_Administrator = 1 << 26;
public static final int mPrv_SevRead = 1 << 27;
public static final int mPrv_SevAdmin = 1 << 28;
public static final int mAccess_RtRead = mPrv_RtRead;
public static final int mAccess_RtWrite = mPrv_RtWrite;
public static final int mAccess_System = mPrv_System;
public static final int mAccess_Process = mPrv_Process;
public static final int mAccess_Instrument = mPrv_Instrument;
public static final int mAccess_RtEventsBlock = mPrv_RtEventsBlock;
public static final int mAccess_RtEventsAck = mPrv_RtEventsAck;
public static final int mAccess_RtPlc = mPrv_RtPlc;
public static final int mAccess_RtNavigator = mPrv_RtNavigator;
public static final int mAccess_AllRt = mPrv_System |
mPrv_Maintenance |
mPrv_Process |
mPrv_Instrument |
mPrv_Instrument |
mPrv_RtRead |
mPrv_RtWrite |
mPrv_RtEventsBlock |
mPrv_RtEventsAck |
mPrv_RtPlc |
mPrv_RtNavigator |
mPrv_Operator1 |
mPrv_Operator2 |
mPrv_Operator3 |
......
......@@ -48,4 +48,6 @@ package jpwr.rt;
public class Pwrs {
public static final int cClass_Node = 65784;
public static final int cClass_Security = 66080;
public static final int cClass_PlantHier = 65672;
public static final int cClass_NodeHier = 65768;
}
......@@ -1551,6 +1551,7 @@ open multiview <t>Open a multiview <LINK> open multiview
open jgraph <t>Open a java graph <LINK> open jgraph
open navigator <t>Open the navigator <LINK> open navigator
open operatorwindow<t>Open the operator window <LINK> open operatorwindow
open trace <t>Open trace for a plc window <LINK> open trace
open trend <t>Open DsTrend or PlotGroup graph <LINK> open trend
read object <t>Read the content of an object from file <LINK> read object
search <t>Search for an object or a string <LINK> search
......
......@@ -1558,6 +1558,7 @@ open graph <t>
open jgraph <t>Öppna en java graf <LINK> open jgraph
open fileview <t>Öppna en fileview <LINK> open fileview
open navigator <t>Öppna navigatorn <LINK> open navigator
open trace <t>Öppna trace för ett plc-fönster <LINK> open trace
open trend <t>Öppna en trendkurva <LINK> open trend
open operatorwindow<t>Öppna operatörsfönstret <LINK> open operatorwindow
read object <t>Läs innehållet av ett objekt från fil <LINK> read object
......
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