gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz gzz/vob/HBox.java gzz/vob/LineCursor.java g...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz gzz/vob/HBox.java gzz/vob/LineCursor.java g...
Date: Sat, 21 Sep 2002 09:04:57 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      02/09/21 09:04:56

Modified files:
        gzz/vob        : HBox.java LineCursor.java LinebreakingUtil.java 
                         TextVob.java 
        gzz/vob/buoy   : BuoyAnchor.java 
        test/gzz/vob   : BenchLBChain.java TestLBChain.java 
Removed files:
        test/gzz/client/awt: TestTextSpanVob.java 

Log message:
        Give HBox a routine to place itself into a coordsys, instead of the
        current approach of returning a vob. This allows to place more than
        one vob, and even sub-coordsys, into the coordsys. This is something
        we want to do (for example, to place a cell-- with a border around it
        and all-- into some linebroken text).

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/HBox.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/LineCursor.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/LinebreakingUtil.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/TextVob.java.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/buoy/BuoyAnchor.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/vob/BenchLBChain.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/vob/TestLBChain.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text

Patches:
Index: gzz/gzz/vob/HBox.java
diff -c gzz/gzz/vob/HBox.java:1.4 gzz/gzz/vob/HBox.java:1.5
*** gzz/gzz/vob/HBox.java:1.4   Mon Aug 26 04:08:55 2002
--- gzz/gzz/vob/HBox.java       Sat Sep 21 09:04:56 2002
***************
*** 1,6 ****
  /*
  HBox.java
!  *    
   *    Copyright (c) 2000-2001, Ted Nelson and Tuomas Lukka
   *
   *    You may use and distribute under the terms of either the GNU Lesser
--- 1,6 ----
  /*
  HBox.java
!  *
   *    Copyright (c) 2000-2001, Ted Nelson and Tuomas Lukka
   *
   *    You may use and distribute under the terms of either the GNU Lesser
***************
*** 8,14 ****
   *    at your choice, any later version. Alternatively, you may use and
   *    distribute under the terms of the XPL.
   *
!  *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of 
   *    the licenses.
   *
   *    This software is distributed in the hope that it will be useful,
--- 8,14 ----
   *    at your choice, any later version. Alternatively, you may use and
   *    distribute under the terms of the XPL.
   *
!  *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
   *    the licenses.
   *
   *    This software is distributed in the hope that it will be useful,
***************
*** 23,36 ****
  package gzz.vob;
  import java.util.*;
  
! /** An interface for linebreaking. A box knows how wide it is at
!  * different scales.
   * <p>
!  * As for ScalableFont, the "normal" size is scale=1000.
   */
  
  public interface HBox {
! String rcsid = "$Id: HBox.java,v 1.4 2002/08/26 08:08:55 tjl Exp $";
  
      float getWidth(float scale);
  
--- 23,37 ----
  package gzz.vob;
  import java.util.*;
  
! /** A box that knows its size at different scales.
!  * Used for linebreaking with billowing, where we need to layout
!  * pieces at different sizes depending on which line they fall on.
   * <p>
!  * The "normal" size is scale=1.
   */
  
  public interface HBox {
! String rcsid = "$Id: HBox.java,v 1.5 2002/09/21 13:04:56 benja Exp $";
  
      float getWidth(float scale);
  
***************
*** 42,68 ****
       */
      float getDepth(float scale);
  
!     /** Return a vob for the contents of this box at the given scale.
!      * This function <strong>may</strong> change 
!      * this HBox and return:
       * the following is a legal implementation:
       * <pre>
       *        public class FooBox extends Vob implements HBox {
!      *                int scale;
       *        ...
       *        ...
!      *                public Vob getVob(int scale) {
       *                        this.scale = scale;
!      *                        return this;
       *                }
       *  }
       * </pre>
       */
!     Vob getVob(float scale);
  
!     /** Get the key for this vob.
!      * XXX WHAT is the meaning of key?
!      */
      Object getKey();
  
      /** Set the preceding HBox.
--- 43,67 ----
       */
      float getDepth(float scale);
  
!     /** Place the contents of this box into a given coordsys.
!      * This function <strong>may</strong> change
!      * this HBox and place it into the coordsys:
       * the following is a legal implementation:
       * <pre>
       *        public class FooBox extends Vob implements HBox {
!      *                float scale;
       *        ...
       *        ...
!      *                public void place(VobScene vs, int cs, float scale) {
       *                        this.scale = scale;
!      *                        vs.map.put(this, cs);
       *                }
       *  }
       * </pre>
       */
!     void place(VobScene vs, int coordsys, float scale);
  
!     /** The key for this HBox. XXX */
      Object getKey();
  
      /** Set the preceding HBox.
***************
*** 75,81 ****
        public float getWidth(float scale) { return 0; }
        public float getHeight(float scale) { return 0; }
        public float getDepth(float scale) { return 0; }
!       public Vob getVob(float scale) { return null; }
        public Object getKey() { return null; }
        public void setPrev(HBox b) { }
      }
--- 74,80 ----
        public float getWidth(float scale) { return 0; }
        public float getHeight(float scale) { return 0; }
        public float getDepth(float scale) { return 0; }
!       public void place(VobScene vs, int cs, float scale) {}
        public Object getKey() { return null; }
        public void setPrev(HBox b) { }
      }
***************
*** 87,95 ****
        protected float scale = 0;
        public float getScale() { return scale; }
  
!       public Vob getVob(float scale) {
            this.scale = scale;
!           return this;
        }
        public Object getKey() { return null; /* XXX */ }
  
--- 86,94 ----
        protected float scale = 0;
        public float getScale() { return scale; }
  
!       public void place(VobScene vs, int cs, float scale) {
            this.scale = scale;
!           vs.map.put(this, cs);
        }
        public Object getKey() { return null; /* XXX */ }
  
Index: gzz/gzz/vob/LineCursor.java
diff -c gzz/gzz/vob/LineCursor.java:1.5 gzz/gzz/vob/LineCursor.java:1.6
*** gzz/gzz/vob/LineCursor.java:1.5     Thu Aug 15 17:05:29 2002
--- gzz/gzz/vob/LineCursor.java Sat Sep 21 09:04:56 2002
***************
*** 1,6 ****
  /*
  CharArrayVob.java
!  *    
   *    Copyright (c) 2001, Ted Nelson and Tuomas Lukka
   *    Copyright (c) 2001, Benja Fallenstein
   *
--- 1,6 ----
  /*
  CharArrayVob.java
!  *
   *    Copyright (c) 2001, Ted Nelson and Tuomas Lukka
   *    Copyright (c) 2001, Benja Fallenstein
   *
***************
*** 9,15 ****
   *    at your choice, any later version. Alternatively, you may use and
   *    distribute under the terms of the XPL.
   *
!  *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of 
   *    the licenses.
   *
   *    This software is distributed in the hope that it will be useful,
--- 9,15 ----
   *    at your choice, any later version. Alternatively, you may use and
   *    distribute under the terms of the XPL.
   *
!  *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
   *    the licenses.
   *
   *    This software is distributed in the hope that it will be useful,
***************
*** 28,35 ****
   *  XXX rename to ...Vob
   */
  
! public class LineCursor extends Vob implements HBox {
! String rcsid = "$Id: LineCursor.java,v 1.5 2002/08/15 21:05:29 benja Exp $";
      static public boolean dbg = false;
      static private void p(String s) { if(dbg) System.out.println(s); }
  
--- 28,35 ----
   *  XXX rename to ...Vob
   */
  
! public class LineCursor extends HBox.VobHBox {
! String rcsid = "$Id: LineCursor.java,v 1.6 2002/09/21 13:04:56 benja Exp $";
      static public boolean dbg = false;
      static private void p(String s) { if(dbg) System.out.println(s); }
  
***************
*** 47,57 ****
  
      public Object getKey() { return KEY; }
  
!     
      // IMPLEMENTATION OF Vob
  
      static Rectangle rect = new Rectangle();
!     public void render(Graphics g, 
                                boolean fast,
                                Vob.RenderInfo info1,
                                Vob.RenderInfo info2) {
--- 47,57 ----
  
      public Object getKey() { return KEY; }
  
! 
      // IMPLEMENTATION OF Vob
  
      static Rectangle rect = new Rectangle();
!     public void render(Graphics g,
                                boolean fast,
                                Vob.RenderInfo info1,
                                Vob.RenderInfo info2) {
***************
*** 80,91 ****
      public float getHeight(float scale) { return style.getAscent(scale); }
      public float getDepth(float scale) { return style.getDescent(scale); }
  
-     public Vob getVob(float scale) {
-       //this.scale = scale;
-       p("linevob getVob()");
-         return this;
-     }
-       
      public void setPrev(HBox b) { }
      public void setPosition(int depth, int x, int y, int w, int h) { }
  
--- 80,85 ----
Index: gzz/gzz/vob/LinebreakingUtil.java
diff -c gzz/gzz/vob/LinebreakingUtil.java:1.3 
gzz/gzz/vob/LinebreakingUtil.java:1.4
*** gzz/gzz/vob/LinebreakingUtil.java:1.3       Thu Aug 15 17:05:29 2002
--- gzz/gzz/vob/LinebreakingUtil.java   Sat Sep 21 09:04:56 2002
***************
*** 27,33 ****
   */
  
  public class LinebreakingUtil {
! String rcsid = "$Id: LinebreakingUtil.java,v 1.3 2002/08/15 21:05:29 benja 
Exp $";
  
      public static final int GLUE_LENGTH = 0;
      public static final int GLUE_STRETCH = 1;
--- 27,33 ----
   */
  
  public class LinebreakingUtil {
! String rcsid = "$Id: LinebreakingUtil.java,v 1.4 2002/09/21 13:04:56 benja 
Exp $";
  
      public static final int GLUE_LENGTH = 0;
      public static final int GLUE_STRETCH = 1;
***************
*** 119,125 ****
            int boxcs = into.coords.coordsys(cs, boxes[i].getKey(), d,
                    x + wid, y - curhei, curwid, curhei + curdep);
  
!           into.map.put(boxes[i].getVob(scale), boxcs);
            wid += curwid;
        }
      }
--- 119,125 ----
            int boxcs = into.coords.coordsys(cs, boxes[i].getKey(), d,
                    x + wid, y - curhei, curwid, curhei + curdep);
  
!           boxes[i].place(into, boxcs, scale);
            wid += curwid;
        }
      }
Index: gzz/gzz/vob/TextVob.java
diff -c gzz/gzz/vob/TextVob.java:1.24 gzz/gzz/vob/TextVob.java:1.25
*** gzz/gzz/vob/TextVob.java:1.24       Mon Sep  9 11:06:11 2002
--- gzz/gzz/vob/TextVob.java    Sat Sep 21 09:04:56 2002
***************
*** 30,37 ****
   * This vob implements the HBox interface so it is possible to create a 
paragraph
   * from these and use a LineBreaker.
   */
! public class TextVob extends Vob implements HBox {
! String rcsid = "$Id: TextVob.java,v 1.24 2002/09/09 15:06:11 benja Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
--- 30,37 ----
   * This vob implements the HBox interface so it is possible to create a 
paragraph
   * from these and use a LineBreaker.
   */
! public class TextVob extends HBox.VobHBox {
! String rcsid = "$Id: TextVob.java,v 1.25 2002/09/21 13:04:56 benja Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
***************
*** 130,140 ****
      public float getWidth(float scale) { return style.getWidth(text, scale); }
      public float getHeight(float scale) { return style.getAscent(scale); }
      public float getDepth(float scale) { return style.getDescent(scale); }
- 
-     public Vob getVob(float scale) {
-       this.scale = scale;
-       return this;
-     }
  
      public void setPrev(HBox b) { }
      public void setPosition(int depth, int x, int y, int w, int h) { }
--- 130,135 ----
Index: gzz/gzz/vob/buoy/BuoyAnchor.java
diff -c gzz/gzz/vob/buoy/BuoyAnchor.java:1.1 
gzz/gzz/vob/buoy/BuoyAnchor.java:1.2
*** gzz/gzz/vob/buoy/BuoyAnchor.java:1.1        Mon Aug 26 04:21:40 2002
--- gzz/gzz/vob/buoy/BuoyAnchor.java    Sat Sep 21 09:04:56 2002
***************
*** 28,35 ****
  /** An endpoint that a buoy con be anchored to.
   */
  
! public class BuoyAnchor extends Vob implements HBox {
! String rcsid = "$Id: BuoyAnchor.java,v 1.1 2002/08/26 08:21:40 tjl Exp $";
      static public boolean dbg = false;
      static private void p(String s) { if(dbg) System.out.println(s); }
  
--- 28,35 ----
  /** An endpoint that a buoy con be anchored to.
   */
  
! public class BuoyAnchor extends HBox.VobHBox {
! String rcsid = "$Id: BuoyAnchor.java,v 1.2 2002/09/21 13:04:56 benja Exp $";
      static public boolean dbg = false;
      static private void p(String s) { if(dbg) System.out.println(s); }
  
***************
*** 80,91 ****
      public float getHeight(float scale) { return style.getAscent(scale); }
      public float getDepth(float scale) { return style.getDescent(scale); }
  
-     public Vob getVob(float scale) {
-       //this.scale = scale;
-       p("linevob getVob()");
-         return this;
-     }
-       
      public void setPrev(HBox b) { }
  
      /*
--- 80,85 ----
Index: gzz/test/gzz/vob/BenchLBChain.java
diff -c gzz/test/gzz/vob/BenchLBChain.java:1.7 
gzz/test/gzz/vob/BenchLBChain.java:1.8
*** gzz/test/gzz/vob/BenchLBChain.java:1.7      Fri Aug 16 06:22:40 2002
--- gzz/test/gzz/vob/BenchLBChain.java  Sat Sep 21 09:04:56 2002
***************
*** 29,38 ****
   */
  
  public class BenchLBChain {
! public static final String rcsid = "$Id: BenchLBChain.java,v 1.7 2002/08/16 
10:22:40 benja Exp $";
      static private void p(String s) { System.out.println(s); }
  
!     static private class TestVob extends Vob implements HBox {
        TestVob() { super(); }
        public void render(Graphics g,
                                boolean fast,
--- 29,38 ----
   */
  
  public class BenchLBChain {
! public static final String rcsid = "$Id: BenchLBChain.java,v 1.8 2002/09/21 
13:04:56 benja Exp $";
      static private void p(String s) { System.out.println(s); }
  
!     static private class TestVob extends HBox.VobHBox {
        TestVob() { super(); }
        public void render(Graphics g,
                                boolean fast,
***************
*** 43,50 ****
        public float getWidth(float scale) { return 20; }
        public float getHeight(float scale) { return 20; }
        public float getDepth(float scale) { return 20; }
-       public Vob getVob(float scale) { return this; }
-       public Object getKey() { return null; }
        public void setPrev(HBox b) { }
        public void setPosition(int depth, int x, int y, int w, int h) { }
      }
--- 43,48 ----
Index: gzz/test/gzz/vob/TestLBChain.java
diff -c gzz/test/gzz/vob/TestLBChain.java:1.10 
gzz/test/gzz/vob/TestLBChain.java:1.11
*** gzz/test/gzz/vob/TestLBChain.java:1.10      Thu Aug 29 05:41:16 2002
--- gzz/test/gzz/vob/TestLBChain.java   Sat Sep 21 09:04:56 2002
***************
*** 29,46 ****
   */
  
  public class TestLBChain extends TestCase {
! String rcsid = "$Id: TestLBChain.java,v 1.10 2002/08/29 09:41:16 tjl Exp $";
  
      public TestLBChain(String s) { super(s); }
  
!     static class TestBox extends Vob implements HBox {
        TestBox(int w) { super(); this.w = w; }
        int w;
        public float getHeight(float scale) { return 5; }
        public float getWidth(float scale) { return w; }
        public float getDepth(float scale) { return 9; }
-       public Vob getVob(float scale) { return this; }
-       public Object getKey() { return null; }
        public void setPrev(HBox box) { }
          public void setPosition(int depth, int x, int y, int w, int h) { }
  
--- 29,44 ----
   */
  
  public class TestLBChain extends TestCase {
! String rcsid = "$Id: TestLBChain.java,v 1.11 2002/09/21 13:04:56 benja Exp $";
  
      public TestLBChain(String s) { super(s); }
  
!     static class TestBox extends HBox.VobHBox {
        TestBox(int w) { super(); this.w = w; }
        int w;
        public float getHeight(float scale) { return 5; }
        public float getWidth(float scale) { return w; }
        public float getDepth(float scale) { return 9; }
        public void setPrev(HBox box) { }
          public void setPosition(int depth, int x, int y, int w, int h) { }
  




reply via email to

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