gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gzz view/DimDecorator.java view/LastOpDecor...


From: Asko Soukka
Subject: [Gzz-commits] gzz/gzz view/DimDecorator.java view/LastOpDecor...
Date: Thu, 21 Nov 2002 22:55:21 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Asko Soukka <address@hidden>    02/11/21 22:55:20

Modified files:
        gzz/view       : DimDecorator.java LastOpDecorator.java 
                         LollipopCellView.java MarkDecorator.java 
        gzz/vob/linebreaking: HBox.java HBroken.java 
        gzz/vob/vobs   : TextVob.java 

Log message:
        gfx/demo/viewtest

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/DimDecorator.java.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LastOpDecorator.java.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LollipopCellView.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/MarkDecorator.java.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/linebreaking/HBox.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/linebreaking/HBroken.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/TextVob.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gzz/gzz/view/DimDecorator.java
diff -u gzz/gzz/view/DimDecorator.java:1.15 gzz/gzz/view/DimDecorator.java:1.16
--- gzz/gzz/view/DimDecorator.java:1.15 Mon Nov 18 05:28:16 2002
+++ gzz/gzz/view/DimDecorator.java      Thu Nov 21 22:55:20 2002
@@ -34,7 +34,7 @@
  *  vob scene.
  */
 public class DimDecorator implements FallbackSceneDecorator {
-String rcsid = "$Id: DimDecorator.java,v 1.15 2002/11/18 10:28:16 humppake Exp 
$";
+String rcsid = "$Id: DimDecorator.java,v 1.16 2002/11/22 03:55:20 humppake Exp 
$";
     public static boolean dbg = true;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
@@ -65,13 +65,13 @@
        float w = size[0], h = size[1];
 
        // The coordinate system where the lines start
-       int orig = sc.orthoCS(into, origKey, 0, 0, 0, 2, 2);
+       int orig = sc.orthoCS(into, origKey, 0, 0, 0, 1, 1);
 
        // The coordinate systems of the dimensions
        int[] targ = {
-           sc.orthoCS(into, dimKeys[0], 0, w, 0, 2, 2),
-           sc.orthoCS(into, dimKeys[1], 0, 0, h, 2, 2),
-           sc.orthoCS(into, dimKeys[2], 0, w, h, 2, 2)
+           sc.translateCS(into, dimKeys[0], w, 0),
+           sc.translateCS(into, dimKeys[1], 0, h),
+           sc.translateCS(into, dimKeys[2], w, h)
        };
 
        for(int i=0; i<3; i++) {
@@ -79,10 +79,8 @@
             int cs_box = sc.orthoCS(targ[i], boxKey, 1, 0, 0, w, h);
            sc.map.put(bg, cs_box);
             
-           int cs = sc.orthoCS(targ[i], dimKeys[i], 0, 5, 5, 2, 2);
-            int cs_wh = sc.coords.ortho(0, 0, 0, 0, w-10, h-10);
-            ((DefaultVobMatcher)sc.matcher).addSub(cs, cs_wh, whKey);
-           sc.map.put(new TextVob(style, dims[i].name), cs, cs_wh);
+           int cs = sc.orthoCS(targ[i], dimKeys[i], 0, 5, 5, h-10, h-10);
+           sc.map.put(new TextVob(style, dims[i].name), cs);
        }
 
         View view = fallback.viewList[win.viewIndex];
@@ -92,10 +90,8 @@
             sc.coords.getRenderInfo(into).getExtRect(rect);
             float vw = style.getWidth(name, 1.6f), vh = style.getHeight(1.6f);
             float vx = rect.width - vw - 10;
-            int cs = sc.orthoCS(into, viewKey, 0, vx, 10, 2, 2);
-            int cs_wh = sc.coords.ortho(0, 0, 0, 0, vw, vh);
-            ((DefaultVobMatcher)sc.matcher).addSub(cs, cs_wh, whKey);
-            sc.map.put(new TextVob(style, name), cs, cs_wh);
+            int cs = sc.orthoCS(into, viewKey, 0, vx, 10, vh, vh);
+            sc.map.put(new TextVob(style, name), cs);
         }
     }
 }
