UIPainterView.st
changeset 1387 65c9df9cb1ad
parent 1366 ffb95ba845ec
child 1388 c5559ad5c09e
equal deleted inserted replaced
1386:5b562fd44e68 1387:65c9df9cb1ad
     7  inclusion of the above copyright notice. This software may not
     7  inclusion of the above copyright notice. This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
       
    12 
       
    13 "{ Package: 'stx:libtool2' }"
    12 
    14 
    13 UIObjectView subclass:#UIPainterView
    15 UIObjectView subclass:#UIPainterView
    14 	instanceVariableNames:'treeView listHolder superclassName className methodName
    16 	instanceVariableNames:'treeView listHolder superclassName className methodName
    15 		categoryName handleColor handleMasterColor'
    17 		categoryName handleColor handleMasterColor'
    16 	classVariableNames:'HandCursor RedefineAspectMethods AspectsAsInstances'
    18 	classVariableNames:'HandCursor RedefineAspectMethods AspectsAsInstances'
   245 
   247 
   246 deleteSelectionBuffered: buffered
   248 deleteSelectionBuffered: buffered
   247     "cut the selection into the cut&paste-buffer
   249     "cut the selection into the cut&paste-buffer
   248      and open a transaction
   250      and open a transaction
   249     "
   251     "
   250     |specs coll oldSelectedNode newSelectedNode newSelection|
   252     |specs coll oldSelection newSelection treeModel|
   251 
   253 
   252     coll := self minSetOfSuperViews:(self selection).
   254     coll := self minSetOfSuperViews:(self selection).
   253 
   255 
   254     coll notNil ifTrue:[
   256     coll notNil ifTrue:[
   255         treeView cvsEventsDisabledDo:[
   257         treeView cvsEventsDisabledDo:[
   256 
   258             treeModel   := treeView model.
   257             ((oldSelectedNode := (treeView model selectedNodes at: 1 ifAbsent: nil)) notNil and:
   259             oldSelection := treeModel selectedNodes at:1 ifAbsent: nil.
   258             [oldSelectedNode parent notNil]) ifTrue: [
   260 
   259                 oldSelectedNode parent children size <= 1 ifTrue: [
   261             oldSelection notNil ifTrue:[
   260                     newSelectedNode := oldSelectedNode parent
   262                 oldSelection := (treeModel indexOf:oldSelection) max:1
   261                 ]
   263             ] ifFalse:[
   262                 ifFalse: [
   264                 oldSelection := 1.
   263                     newSelectedNode := oldSelectedNode parent children 
       
   264                         at: (oldSelectedNode parent indexOfChild: oldSelectedNode) - 1 
       
   265                         ifAbsent: [oldSelectedNode parent children at: 2]
       
   266                 ].
       
   267             ].
   265             ].
       
   266 
   268             self hideSelection.
   267             self hideSelection.
   269             selection := nil.
   268             selection := nil.
   270             specs := coll collect:[:aView| self fullSpecFor:aView ].
   269             specs := coll collect:[:aView| self fullSpecFor:aView ].
   271 
   270 
   272             self withinTransaction:#cut objects:coll do:[
   271             self withinTransaction:#cut objects:coll do:[
   273                 coll reverseDo:[:aView|
   272                 coll reverseDo:[:aView|
   274                     self createUndoRemove:aView.
   273                     self createUndoRemove:aView.
   275                     self remove:aView.
   274                     self remove:aView.
   276                 ]
   275                 ]
   277             ].
   276             ].
   278             buffered ifTrue: [self setSelection: specs].
   277             buffered ifTrue: [self setSelection:specs].
   279             treeView selection: nil. 
   278             treeView selection:nil.
   280             (newSelection := (treeView model indexOf:newSelectedNode)) > 0 ifFalse: [
   279             newSelection := oldSelection min:(treeModel list size).
   281                  newSelection := 1
   280             treeView selection:(Array with: newSelection).
   282             ].
   281             self setSelection:treeView selectedNode contents view withRedraw:true.
   283             treeView selection: (Array with: newSelection).
       
   284             self setSelection:treeView selectedNode contents view withRedraw: true.
       
   285         ]
   282         ]
   286     ]
   283     ]
   287 !
   284 !
   288 
   285 
   289 deleteTotalSelection
   286 deleteTotalSelection
   342 !
   339 !
   343 
   340 
   344 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
   341 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
   345     "add the specs to the object view; returns list of pasted components
   342     "add the specs to the object view; returns list of pasted components
   346     "
   343     "
   347     self 
   344     ^ self 
   348         pasteSpecifications:aSpecificationOrList 
   345         pasteSpecifications:aSpecificationOrList 
   349         keepLayout:keepLayout 
   346         keepLayout:keepLayout 
   350         keepPosition:false 
   347         keepPosition:false 
   351         at:aPointOrNil
   348         at:aPointOrNil
   352 
   349 
   367         paste := Array with:aSpecificationOrList
   364         paste := Array with:aSpecificationOrList
   368     ].
   365     ].
   369     (frame := self singleSelection) isNil ifTrue:[
   366     (frame := self singleSelection) isNil ifTrue:[
   370         frame := self
   367         frame := self
   371     ].
   368     ].
   372 
       
   373     self selection:nil.
   369     self selection:nil.
   374 
   370 
   375     newSel  := OrderedCollection new.
   371     newSel  := OrderedCollection new.
   376     builder := UIBuilder new isEditing:true.
   372     builder := UIBuilder new isEditing:true.
   377 
   373