UIPainter.st
changeset 3130 935ad3a85262
parent 3119 0a80c1bf3dde
child 3132 461c7f2b2148
equal deleted inserted replaced
3129:9a90a9d52bc6 3130:935ad3a85262
  6204     ].        
  6204     ].        
  6205     application openInterface:specSelector
  6205     application openInterface:specSelector
  6206 !
  6206 !
  6207 
  6207 
  6208 doStepDown
  6208 doStepDown
  6209     "moves the selected widget one step down in the hierarchy"
  6209     "moves the selected widget(s) one step down in the hierarchy"
  6210 
  6210 
  6211     treeView doStepOver:1
  6211     treeView doStepOver:1
  6212 !
  6212 !
  6213 
  6213 
  6214 doStepIn
  6214 doStepIn
  6222 
  6222 
  6223     treeView doStepOut
  6223     treeView doStepOut
  6224 !
  6224 !
  6225 
  6225 
  6226 doStepUp
  6226 doStepUp
  6227     "moves the selected widget one step up in the hierarchy"
  6227     "moves the selected widget(s) one step up in the hierarchy"
  6228 
  6228 
  6229     treeView doStepOver:-1
  6229     treeView doStepOver:-1
  6230 !
  6230 !
  6231 
  6231 
  6232 doWindowSpec
  6232 doWindowSpec
  6993 
  6993 
  6994 canChangeOrderInContainer
  6994 canChangeOrderInContainer
  6995     "returns true if any selection exists and all widgets in the selection
  6995     "returns true if any selection exists and all widgets in the selection
  6996      can change their layout through to a move or align operation"
  6996      can change their layout through to a move or align operation"
  6997 
  6997 
  6998     ^(selection size == 1)  and: 
  6998 "/ old code (only allow if a single item is selected):
  6999     [(selection at: 1) ~~ 1 and:   
  6999 "/
  7000     [self selectedNode parent children size > 1]] 
  7000 "/    ^(selection size == 1)  and: 
  7001 
  7001 "/    [(selection at: 1) ~~ 1 and:   
  7002 
  7002 "/    [self selectedNode parent children size > 1]] 
       
  7003 
       
  7004     ^ self selectedNodes 
       
  7005         conform:[:eachSelectedNode |
       
  7006             |parent|
       
  7007 
       
  7008             (parent := eachSelectedNode parent) notNil
       
  7009             and:[parent children size > 1]
       
  7010         ].
  7003 !
  7011 !
  7004 
  7012 
  7005 canExchangeSelectionLayouts 
  7013 canExchangeSelectionLayouts 
  7006     "returns true if the selections size is exactly 2
  7014     "returns true if the selections size is exactly 2
  7007      and all widgets in the selection
  7015      and all widgets in the selection
  7185         parentView subViews do:[:v| v raise ].
  7193         parentView subViews do:[:v| v raise ].
  7186     ].
  7194     ].
  7187     self canvas showSelection.
  7195     self canvas showSelection.
  7188 
  7196 
  7189     self selectNodes:itemList asOrderedCollection.
  7197     self selectNodes:itemList asOrderedCollection.
       
  7198 !
       
  7199 
       
  7200 doStep:item over:anIndex
       
  7201     "moves a single child 'anIndex' forward or backward in list of children.
       
  7202      positive index: move down; negative index: move up"
       
  7203 
       
  7204     |idx size parentItem parentItemsView itemsView canvas prevSelection|
       
  7205 
       
  7206     self askForSelectionChangeAllowed ifFalse:[^ self].
       
  7207 
       
  7208     (    item isNil
       
  7209      or:[(parentItem := item parent) isNil
       
  7210      or:[(size := parentItem children size) < 2
       
  7211      or:[(idx  := parentItem indexOfChild:item) == 0]]]
       
  7212     ) ifTrue:[
       
  7213         ^ self
       
  7214     ].
       
  7215 
       
  7216     idx := idx + anIndex.
       
  7217 
       
  7218     idx < 1 ifTrue:[idx := size]
       
  7219            ifFalse:[idx > size ifTrue:[idx := 1]].
       
  7220 
       
  7221     prevSelection := self selectedNodes.
       
  7222     self setSelection:nil.
       
  7223 
       
  7224     model remove:item.
       
  7225     model add:item beforeIndex:idx below:parentItem.
       
  7226 
       
  7227     idx := parentItem indexOfChild:item.
       
  7228     itemsView := item contents view.
       
  7229     parentItemsView := parentItem contents view.
       
  7230 
       
  7231     canvas := self canvas.
       
  7232     canvas hideSelection.
       
  7233 
       
  7234     itemsView isView ifFalse:[
       
  7235         "/ a component - has its own collection (and therefore indexing) - sigh
       
  7236         idx := idx - ((1 to:idx-1) count:[:i | (parentItem children at:i) contents view isView]).
       
  7237         parentItemsView changeSequenceOrderFor:itemsView to:idx.
       
  7238     ] ifTrue:[
       
  7239         "/ a view - has its own collection (and therefore indexing) - sigh
       
  7240         idx := idx - ((1 to:idx-1) count:[:i | (parentItem children at:i) contents view isView not]).
       
  7241         parentItemsView changeSequenceOrderFor:itemsView to:idx.
       
  7242     ].
       
  7243 
       
  7244     parentItemsView specClass isLayoutContainer ifFalse:[
       
  7245         "/ spVw components notEmptyOrNil ifTrue:[ self halt ].
       
  7246         parentItemsView subViews do:[:v| v raise ].
       
  7247     ].
       
  7248     self selectNodes:prevSelection.
       
  7249     canvas showSelection.
  7190 !
  7250 !
  7191 
  7251 
  7192 doStepIn
  7252 doStepIn
  7193     "move the currently selected widget into the next available container below"
  7253     "move the currently selected widget into the next available container below"
  7194     
  7254     
  7221 
  7281 
  7222     |item idx size parentItem parentItemsView itemsView canvas|
  7282     |item idx size parentItem parentItemsView itemsView canvas|
  7223 
  7283 
  7224     self askForSelectionChangeAllowed ifFalse:[^ self].
  7284     self askForSelectionChangeAllowed ifFalse:[^ self].
  7225 
  7285 
       
  7286     anIndex < 0 ifTrue:[
       
  7287         "/ moving up
       
  7288         self selectedNodes do:[:eachNode |
       
  7289             self doStep:eachNode over:anIndex.
       
  7290         ].
       
  7291     ] ifFalse:[
       
  7292         "/ moving down
       
  7293         self selectedNodes reverseDo:[:eachNode |
       
  7294             self doStep:eachNode over:anIndex.
       
  7295         ].
       
  7296     ].
       
  7297     ^ self.
       
  7298 
  7226     (    (item := self selectedNode) isNil
  7299     (    (item := self selectedNode) isNil
  7227      or:[(parentItem := item parent) isNil
  7300      or:[(parentItem := item parent) isNil
  7228      or:[(size := parentItem children size) < 2
  7301      or:[(size := parentItem children size) < 2
  7229      or:[(idx  := parentItem indexOfChild:item) == 0]]]
  7302      or:[(idx  := parentItem indexOfChild:item) == 0]]]
  7230     ) ifTrue:[
  7303     ) ifTrue:[