Index: gzz/gzz/view/LastOpDecorator.java
diff -u gzz/gzz/view/LastOpDecorator.java:1.22 
gzz/gzz/view/LastOpDecorator.java:1.23
--- gzz/gzz/view/LastOpDecorator.java:1.22      Mon Nov 18 05:28:16 2002
+++ gzz/gzz/view/LastOpDecorator.java   Thu Nov 21 22:55:20 2002
@@ -34,7 +34,7 @@
  *  directional op entered.
  */
 public class LastOpDecorator implements FallbackSceneDecorator {
-String rcsid = "$Id: LastOpDecorator.java,v 1.22 2002/11/18 10:28:16 humppake 
Exp $";
+String rcsid = "$Id: LastOpDecorator.java,v 1.23 2002/11/22 03:55:20 humppake 
Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -123,7 +123,7 @@
        float x = padding;
        float y = size.height - padding - h;
 
-       int cs = sc.orthoCS(into, key, 0, x, y, 2, 2);
+       int cs = sc.orthoBoxCS(into, key, 0, x, y, 1, 1, w, h);
 
        br.put(sc, cs);
 
Index: gzz/gzz/view/LollipopCellView.java
diff -u gzz/gzz/view/LollipopCellView.java:1.2 
gzz/gzz/view/LollipopCellView.java:1.3
--- gzz/gzz/view/LollipopCellView.java:1.2      Mon Nov 18 10:40:49 2002
+++ gzz/gzz/view/LollipopCellView.java  Thu Nov 21 22:55:20 2002
@@ -38,7 +38,7 @@
 /** A factory for making ball-and-stick aka lollipop cell vobs. */
 
 public class LollipopCellView extends BoxCellView {
-public static final String rcsid = "$Id: LollipopCellView.java,v 1.2 
2002/11/18 15:40:49 humppake Exp $";
+public static final String rcsid = "$Id: LollipopCellView.java,v 1.3 
2002/11/22 03:55:20 humppake Exp $";
     float[] boxwh = new float[2];
 
     /** Add the vobs that make up an image of a cell 
@@ -82,32 +82,17 @@
            bg.setBg(bg.getBg().darker().darker());
        }
 
+
        float pad = 5;
-       /** XXX scaling somethign after TextStyle is propably deprecated.
-        *
-        * But think about LollipopCellview with LinebrokenContentCellView.
-        * With multiline cells the ball can't be sized after cell's box.
-        * Most reasonable would be that the ball's size is some how related
-        * with the font's height. In other words Ball should point only
-        * the first line of the content
-        *
-        * Better would be that there is another coordinate system for ball,
-        * but it should be explicitly created already by someone, who can
-        * control eg. the font size. And LollipopCellView should still work
-        * with all the other views...
-        *
-        * Hmm... easisiest would be, if the box's on unit on y-axel means
-        * height of one text row. Then ball's diameter would be simple 1.
-        */
-       //float diameter =  style.getHeight(1)+2*pad;
-       float diameter = 20;
+
        vs.coords.getSqSize(box, boxwh);
+       float diameter = 15; // XXX
 
        /** Cell's content will be drawn next to OvalBgVob */
        final int contentBox = vs.orthoBoxCS(box, "content", 0,
-                                            diameter+pad, pad, 1, 1,
-                                            boxwh[0]-2*pad,
-                                            boxwh[1]-2*pad);
+                                            diameter + pad, pad*0.25f, 1, 1,
+                                            boxwh[0] - (diameter + pad),
+                                            boxwh[1] - 2*pad);
 
        /** Coordsys to make OvalBgVob look circle and at 
         * right place of cell's Box. Currently "right place"
Index: gzz/gzz/view/MarkDecorator.java
diff -u gzz/gzz/view/MarkDecorator.java:1.13 
gzz/gzz/view/MarkDecorator.java:1.14
--- gzz/gzz/view/MarkDecorator.java:1.13        Mon Nov 18 05:28:16 2002
+++ gzz/gzz/view/MarkDecorator.java     Thu Nov 21 22:55:20 2002
@@ -53,16 +53,17 @@
        java.awt.Dimension outer = vs.getSize();
 
        float x = outer.width - w - PAD,
-             y = outer.height - h - PAD;
+             y = outer.height - h - PAD * n;
 
-       int cs_list = vs.orthoCS(into, KEY, 0, x, y, 2, 2);
+       int cs_list = vs.orthoBoxCS(into, KEY, 0, x, y, 1, 1, w, h);
 
         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 box = vs.orthoBoxCS(cs_list, c, 0, 0, i*w, 1, 1, w, h);
+           /*      int box = vs.orthoBoxCS(cs_list, c, 0, 0, i*w, 1, 1, w, h); 
*/
+           int box = vs.orthoBoxCS(cs_list, c, 0, 0, i*(h/n+PAD), 1, 1, w, 
h/n); 
             cv.place(c, vs, box, win);
        }
 
@@ -72,7 +73,7 @@
        if(w > size[0])
            x += size[0] - w;
 
-       int cs = vs.orthoCS(into, TEXT_KEY, 0, x, y, 2, 2);
+       int cs = vs.orthoCS(into, TEXT_KEY, 0, x, y, h, h);
        vs.map.put(new TextVob(style, str), cs);
     }
 }
