[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gzz/modules/pp PPView2.java
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz/gzz/modules/pp PPView2.java |
Date: |
Tue, 26 Nov 2002 02:48:51 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 02/11/26 02:48:49
Modified files:
gzz/modules/pp : PPView2.java
Log message:
Fast-links and new paper adding works.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPView2.java.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
Patches:
Index: gzz/gzz/modules/pp/PPView2.java
diff -u gzz/gzz/modules/pp/PPView2.java:1.18
gzz/gzz/modules/pp/PPView2.java:1.19
--- gzz/gzz/modules/pp/PPView2.java:1.18 Thu Nov 21 09:30:31 2002
+++ gzz/gzz/modules/pp/PPView2.java Tue Nov 26 02:48:49 2002
@@ -131,6 +131,7 @@
*/
public boolean useStencil = true;
+ private PPActions ppactions;
Space space;
public PPDims d;
@@ -292,11 +293,12 @@
}
}
- public PPView2(Space space, GraphicsAPI.Window w) {
+ public PPView2(Space space, GraphicsAPI.Window w, PPActions ppactions) {
this.space = space;
this.d = new PPDims(space);
this.window = w;
this.coordinatePlaneView = new CoordinatePlaneView(d.contains, d.pan);
+ this.ppactions = ppactions;
}
TextStyle style = GraphicsAPI.getInstance().getTextStyle("Sans", 0, 20);
@@ -347,6 +349,7 @@
mainWidth, mainHeight);
vs.activate(frameCS);
+ // cell to frame CS
int c2fCS = vs.coords.ortho(0, 0, 0, 0, 10, 10);
vs.matcher.addSub(mainctr, c2fCS, "C2F");
@@ -384,32 +387,39 @@
}
} else {
// the left panel
- Cell p = main_vc.getAccursed().h(d.contains).h(d.d1).s(d.d1);
- float x = 0.5f * leftPanelWidth;
// put the "New paper" -text
- TextVob new_button = new TextVob(style, "New paper");
+ TextVob new_button = new TextVob(style, "Uusi paperi");
float scale = style.getScaleByHeight(40);
- int button_cs = vs.orthoCS(0, "NEW_BUTTON", 0, 0, 0,
+ float width = new_button.getWidth(scale);
+ int button_frame = vs.orthoBoxCS(0, "new_button_frame", 0, 0, 0, 1,
1,
+ width, new_button.getHeight(scale) +
new_button.getDepth(scale));
+ int button_cs = vs.scaleCS(button_frame, "new_button_cs",
new_button.getHeight(scale) + new_button.getDepth(scale),
new_button.getHeight(scale) + new_button.getDepth(scale));
+ vs.activate(button_frame);
vs.map.put(new_button, button_cs);
+
+ Cell p = main_vc.getAccursed().h(d.contains).h(d.d1).s(d.d1);
+ float x = 0.5f * leftPanelWidth;
+
for(float y = 1.5f*leftPanelObjectHeight; p != null;
- y += leftPanelObjectHeight) {
+ y += leftPanelObjectHeight) {
int ctr = ((GLVobCoorder)vs.coords).affineCoordsys(0, 0,
- x, y, 1, 0, 0, 1);
+ x, y, 1, 0,
0, 1);
vs.matcher.add(ctr, new Pair(p, null));
int fr = vs.orthoBoxCS(ctr, "frame", 10,
- -leftPanelRealWidth/2, -leftPanelRealHeight/2,
- 1, 1, leftPanelRealWidth, leftPanelRealHeight);
+ -leftPanelRealWidth/2,
-leftPanelRealHeight/2,
+ 1, 1, leftPanelRealWidth,
leftPanelRealHeight);
vs.activate(fr);
int c2f = vs.coords.ortho(0, 0, 0, 0,
- leftPanelZoom, leftPanelZoom);
+ leftPanelZoom, leftPanelZoom);
vs.matcher.addSub(ctr, c2f, "C2F");
+
buoy_vc.setAccursed(p);
buoy_singlePlane.render(vs, fr, c2f);
p = p.s(d.d1);
@@ -432,22 +442,22 @@
}
private void placeLinkbuoy(VobScene vs, Cell otherNote,
- int[] coords, Pair key, int dir) {
+ int[] coords, Pair key, int dir) {
int ctr = ((GLVobCoorder)vs.coords).affineCoordsys(0, 0,
- centerX(vs) + dir * buoyRadius,
- mainY + mainHeight/2 + curlinkY * linkbuoyVPHeight,
- 1, 0, 0, 1);
+ centerX(vs) + dir *
buoyRadius,
+ mainY + mainHeight/2
+ curlinkY * linkbuoyVPHeight,
+ 1, 0, 0, 1);
vs.matcher.add(ctr, key);
int frameCS = vs.orthoBoxCS(ctr, "frame", 10,
- (-linkbuoyVPWidth)/2, -linkbuoyVPHeight/2, 1, 1,
- linkbuoyVPWidth, linkbuoyVPHeight);
+ (-linkbuoyVPWidth)/2, -linkbuoyVPHeight/2,
1, 1,
+ linkbuoyVPWidth, linkbuoyVPHeight);
vs.activate(frameCS);
int c2f = vs.coords.ortho(0, 0,
- -linkbuoyZoom*coords[0], -linkbuoyZoom*coords[1],
- linkbuoyZoom, linkbuoyZoom);
+ -linkbuoyZoom*coords[0],
-linkbuoyZoom*coords[1],
+ linkbuoyZoom, linkbuoyZoom);
vs.matcher.addSub(ctr, c2f, "C2F");
buoy_vc.setAccursed(otherNote);
@@ -469,7 +479,7 @@
/** Set the cursor clicked in the main view.
*/
public void setCursorToMain(VobScene vs, float x, float y,
- AbstractViewContext context, int cs, int vp) {
+ AbstractViewContext context, int cs, int vp) {
float[] hit = new float[2];
int vobcs = vs.coords.getCSAt(cs, x, y, hit);
if(vobcs < 0) {
@@ -537,13 +547,25 @@
pa("No hit "+x+" "+y);
return null;
}
+
if(!"frame".equals(vs.matcher.getKey(cs))) {
- pa("WRONG KEY! "+vs.matcher.getKey(cs));
+ if ("new_button_frame".equals(vs.matcher.getKey(cs)) ) {
+ try {
+ ppactions.newPaper();
+ }
+ catch (Exception e) { pa(e.getMessage()); }
+ } else {
+ pa("WRONG KEY! "+vs.matcher.getKey(cs));
+ }
return null;
}
+
// Get its parent
int vp = ((GLVobCoorder)vs.coords).getParent(cs);
Object key = vs.matcher.getKey(vp);
+
+ pa("pushed key: "+ key +" parent vp: " +vp);
+
if("MAINVP".equals(key)) {
pa("Main viewport");
setCursorToMain(vs, x, y, context, cs, vp);
@@ -556,31 +578,38 @@
Map r = new HashMap();
r.put("MAINVP", p);
r.put(p, "MAINVP");
+
// Now, we have almost all the data.
// But we need to figure out WHICH one of the cells in the Pair
// is the one we are moving to. To do this, we have to look at
// the parent coordinate systems.
-
- int tr12 = ((GLVobCoorder)vs.coords).getBuoyOnCircleAnchor(vp); //
XXX... reverse of BFloater
- pa("tr12: "+tr12);
- pa(" "+vs.matcher.getKey(tr12));
-
- int ausq = ((GLVobCoorder)vs.coords).getParent(tr12);
- pa("ausq: "+ausq);
- pa(" "+vs.matcher.getKey(ausq));
-
- int anchor = ((GLVobCoorder)vs.coords).getParent(ausq);
- pa("anch: "+anchor);
- pa(" "+vs.matcher.getKey(anchor));
- Object cell = vs.matcher.getKey(anchor);
-
- Object n;
- if(cell.equals(p.first)) n = p.second;
- else n = p.first;
- pa("New: "+n);
- ((AbstractViewContext)context).setAccursed((Cell)n);
+ if
("BuoyOnCircle".equals(((GLVobCoorder)vs.coords).getCoordSystemStr(vp))) {
+ int tr12 = ((GLVobCoorder)vs.coords).getBuoyOnCircleAnchor(vp); //
XXX... reverse of BFloater
+ pa("tr12: "+tr12);
+ pa(" "+vs.matcher.getKey(tr12));
+
+ int ausq = ((GLVobCoorder)vs.coords).getParent(tr12);
+ pa("ausq: "+ausq);
+ pa(" "+vs.matcher.getKey(ausq));
+
+ int anchor = ((GLVobCoorder)vs.coords).getParent(ausq);
+ pa("anch: "+anchor);
+ pa(" "+vs.matcher.getKey(anchor));
+ Object cell = vs.matcher.getKey(anchor);
+
+ Object n;
+ if(cell.equals(p.first)) n = p.second;
+ else n = p.first;
+ pa("New: "+n);
+
+ ((AbstractViewContext)context).setAccursed((Cell)n);
+ return r;
+ } else {
+ // Change to paper which has been selected from the left panel.
+ ((AbstractViewContext)context).setAccursed((Cell)p.first);
+ }
return r;
}
}