[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] fenfire/org/fenfire/view buoy/AbstractMainNode2...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] fenfire/org/fenfire/view buoy/AbstractMainNode2... |
Date: |
Mon, 09 Jun 2003 15:03:15 -0400 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Branch:
Changes by: Benja Fallenstein <address@hidden> 03/06/09 15:03:14
Modified files:
org/fenfire/view/buoy: AbstractMainNode2D.java
FisheyeMainNode2D.java MainNode2D.java
org/fenfire/view/lava: FenPDFContext.java
Log message:
New focus architecture for FenPDF/View2D, where Focus
is an interface with a simplistic impl that just
stores panX / panY. This allows for more sophisticated
impls that can store e.g. a focused node on a paper.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/MainNode2D.java.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/lava/FenPDFContext.java.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
Patches:
Index: fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java
diff -u fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java:1.18
fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java:1.19
--- fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java:1.18 Sun Jun 8
08:22:10 2003
+++ fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java Mon Jun 9
15:03:13 2003
@@ -23,18 +23,43 @@
protected Object plane;
public Object getPlane() { return plane; }
+ /** An object representing a focus on a 2D plane.
+ * The SimpleFocus implementation below just stores
+ * an X and Y coordinate, but other implementations
+ * could store e.g. an accursed node on the plane.
+ */
+ public interface Focus {
+ float getPanX();
+ float getPanY();
+ void setPan(float panX, float panY);
+ }
+
+ public static class SimpleFocus implements Focus {
+ protected float panX, panY;
+ public SimpleFocus(float panX, float panY) {
+ this.panX = panX;
+ this.panY = panY;
+ }
+ public float getPanX() { return panX; }
+ public float getPanY() { return panY; }
+ public void setPan(float panX, float panY) {
+ this.panX = panX;
+ this.panY = panY;
+ }
+ }
+
/** The view shown in this buoy node.
*/
protected View2D view2d;
public View2D getView2D() { return view2d; }
- protected float panX, panY;
- public float getPanX() { return panX; }
- public float getPanY() { return panY; }
+ protected Focus focus;
+ public Focus getFocus() { return focus; }
+ public void setFocus(Focus f) { this.focus = focus; }
public interface Factory {
AbstractMainNode2D create(Object plane, View2D view2d,
- float panx, float pany);
+ float panX, float panY);
}
@@ -52,9 +77,9 @@
protected float boxw, boxh;
public AbstractMainNode2D(Object plane, View2D view2d,
- float panX, float panY) {
+ Focus focus) {
this.plane = plane; this.view2d = view2d;
- this.panX = panX; this.panY = panY;
+ this.focus = focus;
}
@@ -87,10 +112,18 @@
protected void clipPan() {
view2d.getSize(plane, v2dwh);
if(v2dwh[0] >= 0) {
- if(panX < 0) panX = 0;
- if(panX > v2dwh[0]) panX = v2dwh[0];
- if(panY < 0) panY = 0;
- if(panY > v2dwh[1]) panY = v2dwh[1];
+ float panX = focus.getPanX(), panY = focus.getPanY();
+ boolean chg = false;
+ if(focus.getPanX() < 0) { panX = 0; chg = true; }
+ if(focus.getPanX() > v2dwh[0]) {
+ panX = v2dwh[0]; chg = true;
+ }
+ if(focus.getPanY() < 0) { panY = 0; chg = true; }
+ if(focus.getPanY() > v2dwh[1]) {
+ panY = v2dwh[1];
+ chg = true;
+ }
+ if(chg) focus.setPan(panX, panY);
}
}
@@ -132,7 +165,7 @@
oldVobScene.coords.transformPoints3(box2paper, pt, pt);
if(dbg) p("P3: "+pt[0]+" "+pt[1]+" "+pt[2]);
- panX = pt[0]; panY = pt[1];
+ focus.setPan(pt[0], pt[1]);
clipPan();
AbstractUpdateManager.chg();
@@ -149,7 +182,7 @@
protected void readMouseState(MouseEvent e, VobScene oldVobScene) {
m_state = new int[]{ e.getX(), e.getY(), e.getModifiers()};
- pan[0] = panX; pan[1] = panY;
+ pan[0] = focus.getPanX(); pan[1] = focus.getPanY();
m_pos[0] = m_state[0]; m_pos[1] = m_state[1]; m_pos[2] = 0;
oldVobScene.coords.inverseTransformPoints3(box2screen, m_pos, m_pos);
}
@@ -182,8 +215,8 @@
float[] pos2 = new float[] { e.getX(), e.getY(), 0 };
oldVobScene.coords.inverseTransformPoints3(box2screen, pos2, pos2);
- panX = pan[0] + (m_pos[0] - pos2[0])/getZoom();
- panY = pan[1] + (m_pos[1] - pos2[1])/getZoom();
+ focus.setPan(pan[0] + (m_pos[0] - pos2[0])/getZoom(),
+ pan[1] + (m_pos[1] - pos2[1])/getZoom());
clipPan();
setZoomPan(oldVobScene, box2screen);
Index: fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java
diff -u fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java:1.5
fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java:1.6
--- fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java:1.5 Fri May 16
04:52:53 2003
+++ fenfire/org/fenfire/view/buoy/FisheyeMainNode2D.java Mon Jun 9
15:03:13 2003
@@ -20,8 +20,9 @@
static public class FisheyeMainNode2DFactory implements Factory {
public float zoom;
public AbstractMainNode2D create(Object plane, View2D view2d,
- float panx, float pany) {
- return new FisheyeMainNode2D(plane, view2d, panx, pany);
+ float panx, float pany) {
+ return new FisheyeMainNode2D(plane, view2d,
+ new SimpleFocus(panx, pany));
}
}
@@ -30,13 +31,14 @@
/** Create a main node with a given plane, pan.
*/
public FisheyeMainNode2D(Object plane, View2D view2d,
- float panX, float panY) {
- super(plane, view2d, panX, panY);
+ Focus focus) {
+ super(plane, view2d, focus);
}
protected void setZoomPan(VobScene vs, int mainFrame) {
- vs.coords.setTranslateParams(box2paper, panX, panY);
+ vs.coords.setTranslateParams(box2paper,
+ focus.getPanX(), focus.getPanY());
fisheyeState.setCoordsysParams();
}
@@ -48,7 +50,8 @@
int ctr = vs.translateCS(into, "FTR", boxw/2, boxh/2);
int fish = fisheyeState.getCoordsys(vs, ctr, "FISH");
- int translate = vs.coords.translate(0, panX, panY);
+ int translate = vs.coords.translate(0, focus.getPanX(),
+ focus.getPanY());
vs.matcher.add(fish, translate, "BOX2PAPER");
Index: fenfire/org/fenfire/view/buoy/MainNode2D.java
diff -u fenfire/org/fenfire/view/buoy/MainNode2D.java:1.23
fenfire/org/fenfire/view/buoy/MainNode2D.java:1.24
--- fenfire/org/fenfire/view/buoy/MainNode2D.java:1.23 Sun Jun 8 08:22:11 2003
+++ fenfire/org/fenfire/view/buoy/MainNode2D.java Mon Jun 9 15:03:13 2003
@@ -51,27 +51,27 @@
this.zoom = zoom;
}
public AbstractMainNode2D create(Object plane, View2D view2d,
- float panx, float pany) {
- return new MainNode2D(plane, view2d, panx, pany, zoom);
+ float panx, float pany) {
+ return new MainNode2D(plane, view2d,
+ new SimpleFocus(panx, pany), zoom);
}
}
/** Create a main node with a given plane, pan, and zoom.
*/
public MainNode2D(Object plane, View2D view2d,
- float panX, float panY, float zoom) {
- super(plane, view2d, panX, panY);
+ Focus focus, float zoom) {
+ super(plane, view2d, focus);
this.zoom = zoom;
}
/** Create a main node focused the center of a given plane.
*/
public MainNode2D(Object plane, View2D view2d) {
- this(plane, view2d, 0, 0, 1);
+ this(plane, view2d, new SimpleFocus(0, 0), 1);
view2d.getSize(plane, tmp);
if(tmp[0] >= 0) {
- panX = tmp[0] / 2f;
- panY = tmp[1] / 2f;
+ focus.setPan(tmp[0] / 2f, tmp[1] / 2f);
}
}
@@ -91,7 +91,7 @@
protected void setZoomPan(VobScene vs, int mainFrame) {
vs.coords.setOrthoBoxParams(box2paper, 0,
- panX-boxw/zoom/2, panY-boxh/zoom/2,
+ focus.getPanX()-boxw/zoom/2,
focus.getPanY()-boxh/zoom/2,
1/zoom, 1/zoom, boxw, boxh);
}
Index: fenfire/org/fenfire/view/lava/FenPDFContext.java
diff -u fenfire/org/fenfire/view/lava/FenPDFContext.java:1.29
fenfire/org/fenfire/view/lava/FenPDFContext.java:1.30
--- fenfire/org/fenfire/view/lava/FenPDFContext.java:1.29 Sun Jun 8
07:21:00 2003
+++ fenfire/org/fenfire/view/lava/FenPDFContext.java Mon Jun 9 15:03:13 2003
@@ -225,7 +225,8 @@
p("sc: "+sc+" foo: " + sc.getID());
// mainNodes[1] can never hold articles, can't put there
mainNodes[0]= new
- FisheyeMainNode2D(sc, new PageScrollView2D(), 0,0);
+ FisheyeMainNode2D(sc, new PageScrollView2D(),
+ new AbstractMainNode2D.SimpleFocus(0,0));
return mainNodes;
}
else if (key.equals("LINK")) {
@@ -234,7 +235,7 @@
else if (key.equals("NEW_PAPER")) {
String paper = ppAct.newPaper();
mainNodes[CURR] = new MainNode2D(Nodes.get(paper),
- ppView, 0,0,1);
+ ppView, new
MainNode2D.SimpleFocus(0,0),1);
return mainNodes;
}
else if (key.equals("SAVE")) {
@@ -281,12 +282,13 @@
if (fen.graph.find1_11X(plane, RDF.type) ==
CANVAS2D.Canvas) {
mainNodes[i] = new MainNode2D(plane,
- ppView, 0,0,1);
+ ppView, new
MainNode2D.SimpleFocus(0,0),1);
p("mainNode");
} else {
mainNodes[i] = new
FisheyeMainNode2D(plane,
- new PageScrollView2D(), 0,0);
+ new PageScrollView2D(),
+ new AbstractMainNode2D.SimpleFocus(0,0));
p("fishNode");
}
i++;
@@ -373,8 +375,8 @@
else if (stroke.length() == 1) {
if (accursed[CURR]==null) {
String paper = Nodes.toString(main.getPlane());
- String note = ppAct.newNote(paper, (int)main.getPanX(),
- (int)main.getPanY(), "");
+ String note = ppAct.newNote(paper,
(int)main.getFocus().getPanX(),
+ (int)main.getFocus().getPanY(), "");
cursorOffset[CURR] = 0;
accursed[CURR] = Nodes.get(note);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] fenfire/org/fenfire/view buoy/AbstractMainNode2...,
Benja Fallenstein <=