gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz ./TODO gzz/view/CellContentView.java gzz/vi...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO gzz/view/CellContentView.java gzz/vi...
Date: Tue, 29 Oct 2002 02:30:59 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/10/29 02:30:58

Modified files:
        .              : TODO 
        gzz/view       : CellContentView.java CellHBox.java 
                         CellView.java CellVobFactory.java 
                         FullScreenView.java 
                         LinebrokenCellContentView.java 
                         LollipopCellVobFactory.java MarkDecorator.java 
                         MultitypeCellContentView.java RowColView.java 
                         TextCellContentView.java 
                         VobVanishingClient.java 
        gzz/vob        : TextVob.java 
Added files:
        gzz/view       : CellInBox.java 

Log message:
        Generalizing an API

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.332&tr2=1.333&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellInBox.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellContentView.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellHBox.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellView.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellVobFactory.java.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/FullScreenView.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LinebrokenCellContentView.java.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LollipopCellVobFactory.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/MarkDecorator.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/MultitypeCellContentView.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/RowColView.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/VobVanishingClient.java.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/TextVob.java.diff?tr1=1.43&tr2=1.44&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.332 gzz/TODO:1.333
--- gzz/TODO:1.332      Tue Oct 29 02:13:16 2002
+++ gzz/TODO    Tue Oct 29 02:30:58 2002
@@ -180,6 +180,11 @@
        + clean GzzGL-jni
        + complete "Gzz technologies" white paper
     anybody:
+       - autogenerate the pegboard page from
+         a .rst file and the .rst files of the pegs - currently
+         we need to change several locations.
+         Note the colors in the table: they're very useful (depends
+         only on status).
        + implement PEG 1012
        + implement PEG 1015
        - test/ using pagespanview.ContentView as a CellContentView;
@@ -251,11 +256,6 @@
        - python tests easily runnable one by one
        + remove Media*Stream and other span serialization functionality
           (PEG 1004)
-       - think about autogenerating the pegboard page from
-         a .rst file and the .rst files of the pegs - currently
-         we need to change several locations.
-         Note the colors in the table: they're very useful (depends
-         only on status).
         + the containment mechanism
             + Ted's bindings for it
     tuukkah:
Index: gzz/gzz/view/CellContentView.java
diff -u gzz/gzz/view/CellContentView.java:1.6 
gzz/gzz/view/CellContentView.java:1.7
--- gzz/gzz/view/CellContentView.java:1.6       Mon Oct 14 06:11:12 2002
+++ gzz/gzz/view/CellContentView.java   Tue Oct 29 02:30:58 2002
@@ -32,12 +32,6 @@
  *  (currently CellVobFactory). The same content should be showable
  *  with different kinds of boxes.
  */
