MenuEditor.st
changeset 1389 85a41c80e8dc
parent 1378 5643f9638250
child 1400 891c5c044e33
equal deleted inserted replaced
1388:c5559ad5c09e 1389:85a41c80e8dc
  3292     self model labelAction: [:aNode| aNode contents treeViewLabel]
  3292     self model labelAction: [:aNode| aNode contents treeViewLabel]
  3293 ! !
  3293 ! !
  3294 
  3294 
  3295 !MenuEditor::TreeView methodsFor:'menus'!
  3295 !MenuEditor::TreeView methodsFor:'menus'!
  3296 
  3296 
       
  3297 XXdoDeleteSelectionBuffered:aBool
       
  3298     |appl idx|
       
  3299 
       
  3300     appl := self topView application.
       
  3301 
       
  3302     (appl hasValidSelection value and: [self askForItemModification]) ifFalse:[
       
  3303         ^ self
       
  3304     ].
       
  3305     aBool ifTrue:[
       
  3306         self doCopy
       
  3307     ].
       
  3308 
       
  3309     idx := 10000.
       
  3310     self selection do:[:aNumber| idx := idx min:aNumber ].
       
  3311 
       
  3312     self selectedNodesRemove.
       
  3313     self selection:(idx min:(self list size)).
       
  3314     self setModified.
       
  3315 
       
  3316     aBool ifTrue:[
       
  3317         "/ must update copy&paste indication
       
  3318         appl updateAllToolInstances.
       
  3319     ]
       
  3320 !
       
  3321 
  3297 doCopy
  3322 doCopy
  3298     |clip|
  3323     |clip|
  3299 
  3324 
  3300     self hasSelection ifTrue:[
  3325     self hasSelection ifTrue:[
  3301         self application clipboard:(clip := OrderedCollection new).
  3326         self application clipboard:(clip := OrderedCollection new).
  3383     "Created: / 23.8.1998 / 15:52:46 / cg"
  3408     "Created: / 23.8.1998 / 15:52:46 / cg"
  3384     "Modified: / 23.8.1998 / 17:30:12 / cg"
  3409     "Modified: / 23.8.1998 / 17:30:12 / cg"
  3385 !
  3410 !
  3386 
  3411 
  3387 doCut
  3412 doCut
  3388     |app|
  3413     ^ self doDeleteSelectionBuffered:true
  3389 
  3414 !
  3390     app := self topView application.
  3415 
  3391     (app hasValidSelection value and: [self askForItemModification])
  3416 doDelete
  3392     ifTrue:
  3417     ^ self doDeleteSelectionBuffered:false
  3393     [
  3418 !
  3394         |selectedNodes|
  3419 
  3395         self doCopy.
  3420 doDeleteSelectionBuffered:aBool
  3396         selectedNodes := self selection asSortedCollection.
  3421     |appl nsel list item prnt|
  3397         self selectedNodesRemove.
  3422 
  3398         self selection: selectedNodes first - 1.
  3423     appl := self topView application.
  3399         self setModified.
  3424 
  3400         app updateAllToolInstances.
  3425     (appl hasValidSelection value and: [self askForItemModification]) ifFalse:[
       
  3426         ^ self
       
  3427     ].
       
  3428     aBool ifTrue:[
       
  3429         self doCopy
       
  3430     ].
       
  3431     list := self list.
       
  3432     nsel := list size.
       
  3433     self selection do:[:aNumber| nsel := nsel min:aNumber ].
       
  3434 
       
  3435     (     (item := list at:nsel ifAbsent:nil) notNil
       
  3436      and:[(prnt := item parent) notNil
       
  3437      and:[prnt children last == item]]
       
  3438     ) ifTrue:[
       
  3439         nsel := nsel - 1
       
  3440     ].
       
  3441 
       
  3442     self selectedNodesRemove.
       
  3443     self selection:(nsel min:(list size)).
       
  3444     self setModified.
       
  3445 
       
  3446     aBool ifTrue:[
       
  3447         "/ must update copy&paste indication
       
  3448         appl updateAllToolInstances.
  3401     ]
  3449     ]
  3402 
       
  3403 !
       
  3404 
       
  3405 doDelete
       
  3406 
       
  3407     (self topView application hasValidSelection value and: [self askForItemModification])
       
  3408     ifTrue:
       
  3409     [
       
  3410         |selectedNodes|
       
  3411         selectedNodes := self selection asSortedCollection.
       
  3412         self selectedNodesRemove.
       
  3413         self selection: selectedNodes first - 1.
       
  3414         self setModified.
       
  3415     ]
       
  3416 
       
  3417 !
  3450 !
  3418 
  3451 
  3419 doPaste
  3452 doPaste
  3420     |clip|
  3453     |clip|
  3421 
  3454