[Kst] kdeextragear-2/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Wed Jul 28 16:07:10 CEST 2004


CVS commit by netterfield: 

Start at new lines in labels.
  - '\n' in a label adds a new line
  - Greek replacement hapens first, so in 'the \nuser' \nu will be interpreted
	as as the greek letter nu.
  - a space after a \n will be ignored, so in 'the \n user' '\n ' will be a new line,
	not a new line followed by a space.

As this point, static endering of the multi line label seems to work, but rendering
of the label during dragging seems messed up.


  M +16 -1     kstlabel.cpp   1.35


--- kdeextragear-2/kst/kst/kstlabel.cpp  #1.34:1.35
@@ -286,4 +286,5 @@ void KstLabel::draw(QPainter &p, int px,
 
   uiLength = processedText.length();
+  Width = 0;
   for (i = 0; i < uiLength; i++) {
     C = processedText[i];
@@ -392,4 +393,16 @@ void KstLabel::draw(QPainter &p, int px,
               i++;
             }
+          } else if (processedText[i+1] == 'n') {
+            // New Line here
+            if (Width < (x-x0)) {
+              Width = x - x0;
+            }
+            x = x0;
+            y += 1.5*h;
+            //y_lower -= 1.5*h;
+            i++;
+            if (processedText.at(i+1) == ' ') {
+              i++;
+            }
           } else {
             i++;
@@ -451,5 +464,7 @@ void KstLabel::draw(QPainter &p, int px,
 
   p.restore();
+  if (Width < (x-x0)) {
   Width = x - x0;
+  }
 
   rect.setRect((int)(px + x0), (int)(py + y_upper),





More information about the Kst mailing list