drag and drop cleanup
authorClaus Gittinger <cg@exept.de>
Fri, 13 Oct 2006 17:58:31 +0200
changeset 2118 caee73c7b7dd
parent 2117 3d456b890124
child 2119 e88e67db6f3d
drag and drop cleanup
MenuEditor.st
--- a/MenuEditor.st	Fri Oct 13 17:58:13 2006 +0200
+++ b/MenuEditor.st	Fri Oct 13 17:58:31 2006 +0200
@@ -1947,11 +1947,13 @@
 
 !MenuEditor methodsFor:'drag & drop'!
 
-canDrop:aContext
+canDrop:aDropContext
     "return true, if the DropContext can be dropped into the list of items.
      The dropable objects are already validated by: #dropEnter:"
 
     ^ (dropOverLine notNil and:[dropOverLine ~~ 0])
+
+    "Modified: / 13-10-2006 / 16:03:47 / cg"
 !
 
 changeDropLineTo:aLineOrNil in:aContext
@@ -1992,7 +1994,7 @@
     ].
 !
 
-doDrop:aContext
+doDrop:aDropContext
     "drop the dropContext into the hierachical list of items
     "
     |done item|
@@ -2000,7 +2002,7 @@
     dropOverLine ifNil:[^ false ].      "/ context not valid to me ...
 
     item := listOfItems at:dropOverLine ifAbsent:nil.
-    self dropLeave:aContext.
+    self dropLeave:aDropContext.
     item ifNil:[^ false].
 
     selectionHolder setValue:(Array with:item).
@@ -2009,12 +2011,14 @@
 
     self addAndSelectValueOf:[
         done := true.
-        aContext dropObjects collect:[:el| Item menuItem:(el theObject) ]
+        aDropContext dropObjects collect:[:el| Item menuItem:(el theObject) ]
     ].
     ^ done
-!
-
-dropEnter:aContext
+
+    "Modified: / 13-10-2006 / 16:03:54 / cg"
+!
+
+dropEnter:aDropContext
     "a drop operation enters my widget; validate dropable objects.
      If the objects are not dropable, dropOverLine is set to nil,
      otherwise to 0 (can drop the contents but not).
@@ -2027,7 +2031,7 @@
         "/ current editing spec is modified (couldn't accept operation)
         ^ self
     ].
-    objects := aContext dropObjects.
+    objects := aDropContext dropObjects.
     objects isEmpty ifTrue:[ ^ self ].  "/ nothing to drop ???
 
     "/ test whether all objects are dropable (kind of MenuItem)
@@ -2036,13 +2040,15 @@
         dropOverLine := 0.
     ]
 
-    "Modified: / 13-10-2006 / 12:57:06 / cg"
-!
-
-dropLeave:aContext
+    "Modified: / 13-10-2006 / 16:04:14 / cg"
+!
+
+dropLeave:aDropContext
     "the widget is leaved; restore drop indications drawn ...
     "
-    self changeDropLineTo:nil in:aContext.
+    self changeDropLineTo:nil in:aDropContext.
+
+    "Modified: / 13-10-2006 / 16:03:59 / cg"
 !
 
 dropObjects
@@ -2060,14 +2066,14 @@
     ].
 !
 
-dropOver:aContext
+dropOver:aDropContext
     "called during drag & drop while moving over the widget."
 
     |lnNr item|
 
     dropOverLine ifNil:[^ self ].       "/ context not valid to me ...
 
-    lnNr := listOfItemsView yVisibleToLineNr:(aContext targetPoint y).
+    lnNr := listOfItemsView yVisibleToLineNr:(aDropContext targetPoint y).
     item := nil.
 
     lnNr ifNotNil:[
@@ -2081,7 +2087,9 @@
     item ifNil:[ lnNr := 0 ].   "/ not dropable for item
 
     "/ redraw drop indication
-    self changeDropLineTo:lnNr in:aContext.
+    self changeDropLineTo:lnNr in:aDropContext.
+
+    "Modified: / 13-10-2006 / 16:04:05 / cg"
 ! !
 
 !MenuEditor methodsFor:'event processing'!