12 "{ Package: 'stx:libtool2' }" |
12 "{ Package: 'stx:libtool2' }" |
13 |
13 |
14 ResourceSpecEditor subclass:#UIPainter |
14 ResourceSpecEditor subclass:#UIPainter |
15 instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool |
15 instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool |
16 helpTool painterView painter' |
16 helpTool painterView painter' |
17 classVariableNames:'' |
17 classVariableNames:'UseViewScroller' |
18 poolDictionaries:'' |
18 poolDictionaries:'' |
19 category:'Interface-UIPainter' |
19 category:'Interface-UIPainter' |
20 ! |
20 ! |
21 |
21 |
22 SelectionInTreeView subclass:#TreeView |
22 SelectionInTreeView subclass:#TreeView |
2826 name := name ? UIPainter defaultNameOfCanvas. |
2826 name := name ? UIPainter defaultNameOfCanvas. |
2827 painterView beToolWindow. |
2827 painterView beToolWindow. |
2828 painterView name:name. |
2828 painterView name:name. |
2829 painterView label:name. |
2829 painterView label:name. |
2830 painterView extent:(treeView windowSpecClass defaultExtentInUIPainter). |
2830 painterView extent:(treeView windowSpecClass defaultExtentInUIPainter). |
2831 painter := UIPainterView in:painterView. |
2831 |
2832 painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. |
2832 UseViewScroller == true ifTrue:[ |
|
2833 scroller := HVScrollableView for:ViewScroller in:painterView. |
|
2834 scroller |
|
2835 horizontalScrollable:true miniScroller:true; |
|
2836 verticalScrollable:true; verticalMini:true; |
|
2837 autoHideScrollBars:false; |
|
2838 layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. |
|
2839 viewScroller := scroller scrolledView. |
|
2840 painter := UIPainterView new. |
|
2841 painter extent:300@300. |
|
2842 viewScroller scrolledView:painter. |
|
2843 ] ifFalse:[ |
|
2844 painter := UIPainterView in:painterView. |
|
2845 painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. |
|
2846 ]. |
2833 treeView := treeView canvas:painter specName:name. |
2847 treeView := treeView canvas:painter specName:name. |
2834 painter treeView:treeView. |
2848 painter treeView:treeView. |
2835 treeView model addDependent:self. |
2849 treeView model addDependent:self. |
2836 painter enableChannel:(self enableChannel). |
2850 painter enableChannel:(self enableChannel). |
2837 |
2851 |
3101 "sets view for layout tool" |
3115 "sets view for layout tool" |
3102 |
3116 |
3103 |type| |
3117 |type| |
3104 |
3118 |
3105 self painter topView == aView ifTrue:[ |
3119 self painter topView == aView ifTrue:[ |
3106 type := #Extent |
3120 type := #Extent |
|
3121 ] ifFalse:[ |
|
3122 self canvas == aView ifTrue:[ |
|
3123 type := #Extent |
|
3124 ] |
3107 ]. |
3125 ]. |
3108 self layoutTool layoutView:aView type:type spec:aSpec |
3126 self layoutTool layoutView:aView type:type spec:aSpec |
3109 |
|
3110 ! |
3127 ! |
3111 |
3128 |
3112 specClass |
3129 specClass |
3113 specClass isNil ifTrue:[ |
3130 specClass isNil ifTrue:[ |
3114 specClassName notNil ifTrue:[ |
3131 specClassName notNil ifTrue:[ |
3135 |
3152 |
3136 "Modified: / 31-08-2006 / 10:10:22 / cg" |
3153 "Modified: / 31-08-2006 / 10:10:22 / cg" |
3137 ! ! |
3154 ! ! |
3138 |
3155 |
3139 !UIPainter methodsFor:'private-tools'! |
3156 !UIPainter methodsFor:'private-tools'! |
|
3157 |
|
3158 canvas |
|
3159 "returns the canvas view" |
|
3160 |
|
3161 UseViewScroller == true ifTrue:[ |
|
3162 ^ painter. |
|
3163 ]. |
|
3164 |
|
3165 ^ painter topView. |
|
3166 "/ ^ treeView canvas |
|
3167 |
|
3168 "Modified: / 05-09-2006 / 18:36:32 / cg" |
|
3169 ! |
3140 |
3170 |
3141 helpTool |
3171 helpTool |
3142 "returns the help tool" |
3172 "returns the help tool" |
3143 |
3173 |
3144 helpTool isNil ifTrue:[self noteBookView]. |
3174 helpTool isNil ifTrue:[self noteBookView]. |
3254 selectedSpecAndView |
3284 selectedSpecAndView |
3255 |spec view property| |
3285 |spec view property| |
3256 |
3286 |
3257 treeView isCanvasSelected ifTrue:[ |
3287 treeView isCanvasSelected ifTrue:[ |
3258 spec := treeView canvasSpec. |
3288 spec := treeView canvasSpec. |
3259 view := self painter topView. |
3289 view := self canvas. "/ self painter topView. |
3260 ] ifFalse:[ |
3290 ] ifFalse:[ |
3261 (property := treeView propertySelected) notNil ifTrue:[ |
3291 (property := treeView propertySelected) notNil ifTrue:[ |
3262 treeView canResizeSelectedWidget ifTrue:[ |
3292 treeView canResizeSelectedWidget ifTrue:[ |
3263 view := property view. |
3293 view := property view. |
3264 ]. |
3294 ]. |
3749 |
3779 |
3750 (layout := layoutTool layout) notNil ifTrue:[ |
3780 (layout := layoutTool layout) notNil ifTrue:[ |
3751 layoutTool layoutType == #Extent ifTrue:[ |
3781 layoutTool layoutType == #Extent ifTrue:[ |
3752 layoutView := layoutTool layoutView. |
3782 layoutView := layoutTool layoutView. |
3753 |
3783 |
3754 layoutView == painter topView ifTrue:[ |
3784 layoutView == self canvas ifTrue:[ |
3755 layoutView extent:layout |
3785 layoutView extent:layout. |
|
3786 UseViewScroller == true ifTrue:[ |
|
3787 layoutView container container sizeChanged:nil. |
|
3788 ]. |
3756 ] ifFalse:[ |
3789 ] ifFalse:[ |
3757 spec useDefaultExtent:(layoutTool aspectFor:#useDefaultExtent) value. |
3790 spec useDefaultExtent:(layoutTool aspectFor:#useDefaultExtent) value. |
3758 spec useDefaultExtent ifTrue:[ |
3791 spec useDefaultExtent ifTrue:[ |
3759 "/ temporarily unfreeze the widgets size |
3792 "/ temporarily unfreeze the widgets size |
3760 "/ (but remember, the old setting, which is actually |
3793 "/ (but remember, the old setting, which is actually |
4291 superclassName:specSuperclassName |
4324 superclassName:specSuperclassName |
4292 selector:specSelector. |
4325 selector:specSelector. |
4293 |
4326 |
4294 "/ Transcript showCR:'generating windowSpec code...'. |
4327 "/ Transcript showCR:'generating windowSpec code...'. |
4295 |
4328 |
4296 (painter topView extent > (800 @ 600)) ifTrue:[ |
4329 extentUsed := self canvas extent. |
|
4330 (extentUsed > (800 @ 600)) ifTrue:[ |
4297 Dialog |
4331 Dialog |
4298 warn:(resources |
4332 warn:(resources |
4299 stringWithCRs:'The application''s default window-size is taken from the current size and will be %1.\\This may be too small on some displays - if required, resize and save again.' |
4333 stringWithCRs:'The application''s default window-size is taken from the current size and will be %1.\\This may be too small on some displays - if required, resize and save again.' |
4300 with:painter topView extent printString allBold) |
4334 with:extentUsed printString allBold) |
4301 ]. |
4335 ]. |
4302 |
4336 |
4303 code := painter generateWindowSpecMethodSource withCRs. |
4337 code := painter generateWindowSpecMethodSource withCRs. |
4304 (ReadStream on:code) fileIn. |
4338 (ReadStream on:code) fileIn. |
4305 self doGenerateAspectSelectorsMethod. |
4339 self doGenerateAspectSelectorsMethod. |
4662 |fullSpec winSpec| |
4696 |fullSpec winSpec| |
4663 |
4697 |
4664 fullSpec := FullSpec new. |
4698 fullSpec := FullSpec new. |
4665 fullSpec name:specNameSymbol. |
4699 fullSpec name:specNameSymbol. |
4666 |
4700 |
4667 fullSpec fromBuilder:(self canvas topView) |
4701 fullSpec fromBuilder:(self canvas) |
4668 components:(SpecCollection new collection:aSpecArray). |
4702 components:(SpecCollection new collection:aSpecArray). |
4669 |
4703 |
4670 windowSpec notNil ifTrue:[ |
4704 windowSpec notNil ifTrue:[ |
4671 winSpec := fullSpec window. |
4705 winSpec := fullSpec window. |
4672 winSpec copyValuesFromSpec:windowSpec. |
4706 winSpec copyValuesFromSpec:windowSpec. |
4673 winSpec name: winSpec label. |
4707 winSpec name: winSpec label. |
4674 ]. |
4708 ]. |
4675 ^ fullSpec literalArrayEncoding. |
4709 ^ fullSpec literalArrayEncoding. |
4676 |
|
4677 ! |
4710 ! |
4678 |
4711 |
4679 setAttributesFromWindowSpec:aWindowSpec |
4712 setAttributesFromWindowSpec:aWindowSpec |
4680 "sets a window spec from aWindowSpec and applies some attributes |
4713 "sets a window spec from aWindowSpec and applies some attributes |
4681 to the canvas." |
4714 to the canvas." |