-public interface CellContentView {
-String rcsid = "$Id: CellContentView.java,v 1.6 2002/10/14 10:11:12 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.
-     */
-    void place(Cell c, VobScene sc, Box b,
-               ViewContext context, float scale);
+public abstract class CellContentView extends CellInBox {
+public static final String rcsid = "$Id: CellContentView.java,v 1.7 2002/10/29 
07:30:58 tjl Exp $";
 }
Index: gzz/gzz/view/CellHBox.java
diff -u gzz/gzz/view/CellHBox.java:1.7 gzz/gzz/view/CellHBox.java:1.8
--- gzz/gzz/view/CellHBox.java:1.7      Mon Oct 14 06:11:12 2002
+++ gzz/gzz/view/CellHBox.java  Tue Oct 29 02:30:58 2002
@@ -33,22 +33,25 @@
     CellView view;
     ViewContext context;
 
-    static Dimension dim = new Dimension();
+    float w = -1, h = -1;
+
+    static float[] size = new float[2];
 
     public CellHBox(Cell cell, CellView view, ViewContext context) {
         this.cell = cell;
        this.view = view;
        this.context = context;
+       view.getSize(cell, size);
+       w = size[0];
+       h = size[1];
     }
 
     public float getWidth(float scale) {
-        view.getDefaultSize(scale, dim);
-       return dim.width;
+       return scale * w;
     }
 
     public float getHeight(float scale) {
-        view.getDefaultSize(scale, dim);
-       return dim.height;
+       return scale * h;
     }
 
     public float getDepth(float scale) {
Index: gzz/gzz/view/CellView.java
diff -u gzz/gzz/view/CellView.java:1.6 gzz/gzz/view/CellView.java:1.7
--- gzz/gzz/view/CellView.java:1.6      Mon Oct 14 06:11:12 2002
+++ gzz/gzz/view/CellView.java  Tue Oct 29 02:30:58 2002
@@ -23,21 +23,9 @@
 package gzz.view;
 import gzz.*;
 import gzz.vob.*;
-import java.awt.Dimension;
 
 /** A view showing a single cell.
  */
-public interface CellView {
-
-    /** Place a single cell.
-     * @param Box The box into which to
-     *                         place the cell. 
-     */
-    void place(Cell c, VobScene vs, Box b, ViewContext context);
-
-    /** Get the default size of a cell at a given scale.
-     *  Writes the result into a <code>Dimension</code> object.
-     */
-    void getDefaultSize(float scale, Dimension writeInto);
-
+public abstract class CellView extends CellInBox {
+public static final String rcsid = "$Id: CellView.java,v 1.7 2002/10/29 
07:30:58 tjl Exp $";
 }
Index: gzz/gzz/view/CellVobFactory.java
diff -u gzz/gzz/view/CellVobFactory.java:1.24 
gzz/gzz/view/CellVobFactory.java:1.25
--- gzz/gzz/view/CellVobFactory.java:1.24       Wed Oct 16 03:46:39 2002
+++ gzz/gzz/view/CellVobFactory.java    Tue Oct 29 02:30:58 2002
@@ -45,8 +45,8 @@
  * </pre>
  */
 
-public class CellVobFactory implements CellView {
-public static final String rcsid = "$Id: CellVobFactory.java,v 1.24 2002/10/16 
07:46:39 tjl Exp $";
+public class CellVobFactory extends CellView {
+public static final String rcsid = "$Id: CellVobFactory.java,v 1.25 2002/10/29 
07:30:58 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); }
@@ -170,7 +170,7 @@
        contentBox.setSubWH(box, "CO", pad, pad, box.getWidth()-2*pad, 
box.getHeight()-2*pad);
 
        if(!(GraphicsAPI.getInstance() instanceof gzz.client.gl.GLAPI)) {
-           ccv.place(c, v, contentBox, context, 1);
+           ccv.place(c, v, contentBox, context);
             v.map.put(bg, box.getUnitCoordsys());
        } else {
             v.map.put(bg, box.getUnitCoordsys());
@@ -182,7 +182,7 @@
                null,
                null,
                new Runnable() { public void run() {
-                   ccv.place(c, v, contentBox, context, 1);
+                   ccv.place(c, v, contentBox, context);
                }},
                false
            );
Index: gzz/gzz/view/FullScreenView.java
diff -u gzz/gzz/view/FullScreenView.java:1.3 
gzz/gzz/view/FullScreenView.java:1.4
--- gzz/gzz/view/FullScreenView.java:1.3        Mon Oct 14 06:11:12 2002
+++ gzz/gzz/view/FullScreenView.java    Tue Oct 29 02:30:58 2002
@@ -34,6 +34,6 @@
         context.getCellContentView().place(
             context.getAccursed(),
             vs, b,
-            context, 1);
+            context);
     }
 }
Index: gzz/gzz/view/LinebrokenCellContentView.java
diff -u gzz/gzz/view/LinebrokenCellContentView.java:1.11 
gzz/gzz/view/LinebrokenCellContentView.java:1.12
--- gzz/gzz/view/LinebrokenCellContentView.java:1.11    Mon Oct 14 06:11:12 2002
+++ gzz/gzz/view/LinebrokenCellContentView.java Tue Oct 29 02:30:58 2002
@@ -37,8 +37,8 @@
  *  Doesn't scroll, currently.
  */
 
