[Kst] [Bug 120488] Legend object can be resized

Andrew Walker arwalker at sumusltd.com
Tue Jan 24 23:55:31 CET 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=120488         
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2006-01-24 23:55 -------
SVN commit 502137 by arwalker:

BUG:120488 Make it so that the user cannot resize the legend object through the UI.

 M  +14 -11    ksttoplevelview.cpp  
 M  +2 -0      kstviewlegend.cpp  
 M  +36 -26    kstviewobject.cpp  
 M  +3 -1      kstviewobject.h  


--- trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp #502136:502137
 @ -287,7 +287,7  @
   _mode = v;
   
   // change the mouse handler
-  if ((_mode == CreateMode) || (_mode == LabelMode)) {
+  if (_mode == CreateMode || _mode == LabelMode) {
     _activeHandler = handlerForObject(objectType);
   } else {
     _activeHandler = 0L;
 @ -656,17 +656,20  @
     if (_pressDirection == 0) {
       // moving an object
       pressMoveLayoutModeMove(pos, shift);
-    } else if (_pressDirection & ENDPOINT) {
-      // moving an endpoint of an object
-      pressMoveLayoutModeEndPoint(pos, shift);
-    } else if (_pressDirection & CENTEREDRESIZE) {
-      // resizing an object with fixed center
-      pressMoveLayoutModeCenteredResize(pos, shift);
-    } else {
-      // resizing a rectangular object
-      pressMoveLayoutModeResize(pos, shift);
+      KstApp::inst()->slotUpdateDataMsg(i18n("(x0,y0)-(x1,y1)", "(%1,%2)-(%3,%4)").arg(_prevBand.topLeft().x()).arg(_prevBand.topLeft().y()).arg(_prevBand.bottomRight().x()).arg(_prevBand.bottomRight().y()));
+    } else if (_pressTarget->isResizable()) { 
+      if (_pressDirection & ENDPOINT) {
+        // moving an endpoint of an object
+        pressMoveLayoutModeEndPoint(pos, shift);
+      } else if (_pressDirection & CENTEREDRESIZE) {
+        // resizing an object with fixed center
+        pressMoveLayoutModeCenteredResize(pos, shift);
+      } else {
+        // resizing a rectangular object
+        pressMoveLayoutModeResize(pos, shift);
+      }
+      KstApp::inst()->slotUpdateDataMsg(i18n("(x0,y0)-(x1,y1)", "(%1,%2)-(%3,%4)").arg(_prevBand.topLeft().x()).arg(_prevBand.topLeft().y()).arg(_prevBand.bottomRight().x()).arg(_prevBand.bottomRight().y()));
     }
-    KstApp::inst()->slotUpdateDataMsg(i18n("(x0,y0)-(x1,y1)", "(%1,%2)-(%3,%4)").arg(_prevBand.topLeft().x()).arg(_prevBand.topLeft().y()).arg(_prevBand.bottomRight().x()).arg(_prevBand.bottomRight().y()));
   } else {
     // selecting objects
     pressMoveLayoutModeSelect(pos, shift);
--- trunk/extragear/graphics/kst/kst/kstviewlegend.cpp #502136:502137
 @ -59,6 +59,7  @
   _vertical = true;
   _fontName = KstApp::inst()->defaultFont();
   _fontSize = 0;
+  _isResizable = false;
   setForegroundColor(KstSettings::globalSettings()->foregroundColor);
   setBorderColor(KstSettings::globalSettings()->foregroundColor);
   setBackgroundColor(KstSettings::globalSettings()->backgroundColor);
 @ -82,6 +83,7  @
   _fontName = KstApp::inst()->defaultFont();
   _fontSize = 0;
   _vertical = true;
+  _isResizable = false;
   _absFontSize = _fontSize+KstSettings::globalSettings()->plotFontSize;
   _layoutActions &= ~(MoveTo | Copy | CopyTo);
   _standardActions |= Delete | Edit;
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #502136:502137
 @ -72,6 +72,7  @
   _followsFlow = false;
   _dialogLock = false;
   _fallThroughTransparency = true;
+  _isResizable = true;
   setMinimumSize(DEFAULT_MINIMUM_SIZE);
 }
 
 @ -87,6 +88,7  @
   _followsFlow = false;
   _dialogLock = false;
   _fallThroughTransparency = true;
+  _isResizable = true;
   setMinimumSize(DEFAULT_MINIMUM_SIZE);
   load(e);
 }
 @ -108,6 +110,7  @
   _dialogLock = false;
   _selected = false;
   _fallThroughTransparency = true;
