/[gzz]/gzz/gzz/view/TextCellContentView.java
ViewVC logotype

Diff of /gzz/gzz/view/TextCellContentView.java

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

revision 1.16 by tjl, Tue Oct 8 07:34:54 2002 UTC revision 1.17 by tjl, Mon Oct 14 10:11:13 2002 UTC
# Line 51  public static final String rcsid = "$Id$ Line 51  public static final String rcsid = "$Id$
51          this.style = style;          this.style = style;
52      }      }
53    
54      public void place(Cell c, VobScene v, int cs, float w, float h,      public void place(Cell c, VobScene v, Box box,
55                        ViewContext context, float scale) {                        ViewContext context, float scale) {
56          String s = c.t();          String s = c.t();
57          if (s == null) s = "";          if (s == null) s = "";
# Line 77  public static final String rcsid = "$Id$ Line 77  public static final String rcsid = "$Id$
77          float left = style.getWidth(s.substring(0, center), scale);          float left = style.getWidth(s.substring(0, center), scale);
78          float right = width - left;          float right = width - left;
79    
80          float middle = w / 2.0f;          float middle = box.getWidth() / 2.0f;
81    
82          float skew;          // Possibly offset text so cursor is visible.
83          if(width < w) skew = 0;          float textOffset;
84          else if(left < middle) skew = 0;          if(width < box.getWidth()) textOffset = 0;
85          else if(right < middle) skew = (- width + w);          else if(left < middle) textOffset = 0;
86          else skew = (- left + middle);          else if(right < middle) textOffset = (- width + box.getWidth());
87            else textOffset = (- left + middle);
88    
89          Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);          Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);
90          int skewedcs = v.coordsys(cs, key, 0, skew, 0, 2, 2);          int offsetcs = v.coordsys(box.getWHCoordsys(), key, 0, textOffset, 0, 1, 1);
91    
92          placeVob(c, v, skewedcs, w, h, brBefore, brAfter, offs, context, scale);          placeVob(c, v, offsetcs, box.getWidth(), box.getHeight(), brBefore, brAfter, offs, context, scale);
93      }      }
94    
95      static Object WH_KEY = new Object();      static Object WH_KEY = new Object();

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

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