104 "return a dictionary filled with helpKey -> helptext associations. |
104 "return a dictionary filled with helpKey -> helptext associations. |
105 These are used by the activeHelp tool. |
105 These are used by the activeHelp tool. |
106 " |
106 " |
107 ^ super helpSpec addPairsFrom:#( |
107 ^ super helpSpec addPairsFrom:#( |
108 |
108 |
109 #alignSelectionCenterVer |
109 #moveSelectionLeft |
110 'align selected widgets vertical' |
110 'move selected widgets left while pressing the button' |
111 |
111 |
112 #alignSelectionLeft |
112 #setToDefaultWidth |
113 'align selected widgets to the left edge of the dominant widget ( underlined )' |
113 'set selected widgets to their default width' |
114 |
114 |
115 #alignSelectionRight |
115 #pasteBuffer |
116 'align selected widgets to the right edge of the dominant widget ( underlined )' |
116 'paste widgets at current mouse position' |
117 |
117 |
118 #alignSelectionLeftAndRight |
118 #galleryShown |
119 'align selected widgets to the right and left edge of the dominant widget ( underlined )' |
119 'show or hide gallery view' |
120 |
120 |
121 #alignSelectionTop |
121 #moveSelectionDown |
122 'align selected widgets to the top edge of the dominant widget ( underlined )' |
122 'move selected widgets down while pressing the button' |
123 |
123 |
124 #alignSelectionBottom |
124 #moveSelectionUp |
125 'align selected widgets to the bottom edge of the dominant widget ( underlined )' |
125 'move selected widgets up while pressing the button' |
126 |
|
127 #alignSelectionTopAndBottom |
|
128 'align selected widgets to the top and bottom edge of the dominant widget ( underlined )' |
|
129 |
|
130 #alignSelectionCenterVer |
|
131 'align selected widgets horizontal to the center of the dominant widget ( underlined )' |
|
132 |
|
133 #alignSelectionCenterHor |
|
134 'align selected widgets vertical to the center of the dominant widget ( underlined )' |
|
135 |
126 |
136 #spreadSelectionVer |
127 #spreadSelectionVer |
137 'vertical spacing between selected widgets is made the same' |
128 'vertical spacing between selected widgets is made the same' |
138 |
129 |
|
130 #menuChangeHierarchy |
|
131 'change hierarchy of the selected widget' |
|
132 |
|
133 #copyExtent |
|
134 'copy extent of the selected widget' |
|
135 |
|
136 #moveSelectionRight |
|
137 'move selected widgets right while pressing the button' |
|
138 |
|
139 #cancel |
|
140 'reread specification and layout' |
|
141 |
|
142 #pasteWithLayout |
|
143 'paste widgets without changing their layouts' |
|
144 |
|
145 #alignSelectionRight |
|
146 'align selected widgets to the right edge of the dominant widget' |
|
147 |
|
148 #alignSelectionLeftAndRight |
|
149 'align selected widgets to the right and left edge of the dominant widget' |
|
150 |
|
151 #pasteWidth |
|
152 'change width of all selected widgets to the last copied extent width' |
|
153 |
|
154 #alignSelectionTopAndBottom |
|
155 'align selected widgets to the top and bottom edge of the dominant widget' |
|
156 |
|
157 #copyLayout |
|
158 'copy layout of the selected widget' |
|
159 |
|
160 #painterShown |
|
161 'show or hide painter view' |
|
162 |
|
163 #pasteExtent |
|
164 'change extent of all selected widgets to the last copied extent' |
|
165 |
|
166 #pasteHeight |
|
167 'change height of all selected widgets to the last copied extent height' |
|
168 |
|
169 #accept |
|
170 'write back changes' |
|
171 |
|
172 #centerSelectionVer |
|
173 'center vertical horizontal in contained view' |
|
174 |
|
175 #centerSelectionHor |
|
176 'center widgets horizontal to their top widget' |
|
177 |
|
178 #menuAlignment |
|
179 'provides a set of alignment operation on the current selected widgets' |
|
180 |
|
181 #alignSelectionCenterVer |
|
182 'align selected widgets horizontal to the center of the dominant widget' |
|
183 |
|
184 #pasteLayout |
|
185 'change layout of all selected widgets to the last copied layout' |
|
186 |
|
187 #alignSelectionLeft |
|
188 'align selected widgets to the left edge of the dominant widget' |
|
189 |
139 #spreadSelectionHor |
190 #spreadSelectionHor |
140 'horizontal spacing between selected widgets is made the same' |
191 'horizontal spacing between selected widgets is made the same' |
141 |
192 |
142 #centerSelectionHor |
193 #alignSelectionBottom |
143 'center widgets horizontal to their top widget' |
194 'align selected widgets to the bottom edge of the dominant widget' |
144 |
|
145 #centerSelectionVer |
|
146 'center vertical horizontal in contained view' |
|
147 |
195 |
148 #setToDefaultExtent |
196 #setToDefaultExtent |
149 'set selected widgets to their default extent' |
197 'set selected widgets to their default extent' |
150 |
198 |
151 #setToDefaultWidth |
199 #alignSelectionCenterHor |
152 'set selected widgets to their default width' |
200 'align selected widgets vertical to the center of the dominant widget' |
|
201 |
|
202 #alignSelectionTop |
|
203 'align selected widgets to the top edge of the dominant widget' |
153 |
204 |
154 #setToDefaultHeight |
205 #setToDefaultHeight |
155 'set selected widgets to their default height' |
206 'set selected widgets to their default height' |
156 |
207 |
157 #copyExtent |
|
158 'copy extent of the selected widget' |
|
159 |
|
160 #pasteExtent |
|
161 'change extent of all selected widgets to the last copied extent' |
|
162 |
|
163 #pasteWidth |
|
164 'change width of all selected widgets to the last copied extent width' |
|
165 |
|
166 #pasteHeight |
|
167 'change height of all selected widgets to the last copied extent height' |
|
168 |
|
169 #copyLayout |
|
170 'copy layout of the selected widget' |
|
171 |
|
172 #pasteLayout |
|
173 'change layout of all selected widgets to the last copied layout' |
|
174 |
|
175 #pasteBuffer |
|
176 'paste widgets at current mouse position' |
|
177 |
|
178 #pasteWithLayout |
|
179 'paste widgets without changing their layouts' |
|
180 |
|
181 #accept |
|
182 'write back changes' |
|
183 |
|
184 #cancel |
|
185 'reread specification and layout' |
|
186 |
|
187 #galleryShown |
|
188 'show or hide gallery view' |
|
189 |
|
190 #painterShown |
|
191 'show or hide painter view' |
|
192 |
|
193 #moveSelectionLeft |
|
194 'move selected widgets left while pressing the button' |
|
195 |
|
196 #moveSelectionRight |
|
197 'move selected widgets right while pressing the button' |
|
198 |
|
199 #moveSelectionDown |
|
200 'move selected widgets down while pressing the button' |
|
201 |
|
202 #moveSelectionUp |
|
203 'move selected widgets up while pressing the button' |
|
204 |
|
205 #menuChangeHierarchy |
|
206 'change hierarchy of the selected widget' |
|
207 |
|
208 #menuAlignment |
|
209 'provides a set of alignment operation on the current selected widgets' |
|
210 |
|
211 |
|
212 |
|
213 ) |
208 ) |
214 |
|
215 |
|
216 |
|
217 |
|
218 ! ! |
209 ! ! |
219 |
210 |
220 !UIPainter class methodsFor:'icons'! |
211 !UIPainter class methodsFor:'icons'! |
221 |
212 |
222 iconAlignB |
213 iconAlignB |
1240 accept |
1227 accept |
1241 "accept changes done to the specification. The component assigned to the |
1228 "accept changes done to the specification. The component assigned to the |
1242 specification will change immediately dependant on the attributes derived |
1229 specification will change immediately dependant on the attributes derived |
1243 from the specification. |
1230 from the specification. |
1244 " |
1231 " |
1245 |layout| |
1232 |layout spec prop key layoutTool| |
1246 |
1233 |
1247 self isLayoutToolSelected ifTrue:[ |
1234 self isLayoutToolSelected ifTrue:[ |
|
1235 layoutTool := self layoutTool. |
|
1236 |
1248 (layout := layoutTool layout) notNil ifTrue:[ |
1237 (layout := layoutTool layout) notNil ifTrue:[ |
1249 layoutTool layoutType == #Extent ifTrue:[ |
1238 layoutTool layoutType == #Extent ifTrue:[ |
1250 layoutTool layoutView == self painter topView ifTrue:[ |
1239 layoutTool layoutView == self painter topView ifTrue:[ |
1251 layoutTool layoutView extent:layout |
1240 layoutTool layoutView extent:layout |
1252 ] ifFalse:[ |
1241 ] ifFalse:[ |
1255 ] ifFalse:[ |
1244 ] ifFalse:[ |
1256 self painter setLayout:layout |
1245 self painter setLayout:layout |
1257 ] |
1246 ] |
1258 ] |
1247 ] |
1259 ] ifFalse:[ |
1248 ] ifFalse:[ |
|
1249 spec := self specTool specification. |
|
1250 |
1260 self isHelpToolSelected ifTrue:[ |
1251 self isHelpToolSelected ifTrue:[ |
1261 activeHelpTool accept |
1252 self helpTool accept. |
1262 ]. |
1253 key := self helpTool helpKey. |
1263 self painter updateFromSpec:(specTool specification). |
1254 prop := treeView propertySelected. |
|
1255 |
|
1256 prop notNil ifTrue:[ |
|
1257 prop spec activeHelpKey:key |
|
1258 ]. |
|
1259 spec activeHelpKey:key. |
|
1260 ] ifFalse:[ |
|
1261 self painter updateFromSpec:spec. |
|
1262 ] |
1264 ]. |
1263 ]. |
1265 self modifiedChannel value:false. |
1264 self modifiedChannel value:false. |
1266 |
|
1267 ! |
1265 ! |
1268 |
1266 |
1269 cancel |
1267 cancel |
1270 "cancel all changes done to the specification; reread attributes from the |
1268 "cancel all changes done to the specification; reread attributes from the |
1271 assigned component |
1269 assigned component |
1272 " |
1270 " |
|
1271 |spec key| |
|
1272 |
1273 self isModified ifTrue:[ |
1273 self isModified ifTrue:[ |
1274 specTool specification:(self painter specForSelection). |
1274 (spec := self painter specForSelection) notNil ifTrue:[ |
1275 self setViewInLayoutTool:(layoutTool layoutView). |
1275 key := spec activeHelpKey. |
|
1276 ]. |
|
1277 self helpTool helpKey:key. |
|
1278 self specTool specification:spec. |
|
1279 self setViewInLayoutTool:(self layoutTool layoutView). |
1276 self modifiedChannel value:false. |
1280 self modifiedChannel value:false. |
1277 ] |
1281 ] |
1278 ! |
1282 ! |
1279 |
1283 |
1280 moveSelectionDown |
1284 moveSelectionDown |
1329 aspect := nil. |
1335 aspect := nil. |
1330 ] do:[ |
1336 ] do:[ |
1331 aspect := aspect view asMenu. |
1337 aspect := aspect view asMenu. |
1332 ] |
1338 ] |
1333 ]. |
1339 ]. |
1334 |
|
1335 "/ aspect isNil ifTrue:[ |
|
1336 "/ self warn:'first enter (and confirm) the menus selector.'. |
|
1337 "/ ^ self. |
|
1338 "/ ]. |
|
1339 ]. |
1340 ]. |
1340 |
1341 |
1341 editor := MenuEditor new. |
1342 editor := MenuEditor new. |
1342 editor masterApplication:self. |
1343 editor masterApplication:self. |
1343 editor activeHelpTool:(self activeHelpTool). |
1344 editor useHelpDictionary:(self helpTool dictionary). |
1344 editor openModalOnClass:cls andSelector:aspect. |
1345 editor openModalOnClass:cls andSelector:aspect. |
|
1346 self helpTool updateList. |
1345 |
1347 |
1346 editor selectorName ~= aspect ifTrue:[ |
1348 editor selectorName ~= aspect ifTrue:[ |
1347 editor didInstall ifTrue:[ |
1349 editor didInstall ifTrue:[ |
1348 specTool specification menu:editor selectorName asSymbol. |
1350 self specTool specification menu:editor selectorName asSymbol. |
1349 self modifiedChannel value:true. |
1351 self modifiedChannel value:true. |
1350 self accept |
1352 self accept |
1351 ] |
1353 ] |
1352 ]. |
1354 ]. |
1353 ] |
1355 ] |
1354 |
1356 |
1355 "Modified: 31.7.1997 / 14:26:13 / cg" |
1357 "Modified: 31.7.1997 / 14:26:13 / cg" |
1356 ! ! |
1358 ! ! |
1357 |
1359 |
1358 !UIPainter methodsFor:'active help'! |
1360 !UIPainter methodsFor:'active help'! |
1359 |
|
1360 activeHelpTool |
|
1361 "setup help tool |
|
1362 " |
|
1363 activeHelpTool isNil ifTrue:[ |
|
1364 activeHelpTool := UIHelpTool new. |
|
1365 activeHelpTool helpSpecFrom:specClass. |
|
1366 activeHelpTool masterApplication:self. |
|
1367 ]. |
|
1368 ^ activeHelpTool |
|
1369 ! |
|
1370 |
1361 |
1371 showHelp:aHelpText for:view |
1362 showHelp:aHelpText for:view |
1372 "hook to allow an application to display active help |
1363 "hook to allow an application to display active help |
1373 texts in its own info area. |
1364 texts in its own info area. |
1374 This method may be redefined in a concrete application. |
1365 This method may be redefined in a concrete application. |
1446 ! |
1437 ! |
1447 |
1438 |
1448 noteBookView |
1439 noteBookView |
1449 "returns the notebook view; initialize components within the notebook |
1440 "returns the notebook view; initialize components within the notebook |
1450 " |
1441 " |
1451 |noteBook channel n1 n2| |
1442 |noteBook channel helpTool layoutTool specTool| |
1452 |
1443 |
1453 (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
1444 (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
1454 noteBook := View new. |
1445 noteBook := View new. |
1455 layoutTool := UILayoutTool new. |
1446 layoutTool := UILayoutTool new. |
|
1447 helpTool := UIHelpTool new. |
|
1448 helpTool helpSpecFrom:specClass. |
1456 specTool := UISpecificationTool new. |
1449 specTool := UISpecificationTool new. |
1457 channel := self modifiedChannel. |
1450 channel := self modifiedChannel. |
1458 |
1451 |
1459 layoutTool masterApplication:self. |
1452 layoutTool masterApplication:self. |
1460 specTool masterApplication:self. |
1453 specTool masterApplication:self. |
1461 |
1454 helpTool masterApplication:self. |
1462 n1 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
1455 |
1463 n2 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
1456 layoutCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
1464 |
1457 helpCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
1465 n1 client:layoutTool. |
1458 specCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
1466 specTool builder:(n2 client:specTool). |
1459 |
|
1460 layoutCanvas client:layoutTool. |
|
1461 helpCanvas client:helpTool. |
|
1462 specTool builder:(specCanvas client:specTool). |
1467 |
1463 |
1468 layoutTool masterApplication:self. |
1464 layoutTool masterApplication:self. |
1469 specTool masterApplication:self. |
1465 specTool masterApplication:self. |
|
1466 helpTool masterApplication:self. |
|
1467 |
1470 layoutTool modifiedHolder:channel. |
1468 layoutTool modifiedHolder:channel. |
|
1469 helpTool modifiedHolder:channel. |
1471 specTool modifiedHolder:channel. |
1470 specTool modifiedHolder:channel. |
|
1471 |
1472 builder aspectAt:#noteBookView put:noteBook. |
1472 builder aspectAt:#noteBookView put:noteBook. |
1473 ]. |
1473 ]. |
1474 ^ noteBook |
1474 ^ noteBook |
1475 ! |
1475 ! |
1476 |
1476 |
1667 self painter |
1675 self painter |
1668 className:clsName |
1676 className:clsName |
1669 superclassName:superClassName |
1677 superclassName:superClassName |
1670 selector:(selector ? ''). |
1678 selector:(selector ? ''). |
1671 |
1679 |
1672 specClass := clsName. |
1680 self specClass:clsName. |
1673 specSelector := (selector ? ''). |
1681 specSelector := (selector ? ''). |
1674 specSuperclass := superClassName. |
1682 specSuperclass := superClassName. |
1675 |
1683 |
1676 "Modified: 24.6.1997 / 19:07:01 / cg" |
1684 "Modified: 24.6.1997 / 19:07:01 / cg" |
1677 ! |
1685 ! |
1678 |
1686 |
1679 setViewInLayoutTool:aView |
1687 setViewInLayoutTool:aView |
1680 "set view for layout tool |
1688 "set view for layout tool |
1681 " |
1689 " |
1682 self painter topView ~~ aView ifTrue:[ |
1690 |type| |
1683 layoutTool layoutView:aView type:nil |
1691 |
1684 ] ifFalse:[ |
1692 self painter topView == aView ifTrue:[ |
1685 layoutTool layoutView:aView type:#Extent |
1693 type := #Extent |
1686 ]. |
1694 ]. |
1687 |
1695 self layoutTool layoutView:aView type:type |
1688 |
1696 |
|
1697 ! |
|
1698 |
|
1699 specClass:aClass |
|
1700 specClass := aClass. |
|
1701 self helpTool helpSpecFrom:specClass. |
|
1702 ! ! |
|
1703 |
|
1704 !UIPainter methodsFor:'private tools'! |
|
1705 |
|
1706 helpTool |
|
1707 "returns the help tool |
|
1708 " |
|
1709 helpCanvas isNil ifTrue:[ |
|
1710 self noteBookView |
|
1711 ]. |
|
1712 ^ helpCanvas application |
|
1713 ! |
|
1714 |
|
1715 layoutTool |
|
1716 "returns the layout tool |
|
1717 " |
|
1718 layoutCanvas isNil ifTrue:[ |
|
1719 self noteBookView |
|
1720 ]. |
|
1721 ^ layoutCanvas application |
|
1722 ! |
|
1723 |
|
1724 painter |
|
1725 "returns the painter/canvas view |
|
1726 " |
|
1727 ^ treeView canvas |
|
1728 ! |
|
1729 |
|
1730 specTool |
|
1731 "returns the spec tool |
|
1732 " |
|
1733 specCanvas isNil ifTrue:[ |
|
1734 self noteBookView |
|
1735 ]. |
|
1736 ^ specCanvas application |
1689 ! ! |
1737 ! ! |
1690 |
1738 |
1691 !UIPainter methodsFor:'queries'! |
1739 !UIPainter methodsFor:'queries'! |
1692 |
1740 |
1693 hasSpecClass |
1741 hasSpecClass |
1794 spec := property spec copy. |
1835 spec := property spec copy. |
1795 ] |
1836 ] |
1796 ]. |
1837 ]. |
1797 tabComponent := builder componentAt:#noteBook. |
1838 tabComponent := builder componentAt:#noteBook. |
1798 self setViewInLayoutTool:view. |
1839 self setViewInLayoutTool:view. |
1799 specTool specification:spec. |
1840 self specTool specification:spec. |
1800 |
1841 |
1801 spec notNil ifTrue:[ |
1842 spec notNil ifTrue:[ |
|
1843 self helpTool helpKey:(spec activeHelpKey). |
1802 list := spec class slices collect:[:aSlice| aSlice first asString]. |
1844 list := spec class slices collect:[:aSlice| aSlice first asString]. |
1803 view notNil ifTrue:[list add:(layoutTool class label)]. |
1845 list add:(UIHelpTool label). |
|
1846 list add:(UILayoutTool label). |
1804 self tabList value:list. |
1847 self tabList value:list. |
1805 self showHelp:(spec class name) for:nil. |
1848 self showHelp:(spec class name) for:nil. |
1806 tabComponent enabled:true. |
1849 tabComponent enabled:true. |
1807 |
1850 |
1808 (tabSelection := tabComponent selection) isNil ifTrue:[ |
1851 (tabSelection := tabComponent selection) isNil ifTrue:[ |
1809 tabComponent setSelection:(tabSelection := list first) |
1852 tabComponent setSelection:(tabSelection := list first) |
1810 ]. |
1853 ]. |
1811 self isLayoutToolSelected ifTrue:[ |
1854 self raiseTabView |
1812 (self noteBookView subViews at:1) raise |
|
1813 ] ifFalse:[ |
|
1814 specTool selection:tabSelection. |
|
1815 (self noteBookView subViews at:2) raise |
|
1816 ] |
|
1817 ] ifFalse:[ |
1855 ] ifFalse:[ |
|
1856 self helpTool helpKey:nil. |
1818 tabComponent enabled:false. |
1857 tabComponent enabled:false. |
1819 self showHelp:'' for:nil. |
1858 self showHelp:'' for:nil. |
1820 ]. |
1859 ]. |
1821 self modifiedChannel value:false. |
1860 self modifiedChannel value:false. |
1822 |
|
1823 ! ! |
1861 ! ! |
1824 |
1862 |
1825 !UIPainter methodsFor:'startup / release'! |
1863 !UIPainter methodsFor:'startup / release'! |
1826 |
1864 |
1827 closeRequest |
1865 closeRequest |
2076 (tmp := specSuperclass) isNil ifTrue:[tmp := 'ApplicationModel']. |
2112 (tmp := specSuperclass) isNil ifTrue:[tmp := 'ApplicationModel']. |
2077 aspects at:#superclassNameChannel put:tmp asValue. |
2113 aspects at:#superclassNameChannel put:tmp asValue. |
2078 |
2114 |
2079 (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[ |
2115 (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[ |
2080 |
2116 |
2081 specClass := (self aspectFor:#classNameChannel) value. |
2117 specClass := (self aspectFor:#classNameChannel) value. |
2082 specSelector := (self aspectFor:#methodNameChannel) value. |
2118 specSelector := (self aspectFor:#methodNameChannel) value. |
2083 specSelector notNil ifTrue:[specSelector := specSelector asSymbol]. |
2119 specSelector notNil ifTrue:[specSelector := specSelector asSymbol]. |
2084 specSuperclass := (self aspectFor:#superclassNameChannel) value. |
2120 specSuperclass := (self aspectFor:#superclassNameChannel) value. |
2085 |
2121 |
2086 (again := self checkClassAndSelector not) ifFalse:[ |
2122 (again := self checkClassAndSelector not) ifFalse:[ |