[Kst] branches/work/kst/1.5/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Thu Sep 6 22:26:45 CEST 2007


SVN commit 709209 by arwalker:

BUG:117838 highlight the prospective parent of an object during a move operation. This is necessary as the automatic parenting feature is not necessarily intuitive and this makes it more obvious

 M  +19 -1     ksttoplevelview.cpp  
 M  +5 -4      ksttoplevelview.h  


--- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.cpp #709208:709209
@@ -834,7 +834,7 @@
     p.setPen(QPen(Qt::black, 0, Qt::DotLine));
     if (_selectionList.isEmpty()) {
       if (old.topLeft() != QPoint(-1, -1)) {
-        _pressTarget->drawShadow(p, old.topLeft());  
+        _pressTarget->drawShadow(p, old.topLeft());
       }
       _pressTarget->drawShadow(p, r.topLeft());
     } else {
@@ -845,6 +845,22 @@
         (*iter)->drawShadow(p, r.topLeft() + (*iter)->geometry().topLeft() - originalTopLeft);
       }
     }
+
+    //
+    // draw a selection for the new parent if the _pressTarget is released now...
+    //
+    KstViewObjectPtr container = findDeepestChild(r);
+
+    if (container != _prevContainer) {
+      if (_prevContainer) {
+        _prevContainer->drawShadow(p, _prevContainer->geometry().topLeft());
+      }
+      if (container) {
+        container->drawShadow(p, container->geometry().topLeft());
+      }
+      _prevContainer = container;
+    }
+
     p.end();
   }
 }
@@ -998,6 +1014,7 @@
     // selecting objects using rubber band
     releasePressLayoutModeSelect(pos, shift);
   }
+  _prevContainer = 0L;
   _pressTarget = 0L;
   _pressDirection = -1;
   _moveOffset = QPoint(-1, -1);
@@ -1742,6 +1759,7 @@
     }
     //_pressTarget = 0L;
     _prevBand = QRect(-1, -1, 0, 0);
+    _prevContainer = 0L;
     return;
   }
 
--- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.h #709208:709209
@@ -102,7 +102,7 @@
     void updateFocus(const QPoint& pos);
     bool handlePress(const QPoint& pos, bool shift = false);
     bool handleDoubleClick(const QPoint& pos, bool shift = false);
-    
+
     // press move handlers
     void pressMove(const QPoint& pos, bool shift = false, bool alt = false);
     void pressMoveLayoutMode(const QPoint& pos, bool shift = false, bool alt = false);
@@ -112,7 +112,7 @@
     void pressMoveLayoutModeSelect(const QPoint& pos);
     void pressMoveLayoutModeEndPoint(const QPoint& pos, bool maintainAspect = false, bool snapToBorder = true);
     void pressMoveLayoutModeCenteredResize(const QPoint& pos, bool maintainAspect = false, bool snapToBorder = true);
-    
+
     // release press handlers 
     void releasePress(const QPoint& pos, bool shift = false);
     void releasePressLayoutMode(const QPoint& pos, bool shift = false);
@@ -138,7 +138,7 @@
     QPoint pointSnapToObjects(const QPoint& p);
     // Called as a response to drag re-entering widget()
     void restartMove();
-    
+
     KstGfxMouseHandler *handlerForObject(const QString& objType);
 
   private:
@@ -157,6 +157,7 @@
     QPoint _moveOffset;
     QPoint _moveOffsetSticky;
     KstViewObjectPtr _pressTarget, _hoverFocus;
+    KstViewObjectPtr _prevContainer;
     QRect _prevBand;
     KstViewObjectList _selectionList;
     KstViewObjectPtr _mouseGrabber;
@@ -233,4 +234,4 @@
 
 
 #endif
-// vim: ts=2 sw=2 et
+


More information about the Kst mailing list