UIPainterView.st
changeset 1388 c5559ad5c09e
parent 1387 65c9df9cb1ad
child 1402 7abc17031163
equal deleted inserted replaced
1387:65c9df9cb1ad 1388:c5559ad5c09e
   247 
   247 
   248 deleteSelectionBuffered: buffered
   248 deleteSelectionBuffered: buffered
   249     "cut the selection into the cut&paste-buffer
   249     "cut the selection into the cut&paste-buffer
   250      and open a transaction
   250      and open a transaction
   251     "
   251     "
   252     |specs coll oldSelection newSelection treeModel|
   252     |specs coll index oldSelection newSelection treeModel parent children size|
   253 
   253 
   254     coll := self minSetOfSuperViews:(self selection).
   254     coll := self minSetOfSuperViews:(self selection).
   255 
   255 
   256     coll notNil ifTrue:[
   256     coll notNil ifTrue:[
   257         treeView cvsEventsDisabledDo:[
   257         treeView cvsEventsDisabledDo:[
   258             treeModel   := treeView model.
   258             treeModel    := treeView model.
   259             oldSelection := treeModel selectedNodes at:1 ifAbsent: nil.
   259             oldSelection := treeModel selectedNodes at:1 ifAbsent: nil.
   260 
   260 
   261             oldSelection notNil ifTrue:[
   261             oldSelection notNil ifTrue:[
   262                 oldSelection := (treeModel indexOf:oldSelection) max:1
   262                 children := oldSelection parent children.
       
   263                 (size := children size) > 1 ifTrue:[
       
   264                     index := children identityIndexOf:oldSelection.
       
   265                     size == index ifTrue:[
       
   266                         index := index - 1
       
   267                     ].
       
   268                     newSelection := children at:index ifAbsent:1.
       
   269                 ] ifFalse:[
       
   270                     newSelection := oldSelection parent
       
   271                 ].
       
   272                 newSelection := treeModel indexOf:newSelection.
   263             ] ifFalse:[
   273             ] ifFalse:[
   264                 oldSelection := 1.
   274                 newSelection := 1
   265             ].
   275             ].
   266 
   276 
   267             self hideSelection.
   277             self hideSelection.
   268             selection := nil.
   278             selection := nil.
   269             specs := coll collect:[:aView| self fullSpecFor:aView ].
   279             specs := coll collect:[:aView| self fullSpecFor:aView ].
   274                     self remove:aView.
   284                     self remove:aView.
   275                 ]
   285                 ]
   276             ].
   286             ].
   277             buffered ifTrue: [self setSelection:specs].
   287             buffered ifTrue: [self setSelection:specs].
   278             treeView selection:nil.
   288             treeView selection:nil.
   279             newSelection := oldSelection min:(treeModel list size).
       
   280             treeView selection:(Array with: newSelection).
   289             treeView selection:(Array with: newSelection).
   281             self setSelection:treeView selectedNode contents view withRedraw:true.
   290             self setSelection:treeView selectedNode contents view withRedraw:true.
   282         ]
   291         ]
   283     ]
   292     ]
   284 !
   293 !