44 |
44 |
45 ! |
45 ! |
46 |
46 |
47 documentation |
47 documentation |
48 " |
48 " |
49 GUI-Builder: |
49 The GUI Painter allows the user to build its own applications providing a graphical |
50 this class allows the user to build its own applications providing a graphical |
50 user interface to building components and to define the behavior of the components |
51 user interface to buildin components and to define the behavior of the components |
|
52 during runtime. The resulting specifications can be installed as methods on |
51 during runtime. The resulting specifications can be installed as methods on |
53 classes, typically subclasses of an ApplicationModel. These specifications |
52 classes, typically subclasses of an ApplicationModel. These specifications |
54 are used by the UIBuilder to generate the application window and its component |
53 are used by the UIBuilder to generate the application window and its component |
55 structues when open the application. |
54 structues when open the application. |
56 |
55 |
225 #generateAspectMethods |
227 #generateAspectMethods |
226 'Generates aspect methods for defined aspect selectors of the widgets.' |
228 'Generates aspect methods for defined aspect selectors of the widgets.' |
227 |
229 |
228 #generateHookMethods |
230 #generateHookMethods |
229 'Generates startup/release methods. (#closeRequest, #postBuildWith:, #postOpenWith:)' |
231 'Generates startup/release methods. (#closeRequest, #postBuildWith:, #postOpenWith:)' |
|
232 |
|
233 #helpExamples |
|
234 'Opens a HTML-Browser on the documentation file with some examples of the GUI Painter.' |
|
235 |
|
236 #helpFunctions |
|
237 'Opens a HTML-Browser on the documentation file with the functions of the GUI Painter.' |
|
238 |
|
239 #helpLayoutTool |
|
240 'Opens a HTML-Browser on the documentation file of the Layout Tool.' |
|
241 |
|
242 #helpSelectedWidget |
|
243 'Opens a HTML-Browser on the documentation file of the selected widget.' |
230 |
244 |
231 #moveWidgetDown |
245 #moveWidgetDown |
232 'Moves the selected widget one step down.' |
246 'Moves the selected widget one step down.' |
233 |
247 |
234 #moveWidgetInto |
248 #moveWidgetInto |
764 #verticalLayout: #fit |
778 #verticalLayout: #fit |
765 #horizontalSpace: 0 |
779 #horizontalSpace: 0 |
766 #verticalSpace: 0 |
780 #verticalSpace: 0 |
767 ) |
781 ) |
768 #(#ActionButtonSpec |
782 #(#ActionButtonSpec |
769 #name: 'openSpecDocumentationButton' |
783 #name: 'openWidgetDocumentationButton' |
770 #layout: #(#LayoutFrame -32 1 -1 0 0 1 31 0) |
784 #layout: #(#LayoutFrame -32 1 -1 0 0 1 31 0) |
771 #activeHelpKey: #editOpenSpecDocumentation |
785 #activeHelpKey: #editOpenSpecDocumentation |
772 #hasCharacterOrientedLabel: false |
786 #hasCharacterOrientedLabel: false |
773 #label: 'helpIcon' |
787 #label: 'helpIcon' |
774 #model: #openSpecDocumentation |
788 #model: #openWidgetDocumentation |
775 ) |
789 ) |
776 #(#ActionButtonSpec |
790 #(#ActionButtonSpec |
777 #name: 'cancelButton' |
791 #name: 'cancelButton' |
778 #layout: #(#LayoutFrame 2 0 -26 1 -1 0.5 -2 1) |
792 #layout: #(#LayoutFrame 2 0 -26 1 -1 0.5 -2 1) |
779 #activeHelpKey: #cancel |
793 #activeHelpKey: #commitCancel |
780 #label: 'Cancel' |
794 #label: 'Cancel' |
781 #tabable: true |
795 #tabable: true |
782 #model: #cancel |
796 #model: #cancel |
783 #enableChannel: #modifiedChannel |
797 #enableChannel: #modifiedChannel |
784 ) |
798 ) |
785 #(#ActionButtonSpec |
799 #(#ActionButtonSpec |
786 #name: 'acceptButton' |
800 #name: 'acceptButton' |
787 #layout: #(#LayoutFrame 1 0.5 -26 1 -2 1 -2 1) |
801 #layout: #(#LayoutFrame 1 0.5 -26 1 -2 1 -2 1) |
788 #activeHelpKey: #accept |
802 #activeHelpKey: #commitOK |
789 #label: 'OK' |
803 #label: 'OK' |
790 #tabable: true |
804 #tabable: true |
791 #model: #accept |
805 #model: #accept |
792 #enableChannel: #modifiedChannel |
806 #enableChannel: #modifiedChannel |
793 ) |
807 ) |
813 |
827 |
814 windowSpecWithTranscriptHelp |
828 windowSpecWithTranscriptHelp |
815 "This resource specification was automatically generated |
829 "This resource specification was automatically generated |
816 by the UIPainter of ST/X." |
830 by the UIPainter of ST/X." |
817 |
831 |
818 "Do not manually edit this. If it is corrupted, |
832 "Do not manually edit this!! If it is corrupted, |
819 the UIPainter may not be able to read the specification." |
833 the UIPainter may not be able to read the specification." |
820 |
834 |
821 " |
835 " |
822 UIPainter new openOnClass:UIPainter andSelector:#windowSpecWithTranscriptHelp |
836 UIPainter new openOnClass:UIPainter andSelector:#windowSpecWithTranscriptHelp |
823 UIPainter new openInterface:#windowSpecWithTranscriptHelp |
837 UIPainter new openInterface:#windowSpecWithTranscriptHelp |
959 #activeHelpKey: #cancel |
973 #activeHelpKey: #cancel |
960 #label: 'Cancel' |
974 #label: 'Cancel' |
961 #tabable: true |
975 #tabable: true |
962 #model: #cancel |
976 #model: #cancel |
963 #enableChannel: #modifiedChannel |
977 #enableChannel: #modifiedChannel |
964 #extent: #(#Point 183 24) |
978 #extent: #(#Point 178 24) |
965 ) |
979 ) |
966 #(#ActionButtonSpec |
980 #(#ActionButtonSpec |
967 #name: 'acceptButton' |
981 #name: 'acceptButton' |
968 #activeHelpKey: #accept |
982 #activeHelpKey: #accept |
969 #label: 'OK' |
983 #label: 'OK' |
970 #tabable: true |
984 #tabable: true |
971 #model: #accept |
985 #model: #accept |
972 #enableChannel: #modifiedChannel |
986 #enableChannel: #modifiedChannel |
973 #extent: #(#Point 183 24) |
987 #extent: #(#Point 179 24) |
974 ) |
988 ) |
975 ) |
989 ) |
976 ) |
990 ) |
977 #horizontalLayout: #fitSpace |
991 #horizontalLayout: #fitSpace |
978 #verticalLayout: #fitSpace |
992 #verticalLayout: #fitSpace |
1241 #(#Menu |
1256 #(#Menu |
1242 |
1257 |
1243 #( |
1258 #( |
1244 #(#MenuItem |
1259 #(#MenuItem |
1245 #label: 'Tutorial' |
1260 #label: 'Tutorial' |
1246 #translateLabel: true |
|
1247 #value: #openHTMLDocument: |
1261 #value: #openHTMLDocument: |
1248 #activeHelpKey: #helpTutorial |
1262 #activeHelpKey: #helpTutorial |
1249 #argument: 'tools/uipainter/TOP.html' |
1263 #argument: 'tools/uipainter/TOP.html' |
1250 ) |
1264 ) |
1251 #(#MenuItem |
1265 #(#MenuItem |
1252 #label: '-' |
1266 #label: '-' |
1253 ) |
1267 ) |
1254 #(#MenuItem |
1268 #(#MenuItem |
1255 #label: 'Functions' |
1269 #label: 'Functions' |
1256 #translateLabel: true |
|
1257 #value: #openHTMLDocument: |
1270 #value: #openHTMLDocument: |
1258 #activeHelpKey: #helpTutorial |
1271 #activeHelpKey: #helpFunctions |
1259 #argument: 'tools/uipainter/Functions.html' |
1272 #argument: 'tools/uipainter/Functions.html' |
1260 ) |
1273 ) |
1261 #(#MenuItem |
1274 #(#MenuItem |
1262 #label: 'Examples' |
1275 #label: 'Examples' |
1263 #translateLabel: true |
|
1264 #value: #openHTMLDocument: |
1276 #value: #openHTMLDocument: |
1265 #activeHelpKey: #helpTutorial |
1277 #activeHelpKey: #helpExamples |
1266 #argument: 'tools/uipainter/Examples.html' |
1278 #argument: 'tools/uipainter/Examples.html' |
1267 ) |
1279 ) |
1268 #(#MenuItem |
1280 #(#MenuItem |
1269 #label: '-' |
1281 #label: '-' |
1270 ) |
1282 ) |
1271 #(#MenuItem |
1283 #(#MenuItem |
|
1284 #label: 'Help Tool' |
|
1285 #value: #openHTMLDocument: |
|
1286 #activeHelpKey: #helpHelpTool |
|
1287 #argument: 'tools/uipainter/HelpTool.html' |
|
1288 ) |
|
1289 #(#MenuItem |
|
1290 #label: 'Layout Tool' |
|
1291 #value: #openHTMLDocument: |
|
1292 #activeHelpKey: #helpLayoutTool |
|
1293 #argument: 'tools/uipainter/Layout.html' |
|
1294 ) |
|
1295 #(#MenuItem |
|
1296 #label: '-' |
|
1297 ) |
|
1298 #(#MenuItem |
|
1299 #label: 'Selected Widget' |
|
1300 #value: #openWidgetDocumentation |
|
1301 #activeHelpKey: #helpSelectedWidget |
|
1302 #enabled: #hasOneSelectionOtherThanCanvas |
|
1303 ) |
|
1304 #(#MenuItem |
|
1305 #label: '-' |
|
1306 ) |
|
1307 #(#MenuItem |
1272 #label: 'Show Help Texts' |
1308 #label: 'Show Help Texts' |
1273 #translateLabel: true |
|
1274 #activeHelpKey: #helpShowHelp |
1309 #activeHelpKey: #helpShowHelp |
1275 #indication: #showHelp: |
1310 #indication: #showHelp: |
1276 ) |
1311 ) |
1277 ) nil |
1312 ) nil |
1278 nil |
1313 nil |
1541 ) |
1577 ) |
1542 #(#MenuItem |
1578 #(#MenuItem |
1543 #label: '-' |
1579 #label: '-' |
1544 ) |
1580 ) |
1545 #(#MenuItem |
1581 #(#MenuItem |
1546 #label: 'Open Spec Documentation' |
1582 #label: 'Open Widget Documentation' |
1547 #value: #openSpecDocumentation |
1583 #value: #openWidgetDocumentation |
1548 #activeHelpKey: #editOpenSpecDocumentation |
1584 #activeHelpKey: #editOpenSpecDocumentation |
|
1585 ) |
|
1586 #(#MenuItem |
|
1587 #label: '-' |
|
1588 ) |
|
1589 #(#MenuItem |
|
1590 #label: 'Inspect View' |
|
1591 #value: #inspectView |
|
1592 #activeHelpKey: #editInspectView |
|
1593 #enabled: #hasOneSelectionOtherThanCanvas |
1549 ) |
1594 ) |
1550 #(#MenuItem |
1595 #(#MenuItem |
1551 #label: 'Inspect Spec' |
1596 #label: 'Inspect Spec' |
1552 #value: #inspectSpec |
1597 #value: #inspectSpec |
1553 #activeHelpKey: #editInspectSpec |
1598 #activeHelpKey: #editInspectSpec |
1932 self isModified ifTrue:[ |
1977 self isModified ifTrue:[ |
1933 (spec := self painter specForSelection) notNil ifTrue:[ |
1978 (spec := self painter specForSelection) notNil ifTrue:[ |
1934 key := spec activeHelpKey. |
1979 key := spec activeHelpKey. |
1935 ]. |
1980 ]. |
1936 self helpTool helpKey:key. |
1981 self helpTool helpKey:key. |
|
1982 |
|
1983 treeView isCanvasSelected ifTrue: [ |
|
1984 spec := treeView canvasSpec. |
|
1985 ]. |
1937 self specTool specification:spec. |
1986 self specTool specification:spec. |
1938 view := self layoutTool layoutView. |
1987 view := self layoutTool layoutView. |
1939 |
1988 |
1940 self setViewInLayoutTool:view. |
1989 self setViewInLayoutTool:view. |
1941 spec class == DataSetSpec ifTrue:[ |
1990 spec class == DataSetSpec ifTrue:[ |
1949 inspectSpec |
1998 inspectSpec |
1950 "inspect the selected specification" |
1999 "inspect the selected specification" |
1951 |
2000 |
1952 |spec| |
2001 |spec| |
1953 |
2002 |
1954 (spec := self painter specForSelection) isNil ifTrue:[ |
2003 (spec := self specForSelection) isNil ifTrue:[ |
1955 treeView isCanvasSelected ifTrue:[ |
2004 treeView isCanvasSelected ifTrue:[ |
1956 spec := treeView canvasSpec. |
2005 spec := treeView canvasSpec. |
1957 ] |
2006 ] |
1958 ]. |
2007 ]. |
1959 spec notNil ifTrue:[ |
2008 spec notNil ifTrue:[ |
1960 spec inspect |
2009 spec inspect |
1961 ] |
2010 ] |
1962 |
2011 |
1963 "Created: / 10.3.1998 / 18:11:42 / stefan" |
2012 |
1964 "Modified: / 10.3.1998 / 18:19:55 / stefan" |
2013 ! |
|
2014 |
|
2015 inspectView |
|
2016 "inspect the view of the selected specification" |
|
2017 |
|
2018 |selection view| |
|
2019 |
|
2020 ((selection := self painter selection) isCollection and: [selection size >= 1]) ifTrue:[ |
|
2021 selection first inspect |
|
2022 ] ifFalse: [ |
|
2023 selection inspect |
|
2024 ] |
|
2025 |
1965 ! |
2026 ! |
1966 |
2027 |
1967 moveSelectionDown |
2028 moveSelectionDown |
1968 "move selected components down |
2029 "move selected components down |
1969 " |
2030 " |
1989 " |
2050 " |
1990 self painter moveSelectionUp |
2051 self painter moveSelectionUp |
1991 |
2052 |
1992 ! |
2053 ! |
1993 |
2054 |
1994 openSpecDocumentation |
2055 openWidgetDocumentation |
1995 "open documentation for the selected specification" |
2056 "open documentation for the selected widget" |
1996 |
2057 |
1997 |spec| |
2058 |spec document| |
1998 |
2059 |
1999 (spec := self painter specForSelection) isNil ifTrue:[ |
2060 (spec := self specForSelection) isNil ifTrue:[ |
2000 treeView isCanvasSelected ifTrue:[ |
2061 treeView isCanvasSelected ifTrue:[ |
2001 spec := treeView canvasSpec. |
2062 spec := nil |
2002 ] |
2063 ] |
2003 ]. |
2064 ]. |
2004 spec notNil ifTrue:[ |
2065 spec notNil ifTrue:[ |
2005 HTMLDocumentView openFullOnDocumentationFile: 'tools/uipainter/', spec userFriendlyName,'.html' |
2066 document := 'tools/uipainter/Widgets/', spec userFriendlyName,'.html' |
2006 ] |
2067 ] ifFalse: [ |
|
2068 document := 'tools/uipainter/TOP.html#THEWIDGETSANDHOWDOTHEYWORK' |
|
2069 ]. |
|
2070 HTMLDocumentView openFullOnDocumentationFile: document |
|
2071 |
|
2072 |
2007 ! ! |
2073 ! ! |
2008 |
2074 |
2009 !UIPainter methodsFor:'aspects'! |
2075 !UIPainter methodsFor:'aspects'! |
2010 |
2076 |
2011 aspectFor:aKey |
2077 aspectFor:aKey |
2024 "returns a boolean value holder which is true in case that any selection exists |
2090 "returns a boolean value holder which is true in case that any selection exists |
2025 and all widgets in the selection can change its layout through to a move or |
2091 and all widgets in the selection can change its layout through to a move or |
2026 align operation |
2092 align operation |
2027 " |
2093 " |
2028 ^ builder booleanValueAspectFor:#canMoveOrAlignSelection |
2094 ^ builder booleanValueAspectFor:#canMoveOrAlignSelection |
|
2095 ! |
|
2096 |
|
2097 canMoveSelection |
|
2098 |
|
2099 ^self canChangeOrderInContainer value | |
|
2100 self canMoveSelectionOutOfContainer value | |
|
2101 self canMoveSelectionOutOfContainer value |
2029 ! |
2102 ! |
2030 |
2103 |
2031 canMoveSelectionIntoContainer |
2104 canMoveSelectionIntoContainer |
2032 "returns a boolean value holder which is true in case that one component is selected |
2105 "returns a boolean value holder which is true in case that one component is selected |
2033 and can change its container widget to the next element in the list which will have |
2106 and can change its container widget to the next element in the list which will have |
2083 |
2156 |
2084 (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
2157 (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
2085 noteBook := View new. |
2158 noteBook := View new. |
2086 layoutTool := UILayoutTool new. |
2159 layoutTool := UILayoutTool new. |
2087 helpTool := UIHelpTool new. |
2160 helpTool := UIHelpTool new. |
2088 helpTool helpSpecFrom:specClass. |
2161 helpTool buildFromClass:specClass. |
2089 specTool := UISpecificationTool new. |
2162 specTool := UISpecificationTool new. |
2090 channel := self modifiedChannel. |
2163 channel := self modifiedChannel. |
2091 |
2164 |
2092 layoutTool masterApplication:self. |
2165 layoutTool masterApplication:self. |
2093 specTool masterApplication:self. |
2166 specTool masterApplication:self. |
2545 self painter resetModification |
2617 self painter resetModification |
2546 ]. |
2618 ]. |
2547 ^true |
2619 ^true |
2548 ! |
2620 ! |
2549 |
2621 |
2550 defineClassAndSelector |
|
2551 "launch a dialog to define class, superclass and method" |
|
2552 |
|
2553 |again tmp| |
|
2554 |
|
2555 [ |
|
2556 again := false. |
|
2557 |
|
2558 (tmp := specClass) isNil ifTrue:[tmp := 'NewApplication']. |
|
2559 aspects at:#classNameChannel put:tmp asValue. |
|
2560 |
|
2561 (tmp := specSelector) isNil ifTrue:[tmp := 'windowSpec']. |
|
2562 aspects at:#methodNameChannel put:tmp asValue. |
|
2563 |
|
2564 (tmp := specSuperclass) isNil ifTrue:[tmp := 'ApplicationModel']. |
|
2565 aspects at:#superclassNameChannel put:tmp asValue. |
|
2566 |
|
2567 (self openDialogInterface:#dialogSpecForDefiningClassAndSelector) ifTrue:[ |
|
2568 |
|
2569 specClass := (self aspectFor:#classNameChannel) value. |
|
2570 specSelector := (self aspectFor:#methodNameChannel) value. |
|
2571 specSelector notNil ifTrue:[specSelector := specSelector asSymbol]. |
|
2572 specSuperclass := (self aspectFor:#superclassNameChannel) value. |
|
2573 |
|
2574 (again := self checkClassAndSelector not) ifFalse:[ |
|
2575 self painter className:specClass |
|
2576 superclassName:specSuperclass |
|
2577 selector:specSelector. |
|
2578 ] |
|
2579 ] |
|
2580 ifFalse: |
|
2581 [ |
|
2582 ^nil |
|
2583 ] |
|
2584 |
|
2585 ] doWhile:[again]. |
|
2586 |
|
2587 self specClass:specClass. |
|
2588 self helpTool modified: true |
|
2589 ! |
|
2590 |
|
2591 gridMenu |
|
2592 "open a dialog for grip parameters configuration |
|
2593 " |
|
2594 |hspace vspace bindings painter gridPara| |
|
2595 |
|
2596 painter := self painter. |
|
2597 bindings := IdentityDictionary new. |
|
2598 gridPara := painter gridParameters copy. |
|
2599 |
|
2600 bindings at:#showGrid put:(painter gridShown asValue). |
|
2601 bindings at:#alignToGrid put:(painter gridAlign asValue). |
|
2602 bindings at:#hspace put:((gridPara at:1) asValue). |
|
2603 bindings at:#vspace put:((gridPara at:2) asValue). |
|
2604 |
|
2605 (self openDialogInterface:#dialogSpecForDefiningGridParameters withBindings:bindings) ifFalse:[ |
|
2606 ^ self |
|
2607 ]. |
|
2608 |
|
2609 hspace := (bindings at:#hspace) value ? 5. |
|
2610 vspace := (bindings at:#vspace) value ? 5. |
|
2611 |
|
2612 gridPara at:1 put:hspace. |
|
2613 gridPara at:2 put:vspace. |
|
2614 gridPara at:5 put:hspace. |
|
2615 gridPara at:6 put:vspace. |
|
2616 |
|
2617 painter gridShown:false. |
|
2618 painter gridAlign:false. |
|
2619 painter gridParameters:gridPara. |
|
2620 painter gridAlign:(bindings at:#alignToGrid) value. |
|
2621 painter gridShown:(bindings at:#showGrid) value. |
|
2622 painter clear. |
|
2623 painter clear. |
|
2624 |
|
2625 ! |
|
2626 |
|
2627 hideUIView:aView |
2622 hideUIView:aView |
2628 "hide the view which is an application or top view |
2623 "hide the view which is an application or top view |
2629 " |
2624 " |
2630 aView beIndependent. |
2625 aView beIndependent. |
2631 aView unmap. |
2626 aView unmap. |
2876 self helpTool helpKey:(spec activeHelpKey). |
2873 self helpTool helpKey:(spec activeHelpKey). |
2877 slices := spec class slices. |
2874 slices := spec class slices. |
2878 size := slices size. |
2875 size := slices size. |
2879 |
2876 |
2880 view notNil ifTrue:[ |
2877 view notNil ifTrue:[ |
2881 list := Array new:(size + 2). |
2878 self treeView isCanvasSelected |
2882 list at:(size + 2) put:(UILayoutTool label). |
2879 ifFalse: |
|
2880 [ |
|
2881 list := Array new:(size + 2). |
|
2882 list at:(size + 2) put:(UILayoutTool label). |
|
2883 ] |
|
2884 ifTrue: |
|
2885 [ |
|
2886 list := Array new:(size + 1). |
|
2887 list at:(size + 1) put:(UILayoutTool label). |
|
2888 ]. |
2883 ] ifFalse:[ |
2889 ] ifFalse:[ |
2884 list := Array new:(size + 1). |
2890 list := Array new:(size + 1). |
2885 ]. |
2891 ]. |
|
2892 |
2886 1 to:size do:[:i| list at:i put:((slices at:i) first asString)]. |
2893 1 to:size do:[:i| list at:i put:((slices at:i) first asString)]. |
2887 list at:(size + 1) put:(UIHelpTool label). |
2894 self treeView isCanvasSelected ifFalse: [list at:(size + 1) put:(UIHelpTool label)]. |
2888 |
2895 |
2889 self tabList value:list. |
2896 self tabList value:list. |
2890 self show:(spec class name). |
2897 self show:(spec class name). |
2891 tabComponent enabled:true. |
2898 tabComponent enabled:true. |
2892 |
2899 |
2908 clipboard := self getSelection. |
2915 clipboard := self getSelection. |
2909 |
2916 |
2910 clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]] |
2917 clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]] |
2911 ifFalse:[sel := clipboard]. |
2918 ifFalse:[sel := clipboard]. |
2912 |
2919 |
2913 canPaste := (sel isKindOf:UISpecification) and: |
2920 canPaste := (sel isKindOf:UISpecification) and: |
2914 [treeView selection size = 1 |
2921 [treeView selection size = 1 |
2915 and:[treeView selection first == 1 |
2922 and:[treeView selection first == 1 |
2916 or: [self canPasteInto: treeView selectedNode contents view]]] |
2923 or: [self canPasteInto: treeView selectedNode contents view]]] |
2917 ]. |
2924 ]. |
2918 |
2925 |
2919 self valueOfCanCut value: canCutOrCopy. |
2926 self valueOfCanCut value: canCutOrCopy. |
2920 self valueOfCanCopy value: canCutOrCopy. |
2927 self valueOfCanCopy value: canCutOrCopy. |
2921 self valueOfCanPaste value: canPaste. |
2928 self valueOfCanPaste value: canPaste. |
2922 self valueOfCanPasteWithKeepingLayout value: (canPaste & self canKeepLayoutInSelection). |
2929 self valueOfCanPasteWithKeepingLayout value: (canPaste & self canKeepLayoutInSelection). |
2923 |
2930 |
2924 |
2931 |
2925 ! ! |
2932 ! ! |
2926 |
2933 |
3052 topView := self window. |
3059 topView := self window. |
3053 |
3060 |
3054 topView label:'GUI Painter'. |
3061 topView label:'GUI Painter'. |
3055 |
3062 |
3056 painterView openInGroup:(topView windowGroup). |
3063 painterView openInGroup:(topView windowGroup). |
3057 |
|
3058 painterView application:self. |
|
3059 painterView open. |
3064 painterView open. |
|
3065 painterView application:self. |
3060 |
3066 |
3061 painterView application:self. |
3067 painterView application:self. |
3062 selectionPanel := UISelectionPanel new. |
3068 selectionPanel := UISelectionPanel new. |
3063 selectionPanel allButOpenInterface:#windowSpec. |
3069 selectionPanel allButOpenInterface:#windowSpec. |
3064 selectionPanel window openInGroup:(topView windowGroup). |
3070 selectionPanel window openInGroup:(topView windowGroup). |
3118 "Modified: / 5.2.1998 / 09:48:15 / stefan" |
3123 "Modified: / 5.2.1998 / 09:48:15 / stefan" |
3119 ! |
3124 ! |
3120 |
3125 |
3121 postOpenWith: aBuilder |
3126 postOpenWith: aBuilder |
3122 |
3127 |
|
3128 |painter settings gridPara hspace vspace| |
|
3129 |
3123 super postOpenWith: aBuilder. |
3130 super postOpenWith: aBuilder. |
3124 |
3131 |
3125 treeView selection: (Array with: 1). |
3132 treeView selection: (Array with: 1). |
3126 self treeSelection. |
3133 self treeSelection. |
3127 self tabSelection: 'Basics' |
3134 |
|
3135 painter := self painter. |
|
3136 settings := self class settings. |
|
3137 gridPara := painter gridParameters copy. |
|
3138 hspace := settings at: #HGridSpace ifAbsent: [10]. |
|
3139 vspace := settings at: #VGridSpace ifAbsent: [10]. |
|
3140 gridPara at:1 put:hspace; at:2 put:vspace; at:5 put:hspace; at:6 put:vspace. |
|
3141 painter gridParameters:gridPara. |
|
3142 painter gridShown: (settings at: #GridShown ifAbsent: [false]). |
|
3143 painter gridAlign: (settings at: #GridAlign ifAbsent: [false]). |
|
3144 painter clear. |
3128 |
3145 |
3129 |
3146 |
3130 ! ! |
3147 ! ! |
3131 |
3148 |
3132 !UIPainter methodsFor:'user actions'! |
3149 !UIPainter methodsFor:'user actions'! |
3184 treeView class defaultFont: (font on: device). |
3201 treeView class defaultFont: (font on: device). |
3185 treeView font: treeView class defaultFont |
3202 treeView font: treeView class defaultFont |
3186 ] |
3203 ] |
3187 ! |
3204 ! |
3188 |
3205 |
|
3206 doDefineClassAndSelector |
|
3207 "launch a dialog to define class, superclass, and selector" |
|
3208 |
|
3209 |again tmp helpDict helpKey| |
|
3210 |
|
3211 [ |
|
3212 again := false. |
|
3213 |
|
3214 (tmp := specClass) isNil ifTrue:[tmp := 'NewApplication']. |
|
3215 aspects at:#classNameChannel put:tmp asValue. |
|
3216 |
|
3217 (tmp := specSelector) isNil ifTrue:[tmp := 'windowSpec']. |
|
3218 aspects at:#methodNameChannel put:tmp asValue. |
|
3219 |
|
3220 (tmp := specSuperclass) isNil ifTrue:[tmp := 'ApplicationModel']. |
|
3221 aspects at:#superclassNameChannel put:tmp asValue. |
|
3222 |
|
3223 (self openDialogInterface:#dialogSpecForDefiningClassAndSelector) ifTrue:[ |
|
3224 |
|
3225 specClass := (self aspectFor:#classNameChannel) value. |
|
3226 specSelector := (self aspectFor:#methodNameChannel) value. |
|
3227 specSelector notNil ifTrue:[specSelector := specSelector asSymbol]. |
|
3228 specSuperclass := (self aspectFor:#superclassNameChannel) value. |
|
3229 |
|
3230 (again := self checkClassAndSelector not) ifFalse:[ |
|
3231 self painter className:specClass |
|
3232 superclassName:specSuperclass |
|
3233 selector:specSelector. |
|
3234 ] |
|
3235 ] |
|
3236 ifFalse: |
|
3237 [ |
|
3238 ^nil |
|
3239 ] |
|
3240 |
|
3241 ] doWhile:[again]. |
|
3242 |
|
3243 specClass := specClass isBehavior ifTrue:[specClass name] |
|
3244 ifFalse:[specClass]. |
|
3245 |
|
3246 helpDict := self helpTool dictionary. |
|
3247 helpKey := self helpTool helpKey. |
|
3248 self helpTool buildFromClass:specClass. |
|
3249 self helpTool dictionary declareAllFrom: helpDict. |
|
3250 self helpTool updateList. |
|
3251 self helpTool helpKey: helpKey. |
|
3252 self modifiedChannel value: false. |
|
3253 self helpTool modified: true. |
|
3254 ! |
|
3255 |
|
3256 doDefineGrid |
|
3257 "open a dialog for grip parameters configuration |
|
3258 " |
|
3259 |hspace vspace bindings painter gridPara settings| |
|
3260 |
|
3261 painter := self painter. |
|
3262 bindings := IdentityDictionary new. |
|
3263 gridPara := painter gridParameters copy. |
|
3264 |
|
3265 bindings at:#showGrid put:((self class settings at: #GridShown ifAbsent: [painter gridShown]) asValue). |
|
3266 bindings at:#alignToGrid put:((self class settings at: #GridAlign ifAbsent: [painter gridAlign]) asValue). |
|
3267 bindings at:#hspace put:((gridPara at:1) asValue). |
|
3268 bindings at:#vspace put:((gridPara at:2) asValue). |
|
3269 |
|
3270 (self openDialogInterface:#dialogSpecForDefiningGridParameters withBindings:bindings) ifFalse:[ |
|
3271 ^ self |
|
3272 ]. |
|
3273 |
|
3274 hspace := (bindings at:#hspace) value ? 5. |
|
3275 vspace := (bindings at:#vspace) value ? 5. |
|
3276 |
|
3277 gridPara at:1 put:hspace. |
|
3278 gridPara at:2 put:vspace. |
|
3279 gridPara at:5 put:hspace. |
|
3280 gridPara at:6 put:vspace. |
|
3281 |
|
3282 painter gridShown:false. |
|
3283 painter gridAlign:false. |
|
3284 painter gridParameters:gridPara. |
|
3285 painter gridAlign:(bindings at:#alignToGrid) value. |
|
3286 painter gridShown:(bindings at:#showGrid) value. |
|
3287 settings := self class settings. |
|
3288 settings at: #GridShown put: (bindings at:#showGrid) value. |
|
3289 settings at: #GridAlign put: (bindings at:#alignToGrid) value. |
|
3290 settings at: #HGridSpace put: hspace. |
|
3291 settings at: #VGridSpace put: vspace. |
|
3292 painter clear. |
|
3293 |
|
3294 ! |
|
3295 |
3189 doGenerateAspectMethods |
3296 doGenerateAspectMethods |
3190 "generate aspect and action methods |
3297 "generate aspect and action methods |
3191 " |
3298 " |
3192 |code| |
3299 |code| |
3193 |
3300 |
3194 self treeSelection. "accept modifications" |
3301 self treeSelection. "accept modifications" |
3195 |
3302 |
3196 self hasSpecClassAndSelector ifFalse:[ |
3303 self hasSpecClassAndSelector ifFalse:[ |
3197 self defineClassAndSelector |
3304 self doDefineClassAndSelector |
3198 ]. |
3305 ]. |
3199 |
3306 |
3200 self checkClassAndSelector ifFalse:[ |
3307 self checkClassAndSelector ifFalse:[ |
3201 ^ self |
3308 ^ self |
3202 ]. |
3309 ]. |
3285 self askForModification ifFalse: [^nil]. |
3392 self askForModification ifFalse: [^nil]. |
3286 specClass := specSelector := nil. |
3393 specClass := specSelector := nil. |
3287 self painter removeAll. |
3394 self painter removeAll. |
3288 treeView canvas topView name: UIPainter defaultNameOfCanvas. |
3395 treeView canvas topView name: UIPainter defaultNameOfCanvas. |
3289 treeView canvas topView label: UIPainter defaultNameOfCanvas. |
3396 treeView canvas topView label: UIPainter defaultNameOfCanvas. |
3290 self helpTool reset. |
3397 self helpTool doNew. |
3291 treeView selection:#(1). |
3398 treeView selection:#(1). |
3292 self treeSelection. |
3399 self treeSelection. |
3293 self updateInfoLabel. |
3400 self updateInfoLabel. |
3294 ! |
3401 ! |
3295 |
3402 |
3354 painter className:specClass |
3461 painter className:specClass |
3355 superclassName:specSuperclass |
3462 superclassName:specSuperclass |
3356 selector:specSelector. |
3463 selector:specSelector. |
3357 |
3464 |
3358 code := painter generateWindowSpecMethodSource withCRs. |
3465 code := painter generateWindowSpecMethodSource withCRs. |
3359 painter resetModification. |
3466 |
3360 (ReadStream on:code) fileIn. |
3467 (ReadStream on:code) fileIn. |
3361 |
3468 |
3362 self helpTool installHelpSpecsOnClass:specClass. |
3469 self helpTool installHelpSpecsOnClass:specClass. |
3363 |
3470 |
3364 self updateInfoLabel. |
3471 self updateInfoLabel. |