UIPainterView.st
changeset 887 79a6e12e1d0f
parent 886 3c67610b9631
child 925 e6ddd46581c3
equal deleted inserted replaced
886:3c67610b9631 887:79a6e12e1d0f
   195 
   195 
   196 
   196 
   197 !
   197 !
   198 
   198 
   199 deleteSelection
   199 deleteSelection
       
   200     "delete the selection buffered
       
   201     "
       
   202     self deleteSelectionBuffered: true
       
   203 !
       
   204 
       
   205 deleteSelectionBuffered: buffered
   200     "cut the selection into the cut&paste-buffer
   206     "cut the selection into the cut&paste-buffer
   201      and open a transaction
   207      and open a transaction
   202     "
   208     "
   203     |specs coll oldSelectedNode newSelectedNode|
   209     |specs coll oldSelectedNode newSelectedNode newSelection|
   204 
   210 
   205     coll := self minSetOfSuperViews:(self selection).
   211     coll := self minSetOfSuperViews:(self selection).
   206 
   212 
   207     coll notNil ifTrue:[
   213     coll notNil ifTrue:[
   208         treeView cvsEventsDisabledDo:[
   214         treeView cvsEventsDisabledDo:[
   209 
   215 
   210             oldSelectedNode := treeView selectedNode. 
   216             (oldSelectedNode := (treeView model selectedNodes at: 1 ifAbsent: nil)) notNil ifTrue: [
   211             oldSelectedNode parent children size <= 1 ifTrue: [
   217                 oldSelectedNode parent children size <= 1 ifTrue: [
   212                 newSelectedNode := oldSelectedNode parent
   218                     newSelectedNode := oldSelectedNode parent
   213             ]
   219                 ]
   214             ifFalse: [
   220                 ifFalse: [
   215                 newSelectedNode := oldSelectedNode parent children 
   221                     newSelectedNode := oldSelectedNode parent children 
   216                     at: (oldSelectedNode parent indexOfChild: oldSelectedNode) - 1 
   222                         at: (oldSelectedNode parent indexOfChild: oldSelectedNode) - 1 
   217                     ifAbsent: [oldSelectedNode parent children at: 2]
   223                         ifAbsent: [oldSelectedNode parent children at: 2]
       
   224                 ].
   218             ].
   225             ].
   219 
   226             self hideSelection.
   220             selection := nil.  
   227             selection := nil.
   221             specs := coll collect:[:aView| self fullSpecFor:aView ].
   228             specs := coll collect:[:aView| self fullSpecFor:aView ].
   222 
   229 
   223             self withinTransaction:#cut objects:coll do:[
   230             self withinTransaction:#cut objects:coll do:[
   224                 coll reverseDo:[:aView|
   231                 coll reverseDo:[:aView|
   225                     self createUndoRemove:aView.
   232                     self createUndoRemove:aView.
   226                     self remove:aView
   233                     self remove:aView.
   227                 ]
   234                 ]
   228             ].
   235             ].
       
   236             buffered ifTrue: [self setSelection: specs].
   229             treeView selection: nil. 
   237             treeView selection: nil. 
   230             treeView selection: (treeView model indexOf:newSelectedNode).
   238             (newSelection := (treeView model indexOf:newSelectedNode)) > 0 ifFalse: [
       
   239                  newSelection := 1
       
   240             ].
       
   241             treeView selection: (Array with: newSelection).
   231             self setSelection:treeView selectedNode contents view withRedraw: true.
   242             self setSelection:treeView selectedNode contents view withRedraw: true.
   232 
       
   233         ]
   243         ]
   234     ]
   244     ]
   235 !
   245 !
   236 
   246 
   237 deleteTotalSelection
   247 deleteTotalSelection
   238     "delete the selection; copy the selection into the cut&paste-buffer
   248     "delete the selection
   239      and open a transaction
   249     "            
   240     "
   250     self deleteSelectionBuffered: false
   241     |specs coll|
       
   242 
       
   243     coll := self minSetOfSuperViews:(self selection).
       
   244 
       
   245     coll notNil ifTrue:[
       
   246         treeView cvsEventsDisabledDo:[
       
   247             self select:nil.
       
   248             specs := coll collect:[:aView| self fullSpecFor:aView ].
       
   249 
       
   250             self withinTransaction:#cut objects:coll do:[
       
   251                 coll reverseDo:[:aView|
       
   252                     self remove:aView
       
   253                 ]
       
   254             ].
       
   255             treeView selection: (Array with: 1)
       
   256         ]
       
   257     ]
       
   258 !
   251 !
   259 
   252 
   260 pasteBuffer
   253 pasteBuffer
   261     "add the objects in the paste-buffer to the object view
   254     "add the objects in the paste-buffer to the object view
   262     "
   255     "