ObjectView.st
changeset 38 4b9b70b2cc87
parent 24 966098a893f8
child 59 450ce95a72a4
--- a/ObjectView.st	Sun Aug 07 15:22:53 1994 +0200
+++ b/ObjectView.st	Sun Aug 07 15:23:42 1994 +0200
@@ -42,7 +42,7 @@
 this is an abstract class providing common mechanisms - actual instances are
 DrawView, DirectoryView, LogicView or DocumentView.
 
-$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.7 1994-01-13 00:17:22 claus Exp $
+$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.8 1994-08-07 13:22:59 claus Exp $
 written spring/summer 89 by claus
 '!
 
@@ -170,6 +170,7 @@
     "redraw the grid"
 
     gridPixmap notNil ifTrue:[
+        self paint:Black on:White.
         self displayOpaqueForm:gridPixmap x:0 y:0
     ]
 !
@@ -733,19 +734,20 @@
     |oldOrigin oldFrame newFrame 
      objectsIntersectingOldFrame objectsIntersectingNewFrame 
      wasObscured isObscured intersects
-     vx vy oldLeft oldTop w h newLeft newTop|
+     vx vy oldLeft oldTop w h newLeft newTop griddedNewOrigin|
 
     anObject isNil ifTrue:[^ self].
     anObject canBeMoved ifFalse:[^ self].
 
+    griddedNewOrigin := self alignToGrid:newOrigin.
     oldOrigin := anObject origin.
-    (oldOrigin = newOrigin) ifTrue:[^ self].
+    (oldOrigin = griddedNewOrigin) ifTrue:[^ self].
 
     oldFrame := self frameOf:anObject.
     objectsIntersectingOldFrame := self objectsIntersecting:oldFrame.
     wasObscured := self isObscured:anObject.
 
-    anObject moveTo:newOrigin.
+    anObject moveTo:griddedNewOrigin.
 
     newFrame := self frameOf:anObject.
     objectsIntersectingNewFrame := self objectsIntersecting:newFrame.
@@ -1422,7 +1424,7 @@
     gridH := (self heightOfContentsInMM * mmV + 1) asInteger.
     gridPixmap := Form width:gridW height:gridH depth:(device depth).
     gridPixmap fill:viewBackground.
-    gridPixmap paint:paint.
+    gridPixmap paint:Black.
 
     "draw first row point-by-point"
     yp := 0.0.
@@ -1651,32 +1653,36 @@
 doObjectMove:aPoint
     "do an object move"
 
-    |dragger offs2 newPoint|
+    |dragger offs2|
 
     canDragOutOfView ifTrue:[
         dragger := rootView.
         offs2 := viewOrigin.
-        newPoint := aPoint
     ] ifFalse:[
         dragger := self.
         offs2 := 0@0.
-        newPoint := self alignToGrid:aPoint.
     ].
     movedObject isNil ifTrue:[
         movedObject := selection.
+        "
+         draw first outline
+        "
         movedObject notNil ifTrue:[
             moveDelta := 0@0.
             dragger xoring:[
-                self showDragging:movedObject
-                           offset:(moveDelta - offs2)
+                self showDragging:movedObject offset:(self alignToGrid:(moveDelta - offs2)) 
             ]
         ]
     ].
     movedObject notNil ifTrue:[
+        "
+         clear prev outline,
+         draw new outline
+        "
         dragger xoring:[
-            self showDragging:movedObject offset:(moveDelta - offs2).
-            moveDelta := newPoint - moveStartPoint.
-            self showDragging:movedObject offset:(moveDelta - offs2)
+            self showDragging:movedObject offset:(self alignToGrid:(moveDelta - offs2)).
+            moveDelta := aPoint - moveStartPoint.
+            self showDragging:movedObject offset:(self alignToGrid:(moveDelta - offs2))
         ]
     ]
 !
@@ -1695,8 +1701,10 @@
             dragger := self.
             offs2 := 0@0
         ].
-        dragger xoring:[self showDragging:movedObject 
-                                   offset:(moveDelta - offs2)].
+        dragger xoring:[
+            self showDragging:movedObject 
+                       offset:(self alignToGrid:(moveDelta - offs2))
+        ].
         dragger device synchronizeOutput.
 
         "check if object is to be put into another view"
@@ -1726,12 +1734,15 @@
                                                  from:(rootView id) 
                                                    to:destinationId.
             destinationView notNil ifTrue:[
-                "move into another smalltalk view"
-                self move:movedObject to:destinationPoint
-                                      in:destinationView
+                "
+                 move into another smalltalk view
+                "
+                self move:movedObject to:destinationPoint in:destinationView
             ] ifFalse:[
-                self move:movedObject to:destinationPoint
-                           inAlienViewId:destinationId
+                "
+                 not one of my views
+                "
+                self move:movedObject to:destinationPoint inAlienViewId:destinationId
             ] 
         ].
         self setDefaultActions.
@@ -1744,7 +1755,7 @@
 buttonPress:button x:x y:y
     "user pressed left button"
 
-    (button == 1) ifTrue:[
+    ((button == 1) or:[button == #select]) ifTrue:[
         pressAction notNil ifTrue:[
             lastButt := x @ y.
             pressAction value:lastButt
@@ -1757,7 +1768,7 @@
 buttonShiftPress:button x:x y:y
     "user pressed left button with shift"
 
-    (button == 1) ifTrue:[
+    ((button == 1) or:[button == #select]) ifTrue:[
         shiftPressAction notNil ifTrue:[
             lastButt := x @ y.
             shiftPressAction value:lastButt
@@ -1770,7 +1781,7 @@
 buttonMultiPress:button x:x y:y
     "user pressed left button twice (or more)"
 
-    (button == 1) ifTrue:[
+    ((button == 1) or:[button == #select]) ifTrue:[
         doublePressAction notNil ifTrue:[
             doublePressAction value:(x @ y)
         ]
@@ -1817,7 +1828,7 @@
 !
 
 buttonRelease:button x:x y:y
-    (button == 1) ifTrue: [
+    ((button == 1) or:[button == #select]) ifTrue:[
         releaseAction notNil ifTrue:[releaseAction value]
     ] ifFalse:[
         super buttonRelease:button x:x y:y
@@ -1875,7 +1886,7 @@
 !
 
 initializeFileInObject:anObject
-    "each object may be processed here after its beeing filed-in
+    "each object may be processed here after its being filed-in
      - subclasses may do whatever they want here ...
      (see LogicView for example)"