use new #translatePoint:fromView:toView:
authorClaus Gittinger <cg@exept.de>
Wed, 10 Oct 2001 15:40:15 +0200
changeset 2435 a47df77ac405
parent 2434 a9b9d8f2ab5b
child 2436 7c0da88f2af6
use new #translatePoint:fromView:toView:
ObjectView.st
--- a/ObjectView.st	Wed Oct 10 15:10:13 2001 +0200
+++ b/ObjectView.st	Wed Oct 10 15:40:15 2001 +0200
@@ -632,8 +632,9 @@
      views and relative offsets, then dispatch to one of the endLineDrag methods.
      These can be redefined in subclasses to allow connect between views."
 
-    |rootPoint viewId offs 
-     lastViewId destinationId destinationView destinationPoint inMySelf|
+    |rootPoint viewId offs transformation2
+     lastViewId destinationId destinationView destinationPoint 
+     inMySelf dragOrigin|
 
     self invertDragLine.
 
@@ -648,16 +649,15 @@
         transformation notNil ifTrue:[
             rootPoint := transformation applyTo:rootPoint.
         ].
-        viewId := rootView id.
 
         "
          translate to screen
         "
-        offs := device translatePoint:0@0 from:(self id) to:viewId.
+        offs := device translatePoint:0@0 fromView:self toView:rootView.
         rootPoint := rootPoint + offs.
 
         "search view the drop is in"
-
+        viewId := rootView id.
         [viewId notNil] whileTrue:[
             destinationId := device viewIdFromPoint:rootPoint in:viewId.
             lastViewId := viewId.
@@ -671,31 +671,32 @@
         inMySelf := true
     ].
 
+    dragOrigin := dragObject origin.
     inMySelf ifTrue:[
         "a simple line within myself"
-        self lineDragFrom:dragObject origin to:dragObject corner
+        self lineDragFrom:dragOrigin to:dragObject corner
     ] ifFalse:[
         "into another one"
         destinationView notNil ifTrue:[
-            destinationPoint := device translatePoint:rootPoint from:(rootView id) to:(destinationView id).
-            destinationView transformation notNil ifTrue:[
-                destinationPoint := destinationView transformation applyInverseTo:destinationPoint
+            destinationPoint := device translatePoint:rootPoint fromView:rootView toView:destinationView.
+            (transformation2 := destinationView transformation) notNil ifTrue:[
+                destinationPoint := transformation2 applyInverseTo:destinationPoint
             ].
             "
              move into another smalltalk view
             "
-            self lineDragFrom:dragObject origin to:destinationPoint in:destinationView
+            self lineDragFrom:dragOrigin to:destinationPoint in:destinationView
         ] ifFalse:[
             "
              not one of my views
             "
-            self lineDragFrom:dragObject origin
-                           to:destinationPoint 
-                           inAlienViewId:destinationId
+            self lineDragFrom:dragOrigin to:destinationPoint inAlienViewId:destinationId
         ] 
     ].
     self setDefaultActions.
     dragObject := nil
+
+    "Modified: / 10.10.2001 / 14:41:52 / cg"
 !
 
 invertDragLine
@@ -719,7 +720,7 @@
         "
          translate to screen
         "
-        offs := device translatePoint:0@0 from:(self id) to:(rootView id).
+        offs := device translatePoint:0@0 fromView:self toView:rootView.
         p1 := p1 + offs.
         p2 := p2 + offs.
     ] ifFalse:[
@@ -732,7 +733,7 @@
         dragger flush
     ].
 
-    "Modified: 16.12.1995 / 17:32:56 / cg"
+    "Modified: / 10.10.2001 / 13:59:05 / cg"
 !
 
 lineDragFrom:startPoint to:endPoint
@@ -839,66 +840,68 @@
      one of the moveObjectXXX-methods which should do the real move. 
      These can be redefined in subclasses."
 
