/[gzz]/gzz/gzz/vob/linebreaking/HBox.java
ViewVC logotype

Diff of /gzz/gzz/vob/linebreaking/HBox.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by humppake, Mon Nov 25 11:15:16 2002 UTC revision 1.4 by benja, Sun Dec 29 02:01:41 2002 UTC
# Line 63  String rcsid = "$Id$"; Line 63  String rcsid = "$Id$";
63       */       */
64      void place(VobScene vs, int coordsys, float scale);      void place(VobScene vs, int coordsys, float scale);
65    
66        /** Get this box's length in characters or other units.
67         *  <code>getX(i)</code> is valid for
68         *  <code>i &lt; getLength()</code>.
69         */
70        int getLength();
71    
72        /** Get the position after a unit (e.g. character)
73         *  inside this HBox.
74         */
75        float getX(int i, float scale) throws IndexOutOfBoundsException;
76    
77      /** The key for this HBox. XXX */      /** The key for this HBox. XXX */
78      Object getKey();      Object getKey();
79    
# Line 73  String rcsid = "$Id$"; Line 84  String rcsid = "$Id$";
84      void setPrev(HBox b);      void setPrev(HBox b);
85    
86      class Null implements HBox {      class Null implements HBox {
87            protected int length;
88            public Null() { this(0); }
89            public Null(int length) { this.length = length; }
90    
91          public float getWidth(float scale) { return 0; }          public float getWidth(float scale) { return 0; }
92          public float getHeight(float scale) { return 0; }          public float getHeight(float scale) { return 0; }
93          public float getDepth(float scale) { return 0; }          public float getDepth(float scale) { return 0; }
94          public void place(VobScene vs, int coordsys, float scale) {}          public void place(VobScene vs, int coordsys, float scale) {}
95            public int getLength() { return length; }
96            public float getX(int i, float scale) {
97                if(i<0 || i>length) throw new IndexOutOfBoundsException(""+i);
98                return 0;
99            }
100          public Object getKey() { return null; }          public Object getKey() { return null; }
101          public void setPrev(HBox b) { }          public void setPrev(HBox b) { }
102      }      }
103    
104      public Object WH_KEY = new Object();      public Object WH_KEY = new Object();
105    
106      /** A useful base class for hboxes that are vobs.      /** A useful base class for hboxes that are vobs.
107       *  The second coordsys will contain the width and height for this vob.       *  The second coordsys will contain the width and height for this vob.
108       */       */
# Line 101  String rcsid = "$Id$"; Line 122  String rcsid = "$Id$";
122              int cs_scale = vs.scaleCS(box, "textbox", h, h);              int cs_scale = vs.scaleCS(box, "textbox", h, h);
123              vs.map.put(this, cs_scale);              vs.map.put(this, cs_scale);
124          }          }
125    
126            public int getLength() { return 1; }
127            public float getX(int i, float scale) {
128                if(i < 0 || i > 1) throw new IndexOutOfBoundsException(""+i);
129                if(i == 0) return 0;
130                else return getWidth(scale);
131            }
132    
133          public Object getKey() { return null; /* XXX */ }          public Object getKey() { return null; /* XXX */ }
134    
135          public void setPrev(HBox b) { }          public void setPrev(HBox b) { }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26