+  _isResizable = viewObject._isResizable;
   _geom = viewObject._geom;
   _transparent = viewObject._transparent;
   _followsFlow = viewObject._followsFlow;
 @ -1739,34 +1742,36  @
 
   signed int direction = NONE;
 
-  const QRect geom(geometry());
-  const QPoint topLeft(geom.topLeft());
-  const QPoint topRight(geom.topRight());
-  const QPoint bottomLeft(geom.bottomLeft());
-  const QPoint bottomRight(geom.bottomRight());
-  const QPoint topMiddle(QPoint((topLeft.x() + topRight.x())/2, topLeft.y()));
-  const QPoint bottomMiddle(QPoint((bottomLeft.x() + bottomRight.x())/2, bottomLeft.y()));
-  const QPoint middleLeft(QPoint(topLeft.x(), (topLeft.y() + bottomLeft.y())/2));
-  const QPoint middleRight(QPoint(topRight.x(), (topRight.y() + bottomRight.y())/2));
+  if (_isResizable) {
+    const QRect geom(geometry());
+    const QPoint topLeft(geom.topLeft());
+    const QPoint topRight(geom.topRight());
+    const QPoint bottomLeft(geom.bottomLeft());
+    const QPoint bottomRight(geom.bottomRight());
+    const QPoint topMiddle(QPoint((topLeft.x() + topRight.x())/2, topLeft.y()));
+    const QPoint bottomMiddle(QPoint((bottomLeft.x() + bottomRight.x())/2, bottomLeft.y()));
+    const QPoint middleLeft(QPoint(topLeft.x(), (topLeft.y() + bottomLeft.y())/2));
+    const QPoint middleRight(QPoint(topRight.x(), (topRight.y() + bottomRight.y())/2));
 
-  if (pointsCloseEnough(topLeft, pos)) {
-    direction |= UP | LEFT;
-  } else if (pointsCloseEnough(topRight, pos)) {
-    direction |= UP | RIGHT;
-  } else if (pointsCloseEnough(bottomLeft, pos)) {
-    direction |= DOWN | LEFT;
-  } else if (pointsCloseEnough(bottomRight, pos)) {
-    direction |= DOWN | RIGHT;
-  } else if (pointsCloseEnough(topMiddle, pos)) {
-    direction |= UP;
-  } else if (pointsCloseEnough(bottomMiddle, pos)) {
-    direction |= DOWN;
-  } else if (pointsCloseEnough(middleLeft, pos)) {
-    direction |= LEFT;
-  } else if (pointsCloseEnough(middleRight, pos)) {
-    direction |= RIGHT;
+    if (pointsCloseEnough(topLeft, pos)) {
+      direction |= UP | LEFT;
+    } else if (pointsCloseEnough(topRight, pos)) {
+      direction |= UP | RIGHT;
+    } else if (pointsCloseEnough(bottomLeft, pos)) {
+      direction |= DOWN | LEFT;
+    } else if (pointsCloseEnough(bottomRight, pos)) {
+      direction |= DOWN | RIGHT;
+    } else if (pointsCloseEnough(topMiddle, pos)) {
+      direction |= UP;
+    } else if (pointsCloseEnough(bottomMiddle, pos)) {
+      direction |= DOWN;
+    } else if (pointsCloseEnough(middleLeft, pos)) {
+      direction |= LEFT;
+    } else if (pointsCloseEnough(middleRight, pos)) {
+      direction |= RIGHT;
+    }
   }
-
+  
   return direction;
 }
 
 @ -1849,5 +1854,10  @
   return _fallThroughTransparency;
 }
 
+bool KstViewObject::isResizable() const {
+  return _isResizable;
+}
+
+
 #include "kstviewobject.moc"
 // vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstviewobject.h #502136:502137
 @ -125,7 +125,8  @
 
     bool objectDirty() const; // true if this object or a child is dirty
     bool fallThroughTransparency() const;
-
+    bool isResizable() const;
+    
     virtual QWidget *configWidget();
 
     // can't be const due to KstViewObjectPtr?
 @ -306,6 +307,7  @
     bool _dialogLock : 1;
     bool _container : 1;
     bool _fallThroughTransparency : 1;
+    bool _isResizable : 1;
     int _columns : 6; // "64 columns ought to be enough for anyone"
     QGuardedPtr<KstViewObject> _topObjectForMenu;
     QGuardedPtr<KstViewObject> _parent; // danger!!


More information about the Kst mailing list