/[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.28 by humppake, Mon Nov 25 16:03:39 2002 UTC revision 1.29 by benja, Tue Nov 26 00:30:23 2002 UTC
# Line 94  public static final String rcsid = "$Id$ Line 94  public static final String rcsid = "$Id$
94          offs -= brBefore;          offs -= brBefore;
95          center -= brBefore;          center -= brBefore;
96    
97          float scale = 1; // XXX use getFontSize          vs.coords.getSqSize(box, boxwh);
98            float middle = boxwh[0] / 2.0f;
99            float scale = style.getScaleByHeight(boxwh[1]);
100    
101            if(dbg) {
102                pa("scaled_h: "+boxwh[1]);
103                pa("scale: "+scale);
104            }
105    
106          float width = style.getWidth(s, scale);          float width = style.getWidth(s, scale);
107          float left = style.getWidth(s.substring(0, center), scale);          float left = style.getWidth(s.substring(0, center), scale);
108          float right = width - left;          float right = width - left;
109    
         vs.coords.getSqSize(box, boxwh);  
         float middle = boxwh[0] / 2.0f;  
   
110          // Possibly offset text so cursor is visible.          // Possibly offset text so cursor is visible.
111          float textOffset;          float textOffset;
112          if(width < boxwh[0]) textOffset = 0;          if(width < boxwh[0]) textOffset = 0;
# Line 113  public static final String rcsid = "$Id$ Line 117  public static final String rcsid = "$Id$
117          Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);          Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);
118          int offsetcs = vs.orthoCS(box, key, 0, textOffset, 0, 1, 1);          int offsetcs = vs.orthoCS(box, key, 0, textOffset, 0, 1, 1);
119    
120          placeVob(c, vs, offsetcs, boxwh[0], boxwh[1], brBefore, brAfter, offs, context, scale);          placeVob(c, vs, offsetcs, brBefore, brAfter, offs, context, boxwh[1]);
121      }      }
122    
123      static Object WH_KEY = new Object();      static Object WH_KEY = new Object();
124      static Object CURS_KEY = new Object();      static Object CURS_KEY = new Object();
125      LineVob cursorVob = new LineVob(0, 0, 0, 1, Color.black);      LineVob cursorVob = new LineVob(0, 0, 0, 1, Color.black);
126      protected void placeVob(Cell c, VobScene vs, int cs, float w, float h, int start, int end,      protected void placeVob(Cell c, VobScene vs, int cs, int start, int end,
127                              int offs, ViewContext context, float scale) {                              int offs, ViewContext context, float scaled_h) {
128              // XXX should optimize for common case: no substring()              // XXX should optimize for common case: no substring()
129          TextVob vob = new TextVob(style, c.t().substring(start, end));          TextVob vob = new TextVob(style, c.t().substring(start, end));
         float scaled_h = vob.getHeight(scale) + vob.getDepth(scale);  
130          int cs_scaled = vs.orthoCS(cs, WH_KEY, 0, 0, 0, scaled_h, scaled_h);          int cs_scaled = vs.orthoCS(cs, WH_KEY, 0, 0, 0, scaled_h, scaled_h);
131          vs.map.put(vob, cs_scaled);          vs.map.put(vob, cs_scaled);
132    
133          if(offs >= 0 && offs >= start && offs <= end) {          if(offs >= 0 && offs >= start && offs <= end) {
134              float x = style.getWidth(c.t().substring(start, offs), 1);              float xscale = style.getScaleByHeight(scaled_h);
135                float x = style.getWidth(c.t().substring(start, offs), xscale);
136              int cs_cursor = vs.orthoCS(cs, CURS_KEY, -1, x+1, 0, 0,scaled_h);              int cs_cursor = vs.orthoCS(cs, CURS_KEY, -1, x+1, 0, 0,scaled_h);
137              // v.map.put(new TextCursorVob(vob, offs), cs);              // v.map.put(new TextCursorVob(vob, offs), cs);
138              vs.map.put(cursorVob, cs_cursor);              vs.map.put(cursorVob, cs_cursor);

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

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