Commit 5f9ff3c5 authored by Claes Sjofors's avatar Claes Sjofors

Java android app work

parent e01bb94c
...@@ -4,6 +4,7 @@ import android.graphics.Bitmap; ...@@ -4,6 +4,7 @@ import android.graphics.Bitmap;
public class AGraphInfo { public class AGraphInfo {
public Bitmap bpm; public Bitmap bpm;
public Bitmap bpmInverted;
public String graph; public String graph;
public String text; public String text;
public int iconX; public int iconX;
...@@ -12,4 +13,5 @@ public class AGraphInfo { ...@@ -12,4 +13,5 @@ public class AGraphInfo {
public int iconHeight; public int iconHeight;
public int textX; public int textX;
public int textY; public int textY;
public boolean inverted = false;
} }
...@@ -11,6 +11,8 @@ public class AXttItemAttrObject extends AXttItemBase { ...@@ -11,6 +11,8 @@ public class AXttItemAttrObject extends AXttItemBase {
String name; String name;
int flags; int flags;
int type; int type;
PwrtAttrRef aref;
AXttItemAttrObject(AXtt axtt, PwrtObjid objid, String name, String fullName, int flags, int type, AXttItemAttrObject(AXtt axtt, PwrtObjid objid, String name, String fullName, int flags, int type,
PlowNode destination, int destCode) { PlowNode destination, int destCode) {
...@@ -20,9 +22,24 @@ public class AXttItemAttrObject extends AXttItemBase { ...@@ -20,9 +22,24 @@ public class AXttItemAttrObject extends AXttItemBase {
this.flags = flags; this.flags = flags;
this.type = type; this.type = type;
CdhrAttrRef ar = axtt.gdh.nameToAttrRef( fullName);
if ( ar.evenSts()) return;
aref = ar.aref;
CdhrTypeId cr = axtt.gdh.getAttrRefTid( ar.aref);
if ( cr.evenSts()) return;
CdhrObjid coidret = axtt.gdh.classIdToObjid(cr.typeId);
if ( coidret.evenSts()) return;
CdhrString cnameret = axtt.gdh.objidToName(coidret.objid, Cdh.mName_object);
if ( cnameret.evenSts()) return;
node = new PlowNode(axtt.cmn, 0, 0, axtt.ncObject); node = new PlowNode(axtt.cmn, 0, 0, axtt.ncObject);
node.setAnnotPixmap(0, axtt.iconObject); node.setAnnotPixmap(0, axtt.iconObject);
node.setAnnotation(0, name, 22); node.setAnnotation(0, name, 22);
node.setAnnotation(1, cnameret.str, 22);
axtt.cmn.insertNode(node, destination, destCode); axtt.cmn.insertNode(node, destination, destCode);
node.setUserData(this); node.setUserData(this);
...@@ -89,4 +106,8 @@ public class AXttItemAttrObject extends AXttItemBase { ...@@ -89,4 +106,8 @@ public class AXttItemAttrObject extends AXttItemBase {
} }
axtt.cmn.configure(); axtt.cmn.configure();
} }
public PwrtAttrRef getAttrRef() {
return aref;
}
} }
...@@ -126,14 +126,14 @@ public class FlowCmn implements PlowCmnIfc { ...@@ -126,14 +126,14 @@ public class FlowCmn implements PlowCmnIfc {
public void scroll( int x, int y) { public void scroll( int x, int y) {
offset_y += y; offset_y += y;
offset_x += x; offset_x += x;
if ( offset_x < x_left * zoom_factor - scrollOffset)
offset_x = (int)(x_left * zoom_factor) - scrollOffset;
if ( offset_x > x_right * zoom_factor - canvasWidth + scrollOffset) if ( offset_x > x_right * zoom_factor - canvasWidth + scrollOffset)
offset_x = (int)(x_right * zoom_factor - canvasWidth) + scrollOffset; offset_x = (int)(x_right * zoom_factor - canvasWidth) + scrollOffset;
if ( offset_y < y_low * zoom_factor - scrollOffset) if ( offset_x < x_left * zoom_factor - scrollOffset)
offset_y = (int)(y_low * zoom_factor) - scrollOffset; offset_x = (int)(x_left * zoom_factor) - scrollOffset;
if ( offset_y > y_high * zoom_factor - canvasHeight + 80 + scrollOffset) if ( offset_y > y_high * zoom_factor - canvasHeight + 80 + scrollOffset)
offset_y = (int)(y_high * zoom_factor - canvasHeight + 80) + scrollOffset; offset_y = (int)(y_high * zoom_factor - canvasHeight + 80) + scrollOffset;
if ( offset_y < y_low * zoom_factor - scrollOffset)
offset_y = (int)(y_low * zoom_factor) - scrollOffset;
} }
@Override @Override
public void pageUp() { public void pageUp() {
...@@ -155,8 +155,11 @@ public class FlowCmn implements PlowCmnIfc { ...@@ -155,8 +155,11 @@ public class FlowCmn implements PlowCmnIfc {
int type; int type;
switch( action) { switch( action) {
case MotionEvent.ACTION_UP: case PlowCmnIfc.ACTION_CLICK:
type = PlowEvent.TYPE_CLICK; type = PlowEvent.TYPE_CLICK;
break;
case PlowCmnIfc.ACTION_LONG_CLICK:
type = PlowEvent.TYPE_LONG_CLICK;
break; break;
default: default:
return; return;
......
...@@ -227,8 +227,8 @@ public class FlowCon implements FlowArrayElem { ...@@ -227,8 +227,8 @@ public class FlowCon implements FlowArrayElem {
public void draw( FlowPoint p0, String[] annotv, boolean highlight) { public void draw( FlowPoint p0, String[] annotv, boolean highlight) {
// Adjust pos to javabean koordinates // Adjust pos to javabean koordinates
FlowPoint p = new FlowPoint(cmn); FlowPoint p = new FlowPoint(cmn);
p.x = x_left / cmn.zoom_factor; p.x = 0;
p.y = y_low / cmn.zoom_factor; p.y = 0;
if ( temporary_ref != 0 || cc.con_type == Flow.eConType_Reference) if ( temporary_ref != 0 || cc.con_type == Flow.eConType_Reference)
ref_a.draw( p, null, highlight); ref_a.draw( p, null, highlight);
else { else {
......
...@@ -131,7 +131,7 @@ public class FlowNode implements FlowArrayElem { ...@@ -131,7 +131,7 @@ public class FlowNode implements FlowArrayElem {
break; break;
case Flow.eSave_Node_n_name: case Flow.eSave_Node_n_name:
if ( token.hasMoreTokens()) if ( token.hasMoreTokens())
n_name = token.nextToken(); n_name = token.nextToken();
else else
n_name = new String(); n_name = new String();
break; break;
...@@ -178,7 +178,7 @@ public class FlowNode implements FlowArrayElem { ...@@ -178,7 +178,7 @@ public class FlowNode implements FlowArrayElem {
else else
break; break;
} }
buf.append(c); // TODO convert to UTF-8 buf.append(c);
c_old = c; c_old = c;
} }
annotv[i] = new String( buf); annotv[i] = new String( buf);
......
...@@ -139,4 +139,11 @@ public class GraphCmn implements PlowCmnIfc { ...@@ -139,4 +139,11 @@ public class GraphCmn implements PlowCmnIfc {
public void resetNodraw() { public void resetNodraw() {
graph.ctx.cmn.resetNodraw(); graph.ctx.cmn.resetNodraw();
} }
public int getAppMotion() {
return graph.cmn.getAppMotion();
}
public boolean getSliderActive() {
return graph.ctx.getSliderActive();
}
} }
...@@ -6,6 +6,7 @@ import jpwr.pwrxtt.MainActivity; ...@@ -6,6 +6,7 @@ import jpwr.pwrxtt.MainActivity;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.view.MotionEvent;
public class OpwinCmn implements PlowCmnIfc { public class OpwinCmn implements PlowCmnIfc {
Object userData; Object userData;
...@@ -17,10 +18,15 @@ public class OpwinCmn implements PlowCmnIfc { ...@@ -17,10 +18,15 @@ public class OpwinCmn implements PlowCmnIfc {
int canvasWidth; int canvasWidth;
int offsetY = 0; int offsetY = 0;
int borderY = 0; int borderY = 0;
AGraphInfo currentGraph = null;
double downX;
double downY;
float density;
public OpwinCmn( MainActivity appl, Vector<AGraphInfo> graphList) { public OpwinCmn( MainActivity appl, Vector<AGraphInfo> graphList, float density) {
this.graphList = graphList; this.graphList = graphList;
this.appl = appl; this.appl = appl;
this.density = density;
} }
public int type() { public int type() {
return TYPE_OPWIN; return TYPE_OPWIN;
...@@ -41,10 +47,10 @@ public class OpwinCmn implements PlowCmnIfc { ...@@ -41,10 +47,10 @@ public class OpwinCmn implements PlowCmnIfc {
if (graph.iconHeight > iconHeightMax) if (graph.iconHeight > iconHeightMax)
iconHeightMax = graph.iconHeight; iconHeightMax = graph.iconHeight;
} }
int offsetX = 100; int offsetX = (int)(density * 100);
int offsetY = 100; int offsetY = (int)(density * 100);
int distX = iconWidthMax + 50; int distX = iconWidthMax + (int)(density * 50);
int distY = iconHeightMax + 70; int distY = iconHeightMax + (int)(density * 70);
int x = offsetX; int x = offsetX;
int y = offsetY; int y = offsetY;
for ( int i = 0; i < graphList.size(); i++) { for ( int i = 0; i < graphList.size(); i++) {
...@@ -52,7 +58,7 @@ public class OpwinCmn implements PlowCmnIfc { ...@@ -52,7 +58,7 @@ public class OpwinCmn implements PlowCmnIfc {
graph.iconX = x; graph.iconX = x;
graph.iconY = y; graph.iconY = y;
graph.textX = graph.iconX + graph.iconWidth/2; graph.textX = graph.iconX + graph.iconWidth/2;
graph.textY = graph.iconY + graph.iconHeight + 15; graph.textY = graph.iconY + graph.iconHeight + (int)(density * 15);
borderY = graph.textY + 100; borderY = graph.textY + 100;
...@@ -78,7 +84,12 @@ public class OpwinCmn implements PlowCmnIfc { ...@@ -78,7 +84,12 @@ public class OpwinCmn implements PlowCmnIfc {
for ( int i = 0; i < graphList.size(); i++) { for ( int i = 0; i < graphList.size(); i++) {
AGraphInfo graph = graphList.get(i); AGraphInfo graph = graphList.get(i);
canvas.drawBitmap(graph.bpm, graph.iconX, graph.iconY - offsetY, p); if ( graph.inverted)
canvas.drawBitmap(graph.bpmInverted, graph.iconX, graph.iconY - offsetY, p);
else
canvas.drawBitmap(graph.bpm, graph.iconX, graph.iconY - offsetY, p);
p.setTextSize( density * 15);
int textWidth = (int) p.measureText(graph.text); int textWidth = (int) p.measureText(graph.text);
canvas.drawText(graph.text, graph.textX - textWidth/2, graph.textY - offsetY, p); canvas.drawText(graph.text, graph.textX - textWidth/2, graph.textY - offsetY, p);
} }
...@@ -100,14 +111,23 @@ public class OpwinCmn implements PlowCmnIfc { ...@@ -100,14 +111,23 @@ public class OpwinCmn implements PlowCmnIfc {
public void pageDown() {} public void pageDown() {}
public void eventHandler(int action, double fx, double fy) { public void eventHandler(int action, double fx, double fy) {
switch (action) { switch (action) {
case PlowEvent.TYPE_CLICK: case PlowCmnIfc.ACTION_UP:
System.out.println("Opwin click " + fx + " " + fy); if ( currentGraph != null) {
String cmd = "open graph " + currentGraph.graph;
if ( Math.abs(fx - downX) < 10 && Math.abs(fy - downY) < 10)
appl.command(cmd);
currentGraph.inverted = false;
currentGraph = null;
}
break;
case PlowCmnIfc.ACTION_DOWN:
for ( int i = 0; i < graphList.size(); i++) { for ( int i = 0; i < graphList.size(); i++) {
if ( fx > graphList.get(i).iconX && fx <= graphList.get(i).iconX + graphList.get(i).iconWidth && if ( fx > graphList.get(i).iconX && fx <= graphList.get(i).iconX + graphList.get(i).iconWidth &&
fy > graphList.get(i).iconY - offsetY && fy <= graphList.get(i).iconY + graphList.get(i).iconHeight - offsetY) { fy > graphList.get(i).iconY - offsetY && fy <= graphList.get(i).iconY + graphList.get(i).iconHeight - offsetY) {
System.out.println("Hit in icon"); currentGraph = graphList.get(i);
String cmd = "open graph " + graphList.get(i).graph; currentGraph.inverted = true;
appl.command(cmd); downX = fx;
downY = fy;
} }
} }
break; break;
......
...@@ -77,11 +77,16 @@ public class PlowCmn implements PlowCmnIfc { ...@@ -77,11 +77,16 @@ public class PlowCmn implements PlowCmnIfc {
double x = (fx + offset_x) / zoom_factor; double x = (fx + offset_x) / zoom_factor;
double y = (fy + offset_y) / zoom_factor; double y = (fy + offset_y) / zoom_factor;
int type; int type;
boolean long_click = false;
switch( action) { switch( action) {
case MotionEvent.ACTION_UP: case PlowCmnIfc.ACTION_CLICK:
type = PlowEvent.TYPE_CLICK; type = PlowEvent.TYPE_CLICK;
break; break;
case PlowCmnIfc.ACTION_LONG_CLICK:
type = PlowEvent.TYPE_CLICK;
long_click = true;
break;
default: default:
return; return;
} }
...@@ -92,6 +97,8 @@ public class PlowCmn implements PlowCmnIfc { ...@@ -92,6 +97,8 @@ public class PlowCmn implements PlowCmnIfc {
currentNode = null; currentNode = null;
a.eventHandler(e); a.eventHandler(e);
if ( long_click)
e.type = PlowEvent.TYPE_LONG_CLICK;
appl.eventHandler(e); appl.eventHandler(e);
switch (e.type) { switch (e.type) {
......
...@@ -8,6 +8,11 @@ public interface PlowCmnIfc { ...@@ -8,6 +8,11 @@ public interface PlowCmnIfc {
public static final int TYPE_GRAPH = 3; public static final int TYPE_GRAPH = 3;
public static final int TYPE_EV = 4; public static final int TYPE_EV = 4;
public static final int TYPE_OPWIN = 5; public static final int TYPE_OPWIN = 5;
public static final int ACTION_CLICK = 0;
public static final int ACTION_LONG_CLICK = 1;
public static final int ACTION_DOWN = 2;
public static final int ACTION_UP = 3;
public int type(); public int type();
public Object getUserData(); public Object getUserData();
......
...@@ -10,6 +10,7 @@ import android.graphics.ColorMatrixColorFilter; ...@@ -10,6 +10,7 @@ import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Path; import android.graphics.Path;
import android.graphics.RectF; import android.graphics.RectF;
import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
public class PlowDraw implements PlowDrawIfc { public class PlowDraw implements PlowDrawIfc {
...@@ -26,12 +27,14 @@ public class PlowDraw implements PlowDrawIfc { ...@@ -26,12 +27,14 @@ public class PlowDraw implements PlowDrawIfc {
Typeface[] fonts = new Typeface[6]; Typeface[] fonts = new Typeface[6];
int canvasWidth; int canvasWidth;
int canvasHeight; int canvasHeight;
float textDensity = 1;
float lineDensity = 1;
static float[] inv = { -1f, 0f, 0f, 1f, 1f, static float[] inv = { -1f, 0f, 0f, 1f, 1f,
0f,-1f, 0f, 1f, 1f, 0f,-1f, 0f, 1f, 1f,
0f, 0f,-1f, 1f, 1f, 0f, 0f,-1f, 1f, 1f,
0f, 0f, 0f, 1f, 0f}; 0f, 0f, 0f, 1f, 0f};
public PlowDraw(Activity activity) { public PlowDraw(Activity activity) {
this.activity = activity; this.activity = activity;
paint = new Paint(); paint = new Paint();
...@@ -61,7 +64,7 @@ public class PlowDraw implements PlowDrawIfc { ...@@ -61,7 +64,7 @@ public class PlowDraw implements PlowDrawIfc {
if ( border) { if ( border) {
paint.setColor(getColor(color)); paint.setColor(getColor(color));
paint.setStyle(Paint.Style.STROKE); paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(1); paint.setStrokeWidth(lineDensity < 1 ? 1 : lineDensity);
canvas.drawRect(x1, y1, x2, y2, paint); canvas.drawRect(x1, y1, x2, y2, paint);
} }
else { else {
...@@ -78,7 +81,7 @@ public class PlowDraw implements PlowDrawIfc { ...@@ -78,7 +81,7 @@ public class PlowDraw implements PlowDrawIfc {
if ( border) { if ( border) {
paint.setColor(getColor(color)); paint.setColor(getColor(color));
paint.setStyle(Paint.Style.STROKE); paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(1); paint.setStrokeWidth(lineDensity < 1 ? 1 : lineDensity);
canvas.drawArc(new RectF(x1, y1, x2, y2), 360-angel1, -angel2, false, paint); canvas.drawArc(new RectF(x1, y1, x2, y2), 360-angel1, -angel2, false, paint);
} }
else { else {
...@@ -93,7 +96,7 @@ public class PlowDraw implements PlowDrawIfc { ...@@ -93,7 +96,7 @@ public class PlowDraw implements PlowDrawIfc {
paint.setColor(getColor(color)); paint.setColor(getColor(color));
paint.setStyle(Paint.Style.STROKE); paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(1); paint.setStrokeWidth(lineDensity < 1 ? 1 : lineDensity);
canvas.drawLine(x1, y1, x2, y2, paint); canvas.drawLine(x1, y1, x2, y2, paint);
} }
...@@ -114,16 +117,33 @@ public class PlowDraw implements PlowDrawIfc { ...@@ -114,16 +117,33 @@ public class PlowDraw implements PlowDrawIfc {
@Override @Override
public void drawText( String text, int textColor, int textSize, int font, float x, float y) { public void drawText( String text, int textColor, int textSize, int font, float x, float y) {
paint.setTextSize(textSize); paint.setTextSize(textDensity * textSize);
paint.setTypeface(fonts[font]); paint.setTypeface(fonts[font]);
paint.setColor(getColor(textColor)); paint.setColor(getColor(textColor));
paint.setStyle(Paint.Style.FILL); paint.setStyle(Paint.Style.FILL);
canvas.drawText( text, x, y, paint);
int idx;
if ( (idx = text.indexOf('\n')) != -1) {
Rect tsize = new Rect();
paint.getTextBounds("A", 0, 1, tsize);
String row = text.substring(0,idx);
String rest = text.substring(idx+1);
canvas.drawText( row, x, y, paint);
while ( (idx = rest.indexOf('\n')) != -1) {
row = rest.substring(0,idx);
rest = rest.substring(idx+1);
y += tsize.height() * 1.65;
canvas.drawText( row, x, y, paint);
}
}
else
canvas.drawText( text, x, y, paint);
} }
@Override @Override
public float measureText( String text, int textSize, int font) { public float measureText( String text, int textSize, int font) {
paint.setTextSize(textSize); paint.setTextSize(textDensity * textSize);
paint.setTypeface(null); paint.setTypeface(null);
return paint.measureText(text); return paint.measureText(text);
...@@ -170,4 +190,9 @@ public class PlowDraw implements PlowDrawIfc { ...@@ -170,4 +190,9 @@ public class PlowDraw implements PlowDrawIfc {
return Color.BLACK; return Color.BLACK;
} }
} }
public void setDensity( float textDensity, float lineDensity) {
this.textDensity = textDensity;
this.lineDensity = lineDensity;
}
} }
...@@ -13,5 +13,5 @@ public interface PlowDrawIfc { ...@@ -13,5 +13,5 @@ public interface PlowDrawIfc {
public int getCanvasWidth(); public int getCanvasWidth();
public int getCanvasHeight(); public int getCanvasHeight();
public void setCanvas(Canvas canvas); public void setCanvas(Canvas canvas);
public void setDensity(float textDensity, float lineDensity);
} }
...@@ -3,6 +3,7 @@ package jpwr.app; ...@@ -3,6 +3,7 @@ package jpwr.app;
public class PlowEvent { public class PlowEvent {
public static final int TYPE_CLICK = 1; public static final int TYPE_CLICK = 1;
public static final int TYPE_OBJECT_DELETED = 2; public static final int TYPE_OBJECT_DELETED = 2;
public static final int TYPE_LONG_CLICK = 3;
public int type; public int type;
public double x; public double x;
......
...@@ -126,7 +126,7 @@ public class PlowNode implements PlowComponent, PlowArrayElem, PlowNodeIfc { ...@@ -126,7 +126,7 @@ public class PlowNode implements PlowComponent, PlowArrayElem, PlowNodeIfc {
if ( invert == this.invert) if ( invert == this.invert)
return; return;
this.invert = invert; this.invert = invert;
draw(); // draw();
} }
public void configure(PlowNode previous) { public void configure(PlowNode previous) {
......
...@@ -69,7 +69,6 @@ public class GlowDraw implements GlowDrawIfc { ...@@ -69,7 +69,6 @@ public class GlowDraw implements GlowDrawIfc {
public GlowDraw() { public GlowDraw() {
paint = new Paint(); paint = new Paint();
} }
public void setActivity(Activity activity) { public void setActivity(Activity activity) {
......
...@@ -38,174 +38,16 @@ ...@@ -38,174 +38,16 @@
package jpwr.jopg; package jpwr.jopg;
import jpwr.rt.*; import jpwr.rt.*;
import java.io.*; import java.io.*;
//import java.awt.*;
//import java.awt.font.*;
import java.net.*; import java.net.*;
public class GrowFrame implements GraphApplIfc { public class GrowFrame implements GraphApplIfc {
/*
JScrollPane scrollPane;
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
Dimension size;
Object root;
Graph graph;
Timer timer;
LocalPanel localPanel = new LocalPanel();
int scanTime = 1000;
int scanCount = 0;
JDialog confirmDia = null;
JLabel confirmLabel;
Object confirmDyn;
Object confirmObject;
*/
String instance; String instance;
GrowFrameApplIfc appl; GrowFrameApplIfc appl;
public GrowFrame( String file, Gdh gdh, String instance, GrowFrameApplIfc appl) { public GrowFrame( String file, Gdh gdh, String instance, GrowFrameApplIfc appl) {
/*
root = (Object) this;
this.instance = instance;
this.appl = appl;
init( file, gdh);
*/
} }
private void init( String file, Gdh gdh) { private void init( String file, Gdh gdh) {
/*
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
contentPane.add(localPanel, BorderLayout.CENTER);
contentPane.setOpaque(true);
localPanel.setLayout(null);
localPanel.setOpaque(true);
localPanel.setBackground( Color.white);
this.setTitle("GrowFrame");
size = new Dimension( 1100, 900);
setSize( size);
String filename;
BufferedReader reader = null;
String fname = file;
if ( root != null && root instanceof 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)
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;
}
// Read size info
String line;
int defaultWidth = 0;
int defaultHeight = 0;
try {
for ( int i = 0; i < 2; i++) {
line = reader.readLine();
if ( line == null || !line.startsWith("0! "))
break;
if ( line.substring(3, 15).equals("DefaultWidth"))
defaultWidth = new Integer(line.substring(16)).intValue();
else if ( line.substring(3, 16).equals("DefaultHeight"))
defaultHeight = new Integer(line.substring(17)).intValue();
}
} catch ( Exception e) {
System.out.println( "IOException GlowFrame");
}
System.out.println("GraphFrame size " + defaultWidth + " " + defaultHeight);
if ( defaultWidth != 0 && defaultHeight != 0) {
size = new Dimension( defaultWidth + 5, defaultHeight + 40);
setSize( size);
}
}
if ( gdh == null)
gdh = new Gdh(this);
graph = new Graph(this, gdh);
graph.open(reader);
setSize();
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
setDefaultCloseOperation( DISPOSE_ON_CLOSE);
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;
event.event = Glow.eEvent_MB1Click;
graph.ctx.eventHandler( event);
}
public void mousePressed(MouseEvent e) {
System.out.println("MouseListener");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
event.event = Glow.eEvent_MB1Down;
graph.ctx.eventHandler( event);
}
public void mouseReleased(MouseEvent e) {
System.out.println("MouseListener");
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
event.event = Glow.eEvent_MB1Up;
graph.ctx.eventHandler( event);
}
public void mouseMoved(MouseEvent e) {
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
event.event = Glow.eEvent_CursorMotion;
graph.ctx.eventHandler( event);
}
public void mouseDragged(MouseEvent e) {
GlowEvent event = new GlowEvent();
event.x = (e.getX() + graph.ctx.cmn.mw.offset_x) / graph.ctx.cmn.mw.zoom_factor_x;
event.y = (e.getY() + graph.ctx.cmn.mw.offset_y) / graph.ctx.cmn.mw.zoom_factor_y;
event.event = Glow.eEvent_ButtonMotion;
graph.ctx.eventHandler( event);
}
};
localPanel.addMouseListener(adapter);
localPanel.addMouseMotionListener(adapter);
timer = new Timer( scanTime, this);
timer.start();
*/
} }
...@@ -218,111 +60,23 @@ public class GrowFrame implements GraphApplIfc { ...@@ -218,111 +60,23 @@ public class GrowFrame implements GraphApplIfc {
return 100; return 100;
} }
/*
public void actionPerformed( ActionEvent e) {
scanCount++;
if ( scanCount == 1)
graph.gdh.getObjectRefInfoAll();
graph.ctx.traceScan();
localPanel.repaint();
}
*/
void setSize() { void setSize() {
/*
size = new Dimension( (int)((graph.ctx.cmn.x_right - graph.ctx.cmn.x_left) * graph.ctx.cmn.mw.zoom_factor_x) + Glow.DRAWOFFSET * 2,
(int)((graph.ctx.cmn.y_high - graph.ctx.cmn.y_low) * graph.ctx.cmn.mw.zoom_factor_y) + Glow.DRAWOFFSET * 2);
localPanel.setPreferredSize( size);
localPanel.revalidate();
*/
} }
/*
class LocalPanel extends JPanel {
public LocalPanel() {}
public Dimension getPreferredSize() { return size;}
public Dimension getMinimumSize() { return size;}
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
g2.setPaint(graph.ctx.cmn.gdraw.getColor(graph.ctx.cmn.background_color));
g2.fill(new Rectangle2D.Double(0,0,getWidth(),getHeight()));
graph.gdraw.setGraphics(g2);
graph.ctx.draw();
}
}
*/
public void closeGrow() { public void closeGrow() {
} }
public int command(String cmd) { public int command(String cmd) {
System.out.println("Ge command : " + cmd);
if ( appl != null) if ( appl != null)
return appl.command(cmd); return appl.command(cmd);
return 0; return 0;
} }
public void confirmNo() {} public void confirmNo() {}
public void confirmYes() { public void confirmYes() {}
// ((Dyn)confirmDyn).confirmedAction( Glow.eEvent_MB1Click, confirmObject); public void openConfirmDialog( Object dyn, String text, Object object) {}
}
public void openConfirmDialog( Object dyn, String text, Object object) {
/*
JLabel label = null;
confirmDyn = dyn; public void openValueInputDialog( Object dyn, String text, Object object) {}
confirmObject = object;
if ( confirmDia == null) {
confirmDia = new JDialog();
confirmDia.setTitle("Confirm");
confirmDia.setResizable(false);
confirmDia.setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE);
confirmDia.setSize( 400, 150);
confirmLabel = new JLabel( text, JLabel.CENTER);
confirmDia.getContentPane().setLayout( new BorderLayout());
confirmDia.getContentPane().add( confirmLabel, BorderLayout.CENTER);
JButton buttonYes = new JButton("Yes");
buttonYes.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ev) {
confirmYes();
confirmDia.dispose();
}
});
JButton buttonNo = new JButton("No");
buttonNo.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ev) {
confirmNo();
confirmDia.dispose();
}
});
JButton buttonCancel = new JButton("Cancel");
buttonCancel.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ev) {
confirmNo();
confirmDia.dispose();
}
});
JPanel panel = new JPanel();
panel.add( buttonYes);
panel.add( buttonNo);
panel.add( buttonCancel);
confirmDia.getContentPane().add( panel, BorderLayout.SOUTH);
// confirmDia.setLocationRelativeTo( par);
confirmDia.setVisible( true);
}
else {
// confirmDia.setLocationRelativeTo( par);
confirmLabel.setText( text);
confirmDia.setVisible( true);
}
*/
}
public void openValueInputDialog( Object dyn, String text, Object object) {
}
public String getObject() { public String getObject() {
return instance; return instance;
} }
...@@ -330,6 +84,9 @@ public class GrowFrame implements GraphApplIfc { ...@@ -330,6 +84,9 @@ public class GrowFrame implements GraphApplIfc {
return null; return null;
} }
public void closeGraph() {} public void closeGraph() {}
public boolean isAuthorized(int access) {
return false;
}
} }
......
...@@ -22,6 +22,7 @@ import android.support.v4.app.FragmentManager; ...@@ -22,6 +22,7 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.view.MotionEventCompat; import android.support.v4.view.MotionEventCompat;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.util.DisplayMetrics;
import android.util.FloatMath; import android.util.FloatMath;
import android.util.Log; import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
...@@ -37,6 +38,7 @@ import android.content.SharedPreferences; ...@@ -37,6 +38,7 @@ import android.content.SharedPreferences;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray;
import android.view.*; import android.view.*;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -51,7 +53,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -51,7 +53,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
static final int MODE_SCROLL = 1; static final int MODE_SCROLL = 1;
static final int MODE_ZOOM = 2; static final int MODE_ZOOM = 2;
String dataFile = "pwrdata"; String pwrp_exe = "pwrp_exe/";
String pwrp_load = "pwrp_load/";
String pwr_exe = "pwr_exe/";
Timer timer = new Timer(); Timer timer = new Timer();
MainView view; MainView view;
Gdh gdh = null; Gdh gdh = null;
...@@ -107,6 +111,8 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -107,6 +111,8 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
float eventDistance; float eventDistance;
Vector<AGraphInfo> graphList = new Vector<AGraphInfo>(); Vector<AGraphInfo> graphList = new Vector<AGraphInfo>();
Vector<PlowCmnIfc> cmnList = new Vector<PlowCmnIfc>(); Vector<PlowCmnIfc> cmnList = new Vector<PlowCmnIfc>();
Canvas currentCanvas = null;
float density;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -119,8 +125,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -119,8 +125,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
view.invalidate(); view.invalidate();
timer.schedule( new MyTask(), 0, 2000); timer.schedule( new MyTask(), 0, 2000);
DisplayMetrics metrics = getResources().getDisplayMetrics();
density = metrics.densityDpi / 150;
PlowCmn cmn = new PlowCmn(this, 15D); PlowCmn cmn = new PlowCmn(this, density * 15);
gdraw = new PlowDraw(this); gdraw = new PlowDraw(this);
cmn.setGDraw(gdraw); cmn.setGDraw(gdraw);
currentCmn = cmn; currentCmn = cmn;
...@@ -196,7 +204,25 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -196,7 +204,25 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
} }
} }
} }
public void onBackPressed() {
if ( (opwinCmn != null && currentCmn == opwinCmn) ||
(opwinCmn == null && currentCmn == cmnList.get(0))) {
super.onBackPressed();
return;
}
// Back to opwind
if ( opwinCmn != null) {
while ( currentCmn != opwinCmn)
pushCmn();
}
else {
while ( currentCmn != cmnList.get(0))
pushCmn();
}
}
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
...@@ -230,10 +256,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -230,10 +256,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
if ( aev != null && currentCmn == aev.getCmnAla()) { if ( aev != null && currentCmn == aev.getCmnAla()) {
// Alarm list // Alarm list
item_close.setVisible(true); item_close.setVisible(true);
item_zoomin.setVisible(true); item_zoomin.setVisible(false);
item_zoomout.setVisible(true); item_zoomout.setVisible(false);
item_pageup.setVisible(true); item_pageup.setVisible(false);
item_pagedown.setVisible(true); item_pagedown.setVisible(false);
item_openobject.setVisible(true); item_openobject.setVisible(true);
item_opengraph.setVisible(true); item_opengraph.setVisible(true);
item_openclassgraph.setVisible(true); item_openclassgraph.setVisible(true);
...@@ -246,10 +272,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -246,10 +272,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
else if ( aev != null && currentCmn == aev.getCmnEve()) { else if ( aev != null && currentCmn == aev.getCmnEve()) {
// Event list // Event list
item_close.setVisible(true); item_close.setVisible(true);
item_zoomin.setVisible(true); item_zoomin.setVisible(false);
item_zoomout.setVisible(true); item_zoomout.setVisible(false);
item_pageup.setVisible(true); item_pageup.setVisible(false);
item_pagedown.setVisible(true); item_pagedown.setVisible(false);
item_openobject.setVisible(true); item_openobject.setVisible(true);
item_opengraph.setVisible(true); item_opengraph.setVisible(true);
item_openclassgraph.setVisible(true); item_openclassgraph.setVisible(true);
...@@ -262,10 +288,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -262,10 +288,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
else if ( currentCmn == cmnList.get(0)) { else if ( currentCmn == cmnList.get(0)) {
// Navigator // Navigator
item_close.setVisible(true); item_close.setVisible(true);
item_zoomin.setVisible(true); item_zoomin.setVisible(false);
item_zoomout.setVisible(true); item_zoomout.setVisible(false);
item_pageup.setVisible(true); item_pageup.setVisible(false);
item_pagedown.setVisible(true); item_pagedown.setVisible(false);
item_openobject.setVisible(true); item_openobject.setVisible(true);
item_opengraph.setVisible(true); item_opengraph.setVisible(true);
item_openclassgraph.setVisible(true); item_openclassgraph.setVisible(true);
...@@ -278,10 +304,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -278,10 +304,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
else if ( currentCmn.type() == PlowCmnIfc.TYPE_FLOW) { else if ( currentCmn.type() == PlowCmnIfc.TYPE_FLOW) {
// Plc // Plc
item_close.setVisible(true); item_close.setVisible(true);
item_zoomin.setVisible(true); item_zoomin.setVisible(false);
item_zoomout.setVisible(true); item_zoomout.setVisible(false);
item_pageup.setVisible(true); item_pageup.setVisible(false);
item_pagedown.setVisible(true); item_pagedown.setVisible(false);
item_openobject.setVisible(true); item_openobject.setVisible(true);
item_opengraph.setVisible(true); item_opengraph.setVisible(true);
item_openclassgraph.setVisible(true); item_openclassgraph.setVisible(true);
...@@ -294,8 +320,8 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -294,8 +320,8 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
else if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH) { else if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH) {
// Graph // Graph
item_close.setVisible(true); item_close.setVisible(true);
item_zoomin.setVisible(true); item_zoomin.setVisible(false);
item_zoomout.setVisible(true); item_zoomout.setVisible(false);
item_pageup.setVisible(false); item_pageup.setVisible(false);
item_pagedown.setVisible(false); item_pagedown.setVisible(false);
item_openobject.setVisible(false); item_openobject.setVisible(false);
...@@ -310,8 +336,8 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -310,8 +336,8 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
else if ( currentCmn.type() == PlowCmnIfc.TYPE_OPWIN) { else if ( currentCmn.type() == PlowCmnIfc.TYPE_OPWIN) {
// Operator window // Operator window
item_close.setVisible(true); item_close.setVisible(true);
item_zoomin.setVisible(true); item_zoomin.setVisible(false);
item_zoomout.setVisible(true); item_zoomout.setVisible(false);
item_pageup.setVisible(false); item_pageup.setVisible(false);
item_pagedown.setVisible(false); item_pagedown.setVisible(false);
item_openobject.setVisible(false); item_openobject.setVisible(false);
...@@ -325,10 +351,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -325,10 +351,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
} }
else { else {
// Default // Default
item_pageup.setVisible(true); item_pageup.setVisible(false);
item_zoomin.setVisible(true); item_zoomin.setVisible(false);
item_zoomout.setVisible(true); item_zoomout.setVisible(false);
item_pagedown.setVisible(true); item_pagedown.setVisible(false);
item_openobject.setVisible(true); item_openobject.setVisible(true);
item_opengraph.setVisible(true); item_opengraph.setVisible(true);
item_openclassgraph.setVisible(true); item_openclassgraph.setVisible(true);
...@@ -364,60 +390,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -364,60 +390,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
System.out.println("Page down"); System.out.println("Page down");
break; break;
case R.id.close_option: case R.id.close_option:
switch(currentCmn.type()) { pushCmn();
case PlowCmnIfc.TYPE_PLOW: {
if ( cmnList.size() == 1) {
// Open opwin
if ( opwinCmn != null) {
currentCmn = opwinCmn;
cmnList.add(opwinCmn);
view.invalidate();
}
break;
}
PlowCmn cmn = (PlowCmn)currentCmn;
AXtt axtt = (AXtt)currentCmn.getUserData();
PlowNode o = (PlowNode)cmn.get(0);
AXttItemObject itemo = (AXttItemObject)o.getUserData();
itemo.close(axtt);
currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1);
System.out.println( "cmnList.size() " + cmnList.size());
view.invalidate();
break;
}
case PlowCmnIfc.TYPE_FLOW:
new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_CLOSE, currentCmn));
System.out.println( "cmnList.size() " + cmnList.size());
currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1);
System.out.println( "cmnList.size() " + cmnList.size());
view.invalidate();
System.out.println("Close flow");
break;
case PlowCmnIfc.TYPE_EV:
System.out.println( "cmnList.size() " + cmnList.size());
currentCmn = cmnList.get(cmnList.size()-1);
aev = null;
view.invalidate();
System.out.println("Close ev");
break;
case PlowCmnIfc.TYPE_GRAPH:
new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_CLOSE, currentCmn));
System.out.println( "cmnList.size() " + cmnList.size());
if (graphObject.size() > 0)
graphObject.removeElementAt(graphObject.size()-1);
currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1);
System.out.println( "cmnList.size() " + cmnList.size());
view.invalidate();
System.out.println("Close graph");
break;
case PlowCmnIfc.TYPE_OPWIN:
// Close app ?
break;
}
break; break;
case R.id.openobject_option: { case R.id.openobject_option: {
System.out.println("Open object"); System.out.println("Open object");
...@@ -546,6 +519,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -546,6 +519,10 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
PwrtAttrRef aref = new PwrtAttrRef(((AXttItemObject)baseItem).getObjid()); PwrtAttrRef aref = new PwrtAttrRef(((AXttItemObject)baseItem).getObjid());
new GdhTask().execute(new GdhTaskArg(GdhTask.OPEN_CLASSGRAPH, aref)); new GdhTask().execute(new GdhTaskArg(GdhTask.OPEN_CLASSGRAPH, aref));
} }
else if ( baseItem instanceof AXttItemAttrObject) {
PwrtAttrRef aref = ((AXttItemAttrObject)baseItem).getAttrRef();
new GdhTask().execute(new GdhTaskArg(GdhTask.OPEN_CLASSGRAPH, aref));
}
} }
break; break;
} }
...@@ -637,9 +614,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -637,9 +614,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
} }
if ( aev == null) { if ( aev == null) {
PlowCmnEv cmnAla = new PlowCmnEv(appl, 15D); PlowCmnEv cmnAla = new PlowCmnEv(appl, density * 15);
cmnAla.setGDraw(gdraw); cmnAla.setGDraw(gdraw);
PlowCmnEv cmnEve = new PlowCmnEv(appl, 15D); PlowCmnEv cmnEve = new PlowCmnEv(appl, density * 15);
cmnEve.setGDraw(gdraw); cmnEve.setGDraw(gdraw);
currentCmn = cmnAla; currentCmn = cmnAla;
aev = new AEv(cmnAla, cmnEve, appl); aev = new AEv(cmnAla, cmnEve, appl);
...@@ -661,9 +638,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -661,9 +638,9 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
} }
if ( aev == null) { if ( aev == null) {
PlowCmnEv cmnAla = new PlowCmnEv(appl, 15D); PlowCmnEv cmnAla = new PlowCmnEv(appl, density * 15);
cmnAla.setGDraw(gdraw); cmnAla.setGDraw(gdraw);
PlowCmnEv cmnEve = new PlowCmnEv(appl, 15D); PlowCmnEv cmnEve = new PlowCmnEv(appl, density * 15);
cmnEve.setGDraw(gdraw); cmnEve.setGDraw(gdraw);
currentCmn = cmnEve; currentCmn = cmnEve;
aev = new AEv(cmnAla, cmnEve, appl); aev = new AEv(cmnAla, cmnEve, appl);
...@@ -769,6 +746,36 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -769,6 +746,36 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
break; break;
} }
break; break;
case PlowEvent.TYPE_LONG_CLICK:
if ( e.object == null)
return;
switch(currentCmn.type()) {
case PlowCmnIfc.TYPE_PLOW:
if ( e.inIcon) {
// Open object
System.out.println("Long click event");
AXttItemBase item = (AXttItemBase)((PlowNode)e.object).getUserData();
new GdhTask().execute(new GdhTaskArg(GdhTask.OPEN_ATTRIBUTES, item));
}
else {
// Open plc
System.out.println("Long click event");
AXttItemBase item = (AXttItemBase)((PlowNode)e.object).getUserData();
if ( item instanceof AXttItemObject) {
PwrtObjid oid = ((AXttItemObject)item).getObjid();
new GdhTask().execute(new GdhTaskArg(GdhTask.OPEN_FLOW, oid));
}
}
break;
case PlowCmnIfc.TYPE_EV:
break;
case PlowCmnIfc.TYPE_FLOW:
break;
case PlowCmnIfc.TYPE_OPWIN:
break;
}
break;
case PlowEvent.TYPE_OBJECT_DELETED: { case PlowEvent.TYPE_OBJECT_DELETED: {
AXtt axtt = (AXtt)currentCmn.getUserData(); AXtt axtt = (AXtt)currentCmn.getUserData();
AXttItemBase item = (AXttItemBase)((PlowNode)e.object).getUserData(); AXttItemBase item = (AXttItemBase)((PlowNode)e.object).getUserData();
...@@ -905,7 +912,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -905,7 +912,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
String oName = node.getTraceObject(); String oName = node.getTraceObject();
CdhrObjid oret = gdh.nameToObjid(oName); CdhrObjid oret = gdh.nameToObjid(oName);
PlowCmn cmn = new PlowCmn(appl, 15D); PlowCmn cmn = new PlowCmn(appl, density * 15);
cmn.setGDraw(gdraw); cmn.setGDraw(gdraw);
currentCmn = cmn; currentCmn = cmn;
cmnList.add(cmn); cmnList.add(cmn);
...@@ -976,7 +983,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -976,7 +983,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
String oName = node.getTraceObject(); String oName = node.getTraceObject();
CdhrObjid oret = gdh.nameToObjid(oName); CdhrObjid oret = gdh.nameToObjid(oName);
PlowCmn cmn = new PlowCmn(appl, 15D); PlowCmn cmn = new PlowCmn(appl, density * 15);
cmn.setGDraw(gdraw); cmn.setGDraw(gdraw);
currentCmn = cmn; currentCmn = cmn;
cmnList.add(cmn); cmnList.add(cmn);
...@@ -1173,10 +1180,21 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -1173,10 +1180,21 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
break; break;
} }
case OPWIN: { case OPWIN: {
// If plc window open flow for window, else for first child // Find AppGraph object under WebHandler, search on two hierarchy levels
CdhrObjid oret = gdh.getClassList( Pwrb.cClass_WebHandler); CdhrObjid oret = gdh.getClassList( Pwrb.cClass_WebHandler);
if (oret.oddSts()) { if (oret.oddSts()) {
CdhrString sret = gdh.objidToName(oret.objid, Cdh.mName_volumeStrict);
if ( sret.evenSts()) break;
String appUseWebDir = sret.str + ".AppUseWebDir";
CdhrBoolean bret = gdh.getObjectInfoBoolean(appUseWebDir);
if ( bret.oddSts() && bret.value == true) {
pwr_exe="pwrp_web/";
pwrp_exe="pwrp_web/";
pwrp_load="pwrp_web/";
}
for ( oret = gdh.getChild(oret.objid); oret.oddSts(); oret = gdh.getNextSibling(oret.objid)) { for ( oret = gdh.getChild(oret.objid); oret.oddSts(); oret = gdh.getNextSibling(oret.objid)) {
CdhrClassId cret = gdh.getObjectClass(oret.objid); CdhrClassId cret = gdh.getObjectClass(oret.objid);
if (cret.evenSts()) if (cret.evenSts())
...@@ -1201,7 +1219,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -1201,7 +1219,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
} }
if ( graphList.size() > 0) { if ( graphList.size() > 0) {
opwinCmn = new OpwinCmn(appl, graphList); opwinCmn = new OpwinCmn(appl, graphList, density);
currentCmn = opwinCmn; currentCmn = opwinCmn;
cmnList.add(opwinCmn); cmnList.add(opwinCmn);
} }
...@@ -1240,21 +1258,24 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -1240,21 +1258,24 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
String image = sret.str; String image = sret.str;
if ( image.equals("")) { if ( image.equals("")) {
info.bpm = BitmapFactory.decodeResource(getResources(), R.drawable.graph_icon); info.bpm = BitmapFactory.decodeResource(getResources(), R.drawable.graph_icon);
info.bpmInverted = invertBitmap(info.bpm);
} }
else { else {
URL url = null; URL url = null;
try { try {
if ( image.startsWith("$pwr_exe/")) { 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://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)); url = new URL("http://" + pwrHost + "/" + pwr_exe + image.substring(9));
} }
else { else {
// url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename); // url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename);
url = new URL("http://" + pwrHost + "/pwrp_exe/" + image); url = new URL("http://" + pwrHost + "/" + pwrp_exe + image);
} }
info.bpm = BitmapFactory.decodeStream(url.openConnection().getInputStream()); info.bpm = BitmapFactory.decodeStream(url.openConnection().getInputStream());
info.bpmInverted = invertBitmap(info.bpm);
} catch ( IOException e) { } catch ( IOException e) {
info.bpm = BitmapFactory.decodeResource(getResources(), R.drawable.graph_icon); info.bpm = BitmapFactory.decodeResource(getResources(), R.drawable.graph_icon);
info.bpmInverted = invertBitmap(info.bpm);
System.out.println( "Unable to open file " + image + " " + url); System.out.println( "Unable to open file " + image + " " + url);
} }
} }
...@@ -1319,177 +1340,204 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -1319,177 +1340,204 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
@Override @Override
public boolean onTouchEvent(MotionEvent me) { public boolean onTouchEvent(MotionEvent me) {
if ( me == null) if ( me == null)
return true; return true;
int action = MotionEventCompat.getActionMasked( me); int action = MotionEventCompat.getActionMasked( me);
float x = MotionEventCompat.getX(me, 0); float x = MotionEventCompat.getX(me, 0);
float y = MotionEventCompat.getY(me, 0); float y = MotionEventCompat.getY(me, 0);
boolean isSustained = false; boolean isSustained = false;
boolean sliderActive = false;
if ( lastMotionEvent == me && eventCnt > 0) {
isSustained = true; if ( lastMotionEvent == me && eventCnt > 0) {
x = me.getX(); isSustained = true;
y = me.getY(); x = me.getX();
System.out.println("Sustain motion event: " + eventCnt + " " + lastXSpeed + " " + lastYSpeed); 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()); System.out.println("x,y " + lastMotionEvent.getX() + " " + lastMotionEvent.getY());
eventCnt--; eventMode = MODE_SCROLL;
if ( eventCnt == 0) { eventTimer.schedule( new EventTimerTask(), new Date(System.currentTimeMillis() + 50));
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) { if ( viewOffsetY == 0) {
TypedValue tv = new TypedValue(); if ( context != null) {
context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true); Window window= getWindow();
viewOffsetY = getResources().getDimensionPixelSize(tv.resourceId); viewOffsetY = window.findViewById(Window.ID_ANDROID_CONTENT).getTop();
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); else
viewOffsetY = 56;
switch (action) { }
case MotionEvent.ACTION_MOVE:
if ( isSustained)
System.out.println("Sustained scroll");
if ( eventMode == MODE_SCROLL) {
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, switch (action) {
(MotionEventCompat.getX(me, 0) + MotionEventCompat.getX(me, 1))/2, case MotionEvent.ACTION_MOVE:
(MotionEventCompat.getY(me, 0) + MotionEventCompat.getY(me, 1))/2 + viewOffsetY);
eventDistance = distance;
view.invalidate(); if ( isSustained)
} System.out.println("Sustained scroll");
if ( eventMode == MODE_SCROLL) {
break; if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH &&
case MotionEvent.ACTION_UP: ((GraphCmn)currentCmn).graph.getClickActive() == 1) {
if ( currentCmn != null && currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){ //eventMode = MODE_NO;
System.out.println("Event Up " + action + " (" + x + "," + y + ") cmn " + currentCmn.type()); }
if ( Math.abs(x - downTouchX) < 10 && Math.abs(y - downTouchY) < 10 &&
me.getEventTime() - me.getDownTime() < 700) {
System.out.println("Event Click " + action + " (" + x + "," + y + ") cmn " + currentCmn.type());
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_CLICK, x, y-viewOffsetY)));
}
else {
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_UP, x, y-viewOffsetY)));
}
}
else {
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) { if ( lastTouchId != me.getPointerId(0)) {
System.out.println("ACTION UP, sustained motion event scheduled"); lastTouchX = x;
//lastXSpeed = (downTouchX - x) / (me.getDownTime() - me.getEventTime()); lastTouchY = y;
//lastYSpeed = (downTouchY - y) / (me.getDownTime() - me.getEventTime()); lastTouchId = me.getPointerId(0);
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; break;
case MotionEvent.ACTION_DOWN: }
System.out.println("Event Down " + action + " (" + x + "," + y + ")"); boolean scroll = true;
lastMotionEvent = null; if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH ) {
lastXSpeed = 0; if ( ((GraphCmn)currentCmn).getAppMotion() == Glow.eAppMotion_Slider ||
lastYSpeed = 0; (((GraphCmn)currentCmn).getAppMotion() == Glow.eAppMotion_Both &&
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){ ((GraphCmn)currentCmn).getSliderActive())) {
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER, new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_DOWN, x, y-viewOffsetY))); new GdhEventArg(GraphCmn.ACTION_MOVE, x, y-viewOffsetY)));
scroll = false;
sliderActive = true;
}
}
if ( scroll && !sliderActive) {
System.out.println("Scroll " + x + " " + y);
if ( (int)(lastTouchY - y) != 0) {
currentCmn.scroll((int)(lastTouchX -x), (int)(lastTouchY - y));
view.invalidate();
} }
lastTouchId = me.getPointerId(0);
lastTouchX = x; lastTouchX = x;
lastTouchY = y; lastTouchY = y;
downTouchX = x; lastTouchId = me.getPointerId(0);
downTouchY = y; }
eventMode = MODE_SCROLL; if ( !isSustained && !sliderActive) {
break; if ( lastMotionEvent != null) {
case MotionEvent.ACTION_POINTER_DOWN: lastXSpeed = 0.5 * lastXSpeed + 0.5 * (x - lastMotionEvent.getX()) / (me.getEventTime() - lastMotionEvent.getEventTime());
System.out.println("Event Action Pointer Down"); lastYSpeed = 0.5 * lastYSpeed + 0.5 * (y - lastMotionEvent.getY()) / (me.getEventTime() - lastMotionEvent.getEventTime());
lastMotionEvent = null; }
lastXSpeed = 0; lastMotionEvent = MotionEvent.obtain( me.getDownTime(), me.getEventTime(),
lastYSpeed = 0; me.getAction(), me.getX(), me.getY(),
me.getMetaState());
eventDistance = eventDistance(me); }
if ( eventDistance > 10)
eventMode = MODE_ZOOM;
break;
case MotionEvent.ACTION_POINTER_UP:
System.out.println("Event Action Pointer Up");
eventMode = MODE_SCROLL;
break;
} }
return true; else if ( eventMode == MODE_ZOOM) {
float distance = eventDistance(me);
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH &&
((GraphCmn)currentCmn).getAppMotion() == Glow.eAppMotion_Slider)
currentCmn.zoom(distance/eventDistance);
else
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;
case MotionEvent.ACTION_UP:
if ( currentCmn == null)
break;
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH){
System.out.println("Event Up " + action + " (" + x + "," + y + ") cmn " + currentCmn.type());
if ( Math.abs(x - downTouchX) < 10 && Math.abs(y - downTouchY) < 10 &&
me.getEventTime() - me.getDownTime() < 700) {
System.out.println("Event Click " + action + " (" + x + "," + y + ") cmn " + currentCmn.type());
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_CLICK, x, y-viewOffsetY)));
}
else {
new GdhTask().execute(new GdhTaskArg(GdhTask.EVENTHANDLER,
new GdhEventArg(GraphCmn.ACTION_UP, x, y-viewOffsetY)));
}
}
else if ( currentCmn.type() == PlowCmnIfc.TYPE_OPWIN){
currentCmn.eventHandler(PlowCmnIfc.ACTION_UP, x, y-viewOffsetY);
}
else {
if ( Math.abs(x - downTouchX) < 10 && Math.abs(y - downTouchY) < 10 && currentCmn != null &&
me.getEventTime() - me.getDownTime() > 500) {
currentCmn.eventHandler(PlowCmnIfc.ACTION_LONG_CLICK, x, y-viewOffsetY);
}
else if ( Math.abs(x - downTouchX) < 10 && Math.abs(y - downTouchY) < 10 && currentCmn != null) {
currentCmn.eventHandler(PlowCmnIfc.ACTION_CLICK, x, y-viewOffsetY);
}
}
view.invalidate();
eventMode = MODE_NO;
sliderActive = false;
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("offset : " + viewOffsetY + " (x,y) (" + 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)));
}
else if ( currentCmn.type() == PlowCmnIfc.TYPE_OPWIN) {
currentCmn.eventHandler(PlowCmnIfc.ACTION_DOWN, x, y-viewOffsetY);
view.invalidate();
}
lastTouchId = me.getPointerId(0);
lastTouchX = x;
lastTouchY = y;
downTouchX = x;
downTouchY = y;
eventMode = MODE_SCROLL;
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)
eventMode = MODE_ZOOM;
break;
case MotionEvent.ACTION_POINTER_UP:
System.out.println("Event Action Pointer Up");
eventMode = MODE_SCROLL;
break;
}
return true;
} }
private float eventDistance(MotionEvent me) { private float eventDistance(MotionEvent me) {
float x = MotionEventCompat.getX(me, 0) - MotionEventCompat.getX(me, 1); float x = MotionEventCompat.getX(me, 0) - MotionEventCompat.getX(me, 1);
...@@ -1535,7 +1583,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -1535,7 +1583,7 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
protected void onDraw( Canvas canvas) { protected void onDraw( Canvas canvas) {
if ( currentCmn != null) { if ( currentCmn != null) {
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH) { if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH) {
if ( bitmap == null) { if ( bitmap == null) {
bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888); bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
drawCanvas = new Canvas(bitmap); drawCanvas = new Canvas(bitmap);
...@@ -1546,24 +1594,40 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd ...@@ -1546,24 +1594,40 @@ public class MainActivity extends Activity implements PlowAppl, GraphApplIfc, Gd
drawCanvas.drawColor(graph.cmn.gdraw.getColor(graph.cmn.background_color)); drawCanvas.drawColor(graph.cmn.gdraw.getColor(graph.cmn.background_color));
currentCmn.draw(); currentCmn.draw();
canvas.drawBitmap(bitmap, 0F, 0F, null); canvas.drawBitmap(bitmap, 0F, 0F, null);
} }
else { else {
Canvas c = getHolder().lockCanvas(); Canvas currentCanvas = getHolder().lockCanvas();
if ( c != null) { //if ( currentCanvas == null)
// currentCanvas = getHolder().lockCanvas();
if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH)
c.drawColor(graph.cmn.gdraw.getColor(graph.cmn.background_color)); if ( currentCanvas != null) {
else
c.drawColor(Color.WHITE); if ( currentCmn.type() == PlowCmnIfc.TYPE_GRAPH)
currentCanvas.drawColor(graph.cmn.gdraw.getColor(graph.cmn.background_color));
currentCmn.setCanvas(c); else
currentCmn.draw(); currentCanvas.drawColor(Color.WHITE);
getHolder().unlockCanvasAndPost(c);
} if ( currentCmn.type() == PlowCmnIfc.TYPE_FLOW)
gdraw.setDensity(1, density);
else
gdraw.setDensity(density, density);
currentCmn.setCanvas(currentCanvas);
currentCmn.draw();
/* Test
Paint paint = new Paint();
currentCanvas.drawText( "Density " + density, 10, 100, paint);
*/
getHolder().unlockCanvasAndPost(currentCanvas);
// currentCanvas = getHolder().lockCanvas();
}
} }
} }
}
}
} }
...@@ -1612,8 +1676,8 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -1612,8 +1676,8 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
URL url = null; URL url = null;
try { try {
// url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/common/load/" + filename); // url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/common/load/" + filename);
url = new URL("http://" + pwrHost + "/pwrp_load/" + filename); url = new URL("http://" + pwrHost + "/" + pwrp_load + filename);
reader = new BufferedReader(new InputStreamReader(url.openStream())); reader = new BufferedReader(new InputStreamReader(url.openStream(), "ISO-8859-1"));
} catch ( IOException e) { } catch ( IOException e) {
System.out.println( "Unable to open file " + filename + " " + url); System.out.println( "Unable to open file " + filename + " " + url);
return; return;
...@@ -1627,9 +1691,11 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -1627,9 +1691,11 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
if ( object != null) { if ( object != null) {
FlowNode node = (FlowNode)ctx.getObject(object); FlowNode node = (FlowNode)ctx.getObject(object);
fcmn.select(node); if ( node != null) {
node.setSelect(true); fcmn.select(node);
ctx.centerObject(node); node.setSelect(true);
ctx.centerObject(node);
}
} }
...@@ -1655,13 +1721,13 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -1655,13 +1721,13 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
try { try {
if ( filename.startsWith("$pwr_exe/")) { 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://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)); url = new URL("http://" + pwrHost + "/" + pwr_exe + filename.substring(9));
} }
else { else {
// url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename); // url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename);
url = new URL("http://" + pwrHost + "/pwrp_exe/" + filename); url = new URL("http://" + pwrHost + "/" + pwrp_exe + filename);
} }
reader = new BufferedReader(new InputStreamReader(url.openStream())); reader = new BufferedReader(new InputStreamReader(url.openStream(), "ISO-8859-1"));
} catch ( IOException e) { } catch ( IOException e) {
System.out.println( "Unable to open file " + filename + " " + url); System.out.println( "Unable to open file " + filename + " " + url);
return; return;
...@@ -1747,13 +1813,13 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -1747,13 +1813,13 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
try { try {
if ( filename.startsWith("$pwr_exe/")) { 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://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)); url = new URL("http://" + pwrHost + "/" + pwr_exe + filename.substring(9));
} }
else { else {
// url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename); // url = new URL("http://10.0.2.2/data0/pwrp/opg7/bld/x86_linux/exe/" + filename);
url = new URL("http://" + pwrHost + "/pwrp_exe/" + filename); url = new URL("http://" + pwrHost + "/" + pwrp_exe + filename);
} }
reader = new BufferedReader(new InputStreamReader(url.openStream())); reader = new BufferedReader(new InputStreamReader(url.openStream(), "ISO-8859-1"));
} catch ( IOException e) { } catch ( IOException e) {
System.out.println( "Unable to open file " + filename + " " + url); System.out.println( "Unable to open file " + filename + " " + url);
return null; return null;
...@@ -2007,7 +2073,11 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2007,7 +2073,11 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
graphObject.removeElementAt(graphObject.size()-1); graphObject.removeElementAt(graphObject.size()-1);
currentCmn = cmnList.get(cmnList.size()-2); currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1); cmnList.removeElementAt(cmnList.size()-1);
view.invalidate(); //view.invalidate();
}
public boolean isAuthorized(int access) {
return gdh.isAuthorized(access);
} }
public void invalidateView() { public void invalidateView() {
...@@ -2023,4 +2093,84 @@ System.out.println("MainActivity TimerTask " + currentCmn.type()); ...@@ -2023,4 +2093,84 @@ System.out.println("MainActivity TimerTask " + currentCmn.type());
public PlowCmnIfc getCurrentCmn() { public PlowCmnIfc getCurrentCmn() {
return currentCmn; return currentCmn;
} }
public Bitmap invertBitmap(Bitmap src) {
Bitmap output = Bitmap.createBitmap(src.getWidth(), src.getHeight(), src.getConfig());
int A, R, G, B;
int pixelColor;
int height = src.getHeight();
int width = src.getWidth();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
pixelColor = src.getPixel(x, y);
A = Color.alpha(pixelColor);
R = Math.max( Color.red(pixelColor) - 50, 0);
G = Math.max( Color.green(pixelColor) - 50, 0);
B = Math.max( Color.blue(pixelColor) - 50, 0);
output.setPixel(x, y, Color.argb(A, R, G, B));
}
}
return output;
}
public void pushCmn() {
switch(currentCmn.type()) {
case PlowCmnIfc.TYPE_PLOW: {
if ( cmnList.size() == 1) {
// Open opwin
if ( opwinCmn != null) {
currentCmn = opwinCmn;
cmnList.add(opwinCmn);
view.invalidate();
}
break;
}
PlowCmn cmn = (PlowCmn)currentCmn;
AXtt axtt = (AXtt)currentCmn.getUserData();
PlowNode o = (PlowNode)cmn.get(0);
AXttItemObject itemo = (AXttItemObject)o.getUserData();
itemo.close(axtt);
currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1);
System.out.println( "cmnList.size() " + cmnList.size());
view.invalidate();
break;
}
case PlowCmnIfc.TYPE_FLOW:
new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_CLOSE, currentCmn));
System.out.println( "cmnList.size() " + cmnList.size());
currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1);
System.out.println( "cmnList.size() " + cmnList.size());
view.invalidate();
System.out.println("Close flow");
break;
case PlowCmnIfc.TYPE_EV:
System.out.println( "cmnList.size() " + cmnList.size());
currentCmn = cmnList.get(cmnList.size()-1);
aev = null;
view.invalidate();
System.out.println("Close ev");
break;
case PlowCmnIfc.TYPE_GRAPH:
new GdhTask().execute(new GdhTaskArg(GdhTask.DYNAMIC_CLOSE, currentCmn));
System.out.println( "cmnList.size() " + cmnList.size());
if (graphObject.size() > 0)
graphObject.removeElementAt(graphObject.size()-1);
currentCmn = cmnList.get(cmnList.size()-2);
cmnList.removeElementAt(cmnList.size()-1);
System.out.println( "cmnList.size() " + cmnList.size());
view.invalidate();
System.out.println("Close graph");
break;
case PlowCmnIfc.TYPE_OPWIN:
// Close app ?
break;
}
}
} }
...@@ -591,7 +591,7 @@ public class Dyn { ...@@ -591,7 +591,7 @@ public class Dyn {
public static final int ePwrStatus_Error = 3; public static final int ePwrStatus_Error = 3;
public static final int ePwrStatus_Fatal = 4; public static final int ePwrStatus_Fatal = 4;
public static final boolean debug = false; public static final boolean debug = true;
Vector<DynElem> elements = new Vector<DynElem>(); Vector<DynElem> elements = new Vector<DynElem>();
GraphIfc graph; GraphIfc graph;
...@@ -3174,6 +3174,9 @@ public class Dyn { ...@@ -3174,6 +3174,9 @@ public class Dyn {
} }
public int action( GlowArrayElem object, GlowEvent e) { public int action( GlowArrayElem object, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Click: case Glow.eEvent_MB1Click:
dyn.object = object; dyn.object = object;
...@@ -6361,6 +6364,9 @@ public class Dyn { ...@@ -6361,6 +6364,9 @@ public class Dyn {
} }
public int action( GlowArrayElem object, GlowEvent e) { public int action( GlowArrayElem object, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
object.setColorInverse( 1); object.setColorInverse( 1);
...@@ -6447,6 +6453,9 @@ public class Dyn { ...@@ -6447,6 +6453,9 @@ public class Dyn {
} }
public int action( GlowArrayElem object, GlowEvent e) { public int action( GlowArrayElem object, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
object.setColorInverse( 1); object.setColorInverse( 1);
...@@ -6533,14 +6542,19 @@ public class Dyn { ...@@ -6533,14 +6542,19 @@ public class Dyn {
} }
public int action( GlowArrayElem object, GlowEvent e) { public int action( GlowArrayElem object, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
object.setColorInverse( 1); object.setColorInverse( 1);
dyn.repaintNow = true; dyn.repaintNow = true;
dyn.graph.setClickActive(1);
break; break;
case Glow.eEvent_MB1Up: case Glow.eEvent_MB1Up:
object.setColorInverse( 0); object.setColorInverse( 0);
dyn.repaintNow = true; dyn.repaintNow = true;
dyn.graph.setClickActive( 0);
break; break;
case Glow.eEvent_MB1Click: case Glow.eEvent_MB1Click:
if ( (dyn.action_type1 & Dyn.mActionType1_Confirm) != 0) if ( (dyn.action_type1 & Dyn.mActionType1_Confirm) != 0)
...@@ -6613,6 +6627,9 @@ public class Dyn { ...@@ -6613,6 +6627,9 @@ public class Dyn {
} }
public int action( GlowArrayElem object, GlowEvent e) { public int action( GlowArrayElem object, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: { case Glow.eEvent_MB1Down: {
object.setColorInverse( 1); object.setColorInverse( 1);
...@@ -6632,7 +6649,7 @@ public class Dyn { ...@@ -6632,7 +6649,7 @@ public class Dyn {
break; break;
} }
if ( sts.evenSts()) if ( sts.evenSts())
System.out.println( "SetDig: " + pname.name); System.out.println( "StoDig: " + pname.name);
break; break;
} }
case Glow.eEvent_MB1Up: { case Glow.eEvent_MB1Up: {
...@@ -6710,6 +6727,9 @@ public class Dyn { ...@@ -6710,6 +6727,9 @@ public class Dyn {
} }
public int action( GlowArrayElem object, GlowEvent e) { public int action( GlowArrayElem object, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
object.setColorInverse( 1); object.setColorInverse( 1);
...@@ -6783,6 +6803,9 @@ public class Dyn { ...@@ -6783,6 +6803,9 @@ public class Dyn {
} }
public int action( GlowArrayElem object, GlowEvent e) { public int action( GlowArrayElem object, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
object.setColorInverse( 1); object.setColorInverse( 1);
...@@ -6858,6 +6881,9 @@ public class Dyn { ...@@ -6858,6 +6881,9 @@ public class Dyn {
if ( (dyn.action_type1 & Dyn.mActionType1_Confirm) == 0) if ( (dyn.action_type1 & Dyn.mActionType1_Confirm) == 0)
return 1; return 1;
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
break; break;
...@@ -6926,6 +6952,10 @@ public class Dyn { ...@@ -6926,6 +6952,10 @@ public class Dyn {
public int action( GlowArrayElem o, GlowEvent e) { public int action( GlowArrayElem o, GlowEvent e) {
GrowNode object = (GrowNode)o; GrowNode object = (GrowNode)o;
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
object.setColorInverse( 1); object.setColorInverse( 1);
...@@ -7119,6 +7149,10 @@ public class Dyn { ...@@ -7119,6 +7149,10 @@ public class Dyn {
public int action( GlowArrayElem o, GlowEvent e) { public int action( GlowArrayElem o, GlowEvent e) {
GrowNode object = (GrowNode)o; GrowNode object = (GrowNode)o;
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
object.setColorInverse( 1); object.setColorInverse( 1);
...@@ -7374,6 +7408,9 @@ public class Dyn { ...@@ -7374,6 +7408,9 @@ public class Dyn {
} }
public int action( GlowArrayElem o, GlowEvent e) { public int action( GlowArrayElem o, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
o.setColorInverse( 1); o.setColorInverse( 1);
...@@ -7466,6 +7503,9 @@ public class Dyn { ...@@ -7466,6 +7503,9 @@ public class Dyn {
} }
public int action( GlowArrayElem o, GlowEvent e) { public int action( GlowArrayElem o, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
GrowNode object = (GrowNode)o; GrowNode object = (GrowNode)o;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
...@@ -7602,7 +7642,9 @@ public class Dyn { ...@@ -7602,7 +7642,9 @@ public class Dyn {
} }
public int action( GlowArrayElem o, GlowEvent e) { public int action( GlowArrayElem o, GlowEvent e) {
GrowNode object = (GrowNode)o; if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Down: case Glow.eEvent_MB1Down:
object.setColorInverse( 1); object.setColorInverse( 1);
...@@ -8223,6 +8265,9 @@ public class Dyn { ...@@ -8223,6 +8265,9 @@ public class Dyn {
} }
public int action( GlowArrayElem o, GlowEvent e) { public int action( GlowArrayElem o, GlowEvent e) {
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
GrowNode object = (GrowNode)o; GrowNode object = (GrowNode)o;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Click: case Glow.eEvent_MB1Click:
...@@ -8859,6 +8904,10 @@ public class Dyn { ...@@ -8859,6 +8904,10 @@ public class Dyn {
public int action( GlowArrayElem o, GlowEvent e) { public int action( GlowArrayElem o, GlowEvent e) {
GrowNode object = (GrowNode)o; GrowNode object = (GrowNode)o;
if ( !dyn.graph.isAuthorized( dyn.access))
return 1;
switch ( e.event) { switch ( e.event) {
case Glow.eEvent_MB1Click: case Glow.eEvent_MB1Click:
if ( menu_object != null) { if ( menu_object != null) {
......
...@@ -73,6 +73,7 @@ public class Glow { ...@@ -73,6 +73,7 @@ public class Glow {
public static final int eType_AnnotType = 21; public static final int eType_AnnotType = 21;
public static final int eType_DynType2 = 22; public static final int eType_DynType2 = 22;
public static final int eType_ActionType2 = 23; public static final int eType_ActionType2 = 23;
public static final int eType_AppMotion = 24;
public static final int eCtxType_Glow = 0; public static final int eCtxType_Glow = 0;
public static final int eCtxType_Brow = 1; public static final int eCtxType_Brow = 1;
...@@ -243,6 +244,10 @@ public class Glow { ...@@ -243,6 +244,10 @@ public class Glow {
public static final int eHotIndication_DarkColor = 2; public static final int eHotIndication_DarkColor = 2;
public static final int eHotIndication_LightColor = 3; public static final int eHotIndication_LightColor = 3;
public static final int eAppMotion_Scroll = 0;
public static final int eAppMotion_Slider = 1;
public static final int eAppMotion_Both = 2;
public static final int eDrawType_Line = 0; public static final int eDrawType_Line = 0;
public static final int eDrawType_LineRed = 1; public static final int eDrawType_LineRed = 1;
public static final int eDrawType_LineGray = 2; public static final int eDrawType_LineGray = 2;
...@@ -772,6 +777,7 @@ public class Glow { ...@@ -772,6 +777,7 @@ public class Glow {
public static final int eSave_Ctx_version = 137; public static final int eSave_Ctx_version = 137;
public static final int eSave_Ctx_hot_indication = 138; public static final int eSave_Ctx_hot_indication = 138;
public static final int eSave_Ctx_tiptext_size = 139; public static final int eSave_Ctx_tiptext_size = 139;
public static final int eSave_Ctx_app_motion = 140;
public static final int eSave_Ctx_comment = 199; public static final int eSave_Ctx_comment = 199;
public static final int eSave_Array_a = 200; public static final int eSave_Array_a = 200;
public static final int eSave_NodeClass_nc_name = 300; public static final int eSave_NodeClass_nc_name = 300;
......
...@@ -53,6 +53,7 @@ public class Graph implements GraphIfc, GrowApplIfc { ...@@ -53,6 +53,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
public double scan_time = 1; public double scan_time = 1;
GrowCmn[] cmnStack = new GrowCmn[10]; GrowCmn[] cmnStack = new GrowCmn[10];
int cmnStackCnt = 0; int cmnStackCnt = 0;
int clickActive = 0;
public Graph(GraphApplIfc appl, Gdh gdh) { public Graph(GraphApplIfc appl, Gdh gdh) {
this.appl = appl; this.appl = appl;
...@@ -504,7 +505,7 @@ public class Graph implements GraphIfc, GrowApplIfc { ...@@ -504,7 +505,7 @@ public class Graph implements GraphIfc, GrowApplIfc {
} }
public boolean isAuthorized(int access) { public boolean isAuthorized(int access) {
return true; return appl.isAuthorized(access);
} }
public double getScanTime() { public double getScanTime() {
...@@ -538,4 +539,12 @@ public class Graph implements GraphIfc, GrowApplIfc { ...@@ -538,4 +539,12 @@ public class Graph implements GraphIfc, GrowApplIfc {
ctx = (GrowCtx)cmn.ctx; ctx = (GrowCtx)cmn.ctx;
} }
} }
public void setClickActive(int active) {
clickActive = active;
}
public int getClickActive() {
return clickActive;
}
} }
...@@ -45,4 +45,5 @@ public interface GraphApplIfc { ...@@ -45,4 +45,5 @@ public interface GraphApplIfc {
public String getObject(); public String getObject();
public Object loadGrowCtx( String file); public Object loadGrowCtx( String file);
public void closeGraph(); public void closeGraph();
public boolean isAuthorized(int access);
} }
...@@ -63,4 +63,5 @@ public interface GraphIfc { ...@@ -63,4 +63,5 @@ public interface GraphIfc {
public boolean isAuthorized(int access); public boolean isAuthorized(int access);
public double getScanTime(); public double getScanTime();
public String getCommand(String cmd); public String getCommand(String cmd);
public void setClickActive(int active);
} }
...@@ -99,6 +99,7 @@ public class GrowCmn { ...@@ -99,6 +99,7 @@ public class GrowCmn {
int translate_on; int translate_on;
int input_focus_mark; int input_focus_mark;
int hot_indication; int hot_indication;
int app_motion = Glow.eAppMotion_Both;
Object userdata; Object userdata;
GlowArrayElem callback_object; GlowArrayElem callback_object;
int callback_object_type; int callback_object_type;
...@@ -119,7 +120,7 @@ public class GrowCmn { ...@@ -119,7 +120,7 @@ public class GrowCmn {
public GrowCmn( GrowCtxIfc ctx, GrowApplIfc appl) { public GrowCmn( GrowCtxIfc ctx, GrowApplIfc appl) {
this.ctx = ctx; this.ctx = ctx;
this.appl = appl; this.appl = appl;
this.debug = false; this.debug = true;
this.antiAliasing = true; this.antiAliasing = true;
mw.window_width = getWidth(); mw.window_width = getWidth();
mw.window_height = getHeight(); mw.window_height = getHeight();
...@@ -148,4 +149,7 @@ public class GrowCmn { ...@@ -148,4 +149,7 @@ public class GrowCmn {
public String getOwner() { public String getOwner() {
return owner; return owner;
} }
public int getAppMotion() {
return app_motion;
}
} }
...@@ -140,6 +140,9 @@ public class GrowCtx implements GrowCtxIfc { ...@@ -140,6 +140,9 @@ public class GrowCtx implements GrowCtxIfc {
break; break;
case Glow.eSave_Ctx_tiptext_size: case Glow.eSave_Ctx_tiptext_size:
break; break;
case Glow.eSave_Ctx_app_motion:
cmn.app_motion = Integer.valueOf(token.nextToken());
break;
case Glow.eSave_Ctx_grow: case Glow.eSave_Ctx_grow:
open_grow( reader); open_grow( reader);
grow_loaded = true; grow_loaded = true;
...@@ -826,6 +829,14 @@ public class GrowCtx implements GrowCtxIfc { ...@@ -826,6 +829,14 @@ public class GrowCtx implements GrowCtxIfc {
e.setSource( source, owner); e.setSource( source, owner);
} }
public boolean getSliderActive() {
return sliderActive;
}
public void setSliderActive( boolean active) {
sliderActive = active;
}
} }
......
...@@ -66,4 +66,5 @@ public interface GrowCtxIfc { ...@@ -66,4 +66,5 @@ public interface GrowCtxIfc {
public void traceScan(); public void traceScan();
public boolean traceStarted(); public boolean traceStarted();
public void setSubwindowSource( String name, String source, String owner); public void setSubwindowSource( String name, String source, String owner);
public void setSliderActive( boolean active);
} }
...@@ -198,6 +198,7 @@ public class GrowScrollBar extends GrowRect { ...@@ -198,6 +198,7 @@ public class GrowScrollBar extends GrowRect {
start_pos = fy; start_pos = fy;
start_value = bar_value; start_value = bar_value;
movement_active = 1; movement_active = 1;
cmn.ctx.setSliderActive(true);
} }
break; break;
case Glow.eDir_Horizontal: case Glow.eDir_Horizontal:
...@@ -206,12 +207,14 @@ public class GrowScrollBar extends GrowRect { ...@@ -206,12 +207,14 @@ public class GrowScrollBar extends GrowRect {
start_pos = fx; start_pos = fx;
start_value = bar_value; start_value = bar_value;
movement_active = 1; movement_active = 1;
cmn.ctx.setSliderActive(true);
} }
break; break;
} }
break; break;
case Glow.eEvent_MB1Up: case Glow.eEvent_MB1Up:
movement_active = 0; movement_active = 0;
cmn.ctx.setSliderActive(false);
break; break;
case Glow.eEvent_ButtonMotion: case Glow.eEvent_ButtonMotion:
if ( movement_active != 0) { if ( movement_active != 0) {
......
...@@ -442,9 +442,13 @@ public class GrowWindow extends GrowRect implements GrowScrollBarIfc { ...@@ -442,9 +442,13 @@ public class GrowWindow extends GrowRect implements GrowScrollBarIfc {
} }
v_scrollbar.set_shadow( shadow); v_scrollbar.set_shadow( shadow);
} }
else { else if ( v_scrollbar != null) {
if ( windowCmn != null) 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_value = wctx_y0 * windowCmn.mw.subwindow_scale;
}
} }
if ( horizontal_scrollbar != 0 && h_scrollbar == null) { if ( horizontal_scrollbar != 0 && h_scrollbar == null) {
...@@ -467,9 +471,13 @@ public class GrowWindow extends GrowRect implements GrowScrollBarIfc { ...@@ -467,9 +471,13 @@ public class GrowWindow extends GrowRect implements GrowScrollBarIfc {
} }
h_scrollbar.set_shadow( shadow); h_scrollbar.set_shadow( shadow);
} }
else { else if ( h_scrollbar != null) {
if ( windowCmn != null) 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_value = wctx_x0 * windowCmn.mw.subwindow_scale;
}
} }
} }
......
...@@ -30,6 +30,7 @@ copy : ...@@ -30,6 +30,7 @@ copy :
lib : lib :
exe : $(bld_dir)/control_pwrrt $(bld_dir)/control_pwr $(bld_dir)/control_pwrdemo $(bld_dir)/control_pwrsev exe : $(bld_dir)/control_pwrrt $(bld_dir)/control_pwr $(bld_dir)/control_pwrdemo $(bld_dir)/control_pwrsev
rpi : $(bld_dir)/control_pwrrpi
clean : clean :
...@@ -60,5 +61,10 @@ $(bld_dir)/control_pwrsev : ../../../pwrsev/control ...@@ -60,5 +61,10 @@ $(bld_dir)/control_pwrsev : ../../../pwrsev/control
@ ../../../pwrsev/build.sh @ ../../../pwrsev/build.sh
@ cp $(source) $(target) @ cp $(source) $(target)
$(bld_dir)/control_pwrrpi : ../../../pwrrpi/control
@ echo "build $(target)"
@ ../../../pwrrpi/build.sh
@ cp $(source) $(target)
...@@ -329,6 +329,15 @@ SObject pwrb:Class ...@@ -329,6 +329,15 @@ SObject pwrb:Class
Attr Flags = 0 Attr Flags = 0
EndBody EndBody
EndObject EndObject
!/**
! If AppUseWebDir is set all files used by the Android application is
! read from pwrp_web.
!*/
Object AppUseWebDir $Attribute 42
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
EndObject EndObject
! !
! Template for WebHandler ! Template for WebHandler
......
...@@ -862,6 +862,12 @@ static attrnav_sEnumElement elem_hot_indication[] = { ...@@ -862,6 +862,12 @@ static attrnav_sEnumElement elem_hot_indication[] = {
{ (int) glow_eHotIndication_LightColor, "LightColor"}, { (int) glow_eHotIndication_LightColor, "LightColor"},
{ 0, ""}}; { 0, ""}};
static attrnav_sEnumElement elem_app_motion[] = {
{ (int) glow_eAppMotion_Scroll, "Scroll"},
{ (int) glow_eAppMotion_Slider, "Slider"},
{ (int) glow_eAppMotion_Both, "Both"},
{ 0, ""}};
static attrnav_sEnumElement elem_annot_type[] = { static attrnav_sEnumElement elem_annot_type[] = {
{ (int) glow_eAnnotType_OneLine, "OneLine"}, { (int) glow_eAnnotType_OneLine, "OneLine"},
{ (int) glow_eAnnotType_MultiLine, "MultiLine"}, { (int) glow_eAnnotType_MultiLine, "MultiLine"},
...@@ -995,6 +1001,7 @@ static attrnav_sEnum enum_types[] = { ...@@ -995,6 +1001,7 @@ static attrnav_sEnum enum_types[] = {
{ (int) ge_eAttrType_CurveDataType, (attrnav_sEnumElement *) &elem_curve_datatype}, { (int) ge_eAttrType_CurveDataType, (attrnav_sEnumElement *) &elem_curve_datatype},
{ (int) glow_eType_Gradient, (attrnav_sEnumElement *) &elem_gradient}, { (int) glow_eType_Gradient, (attrnav_sEnumElement *) &elem_gradient},
{ (int) glow_eType_HotIndication, (attrnav_sEnumElement *) &elem_hot_indication}, { (int) glow_eType_HotIndication, (attrnav_sEnumElement *) &elem_hot_indication},
{ (int) glow_eType_AppMotion, (attrnav_sEnumElement *) &elem_app_motion},
{ (int) glow_eType_AnnotType, (attrnav_sEnumElement *) &elem_annot_type}, { (int) glow_eType_AnnotType, (attrnav_sEnumElement *) &elem_annot_type},
{ (int) ge_eAttrType_OptionMenuType, (attrnav_sEnumElement *) &elem_optionmenu_type}, { (int) ge_eAttrType_OptionMenuType, (attrnav_sEnumElement *) &elem_optionmenu_type},
{ 0, NULL}}; { 0, NULL}};
...@@ -1063,6 +1070,7 @@ int attrnav_attr_string_to_value( int type_id, char *value_str, ...@@ -1063,6 +1070,7 @@ int attrnav_attr_string_to_value( int type_id, char *value_str,
case glow_eType_TextSize: case glow_eType_TextSize:
case glow_eType_Gradient: case glow_eType_Gradient:
case glow_eType_HotIndication: case glow_eType_HotIndication:
case glow_eType_AppMotion:
case ge_eAttrType_DynType1: case ge_eAttrType_DynType1:
case ge_eAttrType_DynType2: case ge_eAttrType_DynType2:
case ge_eAttrType_DynTypeTone: case ge_eAttrType_DynTypeTone:
...@@ -1150,6 +1158,7 @@ void attrnav_attrvalue_to_string( int type_id, void *value_ptr, ...@@ -1150,6 +1158,7 @@ void attrnav_attrvalue_to_string( int type_id, void *value_ptr,
case glow_eType_TextSize: case glow_eType_TextSize:
case glow_eType_Gradient: case glow_eType_Gradient:
case glow_eType_HotIndication: case glow_eType_HotIndication:
case glow_eType_AppMotion:
case ge_eAttrType_AnimSequence: case ge_eAttrType_AnimSequence:
case ge_eAttrType_LimitType: case ge_eAttrType_LimitType:
case ge_eAttrType_ScaleType: case ge_eAttrType_ScaleType:
...@@ -2235,6 +2244,7 @@ ItemLocal::ItemLocal( AttrNav *attrnav, const char *item_name, const char *attr, ...@@ -2235,6 +2244,7 @@ ItemLocal::ItemLocal( AttrNav *attrnav, const char *item_name, const char *attr,
case glow_eType_TextSize: case glow_eType_TextSize:
case glow_eType_Gradient: case glow_eType_Gradient:
case glow_eType_HotIndication: case glow_eType_HotIndication:
case glow_eType_AppMotion:
case ge_eAttrType_DynType1: case ge_eAttrType_DynType1:
case ge_eAttrType_DynType2: case ge_eAttrType_DynType2:
case ge_eAttrType_DynTypeTone: case ge_eAttrType_DynTypeTone:
......
...@@ -101,7 +101,8 @@ typedef enum { ...@@ -101,7 +101,8 @@ typedef enum {
glow_eType_HotIndication, //!< Type is glow_eHotIndication glow_eType_HotIndication, //!< Type is glow_eHotIndication
glow_eType_AnnotType, //!< Type is glow_eAnnotType glow_eType_AnnotType, //!< Type is glow_eAnnotType
glow_eType_DynType2, //!< Type of dynamics mask 2 glow_eType_DynType2, //!< Type of dynamics mask 2
glow_eType_ActionType2 //!< Type of action mask 2 glow_eType_ActionType2, //!< Type of action mask 2
glow_eType_AppMotion //!< Type is glow_eAppMotion
} glow_eType; } glow_eType;
//! Type of Ctx class //! Type of Ctx class
...@@ -409,6 +410,13 @@ typedef enum { ...@@ -409,6 +410,13 @@ typedef enum {
glow_eHotIndication_LightColor //!< Lighter color for hot objects glow_eHotIndication_LightColor //!< Lighter color for hot objects
} glow_eHotIndication; } glow_eHotIndication;
//! Action for app motion event
typedef enum {
glow_eAppMotion_Scroll, //!< Scrolling
glow_eAppMotion_Slider, //!< Slider
glow_eAppMotion_Both //!< Both slider and scrolling
} glow_eAppMotion;
//! Color index for a color //! Color index for a color
/*! The drawtype is index in an array that contains the gc for colors in the color palette. /*! The drawtype is index in an array that contains the gc for colors in the color palette.
...@@ -1128,6 +1136,7 @@ typedef enum { ...@@ -1128,6 +1136,7 @@ typedef enum {
glow_eSave_Ctx_version = 137, glow_eSave_Ctx_version = 137,
glow_eSave_Ctx_hot_indication = 138, glow_eSave_Ctx_hot_indication = 138,
glow_eSave_Ctx_tiptext_size = 139, glow_eSave_Ctx_tiptext_size = 139,
glow_eSave_Ctx_app_motion = 140,
glow_eSave_Ctx_comment = 199, glow_eSave_Ctx_comment = 199,
glow_eSave_Array_a = 200, glow_eSave_Array_a = 200,
glow_eSave_NodeClass_nc_name = 300, glow_eSave_NodeClass_nc_name = 300,
......
...@@ -98,7 +98,8 @@ GlowCtx::GlowCtx( const char *ctx_name, double zoom_fact, int offs_x, int offs_y ...@@ -98,7 +98,8 @@ GlowCtx::GlowCtx( const char *ctx_name, double zoom_fact, int offs_x, int offs_y
default_hot_mode(glow_eHotMode_SingleObject), hot_found(0), default_hot_mode(glow_eHotMode_SingleObject), hot_found(0),
userdata_save_callback(0), userdata_open_callback(0), userdata_copy_callback(0), userdata_save_callback(0), userdata_open_callback(0), userdata_copy_callback(0),
version(GLOW_VERSION), inputfocus_object(0), is_component(0), comment(0), version(GLOW_VERSION), inputfocus_object(0), is_component(0), comment(0),
hot_indication(glow_eHotIndication_LightColor), tiptext_size(2), eventlog_callback(0) hot_indication(glow_eHotIndication_LightColor), tiptext_size(2), app_motion(glow_eAppMotion_Both),
eventlog_callback(0)
{ {
strcpy(name, ctx_name); strcpy(name, ctx_name);
memset( (void *)event_callback, 0, sizeof(event_callback)); memset( (void *)event_callback, 0, sizeof(event_callback));
...@@ -214,6 +215,7 @@ int GlowCtx::save( char *filename, glow_eSaveMode mode) ...@@ -214,6 +215,7 @@ int GlowCtx::save( char *filename, glow_eSaveMode mode)
fp << int(glow_eSave_Ctx_version) << FSPACE << version << endl; fp << int(glow_eSave_Ctx_version) << FSPACE << version << endl;
fp << int(glow_eSave_Ctx_hot_indication) << FSPACE << hot_indication << endl; fp << int(glow_eSave_Ctx_hot_indication) << FSPACE << hot_indication << endl;
fp << int(glow_eSave_Ctx_tiptext_size) << FSPACE << tiptext_size << endl; fp << int(glow_eSave_Ctx_tiptext_size) << FSPACE << tiptext_size << endl;
fp << int(glow_eSave_Ctx_app_motion) << FSPACE << app_motion << endl;
if ( ctx_type == glow_eCtxType_Grow) if ( ctx_type == glow_eCtxType_Grow)
{ {
fp << int(glow_eSave_Ctx_grow) << endl; fp << int(glow_eSave_Ctx_grow) << endl;
...@@ -361,6 +363,7 @@ int GlowCtx::open( char *filename, glow_eSaveMode mode) ...@@ -361,6 +363,7 @@ int GlowCtx::open( char *filename, glow_eSaveMode mode)
case glow_eSave_Ctx_version: fp >> version; break; case glow_eSave_Ctx_version: fp >> version; break;
case glow_eSave_Ctx_hot_indication: fp >> tmp; hot_indication = (glow_eHotIndication)tmp; break; case glow_eSave_Ctx_hot_indication: fp >> tmp; hot_indication = (glow_eHotIndication)tmp; break;
case glow_eSave_Ctx_tiptext_size: fp >> tiptext_size; break; case glow_eSave_Ctx_tiptext_size: fp >> tiptext_size; break;
case glow_eSave_Ctx_app_motion: fp >> tmp; app_motion = (glow_eAppMotion)tmp; break;
case glow_eSave_Ctx_grow: case glow_eSave_Ctx_grow:
((GrowCtx *)this)->open_grow( fp); ((GrowCtx *)this)->open_grow( fp);
grow_loaded = 1; grow_loaded = 1;
......
...@@ -847,6 +847,7 @@ class GlowCtx { ...@@ -847,6 +847,7 @@ class GlowCtx {
CtxComment *comment; CtxComment *comment;
glow_eHotIndication hot_indication; //!< Specification of how hots object should be drawn. glow_eHotIndication hot_indication; //!< Specification of how hots object should be drawn.
int tiptext_size; //!< Size of tooltip text int tiptext_size; //!< Size of tooltip text
glow_eAppMotion app_motion; //!< Action for app motion event.
glow_tEventLogCb eventlog_callback; //!< Callback function to log events. glow_tEventLogCb eventlog_callback; //!< Callback function to log events.
static int eventlog_enabled; //!< Event logging enabled. static int eventlog_enabled; //!< Event logging enabled.
......
...@@ -3261,6 +3261,11 @@ int grow_GetGraphAttrInfo( grow_tCtx ctx, grow_sAttrInfo **info, ...@@ -3261,6 +3261,11 @@ int grow_GetGraphAttrInfo( grow_tCtx ctx, grow_sAttrInfo **info,
attrinfo[i].type = glow_eType_TextSize; attrinfo[i].type = glow_eType_TextSize;
attrinfo[i++].size = sizeof( ctx->tiptext_size); attrinfo[i++].size = sizeof( ctx->tiptext_size);
strcpy( attrinfo[i].name, "AppMotion");
attrinfo[i].value_p = &ctx->app_motion;
attrinfo[i].type = glow_eType_AppMotion;
attrinfo[i++].size = sizeof( ctx->app_motion);
attrinfo[i].info_type = grow_eInfoType_End; attrinfo[i].info_type = grow_eInfoType_End;
*attr_cnt = i; *attr_cnt = i;
*info = attrinfo; *info = attrinfo;
......
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