refactored selectAll to allow for rectangle-drag in UIObjectView
authorClaus Gittinger <cg@exept.de>
Mon, 18 May 2009 15:51:32 +0200
changeset 2538 ded6eb784054
parent 2537 12e3b32befe4
child 2539 3fa0fde65f75
refactored selectAll to allow for rectangle-drag in UIObjectView
UIObjectView.st
--- a/UIObjectView.st	Mon May 18 15:28:47 2009 +0200
+++ b/UIObjectView.st	Mon May 18 15:51:32 2009 +0200
@@ -486,6 +486,13 @@
     self shouldNotImplement
 ! !
 
+!UIObjectView methodsFor:'enumerating'!
+
+contentsDo:aBlock
+    self subViews do:aBlock.
+    self components do:aBlock.
+! !
+
 !UIObjectView methodsFor:'event handling'!
 
 doublePressed:pressPoint
@@ -934,7 +941,9 @@
 
     viewOperatedUpon isNil ifTrue:[
         clickedView isNil ifTrue:[
+            "/ clicked outside - start a rectangle drag.
             self select:nil.
+            self startRectangleDrag:aPoint.
             ^ self.
         ].
 
@@ -1840,6 +1849,10 @@
     ].
   ^ false
 
+!
+
+object:anObject isContainedIn:aRectangle
+    ^ anObject bounds isContainedIn:aRectangle
 ! !
 
 !UIObjectView methodsFor:'transaction'!
@@ -2159,15 +2172,14 @@
         aligning ifTrue:[
             n := ((aView computeOrigin x) \\ gridX).
             n == 0 ifTrue:[n := gridX].
-            n := n negated.
         ] ifFalse:[
-            n := -1.
+            n := 1.
             self sensor shiftDown ifTrue:[
-                n := -8.    
+                n := 8.    
             ].
         ].
         n := n * howMany.
-        self shiftLayout:aView horizontal:n
+        self shiftLayout:aView horizontal:n negated
     ]
 !
 
@@ -2188,9 +2200,7 @@
     self moveDo:[:aView|
         aligning ifTrue:[
             n := ((aView computeCorner x) \\ gridX).
-
-            n ~~ 0 ifTrue:[n := n negated]
-                  ifFalse:[n := gridX]
+            n == 0 ifTrue:[n := gridX].
         ] ifFalse:[
             n := 1.
             self sensor shiftDown ifTrue:[