--- a/MenuEditor.st Wed Aug 09 12:03:27 2000 +0200
+++ b/MenuEditor.st Wed Aug 09 12:18:11 2000 +0200
@@ -3294,6 +3294,31 @@
!MenuEditor::TreeView methodsFor:'menus'!
+XXdoDeleteSelectionBuffered:aBool
+ |appl idx|
+
+ appl := self topView application.
+
+ (appl hasValidSelection value and: [self askForItemModification]) ifFalse:[
+ ^ self
+ ].
+ aBool ifTrue:[
+ self doCopy
+ ].
+
+ idx := 10000.
+ self selection do:[:aNumber| idx := idx min:aNumber ].
+
+ self selectedNodesRemove.
+ self selection:(idx min:(self list size)).
+ self setModified.
+
+ aBool ifTrue:[
+ "/ must update copy&paste indication
+ appl updateAllToolInstances.
+ ]
+!
+
doCopy
|clip|
@@ -3385,35 +3410,43 @@
!
doCut
- |app|
-
- app := self topView application.
- (app hasValidSelection value and: [self askForItemModification])
- ifTrue:
- [
- |selectedNodes|
- self doCopy.
- selectedNodes := self selection asSortedCollection.
- self selectedNodesRemove.
- self selection: selectedNodes first - 1.
- self setModified.
- app updateAllToolInstances.
- ]
-
+ ^ self doDeleteSelectionBuffered:true
!
doDelete
-
- (self topView application hasValidSelection value and: [self askForItemModification])
- ifTrue:
- [
- |selectedNodes|
- selectedNodes := self selection asSortedCollection.
- self selectedNodesRemove.
- self selection: selectedNodes first - 1.
- self setModified.
+ ^ self doDeleteSelectionBuffered:false
+!
+
+doDeleteSelectionBuffered:aBool
+ |appl nsel list item prnt|
+
+ appl := self topView application.
+
+ (appl hasValidSelection value and: [self askForItemModification]) ifFalse:[
+ ^ self
+ ].
+ aBool ifTrue:[
+ self doCopy
+ ].
+ list := self list.
+ nsel := list size.
+ self selection do:[:aNumber| nsel := nsel min:aNumber ].
+
+ ( (item := list at:nsel ifAbsent:nil) notNil
+ and:[(prnt := item parent) notNil
+ and:[prnt children last == item]]
+ ) ifTrue:[
+ nsel := nsel - 1
+ ].
+
+ self selectedNodesRemove.
+ self selection:(nsel min:(list size)).
+ self setModified.
+
+ aBool ifTrue:[
+ "/ must update copy&paste indication
+ appl updateAllToolInstances.
]
-
!
doPaste