UIPainter.st
changeset 1063 9e710dbc7c92
parent 1059 ecb59576e1e6
child 1068 dcb2cba5787f
equal deleted inserted replaced
1062:15184a3a00e1 1063:9e710dbc7c92
  1863 !
  1863 !
  1864 
  1864 
  1865 noteBookView
  1865 noteBookView
  1866     "returns the notebook view; initialize the tools embedded in the notebook"
  1866     "returns the notebook view; initialize the tools embedded in the notebook"
  1867 
  1867 
  1868     |noteBook channel helpTool layoutTool specTool|
  1868     |noteBook modifiedChannel acceptChannel helpTool layoutTool specTool|
  1869 
  1869 
  1870     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
  1870     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
  1871 	noteBook   := View new.
  1871         noteBook   := View new.
  1872 	layoutTool := UILayoutTool new.
  1872         layoutTool := UILayoutTool new.
  1873 	helpTool   := UIHelpTool   new.
  1873         helpTool   := UIHelpTool   new.
  1874 	helpTool buildFromClass:specClass.
  1874         helpTool buildFromClass:specClass.
  1875 	specTool   := UISpecificationTool new.
  1875         specTool   := UISpecificationTool new.
  1876 	channel    := self modifiedChannel.
  1876         modifiedChannel    := self modifiedChannel.
  1877 
  1877 
  1878 	layoutTool masterApplication:self.
  1878         layoutTool masterApplication:self.
  1879 	specTool   masterApplication:self.
  1879         specTool   masterApplication:self.
  1880 	helpTool   masterApplication:self.
  1880         helpTool   masterApplication:self.
  1881 
  1881 
  1882 	layoutCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1882         layoutCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1883 	helpCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1883         helpCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1884 	specCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1884         specCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  1885 
  1885 
  1886 	layoutCanvas client:layoutTool.
  1886         layoutCanvas client:layoutTool.
  1887 	helpCanvas   client:helpTool.
  1887         helpCanvas   client:helpTool.
  1888 	specTool builder:(specCanvas client:specTool).
  1888         specTool builder:(specCanvas client:specTool).
  1889 
  1889 
  1890 	layoutTool masterApplication:self.
  1890         layoutTool masterApplication:self.
  1891 	specTool   masterApplication:self.
  1891         specTool   masterApplication:self.
  1892 	helpTool   masterApplication:self.
  1892         helpTool   masterApplication:self.
  1893 
  1893 
  1894 	layoutTool modifiedHolder:channel.
  1894         layoutTool modifiedHolder:modifiedChannel.
  1895 	helpTool   modifiedHolder:channel.
  1895         helpTool   modifiedHolder:modifiedChannel.
  1896 	specTool   modifiedHolder:channel.
  1896         specTool   modifiedHolder:modifiedChannel.
  1897 
  1897 
  1898 	builder aspectAt:#noteBookView put:noteBook.
  1898         builder aspectAt:#noteBookView put:noteBook.
  1899     ].
  1899     ].
  1900     ^ noteBook
  1900     ^ noteBook
  1901 !
  1901 !
  1902 
  1902 
  1903 painterShown
  1903 painterShown
  2218     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
  2218     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
  2219 
  2219 
  2220     treeView notNil
  2220     treeView notNil
  2221     ifTrue:
  2221     ifTrue:
  2222     [
  2222     [
  2223 	treeSelection := treeView selection.
  2223         treeSelection := treeView selection.
  2224 	"/ the top-node cannot be cut, copied or pasted.
  2224         "/ the top-node cannot be cut, copied or pasted.
  2225 	canCutOrCopy := treeSelection size >= 1 and:[treeSelection first ~~ 1].
  2225         canCutOrCopy := treeSelection size >= 1 and:[treeSelection first ~~ 1].
  2226 	clipboard := self getSelection.
  2226         clipboard := self getSelection.
  2227 
  2227 
  2228 	clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]]
  2228         clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]]
  2229 			      ifFalse:[sel := clipboard].
  2229                               ifFalse:[sel := clipboard].
  2230 
  2230 
  2231 	canPaste := (sel isKindOf:UISpecification) and: 
  2231         canPaste := (sel isKindOf:UISpecification) and: 
  2232 		    [treeSelection size  = 1 
  2232                     [treeSelection size  = 1 
  2233 		    and:[treeSelection first == 1 
  2233                     and:[treeSelection first == 1 
  2234 		    or: [self canPasteInto: treeView selectedNode contents view]]]
  2234                     or: [self canPasteInto: treeView selectedNode contents view]]]
  2235     ].
  2235     ].
  2236 
  2236 
  2237     self valueOfCanCut value: canCutOrCopy.
  2237     self valueOfCanCut value: canCutOrCopy.
  2238     self valueOfCanCopy value: canCutOrCopy.
  2238     self valueOfCanCopy value: canCutOrCopy.
  2239     self valueOfCanPaste value: canPaste.            
  2239     self valueOfCanPaste value: canPaste.            
  2240     self valueOfCanPasteWithKeepingLayout value: (canPaste "&  self canKeepLayoutInSelection").
  2240     self valueOfCanPasteWithKeepingLayout value: (canPaste "&  self canKeepLayoutInSelection").
       
  2241 
       
  2242 "/    self modifiedChannel value: false.
  2241 
  2243 
  2242     "Modified: / 16.7.1998 / 19:13:30 / cg"
  2244     "Modified: / 16.7.1998 / 19:13:30 / cg"
  2243 ! !
  2245 ! !
  2244 
  2246 
  2245 !UIPainter methodsFor:'defaults'!
  2247 !UIPainter methodsFor:'defaults'!
  2927 accept
  2929 accept
  2928     "accepts all modifications done to the attributes of the current section"
  2930     "accepts all modifications done to the attributes of the current section"
  2929 
  2931 
  2930     |painter layout spec prop key layoutTool|
  2932     |painter layout spec prop key layoutTool|
  2931 
  2933 
       
  2934     self acceptChannel value:true.      "/ force editFields to accept
       
  2935     self acceptChannel value:false.
       
  2936 
  2932     self modifiedChannel value:false.
  2937     self modifiedChannel value:false.
  2933     modified := true.
  2938     modified := true.
  2934 
  2939 
  2935     painter := self painter.
  2940     painter := self painter.
  2936 
  2941 
  2937     self isLayoutToolSelected ifTrue:[
  2942     self isLayoutToolSelected ifTrue:[
  2938 	layoutTool := self layoutTool.
  2943         layoutTool := self layoutTool.
  2939 
  2944 
  2940 	(layout := layoutTool layout) notNil ifTrue:[
  2945         (layout := layoutTool layout) notNil ifTrue:[
  2941 	    layoutTool layoutType == #Extent ifTrue:[
  2946             layoutTool layoutType == #Extent ifTrue:[
  2942 		layoutTool layoutView == painter topView ifTrue:[
  2947                 layoutTool layoutView == painter topView ifTrue:[
  2943 		    layoutTool layoutView extent:layout
  2948                     layoutTool layoutView extent:layout
  2944 		] ifFalse:[
  2949                 ] ifFalse:[
  2945 		    painter setExtent:layout
  2950                     painter setExtent:layout
  2946 		]
  2951                 ]
  2947 	    ] ifFalse:[
  2952             ] ifFalse:[
  2948 		painter setLayout:layout
  2953                 painter setLayout:layout
  2949 	    ]
  2954             ]
  2950 	]
  2955         ]
  2951     ] ifFalse:[
  2956     ] ifFalse:[
  2952 	spec := self specTool specification.
  2957         spec := self specTool specification.
  2953 
  2958 
  2954 	self isHelpToolSelected ifTrue:[
  2959         self isHelpToolSelected ifTrue:[
  2955 	    self helpTool accept.      
  2960             self helpTool accept.      
  2956 	    spec activeHelpKey:self helpTool helpKey.
  2961             spec activeHelpKey:self helpTool helpKey.
  2957 	].      
  2962         ].      
  2958 	painter updateFromSpec:spec
  2963         painter updateFromSpec:spec
  2959     ]             
  2964     ]             
  2960 
  2965 
  2961 
  2966 
  2962 !
  2967 !
  2963 
  2968