-    |inMySelf rootPoint destinationPoint p
+    |inMySelf rootPoint destinationPoint p transformation2
      viewId destinationView destinationId lastViewId|
 
     movedObject notNil ifTrue:[
-	self invertDragObject:movedObject delta:moveDelta.    
-
-	"check if object is to be put into another view"
-	rootMotion ifTrue:[
-	    p := lastButt.
-	    "
-	     get device coordinates
-	    "
-	    transformation notNil ifTrue:[
-		p := transformation applyTo:p.
-	    ].
-	    viewId := rootView id.
-	    "
-	     translate to screen
-	    "
-	    rootPoint := p + (device translatePoint:0@0 from:(self id) to:viewId).
-
-	    "search view the drop is in"
-	    [viewId notNil] whileTrue:[
-		destinationId := device viewIdFromPoint:rootPoint in:viewId.
-		lastViewId := viewId.
-		viewId := destinationId
-	    ].
-	    destinationView := device viewFromId:lastViewId.
-	    destinationId := lastViewId.
-	    inMySelf := (destinationView == self).
-	    rootMotion := false
-	] ifFalse:[
-	    inMySelf := true
-	].
-
-	inMySelf ifTrue:[
-	    "simple move"
-	    self move:movedObject by:moveDelta
-	] ifFalse:[
-	    destinationPoint := device translatePoint:rootPoint
-						 from:(rootView id) 
-						   to:destinationId.
-	    destinationView notNil ifTrue:[
-		destinationView transformation notNil ifTrue:[
-		    destinationPoint := destinationView transformation applyInverseTo:destinationPoint
-		].
-		"
-		 move into another smalltalk view
-		"
-		self move:movedObject to:destinationPoint in:destinationView
-	    ] ifFalse:[
-		"
-		 not one of my views
-		"
-		self move:movedObject to:destinationPoint inAlienViewId:destinationId
-	    ] 
-	].
-	self setDefaultActions.
-	movedObject := nil
+        self invertDragObject:movedObject delta:moveDelta.    
+
+        "check if object is to be put into another view"
+        rootMotion ifTrue:[
+            p := lastButt.
+            "
+             get device coordinates
+            "
+            transformation notNil ifTrue:[
+                p := transformation applyTo:p.
+            ].
+            "
+             translate to screen
+            "
+            rootPoint := p + (device translatePoint:0@0 fromView:self toView:rootView).
+
+            "search view the drop is in"
+            viewId := rootView id.
+            [viewId notNil] whileTrue:[
+                destinationId := device viewIdFromPoint:rootPoint in:viewId.
+                lastViewId := viewId.
+                viewId := destinationId
+            ].
+            destinationView := device viewFromId:lastViewId.
+            destinationId := lastViewId.
+            inMySelf := (destinationView == self).
+            rootMotion := false
+        ] ifFalse:[
+            inMySelf := true
+        ].
+
+        inMySelf ifTrue:[
+            "simple move"
+            self move:movedObject by:moveDelta
+        ] ifFalse:[
+            destinationPoint := device translatePoint:rootPoint        "/ use id here - could be alian view
+                                                 from:(rootView id) 
+                                                   to:destinationId.
+            destinationView notNil ifTrue:[
+                (transformation2 := destinationView transformation) notNil ifTrue:[
+                    destinationPoint := transformation2 applyInverseTo:destinationPoint
+                ].
+                "
+                 move into another smalltalk view
+                "
+                self move:movedObject to:destinationPoint in:destinationView
+            ] ifFalse:[
+                "
+                 not one of my views
+                "
+                self move:movedObject to:destinationPoint inAlienViewId:destinationId
+            ] 
+        ].
+        self setDefaultActions.
+        movedObject := nil
     ]
+
+    "Modified: / 10.10.2001 / 14:43:09 / cg"
 !
 
 invertDragObject:movedObject delta:moveDelta
@@ -921,7 +924,7 @@
         "
          translate to screen
         "
-        offs := device translatePoint:0@0 from:(self id) to:(rootView id).
+        offs := device translatePoint:0@0 fromView:self toView:rootView.
 "/ 'offs' print. offs printNL.
         p := p + offs.
 "/ 'screen ' print. p printNL.
@@ -953,7 +956,7 @@
         self flush
     ].
 
-    "Modified: 16.12.1995 / 17:33:04 / cg"
+    "Modified: / 10.10.2001 / 13:59:19 / cg"
 !
 
 setMoveActions
@@ -3243,5 +3246,5 @@
 !ObjectView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.87 2001-07-10 18:57:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.88 2001-10-10 13:40:15 cg Exp $'
 ! !