UIPainter.st
changeset 2313 c60fe56ab5bf
parent 2310 ac9be9035f2c
child 2318 8d920f26edef
equal deleted inserted replaced
2312:8b25e13ab035 2313:c60fe56ab5bf
  2493      which is contained within another component"
  2493      which is contained within another component"
  2494 
  2494 
  2495     ^ builder booleanValueAspectFor:#canMoveSelectionOutOfContainer
  2495     ^ builder booleanValueAspectFor:#canMoveSelectionOutOfContainer
  2496 !
  2496 !
  2497 
  2497 
       
  2498 canPasteHolder
       
  2499 
       
  2500     |holder|
       
  2501     (holder := builder bindingAt:#canPasteHolder) isNil ifTrue:[
       
  2502         holder := [ self canPaste ].
       
  2503     ].
       
  2504     ^ holder
       
  2505 !
       
  2506 
  2498 canPasteKeepingLayoutHolder
  2507 canPasteKeepingLayoutHolder
  2499 
  2508     ^ self canPasteHolder
  2500     |holder|
       
  2501     (holder := builder bindingAt:#valueOfCanPasteWithKeepingLayout) isNil ifTrue:[
       
  2502         builder aspectAt:#valueOfCanPasteWithKeepingLayout put:(holder :=  false asValue).
       
  2503     ].
       
  2504     ^ holder
       
  2505 !
  2509 !
  2506 
  2510 
  2507 canReplaceSelection
  2511 canReplaceSelection
  2508     treeView isCanvasSelected ifTrue:[^ false].
  2512     treeView isCanvasSelected ifTrue:[^ false].
  2509     ^ true
  2513     ^ true
  2905 !
  2909 !
  2906 
  2910 
  2907 updateChannels
  2911 updateChannels
  2908     "updates the channels"
  2912     "updates the channels"
  2909 
  2913 
  2910     |canCutOrCopy canPaste clipboard sel treeSelection|
  2914     |canCutOrCopy|
  2911 
  2915 
  2912     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
  2916     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
  2913     self canExchangeSelectionLayouts    value:(treeView canExchangeSelectionLayouts).
  2917     self canExchangeSelectionLayouts    value:(treeView canExchangeSelectionLayouts).
  2914     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
  2918     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
  2915     self canMoveSelectionIntoContainer  value:(treeView canMoveSelectionIntoContainer).
  2919     self canMoveSelectionIntoContainer  value:(treeView canMoveSelectionIntoContainer).
  2916     self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer).
  2920     self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer).
  2917     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
  2921     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
  2918 
  2922 
  2919     painterView notNil ifTrue:[
  2923     "/ the top-node cannot be cut, copied or pasted.
  2920         treeSelection := treeView selection.
  2924     canCutOrCopy := treeView selection notEmptyOrNil and:[treeView selection first ~~ 1].
  2921         "/ the top-node cannot be cut, copied or pasted.
       
  2922         canCutOrCopy := treeSelection size >= 1 and:[treeSelection first ~~ 1].
       
  2923         clipboard := painterView getClipboardObject.
       
  2924 
       
  2925         clipboard notEmptyOrNil 
       
  2926                 ifTrue:[sel := clipboard first]
       
  2927                 ifFalse:[sel := clipboard].
       
  2928 
       
  2929         canPaste := (sel isKindOf:UISpecification) 
       
  2930 "/                    and:[treeSelection size  = 1 
       
  2931 "/                    and:[treeSelection first == 1 
       
  2932 "/                         or: [self canPasteInto: treeView selectedNode contents view]]]
       
  2933     ].
       
  2934 
  2925 
  2935     self canCutHolder value: canCutOrCopy.
  2926     self canCutHolder value: canCutOrCopy.
  2936     self canCopyHolder value: canCutOrCopy.
  2927     self canCopyHolder value: canCutOrCopy.
  2937     self canPasteHolder value: canPaste.            
       
  2938     self canPasteKeepingLayoutHolder value: (canPaste "&  self canKeepLayoutInSelection").
       
  2939 
  2928 
  2940 "/    self modifiedChannel value: false.
  2929 "/    self modifiedChannel value: false.
  2941 
  2930 
  2942     "Modified: / 16.7.1998 / 19:13:30 / cg"
  2931     "Modified: / 16.7.1998 / 19:13:30 / cg"
  2943 ! !
  2932 ! !
  3448     specTool isNil ifTrue:[self noteBookView].
  3437     specTool isNil ifTrue:[self noteBookView].
  3449   ^ specTool
  3438   ^ specTool
  3450 ! !
  3439 ! !
  3451 
  3440 
  3452 !UIPainter methodsFor:'queries'!
  3441 !UIPainter methodsFor:'queries'!
       
  3442 
       
  3443 canPaste
       
  3444     |clipboard sel|
       
  3445 
       
  3446     clipboard := painterView getClipboardObject.
       
  3447 
       
  3448     clipboard notEmptyOrNil 
       
  3449             ifTrue:[sel := clipboard first]
       
  3450             ifFalse:[sel := clipboard].
       
  3451 
       
  3452     ^ (sel isKindOf:UISpecification) 
       
  3453 "/                    and:[treeSelection size  = 1 
       
  3454 "/                    and:[treeSelection first == 1 
       
  3455 "/                         or: [self canPasteInto: treeView selectedNode contents view]]]
       
  3456 !
  3453 
  3457 
  3454 hasSpecClass
  3458 hasSpecClass
  3455     "answers whether an application class is defined"
  3459     "answers whether an application class is defined"
  3456 
  3460 
  3457     ^ (self resolveName:specClassName) notNil
  3461     ^ (self resolveName:specClassName) notNil