UIObjectView.st
changeset 2514 faf45b01db30
parent 2513 1c2ac34566ab
child 2516 6c0bc4ed2d88
--- a/UIObjectView.st	Mon May 11 10:54:14 2009 +0200
+++ b/UIObjectView.st	Mon May 11 11:52:33 2009 +0200
@@ -765,11 +765,10 @@
 !UIObjectView methodsFor:'object moving'!
 
 doObjectMove:aPoint
-    "move selection"
+    "move movedOject (which is a misnomer - its actually a collection of objects to move)"
 
     movedObject notNil ifTrue:[
         self hideSelection.
-        self repairDamage.
 
         self invertOutlineOf:movedObject.
 
@@ -779,7 +778,6 @@
         self invertOutlineOf:movedObject.
 
         self showSelection.
-        self repairDamage.
     ]
 !
 
@@ -814,8 +812,8 @@
 !
 
 moveObject:anObject to:aPoint
-    "move anObject to newOrigin, aPoint
-    "
+    "move anObject to newOrigin, aPoint"
+
     |dX dY org delta|
 
     anObject notNil ifTrue:[
@@ -827,7 +825,7 @@
         dY := delta y.
 
         undoHistory withoutTransactionDo:[
-            self shiftLayout:anObject top:dY bottom:dY left:dX right:dX
+            self shiftLayout:anObject horizontal:dX vertical:dY
         ]
     ]
 !
@@ -983,8 +981,8 @@
 
     object := resizeData object.
 
-self hideSelection.
-self repairDamage.
+    self hideSelection.
+
     self invertOutlineOf:object.
     p := (self alignToGrid:aPoint) - (resizeData delta).
 
@@ -997,8 +995,7 @@
    "/ object geometryLayout:(object geometryLayout).
     self invertOutlineOf:object.
 
-self showSelection.
-self repairDamage.
+    self showSelection.
 !
 
 endResize
@@ -1199,12 +1196,17 @@
 shiftLayout:aViewOrComponent horizontal:n
     "shift layout for a view; in case of an open transaction, the undo action is registered"
 
-    (aViewOrComponent isKindOf:LineSegmentMorph) ifTrue:[
-        self shiftLayout:aViewOrComponent 
-             startPoint:(n @ 0) endPoint:(n @ 0)
+    self shiftLayout:aViewOrComponent horizontal:n vertical:0
+!
+
+shiftLayout:aViewOrComponent horizontal:h vertical:v
+    "shift layout for a view; in case of an open transaction, the undo action is registered"
+
+    (self specFor:aViewOrComponent) hasLayout ifTrue:[
+        self shiftLayout:aViewOrComponent top:v bottom:v left:h right:h
     ] ifFalse:[
-        self shiftLayout:aViewOrComponent top:0 bottom:0 left:n right:n
-    ]
+        self shiftLayout:aViewOrComponent startPoint:(h @ v) endPoint:(h @ v)
+    ].
 !
 
 shiftLayout:aView left:l right:r
@@ -1271,12 +1273,7 @@
 shiftLayout:aViewOrComponent vertical:n
     "shift layout for a view; in case of an open transaction, the undo action is registered"
 
-    (aViewOrComponent isKindOf:LineSegmentMorph) ifTrue:[
-        self shiftLayout:aViewOrComponent 
-             startPoint:(0 @ n) endPoint:(0 @ n)
-    ] ifFalse:[
-        self shiftLayout:aViewOrComponent top:n bottom:n left:0 right:0
-    ].
+    self shiftLayout:aViewOrComponent horizontal:0 vertical:n
 ! !
 
 !UIObjectView methodsFor:'searching'!
@@ -1344,7 +1341,9 @@
 hideSelection
     "hide the selection - undraw hilights - whatever that is
     "
-super hideSelection.
+
+    super hideSelection.
+    self repairDamage.   
 "/    self showUnselected:selection.
 !
 
@@ -1411,7 +1410,8 @@
     "show the selection - draw handles"
 
     selectionHiddenLevel == 0 ifTrue:[
-        super showSelection
+        super showSelection.
+        self repairDamage.   
     ].
 !
 
@@ -1472,16 +1472,14 @@
     selectionHiddenLevel := selectionHiddenLevel + 1.
 
     aBlock ensure:[
-        selectionHiddenLevel == 1 ifTrue:[
+        selectionHiddenLevel := selectionHiddenLevel - 1.
+        selectionHiddenLevel == 0 ifTrue:[
             setOfSuperViewsSizeChanged notEmpty ifTrue:[
                 coll := self minClosedViewSetFor:setOfSuperViewsSizeChanged.
                 coll do:[:aView| aView sizeChanged:nil].
                 setOfSuperViewsSizeChanged := IdentitySet new
             ].
-            selectionHiddenLevel := 0.
-            self selectionDo:[:aView| self showSelected:aView].
-        ] ifFalse:[
-            selectionHiddenLevel := selectionHiddenLevel - 1.
+            self showSelection.
         ]
     ]
 !