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,\
......
package jpwr.pwrxtt;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Date;
import java.util.StringTokenizer;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.MotionEventCompat;
import android.text.Editable;
import android.text.InputType;
import android.util.FloatMath;
......@@ -26,12 +32,15 @@ import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.view.*;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.graphics.*;
import jpwr.rt.*;
import jpwr.app.*;
......@@ -42,6 +51,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
static final int MODE_SCROLL = 1;
static final int MODE_ZOOM = 2;
String dataFile = "pwrdata";
Timer timer = new Timer();
MainView view;
Gdh gdh = null;
......@@ -51,6 +61,12 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
float lastTouchY;
float downTouchX;
float downTouchY;
int lastTouchId;
double lastXSpeed;
double lastYSpeed;
MotionEvent lastMotionEvent = null;
int eventCnt = 0;
Timer eventTimer = new Timer();
private EditText editInput;
private EditText editValueInput;
private EditText editUsername;
......@@ -79,7 +95,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
AlertDialog inputDialog = null;
AlertDialog loginDialog = null;
Context context;
static private boolean initDone = false;
boolean initDone = false;
String currentUser = null;
boolean newCurrentUser = false;
String pwrHost = null;
......@@ -91,7 +107,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
float eventDistance;
Vector<AGraphInfo> graphList = new Vector<AGraphInfo>();
Vector<PlowCmnIfc> cmnList = new Vector<PlowCmnIfc>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -111,7 +127,19 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
cmnList.add(cmn);
editInput = new EditText(this);
editInput.setText("10.0.2.2");
// Get stored host
String host = "10.0.2.2";
try {
SharedPreferences hostPrefs = getSharedPreferences("prefs", MODE_PRIVATE);
if ( hostPrefs != null)
host = hostPrefs.getString("host", "10.0.2.2");
}
catch ( ClassCastException e) {
}
editInput.setText( host, TextView.BufferType.EDITABLE);
editInput.setSingleLine();
new AlertDialog.Builder(this)
.setTitle(R.string.app_name)
......@@ -158,6 +186,14 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
setTitle("PwrXtt on " + pwrHost);
new GdhTask().execute(new GdhTaskArg(GdhTask.ROOTLIST,(AXttItemBase)null));
new GdhTask().execute(new GdhTaskArg(GdhTask.OPWIN, null));
// Store entered host for next session
SharedPreferences settings = getSharedPreferences("prefs", MODE_PRIVATE);
if ( settings != null) {
SharedPreferences.Editor editor = settings.edit();
editor.putString("host", pwrHost);
editor.commit();
}
}
}
......@@ -408,7 +444,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
break;
}
case R.id.opencrr_option: {
System.out.println("Open object");
System.out.println("Open cross");
if ( !gdh.isAuthorized(Pwr.mAccess_AllRt)) {
openMessageDialog("Not authorized");
break;
......@@ -435,7 +471,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
}
case R.id.openplc_option: {
System.out.println("Open plc");
if ( !gdh.isAuthorized(Pwr.mAccess_AllRt)) {
if ( !gdh.isAuthorized(Pwr.mAccess_RtPlc | Pwr.mAccess_System)) {
openMessageDialog("Not authorized");
break;
}
......@@ -581,7 +617,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
}
case R.id.navigator_option: {
System.out.println("Open Navigator");
if ( !gdh.isAuthorized(Pwr.mAccess_AllRt)) {
if ( !gdh.isAuthorized(Pwr.mAccess_RtNavigator | Pwr.mAccess_System)) {
openMessageDialog("Not authorized");
break;
}
......@@ -642,7 +678,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
break;
}
case R.id.alarmack_option: {
if ( !gdh.isAuthorized(Pwr.mAccess_AllRt)) {
if ( !gdh.isAuthorized(Pwr.mAccess_RtEventsAck | Pwr.mAccess_System)) {
openMessageDialog("Not authorized");
break;
}
......@@ -1143,53 +1179,26 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
for ( oret = gdh.getChild(oret.objid); oret.oddSts(); oret = gdh.getNextSibling(oret.objid)) {
CdhrClassId cret = gdh.getObjectClass(oret.objid);
if (cret.oddSts() && cret.getClassId() == Pwrb.cClass_AppGraph) {
CdhrString sret = gdh.objidToName(oret.objid, Cdh.mName_volumeStrict);
String name = sret.str;
AGraphInfo info = new AGraphInfo();
String aName = name + ".Image";
sret = gdh.getObjectInfoString(aName);
if ( sret.evenSts())
continue;
String image = sret.str;
if ( image.equals("")) {
info.bpm = BitmapFactory.decodeResource(getResources(), R.drawable.graph_icon);
}
else {
URL url = null;
try {
if ( image.startsWith("$pwr_exe/")) {
// url = new URL("http://10.0.2.2/data0/x4-8-6/rls/os_linux/hw_x86/exp/exe/" + filename.substring(9));
url = new URL("http://" + pwrHost + "/pwr_exe/" + image.substring(9));
}
else {
// url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename);
url = new URL("http://" + pwrHost + "/pwrp_exe/" + image);
}
info.bpm = BitmapFactory.decodeStream(url.openConnection().getInputStream());
} catch ( IOException e) {
info.bpm = BitmapFactory.decodeResource(getResources(), R.drawable.graph_icon);
System.out.println( "Unable to open file " + image + " " + url);
}
}
aName = name + ".Name";
sret = gdh.getObjectInfoString(aName);
if ( sret.evenSts())
continue;
info.graph = sret.str;
aName = name + ".Text";
sret = gdh.getObjectInfoString(aName);
if ( sret.evenSts())
continue;
info.text = sret.str;
graphList.add(info);
if (cret.evenSts())
break;
switch ( cret.getClassId()) {
case Pwrb.cClass_AppGraph:
addGraphList(oret.objid);
break;
case Pwrs.cClass_PlantHier:
case Pwrs.cClass_NodeHier:
for ( CdhrObjid oret2 = gdh.getChild(oret.objid);
oret2.oddSts();
oret2 = gdh.getNextSibling(oret2.objid)) {
CdhrClassId cret2 = gdh.getObjectClass(oret2.objid);
if (cret2.oddSts() && cret2.getClassId() == Pwrb.cClass_AppGraph)
addGraphList(oret2.objid);
}
break;
default: ;
}
}
if ( graphList.size() > 0) {
opwinCmn = new OpwinCmn(appl, graphList);
......@@ -1217,6 +1226,55 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
view.invalidate();
}
}
private void addGraphList( PwrtObjid objid) {
CdhrString sret = gdh.objidToName(objid, Cdh.mName_volumeStrict);
String name = sret.str;
AGraphInfo info = new AGraphInfo();
String aName = name + ".Image";
sret = gdh.getObjectInfoString(aName);
if ( sret.evenSts())
return;
String image = sret.str;
if ( image.equals("")) {
info.bpm = BitmapFactory.decodeResource(getResources(), R.drawable.graph_icon);
}
else {
URL url = null;
try {
if ( image.startsWith("$pwr_exe/")) {
// url = new URL("http://10.0.2.2/data0/x4-8-6/rls/os_linux/hw_x86/exp/exe/" + filename.substring(9));
url = new URL("http://" + pwrHost + "/pwr_exe/" + image.substring(9));
}
else {
// url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename);
url = new URL("http://" + pwrHost + "/pwrp_exe/" + image);
}
info.bpm = BitmapFactory.decodeStream(url.openConnection().getInputStream());
} catch ( IOException e) {
info.bpm = BitmapFactory.decodeResource(getResources(), R.drawable.graph_icon);
System.out.println( "Unable to open file " + image + " " + url);
}
}
aName = name + ".Name";
sret = gdh.getObjectInfoString(aName);
if ( sret.evenSts())
return;
info.graph = sret.str;
aName = name + ".Text";
sret = gdh.getObjectInfoString(aName);
if ( sret.evenSts())
return;
info.text = sret.str;
graphList.add(info);
}
private class ReaderTaskArg {
int action;
Object data1;
......@@ -1261,10 +1319,43 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
@Override
public boolean onTouchEvent(MotionEvent me) {
int action = me.getAction();
float x = me.getX();
float y = me.getY();
if ( me == null)
return true;
int action = MotionEventCompat.getActionMasked( me);
float x = MotionEventCompat.getX(me, 0);
float y = MotionEventCompat.getY(me, 0);
boolean isSustained = false;
if ( lastMotionEvent == me && eventCnt > 0) {
isSustained = true;
x = me.getX();
y = me.getY();
System.out.println("Sustain motion event: " + eventCnt + " " + lastXSpeed + " " + lastYSpeed);
System.out.println("x,y " + lastMotionEvent.getX() + " " + lastMotionEvent.getY());
eventCnt--;
if ( eventCnt == 0) {
lastMotionEvent = null;
lastXSpeed = 0;
lastYSpeed = 0;
eventMode = MODE_NO;
}
else {
lastXSpeed = 0.8 * lastXSpeed;
lastYSpeed = 0.8 * lastYSpeed;
lastMotionEvent = MotionEvent.obtain( lastMotionEvent.getDownTime(),
lastMotionEvent.getEventTime(),
lastMotionEvent.getAction(),
(float)(lastMotionEvent.getX() + lastXSpeed * 50),
(float)(lastMotionEvent.getY() + lastYSpeed * 50),
lastMotionEvent.getMetaState());
System.out.println("x,y " + lastMotionEvent.getX() + " " + lastMotionEvent.getY());
eventMode = MODE_SCROLL;
eventTimer.schedule( new EventTimerTask(), new Date(System.currentTimeMillis() + 50));
}
}
if ( viewOffsetY == 0) {
if ( context != null) {
TypedValue tv = new TypedValue();
......@@ -1273,35 +1364,58 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
int id = getResources().getIdentifier("status_bar_height", "dimen", "android");
if ( id > 0)
viewOffsetY += getResources().getDimensionPixelSize(id);
viewOffsetY = 60;
}
else
viewOffsetY = 80;
}
System.out.println("offset : " + viewOffsetY);
// System.out.println("offset : " + viewOffsetY);
switch (action) {
case MotionEvent.ACTION_MOVE:
System.out.println("Event Move " + action + " (" + x + "," + y + ")");
if ( isSustained)
System.out.println("Sustained scroll");
if ( eventMode == MODE_SCROLL) {
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){
if ( lastTouchId != me.getPointerId(0)) {
lastTouchX = x;
lastTouchY = y;
lastTouchId = me.getPointerId(0);
break;
}
if ( false /* currentCmn.type() == PlowCmnIfc.TYPE_GRAPH */){
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_MOVE, x, y-viewOffsetY)));
}
else {
System.out.println("Scroll " + x + " " + y);
if ( (int)(lastTouchY - y) != 0) {
currentCmn.scroll((int)(lastTouchX -x), (int)(lastTouchY - y));
view.invalidate();
}
lastTouchX = x;
lastTouchY = y;
lastTouchId = me.getPointerId(0);
}
if ( !isSustained) {
if ( lastMotionEvent != null) {
lastXSpeed = 0.5 * lastXSpeed + 0.5 * (x - lastMotionEvent.getX()) / (me.getEventTime() - lastMotionEvent.getEventTime());
lastYSpeed = 0.5 * lastYSpeed + 0.5 * (y - lastMotionEvent.getY()) / (me.getEventTime() - lastMotionEvent.getEventTime());
}
lastMotionEvent = MotionEvent.obtain( me.getDownTime(), me.getEventTime(),
me.getAction(), me.getX(), me.getY(),
me.getMetaState());
}
}
else if ( eventMode == MODE_ZOOM) {
float distance = eventDistance(me);
currentCmn.zoom(distance/eventDistance);
currentCmn.zoom(distance/eventDistance,
(MotionEventCompat.getX(me, 0) + MotionEventCompat.getX(me, 1))/2,
(MotionEventCompat.getY(me, 0) + MotionEventCompat.getY(me, 1))/2 + viewOffsetY);
eventDistance = distance;
view.invalidate();
}
break;
......@@ -1323,15 +1437,37 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
if ( Math.abs(x - downTouchX) < 10 && Math.abs(y - downTouchY) < 10 && currentCmn != null) {
currentCmn.eventHandler(action, x, y-viewOffsetY);
}
}
}
view.invalidate();
eventMode = MODE_NO;
if ( lastMotionEvent != null) {
System.out.println("ACTION UP, sustained motion event scheduled");
//lastXSpeed = (downTouchX - x) / (me.getDownTime() - me.getEventTime());
//lastYSpeed = (downTouchY - y) / (me.getDownTime() - me.getEventTime());
eventCnt = (int)(10 * FloatMath.sqrt((float)(lastXSpeed * lastXSpeed + lastYSpeed * lastYSpeed)));
long dt = me.getEventTime() - lastMotionEvent.getEventTime();
lastMotionEvent = MotionEvent.obtain( lastMotionEvent.getDownTime(),
lastMotionEvent.getEventTime(),
lastMotionEvent.getAction(),
(float)(lastMotionEvent.getX() + lastXSpeed * dt),
(float)(lastMotionEvent.getY() + lastYSpeed * dt),
lastMotionEvent.getMetaState());
eventTimer.schedule( new EventTimerTask(), new Date(System.currentTimeMillis() + 50));
eventMode = MODE_SCROLL;
}
break;
case MotionEvent.ACTION_DOWN:
System.out.println("Event Down " + action + " (" + x + "," + y + ")");
lastMotionEvent = null;
lastXSpeed = 0;
lastYSpeed = 0;
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_DOWN, x, y-viewOffsetY)));
}
lastTouchId = me.getPointerId(0);
lastTouchX = x;
lastTouchY = y;
downTouchX = x;
......@@ -1340,6 +1476,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
break;
case MotionEvent.ACTION_POINTER_DOWN:
System.out.println("Event Action Pointer Down");
lastMotionEvent = null;
lastXSpeed = 0;
lastYSpeed = 0;
eventDistance = eventDistance(me);
if ( eventDistance > 10)
......@@ -1347,18 +1486,29 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
break;
case MotionEvent.ACTION_POINTER_UP:
System.out.println("Event Action Pointer Up");
eventMode = MODE_NO;
eventMode = MODE_SCROLL;
break;
}
return true;
}
private float eventDistance(MotionEvent me) {
float x = me.getX(0) - me.getX(1);
float y = me.getY(0) - me.getY(1);
float x = MotionEventCompat.getX(me, 0) - MotionEventCompat.getX(me, 1);
float y = MotionEventCompat.getY(me, 0) - MotionEventCompat.getY(me, 1);
return FloatMath.sqrt(x * x + y * y);
}
class EventTimerTask extends TimerTask {
@Override
public void run() {
runOnUiThread( new Runnable() {
public void run() {
if ( lastMotionEvent != null)
onTouchEvent( lastMotionEvent);
}});
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
......@@ -1518,6 +1668,7 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
}
graph = new Graph(this, gdh);
graphObject.add(instance);
graph.setOwner(instance);
graph.open(reader);
graph.gdraw.setActivity(this);
GraphCmn cmn = new GraphCmn(graph);
......@@ -1589,6 +1740,27 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
return null;
}
public Object loadGrowCtx( String fname) {
String filename = fname;
BufferedReader reader;
URL url = null;
try {
if ( filename.startsWith("$pwr_exe/")) {
// url = new URL("http://10.0.2.2/data0/x4-8-6/rls/os_linux/hw_x86/exp/exe/" + filename.substring(9));
url = new URL("http://" + pwrHost + "/pwr_exe/" + filename.substring(9));
}
else {
// url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename);
url = new URL("http://" + pwrHost + "/pwrp_exe/" + filename);
}
reader = new BufferedReader(new InputStreamReader(url.openStream()));
} catch ( IOException e) {
System.out.println( "Unable to open file " + filename + " " + url);
return null;
}
return graph.loadGrowCtx(reader);
}
static CliTable[] cliTable = new CliTable[] {
new CliTable( "OPEN", new String[] {"cli_arg1", "cli_arg2", "/NAME",
"/FILE", "/SCROLLBAR", "/WIDTH", "/HEIGHT", "/MENU", "/NAVIGATOR",
......@@ -1597,8 +1769,8 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
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", "/VALUE", "/BYPASS", "/SOURCE", "/OBJECT"}),
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"}),
......@@ -1682,8 +1854,13 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
Boolean newFrame = true;
String frameName = null;
String urlValue = cli.getQualValue("cli_arg2");
if (!urlValue.startsWith("http://") && !urlValue.startsWith("https://"))
urlValue = "http://" + urlValue;
System.out.println("open url " + urlValue);
}
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlValue));
startActivity(browserIntent);
}
else if ( trend.length() >= cli_arg1.length() &&
trend.substring(0,cli_arg1.length()).equals(cli_arg1)) {
// Command is "OPEN TREND"
......@@ -1698,7 +1875,51 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
}
else if ( command.equals("SET")) {
if ( cli.qualifierFound("cli_arg1")) {
}
String cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase();
String subwindow = "SUBWINDOW";
if ( subwindow.length() >= cli_arg1.length() &&
subwindow.substring(0,cli_arg1.length()).equals(cli_arg1)) {
// Command is "SET SUBWINDOW"
if ( currentCmn.type() != PlowCmnIfc.TYPE_GRAPH)
return 0;
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";
((GraphCmn)currentCmn).graph.setSubwindowSource( name, source, object);
}
}
}
else if ( command.equals("CHECK")) {
if ( cli.qualifierFound("cli_arg1")) {
......@@ -1780,6 +2001,15 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
return 1;
}
public void closeGraph() {
new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_CLOSE, currentCmn));
if (graphObject.size() > 0)
graphObject.removeElementAt(graphObject.size()-1);
currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1);
view.invalidate();
}
public void invalidateView() {
view.invalidate();
}
......
/*
* 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 \
......
......@@ -112,6 +112,60 @@ public class Dyn {
public static final int mActionType2_No = 0;
//! Priority order for dyntypes and actiontypes. Lower value gives higher priority.
public static final int eDynPrio_DigSound = 0;
public static final int eDynPrio_HostObject = 1;
public static final int eDynPrio_Invisible = 2;
public static final int eDynPrio_DigFlash = 3;
public static final int eDynPrio_DigError = 4;
public static final int eDynPrio_DigWarning = 5;
public static final int eDynPrio_AnalogColor = 6;
public static final int eDynPrio_DigColor = 7;
public static final int eDynPrio_DigLowColor = 8;
public static final int eDynPrio_DigBorder = 9;
public static final int eDynPrio_DigText = 10;
public static final int eDynPrio_FillLevel = 11;
public static final int eDynPrio_Value = 12;
public static final int eDynPrio_ValueInput = 13;
public static final int eDynPrio_Rotate = 14;
public static final int eDynPrio_Move = 15;
public static final int eDynPrio_AnalogShift = 16;
public static final int eDynPrio_DigShift = 17;
public static final int eDynPrio_Animation = 18;
public static final int eDynPrio_Bar = 19;
public static final int eDynPrio_Trend = 20;
public static final int eDynPrio_FastCurve = 21;
public static final int eDynPrio_XY_Curve = 22;
public static final int eDynPrio_AnalogText = 23;
public static final int eDynPrio_Table = 24;
public static final int eDynPrio_SliderBackground = 25;
public static final int eDynPrio_Video = 26;
public static final int eDynPrio_StatusColor = 27;
public static final int eDynPrio_PopupMenu = 28;
public static final int eDynPrio_Confirm = 29;
public static final int eDynPrio_SetDig = 30;
public static final int eDynPrio_ResetDig = 31;
public static final int eDynPrio_ToggleDig = 32;
public static final int eDynPrio_StoDig = 33;
public static final int eDynPrio_Help = 34;
public static final int eDynPrio_OpenGraph = 35;
public static final int eDynPrio_OpenURL = 36;
public static final int eDynPrio_CommandDoubleClick = 37;
public static final int eDynPrio_IncrAnalog = 38;
public static final int eDynPrio_RadioButton = 39;
public static final int eDynPrio_Slider = 40;
public static final int eDynPrio_TipText = 41;
public static final int eDynPrio_PulldownMenu = 42;
public static final int eDynPrio_OptionMenu = 43;
public static final int eDynPrio_InputFocus = 44;
public static final int eDynPrio_DigCommand = 45;
public static final int eDynPrio_SetValue = 46;
public static final int eDynPrio_Pie = 47;
public static final int eDynPrio_BarChart = 48;
public static final int eDynPrio_Axis = 49;
public static final int eDynPrio_Command = 9999;
public static final int eDynPrio_CloseGraph = 10000;
public static final int eSave_Dyn = 1;
public static final int eSave_DigLowColor = 2;
public static final int eSave_DigColor = 3;
......@@ -371,6 +425,7 @@ public class Dyn {
public static final int eSave_AnalogColor_color = 6103;
public static final int eSave_AnalogColor_instance = 6104;
public static final int eSave_AnalogColor_instance_mask = 6105;
public static final int eSave_AnalogColor_border = 6106;
public static final int eSave_TipText_text = 6200;
public static final int eSave_Help_topic = 6300;
public static final int eSave_Help_bookmark = 6400;
......@@ -536,10 +591,11 @@ public class Dyn {
public static final int ePwrStatus_Error = 3;
public static final int ePwrStatus_Fatal = 4;
public static final boolean debug = true;
public static final boolean debug = false;
Vector<DynElem> elements = new Vector<DynElem>();
GraphIfc graph;
GlowArrayElem object;
int dyn_type1;
int dyn_type2;
int action_type1;
......@@ -559,6 +615,355 @@ public class Dyn {
this.graph = graph;
}
public Dyn(Dyn x) {
this.graph = x.graph;
this.dyn_type1 = x.dyn_type1;
this.dyn_type2 = x.dyn_type2;
this.total_dyn_type1 = x.total_dyn_type1;
this.total_dyn_type2 = x.total_dyn_type2;
this.action_type1 = x.action_type1;
this.action_type2 = x.action_type2;
this.total_action_type1 = x.total_action_type1;
this.total_action_type2 = x.total_action_type2;
this.access = x.access;
this.cycle = x.cycle;
for ( int i = 0; i < x.elements.size(); i++) {
DynElem e = null;
switch( x.elements.get(i).dyn_type1) {
case Dyn.mDynType1_DigLowColor:
e = new DynDigLowColor((DynDigLowColor) x.elements.get(i)); break;
case Dyn.mDynType1_DigColor:
e = new DynDigColor((DynDigColor) x.elements.get(i)); break;
case Dyn.mDynType1_DigError:
e = new DynDigError((DynDigError) x.elements.get(i)); break;
case Dyn.mDynType1_DigWarning:
e = new DynDigWarning((DynDigWarning) x.elements.get(i)); break;
case Dyn.mDynType1_DigFlash:
e = new DynDigFlash((DynDigFlash) x.elements.get(i)); break;
case Dyn.mDynType1_Invisible:
e = new DynInvisible((DynInvisible) x.elements.get(i)); break;
case Dyn.mDynType1_DigBorder:
e = new DynDigBorder((DynDigBorder) x.elements.get(i)); break;
case Dyn.mDynType1_DigText:
e = new DynDigText((DynDigText) x.elements.get(i)); break;
case Dyn.mDynType1_Value:
e = new DynValue((DynValue) x.elements.get(i)); break;
case Dyn.mDynType1_AnalogColor:
e = new DynAnalogColor((DynAnalogColor) x.elements.get(i)); break;
case Dyn.mDynType1_Rotate:
e = new DynRotate((DynRotate) x.elements.get(i)); break;
case Dyn.mDynType1_Move:
e = new DynMove((DynMove) x.elements.get(i)); break;
case Dyn.mDynType1_DigShift:
e = new DynDigShift((DynDigShift) x.elements.get(i)); break;
case Dyn.mDynType1_AnalogShift:
e = new DynAnalogShift((DynAnalogShift) x.elements.get(i)); break;
case Dyn.mDynType1_Video:
e = new DynVideo((DynVideo) x.elements.get(i)); break;
case Dyn.mDynType1_Animation:
e = new DynAnimation((DynAnimation) x.elements.get(i)); break;
case Dyn.mDynType1_Bar:
e = new DynBar((DynBar) x.elements.get(i)); break;
case Dyn.mDynType1_Trend:
e = new DynTrend((DynTrend) x.elements.get(i)); break;
case Dyn.mDynType1_FillLevel:
e = new DynFillLevel((DynFillLevel) x.elements.get(i)); break;
case Dyn.mDynType1_FastCurve:
e = new DynFastCurve((DynFastCurve) x.elements.get(i)); break;
case Dyn.mDynType1_AnalogText:
e = new DynAnalogText((DynAnalogText) x.elements.get(i)); break;
case Dyn.mDynType1_Table:
e = new DynTable((DynTable) x.elements.get(i)); break;
case Dyn.mDynType1_StatusColor:
e = new DynStatusColor((DynStatusColor) x.elements.get(i)); break;
case Dyn.mDynType1_HostObject:
e = new DynHostObject((DynHostObject) x.elements.get(i)); break;
case Dyn.mDynType1_DigSound:
e = new DynDigSound((DynDigSound) x.elements.get(i)); break;
case Dyn.mDynType1_XY_Curve:
e = new DynXY_Curve((DynXY_Curve) x.elements.get(i)); break;
case Dyn.mDynType1_DigCommand:
e = new DynDigCommand((DynDigCommand) x.elements.get(i)); break;
case Dyn.mDynType1_Pie:
e = new DynPie((DynPie) x.elements.get(i)); break;
case Dyn.mDynType1_BarChart:
e = new DynBarChart((DynBarChart) x.elements.get(i)); break;
default: ;
}
switch( x.elements.get(i).dyn_type2) {
case Dyn.mDynType2_Axis:
e = new DynAxis((DynAxis) x.elements.get(i)); break;
default: ;
}
switch( x.elements.get(i).action_type1) {
case Dyn.mActionType1_PopupMenu:
e = new DynPopupMenu((DynPopupMenu) x.elements.get(i)); break;
case Dyn.mActionType1_SetDig:
e = new DynSetDig((DynSetDig) x.elements.get(i)); break;
case Dyn.mActionType1_ResetDig:
e = new DynResetDig((DynResetDig) x.elements.get(i)); break;
case Dyn.mActionType1_ToggleDig:
e = new DynToggleDig((DynToggleDig) x.elements.get(i)); break;
case Dyn.mActionType1_StoDig:
e = new DynStoDig((DynStoDig) x.elements.get(i)); break;
case Dyn.mActionType1_Command:
e = new DynCommand((DynCommand) x.elements.get(i)); break;
case Dyn.mActionType1_CommandDoubleClick:
e = new DynCommandDoubleClick((DynCommandDoubleClick) x.elements.get(i)); break;
case Dyn.mActionType1_Confirm:
e = new DynConfirm((DynConfirm) x.elements.get(i)); break;
case Dyn.mActionType1_IncrAnalog:
e = new DynIncrAnalog((DynIncrAnalog) x.elements.get(i)); break;
case Dyn.mActionType1_RadioButton:
e = new DynRadioButton((DynRadioButton) x.elements.get(i)); break;
case Dyn.mActionType1_Slider:
e = new DynSlider((DynSlider) x.elements.get(i)); break;
case Dyn.mActionType1_ValueInput:
e = new DynValueInput((DynValueInput) x.elements.get(i)); break;
case Dyn.mActionType1_TipText:
e = new DynTipText((DynTipText) x.elements.get(i)); break;
case Dyn.mActionType1_Help:
e = new DynHelp((DynHelp) x.elements.get(i)); break;
case Dyn.mActionType1_OpenGraph:
e = new DynOpenGraph((DynOpenGraph) x.elements.get(i)); break;
case Dyn.mActionType1_OpenURL:
e = new DynOpenURL((DynOpenURL) x.elements.get(i)); break;
case Dyn.mActionType1_InputFocus:
e = new DynInputFocus((DynInputFocus) x.elements.get(i)); break;
case Dyn.mActionType1_CloseGraph:
e = new DynCloseGraph((DynCloseGraph) x.elements.get(i)); break;
case Dyn.mActionType1_PulldownMenu:
e = new DynPulldownMenu((DynPulldownMenu) x.elements.get(i)); break;
case Dyn.mActionType1_OptionMenu:
e = new DynOptionMenu((DynOptionMenu) x.elements.get(i)); break;
case Dyn.mActionType1_SetValue:
e = new DynSetValue((DynSetValue) x.elements.get(i)); break;
default: ;
}
switch( x.elements.get(i).action_type2) {
default: ;
}
if ( e != null) {
e.dyn = this;
elements.add(e);
}
}
}
DynElem copy_element( DynElem x) {
DynElem e = null;
if ( x.action_type1 != 0) {
switch ( x.action_type1) {
case mActionType1_PopupMenu:
e = (DynElem) new DynPopupMenu((DynPopupMenu) x);
break;
case mActionType1_SetDig:
e = (DynElem) new DynSetDig((DynSetDig) x);
break;
case mActionType1_ResetDig:
e = (DynElem) new DynResetDig((DynResetDig) x);
break;
case mActionType1_ToggleDig:
e = (DynElem) new DynToggleDig((DynToggleDig) x);
break;
case mActionType1_StoDig:
e = (DynElem) new DynStoDig((DynStoDig) x);
break;
case mActionType1_Command:
e = (DynElem) new DynCommand((DynCommand) x);
break;
case mActionType1_CommandDoubleClick:
e = (DynElem) new DynCommandDoubleClick((DynCommandDoubleClick) x);
break;
case mActionType1_Confirm:
e = (DynElem) new DynConfirm((DynConfirm) x);
break;
case mActionType1_IncrAnalog:
e = (DynElem) new DynIncrAnalog((DynIncrAnalog) x);
break;
case mActionType1_RadioButton:
e = (DynElem) new DynRadioButton((DynRadioButton) x);
break;
case mActionType1_Slider:
e = (DynElem) new DynSlider((DynSlider) x);
break;
case mActionType1_ValueInput:
e = (DynElem) new DynValueInput((DynValueInput) x);
break;
case mActionType1_TipText:
e = (DynElem) new DynTipText((DynTipText) x);
break;
case mActionType1_Help:
e = (DynElem) new DynHelp((DynHelp ) x);
break;
case mActionType1_OpenGraph:
e = (DynElem) new DynOpenGraph((DynOpenGraph) x);
break;
case mActionType1_OpenURL:
e = (DynElem) new DynOpenURL((DynOpenURL) x);
break;
case mActionType1_InputFocus:
e = (DynElem) new DynInputFocus((DynInputFocus) x);
break;
case mActionType1_CloseGraph:
e = (DynElem) new DynCloseGraph((DynCloseGraph) x);
break;
case mActionType1_PulldownMenu:
e = (DynElem) new DynPulldownMenu((DynPulldownMenu) x);
break;
case mActionType1_OptionMenu:
e = (DynElem) new DynOptionMenu((DynOptionMenu) x);
break;
case mActionType1_SetValue:
e = (DynElem) new DynSetValue((DynSetValue) x);
break;
default: ;
}
}
else if ( x.action_type2 != 0) {
switch ( x.action_type2) {
default: ;
}
}
else if ( x.dyn_type1 != 0) {
switch ( x.dyn_type1) {
case mDynType1_DigLowColor:
e = (DynElem) new DynDigLowColor((DynDigLowColor) x);
break;
case mDynType1_DigColor:
e = (DynElem) new DynDigColor((DynDigColor) x);
break;
case mDynType1_DigWarning:
e = (DynElem) new DynDigWarning((DynDigWarning) x);
break;
case mDynType1_DigError:
e = (DynElem) new DynDigError((DynDigError) x);
break;
case mDynType1_DigFlash:
e = (DynElem) new DynDigFlash((DynDigFlash) x);
break;
case mDynType1_Invisible:
e = (DynElem) new DynInvisible((DynInvisible) x);
break;
case mDynType1_DigBorder:
e = (DynElem) new DynDigBorder((DynDigBorder) x);
break;
case mDynType1_DigText:
e = (DynElem) new DynDigText((DynDigText) x);
break;
case mDynType1_Value:
e = (DynElem) new DynValue((DynValue) x);
break;
case mDynType1_AnalogColor:
e = (DynElem) new DynAnalogColor((DynAnalogColor) x);
break;
case mDynType1_Rotate:
e = (DynElem) new DynRotate((DynRotate) x);
break;
case mDynType1_Move:
e = (DynElem) new DynMove((DynMove) x);
break;
case mDynType1_AnalogShift:
e = (DynElem) new DynAnalogShift((DynAnalogShift) x);
break;
case mDynType1_DigShift:
e = (DynElem) new DynDigShift((DynDigShift) x);
break;
case mDynType1_Animation:
e = (DynElem) new DynAnimation((DynAnimation) x);
break;
case mDynType1_Video:
e = (DynElem) new DynVideo((DynVideo) x);
break;
case mDynType1_Bar:
e = (DynElem) new DynBar((DynBar) x);
break;
case mDynType1_Trend:
e = (DynElem) new DynTrend((DynTrend) x);
break;
case mDynType1_XY_Curve:
e = (DynElem) new DynXY_Curve((DynXY_Curve) x);
break;
case mDynType1_DigCommand:
e = (DynElem) new DynDigCommand((DynDigCommand) x);
break;
case mDynType1_FillLevel:
e = (DynElem) new DynFillLevel((DynFillLevel) x);
break;
case mDynType1_FastCurve:
e = (DynElem) new DynFastCurve((DynFastCurve) x);
break;
case mDynType1_AnalogText:
e = (DynElem) new DynAnalogText((DynAnalogText) x);
break;
case mDynType1_Table:
e = (DynElem) new DynTable((DynTable) x);
break;
case mDynType1_StatusColor:
e = (DynElem) new DynStatusColor((DynStatusColor) x);
break;
case mDynType1_Pie:
e = (DynElem) new DynPie((DynPie) x);
break;
case mDynType1_BarChart:
e = (DynElem) new DynBarChart((DynBarChart) x);
break;
case mDynType1_HostObject:
e = (DynElem) new DynHostObject((DynHostObject) x);
break;
case mDynType1_DigSound:
e = (DynElem) new DynDigSound((DynDigSound) x);
break;
default: ;
}
}
else if ( x.dyn_type2 != 0) {
switch ( x.dyn_type2) {
case mDynType2_Axis:
e = (DynElem) new DynAxis((DynAxis) x);
break;
default: ;
}
}
if ( e != null)
e.dyn = this;
return e;
}
public void merge( Dyn x) {
DynElem elem, xelem;
DynElem e;
dyn_type1 = dyn_type1 | x.dyn_type1;
total_dyn_type1 = total_dyn_type1 | x.total_dyn_type1;
action_type1 = action_type1 | x.action_type1;
total_action_type1 = total_action_type1 | x.total_action_type1;
for ( int i = 0; i < x.elements.size(); i++) {
xelem = x.elements.get(i);
for ( int j = 0; j < elements.size(); j++) {
elem = elements.get(j);
if ( elem.dyn_type1 == xelem.dyn_type1 &&
elem.dyn_type2 == xelem.dyn_type2 &&
elem.action_type1 == xelem.action_type1 &&
elem.action_type2 == xelem.action_type2) {
// Element exists in both, use element in x, i.e. remove current element
elements.remove(j);
break;
}
}
// Insert copy of x element
e = copy_element( xelem);
if ( e != null) {
elements.add( e);
}
}
}
public void open( BufferedReader reader) {
String line;
StringTokenizer token;
......@@ -804,6 +1209,14 @@ public class Dyn {
return action_type2;
}
String getHostObject() {
for ( int i = 0; i < elements.size(); i++) {
if ( (elements.get(i).dyn_type1 & Dyn.mDynType1_HostObject) != 0)
return ((DynHostObject)elements.get(i)).hostobject;
}
return "";
}
boolean getDig( int p, int a_typeid, int bitmask, int db) {
switch ( a_typeid) {
case Pwr.eType_Boolean: {
......@@ -895,17 +1308,55 @@ public class Dyn {
return 0;
}
public void setTotal( GlowArrayElem object) {
if ( object == null) {
total_dyn_type1 = dyn_type1;
total_dyn_type2 = dyn_type2;
total_action_type1 = action_type1;
total_action_type2 = action_type2;
}
else {
if ( (dyn_type1 & Dyn.mDynType1_Inherit) != 0) {
int inherit_dyn_type1 = object.getClassDynType1();
int inherit_dyn_type2 = object.getClassDynType2();
total_dyn_type1 = dyn_type1 | inherit_dyn_type1;
total_dyn_type2 = dyn_type2 | inherit_dyn_type2;
}
else {
total_dyn_type1 = dyn_type1;
total_dyn_type2 = dyn_type2;
}
if ( (action_type1 & Dyn.mActionType1_Inherit) != 0) {
int inherit_action_type1 = object.getClassActionType1();
int inherit_action_type2 = object.getClassActionType2();
total_action_type1 = action_type1 | inherit_action_type1;
total_action_type2 = action_type2 | inherit_action_type2;
}
else {
total_action_type1 = action_type1;
total_action_type2 = action_type2;
}
}
}
public DynParsedAttrName parseAttrName(String name) {
if ( (total_dyn_type1 & Dyn.mDynType1_HostObject) != 0) {
int idx = name.indexOf("$hostobject");
if ( idx != -1) {
String hostobject = getHostObject();
String n = name.substring(0, idx) + hostobject + name.substring(idx+11);
return graph.parseAttrName( n);
}
}
return graph.parseAttrName( name);
}
public int connect(GlowArrayElem object) {
System.out.println("Dyn connect object 0 " + object + " elements " + elements.size());
if ( (dyn_type1 & Dyn.mDynType1_Inherit) != 0) {
System.out.println("Dyn connect object 1 " + object + " elements " + elements.size());
int inherit_dyn_type1 = object.getClassDynType1();
System.out.println("Dyn connect object 2 " + object + " elements " + elements.size());
int inherit_dyn_type2 = object.getClassDynType2();
total_dyn_type1 = dyn_type1 | inherit_dyn_type1;
total_dyn_type2 = dyn_type2 | inherit_dyn_type2;
......@@ -914,7 +1365,6 @@ public class Dyn {
total_dyn_type1 = dyn_type1;
total_dyn_type2 = dyn_type2;
}
System.out.println("Dyn connect object 3 " + object + " elements " + elements.size());
if ( (action_type1 & Dyn.mActionType1_Inherit) != 0) {
int inherit_action_type1 = object.getClassActionType1();
......@@ -931,7 +1381,6 @@ public class Dyn {
cycle = object.getClassCycle();
for ( int i = 0; i < elements.size(); i++) {
System.out.println("Dyn connect " + elements.get(i));
elements.get(i).connect(object);
}
return 1;
......@@ -986,15 +1435,26 @@ public class Dyn {
int dyn_type2;
int action_type1;
int action_type2;
int prio;
int instance_mask;
int instance;
DynElem(Dyn dyn, int dyn_type1, int dyn_type2, int action_type1, int action_type2) {
DynElem(Dyn dyn, int dyn_type1, int dyn_type2, int action_type1, int action_type2, int prio) {
this.dyn = dyn;
this.dyn_type1 = dyn_type1;
this.dyn_type2 = dyn_type2;
this.action_type1 = action_type1;
this.action_type2 = action_type2;
this.prio = prio;
}
DynElem( DynElem x) {
this.dyn = x.dyn;
this.dyn_type1 = x.dyn_type1;
this.dyn_type2 = x.dyn_type2;
this.action_type1 = x.action_type1;
this.action_type2 = x.action_type2;
this.instance_mask = x.instance_mask;
this.instance = x.instance;
}
public int getDynType1() {return dyn_type1;}
public void open( BufferedReader reader) {}
......@@ -1018,7 +1478,13 @@ public class Dyn {
int a_typeid;
public DynDigLowColor( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigLowColor, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigLowColor, 0, 0, 0, Dyn.eDynPrio_DigLowColor);
}
public DynDigLowColor( DynDigLowColor x) {
super(x);
color = x.color;
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -1030,7 +1496,6 @@ public class Dyn {
DynParsedAttrName pname = dyn.parseAttrName(attribute);
if ( pname == null || pname.name.equals(""))
return 1;
System.out.println("DigLowColor: " + attribute + " pname " + pname.name + " db " + pname.database);
GdhrRefObjectInfo ret = null;
......@@ -1160,7 +1625,13 @@ public class Dyn {
int a_typeid;
public DynDigColor( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigColor, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigColor, 0, 0, 0, Dyn.eDynPrio_DigColor);
}
public DynDigColor( DynDigColor x) {
super(x);
color = x.color;
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -1317,7 +1788,12 @@ public class Dyn {
public DynDigWarning( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigWarning, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigWarning, 0, 0, 0, Dyn.eDynPrio_DigWarning);
}
public DynDigWarning( DynDigWarning x) {
super(x);
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -1453,7 +1929,12 @@ public class Dyn {
int a_typeid;
public DynDigError( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigError, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigError, 0, 0, 0, Dyn.eDynPrio_DigError);
}
public DynDigError( DynDigError x) {
super(x);
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -1592,7 +2073,15 @@ public class Dyn {
boolean on;
public DynDigFlash( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigFlash, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigFlash, 0, 0, 0, Dyn.eDynPrio_DigFlash);
}
public DynDigFlash( DynDigFlash x) {
super(x);
color = x.color;
color2 = x.color2;
on = x.on;
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -1760,7 +2249,12 @@ public class Dyn {
String command;
public DynInvisible( Dyn dyn) {
super(dyn, Dyn.mDynType1_Invisible, 0, 0, 0);
super(dyn, Dyn.mDynType1_Invisible, 0, 0, 0, Dyn.eDynPrio_Invisible);
}
public DynInvisible( DynInvisible x) {
super(x);
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -1923,7 +2417,13 @@ public class Dyn {
int a_typeid;
public DynDigBorder( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigBorder, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigBorder, 0, 0, 0, Dyn.eDynPrio_DigBorder);
}
public DynDigBorder( DynDigBorder x) {
super(x);
color = x.color;
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -1981,7 +2481,6 @@ public class Dyn {
else
firstScan = false;
System.out.println("DigBorder " + value + " color " + color);
if ( value) {
object.setBorderColor(color);
}
......@@ -2047,7 +2546,13 @@ public class Dyn {
int a_typeid;
public DynDigText( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigText, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigText, 0, 0, 0, Dyn.eDynPrio_DigText);
}
public DynDigText( DynDigText x) {
super(x);
attribute = x.attribute;
low_text = x.low_text;
}
public int connect(GlowArrayElem o) {
......@@ -2185,7 +2690,15 @@ public class Dyn {
StringBuffer sb = new StringBuffer();
public DynValue( Dyn dyn) {
super(dyn, Dyn.mDynType1_Value, 0, 0, 0);
super(dyn, Dyn.mDynType1_Value, 0, 0, 0, Dyn.eDynPrio_Value);
}
public DynValue( DynValue x) {
super(x);
attribute = x.attribute;
zero_blank = x.zero_blank;
format = x.format;
cFormat = new GlowCFormat(format);
}
public int connect(GlowArrayElem o) {
......@@ -2413,8 +2926,13 @@ public class Dyn {
DynValueInput e = (DynValueInput)object;
System.out.println("Dyn Value input: " + str);
boolean cmn_popped = false;
GrowCmn ocmn = (GrowCmn)((DynElem)object).dyn.object.getCmn();
if ( e.dyn.graph.getCmn() != ocmn) {
e.dyn.graph.cmnPop( ocmn);
cmn_popped = true;
}
try {
PwrtStatus sts = null;
......@@ -2425,7 +2943,8 @@ public class Dyn {
if ( pname != null && pname.type == Pwr.eType_Float32) {
CdhrFloat ret = e.dyn.graph.getGdh().getObjectInfoFloat( pname.name);
if ( ret.evenSts()) {
System.out.println( "ValueInput " + pname.name);
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_Error;
}
minval = ret.value;
......@@ -2444,7 +2963,8 @@ public class Dyn {
if ( pname.type == Pwr.eType_Float32) {
CdhrFloat ret = e.dyn.graph.getGdh().getObjectInfoFloat( pname.name);
if ( ret.evenSts()) {
System.out.println( "ValueInput " + pname.name);
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_Error;
}
maxval = ret.value;
......@@ -2459,10 +2979,16 @@ public class Dyn {
switch ( e.a_typeid) {
case Pwr.eType_Float32: {
float inputValue = Float.parseFloat( str.trim());
if ( minval != 0 && maxval != 0 && inputValue < minval)
if ( minval != 0 && maxval != 0 && inputValue < minval) {
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_MinValueExceeded;
if ( minval != 0 && maxval != 0 && inputValue > maxval )
}
if ( minval != 0 && maxval != 0 && inputValue > maxval) {
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_MaxValueExceeded;
}
DynParsedAttrName pname = e.dyn.parseAttrName(e.value_element.attribute);
if ( pname == null || pname.name.equals(""))
......@@ -2476,10 +3002,14 @@ public class Dyn {
sts = e.dyn.graph.getLdb().setObjectInfo( graph, pname.name, inputValue);
break;
default:
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_Error;
}
if ( sts.evenSts()) {
System.out.println( "setObjectInfoError " + sts);
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_Error;
}
break;
......@@ -2491,10 +3021,16 @@ public class Dyn {
case Pwr.eType_Int8:
case Pwr.eType_UInt8: {
int inputValue = Integer.parseInt( str.trim(), 10);
if ( minval != 0 && maxval != 0 && inputValue < minval)
if ( minval != 0 && maxval != 0 && inputValue < minval) {
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_MinValueExceeded;
if ( minval != 0 && maxval != 0 && inputValue > maxval )
}
if ( minval != 0 && maxval != 0 && inputValue > maxval ) {
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_MaxValueExceeded;
}
DynParsedAttrName pname = e.dyn.parseAttrName(e.value_element.attribute);
if ( pname == null || pname.name.equals(""))
......@@ -2508,10 +3044,14 @@ public class Dyn {
sts = e.dyn.graph.getLdb().setObjectInfo( graph, pname.name, inputValue);
break;
default:
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_Error;
}
if ( sts.evenSts()) {
System.out.println( "setObjectInfoError " + sts);
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_Error;
}
break;
......@@ -2544,6 +3084,8 @@ public class Dyn {
}
if ( sts.evenSts()) {
System.out.println( "setObjectInfoError " + sts);
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_Error;
}
break;
......@@ -2563,15 +3105,21 @@ public class Dyn {
sts = e.dyn.graph.getLdb().setObjectInfo( graph, pname.name, str);
break;
default:
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_Error;
}
if ( sts.evenSts()) {
System.out.println( "setObjectInfoError " + sts);
if ( cmn_popped)
e.dyn.graph.cmnPush();
return Dyn.eValueInput_Error;
}
break;
}
}
if ( cmn_popped)
e.dyn.graph.cmnPush();
}
catch(NumberFormatException ex) {
System.out.println( ex.toString() );
......@@ -2594,7 +3142,19 @@ public class Dyn {
int a_typeid;
public DynValueInput( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_ValueInput, 0);
super(dyn, 0, 0, Dyn.mActionType1_ValueInput, 0, Dyn.eDynPrio_ValueInput);
}
public DynValueInput( DynValueInput x) {
super(x);
min_value = x.min_value;
max_value = x.max_value;
clear = x.clear;
popup = x.popup;
unselect = x.unselect;
escape_store = x.escape_store;
minvalue_attr = x.minvalue_attr;
maxvalue_attr = x.maxvalue_attr;
}
public int connect(GlowArrayElem o) {
......@@ -2616,6 +3176,7 @@ public class Dyn {
public int action( GlowArrayElem object, GlowEvent e) {
switch ( e.event) {
case Glow.eEvent_MB1Click:
dyn.object = object;
dyn.graph.openValueInputDialog( dyn, "Enter value", this);
break;
}
......@@ -2687,6 +3248,7 @@ public class Dyn {
double limit;
int limit_type;
int color;
int border;
PwrtRefId subid;
int p;
int database;
......@@ -2702,7 +3264,16 @@ public class Dyn {
boolean isMainInstance = false;
public DynAnalogColor( Dyn dyn) {
super(dyn, Dyn.mDynType1_AnalogColor, 0, 0, 0);
super(dyn, Dyn.mDynType1_AnalogColor, 0, 0, 0, Dyn.eDynPrio_AnalogColor);
}
public DynAnalogColor( DynAnalogColor x) {
super(x);
attribute = x.attribute;
limit = x.limit;
limit_type = x.limit_type;
color = x.color;
border = x.border;
}
public int connect(GlowArrayElem o) {
......@@ -2914,6 +3485,9 @@ public class Dyn {
case Dyn.eSave_AnalogColor_instance_mask:
instance_mask = Integer.valueOf(token.nextToken());
break;
case Dyn.eSave_AnalogColor_border:
border = Integer.valueOf(token.nextToken());
break;
case Dyn.eSave_End:
end_found = true;
break;
......@@ -2950,7 +3524,15 @@ public class Dyn {
int rotation_point;
public DynRotate( Dyn dyn) {
super(dyn, Dyn.mDynType1_Rotate, 0, 0, 0);
super(dyn, Dyn.mDynType1_Rotate, 0, 0, 0, Dyn.eDynPrio_Rotate);
}
public DynRotate( DynRotate x) {
super(x);
attribute = x.attribute;
x0 = x.x0;
y0 = x.y0;
factor = x.factor;
}
public int connect(GlowArrayElem o) {
......@@ -3064,6 +3646,8 @@ public class Dyn {
String move_y_attribute;
String scale_x_attribute;
String scale_y_attribute;
double x_factor;
double y_factor;
double x_offset;
double y_offset;
double scale_x_factor;
......@@ -3071,7 +3655,20 @@ public class Dyn {
int scale_type;
public DynMove( Dyn dyn) {
super(dyn, Dyn.mDynType1_Move, 0, 0, 0);
super(dyn, Dyn.mDynType1_Move, 0, 0, 0, Dyn.eDynPrio_Move);
}
public DynMove( DynMove x) {
super(x);
x_offset = x.x_offset;
y_offset = x.y_offset;
x_factor = x.x_factor;
y_factor = x.y_factor;
scale_type = x.scale_type;
move_x_attribute = x.move_x_attribute;
move_y_attribute = x.move_y_attribute;
scale_x_attribute = x.scale_x_attribute;
scale_y_attribute = x.scale_y_attribute;
}
public void open( BufferedReader reader) {
......@@ -3110,6 +3707,12 @@ public class Dyn {
case Dyn.eSave_Move_y_offset:
y_offset = new Double(token.nextToken()).doubleValue();
break;
case Dyn.eSave_Move_x_factor:
x_factor = new Double(token.nextToken()).doubleValue();
break;
case Dyn.eSave_Move_y_factor:
y_factor = new Double(token.nextToken()).doubleValue();
break;
case Dyn.eSave_Move_scale_x_factor:
scale_x_factor = new Double(token.nextToken()).doubleValue();
break;
......@@ -3152,7 +3755,12 @@ public class Dyn {
int oldValueI;
public DynAnalogShift( Dyn dyn) {
super(dyn, Dyn.mDynType1_AnalogShift, 0, 0, 0);
super(dyn, Dyn.mDynType1_AnalogShift, 0, 0, 0, Dyn.eDynPrio_AnalogShift);
}
public DynAnalogShift( DynAnalogShift x) {
super(x);
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -3292,7 +3900,12 @@ public class Dyn {
boolean oldValue;
public DynDigShift( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigShift, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigShift, 0, 0, 0, Dyn.eDynPrio_DigShift);
}
public DynDigShift( DynDigShift x) {
super(x);
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -3403,7 +4016,13 @@ public class Dyn {
int sequence;
public DynAnimation( Dyn dyn) {
super(dyn, Dyn.mDynType1_Animation, 0, 0, 0);
super(dyn, Dyn.mDynType1_Animation, 0, 0, 0, Dyn.eDynPrio_Animation);
}
public DynAnimation( DynAnimation x) {
super(x);
attribute = x.attribute;
sequence = x.sequence;
}
public void open( BufferedReader reader) {
......@@ -3449,7 +4068,11 @@ public class Dyn {
public class DynVideo extends DynElem {
public DynVideo( Dyn dyn) {
super(dyn, Dyn.mDynType1_Video, 0, 0, 0);
super(dyn, Dyn.mDynType1_Video, 0, 0, 0, Dyn.eDynPrio_Video);
}
public DynVideo( DynVideo x) {
super(x);
}
public void open( BufferedReader reader) {
......@@ -3508,7 +4131,14 @@ public class Dyn {
float old_min_value;
public DynBar( Dyn dyn) {
super(dyn, Dyn.mDynType1_Bar, 0, 0, 0);
super(dyn, Dyn.mDynType1_Bar, 0, 0, 0, Dyn.eDynPrio_Bar);
}
public DynBar( DynBar x) {
super(x);
attribute = x.attribute;
minvalue_attr = x.minvalue_attr;
maxvalue_attr = x.maxvalue_attr;
}
public int connect(GlowArrayElem o) {
......@@ -3713,7 +4343,18 @@ public class Dyn {
PwrtRefId hold_subid;
public DynTrend( Dyn dyn) {
super(dyn, Dyn.mDynType1_Trend, 0, 0, 0);
super(dyn, Dyn.mDynType1_Trend, 0, 0, 0, Dyn.eDynPrio_Trend);
}
public DynTrend( DynTrend x) {
super(x);
attribute1 = x.attribute1;
attribute2 = x.attribute2;
minvalue_attr1 = x.minvalue_attr1;
minvalue_attr2 = x.minvalue_attr2;
maxvalue_attr1 = x.maxvalue_attr1;
maxvalue_attr2 = x.maxvalue_attr2;
hold_attr = x.hold_attr;
}
public int connect(GlowArrayElem o) {
......@@ -3913,7 +4554,6 @@ public class Dyn {
object.add_value(1, 0);
else
object.add_value(0, 0);
System.out.println("DynTrend add : " + value);
break;
}
case Pwr.eType_Float32: {
......@@ -4036,9 +4676,30 @@ public class Dyn {
int datatype;
int curve_color;
int fill_color;
int noofpoints;
public DynXY_Curve( Dyn dyn) {
super(dyn, Dyn.mDynType1_XY_Curve, 0, 0, 0);
super(dyn, Dyn.mDynType1_XY_Curve, 0, 0, 0, Dyn.eDynPrio_XY_Curve);
}
public DynXY_Curve( DynXY_Curve x) {
super(x);
x_attr = x.x_attr;
y_attr = x.y_attr;
y_minvalue_attr = x.y_minvalue_attr;
y_maxvalue_attr = x.y_maxvalue_attr;
x_minvalue_attr = x.x_minvalue_attr;
x_maxvalue_attr = x.x_maxvalue_attr;
noofpoints_attr = x.noofpoints_attr;
update_attr = x.update_attr;
y_min_value = x.y_min_value;
y_max_value = x.y_max_value;
x_min_value = x.x_min_value;
x_max_value = x.x_max_value;
noofpoints = x.noofpoints;
datatype = x.datatype;
curve_color = x.curve_color;
fill_color = x.fill_color;
}
public void open( BufferedReader reader) {
......@@ -4157,7 +4818,14 @@ public class Dyn {
StringBuffer sb = new StringBuffer();
public DynTable( Dyn dyn) {
super(dyn, Dyn.mDynType1_Table, 0, 0, 0);
super(dyn, Dyn.mDynType1_Table, 0, 0, 0, Dyn.eDynPrio_Table);
}
public DynTable( DynTable x) {
super(x);
attribute = x.attribute;
format = x.format;
sel_attribute = x.sel_attribute;
}
public void open( BufferedReader reader) {
......@@ -4676,7 +5344,13 @@ public class Dyn {
public DynStatusColor( Dyn dyn) {
super(dyn, Dyn.mDynType1_StatusColor, 0, 0, 0);
super(dyn, Dyn.mDynType1_StatusColor, 0, 0, 0, Dyn.eDynPrio_StatusColor);
}
public DynStatusColor( DynStatusColor x) {
super(x);
attribute = x.attribute;
nostatus_color = x.nostatus_color;
}
public int connect(GlowArrayElem o) {
......@@ -4862,10 +5536,25 @@ public class Dyn {
}
public class DynPie extends DynElem {
public static final int MAX_SECTORS = 12;
String[] attribute = new String[12];
int sectors;
double min_value;
double max_value;
int fix_range;
public DynPie( Dyn dyn) {
super(dyn, Dyn.mDynType1_Pie, 0, 0, 0);
super(dyn, Dyn.mDynType1_Pie, 0, 0, 0, Dyn.eDynPrio_Pie);
}
public DynPie( DynPie x) {
super(x);
for ( int i = 0; i < MAX_SECTORS; i++)
attribute[i] = x.attribute[i];
sectors = x.sectors;
min_value = x.min_value;
max_value = x.max_value;
fix_range = x.fix_range;
}
public void open( BufferedReader reader) {
......@@ -4950,10 +5639,27 @@ public class Dyn {
}
public class DynBarChart extends DynElem {
public static final int MAX_BARSEGMENTS = 12;
String[] attribute = new String[12];
int bars;
int barsegments;
double min_value;
double max_value;
boolean fix_range;
public DynBarChart( Dyn dyn) {
super(dyn, Dyn.mDynType1_BarChart, 0, 0, 0);
super(dyn, Dyn.mDynType1_BarChart, 0, 0, 0, Dyn.eDynPrio_BarChart);
}
public DynBarChart( DynBarChart x) {
super(x);
bars = x.bars;
barsegments = x.barsegments;
min_value = x.min_value;
max_value = x.max_value;
fix_range = x.fix_range;
for ( int i = 0; i < MAX_BARSEGMENTS; i++)
attribute[i] = x.attribute[i];
}
public void open( BufferedReader reader) {
......@@ -5040,9 +5746,19 @@ public class Dyn {
public class DynAxis extends DynElem {
String minvalue_attr;
String maxvalue_attr;
double min_value;
double max_value;
public DynAxis( Dyn dyn) {
super(dyn, 0, Dyn.mDynType2_Axis, 0, 0);
super(dyn, 0, Dyn.mDynType2_Axis, 0, 0, Dyn.eDynPrio_Axis);
}
public DynAxis( DynAxis x) {
super(x);
minvalue_attr = x.minvalue_attr;
maxvalue_attr = x.maxvalue_attr;
min_value = x.min_value;
max_value = x.max_value;
}
public void open( BufferedReader reader) {
......@@ -5090,7 +5806,12 @@ public class Dyn {
String hostobject;
public DynHostObject( Dyn dyn) {
super(dyn, Dyn.mDynType1_HostObject, 0, 0, 0);
super(dyn, Dyn.mDynType1_HostObject, 0, 0, 0, Dyn.eDynPrio_HostObject);
}
public DynHostObject( DynHostObject x) {
super(x);
hostobject = x.hostobject;
}
public void open( BufferedReader reader) {
......@@ -5137,7 +5858,15 @@ public class Dyn {
int interval;
public DynDigSound( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigSound, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigSound, 0, 0, 0, Dyn.eDynPrio_DigSound);
}
public DynDigSound( DynDigSound x) {
super(x);
level = x.level;
interval = x.interval;
attribute = x.attribute;
soundobject = x.soundobject;
}
public void open( BufferedReader reader) {
......@@ -5218,7 +5947,18 @@ public class Dyn {
PwrtRefId min_value_subid;
public DynFillLevel( Dyn dyn) {
super(dyn, Dyn.mDynType1_FillLevel, 0, 0, 0);
super(dyn, Dyn.mDynType1_FillLevel, 0, 0, 0, Dyn.eDynPrio_FillLevel);
}
public DynFillLevel( DynFillLevel x) {
super(x);
color = x.color;
direction = x.direction;
min_value = x.min_value;
max_value = x.max_value;
attribute = x.attribute;
minvalue_attr = x.minvalue_attr;
maxvalue_attr = x.maxvalue_attr;
}
public int connect(GlowArrayElem o) {
......@@ -5362,7 +6102,6 @@ public class Dyn {
default: ;
}
}
System.out.println("FillLevel: " + value);
object.setFillLevel( value);
oldValue = pvalue;
}
......@@ -5438,7 +6177,13 @@ public class Dyn {
boolean oldValue;
public DynDigCommand( Dyn dyn) {
super(dyn, Dyn.mDynType1_DigCommand, 0, 0, 0);
super(dyn, Dyn.mDynType1_DigCommand, 0, 0, 0, Dyn.eDynPrio_DigCommand);
}
public DynDigCommand( DynDigCommand x) {
super(x);
attribute = x.attribute;
command = x.command;
}
public int connect(GlowArrayElem o) {
......@@ -5558,7 +6303,12 @@ public class Dyn {
String ref_object;
public DynPopupMenu( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_PopupMenu, 0);
super(dyn, 0, 0, Dyn.mActionType1_PopupMenu, 0, Dyn.eDynPrio_PopupMenu);
}
public DynPopupMenu( DynPopupMenu x) {
super(x);
ref_object = x.ref_object;
}
public void open( BufferedReader reader) {
......@@ -5602,7 +6352,12 @@ public class Dyn {
String attribute;
public DynSetDig( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_SetDig, 0);
super(dyn, 0, 0, Dyn.mActionType1_SetDig, 0, Dyn.eDynPrio_SetDig);
}
public DynSetDig( DynSetDig x) {
super(x);
attribute = x.attribute;
}
public int action( GlowArrayElem object, GlowEvent e) {
......@@ -5683,7 +6438,12 @@ public class Dyn {
String attribute;
public DynResetDig( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_ResetDig, 0);
super(dyn, 0, 0, Dyn.mActionType1_ResetDig, 0, Dyn.eDynPrio_ResetDig);
}
public DynResetDig( DynResetDig x) {
super(x);
attribute = x.attribute;
}
public int action( GlowArrayElem object, GlowEvent e) {
......@@ -5764,7 +6524,12 @@ public class Dyn {
String attribute;
public DynToggleDig( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_ToggleDig, 0);
super(dyn, 0, 0, Dyn.mActionType1_ToggleDig, 0, Dyn.eDynPrio_ToggleDig);
}
public DynToggleDig( DynToggleDig x) {
super(x);
attribute = x.attribute;
}
public int action( GlowArrayElem object, GlowEvent e) {
......@@ -5839,7 +6604,12 @@ public class Dyn {
String attribute;
public DynStoDig( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_StoDig, 0);
super(dyn, 0, 0, Dyn.mActionType1_StoDig, 0, Dyn.eDynPrio_StoDig);
}
public DynStoDig( DynStoDig x) {
super(x);
attribute = x.attribute;
}
public int action( GlowArrayElem object, GlowEvent e) {
......@@ -5931,7 +6701,12 @@ public class Dyn {
String command;
public DynCommand( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_Command, 0);
super(dyn, 0, 0, Dyn.mActionType1_Command, 0, Dyn.eDynPrio_Command);
}
public DynCommand( DynCommand x) {
super(x);
command = x.command;
}
public int action( GlowArrayElem object, GlowEvent e) {
......@@ -5948,6 +6723,9 @@ public class Dyn {
if ( (dyn.action_type1 & Dyn.mActionType1_Confirm) != 0)
break;
if ( command == null)
return 1;
String cmd = graph.getCommand(command);
dyn.graph.command(cmd);
......@@ -5996,7 +6774,12 @@ public class Dyn {
String command;
public DynCommandDoubleClick( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_CommandDoubleClick, 0);
super(dyn, 0, 0, Dyn.mActionType1_CommandDoubleClick, 0, Dyn.eDynPrio_CommandDoubleClick);
}
public DynCommandDoubleClick( DynCommandDoubleClick x) {
super(x);
command = x.command;
}
public int action( GlowArrayElem object, GlowEvent e) {
......@@ -6062,7 +6845,12 @@ public class Dyn {
String text;
public DynConfirm( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_Confirm, 0);
super(dyn, 0, 0, Dyn.mActionType1_Confirm, 0, Dyn.eDynPrio_Confirm);
}
public DynConfirm( DynConfirm x) {
super(x);
text = x.text;
}
public int action( GlowArrayElem o, GlowEvent e) {
......@@ -6125,7 +6913,15 @@ public class Dyn {
double max_value;
public DynIncrAnalog( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_IncrAnalog, 0);
super(dyn, 0, 0, Dyn.mActionType1_IncrAnalog, 0, Dyn.eDynPrio_IncrAnalog);
}
public DynIncrAnalog( DynIncrAnalog x) {
super(x);
attribute = x.attribute;
increment = x.increment;
min_value = x.min_value;
max_value = x.max_value;
}
public int action( GlowArrayElem o, GlowEvent e) {
......@@ -6248,7 +7044,12 @@ public class Dyn {
boolean oldValue;
public DynRadioButton( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_RadioButton, 0);
super(dyn, 0, 0, Dyn.mActionType1_RadioButton, 0, Dyn.eDynPrio_RadioButton);
}
public DynRadioButton( DynRadioButton x) {
super(x);
attribute = x.attribute;
}
public int connect(GlowArrayElem o) {
......@@ -6343,7 +7144,7 @@ public class Dyn {
oe.type() == Glow.eObjectType_GrowNode) {
value = false;
Dyn gm_dyn = (Dyn)((GrowNode)o).getUserData();
Dyn gm_dyn = (Dyn)((GrowNode)oe).getUserData();
if ( (gm_dyn.total_action_type1 & Dyn.mActionType1_RadioButton) != 0) {
for ( int j = 0; j < gm_dyn.elements.size(); j++) {
......@@ -6355,6 +7156,7 @@ public class Dyn {
switch ( pname.database) {
case GraphIfc.eDatabase_Gdh:
PwrtStatus sts = dyn.graph.getGdh().setObjectInfo( pname.name, value);
System.out.println("setObjectInfo: " + sts.getSts());
break;
case GraphIfc.eDatabase_Ccm:
// TODO
......@@ -6428,7 +7230,12 @@ public class Dyn {
String text;
public DynTipText( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_TipText, 0);
super(dyn, 0, 0, Dyn.mActionType1_TipText, 0, Dyn.eDynPrio_TipText);
}
public DynTipText( DynTipText x) {
super(x);
text = x.text;
}
public void open( BufferedReader reader) {
......@@ -6473,7 +7280,13 @@ public class Dyn {
String bookmark;
public DynHelp( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_Help, 0);
super(dyn, 0, 0, Dyn.mActionType1_Help, 0, Dyn.eDynPrio_Help);
}
public DynHelp( DynHelp x) {
super(x);
topic = x.topic;
bookmark = x.bookmark;
}
public int action( GlowArrayElem o, GlowEvent e) {
......@@ -6552,18 +7365,22 @@ public class Dyn {
String graph_object;
public DynOpenGraph( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_OpenGraph, 0);
super(dyn, 0, 0, Dyn.mActionType1_OpenGraph, 0, Dyn.eDynPrio_OpenGraph);
}
public DynOpenGraph( DynOpenGraph x) {
super(x);
graph_object = x.graph_object;
}
public int action( GlowArrayElem o, GlowEvent e) {
GrowNode object = (GrowNode)o;
switch ( e.event) {
case Glow.eEvent_MB1Down:
object.setColorInverse( 1);
o.setColorInverse( 1);
dyn.repaintNow = true;
break;
case Glow.eEvent_MB1Up:
object.setColorInverse( 0);
o.setColorInverse( 0);
dyn.repaintNow = true;
break;
case Glow.eEvent_MB1Click:
......@@ -6640,7 +7457,12 @@ public class Dyn {
String url;
public DynOpenURL( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_OpenURL, 0);
super(dyn, 0, 0, Dyn.mActionType1_OpenURL, 0, Dyn.eDynPrio_OpenURL);
}
public DynOpenURL( DynOpenURL x) {
super(x);
url = x.url;
}
public int action( GlowArrayElem o, GlowEvent e) {
......@@ -6710,7 +7532,15 @@ public class Dyn {
String next_tab;
public DynInputFocus( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_InputFocus, 0);
super(dyn, 0, 0, Dyn.mActionType1_InputFocus, 0, Dyn.eDynPrio_InputFocus);
}
public DynInputFocus( DynInputFocus x) {
super(x);
initial_focus = x.initial_focus;
next_horizontal = x.next_horizontal;
next_vertical = x.next_vertical;
next_tab = x.next_tab;
}
public void open( BufferedReader reader) {
......@@ -6764,7 +7594,32 @@ public class Dyn {
public class DynCloseGraph extends DynElem {
public DynCloseGraph( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_CloseGraph, 0);
super(dyn, 0, 0, Dyn.mActionType1_CloseGraph, 0, Dyn.eDynPrio_CloseGraph);
}
public DynCloseGraph( DynCloseGraph x) {
super(x);
}
public int action( GlowArrayElem o, GlowEvent e) {
GrowNode object = (GrowNode)o;
switch ( e.event) {
case Glow.eEvent_MB1Down:
object.setColorInverse( 1);
dyn.repaintNow = true;
break;
case Glow.eEvent_MB1Up:
object.setColorInverse( 0);
dyn.repaintNow = true;
break;
case Glow.eEvent_MB1Click:
if ( (dyn.action_type1 & Dyn.mActionType1_Confirm) != 0)
break;
dyn.graph.closeGraph();
break;
}
return 1;
}
public void open( BufferedReader reader) {
......@@ -6832,7 +7687,15 @@ public class Dyn {
int direction;
public DynSlider( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_Slider, 0);
super(dyn, 0, 0, Dyn.mActionType1_Slider, 0, Dyn.eDynPrio_Slider);
}
public DynSlider( DynSlider x) {
super(x);
attribute = x.attribute;
minvalue_attr = x.minvalue_attr;
maxvalue_attr = x.maxvalue_attr;
insensitive_attr = x.insensitive_attr;
}
public int connect(GlowArrayElem o) {
......@@ -7286,7 +8149,14 @@ public class Dyn {
int curve_index2;
public DynFastCurve( Dyn dyn) {
super(dyn, Dyn.mDynType1_FastCurve, 0, 0, 0);
super(dyn, Dyn.mDynType1_FastCurve, 0, 0, 0, Dyn.eDynPrio_FastCurve);
}
public DynFastCurve( DynFastCurve x) {
super(x);
curve_index1 = x.curve_index1;
curve_index2 = x.curve_index2;
fast_object = x.fast_object;
}
public void open( BufferedReader reader) {
......@@ -7340,7 +8210,16 @@ public class Dyn {
int text_size;
public DynPulldownMenu( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_PulldownMenu, 0);
super(dyn, 0, 0, Dyn.mActionType1_PulldownMenu, 0, Dyn.eDynPrio_PulldownMenu);
}
public DynPulldownMenu( DynPulldownMenu x) {
super(x);
button_mask = x.button_mask;
items_text = x.items_text;
for ( int i = 0; i < 32; i++) {
items_dyn[i] = new Dyn(x.items_dyn[i]);
}
}
public int action( GlowArrayElem o, GlowEvent e) {
......@@ -7808,7 +8687,19 @@ public class Dyn {
int text_size;
public DynOptionMenu( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_OptionMenu, 0);
super(dyn, 0, 0, Dyn.mActionType1_OptionMenu, 0, Dyn.eDynPrio_OptionMenu);
}
public DynOptionMenu( DynOptionMenu x) {
super(x);
attribute = x.attribute;
text_attribute = x.text_attribute;
size_attribute = x.size_attribute;
update_attribute = x.update_attribute;
items_text = x.items_text;
items_enum = x.items_enum;
button_mask = x.button_mask;
optionmenu_type = x.optionmenu_type;
}
public int connect(GlowArrayElem o) {
......@@ -8379,6 +9270,11 @@ public class Dyn {
public DynAnalogText( Dyn dyn) {
super(dyn);
dyn_type1 = Dyn.mDynType1_AnalogText;
prio = Dyn.eDynPrio_AnalogText;
}
public DynAnalogText( DynAnalogText x) {
super(x);
}
public int action( GlowArrayElem o, GlowEvent e) {
......@@ -8426,7 +9322,13 @@ public class Dyn {
String value;
public DynSetValue( Dyn dyn) {
super(dyn, 0, 0, Dyn.mActionType1_SetValue, 0);
super(dyn, 0, 0, Dyn.mActionType1_SetValue, 0, Dyn.eDynPrio_SetValue);
}
public DynSetValue( DynSetValue x) {
super(x);
attribute = x.attribute;
value = x.value;
}
public void open( BufferedReader reader) {
......@@ -8474,6 +9376,132 @@ public class Dyn {
}
}
public int action( GlowArrayElem o, GlowEvent e) {
GrowNode object = (GrowNode)o;
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) {
case Glow.eEvent_MB1Down:
object.setColorInverse( 1);
break;
case Glow.eEvent_MB1Up:
object.setColorInverse( 0);
break;
case Glow.eEvent_MB1Click: {
PwrtStatus sts = null;
try {
if ( (dyn.action_type1 & Dyn.mActionType1_Confirm) != 0)
break;
DynParsedAttrName pname = dyn.parseAttrName(attribute);
switch ( pname.type) {
case Pwr.eType_Float32: {
float inputValue = Float.parseFloat( value.trim());
switch ( pname.database) {
case GraphIfc.eDatabase_Gdh:
sts = dyn.graph.getGdh().setObjectInfo( pname.name, inputValue);
break;
case GraphIfc.eDatabase_Local:
sts = dyn.graph.getLdb().setObjectInfo( graph, pname.name, inputValue);
break;
default:
return 0;
}
if ( sts.evenSts()) {
System.out.println( "setObjectInfoError " + sts);
return 0;
}
break;
}
case Pwr.eType_Int32:
case Pwr.eType_UInt32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8: {
int inputValue = Integer.parseInt( value.trim(), 10);
switch ( pname.database) {
case GraphIfc.eDatabase_Gdh:
sts = dyn.graph.getGdh().setObjectInfo( pname.name, inputValue);
break;
case GraphIfc.eDatabase_Local:
sts = dyn.graph.getLdb().setObjectInfo( graph, pname.name, inputValue);
break;
default:
return 0;
}
if ( sts.evenSts()) {
System.out.println( "setObjectInfoError " + sts);
return 0;
}
break;
}
case Pwr.eType_Boolean: {
int inputValueInt = Integer.parseInt( value.trim(), 10);
boolean inputValue;
if ( inputValueInt == 0)
inputValue = false;
else if ( inputValueInt == 1)
inputValue = true;
else
break;
switch ( pname.database) {
case GraphIfc.eDatabase_Gdh:
sts = dyn.graph.getGdh().setObjectInfo( pname.name, inputValue);
break;
case GraphIfc.eDatabase_Local:
sts = dyn.graph.getLdb().setObjectInfo( graph, pname.name, inputValue);
break;
default:
return 0;
}
if ( sts.evenSts()) {
System.out.println( "setObjectInfoError " + sts);
return 0;
}
break;
}
case Pwr.eType_String: {
switch ( pname.database) {
case GraphIfc.eDatabase_Gdh:
sts = dyn.graph.getGdh().setObjectInfo( pname.name, value);
break;
case GraphIfc.eDatabase_Local:
sts = dyn.graph.getLdb().setObjectInfo( graph, pname.name, value);
break;
default:
return 0;
}
if ( sts.evenSts()) {
System.out.println( "setObjectInfoError " + sts);
return 0;
}
break;
}
default:
;
}
}
catch(NumberFormatException ex) {
System.out.println( ex.toString() );
return 0;
}
break;
}
default:
return 0;
}
return 1;
}
}
......
......@@ -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);
}
/*
* 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.jopg;
import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowFolder extends GrowWindow {
public static final int MAX_FOLDERS = 12;
int folders;
int text_size;
int text_drawtype;
int text_color_drawtype;
double header_height;
String[] folder_file_names = new String[MAX_FOLDERS];
String[] folder_text = new String[MAX_FOLDERS];
double[] folder_scale = new double[MAX_FOLDERS];
int[] folder_v_scrollbar = new int[MAX_FOLDERS];
int[] folder_h_scrollbar = new int[MAX_FOLDERS];
String[] folder_owner = new String[MAX_FOLDERS];
int current_folder;
int color_selected;
int color_unselected;
public GrowFolder(GrowCmn cmn) {
super(cmn);
}
public int type() {
return Glow.eObjectType_GrowFolder;
}
public void open(BufferedReader reader) {
String line;
StringTokenizer token;
boolean end_found = false;
try {
while( (line = reader.readLine()) != null) {
token = new StringTokenizer(line);
int key = Integer.valueOf(token.nextToken());
if ( cmn.debug) System.out.println( "GrowFolder : " + line);
switch ( key) {
case Glow.eSave_GrowFolder:
break;
case Glow.eSave_GrowFolder_folders:
folders = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_text_size:
text_size = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_text_drawtype:
text_drawtype = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_text_color_drawtype:
text_color_drawtype = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_header_height:
header_height = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_color_selected:
color_selected = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_color_unselected:
color_unselected = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names1:
if ( token.hasMoreTokens())
folder_file_names[0] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text1:
if ( token.hasMoreTokens())
folder_text[0] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale1:
folder_scale[0] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar1:
folder_v_scrollbar[0] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar1:
folder_h_scrollbar[0] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names2:
if ( token.hasMoreTokens())
folder_file_names[1] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text2:
if ( token.hasMoreTokens())
folder_text[1] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale2:
folder_scale[1] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar2:
folder_v_scrollbar[1] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar2:
folder_h_scrollbar[1] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names3:
if ( token.hasMoreTokens())
folder_file_names[2] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text3:
if ( token.hasMoreTokens())
folder_text[2] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale3:
folder_scale[2] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar3:
folder_v_scrollbar[2] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar3:
folder_h_scrollbar[2] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names4:
if ( token.hasMoreTokens())
folder_file_names[3] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text4:
if ( token.hasMoreTokens())
folder_text[3] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale4:
folder_scale[3] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar4:
folder_v_scrollbar[3] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar4:
folder_h_scrollbar[3] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names5:
if ( token.hasMoreTokens())
folder_file_names[4] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text5:
if ( token.hasMoreTokens())
folder_text[4] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale5:
folder_scale[4] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar5:
folder_v_scrollbar[4] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar5:
folder_h_scrollbar[4] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names6:
if ( token.hasMoreTokens())
folder_file_names[5] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text6:
if ( token.hasMoreTokens())
folder_text[5] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale6:
folder_scale[5] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar6:
folder_v_scrollbar[5] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar6:
folder_h_scrollbar[5] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names7:
if ( token.hasMoreTokens())
folder_file_names[6] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text7:
if ( token.hasMoreTokens())
folder_text[6] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale7:
folder_scale[6] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar7:
folder_v_scrollbar[6] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar7:
folder_h_scrollbar[6] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names8:
if ( token.hasMoreTokens())
folder_file_names[7] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text8:
if ( token.hasMoreTokens())
folder_text[7] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale8:
folder_scale[7] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar8:
folder_v_scrollbar[7] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar8:
folder_h_scrollbar[7] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names9:
if ( token.hasMoreTokens())
folder_file_names[8] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text9:
if ( token.hasMoreTokens())
folder_text[8] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale9:
folder_scale[8] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar9:
folder_v_scrollbar[8] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar9:
folder_h_scrollbar[8] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names10:
if ( token.hasMoreTokens())
folder_file_names[9] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text10:
if ( token.hasMoreTokens())
folder_text[9] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale10:
folder_scale[9] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar10:
folder_v_scrollbar[9] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar10:
folder_h_scrollbar[9] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names11:
if ( token.hasMoreTokens())
folder_file_names[10] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text11:
if ( token.hasMoreTokens())
folder_text[10] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale11:
folder_scale[10] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar11:
folder_v_scrollbar[10] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar11:
folder_h_scrollbar[10] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_file_names12:
if ( token.hasMoreTokens())
folder_file_names[11] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_text12:
if ( token.hasMoreTokens())
folder_text[11] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_scale12:
folder_scale[11] = new Double(token.nextToken()).doubleValue();
break;
case Glow.eSave_GrowFolder_folder_v_scrollbar12:
folder_v_scrollbar[11] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_h_scrollbar12:
folder_h_scrollbar[11] = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_GrowFolder_folder_owner1:
if ( token.hasMoreTokens())
folder_owner[0] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner2:
if ( token.hasMoreTokens())
folder_owner[1] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner3:
if ( token.hasMoreTokens())
folder_owner[2] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner4:
if ( token.hasMoreTokens())
folder_owner[3] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner5:
if ( token.hasMoreTokens())
folder_owner[4] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner6:
if ( token.hasMoreTokens())
folder_owner[5] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner7:
if ( token.hasMoreTokens())
folder_owner[6] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner8:
if ( token.hasMoreTokens())
folder_owner[7] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner9:
if ( token.hasMoreTokens())
folder_owner[8] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner10:
if ( token.hasMoreTokens())
folder_owner[9] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner11:
if ( token.hasMoreTokens())
folder_owner[10] = token.nextToken();
break;
case Glow.eSave_GrowFolder_folder_owner12:
if ( token.hasMoreTokens())
folder_owner[11] = token.nextToken();
break;
case Glow.eSave_GrowFolder_window_part:
super.open( reader);
break;
case Glow.eSave_End:
end_found = true;
break;
default:
System.out.println( "Syntax error in GrowFolder");
break;
}
if ( end_found)
break;
}
y_low_offs = header_height;
input_file_name = folder_file_names[0];
window_scale = folder_scale[0];
vertical_scrollbar = folder_v_scrollbar[0];
horizontal_scrollbar = folder_h_scrollbar[0];
owner = folder_owner[0];
super.update_attributes();
} catch ( Exception e) {
System.out.println( "IOException GrowWindow");
}
}
public void draw(GlowTransform t, int highlight, int hot, Object node, Object colornode) {
if ( cmn.nodraw != 0)
return;
int idx;
int drawtype;
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * line_width - 1);
idx += hot;
idx = Math.max( 0, idx);
idx = Math.min( idx, Glow.DRAW_TYPE_SIZE-1);
int text_idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (text_size +4) - 4);
double tsize = cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * (8+2*text_size);
text_idx = Math.min( text_idx, Glow.DRAW_TYPE_SIZE-1);
int ll_x, ll_y, ur_x, ur_y;
double dx1, dy1, dx2, dy2;
if ( t == null) {
dx1 = trf.x( ll.x, ll.y);
dy1 = trf.y( ll.x, ll.y);
dx2 = trf.x( ur.x, ur.y);
dy2 = trf.y( ur.x, ur.y);
}
else {
dx1 = trf.x( t, ll.x, ll.y);
dy1 = trf.y( t, ll.x, ll.y);
dx2 = trf.x( t, ur.x, ur.y);
dy2 = trf.y( t, ur.x, ur.y);
}
dx1 = Math.min( dx1, dx2);
dx2 = Math.max( dx1, dx2);
dy1 = Math.min( dy1, dy2);
dy2 = Math.max( dy1, dy2);
ll_x = (int)( dx1 * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
ur_x = (int)( dx2 * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
ur_y = (int)( (dy1 + y_low_offs) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
ll_y = (int)( dy1 * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
drawtype = GlowColor.get_drawtype( draw_type, Glow.eDrawType_LineHighlight,
highlight, (GrowNode)colornode, 0, 0);
int drawtype_light = GlowColor.shift_drawtype( color_unselected, -2,
(GrowNode)colornode);
int drawtype_dark = GlowColor.shift_drawtype( color_unselected, 2,
(GrowNode)colornode);
int x;
int width = (ur_x - ll_x) / folders;
int h = ur_y - ll_y;
GlowPointX[] p = new GlowPointX[4];
for ( int j = 0; j < 4; j++)
p[j] = new GlowPointX();
for ( int i = folders - 1; i >= -1; i--) {
if ( i == current_folder)
// Draw this last
continue;
if ( i == -1)
i = current_folder;
x = ll_x + i * width;
if ( i == 0)
p[0].x = ll_x;
else
p[0].x = x - h/4;
p[0].y = ll_y + h;
p[1].x = x + h/4;
p[1].y = ll_y;
p[2].x = x + width - h/4;
p[2].y = ll_y;
if ( i == folders - 1)
p[3].x = ur_x;
else
p[3].x = x + width + h/4;
p[3].y = ll_y + h;
if ( i == current_folder)
cmn.gdraw.fill_polyline( p, 4, color_selected, 0);
else {
cmn.gdraw.fill_polyline( p, 4, color_unselected, 0);
if ( shadow != 0) {
cmn.gdraw.line( p[0].x+1, p[0].y, p[1].x+1, p[1].y, drawtype_light, 0, 0);
if ( i != 0) {
GlowPointX[] ps = new GlowPointX[4];
for ( int j = 0; j < 4; j++)
ps[j] = new GlowPointX();
ps[0].x = x + h/4;
ps[0].y = ll_y + h;
ps[1].x = x;
ps[1].y = ll_y + h/2;
ps[2].x = x + h/8;
ps[2].y = ll_y + h/4;
ps[3].x = x + h/2;
ps[3].y = ll_y + h;
cmn.gdraw.fill_polyline( ps, 4, drawtype_dark, 0);
}
}
}
if ( shadow != 0) {
if ( i == current_folder) {
drawtype_light = GlowColor.shift_drawtype( color_selected, -2,
(GrowNode)colornode);
cmn.gdraw.line( p[0].x+1, p[0].y, p[1].x+1, p[1].y, drawtype_light, 0, 0);
}
cmn.gdraw.line( p[1].x, p[1].y+1, p[2].x, p[2].y+1, drawtype_light, 0, 0);
}
cmn.gdraw.polyline( p, 4, drawtype, idx, 0);
if ( text_idx >= 0) {
cmn.gdraw.text( x + h/2, ll_y + h - 2,
folder_text[i], text_drawtype, text_color_drawtype,
text_idx, highlight, 0, Glow.eFont_Helvetica, tsize, 0);
}
if ( i == current_folder)
break;
}
super.draw( t, highlight, hot, node, colornode);
cmn.gdraw.line( p[0].x+1, p[0].y, p[3].x-1, p[3].y, color_selected, idx, 0);
}
public int eventHandler( GlowEvent event, double fx, double fy) {
int sts;
if ( event.event == Glow.eEvent_MB1Click) {
if ( x_left <= fx && fx <= x_right &&
y_low <= fy && fy <= y_low + header_height) {
double w = (x_right - x_left) / folders;
double x = x_left + w;
for ( int i = 0; i < folders; i++) {
if ( fx <= x) {
// Change file
input_file_name = folder_file_names[i];
window_scale = folder_scale[i];
vertical_scrollbar = folder_v_scrollbar[i];
horizontal_scrollbar = folder_h_scrollbar[i];
owner = folder_owner[i];
current_folder = i;
System.out.println("New folder owner: " + owner);
super.update_attributes();
draw();
break;
}
x += w;
}
return 1;
}
}
GlowEvent e = new GlowEvent();
e.event = event.event;
e.type = event.type;
e.x = event.x;
e.y = event.y - header_height;
e.object = event.object;
e.object_type = event.object_type;
sts = super.eventHandler( e, fx, fy);
return sts;
}
}
......@@ -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));
}
......
......@@ -39,17 +39,28 @@ import jpwr.rt.*;
import java.io.*;
import java.util.*;
public class GrowWindow extends GrowRect {
public class GrowWindow extends GrowRect implements GrowScrollBarIfc {
String file_name;
String input_file_name = new String();
double scrollbar_width;
int scrollbar_color;
int scrollbar_bg_color;
int vertical_scrollbar;
int horizontal_scrollbar;
double window_scale;
String owner;
String owner = new String();
Object userdata;
GrowCmn windowCmn;
double wctx_x0;
double wctx_x1;
double wctx_y0;
double wctx_y1;
double y_low_offs = 0;
double h_value = 0;
double v_value = 0;
GrowScrollBar v_scrollbar;
GrowScrollBar h_scrollbar;
public GrowWindow(GrowCmn cmn) {
super(cmn);
......@@ -125,6 +136,9 @@ public class GrowWindow extends GrowRect {
break;
}
if ( file_name != null && !file_name.equals(""))
new_ctx();
} catch ( Exception e) {
System.out.println( "IOException GrowWindow");
}
......@@ -134,6 +148,384 @@ public class GrowWindow extends GrowRect {
if ( cmn.nodraw != 0)
return;
int idx;
int drawtype;
idx = (int)( cmn.mw.zoom_factor_y / cmn.mw.base_zoom_factor * line_width - 1);
idx += hot;
idx = Math.max( 0, idx);
idx = Math.min( idx, Glow.DRAW_TYPE_SIZE-1);
int ll_x, ll_y, ur_x, ur_y;
double dx1, dy1, dx2, dy2;
if ( t == null) {
dx1 = trf.x( ll.x, ll.y);
dy1 = trf.y( ll.x, ll.y);
dx2 = trf.x( ur.x, ur.y);
dy2 = trf.y( ur.x, ur.y);
}
else {
dx1 = trf.x( t, ll.x, ll.y);
dy1 = trf.y( t, ll.x, ll.y);
dx2 = trf.x( t, ur.x, ur.y);
dy2 = trf.y( t, ur.x, ur.y);
}
dx1 = Math.min( dx1, dx2);
dx2 = Math.max( dx1, dx2);
dy1 = Math.min( dy1, dy2);
dy2 = Math.max( dy1, dy2);
if ( v_scrollbar != null) {
if ( h_scrollbar == null)
v_scrollbar.set_position( dx2 - scrollbar_width, dy1 + y_low_offs, scrollbar_width,
dy2 - (dy1 + y_low_offs));
else
v_scrollbar.set_position( dx2 - scrollbar_width, dy1 + y_low_offs, scrollbar_width,
dy2 - (dy1 + y_low_offs) - scrollbar_width);
v_scrollbar.draw( null, 0, 0, null, null);
}
if ( h_scrollbar != null) {
if ( v_scrollbar == null)
h_scrollbar.set_position( dx1, dy2 - scrollbar_width, dx2 - dx1, scrollbar_width);
else
h_scrollbar.set_position( dx1, dy2 - scrollbar_width, dx2 - dx1 - scrollbar_width, scrollbar_width);
h_scrollbar.draw( null, 0, 0, null, null);
}
ll_x = (int)( dx1 * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
ll_y = (int)( (dy1 + y_low_offs) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
if ( windowCmn != null) {
ur_x = (int)( (dx2 - vertical_scrollbar * scrollbar_width) * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
ur_y = (int)( (dy2 - horizontal_scrollbar * scrollbar_width) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
windowCmn.mw.window_width = (int)((x_right - x_left) * cmn.mw.zoom_factor_x);
windowCmn.mw.window_height = (int)((y_high - y_low) * cmn.mw.zoom_factor_y);
windowCmn.mw.subwindow_x = (int)(x_left * cmn.mw.zoom_factor_x - cmn.mw.offset_x);
windowCmn.mw.subwindow_y = (int)(y_low * cmn.mw.zoom_factor_y - cmn.mw.offset_y);
windowCmn.mw.offset_x = - ll_x + (int)( h_value * cmn.mw.zoom_factor_x);
windowCmn.mw.offset_y = - ll_y + (int)( v_value * cmn.mw.zoom_factor_y);
windowCmn.mw.zoom_factor_x = windowCmn.mw.subwindow_scale * cmn.mw.zoom_factor_x;
windowCmn.mw.zoom_factor_y = windowCmn.mw.subwindow_scale * cmn.mw.zoom_factor_y;
// window_ctx->draw_buffer_only = ctx->draw_buffer_only;
if ( fill != 0)
cmn.gdraw.fill_rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fill_drawtype);
cmn.gdraw.set_clip_rectangle( ll_x, ll_y, ur_x-1, ur_y-1);
windowCmn.ctx.draw( ll_x, ll_y, ur_x, ur_y);
cmn.gdraw.reset_clip_rectangle();
}
ur_x = (int)( dx2 * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
ur_y = (int)( dy2 * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
drawtype = GlowColor.get_drawtype( draw_type, Glow.eDrawType_LineHighlight,
highlight, (GrowNode)colornode, 0, 0);
cmn.gdraw.rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx, 0);
}
public void new_ctx() {
if ( file_name.equals("_no_"))
return;
if ( file_name.indexOf('.') == -1)
file_name = file_name + ".pwg";
System.out.println("GrowWindow loading " + file_name);
GrowCtxIfc ctx = (GrowCtxIfc)cmn.appl.loadCtx( file_name);
if ( ctx == null)
return;
windowCmn = ctx.getCmn();
windowCmn.appl = cmn.appl;
windowCmn.owner = owner;
windowCmn.mw.subwindow_scale = window_scale;
windowCmn.mw.zoom_factor_x = windowCmn.mw.zoom_factor_y =
windowCmn.mw.subwindow_scale * cmn.mw.zoom_factor_x;
input_file_name = file_name;
if ( windowCmn.background_color != Glow.eDrawType_Inherit) {
fill_drawtype = original_fill_drawtype = windowCmn.background_color;
fill = 1;
}
if ( windowCmn.x0 != windowCmn.x1 && windowCmn.y0 != windowCmn.y1) {
wctx_x0 = windowCmn.x0;
wctx_x1 = windowCmn.x1;
wctx_y0 = windowCmn.y0;
wctx_y1 = windowCmn.y1;
}
else {
wctx_x0 = windowCmn.x_left;
wctx_x1 = windowCmn.x_right;
wctx_y0 = windowCmn.y_low;
wctx_y1 = windowCmn.y_high;
}
windowCmn.mw.window_width = (int)((x_right - x_left) * cmn.mw.zoom_factor_x);
windowCmn.mw.window_height = (int)((y_high - y_low) * cmn.mw.zoom_factor_y);
windowCmn.mw.subwindow_x = (int)(x_left * cmn.mw.zoom_factor_x - cmn.mw.offset_x);
windowCmn.mw.subwindow_y = (int)(y_low * cmn.mw.zoom_factor_y - cmn.mw.offset_y);
windowCmn.mw.subwindow_scale = cmn.mw.subwindow_scale * window_scale;
windowCmn.mw.zoom_factor_x = windowCmn.mw.zoom_factor_y =
cmn.mw.zoom_factor_x * windowCmn.mw.subwindow_scale;
configureScrollbars();
}
public int eventHandler( GlowEvent event, double fx, double fy) {
int sts, v_sts, h_sts;
GlowPointDX rp;
/*
switch ( event.event) {
case Glow.eEvent_Key_Right:
case Glow.eEvent_Key_Left:
case Glow.eEvent_Key_Up:
case Glow.eEvent_Key_Down:
case Glow.eEvent_Key_BackSpace:
case Glow.eEvent_Key_Return:
case Glow.eEvent_Key_Tab:
case Glow.eEvent_Key_ShiftTab:
case Glow.eEvent_Key_Escape:
case Glow.eEvent_Key_Ascii:
if ( input_focus) {
windowCmn.eventHandler( event, fx, 0);
if ( !windowCmn.inputfocus_object) {
cmn.register_inputfocus( this, 0);
input_focus = 0;
}
return 1;
}
else
return 0;
case Glow.eEvent_ScrollUp:
if ( !cmn.trace_started)
return 0;
if ( v_scrollbar) {
double rx, ry;
// Convert koordinates to local koordinates
rp = trf.reverse( fx, fy);
sts = local_event_handler( event, rp.x, rp.y);
if ( sts) {
v_value -= (wctx_y1 - wctx_y0) * window_scale/50;
if ( v_value < wctx_y0 * window_scale)
v_value = wctx_y0 * window_scale;
draw();
v_scrollbar.set_value( v_value, y_high -
(y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar);
return 1;
}
else
return 0;
}
break;
case Glow.eEvent_ScrollDown:
if ( !cmn.trace_started)
return 0;
if ( v_scrollbar) {
double rx, ry;
// Convert koordinates to local koordinates
rp = trf.reverse( fx, fy);
sts = local_event_handler( event);
if ( sts) {
v_value += (wctx_y1 - wctx_y0) * window_scale/50;
if ( v_value > wctx_y1 * window_scale - ((y_high - (y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar)))
v_value = wctx_y1 * window_scale - ((y_high - (y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar));
draw();
v_scrollbar.set_value( v_value, y_high -
(y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar);
return 1;
}
else
return 0;
}
break;
default:
;
}
*/
v_sts = h_sts = 0;
if ( v_scrollbar != null)
v_sts = v_scrollbar.eventHandler( event, fx, fy);
if (h_scrollbar != null)
h_sts = h_scrollbar.eventHandler( event, fx, fy);
if ( v_sts != 0 || h_sts != 0) {
return 1;
}
sts = super.eventHandler( event, fx, fy);
if ( cmn.callback_object == this) {
// Disable event callback for this object, let the window ctx handle it
cmn.callback_object = null;
cmn.callback_object_type = Glow.eObjectType_NoObject;
}
if ( windowCmn != null && sts != 0) {
int ur_x = (int)( (x_right - vertical_scrollbar * scrollbar_width) * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
int ll_x = (int)( x_left * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
int ur_y = (int)( (y_high - horizontal_scrollbar * scrollbar_width) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
int ll_y = (int)( (y_low + y_low_offs) * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
// window_ctx->draw_buffer_only = ctx->draw_buffer_only;
cmn.gdraw.set_clip_rectangle( ll_x, ll_y, ur_x, ur_y);
// Set callback to redraw the background
// windowCmn.redraw_callback = redraw_cb;
// windowCmn.redraw_data = (Object)this;
GlowEvent e = new GlowEvent();
e.event = event.event;
e.type = event.type;
e.x = (event.x - x_left) / windowCmn.mw.subwindow_scale + h_value / windowCmn.mw.subwindow_scale;
e.y = (event.y - y_low) / windowCmn.mw.subwindow_scale + v_value / windowCmn.mw.subwindow_scale;
e.object = event.object;
e.object_type = event.object_type;
sts = windowCmn.ctx.eventHandler( e, fx, fy);
if ( sts == Glow.GLOW__TERMINATED)
return sts;
// windowCmn.redraw_callback = 0;
// windowCmn.redraw_data = 0;
cmn.gdraw.reset_clip_rectangle();
/*
if ( windowCmn.inputfocus_object && !input_focus) {
cmn.register_inputfocus( this, 1);
input_focus = 1;
}
else if ( !windowCmn.inputfocus_object && input_focus) {
cmn.register_inputfocus( this, 0);
input_focus = 0;
}
*/
// if ( window_ctx->callback_object)
// ctx->register_callback_object( window_ctx->callback_object_type, window_ctx->callback_object);
}
return sts;
}
void configureScrollbars() {
double x0, y0, width, height;
if ( vertical_scrollbar != 0 && v_scrollbar == null) {
x0 = x_right - scrollbar_width;
y0 = y_low + y_low_offs;
width = scrollbar_width;
if ( horizontal_scrollbar != 0)
height = y_high - (y_low + y_low_offs) - scrollbar_width;
else
height = y_high - (y_low + y_low_offs);
v_scrollbar = new GrowScrollBar( cmn, "vScrollbar", x0, y0, width, height,
Glow.eDir_Vertical, Glow.eDrawType_Line, 1, display_level,
scrollbar_bg_color, scrollbar_color, 1, this);
if ( windowCmn != null) {
v_scrollbar.set_range( wctx_y0 * windowCmn.mw.subwindow_scale, wctx_y1 * window_scale);
v_scrollbar.set_value( wctx_y0 * windowCmn.mw.subwindow_scale, y_high -
(y_low + y_low_offs) - scrollbar_width * horizontal_scrollbar);
v_value = wctx_y0 * windowCmn.mw.subwindow_scale;
}
v_scrollbar.set_shadow( shadow);
}
else {
if ( windowCmn != null)
v_value = wctx_y0 * windowCmn.mw.subwindow_scale;
}
if ( horizontal_scrollbar != 0 && h_scrollbar == null) {
x0 = x_left;
y0 = y_high - scrollbar_width;
height = scrollbar_width;
if ( vertical_scrollbar != 0)
width = x_right - x_left - scrollbar_width;
else
width = x_right - x_left;
h_scrollbar = new GrowScrollBar( cmn, "vScrollbar", x0, y0, width, height,
Glow.eDir_Horizontal, Glow.eDrawType_Line, 1, display_level,
scrollbar_bg_color, scrollbar_color, 1, this);
if ( windowCmn != null) {
h_scrollbar.set_range( wctx_x0 * windowCmn.mw.subwindow_scale, wctx_x1 * windowCmn.mw.subwindow_scale);
h_scrollbar.set_value( wctx_x0 * windowCmn.mw.subwindow_scale,
x_right - x_left - scrollbar_width * vertical_scrollbar);
h_value = wctx_x0 * windowCmn.mw.subwindow_scale;
}
h_scrollbar.set_shadow( shadow);
}
else {
if ( windowCmn != null)
h_value = wctx_x0 * windowCmn.mw.subwindow_scale;
}
}
public void verticalScrollValueChanged(double value) {
if ( v_value != value) {
v_value = value;
draw();
}
}
public void horizontalScrollValueChanged(double value) {
if ( h_value != value) {
h_value = value;
draw();
}
}
public void update_attributes() {
if ( owner == null)
owner = new String();
if ( !input_file_name.equals( file_name) ||
!windowCmn.owner.equals( owner)) {
// New graph, create new context
int ur_x = (int)( x_right * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
int ll_x = (int)( x_left * cmn.mw.zoom_factor_x) - cmn.mw.offset_x;
int ur_y = (int)( y_high * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
int ll_y = (int)( y_low * cmn.mw.zoom_factor_y) - cmn.mw.offset_y;
cmn.gdraw.set_clip_rectangle( ll_x, ll_y, ur_x-1, ur_y-1);
if ( windowCmn != null) {
if ( windowCmn.ctx.traceStarted())
windowCmn.ctx.traceDisconnect();
fill_drawtype = original_fill_drawtype = Glow.eDrawType_Inherit;
fill = 0;
}
file_name = input_file_name;
new_ctx();
windowCmn.ctx.traceConnect();
cmn.gdraw.reset_clip_rectangle();
}
}
public void traceConnect() {
windowCmn.ctx.traceConnect();
}
public void traceDisconnect() {
windowCmn.ctx.traceDisconnect();
}
public void traceScan() {
windowCmn.ctx.traceScan();
}
public void setSource( String file_name, String owner) {
this.input_file_name = file_name;
this.owner = owner;
update_attributes();
}
}
......@@ -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