-public class LinebrokenCellContentView implements CellContentView {
-public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.11 
2002/10/14 10:11:12 tjl Exp $";
+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 boolean dbg = false;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
@@ -63,7 +63,8 @@
 
     static Rectangle box = new Rectangle();
     public void place(Cell c, VobScene vs, Box box,
-                      ViewContext context, float scale) {
+                      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);
Index: gzz/gzz/view/LollipopCellVobFactory.java
diff -u gzz/gzz/view/LollipopCellVobFactory.java:1.1 
gzz/gzz/view/LollipopCellVobFactory.java:1.2
--- gzz/gzz/view/LollipopCellVobFactory.java:1.1        Fri Oct 18 05:03:53 2002
+++ gzz/gzz/view/LollipopCellVobFactory.java    Tue Oct 29 02:30:58 2002
@@ -37,7 +37,7 @@
 /** 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.1 
2002/10/18 09:03:53 humppake Exp $";
+public static final String rcsid = "$Id: LollipopCellVobFactory.java,v 1.2 
2002/10/29 07:30:58 tjl Exp $";
 
     /** Add the vobs that make up an image of a cell 
      * into the given coordinate
@@ -97,7 +97,7 @@
                            box.getHeight()-2*pad);
 
        if(!(GraphicsAPI.getInstance() instanceof gzz.client.gl.GLAPI)) {
-           ccv.place(c, v, contentBox, context, 1);
+           ccv.place(c, v, contentBox, context);
             v.map.put(bg, cs);
        } else {
             v.map.put(bg, cs);
@@ -109,7 +109,7 @@
                null,
                null,
                new Runnable() { public void run() {
-                   ccv.place(c, v, contentBox, context, 1);
+                   ccv.place(c, v, contentBox, context);
                }},
                false
            );
Index: gzz/gzz/view/MarkDecorator.java
diff -u gzz/gzz/view/MarkDecorator.java:1.9 gzz/gzz/view/MarkDecorator.java:1.10
--- gzz/gzz/view/MarkDecorator.java:1.9 Sun Oct 27 19:17:54 2002
+++ gzz/gzz/view/MarkDecorator.java     Tue Oct 29 02:30:58 2002
@@ -39,13 +39,14 @@
 
     public void render(VobScene vs, int into, Fallback fallback,
                        Fallback.Win win) {
-        java.awt.Dimension boxsize = new java.awt.Dimension();
-       cv.getDefaultSize(1, boxsize);
+       float[] size = new float[2];
+
+       cv.getSize(null, size);
 
        int n = DefaultBinder.marks.size();
        if(n == 0) return;
 
-       float w = boxsize.width, h = n * boxsize.height;
+       float w = size[0], h = n * size[1];
 
        java.awt.Dimension outer = vs.getSize();
 
@@ -61,8 +62,8 @@
            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*boxsize.height, 1, 1);
-           b.set(vs, cs, boxsize.width, boxsize.height);
+           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);
        }
@@ -70,8 +71,8 @@
        w = style.getWidth(str, 1);
        h = style.getHeight(1);
        y -= h;
-       if(w > boxsize.width)
-           x += boxsize.width - w;
+       if(w > size[0])
+           x += size[0] - w;
 
        int cs = vs.orthoCS(into, TEXT_KEY, 0, x, y, 2, 2);
        vs.map.put(new TextVob(style, str), cs);
Index: gzz/gzz/view/MultitypeCellContentView.java
diff -u gzz/gzz/view/MultitypeCellContentView.java:1.4 
gzz/gzz/view/MultitypeCellContentView.java:1.5
--- gzz/gzz/view/MultitypeCellContentView.java:1.4      Mon Oct 14 06:11:13 2002
+++ gzz/gzz/view/MultitypeCellContentView.java  Tue Oct 29 02:30:58 2002
@@ -28,7 +28,7 @@
 /** A cell content view that uses a text- or pagespan view, dependent
  * on the type of content.
  */
-public class MultitypeCellContentView implements CellContentView {
+public class MultitypeCellContentView extends CellContentView {
     CellContentView textView, pageView;
     
     public MultitypeCellContentView(
@@ -38,14 +38,14 @@
     }
     
     public void place(Cell c, VobScene sc, Box box,
-                      ViewContext context, float scale) {
+                      ViewContext context) {
         VStreamCellTexter tex = (VStreamCellTexter)c.space.getCellTexter();
         Enfilade1D enf = tex.getEnfilade(c, null);
         if(enf.length() == 0) return;
         Object firstSpan = enf.getList().get(0);
         if(firstSpan instanceof PageSpan)
-            pageView.place(c, sc, box, context, scale);
+            pageView.place(c, sc, box, context);
         else
-            textView.place(c, sc, box, context, scale);
+            textView.place(c, sc, box, context);
     }
 }
Index: gzz/gzz/view/RowColView.java
diff -u gzz/gzz/view/RowColView.java:1.8 gzz/gzz/view/RowColView.java:1.9
--- gzz/gzz/view/RowColView.java:1.8    Tue Oct 15 09:29:18 2002
+++ gzz/gzz/view/RowColView.java        Tue Oct 29 02:30:58 2002
@@ -48,8 +48,13 @@
     public void render(VobScene sc, int into, ViewContext context) {
         CellView fact = context.getCellView();
         Dimension size = sc.getSize();
+
         Dimension cellSize = new Dimension();
-        fact.getDefaultSize(1, cellSize);
+
+       float[] foosize = new float[2]; // XXX cleanup
+        fact.getSize(null, foosize);
+       cellSize.width = (int)foosize[0];
+       cellSize.height = (int)foosize[1];
 
         int main, second;
         if(column) { main = 0; second = 1; }
Index: gzz/gzz/view/TextCellContentView.java
diff -u gzz/gzz/view/TextCellContentView.java:1.18 
gzz/gzz/view/TextCellContentView.java:1.19
--- gzz/gzz/view/TextCellContentView.java:1.18  Tue Oct 15 09:29:18 2002
+++ gzz/gzz/view/TextCellContentView.java       Tue Oct 29 02:30:58 2002
@@ -36,8 +36,8 @@
 /** A cell content view showing a cell's text.
  */
 
-public class TextCellContentView implements CellContentView {
-public static final String rcsid = "$Id: TextCellContentView.java,v 1.18 
2002/10/15 13:29:18 tjl Exp $";
+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 boolean dbg = false;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
@@ -52,7 +52,7 @@
     }
 
     public void place(Cell c, VobScene v, Box box,
-                      ViewContext context, float scale) {
+                      ViewContext context) {
        String s = c.t();
         if (s == null) s = "";
         int offs = context.getCursorOffset(c);
@@ -72,6 +72,8 @@
         s = s.substring(brBefore, brAfter);
         offs -= brBefore;
         center -= brBefore;
+
+       float scale = 1; // XXX use getFontSize
 
         float width = style.getWidth(s, scale);
         float left = style.getWidth(s.substring(0, center), scale);
Index: gzz/gzz/view/VobVanishingClient.java
diff -u gzz/gzz/view/VobVanishingClient.java:1.18 
gzz/gzz/view/VobVanishingClient.java:1.19
--- gzz/gzz/view/VobVanishingClient.java:1.18   Tue Oct 15 09:29:18 2002
+++ gzz/gzz/view/VobVanishingClient.java        Tue Oct 29 02:30:58 2002
@@ -102,8 +102,11 @@
     ViewContext context;
     CellView cvf;
 
+    float[] s = new float[2];
     public Object getVobSize(Cell c, float fract, int flags, Dimension outDim) 
{
-       cvf.getDefaultSize(fract, outDim);
+       cvf.getSize(null, fract, s);
+       outDim.width = (int)(s[0] * fract);
+       outDim.height = (int)(s[1] * fract);
        return null;
     }
 
Index: gzz/gzz/vob/TextVob.java
diff -u gzz/gzz/vob/TextVob.java:1.43 gzz/gzz/vob/TextVob.java:1.44
--- gzz/gzz/vob/TextVob.java:1.43       Fri Oct 25 04:20:23 2002
+++ gzz/gzz/vob/TextVob.java    Tue Oct 29 02:30:58 2002
@@ -38,10 +38,13 @@
  * we are in a flexibly scaling world, that size has no bearing
  * on how tall the text in a TextVob will appear: only the height of the 
coordinate
  * system into which the textvob is placed affects that.
+ * <p>
+ * To get text the right way, give an isotropic coordinate system, i.e. one 
that
+ * keeps squares squares.
  * XXX Diagram!
  */
 public class TextVob extends HBox.VobHBox {
-String rcsid = "$Id: TextVob.java,v 1.43 2002/10/25 08:20:23 tjl Exp $";
+String rcsid = "$Id: TextVob.java,v 1.44 2002/10/29 07:30:58 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]