UIPainter.st
changeset 3032 41f4128c029c
parent 3025 7509aa3559e9
child 3051 ebb32d3a997e
equal deleted inserted replaced
3031:a301eabbab46 3032:41f4128c029c
   202     ^ super helpSpec addPairsFrom:#(
   202     ^ super helpSpec addPairsFrom:#(
   203 
   203 
   204 #align
   204 #align
   205 'Widget alignment functions'
   205 'Widget alignment functions'
   206 
   206 
       
   207 #alignResizeSelectionBottom
       
   208 'Resize the selected widgets'' bottom edges to align them with the bottom of the dominant widget'
       
   209 
       
   210 #alignResizeSelectionLeft
       
   211 'Resize the selected widgets'' left edges to align them with the left edge of the dominant widget'
       
   212 
       
   213 #alignResizeSelectionRight
       
   214 'Resize the selected widgets'' right edges to align them with the right edge of the dominant widget'
       
   215 
       
   216 #alignResizeSelectionTop
       
   217 'Resize the selected widgets'' top edges to align them with the top edge of the dominant widget'
       
   218 
   207 #alignSelectionBottom
   219 #alignSelectionBottom
   208 'Aligns the selected widgets'' bottom edges with the bottom of the dominant widget'
   220 'Aligns the selected widgets'' bottom edges with the bottom of the dominant widget'
   209 
   221 
   210 #alignResizeSelectionBottom
       
   211 'Resize the selected widgets'' bottom edges to align them with the bottom of the dominant widget'
       
   212 
       
   213 #alignSelectionCenterHor
   222 #alignSelectionCenterHor
   214 'Aligns the selected widgets'' centers vertically with the center of the dominant widget'
   223 'Aligns the selected widgets'' centers vertically with the center of the dominant widget'
   215 
   224 
   216 #alignSelectionCenterVer
   225 #alignSelectionCenterVer
   217 'Aligns the selected widgets'' centers horizontally with the center of the dominant widget'
   226 'Aligns the selected widgets'' centers horizontally with the center of the dominant widget'
   218 
   227 
   219 #alignSelectionLeft
   228 #alignSelectionLeft
   220 'Aligns the selected widgets'' left edges with the left edge of the dominant widget'
   229 'Aligns the selected widgets'' left edges with the left edge of the dominant widget'
   221 
   230 
   222 #alignResizeSelectionLeft
       
   223 'Resize the selected widgets'' left edges to align them with the left edge of the dominant widget'
       
   224 
       
   225 #alignSelectionLeftAndRight
   231 #alignSelectionLeftAndRight
   226 'Aligns the selected widgets'' left & right edges with the dominant widget'
   232 'Aligns the selected widgets'' left & right edges with the dominant widget'
   227 
   233 
   228 #alignSelectionRight
   234 #alignSelectionRight
   229 'Aligns the selected widgets'' right edges with the right edge of the dominant widget'
   235 'Aligns the selected widgets'' right edges with the right edge of the dominant widget'
   230 
   236 
   231 #alignResizeSelectionRight
       
   232 'Resize the selected widgets'' right edges to align them with the right edge of the dominant widget'
       
   233 
       
   234 #alignSelectionTop
   237 #alignSelectionTop
   235 'Aligns the selected widgets'' top edges with the top edge of the dominant widget'
   238 'Aligns the selected widgets'' top edges with the top edge of the dominant widget'
   236 
   239 
   237 #alignResizeSelectionTop
       
   238 'Resize the selected widgets'' top edges to align them with the top edge of the dominant widget'
       
   239 
       
   240 #alignSelectionTopAndBottom
   240 #alignSelectionTopAndBottom
   241 'Aligns the selected widgets'' top and bottom edges with the dominant widget'
   241 'Aligns the selected widgets'' top and bottom edges with the dominant widget'
   242 
   242 
       
   243 #alignToGrid
       
   244 'Am Raster ausrichten'
       
   245 
   243 #centerSelectionHor
   246 #centerSelectionHor
   244 'Centers the selected widgets horizontally within their containing widget'
   247 'Centers the selected widgets horizontally within their containing widget'
   245 
   248 
   246 #centerSelectionVer
   249 #centerSelectionVer
   247 'Centers the selected widgets vertically within their containing widget'
   250 'Centers the selected widgets vertically within their containing widget'
   298 'Opens an inspector on the selected widget'
   301 'Opens an inspector on the selected widget'
   299 
   302 
   300 #editOpenSpecDocumentation
   303 #editOpenSpecDocumentation
   301 'Opens the documentation of the selected widget'
   304 'Opens the documentation of the selected widget'
   302 
   305 
       
   306 #editSaveSpecForSelection
       
   307 'Generate a sub-spec method for the selected element only.\Useful when refactoring an existing spec into sub specifications.'
       
   308 
   303 #fileBrowseAspectMethods
   309 #fileBrowseAspectMethods
   304 'Opens a System Browser on the application''s aspect methods'
   310 'Opens a System Browser on the application''s aspect methods'
   305 
   311 
   306 #fileBrowseClass
   312 #fileBrowseClass
   307 'Open a System Browser on the application''s class'
   313 'Open a System Browser on the application''s class'
   331 'Generates aspect methods for defined aspect selectors of the widgets'
   337 'Generates aspect methods for defined aspect selectors of the widgets'
   332 
   338 
   333 #generateHookMethods
   339 #generateHookMethods
   334 'Generates startup/release methods. (#closeRequest, #postBuildWith:, #postOpenWith:)'
   340 'Generates startup/release methods. (#closeRequest, #postBuildWith:, #postOpenWith:)'
   335 
   341 
   336 #group
   342 "/ #group
   337 ''
   343 "/ ''
   338 
   344 
   339 #helpExamples
   345 #helpExamples
   340 'Show some examples uses of the GUI Painter'
   346 'Show some examples uses of the GUI Painter'
   341 
   347 
   342 #helpFunctions
   348 #helpFunctions
   364 'Moves the selected widget out of its parent widget'
   370 'Moves the selected widget out of its parent widget'
   365 
   371 
   366 #moveWidgetUp
   372 #moveWidgetUp
   367 'Moves the selected widget up in the list (brings it to the back)'
   373 'Moves the selected widget up in the list (brings it to the back)'
   368 
   374 
       
   375 #openColorEditor
       
   376 'Open a color editor'
       
   377 
   369 #pasteBuffer
   378 #pasteBuffer
   370 'Pastes the widgets of the clipboard at the current mouse position'
   379 'Pastes the widgets of the clipboard at the current mouse position'
   371 
   380 
   372 #pasteWithLayout
   381 #pasteWithLayout
   373 'Pastes the widgets of the clipboard without changing their layouts'
   382 'Pastes the widgets of the clipboard without changing their layouts'
   374 
   383 
   375 #referToCOnfigDatabase
   384 #pickColorFromScreen
       
   385 'Pick a color from the screen'
       
   386 
       
   387 #recentlyUsedColors
       
   388 'Pick a recently used color'
       
   389 
       
   390 #referToConfigDatabase
   376 ''
   391 ''
   377 
   392 
   378 #settingsAspectsAsInstances
   393 #settingsAspectsAsInstances
   379 'Generate aspects as instance variables (or bindings, if off)'
   394 'Generate aspects as instance variables (or bindings, if off)'
   380 
   395 
   383 
   398 
   384 #settingsGallery
   399 #settingsGallery
   385 'Shows or hides the gallery window'
   400 'Shows or hides the gallery window'
   386 
   401 
   387 #settingsGenerateCommentedCode
   402 #settingsGenerateCommentedCode
   388 ''
   403 'Enables/disables comments in the generated code, especially in aspect and hook methods'
   389 
   404 
   390 #settingsGridManager
   405 #settingsGridManager
   391 'Opens a dialog to toggle grid display or to change the grids spacing'
   406 'Opens a dialog to toggle grid display or to change the grids spacing'
   392 
   407 
   393 #settingsRedefineAspectMethods
   408 #settingsRedefineAspectMethods
   397 'Toggles display of help texts (after opening a new GUI Painter)'
   412 'Toggles display of help texts (after opening a new GUI Painter)'
   398 
   413 
   399 #settingsUndoManager
   414 #settingsUndoManager
   400 'Opens a dialog to undo modifications'
   415 'Opens a dialog to undo modifications'
   401 
   416 
       
   417 #shadesOfBlue
       
   418 'Blue color tones'
       
   419 
       
   420 #shadesOfCyan
       
   421 'Cyan color tones'
       
   422 
       
   423 #shadesOfGray
       
   424 'Gray color tones'
       
   425 
       
   426 #shadesOfGreen
       
   427 'Green color tones'
       
   428 
       
   429 #shadesOfMagenta
       
   430 'Magenta color tones'
       
   431 
       
   432 #shadesOfRed
       
   433 'Red color tones'
       
   434 
       
   435 #shadesOfYellow
       
   436 'Yellow color tones'
       
   437 
   402 #showGrid
   438 #showGrid
   403 'Raster zeigen'
   439 'Raster zeigen'
   404 
   440 
   405 #alignToGrid
       
   406 'Am Raster ausrichten'
       
   407 
       
   408 #sortItems
   441 #sortItems
   409 'Sort the selected items by position (left to right, top to bottom)'
   442 'Sort the selected items by position (left to right, top to bottom)'
   410 
   443 
   411 #spreadSelectionHor
   444 #spreadSelectionHor
   412 'Sets the horizontal spaces between the selected widgets to the same value'
   445 'Sets the horizontal spaces between the selected widgets to the same value'
   418 'Toggles geometry test mode (to define ratios of variable panels and top-window dimension)'
   451 'Toggles geometry test mode (to define ratios of variable panels and top-window dimension)'
   419 
   452 
   420 #testStartApplication
   453 #testStartApplication
   421 'Starts the application with the current window spec'
   454 'Starts the application with the current window spec'
   422 
   455 
   423 shadesOfRed
   456 #useDefaultColorToggle
   424 'Red color tones'
       
   425 
       
   426 shadesOfGreen
       
   427 'Green color tones'
       
   428 
       
   429 shadesOfBlue
       
   430 'Blue color tones'
       
   431 
       
   432 shadesOfCyan
       
   433 'Cyan color tones'
       
   434 
       
   435 shadesOfMagenta
       
   436 'Magenta color tones'
       
   437 
       
   438 shadesOfYellow
       
   439 'Yellow color tones'
       
   440 
       
   441 shadesOfGray
       
   442 'Gray color tones'
       
   443 
       
   444 openColorEditor
       
   445 'Open a color editor'
       
   446 
       
   447 pickColorFromScreen
       
   448 'Pick a color from the screen'
       
   449 
       
   450 recentlyUsedColors
       
   451 'Pick a recently used color'
       
   452 
       
   453 useDefaultColorToggle
       
   454 'Toggle between default and explicit color'
   457 'Toggle between default and explicit color'
   455 
   458 
   456 )
   459 )
   457 
       
   458     "Modified: / 09-08-2012 / 09:40:53 / cg"
       
   459 ! !
   460 ! !
   460 
   461 
   461 !UIPainter class methodsFor:'helpers'!
   462 !UIPainter class methodsFor:'helpers'!
   462 
   463 
   463 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   464 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
  2150      by the MenuEditor of ST/X."
  2151      by the MenuEditor of ST/X."
  2151 
  2152 
  2152     "Do not manually edit this!! If it is corrupted,
  2153     "Do not manually edit this!! If it is corrupted,
  2153      the MenuEditor may not be able to read the specification."
  2154      the MenuEditor may not be able to read the specification."
  2154 
  2155 
       
  2156 
  2155     "
  2157     "
  2156      MenuEditor new openOnClass:UIPainter andSelector:#menuEdit
  2158      MenuEditor new openOnClass:UIPainter andSelector:#menuEdit
  2157      (Menu new fromLiteralArrayEncoding:(UIPainter menuEdit)) startUp
  2159      (Menu new fromLiteralArrayEncoding:(UIPainter menuEdit)) startUp
  2158     "
  2160     "
  2159 
  2161 
  2166             activeHelpKey: editUndo
  2168             activeHelpKey: editUndo
  2167             enabled: hasUndoHistory
  2169             enabled: hasUndoHistory
  2168             label: 'Undo'
  2170             label: 'Undo'
  2169             itemValue: undoLast
  2171             itemValue: undoLast
  2170             nameKey: undo
  2172             nameKey: undo
  2171             translateLabel: true
       
  2172           )
  2173           )
  2173          (MenuItem
  2174          (MenuItem
  2174             label: '-'
  2175             label: '-'
  2175           )
  2176           )
  2176          (MenuItem
  2177          (MenuItem
  2177             activeHelpKey: editCut
  2178             activeHelpKey: editCut
  2178             enabled: canCutHolder
  2179             enabled: canCutHolder
  2179             label: 'Cut'
  2180             label: 'Cut'
  2180             itemValue: deleteSelection
  2181             itemValue: deleteSelection
  2181             translateLabel: true
       
  2182           )
  2182           )
  2183          (MenuItem
  2183          (MenuItem
  2184             activeHelpKey: editCopy
  2184             activeHelpKey: editCopy
  2185             enabled: canCopyHolder
  2185             enabled: canCopyHolder
  2186             label: 'Copy'
  2186             label: 'Copy'
  2187             itemValue: copySelection
  2187             itemValue: copySelection
  2188             translateLabel: true
       
  2189           )
  2188           )
  2190          (MenuItem
  2189          (MenuItem
  2191             activeHelpKey: editPaste
  2190             activeHelpKey: editPaste
  2192             enabled: canPasteHolder
  2191             enabled: canPasteHolder
  2193             label: 'Paste'
  2192             label: 'Paste'
  2194             itemValue: pasteBuffer
  2193             itemValue: pasteBuffer
  2195             translateLabel: true
       
  2196           )
  2194           )
  2197          (MenuItem
  2195          (MenuItem
  2198             activeHelpKey: pasteWithLayout
  2196             activeHelpKey: pasteWithLayout
  2199             enabled: canPasteKeepingLayoutHolder
  2197             enabled: canPasteKeepingLayoutHolder
  2200             label: 'Paste with Layout'
  2198             label: 'Paste with Layout'
  2201             itemValue: pasteWithLayout
  2199             itemValue: pasteWithLayout
  2202             translateLabel: true
       
  2203           )
  2200           )
  2204          (MenuItem
  2201          (MenuItem
  2205             activeHelpKey: editPaste
  2202             activeHelpKey: editPaste
  2206             enabled: canPasteKeepingLayoutHolder
  2203             enabled: canPasteKeepingLayoutHolder
  2207             label: 'Paste Keeping Absolute Position'
  2204             label: 'Paste Keeping Absolute Position'
  2208             itemValue: pasteKeepingPosition
  2205             itemValue: pasteKeepingPosition
  2209             translateLabel: true
       
  2210           )
  2206           )
  2211          (MenuItem
  2207          (MenuItem
  2212             activeHelpKey: editDelete
  2208             activeHelpKey: editDelete
  2213             enabled: canCutHolder
  2209             enabled: canCutHolder
  2214             label: 'Delete'
  2210             label: 'Delete'
  2215             itemValue: deleteTotalSelection
  2211             itemValue: deleteTotalSelection
  2216             translateLabel: true
       
  2217           )
  2212           )
  2218          (MenuItem
  2213          (MenuItem
  2219             activeHelpKey: replaceBy
  2214             activeHelpKey: replaceBy
  2220             enabled: canReplaceSelection
  2215             enabled: canReplaceSelection
  2221             label: 'Replace By...'
  2216             label: 'Replace By...'
  2222             itemValue: doAskAndReplaceWidgetBy
  2217             itemValue: doAskAndReplaceWidgetBy
  2223             translateLabel: true
       
  2224           )
  2218           )
  2225          (MenuItem
  2219          (MenuItem
  2226             label: '-'
  2220             label: '-'
  2227           )
  2221           )
  2228          (MenuItem
  2222          (MenuItem
  2229             enabled: canMoveSelection
  2223             enabled: canMoveSelection
  2230             label: 'Move'
  2224             label: 'Move'
  2231             translateLabel: true
       
  2232             submenuChannel: menuMove
  2225             submenuChannel: menuMove
  2233           )
  2226           )
  2234          (MenuItem
  2227          (MenuItem
  2235             enabled: canMoveOrAlignSelection
  2228             enabled: canMoveOrAlignSelection
  2236             label: 'Align'
  2229             label: 'Align'
  2237             translateLabel: true
       
  2238             submenuChannel: menuAlign
  2230             submenuChannel: menuAlign
  2239           )
  2231           )
  2240          (MenuItem
  2232          (MenuItem
  2241             enabled: hasSelection
  2233             enabled: hasSelection
  2242             label: 'Dimension'
  2234             label: 'Dimension'
  2243             translateLabel: true
       
  2244             submenu: 
  2235             submenu: 
  2245            (Menu
  2236            (Menu
  2246               (
  2237               (
  2247                (MenuItem
  2238                (MenuItem
  2248                   activeHelpKey: editDimensionCopyLayout
  2239                   activeHelpKey: editDimensionCopyLayout
  2249                   enabled: hasSingleSelection
  2240                   enabled: hasSingleSelection
  2250                   label: 'Copy Layout'
  2241                   label: 'Copy Layout'
  2251                   itemValue: copyLayout
  2242                   itemValue: copyLayout
  2252                   translateLabel: true
       
  2253                 )
  2243                 )
  2254                (MenuItem
  2244                (MenuItem
  2255                   activeHelpKey: editDimensionPasteLayout
  2245                   activeHelpKey: editDimensionPasteLayout
  2256                   enabled: canMoveOrAlignSelection
  2246                   enabled: canMoveOrAlignSelection
  2257                   label: 'Paste Layout'
  2247                   label: 'Paste Layout'
  2258                   itemValue: pasteLayout
  2248                   itemValue: pasteLayout
  2259                   translateLabel: true
       
  2260                 )
  2249                 )
  2261                (MenuItem
  2250                (MenuItem
  2262                   activeHelpKey: editDimensionExchangeLayouts
  2251                   activeHelpKey: editDimensionExchangeLayouts
  2263                   enabled: canExchangeSelectionLayouts
  2252                   enabled: canExchangeSelectionLayouts
  2264                   label: 'Exchange Layouts'
  2253                   label: 'Exchange Layouts'
  2265                   itemValue: exchangeLayouts
  2254                   itemValue: exchangeLayouts
  2266                   translateLabel: true
       
  2267                 )
  2255                 )
  2268                (MenuItem
  2256                (MenuItem
  2269                   label: '-'
  2257                   label: '-'
  2270                 )
  2258                 )
  2271                (MenuItem
  2259                (MenuItem
  2272                   activeHelpKey: editDimensionCopyExtent
  2260                   activeHelpKey: editDimensionCopyExtent
  2273                   enabled: hasSingleSelection
  2261                   enabled: hasSingleSelection
  2274                   label: 'Copy Extent'
  2262                   label: 'Copy Extent'
  2275                   itemValue: copyExtent
  2263                   itemValue: copyExtent
  2276                   translateLabel: true
       
  2277                 )
  2264                 )
  2278                (MenuItem
  2265                (MenuItem
  2279                   activeHelpKey: editDimensionPasteExtent
  2266                   activeHelpKey: editDimensionPasteExtent
  2280                   enabled: canMoveOrAlignSelection
  2267                   enabled: canMoveOrAlignSelection
  2281                   label: 'Paste Extent'
  2268                   label: 'Paste Extent'
  2282                   itemValue: pasteExtent
  2269                   itemValue: pasteExtent
  2283                   translateLabel: true
       
  2284                 )
  2270                 )
  2285                (MenuItem
  2271                (MenuItem
  2286                   activeHelpKey: editDimensionPasteWidth
  2272                   activeHelpKey: editDimensionPasteWidth
  2287                   enabled: canMoveOrAlignSelection
  2273                   enabled: canMoveOrAlignSelection
  2288                   label: 'Paste Width'
  2274                   label: 'Paste Width'
  2289                   itemValue: pasteWidth
  2275                   itemValue: pasteWidth
  2290                   translateLabel: true
       
  2291                 )
  2276                 )
  2292                (MenuItem
  2277                (MenuItem
  2293                   activeHelpKey: editDimensionPasteHeight
  2278                   activeHelpKey: editDimensionPasteHeight
  2294                   enabled: canMoveOrAlignSelection
  2279                   enabled: canMoveOrAlignSelection
  2295                   label: 'Paste Height'
  2280                   label: 'Paste Height'
  2296                   itemValue: pasteHeight
  2281                   itemValue: pasteHeight
  2297                   translateLabel: true
       
  2298                 )
  2282                 )
  2299                (MenuItem
  2283                (MenuItem
  2300                   label: '-'
  2284                   label: '-'
  2301                 )
  2285                 )
  2302                (MenuItem
  2286                (MenuItem
  2303                   activeHelpKey: editDimensionDefaultExtent
  2287                   activeHelpKey: editDimensionDefaultExtent
  2304                   enabled: canMoveOrAlignSelection
  2288                   enabled: canMoveOrAlignSelection
  2305                   label: 'Set Default Extent'
  2289                   label: 'Set Default Extent'
  2306                   itemValue: setToDefaultExtent
  2290                   itemValue: setToDefaultExtent
  2307                   translateLabel: true
       
  2308                 )
  2291                 )
  2309                (MenuItem
  2292                (MenuItem
  2310                   activeHelpKey: editDimensionDefaultWidth
  2293                   activeHelpKey: editDimensionDefaultWidth
  2311                   enabled: canMoveOrAlignSelection
  2294                   enabled: canMoveOrAlignSelection
  2312                   label: 'Set Default Width'
  2295                   label: 'Set Default Width'
  2313                   itemValue: setToDefaultWidth
  2296                   itemValue: setToDefaultWidth
  2314                   translateLabel: true
       
  2315                 )
  2297                 )
  2316                (MenuItem
  2298                (MenuItem
  2317                   activeHelpKey: editDimensionDefaultHeight
  2299                   activeHelpKey: editDimensionDefaultHeight
  2318                   enabled: canMoveOrAlignSelection
  2300                   enabled: canMoveOrAlignSelection
  2319                   label: 'Set Default Height'
  2301                   label: 'Set Default Height'
  2320                   itemValue: setToDefaultHeight
  2302                   itemValue: setToDefaultHeight
  2321                   translateLabel: true
       
  2322                 )
  2303                 )
  2323                )
  2304                )
  2324               nil
  2305               nil
  2325               nil
  2306               nil
  2326             )
  2307             )
  2330           )
  2311           )
  2331          (MenuItem
  2312          (MenuItem
  2332             activeHelpKey: editOpenSpecDocumentation
  2313             activeHelpKey: editOpenSpecDocumentation
  2333             label: 'Open Widget Documentation'
  2314             label: 'Open Widget Documentation'
  2334             itemValue: doOpenWidgetDocumentation
  2315             itemValue: doOpenWidgetDocumentation
  2335             translateLabel: true
  2316           )
  2336           )
  2317          (MenuItem
  2337          (MenuItem
  2318             activeHelpKey: referToConfigDatabase
  2338             activeHelpKey: referToCOnfigDatabase
       
  2339             label: 'Refer to Config Database'
  2319             label: 'Refer to Config Database'
  2340             itemValue: configSelection
  2320             itemValue: configSelection
  2341             translateLabel: true
       
  2342             isVisible: false
  2321             isVisible: false
  2343           )
  2322           )
  2344          (MenuItem
  2323          (MenuItem
  2345             label: '-'
  2324             label: '-'
  2346             isVisible: false
  2325             isVisible: false
  2347           )
  2326           )
  2348          (MenuItem
  2327          (MenuItem
  2349             activeHelpKey: drawEdit
  2328             activeHelpKey: drawEdit
  2350             label: 'Draw Edit'
  2329             label: 'Draw Edit'
  2351             itemValue: shapeEdit
  2330             itemValue: shapeEdit
  2352             translateLabel: true
       
  2353             isVisible: false
  2331             isVisible: false
  2354           )
  2332           )
  2355          (MenuItem
  2333          (MenuItem
  2356             label: '-'
  2334             label: '-'
  2357           )
  2335           )
  2358          (MenuItem
  2336          (MenuItem
  2359             activeHelpKey: sortItems
  2337             activeHelpKey: sortItems
  2360             label: 'Sort Selected Items by Position'
  2338             label: 'Sort Selected Items by Position'
  2361             itemValue: doSortItems
  2339             itemValue: doSortItems
  2362             translateLabel: true
  2340           )
  2363           )
       
  2364 "/         (MenuItem
       
  2365 "/            label: 'Action'
       
  2366 "/            translateLabel: true
       
  2367 "/          )
       
  2368          (MenuItem
  2341          (MenuItem
  2369             activeHelpKey: groupWithLayout
  2342             activeHelpKey: groupWithLayout
  2370             enabled: canGroup
  2343             enabled: canGroup
  2371             label: 'Group with Layout'
  2344             label: 'Group with Layout'
  2372             itemValue: groupWithLayout
  2345             itemValue: groupWithLayout
  2373             translateLabel: true
       
  2374           )
  2346           )
  2375          (MenuItem
  2347          (MenuItem
  2376             activeHelpKey: ungroup
  2348             activeHelpKey: ungroup
  2377             enabled: canUngroup
  2349             enabled: canUngroup
  2378             label: 'Ungroup'
  2350             label: 'Ungroup'
  2379             itemValue: ungroup
  2351             itemValue: ungroup
  2380             translateLabel: true
       
  2381           )
  2352           )
  2382          (MenuItem
  2353          (MenuItem
  2383             activeHelpKey: ungroupWithLayout
  2354             activeHelpKey: ungroupWithLayout
  2384             enabled: canGroup
  2355             enabled: canGroup
  2385             label: 'Ungroup with Layout'
  2356             label: 'Ungroup with Layout'
  2386             itemValue: ungroupWithLayout
  2357             itemValue: ungroupWithLayout
  2387             translateLabel: true
       
  2388           )
  2358           )
  2389          (MenuItem
  2359          (MenuItem
  2390             label: '-'
  2360             label: '-'
  2391           )
  2361           )
  2392          (MenuItem
  2362          (MenuItem
  2393             activeHelpKey: editBrowseViewClass
  2363             activeHelpKey: editBrowseViewClass
  2394             enabled: hasOneSelectionOtherThanCanvas
  2364             enabled: hasOneSelectionOtherThanCanvas
  2395             label: 'Browse Widget Class'
  2365             label: 'Browse Widget Class'
  2396             itemValue: doBrowseViewClass
  2366             itemValue: doBrowseViewClass
  2397             translateLabel: true
       
  2398           )
  2367           )
  2399          (MenuItem
  2368          (MenuItem
  2400             activeHelpKey: editInspectView
  2369             activeHelpKey: editInspectView
  2401             enabled: hasOneSelectionOtherThanCanvas
  2370             enabled: hasOneSelectionOtherThanCanvas
  2402             label: 'Inspect Widget'
  2371             label: 'Inspect Widget'
  2403             itemValue: doInspectView
  2372             itemValue: doInspectView
  2404             translateLabel: true
       
  2405           )
  2373           )
  2406          (MenuItem
  2374          (MenuItem
  2407             activeHelpKey: editBrowseViewClass
  2375             activeHelpKey: editBrowseViewClass
  2408             label: 'Browse Specification Class'
  2376             label: 'Browse Specification Class'
  2409             itemValue: doBrowseSpecificationClass
  2377             itemValue: doBrowseSpecificationClass
  2410             translateLabel: true
       
  2411           )
  2378           )
  2412          (MenuItem
  2379          (MenuItem
  2413             activeHelpKey: editInspectSpec
  2380             activeHelpKey: editInspectSpec
  2414             label: 'Inspect Spec'
  2381             label: 'Inspect Spec'
  2415             itemValue: doInspectSpec
  2382             itemValue: doInspectSpec
  2416             translateLabel: true
  2383           )
       
  2384          (MenuItem
       
  2385             label: '-'
       
  2386           )
       
  2387          (MenuItem
       
  2388             activeHelpKey: editSaveSpecForSelection
       
  2389             enabled: hasOneSelectionOtherThanCanvas
       
  2390             label: 'Save Spec of Selection...'
       
  2391             itemValue: doSaveElementSpecAs
  2417           )
  2392           )
  2418          )
  2393          )
  2419         nil
  2394         nil
  2420         nil
  2395         nil
  2421       )
  2396       )
  5517 
  5492 
  5518     self askForModification ifFalse: [^nil].
  5493     self askForModification ifFalse: [^nil].
  5519 
  5494 
  5520     self loadFromMessage: 
  5495     self loadFromMessage: 
  5521         (ResourceSelectionBrowser
  5496         (ResourceSelectionBrowser
  5522             request: 'Load Window Spec From Class'
  5497             request: 'Load Window Spec from Class'
  5523             onSuperclass: nil
  5498             onSuperclass: nil
  5524             andClass: self specClass
  5499             andClass: self specClass
  5525             andSelector: specSelector ? #windowSpec
  5500             andSelector: specSelector ? #windowSpec
  5526             withResourceTypes: #(canvas))
  5501             withResourceTypes: #(canvas))
  5527 
  5502 
  5534     |classAndSelector class selector|
  5509     |classAndSelector class selector|
  5535 
  5510 
  5536     self askForSectionModification.
  5511     self askForSectionModification.
  5537 
  5512 
  5538     classAndSelector := ResourceSelectionBrowser
  5513     classAndSelector := ResourceSelectionBrowser
  5539             request: 'Load Subspec From Class'
  5514             request: 'Load Subspec from Class'
  5540             onSuperclass: nil
  5515             onSuperclass: nil
  5541             andClass: self specClass
  5516             andClass: self specClass
  5542             andSelector: specSelector
  5517             andSelector: specSelector
  5543             withResourceTypes: #(canvas).
  5518             withResourceTypes: #(canvas).
  5544 
  5519 
  5622         ]
  5597         ]
  5623     ].
  5598     ].
  5624 
  5599 
  5625     specClass := self resolveName:specClassName.
  5600     specClass := self resolveName:specClassName.
  5626     (specClass notNil and:[ specClass isClass ]) ifFalse:[
  5601     (specClass notNil and:[ specClass isClass ]) ifFalse:[
  5627         self warn:('Oops - cannot save - class not found: ' , specClassName).
  5602         self warn:('Oops - cannot save. Class not found: ' , specClassName).
  5628         ^ nil
  5603         ^ nil
  5629     ].
  5604     ].
  5630 
  5605 
  5631     painter := self painter.
  5606     painter := self painter.
  5632     painter 
  5607     painter 
  5672 "/    self hasSpecClassAndSelector ifTrue:[
  5647 "/    self hasSpecClassAndSelector ifTrue:[
  5673 "/        self askForModification ifFalse:[^ false].
  5648 "/        self askForModification ifFalse:[^ false].
  5674 "/    ].
  5649 "/    ].
  5675 
  5650 
  5676     classAndSelector := ResourceSelectionBrowser
  5651     classAndSelector := ResourceSelectionBrowser
  5677             request: 'Save Window Spec In Class'
  5652             request: 'Save Window Spec in Class'
  5678             onSuperclass: #Object
  5653             onSuperclass: #Object
  5679             andClass: (specClassName ? #ApplicationModel) asSymbol
  5654             andClass: (specClassName ? #ApplicationModel) asSymbol
  5680             andSelector: specSelector ? #windowSpec
  5655             andSelector: specSelector ? #windowSpec
  5681             withResourceTypes: #(canvas).
  5656             withResourceTypes: #(canvas).
  5682 
  5657 
  5688     specClass := classAndSelector methodClass.
  5663     specClass := classAndSelector methodClass.
  5689     specClassName := classAndSelector methodClass name.
  5664     specClassName := classAndSelector methodClass name.
  5690     specSelector := classAndSelector methodSelector.
  5665     specSelector := classAndSelector methodSelector.
  5691     specSuperclassName := specClass superclass name.
  5666     specSuperclassName := specClass superclass name.
  5692     self doSave.
  5667     self doSave.
       
  5668     ^ true
       
  5669 !
       
  5670 
       
  5671 doSaveElementSpecAs
       
  5672     "opens a ResourceSelectionBrowser for saving a spec for the selected
       
  5673      elements on a class.
       
  5674      Useful to save parts for refactoring a spec into
       
  5675      subSpecifications, for example when putting parts into a tab"
       
  5676 
       
  5677     |spec fullSpec classAndSelector subSpecClass subSpecClassName subSpecSelector code|
       
  5678 
       
  5679     self askForSectionModification.
       
  5680 
       
  5681     (spec := self painter specForSelection) isNil ifTrue:[
       
  5682         self warn:('Select a single item first').
       
  5683         ^ false
       
  5684     ].
       
  5685 
       
  5686     classAndSelector := ResourceSelectionBrowser
       
  5687             request: 'Save Subspec in Class'
       
  5688             onSuperclass: #Object
       
  5689             andClass: specClassName
       
  5690             andSelector: #subSpec
       
  5691             withResourceTypes: #(canvas).
       
  5692 
       
  5693     classAndSelector isNil ifTrue:[^ false].
       
  5694 
       
  5695     self clearModified.
       
  5696     self painter resetModification.
       
  5697 
       
  5698     subSpecClass := classAndSelector methodClass.
       
  5699     subSpecClassName := classAndSelector methodClass name.
       
  5700     subSpecSelector := classAndSelector methodSelector.
       
  5701 
       
  5702     subSpecClass := self resolveName:subSpecClassName.
       
  5703     (subSpecClass notNil and:[ subSpecClass isClass ]) ifFalse:[
       
  5704         self warn:('Oops - cannot save - class not found: ' , subSpecClassName).
       
  5705         ^ false
       
  5706     ].
       
  5707 
       
  5708     spec := painter fullSpecFor:(painter singleSelection).
       
  5709 
       
  5710     fullSpec := treeView generateFullSpecForComponents:(Array with:spec) named:subSpecSelector asUppercaseFirst.
       
  5711     code := painter generateWindowSpecMethodSourceFor:fullSpec class:subSpecClassName selector:subSpecSelector.
       
  5712     (ReadStream on:code) fileIn.
  5693     ^ true
  5713     ^ true
  5694 !
  5714 !
  5695 
  5715 
  5696 doSelectAspectMethod:aspectSelector
  5716 doSelectAspectMethod:aspectSelector
  5697     "open a dialog to select an existing aspect method and enter in the field"
  5717     "open a dialog to select an existing aspect method and enter in the field"