UIPainterView.st
changeset 886 3c67610b9631
parent 858 6b2e9e31cf06
child 887 79a6e12e1d0f
equal deleted inserted replaced
885:34cefb1e6dda 886:3c67610b9631
   198 
   198 
   199 deleteSelection
   199 deleteSelection
   200     "cut the selection into the cut&paste-buffer
   200     "cut the selection into the cut&paste-buffer
   201      and open a transaction
   201      and open a transaction
   202     "
   202     "
   203     |specs coll|
   203     |specs coll oldSelectedNode newSelectedNode|
   204 
   204 
   205     coll := self minSetOfSuperViews:(self selection).
   205     coll := self minSetOfSuperViews:(self selection).
   206 
   206 
   207     coll notNil ifTrue:[
   207     coll notNil ifTrue:[
   208         treeView cvsEventsDisabledDo:[
   208         treeView cvsEventsDisabledDo:[
   209             self select:nil.
   209 
       
   210             oldSelectedNode := treeView selectedNode. 
       
   211             oldSelectedNode parent children size <= 1 ifTrue: [
       
   212                 newSelectedNode := oldSelectedNode parent
       
   213             ]
       
   214             ifFalse: [
       
   215                 newSelectedNode := oldSelectedNode parent children 
       
   216                     at: (oldSelectedNode parent indexOfChild: oldSelectedNode) - 1 
       
   217                     ifAbsent: [oldSelectedNode parent children at: 2]
       
   218             ].
       
   219 
       
   220             selection := nil.  
   210             specs := coll collect:[:aView| self fullSpecFor:aView ].
   221             specs := coll collect:[:aView| self fullSpecFor:aView ].
   211 
   222 
   212             self withinTransaction:#cut objects:coll do:[
   223             self withinTransaction:#cut objects:coll do:[
   213                 coll reverseDo:[:aView|
   224                 coll reverseDo:[:aView|
   214                     self createUndoRemove:aView.
   225                     self createUndoRemove:aView.
   215                     self remove:aView
   226                     self remove:aView
   216                 ]
   227                 ]
   217             ].
   228             ].
   218             self setSelection:specs.
   229             treeView selection: nil. 
   219             treeView selection: (Array with: 1)
   230             treeView selection: (treeView model indexOf:newSelectedNode).
       
   231             self setSelection:treeView selectedNode contents view withRedraw: true.
       
   232 
   220         ]
   233         ]
   221     ]
   234     ]
   222 !
   235 !
   223 
   236 
   224 deleteTotalSelection
   237 deleteTotalSelection
  1270 
  1283 
  1271 !
  1284 !
  1272 
  1285 
  1273 select:something
  1286 select:something
  1274     "change selection to something
  1287     "change selection to something
  1275     "
  1288     "         
  1276     (self enabled and:[something ~= self selection]) ifTrue:[   
  1289     (self enabled and:[something ~= self selection]) ifTrue:[   
  1277         something isNil 
  1290         something isNil 
  1278             ifTrue: [treeView selection: (Array with: 1)]
  1291             ifTrue: [treeView selection: (Array with: 1)]
  1279             ifFalse:[treeView cvsSelection:something].
  1292             ifFalse:[treeView cvsSelection:something].
  1280         self setSelection:something withRedraw:true
  1293         self setSelection:something withRedraw:true 
  1281     ]
  1294     ]
  1282 
  1295 
  1283 !
  1296 !
  1284 
  1297 
  1285 updateSelectionFromModel:aSelOrNil
  1298 updateSelectionFromModel:aSelOrNil