Bug 120884 - Text view object resize behaviour is incorrect in some cases
Summary: Text view object resize behaviour is incorrect in some cases
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-27 20:01 UTC by Andrew Walker
Modified: 2006-01-27 23:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2006-01-27 20:01:50 UTC
Version:           HEAD (using KDE KDE 3.5.0)
OS:                Linux

PROBLEM:
A text view object with the "Auto Resize for Text" property checked does not resize as the user would expect.

STEPS TO REPRODUCE:
Start Kst
Create a text view object and check the "Auto Resize for Text" property
Click on the text object to select it
Using the lower-left corner of the text object drag the corner left and down to resize it
Release the mouse button

RESULTS:
The text object remains the same size but jumps to the top-left of the rectangle defined by the user's drag operation

EXPECTED RESULTS:
Either the user is unable to resize this text object or the text object remains at the same location following the operation. My preference would be the former.
Comment 1 Andrew Walker 2006-01-27 22:39:21 UTC
Proposed patch for this problem.

Index: kstviewlabel.cpp
===================================================================
--- kstviewlabel.cpp    (revision 503013)
+++ kstviewlabel.cpp    (working copy)
@@ -73,7 +73,7 @@
   reparse();
   computeTextSize(_parsed);
   setDirty(false);
-  _autoResize = true;
+  setAutoResize(true);
 }


@@ -114,7 +114,7 @@
     n = n.nextSibling();
   }

-  _autoResize = in_autoResize;
+  setAutoResize(in_autoResize);
 }


@@ -491,6 +491,7 @@

 void KstViewLabel::setAutoResize(bool on) {
     _autoResize = on;
+    _isResizable = !on;
 }
Comment 2 George Staikos 2006-01-27 23:02:38 UTC
Untested, but looks good to me.  If it works for you, please commit to trunk.

On Friday 27 January 2006 16:39, Andrew Walker wrote:
[bugs.kde.org quoted mail]
Comment 3 Netterfield 2006-01-27 23:18:57 UTC
The current behavior is intentional, if surprising.

The problem is with the definition of 'text size', which was inherited from the definition for axis labels: size 0 is supposed to mean 12 point for some default size plot (don't remember exactly what size...).  If you then make the plot bigger, the label should grow.  If you shrink the plot, the labels should get smaller (down to a floor size).

Now, what about a label that is the child of a plot, other than axis labels?  It would be surprising indeed if their size had a different definition.  So, in calculating the size the font should be, we use the dimensions of the parent.  If a label of text size '0' is the child of a big plot, the displayed font should be larger than if it is the parent of a small plot. (ie, parented floating labels have the same behavior as axis labels).

Of course the label could be owned by things other than a plot, like an ellipse in the bug report.  So..... the current behavior, at least, is usable, once understood.

So the proposed patch, at least tentativly, is "not accepted=me".
Comment 4 Andrew Walker 2006-01-27 23:24:01 UTC
Barth, I think your comment was meant for 120883 and not 120884.
Comment 5 Andrew Walker 2006-01-27 23:40:00 UTC
SVN commit 503027 by arwalker:

BUG:120884 No longer allow an auto-resize text label to be resized as this is a meaningless operation.

 M  +13 -4     kstviewlabel.cpp  


--- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #503026:503027
@@ -73,7 +73,7 @@
   reparse();
   computeTextSize(_parsed);
   setDirty(false);
-  _autoResize = true;
+  setAutoResize(true);
 }
 
 
@@ -114,7 +114,7 @@
     n = n.nextSibling();
   }
 
-  _autoResize = in_autoResize;
+  setAutoResize(in_autoResize);
 }
 
 
@@ -331,7 +331,11 @@
   if (p.type() == KstPainter::P_PRINT ||
       p.type() == KstPainter::P_EXPORT) {
     if (_autoResize) {
-      adjustSizeForText(p.window());
+      if (_parent) {
+        adjustSizeForText(_parent->geometry());
+      } else {
+        adjustSizeForText(p.window());
+      }
     } else {
       computeTextSize(_parsed);
     }
@@ -350,7 +354,11 @@
     }
     if (dirty()) {
       if (_autoResize) {
-        adjustSizeForText(p.window());
+        if (_parent) {
+          adjustSizeForText(_parent->geometry());
+        } else {
+          adjustSizeForText(p.window());
+        }
         drawToBuffer(_parsed);
       } else {
         computeTextSize(_parsed);
@@ -491,6 +499,7 @@
 
 void KstViewLabel::setAutoResize(bool on) {
     _autoResize = on;
+    _isResizable = !on;
 }