[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gzz/view/Cell1DBuoyHook.java gzz/view/CellH...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz gzz/view/Cell1DBuoyHook.java gzz/view/CellH... |
Date: |
Fri, 01 Nov 2002 14:53:54 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/11/01 14:53:53
Modified files:
gzz/view : Cell1DBuoyHook.java CellHBox.java
CellInBox.java CellInBoxPlugin.java
CellPlacementHook.java CellVobFactory.java
CoordinatePlaneView.java FullScreenView.java
LinebrokenCellContentView.java
LollipopCellVobFactory.java MarkDecorator.java
MultitypeCellContentView.java RowColView.java
TextCellContentView.java
VobVanishingClient.java
gzz/vob : VobScene.java
test/gzz/view : cellvobfactory.test
test/tools : gfx.py
Removed files:
gzz/vob : Box.java
Log message:
Use box all around. If anything broke, it's *YOUR* fault because you
hadn't made a test for it\! ;)
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/Cell1DBuoyHook.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellHBox.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellInBox.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellInBoxPlugin.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellPlacementHook.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellVobFactory.java.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CoordinatePlaneView.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/FullScreenView.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LinebrokenCellContentView.java.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LollipopCellVobFactory.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/MarkDecorator.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/MultitypeCellContentView.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/RowColView.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/VobVanishingClient.java.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/VobScene.java.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/view/cellvobfactory.test.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/tools/gfx.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: gzz/gzz/view/Cell1DBuoyHook.java
diff -u gzz/gzz/view/Cell1DBuoyHook.java:1.3
gzz/gzz/view/Cell1DBuoyHook.java:1.4
--- gzz/gzz/view/Cell1DBuoyHook.java:1.3 Wed Oct 30 14:10:17 2002
+++ gzz/gzz/view/Cell1DBuoyHook.java Fri Nov 1 14:53:52 2002
@@ -31,7 +31,7 @@
* XXX Tjl Doc
*/
public class Cell1DBuoyHook implements CellPlacementHook {
-public static final String rcsid = "$Id: Cell1DBuoyHook.java,v 1.3 2002/10/30
19:10:17 tjl Exp $";
+public static final String rcsid = "$Id: Cell1DBuoyHook.java,v 1.4 2002/11/01
19:53:52 tjl Exp $";
public static boolean dbg = true;
private static void pa(String s) { System.err.println(s); }
@@ -39,11 +39,11 @@
*/
public interface Floater {
/** Create a buoy.
- * @param b The box of the anchor.
+ * @param anchor The (box) coordinate system of the anchor.
* @param c The cell which is the center of the new buoy.
* @param connectedFrom The cell which was placed
*/
- void buoy(Box b, Cell c, Cell connectedFrom);
+ void buoy(int anchor, Cell c, Cell connectedFrom);
}
private Dim d_clone;
@@ -59,7 +59,7 @@
this.d_assoc = d_assoc;
}
- public void placed(Cell c, VobScene sc, Box b, ViewContext context) {
+ public void placed(Cell c, VobScene sc, int box, ViewContext context) {
for(Cell assoc = c; assoc != null;
assoc = assoc.s(d_clone)) {
Cell left = assoc.s(d_assoc, -1);
@@ -67,10 +67,10 @@
if(dbg) pa("BUOYS: LINKS");
if(dbg) pa("left: "+left+" right: "+right);
if(right != null) {
- rightfloater.buoy(b, right.h(d_clone), c);
+ rightfloater.buoy(box, right.h(d_clone), c);
}
if(left != null) {
- leftfloater.buoy(b, left.h(d_clone), c);
+ leftfloater.buoy(box, left.h(d_clone), c);
}
}
Index: gzz/gzz/view/CellHBox.java
diff -u gzz/gzz/view/CellHBox.java:1.8 gzz/gzz/view/CellHBox.java:1.9
--- gzz/gzz/view/CellHBox.java:1.8 Tue Oct 29 02:30:58 2002
+++ gzz/gzz/view/CellHBox.java Fri Nov 1 14:53:52 2002
@@ -64,9 +64,8 @@
public void place(VobScene vs, int coordsys, float scale) {
float w = getWidth(scale), h = getHeight(scale)+getDepth(scale);
- Box b = new Box();
- b.set(vs, coordsys, w, h);
- view.place(cell, vs, b, context);
+ int box = vs.boxCS(coordsys, "HBoxBox", w, h);
+ view.place(cell, vs, box, context);
}
public void setPrev(HBox b) {}
Index: gzz/gzz/view/CellInBox.java
diff -u gzz/gzz/view/CellInBox.java:1.3 gzz/gzz/view/CellInBox.java:1.4
--- gzz/gzz/view/CellInBox.java:1.3 Wed Oct 30 14:10:17 2002
+++ gzz/gzz/view/CellInBox.java Fri Nov 1 14:53:52 2002
@@ -34,12 +34,15 @@
* the default implementations call each other.
*/
public abstract class CellInBox {
-public static final String rcsid = "$Id: CellInBox.java,v 1.3 2002/10/30
19:10:17 tjl Exp $";
+public static final String rcsid = "$Id: CellInBox.java,v 1.4 2002/11/01
19:53:52 tjl Exp $";
/** Place the contents of one cell into the given coord system.
* The coordsys given shall be a mapping from the rectangle
* (0,w)x(0,h) onto the screen.
+ * @param box A coordinate system, into whose "unit square" the cell will
be placed.
+ * Note that some coordinate systems (box,
orthoBox) set their "unit
+ * square" not to be 0..1 x 0..1.
*/
- public abstract void place(Cell c, VobScene vs, Box b,
+ public abstract void place(Cell c, VobScene vs, int box,
ViewContext context);
/** Get the default size of the cell.
Index: gzz/gzz/view/CellInBoxPlugin.java
diff -u gzz/gzz/view/CellInBoxPlugin.java:1.2
gzz/gzz/view/CellInBoxPlugin.java:1.3
--- gzz/gzz/view/CellInBoxPlugin.java:1.2 Tue Oct 29 16:21:25 2002
+++ gzz/gzz/view/CellInBoxPlugin.java Fri Nov 1 14:53:52 2002
@@ -34,10 +34,10 @@
this.sub = sub;
this.hook = hook;
}
- public void place(Cell c, VobScene sc, Box b,
+ public void place(Cell c, VobScene sc, int box,
ViewContext context) {
- sub.place(c, sc, b, context);
- hook.placed(c, sc, b, context);
+ sub.place(c, sc, box, context);
+ hook.placed(c, sc, box, context);
}
public void getSize(Cell c, float[] out) {
sub.getSize(c, out);
Index: gzz/gzz/view/CellPlacementHook.java
diff -u gzz/gzz/view/CellPlacementHook.java:1.2
gzz/gzz/view/CellPlacementHook.java:1.3
--- gzz/gzz/view/CellPlacementHook.java:1.2 Tue Oct 29 16:21:25 2002
+++ gzz/gzz/view/CellPlacementHook.java Fri Nov 1 14:53:52 2002
@@ -28,8 +28,8 @@
/** An interface for code to be run when a cell has been placed in a box.
*/
public interface CellPlacementHook {
-String rcsid = "$Id: CellPlacementHook.java,v 1.2 2002/10/29 21:21:25 benja
Exp $";
+String rcsid = "$Id: CellPlacementHook.java,v 1.3 2002/11/01 19:53:52 tjl Exp
$";
/** A cell was placed.
*/
- void placed(Cell c, VobScene sc, Box b, ViewContext context);
+ void placed(Cell c, VobScene sc, int b, ViewContext context);
}
Index: gzz/gzz/view/CellVobFactory.java
diff -u gzz/gzz/view/CellVobFactory.java:1.27
gzz/gzz/view/CellVobFactory.java:1.28
--- gzz/gzz/view/CellVobFactory.java:1.27 Wed Oct 30 14:10:17 2002
+++ gzz/gzz/view/CellVobFactory.java Fri Nov 1 14:53:52 2002
@@ -46,7 +46,7 @@
*/
public class CellVobFactory extends CellView {
-public static final String rcsid = "$Id: CellVobFactory.java,v 1.27 2002/10/30
19:10:17 tjl Exp $";
+public static final String rcsid = "$Id: CellVobFactory.java,v 1.28 2002/11/01
19:53:52 tjl Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
@@ -119,16 +119,10 @@
static Rectangle rect = new Rectangle();
- /** Add the vobs that make up an image of a cell
- * into the given coordinate
- * system of the given vobscene.
- * @param c The cell
- * @param v The vobscene to add to
- * @param box The box in which the cell should be.
- * @param context The view context, for querying cursors, marks etc.
- */
- public void place(final Cell c, final VobScene v,
- final Box box,
+ float[] boxwh = new float[2];
+
+ public void place(final Cell c, final VobScene vs,
+ final int box,
final ViewContext context) {
setCenter(context.getAccursed());
if(d_clone == null)
@@ -159,24 +153,27 @@
bg.setBg(bg.getBg().darker().darker());
}
- final Box contentBox = new Box();
float pad = 5;
- contentBox.setSubWH(box, "CO", pad, pad, box.getWidth()-2*pad,
box.getHeight()-2*pad);
+
+ vs.coords.getSqSize(box, boxwh);
+ final int contentBox = vs.orthoBoxCS(box, "CONTENT", 0, pad, pad, 1, 1,
+ boxwh[0]-2*pad, boxwh[1]-2*pad);
+ final int unitsq = vs.unitSqCS(box, "UNIT");
if(!(GraphicsAPI.getInstance() instanceof gzz.client.gl.GLAPI)) {
- ccv.place(c, v, contentBox, context);
- v.map.put(bg, box.getUnitCoordsys());
+ ccv.place(c, vs, contentBox, context);
+ vs.map.put(bg, unitsq);
} else {
- v.map.put(bg, box.getUnitCoordsys());
+ vs.map.put(bg, unitsq);
gzz.gfx.gl.Stencil.drawStenciled(
- v,
+ vs,
new Runnable() { public void run() {
- v.map.put(bg, box.getUnitCoordsys());
+ vs.map.put(bg, unitsq);
}},
null,
null,
new Runnable() { public void run() {
- ccv.place(c, v, contentBox, context);
+ ccv.place(c, vs, contentBox, context);
}},
false
);
Index: gzz/gzz/view/CoordinatePlaneView.java
diff -u gzz/gzz/view/CoordinatePlaneView.java:1.1
gzz/gzz/view/CoordinatePlaneView.java:1.2
--- gzz/gzz/view/CoordinatePlaneView.java:1.1 Wed Oct 30 14:10:17 2002
+++ gzz/gzz/view/CoordinatePlaneView.java Fri Nov 1 14:53:52 2002
@@ -12,14 +12,14 @@
*/
public class CoordinatePlaneView implements View {
-public static final String rcsid = "$Id: CoordinatePlaneView.java,v 1.1
2002/10/30 19:10:17 tjl Exp $";
+public static final String rcsid = "$Id: CoordinatePlaneView.java,v 1.2
2002/11/01 19:53:52 tjl Exp $";
public static boolean dbg = true;
private static void pa(String s) { System.err.println(s); }
private Dim d_rank;
private Dim d_coords;
- private Box cursorBox;
+ private int cursorBox;
public CoordinatePlaneView(Dim d_rank, Dim d_coords) {
this.d_rank = d_rank;
@@ -27,15 +27,14 @@
}
/** Get the box into which the cursor cell was placed.
*/
- public Box getCursorBox() { return cursorBox; }
+ public int getCursorBox() { return cursorBox; }
public void render(VobScene vs, int into, ViewContext context) {
Cell cur = context.getAccursed();
Cell item = cur.h(d_rank);
Cell head = item;
- Box b = new Box();
float[] bs = new float[2];
- cursorBox = null;
+ cursorBox = -1;
CellInBox cv = context.getCellView();
while(item != null) { // for every item:
Cell firstCoord = item.s(d_coords, 1);
@@ -43,11 +42,12 @@
if(firstCoord != null) {
int[] place = gzz.client.Params.getInts(firstCoord, d_coords,
2, null);
cv.getSize(item, bs);
- int whc = vs.translateCS(into, item, place[0], place[1]);
- b.set(vs, whc, bs[0], bs[1]);
- cv.place(item, vs, b, context);
+
+ int box = vs.orthoBoxCS(into, item, 0, place[0], place[1], 1,
1, bs[0], bs[1]);
+
+ cv.place(item, vs, box, context);
if(item.equals(cur))
- cursorBox = (Box)b.clone();
+ cursorBox = box;
}
item = item.s(d_rank);
if(head.equals(item)) break;
Index: gzz/gzz/view/FullScreenView.java
diff -u gzz/gzz/view/FullScreenView.java:1.4
gzz/gzz/view/FullScreenView.java:1.5
--- gzz/gzz/view/FullScreenView.java:1.4 Tue Oct 29 02:30:58 2002
+++ gzz/gzz/view/FullScreenView.java Fri Nov 1 14:53:52 2002
@@ -29,11 +29,10 @@
public class FullScreenView implements View {
public void render(VobScene vs, int into, ViewContext context) {
java.awt.Dimension size = vs.getSize();
- Box b = new Box();
- b.set(vs, 0, size.width, size.height);
+ int box = vs.boxCS(0, "FSBox", size.width, size.height);
context.getCellContentView().place(
context.getAccursed(),
- vs, b,
+ vs, box,
context);
}
}
Index: gzz/gzz/view/LinebrokenCellContentView.java
diff -u gzz/gzz/view/LinebrokenCellContentView.java:1.12
gzz/gzz/view/LinebrokenCellContentView.java:1.13
--- gzz/gzz/view/LinebrokenCellContentView.java:1.12 Tue Oct 29 02:30:58 2002
+++ gzz/gzz/view/LinebrokenCellContentView.java Fri Nov 1 14:53:52 2002
@@ -38,7 +38,7 @@
*/
public class LinebrokenCellContentView extends CellContentView {
-public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.12
2002/10/29 07:30:58 tjl Exp $";
+public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.13
2002/11/01 19:53:52 tjl Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
@@ -62,13 +62,15 @@
}
static Rectangle box = new Rectangle();
- public void place(Cell c, VobScene vs, Box box,
+ float[] boxwh = new float[2];
+ public void place(Cell c, VobScene vs, int box,
ViewContext context) {
float scale = 1; // XXX getFontScale (see PEG vobcoorder_fontscale--tjl)
HChain ch = getChain(c, scale);
- if(dbg) pa(""+box.getWidth());
- HBroken br = breaker.breakLines(ch, box.getWidth(), scale);
- br.put(vs, box.getWHCoordsys());
+ vs.coords.getSqSize(box, boxwh);
+ if(dbg) pa(""+boxwh[0]);
+ HBroken br = breaker.breakLines(ch, boxwh[0], scale);
+ br.put(vs, box);
}
protected HChain getChain(Cell c, float scale) {
Index: gzz/gzz/view/LollipopCellVobFactory.java
diff -u gzz/gzz/view/LollipopCellVobFactory.java:1.3
gzz/gzz/view/LollipopCellVobFactory.java:1.4
--- gzz/gzz/view/LollipopCellVobFactory.java:1.3 Wed Oct 30 14:10:17 2002
+++ gzz/gzz/view/LollipopCellVobFactory.java Fri Nov 1 14:53:52 2002
@@ -37,7 +37,8 @@
/** A factory for making ball-and-stick aka lollipop cell vobs. */
public class LollipopCellVobFactory extends CellVobFactory {
-public static final String rcsid = "$Id: LollipopCellVobFactory.java,v 1.3
2002/10/30 19:10:17 tjl Exp $";
+public static final String rcsid = "$Id: LollipopCellVobFactory.java,v 1.4
2002/11/01 19:53:52 tjl Exp $";
+ float[] boxwh = new float[2];
/** Add the vobs that make up an image of a cell
* into the given coordinate
@@ -47,8 +48,8 @@
* @param box The box in which the cell should be.
* @param context The view context, for querying cursors, marks etc.
*/
- public void place(final Cell c, final VobScene v,
- final Box box,
+ public void place(final Cell c, final VobScene vs,
+ final int box,
final ViewContext context) {
setCenter(context.getAccursed());
if(d_clone == null)
@@ -80,36 +81,39 @@
bg.setBg(bg.getBg().darker().darker());
}
- final Box contentBox = new Box();
float pad = 5;
+ vs.coords.getSqSize(box, boxwh);
+
/** Coordsys to make OvalBgVob look circle and at
* right place of cell's Box. Currently "right place"
* is in the middle.
*/
- final int cs = v.orthoCS(box.getWHCoordsys(), "cs", 0,
- box.getWidth()/2-box.getHeight()/2, 0,
- box.getHeight(), box.getHeight());
+ final int cs = vs.orthoCS(box, "cs", 0,
+ boxwh[0]/2-boxwh[1]/2, 0,
+ boxwh[1], boxwh[1]);
+
/** Cell's content will be drawn next to OvalBgVob */
- contentBox.setSubWH(box, "CO", box.getWidth()/2+box.getHeight()/2+pad,
pad,
- box.getWidth()-2*pad,
- box.getHeight()-2*pad);
+ final int contentBox = vs.orthoBoxCS(box, "CO", 0,
+ boxwh[0]/2+boxwh[1]/2+pad, pad, 1, 1,
+ boxwh[0]-2*pad,
+ boxwh[1]-2*pad);
if(!(GraphicsAPI.getInstance() instanceof gzz.client.gl.GLAPI)) {
- ccv.place(c, v, contentBox, context);
- v.map.put(bg, cs);
+ ccv.place(c, vs, contentBox, context);
+ vs.map.put(bg, cs);
} else {
- v.map.put(bg, cs);
+ vs.map.put(bg, cs);
gzz.gfx.gl.Stencil.drawStenciled(
- v,
+ vs,
new Runnable() { public void run() {
- v.map.put(bg, cs);
+ vs.map.put(bg, cs);
}},
null,
null,
new Runnable() { public void run() {
- ccv.place(c, v, contentBox, context);
+ ccv.place(c, vs, contentBox, context);
}},
false
);
Index: gzz/gzz/view/MarkDecorator.java
diff -u gzz/gzz/view/MarkDecorator.java:1.10
gzz/gzz/view/MarkDecorator.java:1.11
--- gzz/gzz/view/MarkDecorator.java:1.10 Tue Oct 29 02:30:58 2002
+++ gzz/gzz/view/MarkDecorator.java Fri Nov 1 14:53:52 2002
@@ -55,17 +55,13 @@
int cs_list = vs.orthoCS(into, KEY, 0, x, y, 2, 2);
- Box b = new Box();
-
for(int i=0; i<n; i++) {
Mark m = (Mark)DefaultBinder.marks.get(i);
if(m.spans != null) return; // for now-- should show span(s)
Cell c = m.cell;
- int cs = vs.orthoCS(cs_list, c, 0, 0, i*w, 1, 1);
- b.set(vs, cs, w, h);
-
- cv.place(c, vs, b, win);
+ int box = vs.orthoBoxCS(cs_list, c, 0, 0, i*w, 1, 1, w, h);
+ cv.place(c, vs, box, win);
}
w = style.getWidth(str, 1);
Index: gzz/gzz/view/MultitypeCellContentView.java
diff -u gzz/gzz/view/MultitypeCellContentView.java:1.5
gzz/gzz/view/MultitypeCellContentView.java:1.6
--- gzz/gzz/view/MultitypeCellContentView.java:1.5 Tue Oct 29 02:30:58 2002
+++ gzz/gzz/view/MultitypeCellContentView.java Fri Nov 1 14:53:52 2002
@@ -37,7 +37,7 @@
this.pageView = pageView;
}
- public void place(Cell c, VobScene sc, Box box,
+ public void place(Cell c, VobScene sc, int box,
ViewContext context) {
VStreamCellTexter tex = (VStreamCellTexter)c.space.getCellTexter();
Enfilade1D enf = tex.getEnfilade(c, null);
Index: gzz/gzz/view/RowColView.java
diff -u gzz/gzz/view/RowColView.java:1.10 gzz/gzz/view/RowColView.java:1.11
--- gzz/gzz/view/RowColView.java:1.10 Wed Oct 30 14:10:17 2002
+++ gzz/gzz/view/RowColView.java Fri Nov 1 14:53:52 2002
@@ -90,17 +90,16 @@
int k[] = new int[2];
for(k[main]=0; k[main] < n[main]; k[main]++)
for(k[second]=0; k[second] < n[second]; k[second]++) {
- cs[k[main]][k[second]] = sc.orthoCS(
+ cs[k[main]][k[second]] = sc.orthoBoxCS(
into, grid[k[main]][k[second]], 0,
- xoffs + k[0]*xroom, yoffs + k[1]*yroom, 2, 2);
+ xoffs + k[0]*xroom, yoffs + k[1]*yroom, 1, 1,
+ cellSize.width, cellSize.height);
}
- Box b = new Box();
for(int i=0; i<n[main]; i++)
for(int j=0; j<n[second]; j++)
if(grid[i][j] != null) {
- b.set(sc, cs[i][j], cellSize.width, cellSize.height);
- fact.place(grid[i][j], sc, b, context);
+ fact.place(grid[i][j], sc, cs[i][j], context);
}
Vob conn[] = new Vob[] {
Index: gzz/gzz/view/TextCellContentView.java
diff -u gzz/gzz/view/TextCellContentView.java:1.19
gzz/gzz/view/TextCellContentView.java:1.20
--- gzz/gzz/view/TextCellContentView.java:1.19 Tue Oct 29 02:30:58 2002
+++ gzz/gzz/view/TextCellContentView.java Fri Nov 1 14:53:52 2002
@@ -37,7 +37,7 @@
*/
public class TextCellContentView extends CellContentView {
-public static final String rcsid = "$Id: TextCellContentView.java,v 1.19
2002/10/29 07:30:58 tjl Exp $";
+public static final String rcsid = "$Id: TextCellContentView.java,v 1.20
2002/11/01 19:53:52 tjl Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
@@ -51,7 +51,8 @@
this.style = style;
}
- public void place(Cell c, VobScene v, Box box,
+ float[] boxwh = new float[2];
+ public void place(Cell c, VobScene vs, int box,
ViewContext context) {
String s = c.t();
if (s == null) s = "";
@@ -79,19 +80,20 @@
float left = style.getWidth(s.substring(0, center), scale);
float right = width - left;
- float middle = box.getWidth() / 2.0f;
+ vs.coords.getSqSize(box, boxwh);
+ float middle = boxwh[0] / 2.0f;
// Possibly offset text so cursor is visible.
float textOffset;
- if(width < box.getWidth()) textOffset = 0;
+ if(width < boxwh[0]) textOffset = 0;
else if(left < middle) textOffset = 0;
- else if(right < middle) textOffset = (- width + box.getWidth());
+ else if(right < middle) textOffset = (- width + boxwh[0]);
else textOffset = (- left + middle);
Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);
- int offsetcs = v.orthoCS(box.getWHCoordsys(), key, 0, textOffset, 0,
1, 1);
+ int offsetcs = vs.orthoCS(box, key, 0, textOffset, 0, 1, 1);
- placeVob(c, v, offsetcs, box.getWidth(), box.getHeight(), brBefore,
brAfter, offs, context, scale);
+ placeVob(c, vs, offsetcs, boxwh[0], boxwh[1], brBefore, brAfter, offs,
context, scale);
}
static Object WH_KEY = new Object();
Index: gzz/gzz/view/VobVanishingClient.java
diff -u gzz/gzz/view/VobVanishingClient.java:1.20
gzz/gzz/view/VobVanishingClient.java:1.21
--- gzz/gzz/view/VobVanishingClient.java:1.20 Wed Oct 30 14:10:17 2002
+++ gzz/gzz/view/VobVanishingClient.java Fri Nov 1 14:53:52 2002
@@ -115,25 +115,28 @@
public void place(Cell c, Object o, float fract, int x0, int y0, int x1,
int y1,
int depth, float rot) {
Vob v = (Vob)o;
- int cs = into.orthoCS(intoCS, c, depth, x0, y0, fract, fract);
- Box b = new Box();
- b.set(into, cs, (x1-x0)/fract, (y1-y0)/fract);
- cell2Box.put(c, b);
- cvf.place(c, into, b, context);
+ int box = into.orthoBoxCS(intoCS, c, depth, x0, y0, fract, fract,
+ (x1-x0)/fract, (y1-y0)/fract);
+ cell2Box.put(c, new Integer(box));
+ cvf.place(c, into, box, context);
}
+ private int iv(Integer i) {
+ if(i == null) return -1;
+ return i.intValue();
+ }
public void connect(Cell cell1, Cell cell2, int dx, int dy) {
- Box b1 = (Box)cell2Box.get(cell1);
- Box b2 = (Box)cell2Box.get(cell2);
+ int b1 = iv((Integer)cell2Box.get(cell1));
+ int b2 = iv((Integer)cell2Box.get(cell2));
- if(b1 == null && b2 == null)
+ if(b1 == -1 && b2 == -1)
throw new Error("Neither cell seems to have been put, yet");
- else if(b2 == null)
- into.map.put(pstubs[dx], b1.getUnitCoordsys());
- else if(b1 == null)
- into.map.put(nstubs[dx], b2.getUnitCoordsys());
+ else if(b2 == -1)
+ into.map.put(pstubs[dx], b1);
+ else if(b1 == -1)
+ into.map.put(nstubs[dx], b2);
else
- into.map.put(connections[dx][dy], b1.getUnitCoordsys(),
b2.getUnitCoordsys());
+ into.map.put(connections[dx][dy], b1, b2);
}
}
Index: gzz/gzz/vob/VobScene.java
diff -u gzz/gzz/vob/VobScene.java:1.13 gzz/gzz/vob/VobScene.java:1.14
--- gzz/gzz/vob/VobScene.java:1.13 Wed Oct 30 14:10:17 2002
+++ gzz/gzz/vob/VobScene.java Fri Nov 1 14:53:53 2002
@@ -89,6 +89,16 @@
return matcher.addSub(into, af().scale(into, sx, sy, sz), key);
}
+ public int unitSqCS(int into, Object key) {
+ return matcher.addSub(into, coords.unitSq(into), key);
+ }
+ public int boxCS(int into, Object key, float w, float h) {
+ return matcher.addSub(into, coords.box(into, w, h), key);
+ }
+ public int orthoBoxCS(int into, Object key, float d, float x, float y,
float sx, float sy, float w, float h) {
+ return matcher.addSub(into, coords.orthoBox(into, d, x, y, sx, sy, w,
h), key);
+ }
+
/** Determines size of the area designated for the <code>Vob</code>s.
* At least at the moment doesn't include margins.
* Coordinates of the scene's
Index: gzz/test/gzz/view/cellvobfactory.test
diff -u gzz/test/gzz/view/cellvobfactory.test:1.3
gzz/test/gzz/view/cellvobfactory.test:1.4
--- gzz/test/gzz/view/cellvobfactory.test:1.3 Wed Oct 16 03:46:39 2002
+++ gzz/test/gzz/view/cellvobfactory.test Fri Nov 1 14:53:53 2002
@@ -50,13 +50,11 @@
# Finally, should check edge color!
-def testSingle__failing_solidbgvob():
+def testSingle_solidbgvob():
vs = getvs()
vs.map.put(SolidBgVob(Color.blue))
- box = Box()
- orth = vs.orthoCS(0, "A", 0, 100, 100, 1, 1)
- box.set(vs, orth, 200, 50)
+ box = vs.orthoBoxCS(0, "A", 0, 100, 100, 1, 1, 200, 50)
cvf = CellVobFactory()
context = VC()
@@ -67,7 +65,7 @@
checkbox(100, 100, 200, 50, (255,255,255))
# Check that setting the coordsys params works
- vs.coords.setOrthoParams(orth, 0, 150, 200, .5, .5)
+ vs.coords.setOrthoBoxParams(box, 0, 150, 200, .5, .5, 200, 50)
render(vs)
checkbox(150, 200, 100, 25, (255, 255, 255))
@@ -76,7 +74,7 @@
vs.map.put(SolidBgVob(Color.blue))
parent = vs.orthoCS(0, "A", 0, 120, 60, 2, 2)
child = vs.orthoCS(parent, "B", 0, 20, 30, .25, .25)
- box.set(vs, child, 200, 50)
+ box = vs.boxCS(child, "C", 200, 50)
cvf.place(cell, vs, box, context)
render(vs)
checkbox(160, 120, 100, 25, (255, 255, 255))
Index: gzz/test/tools/gfx.py
diff -u gzz/test/tools/gfx.py:1.8 gzz/test/tools/gfx.py:1.9
--- gzz/test/tools/gfx.py:1.8 Wed Oct 30 14:10:17 2002
+++ gzz/test/tools/gfx.py Fri Nov 1 14:53:53 2002
@@ -93,4 +93,4 @@
print "CBCF getsize",args
def place(self, cell, vs, box, context):
print "Place: ", box
- vs.map.put(self.bgv, box.getUnitCoordsys())
+ vs.map.put(self.bgv, vs.unitSqCS(box, "U"))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz gzz/view/Cell1DBuoyHook.java gzz/view/CellH...,
Tuomas J. Lukka <=