Index: gzz/gzz/vob/linebreaking/HBox.java
diff -u gzz/gzz/vob/linebreaking/HBox.java:1.1 
gzz/gzz/vob/linebreaking/HBox.java:1.2
--- gzz/gzz/vob/linebreaking/HBox.java:1.1      Fri Nov  1 20:23:46 2002
+++ gzz/gzz/vob/linebreaking/HBox.java  Thu Nov 21 22:55:20 2002
@@ -33,7 +33,7 @@
  */
 
 public interface HBox {
-String rcsid = "$Id: HBox.java,v 1.1 2002/11/02 01:23:46 benja Exp $";
+String rcsid = "$Id: HBox.java,v 1.2 2002/11/22 03:55:20 humppake Exp $";
 
     float getWidth(float scale);
 
@@ -90,13 +90,17 @@
        protected float scale = 0;
        public float getScale() { return scale; }
 
-       public void place(VobScene vs, int coordsys, float scale) {
+       public void place(VobScene vs, int box, float scale) {
            this.scale = scale;
-            float w = getWidth(scale), h = getHeight(scale)+getDepth(scale);
-            int cs_wh = vs.coords.ortho(0, 0, 0, 0, w, h);
-            ((DefaultVobMatcher)vs.matcher).addSub(coordsys, cs_wh, WH_KEY);
-            
-           vs.map.put(this, coordsys, cs_wh);
+           /*
+             float [] boxwh = new float[2];
+             vs.coords.getSqSize(box, boxwh);
+             float h = boxwh[1];
+           */
+           
+           float h = getHeight(scale)+getDepth(scale);
+           int cs_box = vs.scaleCS(box, "textbox", h, h);
+           vs.map.put(this, cs_box);
        }
        public Object getKey() { return null; /* XXX */ }
 
Index: gzz/gzz/vob/linebreaking/HBroken.java
diff -u gzz/gzz/vob/linebreaking/HBroken.java:1.1 
gzz/gzz/vob/linebreaking/HBroken.java:1.2
--- gzz/gzz/vob/linebreaking/HBroken.java:1.1   Fri Nov  1 20:23:46 2002
+++ gzz/gzz/vob/linebreaking/HBroken.java       Thu Nov 21 22:55:20 2002
@@ -55,6 +55,12 @@
     }
 
     public void put(VobScene vs, int coordsys) {
+       /*
+         float [] boxwh = new float[2];
+         vs.coords.getSqSize(coordsys, boxwh);
+         float w = boxwh[0], h = boxwh[1];
+       */
+
         int x = 0, y = 0;
 
         for(int i=0; i<=length; i++) {
@@ -73,8 +79,9 @@
            for(int j=from; j<to; j++) {
                HBox box = chain.getBox(j);
                Object key = box.getKey();
-
-               int cs = vs.orthoCS(coordsys, key, 0, x, y, 2, 2);
+               
+               /* int cs = vs.orthoBoxCS(coordsys, key, 0, x, y, 1, 1, w, h); 
*/
+               int cs = vs.orthoCS(coordsys, key, 0, x, y, 1, 1);
                box.place(vs, cs, scale);
 
                x += box.getWidth(scale);
Index: gzz/gzz/vob/vobs/TextVob.java
diff -u gzz/gzz/vob/vobs/TextVob.java:1.3 gzz/gzz/vob/vobs/TextVob.java:1.4
--- gzz/gzz/vob/vobs/TextVob.java:1.3   Thu Nov 21 15:55:59 2002
+++ gzz/gzz/vob/vobs/TextVob.java       Thu Nov 21 22:55:20 2002
@@ -48,7 +48,7 @@
  * XXX Diagram!
  */
 public class TextVob extends HBox.VobHBox {
-String rcsid = "$Id: TextVob.java,v 1.3 2002/11/21 20:55:59 humppake Exp $";
+String rcsid = "$Id: TextVob.java,v 1.4 2002/11/22 03:55:20 humppake Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -108,24 +108,25 @@
 
         info1.getExtRect(rect);
         float x = rect.x, y = rect.y;
-        info2.getExtRect(rect);
         float w = rect.width, h = rect.height;
 
+       /* info2.getExtRect(rect); */
+
        Shape oldClip = g.getClip();
        /*g.clipRect(rect.x, rect.y,
                       rect.width,
                      rect.height + 3);*/
-       // float scale = style.getScaleByHeight(h-3); // Why h-3?
+       /*  float scale = style.getScaleByHeight(h-3); // Why h-3? */
 
        float scale = style.getScaleByHeight(h);
-        if(dbg) pa("Render @ scale " + scale + ": '"+text+"' "+x+" "+y+" "+w+" 
"+h);
+        if(dbg) pa("Render @ scale " + scale + ": '"+text+"' 
"+getWidth(scale)+" "+y+" "+w+" "+h);
 
        float fasc = style.getAscent(scale);
        float fdsc = style.getDescent(scale);
        float fh = fasc + fdsc;
        float ty = y + h/2 + fasc/2;
         
-        if(dbg) g.drawRect((int)x, (int)y, (int)w, (int)h);
+        if(dbg) g.drawRect((int)x, (int)y, (int)getWidth(scale), (int)h);
 
        ((AWTTextStyle)style).render(g, (int)x, (int)ty, text, scale, null);
 
@@ -171,8 +172,8 @@
      */
     private Vob ht;
     public int addToListGL(GraphicsAPI.Window win,
-                       int[] list, int curs, int coordsys1,
-                               int coordsys2) {
+                          int[] list, int curs, int coordsys1,
+                          int coordsys2) {
        if(dbg) pa("Addtolistgl text "+text);
        if(ht == null) {
            GLTextStyle gls = (GLTextStyle)style;




reply via email to

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