diff -r 626e8241dc76 -r 1612c23d9c5d DragAndDropManager.st --- a/DragAndDropManager.st Sat Oct 26 19:06:50 1996 +0200 +++ b/DragAndDropManager.st Sat Oct 26 19:17:33 1996 +0200 @@ -52,7 +52,8 @@ self invertGenericAt:previousPoint ]. previousPoint := nil. - self uncatchEvents + self uncatchEvents. + self endDragAt:x @ y "Created: 26.10.1996 / 15:17:20 / cg" "Modified: 26.10.1996 / 15:22:41 / cg" @@ -121,7 +122,8 @@ self invertLineFrom:initialPoint to:previousPoint ]. previousPoint := nil. - self uncatchEvents + self uncatchEvents. + self endDragAt:x @ y "Created: 26.10.1996 / 15:17:20 / cg" "Modified: 26.10.1996 / 15:22:41 / cg" @@ -240,9 +242,64 @@ "Modified: 26.10.1996 / 15:21:57 / cg" ! +endDragAt:ip + |rootPoint t viewId offs destinationId lastViewId destinationView + rootView destinationPoint device| + + dropAction notNil ifTrue:[ + device := dragView device. + rootView := device rootView. + rootPoint := ip. + + " + get device coordinates + " + (t := dragView transformation) notNil ifTrue:[ + rootPoint := t applyTo:ip. + ]. + viewId := rootView id. + + " + translate to screen + " + offs := device translatePoint:0@0 from:(dragView id) to:viewId. + rootPoint := rootPoint + offs. + + "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. + + "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 + ]. + ] ifFalse:[ + " + not one of my views + " + ]. + + dropAction value:destinationView + value:destinationId + value:rootPoint + value:destinationPoint + ] + + +! + uncatchEvents dragView delegate:rememberedDelegate. - dragView := nil. "Created: 26.10.1996 / 15:22:29 / cg" ! ! @@ -251,7 +308,22 @@ buttonPress:button x:x y:y DragAndDropManager new - startLineDragIn:self at:(x@y) atEnd:[:v :id :p | ]. + startLineDragIn:self at:(x@y) + atEnd:[:view + :viewID + :rootPoint + :viewPoint | + + Transcript show:'dropped at '; + show:viewPoint; + show:' in '. + view notNil ifTrue:[ + Transcript showCR:view + ] ifFalse:[ + Transcript show:'alien view '; + showCR:viewID address + ] + ]. " self new open @@ -265,7 +337,10 @@ startGenericDrag:[:p | device rootView displayString:'hello' at:p] in:self at:(x@y) - atEnd:[:v :id :p | ] + atEnd:[:view + :viewID + :rootPoint + :viewPoint | ] " @@ -281,7 +356,10 @@ DragAndDropManager new startArrowDragIn:self at:(x@y) - atEnd:[:v :id :p | ] + atEnd:[:view + :viewID + :rootPoint + :viewPoint | ] " self new open @@ -291,5 +369,5 @@ !DragAndDropManager class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.4 1996-10-26 17:06:50 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.5 1996-10-26 17:17:33 cg Exp $' ! !