DragAndDropManager.st
changeset 609 1343bda17876
parent 549 51c6f1d918c2
child 628 22085aaf983c
--- a/DragAndDropManager.st	Tue Jun 17 18:09:03 1997 +0200
+++ b/DragAndDropManager.st	Wed Jun 18 10:22:15 1997 +0200
@@ -21,7 +21,7 @@
 	category:'Interface-Support'
 !
 
-View subclass:#DemoView
+View subclass:#DemoView2
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
@@ -35,7 +35,7 @@
 	privateIn:DragAndDropManager
 !
 
-View subclass:#DemoView2
+View subclass:#DemoView
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
@@ -929,6 +929,20 @@
     "/
     destinationPoint := device translatePoint:rootPoint from:rootId to:destinationId.
 
+    "/
+    "/ if the destinationView has a transformation,
+    "/ also translate to logical coordinates ..
+    "/
+    destinationView notNil ifTrue:[
+        (t := destinationView transformation) notNil ifTrue:[
+            destinationPoint := t applyInverseTo:destinationPoint
+        ]
+    ].
+
+    "/
+    "/ if this dragOperation has an explicit dropAction,
+    "/ perform it.
+    "/
     dropAction notNil ifTrue:[
         "/ initiator wants to do it himself, manually.
 
@@ -947,19 +961,18 @@
         "/
         "/ one of my views
         "/
-        destinationPoint := device translatePoint:rootPoint
-                                             from:(rootView id) 
-                                               to:(destinationView id).
-        destinationView transformation notNil ifTrue:[
-            destinationPoint := destinationView transformation applyInverseTo:destinationPoint
-        ].
 
+        "/
+        "/ see if the view itself can drop that stuff ...
+        "/
         (destinationView canDrop:dropObjects) ifTrue:[
             destinationView drop:dropObjects at:destinationPoint.
             ^ self.
         ].
 
+        "/
         "/ try superViews along the chain ...
+        "/
         destinationView := destinationView superView.
         [destinationView notNil] whileTrue:[
             (destinationView canDrop:dropObjects) ifTrue:[
@@ -975,14 +988,14 @@
     "/ not one of my views
     "/
 
-    "/ XXX add external clipboard mechanism via display
+    "/ external clipboard mechanism via display
     device 
         drop:dropObjects 
         inWindowID:destinationId 
         position:destinationPoint 
         rootPosition:rootPoint
 
-    "Modified: 19.4.1997 / 12:36:29 / cg"
+    "Modified: 18.6.1997 / 10:19:59 / cg"
 !
 
 uncatchEvents
@@ -997,51 +1010,44 @@
     "
 ! !
 
-!DragAndDropManager::DemoView class methodsFor:'documentation'!
+!DragAndDropManager::DemoView2 class methodsFor:'documentation'!
 
 documentation
 "
-    demonstrates rubber-line dragging.
+    demonstrates string dragging.
 
     See the buttonPress method, where a drag is initiated.
     At endDrop, look at the transcript.
 
+
     [author:]
         Claus Gittinger
 
     [start with:]
-        DemoView new open
+        DemoView2 new open
 "
+
+
 ! !
 
-!DragAndDropManager::DemoView methodsFor:'events'!
+!DragAndDropManager::DemoView2 methodsFor:'events'!
 
 buttonPress:button x:x y:y
     DragAndDropManager new
-        startLineDragIn:self at:(x@y) 
+        startGenericDrag:[:p :v | v displayString:'hello' at:p]
+        in:self 
+        at:(x@y) 
         atEnd:[:view
                :viewID
                :rootPoint
-               :viewPoint | 
+               :viewPoint | ]
 
-               Transcript show:'dropped at ';
-                          show:viewPoint;
-                          show:' (screen: ';
-                          show:rootPoint;
-                          show:') in '.
-               view notNil ifTrue:[
-                   Transcript showCR:view
-               ] ifFalse:[
-                   Transcript show:'alien view ';
-                              showCR:viewID address
-               ] 
-        ].
 
     "
      self new open
     "
 
-    "Modified: 19.4.1997 / 11:40:46 / cg"
+
 ! !
 
 !DragAndDropManager::DemoView3 class methodsFor:'documentation'!
@@ -1094,48 +1100,55 @@
     "Modified: 19.4.1997 / 12:45:29 / cg"
 ! !
 
-!DragAndDropManager::DemoView2 class methodsFor:'documentation'!
+!DragAndDropManager::DemoView class methodsFor:'documentation'!
 
 documentation
 "
-    demonstrates string dragging.
+    demonstrates rubber-line dragging.
 
     See the buttonPress method, where a drag is initiated.
     At endDrop, look at the transcript.
 
-
     [author:]
         Claus Gittinger
 
     [start with:]
-        DemoView2 new open
+        DemoView new open
 "
-
-
 ! !
 
-!DragAndDropManager::DemoView2 methodsFor:'events'!
+!DragAndDropManager::DemoView methodsFor:'events'!
 
 buttonPress:button x:x y:y
     DragAndDropManager new
-        startGenericDrag:[:p :v | v displayString:'hello' at:p]
-        in:self 
-        at:(x@y) 
+        startLineDragIn:self at:(x@y) 
         atEnd:[:view
                :viewID
                :rootPoint
-               :viewPoint | ]
+               :viewPoint | 
 
+               Transcript show:'dropped at ';
+                          show:viewPoint;
+                          show:' (screen: ';
+                          show:rootPoint;
+                          show:') in '.
+               view notNil ifTrue:[
+                   Transcript showCR:view
+               ] ifFalse:[
+                   Transcript show:'alien view ';
+                              showCR:viewID address
+               ] 
+        ].
 
     "
      self new open
     "
 
-
+    "Modified: 19.4.1997 / 11:40:46 / cg"
 ! !
 
 !DragAndDropManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.14 1997-04-19 15:24:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.15 1997-06-18 08:22:15 cg Exp $'
 ! !