gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java


From: Asko Soukka
Subject: [Gzz-commits] gzz/gzz/view LinebrokenCellContentView.java
Date: Fri, 10 Jan 2003 06:26:48 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Asko Soukka <address@hidden>    03/01/10 06:26:48

Modified files:
        gzz/view       : LinebrokenCellContentView.java 

Log message:
        Fixing LinebrokenCellContentView.getSize()

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LinebrokenCellContentView.java.diff?tr1=1.20&tr2=1.21&r1=text&r2=text

Patches:
Index: gzz/gzz/view/LinebrokenCellContentView.java
diff -u gzz/gzz/view/LinebrokenCellContentView.java:1.20 
gzz/gzz/view/LinebrokenCellContentView.java:1.21
--- gzz/gzz/view/LinebrokenCellContentView.java:1.20    Fri Jan 10 05:00:16 2003
+++ gzz/gzz/view/LinebrokenCellContentView.java Fri Jan 10 06:26:47 2003
@@ -40,7 +40,7 @@
  *  Doesn't scroll, currently.
  */
 public class LinebrokenCellContentView extends CellView {
-public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.20 
2003/01/10 10:00:16 mudyc Exp $";
+public static final String rcsid = "$Id: LinebrokenCellContentView.java,v 1.21 
2003/01/10 11:26:47 humppake Exp $";
     public static boolean dbg = false;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
@@ -81,7 +81,25 @@
        else
            s = widthString;
 
+       /**
+        * Width of LinebrokenCellContentView is the
+        * width of its longest line.
+        */
        float w = style.getWidth(s, scale);
+        int linebreak = s.indexOf('\n');
+       if (linebreak != -1) {
+           w = style.getWidth(s.substring(0, linebreak), scale);
+           int anotherLinebreak = s.indexOf('\n', linebreak+1);
+           while (anotherLinebreak != -1) {
+               float anotherWidth = style.getWidth(s.substring(linebreak+1, 
anotherLinebreak), scale);
+               if (w < anotherWidth) w = anotherWidth;
+               linebreak = anotherLinebreak;
+               anotherLinebreak = s.indexOf('\n', linebreak+1);
+           } 
+           float anotherWidth = style.getWidth(s.substring(linebreak+1, 
s.length()), scale);
+           if (w < anotherWidth) w = anotherWidth;
+       }
+
        float h;
        if(c != null)
            h = getHeight(c, w, scale);




reply via email to

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