ObjectView.st
changeset 2782 efccf22db49d
parent 2747 6fd2aa4c9300
child 2783 ea9bf46c39d9
--- a/ObjectView.st	Wed Jul 16 18:34:02 2003 +0200
+++ b/ObjectView.st	Wed Jul 30 08:09:59 2003 +0200
@@ -326,6 +326,25 @@
 
 !ObjectView methodsFor:'accessing'!
 
+aligning
+    ^ aligning
+!
+
+aligningMove
+    ^ aligningMove
+!
+
+aligningMove:aBoolean
+
+    aligningMove == aBoolean ifTrue:[ ^ self ].
+    aBoolean ifTrue:[
+        aligning == true ifFalse:[ ^ self ].
+        gridAlign isNil ifTrue:[ ^ self ].
+    ].
+
+    aligningMove := aBoolean
+!
+
 contents
     ^ contents
 
@@ -598,7 +617,7 @@
 "/    self setSelection:tmp
     ].
 
-    "Modified: / 4.7.1999 / 15:29:55 / cg"
+    ^ tmp
 !
 
 paste:something
@@ -824,41 +843,43 @@
     |d org nOrg|
 
     movedObject isNil ifTrue:[
-	movedObject := selection.
-	"
-	 draw first outline
-	"
-	movedObject notNil ifTrue:[
-	    moveDelta := 0@0.
-
-	    "tricky, the moved object may not currently be aligned.
-	     if so, simulate a frame move of the delta"
-
-	    aligningMove ifTrue:[
-		org := movedObject origin.
-		d := org - (self alignToGrid:(org)).
-		moveDelta := d negated.
-	    ].
-	    self invertDragObject:movedObject delta:moveDelta    
-	]
+        movedObject := selection.
+        "
+         draw first outline
+        "
+        movedObject notNil ifTrue:[
+            moveDelta := 0@0.
+
+            "tricky, the moved object may not currently be aligned.
+             if so, simulate a frame move of the delta"
+
+            aligningMove ifTrue:[
+                org := movedObject origin.
+                d := org - (self alignToGrid:(org)).
+                moveDelta := d negated.
+            ].
+            self invertDragObject:movedObject delta:moveDelta    
+        ]
     ].
-    movedObject notNil ifTrue:[
-	d := aPoint - moveStartPoint.
-	aligningMove ifTrue:[
-	    org := movedObject origin.
-	    nOrg := org + d.
-	    d :=  (self alignToGrid:(nOrg)) - org.
-	].
-	d ~= moveDelta ifTrue:[
-	    "
-	     clear prev outline,
-	     draw new outline
-	    "
-	    self invertDragObject:movedObject delta:moveDelta.    
-	    moveDelta :=  d.
-	    self invertDragObject:movedObject delta:moveDelta    
-	]
-    ]
+    moveStartPoint notNil ifTrue:[
+        movedObject notNil ifTrue:[
+            d := aPoint - moveStartPoint.
+            aligningMove ifTrue:[
+                org := movedObject origin.
+                nOrg := org + d.
+                d :=  (self alignToGrid:(nOrg)) - org.
+            ].
+            d ~= moveDelta ifTrue:[
+                "
+                 clear prev outline,
+                 draw new outline
+                "
+                self invertDragObject:movedObject delta:moveDelta.    
+                moveDelta :=  d.
+                self invertDragObject:movedObject delta:moveDelta    
+            ]
+        ]
+    ].
 !
 
 endObjectMove
@@ -2650,12 +2671,44 @@
     ]
 !
 
+findAllObjectsHandleAt:aPoint
+
+    ^ contents select:[:object|
+        (self object:object hasHandleAt:aPoint) 
+    ] 
+!
+
+findAllObjectsHandleAt:aPoint suchThat:aBlock
+
+    ^ contents select:[:object|
+        (aBlock value:object) 
+        and:[(self object:object hasHandleAt:aPoint)]
+    ] 
+!
+
+findLastObjectHandleAt:aPoint
+
+    ^ contents detectLast:[:object|
+        (self object:object hasHandleAt:aPoint) 
+    ] ifNone:nil
+!
+
+findLastObjectHandleAt:aPoint suchThat:aBlock
+
+    contents reverseDo:[:object |
+        (self object:object hasHandleAt:aPoint) ifTrue:[
+            (aBlock value:object) ifTrue:[ ^ object ]
+        ]
+    ].
+    ^ nil
+!
+
 findObjectHandleAt:aPoint
     |objectFound|
     contents do:[:object |
-	(self object:object hasHandle:aPoint) ifTrue:[
-	    objectFound := object
-	]
+        (self object:object hasHandleAt:aPoint) ifTrue:[
+            objectFound := object
+        ]
     ].
     ^ objectFound
 !
@@ -3103,7 +3156,7 @@
     "round aPoint to the next nearest point on the grid"
 
     aligning ifFalse:[
-	^ aPoint
+        ^ aPoint
     ].
 
     ^ (aPoint grid:gridAlign) rounded
@@ -3273,5 +3326,5 @@
 !ObjectView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.97 2003-05-07 14:44:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.98 2003-07-30 06:09:59 tm Exp $'
 ! !