UIPainter.st
changeset 2552 6b958036f5c4
parent 2551 9f95bababe1b
child 2559 04b2605a66b2
equal deleted inserted replaced
2551:9f95bababe1b 2552:6b958036f5c4
  2964     "Created: / 14-01-2008 / 17:36:04 / cg"
  2964     "Created: / 14-01-2008 / 17:36:04 / cg"
  2965 !
  2965 !
  2966 
  2966 
  2967 canMoveOrAlignSelection
  2967 canMoveOrAlignSelection
  2968     "returns a boolean value holder which is true in case that any selection exists
  2968     "returns a boolean value holder which is true in case that any selection exists
  2969      and all widgets in the selection can change its layout through to a move or
  2969      and all widgets in the selection can change their layout through to a move or
  2970      align operation"
  2970      align operation"
  2971 
  2971 
  2972     ^ builder booleanValueAspectFor:#canMoveOrAlignSelection
  2972     ^ builder booleanValueAspectFor:#canMoveOrAlignSelection
  2973 !
  2973 !
  2974 
  2974 
  2979      or: [ self canMoveSelectionOutOfContainer value 
  2979      or: [ self canMoveSelectionOutOfContainer value 
  2980      or: [ self canMoveSelectionIntoContainer value ]]
  2980      or: [ self canMoveSelectionIntoContainer value ]]
  2981 !
  2981 !
  2982 
  2982 
  2983 canMoveSelectionIntoContainer
  2983 canMoveSelectionIntoContainer
  2984     "returns true in case that one widget is selected and can change its container
  2984     "returns true in case that at least one widget is selected and can change its container
  2985      widget to an element below"
  2985      widget to an element below"
  2986 
  2986 
  2987     ^ builder booleanValueAspectFor:#canMoveSelectionIntoContainer
  2987     ^ builder booleanValueAspectFor:#canMoveSelectionIntoContainer
  2988 !
  2988 !
  2989 
  2989 
  2990 canMoveSelectionOutOfContainer
  2990 canMoveSelectionOutOfContainer
  2991     "returns a boolean value holder which is true in case that one widget is selected
  2991     "returns a boolean value holder which is true in case that at least one widget is selected
  2992      which is contained within another component"
  2992      which is contained within another component"
  2993 
  2993 
  2994     ^ builder booleanValueAspectFor:#canMoveSelectionOutOfContainer
  2994     ^ builder booleanValueAspectFor:#canMoveSelectionOutOfContainer
  2995 !
  2995 !
  2996 
  2996 
  3008 !
  3008 !
  3009 
  3009 
  3010 canReplaceSelection
  3010 canReplaceSelection
  3011     treeView isCanvasSelected ifTrue:[^ false].
  3011     treeView isCanvasSelected ifTrue:[^ false].
  3012     ^ true
  3012     ^ true
       
  3013 !
       
  3014 
       
  3015 canResizeSelection
       
  3016     "returns a boolean value holder which is true in case that any selection exists
       
  3017      and all widgets in the selection can be resized"
       
  3018 
       
  3019     ^ builder booleanValueAspectFor:#canResizeSelection
  3013 !
  3020 !
  3014 
  3021 
  3015 editToolBarVisibleHolder
  3022 editToolBarVisibleHolder
  3016     |holder|
  3023     |holder|
  3017 
  3024 
  3509     "updates the channels"
  3516     "updates the channels"
  3510 
  3517 
  3511     |canCutOrCopy|
  3518     |canCutOrCopy|
  3512 
  3519 
  3513     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
  3520     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
       
  3521     self canResizeSelection             value:(treeView canResizeSelection).
  3514     self canExchangeSelectionLayouts    value:(treeView canExchangeSelectionLayouts).
  3522     self canExchangeSelectionLayouts    value:(treeView canExchangeSelectionLayouts).
  3515     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
  3523     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
  3516     self canMoveSelectionIntoContainer  value:(treeView canMoveSelectionIntoContainer).
  3524     self canMoveSelectionIntoContainer  value:(treeView canMoveSelectionIntoContainer).
  3517     self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer).
  3525     self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer).
  3518     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
  3526     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
  6051     ].
  6059     ].
  6052 
  6060 
  6053     (size := sel size) ~~ 0 ifTrue:[
  6061     (size := sel size) ~~ 0 ifTrue:[
  6054         list := OrderedCollection new:size.
  6062         list := OrderedCollection new:size.
  6055 
  6063 
  6056         sel do:[:aView||item|
  6064         sel do:[:aView|
       
  6065             |item|
       
  6066 
  6057             (item := self itemOfView:aView) notNil ifTrue:[
  6067             (item := self itemOfView:aView) notNil ifTrue:[
  6058                 list add:item.
  6068                 list add:item.
  6059                 model doMakeVisible:item.
  6069                 model doMakeVisible:item.
  6060             ]
  6070             ]
  6061         ].
  6071         ].
  6093     ) ifTrue:[
  6103     ) ifTrue:[
  6094         oldSel := selection copy.
  6104         oldSel := selection copy.
  6095         self removeFromSelection:index.
  6105         self removeFromSelection:index.
  6096         self selectionChangedFrom:oldSel.
  6106         self selectionChangedFrom:oldSel.
  6097     ].
  6107     ].
       
  6108 !
       
  6109 
       
  6110 selectedViews
       
  6111     ^ self selection 
       
  6112         collect:[:index |
       
  6113             |node view|
       
  6114 
       
  6115             node := listOfNodes at:index.
       
  6116             view := node contents view.
       
  6117             view
       
  6118         ]
  6098 ! !
  6119 ! !
  6099 
  6120 
  6100 !UIPainter::TreeView methodsFor:'change & update'!
  6121 !UIPainter::TreeView methodsFor:'change & update'!
  6101 
  6122 
  6102 canvasNameChanged:aName
  6123 canvasNameChanged:aName
  6466         ]
  6487         ]
  6467     ].
  6488     ].
  6468     ^ false
  6489     ^ false
  6469 !
  6490 !
  6470 
  6491 
       
  6492 canResizeSelection
       
  6493     "returns true if all selected widgets can be resized"
       
  6494 
       
  6495     selection isEmptyOrNil ifTrue:[ ^ false ].
       
  6496     ^ self canvas canResize:(self selectedViews)
       
  6497 !
       
  6498 
  6471 hasOneSelectionOtherThanCanvas
  6499 hasOneSelectionOtherThanCanvas
  6472     "returns true in case that one selection exists other than the canvas"
  6500     "returns true in case that one selection exists other than the canvas"
  6473 
  6501 
  6474     ^ selection size == 1 and:[selection first ~~ 1]
  6502     ^ selection size == 1 and:[selection first ~~ 1]
  6475 !
  6503 !