UIPainter.st
author Claus Gittinger <cg@exept.de>
Sat, 21 Jul 2012 18:58:03 +0200
changeset 2898 c7f6c498df6a
parent 2883 bee1a24df6e4
child 2901 4c010c4a4166
permissions -rw-r--r--
category of:15 methods
     1 "
     2  COPYRIGHT (c) 1995-1998 by eXept Software AG
     3               All Rights Reserved
     4 
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    11 "
    12 "{ Package: 'stx:libtool2' }"
    13 
    14 ResourceSpecEditor subclass:#UIPainter
    15 	instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool
    16 		helpTool painterView painter lastPort lastPage'
    17 	classVariableNames:'SelectionPanelClass UseViewScroller LastPort LastPage
    18 		DefaultEditToolBarVisible DefaultToolBarVisible'
    19 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    21 !
    22 
    23 SelectionInTreeView subclass:#TreeView
    24 	instanceVariableNames:'lastDrawnMaster canvasEventsDisabled windowSpec windowSpecClass
    25 		painter'
    26 	classVariableNames:''
    27 	poolDictionaries:''
    28 	privateIn:UIPainter
    29 !
    30 
    31 !UIPainter class methodsFor:'documentation'!
    32 
    33 copyright
    34 "
    35  COPYRIGHT (c) 1995-1998 by eXept Software AG
    36               All Rights Reserved
    37 
    38  This software is furnished under a license and may be used
    39  only in accordance with the terms of that license and with the
    40  inclusion of the above copyright notice.   This software may not
    41  be provided or otherwise made available to, or used by, any
    42  other person.  No title to or ownership of the software is
    43  hereby transferred.
    44 "
    45 
    46 !
    47 
    48 documentation
    49 "
    50     The GUI Painter provides the user with a graphical user interface for building own 
    51     interfaces by interactively assembling widgets and defining the behavior of the widgets.
    52     The resulting interface specifications can be saved as methods on the application
    53     classes, typically subclasses of the class ApplicationModel. These specifications
    54     are used by the UIBuilder to generate the application window and its widgets when 
    55     opening the application.
    56 
    57     [start with:]
    58         UIPainter open
    59 
    60     [author:]
    61         Claus Gittinger, eXept Software AG
    62         Claus Atzkern, eXept Software AG
    63         Thomas Zwick, eXept Software AG
    64 
    65     [see also:]
    66         UIBuilder
    67         ApplicationModel
    68         UISpecification
    69 
    70     [instance variables:]                                                  
    71         isSpecOnlyPainter       true if this painter is for a spec only (as used by expecco),
    72                                 as opposed to a regular painter, which stores the spec in a class.
    73                                 A spec-only painter has no class to store additional specs (esp.
    74                                 menu- and tabSpecs) and should not offer postBuild and other
    75                                 callback functions.
    76 "
    77 ! !
    78 
    79 !UIPainter class methodsFor:'initialization'!
    80 
    81 initialize
    82     SelectionPanelClass isNil ifTrue:[
    83         SelectionPanelClass := UISelectionPanel
    84     ].
    85 ! !
    86 
    87 !UIPainter class methodsFor:'instance creation'!
    88 
    89 openOnClass:aClass andSelector:aSelector
    90     "open a GUI Painter on aClass and (windowSpec) aSelector"
    91 
    92     ^ self new openOnClass:aClass theNonMetaclass andSelector:aSelector
    93 ! !
    94 
    95 !UIPainter class methodsFor:'ST-80 queries'!
    96 
    97 preferenceFor:aSymbol
    98     "ST-80 compatible; always returns false
    99     "
   100     ^ false
   101 
   102 
   103 ! !
   104 
   105 !UIPainter class methodsFor:'defaults'!
   106 
   107 defaultEditToolbarVisible
   108     ^ DefaultEditToolBarVisible ? true
   109 !
   110 
   111 defaultNameOfCanvas
   112     "returns the default name of the application"
   113 
   114     ^ 'NewApplication'
   115 !
   116 
   117 defaultToolbarVisible
   118     ^ DefaultToolBarVisible ? true
   119 !
   120 
   121 selectionPanelClass
   122     ^ SelectionPanelClass
   123 
   124     "
   125      UIPainter selectionPanelClass.
   126      UIPainter selectionPanelClass:UISelectionPanel
   127     "
   128 !
   129 
   130 selectionPanelClass:something
   131     "set the class used as selection panel.
   132      this is UISelectionPanel as default"
   133 
   134     SelectionPanelClass := something.
   135 
   136     "
   137      UIPainter selectionPanelClass:UISelectionPanel
   138     "
   139 ! !
   140 
   141 !UIPainter class methodsFor:'help specs'!
   142 
   143 flyByHelpSpec
   144     <resource: #help>
   145 
   146     ^super flyByHelpSpec 
   147         addPairsFrom:#(
   148 
   149 #fileSave
   150 'Save Spec'
   151 
   152 shadesOfRed
   153 'Red color tones'
   154 
   155 shadesOfGreen
   156 'Green color tones'
   157 
   158 shadesOfBlue
   159 'Blue color tones'
   160 
   161 shadesOfCyan
   162 'Cyan color tones'
   163 
   164 shadesOfMagenta
   165 'Magenta color tones'
   166 
   167 shadesOfYellow
   168 'Yellow color tones'
   169 
   170 shadesOfGray
   171 'Gray color tones'
   172 
   173 openColorEditor
   174 'Open a color editor'
   175 
   176 pickColorFromScreen
   177 'Pick a color from the screen'
   178 
   179 recentlyUsedColors
   180 'Pick a recently used color'
   181 
   182 useDefaultColorToggle
   183 'Toggle between default and explicit color'
   184 
   185 );
   186     declareAllFrom:self helpSpec
   187 !
   188 
   189 helpSpec
   190     "This resource specification was automatically generated
   191      by the UIHelpTool of ST/X."
   192 
   193     "Do not manually edit this!! If it is corrupted,
   194      the UIHelpTool may not be able to read the specification."
   195 
   196     "
   197      UIHelpTool openOnClass:UIPainter    
   198     "
   199 
   200     <resource: #help>
   201 
   202     ^ super helpSpec addPairsFrom:#(
   203 
   204 #align
   205 'Widget alignment functions.'
   206 
   207 #alignSelectionBottom
   208 'Aligns the selected widgets'' bottom edges with the bottom of the dominant widget.'
   209 
   210 #alignResizeSelectionBottom
   211 'Resize the selected widgets'' bottom edges to align them with the bottom of the dominant widget.'
   212 
   213 #alignSelectionCenterHor
   214 'Aligns the selected widgets'' centers vertically with the center of the dominant widget.'
   215 
   216 #alignSelectionCenterVer
   217 'Aligns the selected widgets'' centers horizontally with the center of the dominant widget.'
   218 
   219 #alignSelectionLeft
   220 'Aligns the selected widgets'' left edges with the left edge of the dominant widget.'
   221 
   222 #alignResizeSelectionLeft
   223 'Resize the selected widgets'' left edges to align them with the left edge of the dominant widget.'
   224 
   225 #alignSelectionLeftAndRight
   226 'Aligns the selected widgets'' left & right edges with the dominant widget.'
   227 
   228 #alignSelectionRight
   229 'Aligns the selected widgets'' right edges with the right edge of the dominant widget.'
   230 
   231 #alignResizeSelectionRight
   232 'Resize the selected widgets'' right edges to align them with the right edge of the dominant widget.'
   233 
   234 #alignSelectionTop
   235 'Aligns the selected widgets'' top edges with the top edge of the dominant widget.'
   236 
   237 #alignResizeSelectionTop
   238 'Resize the selected widgets'' top edges to align them with the top edge of the dominant widget.'
   239 
   240 #alignSelectionTopAndBottom
   241 'Aligns the selected widgets'' top and bottom edges with the dominant widget.'
   242 
   243 #centerSelectionHor
   244 'Centers the selected widgets horizontally within their containing widget.'
   245 
   246 #centerSelectionVer
   247 'Centers the selected widgets vertically within their containing widget.'
   248 
   249 #changePositionDown
   250 'Moves the selected widget(s) towards the bottom.'
   251 
   252 #changePositionLeft
   253 'Moves the selected widget(s) towards the left.'
   254 
   255 #changePositionRight
   256 'Moves the selected widget(s) towards the right.'
   257 
   258 #changePositionUp
   259 'Moves the selected widget(s) towards the top.'
   260 
   261 #drawEdit
   262 ''
   263 
   264 #editBrowseViewClass
   265 'Opens a browser on the class of the selected widget.'
   266 
   267 #editDimensionCopyExtent
   268 'Copies the extent of the selected widget.'
   269 
   270 #editDimensionCopyLayout
   271 'Copies the layout of the selected widget.'
   272 
   273 #editDimensionDefaultExtent
   274 'Sets the selected widget(s) extent to their default.'
   275 
   276 #editDimensionDefaultHeight
   277 'Sets the selected widget(s) height to their default.'
   278 
   279 #editDimensionDefaultWidth
   280 'Sets the selected widget(s) width to their default.'
   281 
   282 #editDimensionPasteExtent
   283 'Sets the extent of the selected widget(s) to the last copied extent.'
   284 
   285 #editDimensionPasteHeight
   286 'Sets the height of the selected widget(s) to the height of the last copied layout/extent.'
   287 
   288 #editDimensionPasteLayout
   289 'Sets the layout of the selected widget(s) to the last copied layout.'
   290 
   291 #editDimensionPasteWidth
   292 'Sets the width of the selected widget(s) to the width of the last copied layout/extent.'
   293 
   294 #editInspectSpec
   295 'Opens an inspector on the spec of the selected widget.'
   296 
   297 #editInspectView
   298 'Opens an inspector on the selected widget.'
   299 
   300 #editOpenSpecDocumentation
   301 'Opens the documentation of the selected widget.'
   302 
   303 #fileBrowseAspectMethods
   304 'Opens a System Browser on the application''s aspect methods.'
   305 
   306 #fileBrowseClass
   307 'Open a System Browser on the application''s class.'
   308 
   309 #fileLoad
   310 'Opens a dialog to load a window specification from a classes spec method.'
   311 
   312 #fileLoadSubspec
   313 'Opens a dialog to load a sub specification from a classes windowSpec method.'
   314 
   315 #fileNew
   316 'Creates a new window spec.'
   317 
   318 #filePickAnInterface
   319 'Select a view on the screen, generate a window spec for it and edit this spec.'
   320 
   321 #fileSave
   322 'Saves the window spec in the current class (as spec method).'
   323 
   324 #fileSaveAs
   325 'Opens a dialog to select class and selector for saving the window spec.'
   326 
   327 #fileShowWindowSpec
   328 'Opens a Workspace showing the current window spec.'
   329 
   330 #generateAspectMethods
   331 'Generates aspect methods for defined aspect selectors of the widgets.'
   332 
   333 #generateHookMethods
   334 'Generates startup/release methods. (#closeRequest, #postBuildWith:, #postOpenWith:)'
   335 
   336 #group
   337 ''
   338 
   339 #helpExamples
   340 'Show some examples uses of the GUI Painter.'
   341 
   342 #helpFunctions
   343 'Show the documentation on the GUI Painters menu and button functions.'
   344 
   345 #helpLayoutTool
   346 'Show the Layout Tools documentation.'
   347 
   348 #helpSelectedWidget
   349 'Show the documentation of the selected widget.'
   350 
   351 #helpTutorial
   352 'Show the GUI Painters documentation.'
   353 
   354 #historyMenuItem
   355 'Edit this windowSpec.'
   356 
   357 #moveWidgetDown
   358 'Moves the selected widget down in the list (brings it to the front).'
   359 
   360 #moveWidgetInto
   361 'Moves the selected widget into next widget as child widget.'
   362 
   363 #moveWidgetOut
   364 'Moves the selected widget out of its parent widget.'
   365 
   366 #moveWidgetUp
   367 'Moves the selected widget up in the list (brings it to the back).'
   368 
   369 #pasteBuffer
   370 'Pastes the widgets of the clipboard at the current mouse position.'
   371 
   372 #pasteWithLayout
   373 'Pastes the widgets of the clipboard without changing their layouts.'
   374 
   375 #referToCOnfigDatabase
   376 ''
   377 
   378 #settingsAspectsAsInstances
   379 'Generate aspects as instance variables (or bindings, if off).'
   380 
   381 #settingsCanvas
   382 'Shows or hides the canvas window.'
   383 
   384 #settingsGallery
   385 'Shows or hides the gallery window.'
   386 
   387 #settingsGenerateCommentedCode
   388 ''
   389 
   390 #settingsGridManager
   391 'Opens a dialog to toggle grid display or to change the grids spacing.'
   392 
   393 #settingsRedefineAspectMethods
   394 'Toggles the permission to overwrite existing aspect methods.'
   395 
   396 #settingsTranscriptHelp
   397 'Toggles display of help texts (after opening a new GUI Painter).'
   398 
   399 #settingsUndoManager
   400 'Opens a dialog to undo modifications.'
   401 
   402 #showGrid
   403 'Raster zeigen'
   404 
   405 #alignToGrid
   406 'Am Raster ausrichten'
   407 
   408 #sortItems
   409 'Sort the selected items by position (left to right, top to bottom)'
   410 
   411 #spreadSelectionHor
   412 'Sets the horizontal spaces between the selected widgets to the same value.'
   413 
   414 #spreadSelectionVer
   415 'Sets the vertical spaces between the selected widgets to the same value.'
   416 
   417 #testGeometryTestMode
   418 'Toggles geometry test mode (to define ratios of variable panels and top-window dimension).'
   419 
   420 #testStartApplication
   421 'Starts the application with the current window spec.'
   422 
   423 shadesOfRed
   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'
   455 
   456 )
   457 
   458     "Modified: / 28-07-2010 / 10:02:50 / cg"
   459 ! !
   460 
   461 !UIPainter class methodsFor:'helpers'!
   462 
   463 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   464     "converts a string to a string collection with maximum characters
   465      per line
   466     "
   467     |stream
   468         max     "{ Class:SmallInteger }"
   469         size    "{ Class:SmallInteger }"
   470         start   "{ Class:SmallInteger }"
   471         stop    "{ Class:SmallInteger }"
   472         cpySz   "{ Class:SmallInteger }"
   473         lnSz    "{ Class:SmallInteger }"
   474         atBeginOfLine|
   475 
   476     maxCharactersPerLine < 20 ifFalse:[max := maxCharactersPerLine - 1]
   477                                ifTrue:[max := 20].
   478 
   479     (size := aString size) <= max ifTrue:[
   480         ^ aString
   481     ].
   482     start  := 1.
   483     lnSz   := 0.
   484     stream := (String new:size) writeStream.
   485 
   486     atBeginOfLine := true.
   487 
   488     [start <= size] whileTrue:[
   489         (start := aString indexOfNonSeparatorStartingAt:start) == 0 ifTrue:[
   490             ^ stream contents
   491         ].
   492         (aString at:start) == $\ ifTrue:[
   493             skipLineFeed ifFalse:[
   494                 stream nextPut:$\
   495             ].
   496             start := start + 1.
   497             stream cr.
   498             start := start + 1.
   499             lnSz := 0.
   500         ] ifFalse:[
   501             (stop := aString indexOfSeparatorStartingAt:start) == 0 ifTrue:[
   502                 stop := size + 1
   503             ].
   504             (aString at:(stop - 1)) == $\ ifTrue:[
   505                 stop := stop - 1
   506             ].
   507             cpySz := stop - start.
   508 
   509             lnSz == 0 ifFalse:[
   510                 (lnSz := lnSz + cpySz) >= max ifTrue:[stream cr.    lnSz := cpySz. atBeginOfLine := true. ]
   511                                              ifFalse:[stream space. lnSz := lnSz + 1]
   512             ] ifTrue:[
   513                 lnSz := cpySz
   514             ].
   515             stream nextPutAll:aString startingAt:start to:(stop - 1).
   516             start := stop.
   517         ]
   518     ].
   519     ^ stream contents
   520 
   521     "Modified: / 1.2.1998 / 14:42:56 / cg"
   522 ! !
   523 
   524 !UIPainter class methodsFor:'image specs'!
   525 
   526 arrowDown
   527     "This resource specification was automatically generated
   528      by the ImageEditor of ST/X."
   529 
   530     "Do not manually edit this!! If it is corrupted,
   531      the ImageEditor may not be able to read the specification."
   532 
   533     "
   534      self arrowDown inspect
   535      ImageEditor openOnClass:self andSelector:#arrowDown
   536      Icon flushCachedIcons
   537     "
   538 
   539     <resource: #image>
   540 
   541     ^Icon
   542         constantNamed:'UIPainter class arrowDown'
   543         ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>C?8O? ?>C@XNC <^C;8O? ?>C?8@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   544 @@@@@@@@@@@? A<@C @D@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   545 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself]
   546 !
   547 
   548 arrowLeft
   549     "This resource specification was automatically generated
   550      by the ImageEditor of ST/X."
   551 
   552     "Do not manually edit this!! If it is corrupted,
   553      the ImageEditor may not be able to read the specification."
   554 
   555     "
   556      self arrowLeft inspect
   557      ImageEditor openOnClass:self andSelector:#arrowLeft
   558      Icon flushCachedIcons
   559     "
   560 
   561     <resource: #image>
   562 
   563     ^Icon
   564         constantNamed:'UIPainter class arrowLeft'
   565         ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>C?8O7 >^C18NG <^C98O7 ?>C?8@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@H@A @N@A8@C PF@@H@@@@@@@@a') ; yourself); yourself]
   566 !
   567 
   568 arrowRight
   569     "This resource specification was automatically generated
   570      by the ImageEditor of ST/X."
   571 
   572     "Do not manually edit this!! If it is corrupted,
   573      the ImageEditor may not be able to read the specification."
   574 
   575     "
   576      self arrowRight inspect
   577      ImageEditor openOnClass:self andSelector:#arrowRight
   578      Icon flushCachedIcons
   579     "
   580 
   581     <resource: #image>
   582 
   583     ^Icon
   584         constantNamed:'UIPainter class arrowRight'
   585         ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>C?8O_ <>C18OC <^C38O_ ?>C?8@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@ @C@@NA@<@C @L@@ @@@@@@@@a') ; yourself); yourself]
   586 !
   587 
   588 arrowUp
   589     "This resource specification was automatically generated
   590      by the ImageEditor of ST/X."
   591 
   592     "Do not manually edit this!! If it is corrupted,
   593      the ImageEditor may not be able to read the specification."
   594 
   595     "
   596      self arrowUp inspect
   597      ImageEditor openOnClass:self andSelector:#arrowUp
   598      Icon flushCachedIcons
   599     "
   600 
   601     <resource: #image>
   602 
   603     ^Icon
   604         constantNamed:'UIPainter class arrowUp'
   605         ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>C?8O? >>C18NC 0FC?8O? ?>C?8@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@A@@NG1<@O8@@@@@@@@@@AP@a') ; yourself); yourself]
   606 !
   607 
   608 browseActionImage
   609     "This resource specification was automatically generated
   610      by the ImageEditor of ST/X."
   611 
   612     "Do not manually edit this!! If it is corrupted,
   613      the ImageEditor may not be able to read the specification."
   614 
   615     "
   616      self browseActionImage inspect
   617      ImageEditor openOnClass:self andSelector:#browseActionImage
   618      Icon flushCachedIcons
   619     "
   620 
   621     <resource: #image>
   622 
   623     ^Icon
   624         constantNamed:'UIPainter class browseActionImage'
   625         ifAbsentPut:[(Depth8Image new) width: 11; height: 12; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   626 R@@@RT%RST1LTD9H@D%IT%MRSD1PS$!!RT$5RUEILT%INT%UVT%YWU%IVUUIHT%!!YV%-ZVU!!RWD!!MT%Y[@E-VT%5\RD1RU%,@V5YRWU1HT%!!YV%-ZVU!!RWEIU
   627 U%IVU5YRU%URZ%IR@EITT ART&,@@@@@T%MR@@@@@@@@@@@@T @@@@@@') ; colorMapFromArray:#[255 248 248 63 144 224 64 152 232 79 160 232 64 152 224 64 144 224 63 136 224 48 128 216 48 120 216 47 112 216 47 112 208 32 104 208 32 96 208 31 88 200 16 88 200 16 80 200 15 72 192 15 64 192 0 64 192 0 56 184 0 56 176 0 48 160 143 200 248 128 200 248 127 192 248 112 184 248 111 176 248 96 168 248 95 160 248 80 152 248 79 144 248 64 128 248 63 120 248 48 112 248 32 104 248 31 96 248 16 88 248 15 80 248 0 72 248 0 64 240 0 48 168 112 176 248 111 168 248 96 160 248 95 152 248 80 144 248 79 136 248 63 128 248 48 120 248 47 112 248 15 72 248 0 48 176 95 168 232 191 224 248 191 216 248 176 208 248 175 208 248 175 200 248 160 200 248 160 192 248 159 192 248 159 184 248 144 184 248 144 176 248 143 168 248 128 168 248 128 160 248 127 160 248 127 152 240 31 72 176 111 168 232 127 160 216 207 216 240 240 240 248 240 232 240 63 88 176 239 232 240 240 240 240 48 88 176 96 168 224 224 224 232 96 160 224 240 144 24 255 248 48 255 248 96 255 248 24 240 208 24 255 248 152 255 248 88 255 248 136 255 248 176 255 248 200 48 80 176 223 216 224 96 152 224 96 152 216 95 152 216 48 120 208 80 144 208 80 136 208 79 128 200 79 120 200 79 120 192 64 112 192 64 104 184 63 104 184 63 96 184 15 56 160]; mask:((Depth1Image new) width: 11; height: 12; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A@@N@F;@?>A?0G>@O8A?0O? [,@N@@P@') ; yourself); yourself]
   628 !
   629 
   630 defaultIcon
   631     <resource: #programImage>
   632 
   633     ^ ToolbarIconLibrary startUIPainterIcon
   634 
   635     "Created: / 10-02-2007 / 14:45:56 / cg"
   636     "Modified: / 17-09-2007 / 11:36:33 / cg"
   637 !
   638 
   639 editTableIcon
   640     <resource: #programImage>
   641 
   642     ^ SystemBrowser tableColumnsIcon
   643 !
   644 
   645 helpIcon
   646     <resource: #programImage>
   647 
   648     ^ Icon helpIcon
   649 !
   650 
   651 hideToolBarIcon
   652     <resource: #programImage>
   653 
   654     ^ ToolbarIconLibrary hideToolBarIcon
   655 !
   656 
   657 iconAlignB
   658     "This resource specification was automatically generated
   659      by the ImageEditor of ST/X."
   660 
   661     "Do not manually edit this!! If it is corrupted,
   662      the ImageEditor may not be able to read the specification."
   663 
   664     "
   665      self iconAlignB inspect
   666      ImageEditor openOnClass:self andSelector:#iconAlignB
   667      Icon flushCachedIcons
   668     "
   669 
   670     <resource: #image>
   671 
   672     ^Icon
   673         constantNamed:'UIPainter class iconAlignB'
   674         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   675 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@@@@G@@@@@@@G@E@@@@@G@G@@@@@G@G@@@@@G@G@@@E@G@G@@@G@G@G@K@G@G@G@@@G@G@G@A@G@G@G@@
   676 @G@G@G@K@@@@@@@@B*****(@B*****(@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@G C@G @@G'' @G'' @G'' @G'' G'''' G'''' G'''' G''''!!G'''' G'''' G'''' G'''' O??0O??0@@@@@@@C@@@@') ; yourself); yourself]
   677 !
   678 
   679 iconAlignL
   680     "This resource specification was automatically generated
   681      by the ImageEditor of ST/X."
   682 
   683     "Do not manually edit this!! If it is corrupted,
   684      the ImageEditor may not be able to read the specification."
   685 
   686     "
   687      self iconAlignL inspect
   688      ImageEditor openOnClass:self andSelector:#iconAlignL
   689      Icon flushCachedIcons
   690     "
   691 
   692     <resource: #image>
   693 
   694     ^Icon
   695         constantNamed:'UIPainter class iconAlignL'
   696         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   697 @@@@@@@@@@@@@@@@@(@@@@@@@(@@@@@@@(UUUP@I@(_??0@@@(@@@@@@@(@@@@@@@(@@@@@@@(@@@@@@@(UUUU@@@(_???@@@(@@@@@E@(@@@@@@@(@@@@@@
   698 @(@@@@@@@(UU@@@@@(_?@@@@@(@@@@@@@(@@@@@@@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@@@G?>@G?>@G?>@G?>@F@@@F@@@G?? G?? G?? G?? F@@@F@@@G? @G? @G? @G? @F@@@@@@@@@@@') ; yourself); yourself]
   699 !
   700 
   701 iconAlignLR
   702     "This resource specification was automatically generated
   703      by the ImageEditor of ST/X."
   704 
   705     "Do not manually edit this!! If it is corrupted,
   706      the ImageEditor may not be able to read the specification."
   707 
   708     "
   709      self iconAlignLR inspect
   710      ImageEditor openOnClass:self andSelector:#iconAlignLR
   711      Icon flushCachedIcons
   712     "
   713 
   714     <resource: #image>
   715 
   716     ^Icon
   717         constantNamed:'UIPainter class iconAlignLR'
   718         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   719 @@@@@@@@@@@@@@@@@(@@@B @@(@@@B @@(UUUR I@(_??2 @@(@@@B @@(@@@B @@(@@@B @@(@@@B @@(UUUR @@(_??2 @@(@@@B E@(@@@B @@(@@@B @
   720 @(@@@B @@(UUUR @@(_??B @@(@@@B @@(@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@A G?? G?? G?? G?? F@A F@A G?? G?? G?? G?? F@A F@A G?? G?? G?; G?? F@A @@@@@@@@') ; yourself); yourself]
   721 !
   722 
   723 iconAlignR
   724     "This resource specification was automatically generated
   725      by the ImageEditor of ST/X."
   726 
   727     "Do not manually edit this!! If it is corrupted,
   728      the ImageEditor may not be able to read the specification."
   729 
   730     "
   731      self iconAlignR inspect
   732      ImageEditor openOnClass:self andSelector:#iconAlignR
   733      Icon flushCachedIcons
   734     "
   735 
   736     <resource: #image>
   737 
   738     ^Icon
   739         constantNamed:'UIPainter class iconAlignR'
   740         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   741 @@@@@@@@@@@@@@@@@@@@@B @@@@@@B @@@UUUR I@@_??2 @@@@@@B @@@@@@B @@@@@@B @@@@@@B @@EUUUR @@G???2 @@@@@@B E@@@@@B @@@@@@B @
   742 @@@@@B @@@@EUR @@@@G?2 @@@@@@B @@@@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@A A?? A?? A?? A?? @@A @@A G?? G?? G?? G?? @@A @@A @G? @G? @G? @G? @@A @@@@@@@@') ; yourself); yourself]
   743 !
   744 
   745 iconAlignT
   746     "This resource specification was automatically generated
   747      by the ImageEditor of ST/X."
   748 
   749     "Do not manually edit this!! If it is corrupted,
   750      the ImageEditor may not be able to read the specification."
   751 
   752     "
   753      self iconAlignT inspect
   754      ImageEditor openOnClass:self andSelector:#iconAlignT
   755      Icon flushCachedIcons
   756     "
   757 
   758     <resource: #image>
   759 
   760     ^Icon
   761         constantNamed:'UIPainter class iconAlignT'
   762         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   763 @@@@@@@@@@@@@@@@@@@@@@@@B*****(@B*****(@@@@@@@@@@E@E@E@K@G@G@G@@@G@G@G@A@G@G@G@@@G@G@G@K@G@G@G@@@@@G@G@@@@@G@G@@@@@G@G@@
   764 @@@G@G@@@@@G@@@@@@@G@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@C@@@@O??0O??0G'''' G'''' G'''' G'''' G''''!!G'''' G'''' G'''' @G'' @G'' @G'' @G'' @G @@G C@@@@@@@@@@@@') ; yourself); yourself]
   765 !
   766 
   767 iconAlignTB
   768     "This resource specification was automatically generated
   769      by the ImageEditor of ST/X."
   770 
   771     "Do not manually edit this!! If it is corrupted,
   772      the ImageEditor may not be able to read the specification."
   773 
   774     "
   775      self iconAlignTB inspect
   776      ImageEditor openOnClass:self andSelector:#iconAlignTB
   777      Icon flushCachedIcons
   778     "
   779 
   780     <resource: #image>
   781 
   782     ^Icon
   783         constantNamed:'UIPainter class iconAlignTB'
   784         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   785 @@@@@@@A@@@@@@@@@@@@@@@@B*****(@B*****(@@@@@@@@@@E@E@E@G@G@G@G@@@G@G@G@@@G@G@G@@@G@G@G@H@G@G@G@@@G@G@G@A@G@G@G@@@G@G@G@@
   786 @G@G@D@@@@@@@@@@B*****(@B*****(@@@@@@@@@@@@@@@@H@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@C@@@@O??0O??0G'''' G''''!!G'''' G'''' G'''' G'''' G'''' G'''' G''''!!G''''!!G''& G'''' O??0O??2@@@@@@@@@@@@') ; yourself); yourself]
   787 !
   788 
   789 iconCenterH
   790     "This resource specification was automatically generated
   791      by the ImageEditor of ST/X."
   792 
   793     "Do not manually edit this!! If it is corrupted,
   794      the ImageEditor may not be able to read the specification."
   795 
   796     "
   797      self iconCenterH inspect
   798      ImageEditor openOnClass:self andSelector:#iconCenterH
   799      Icon flushCachedIcons
   800     "
   801 
   802     <resource: #image>
   803 
   804     ^Icon
   805         constantNamed:'UIPainter class iconCenterH'
   806         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   807 @@@@@@@@@@@@@@@@@(@J@B @@(@J@B @@(UZUR @@(?:?R @@(@J@B @@(@J@B @@(@J@B @@@@J@@@@@EUZUU@@@O?:?=@@@@@J@@@@@(@J@B @@(@J@B @
   808 @(@J@B @@(EZUB@@@(O:=B @@(@J@B @@(@J@B @@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@C@@A?>@A?>@A?>@A?>@@C@@@C@@G?? G?? G?? G??#@C@@@C@C@?<@@?<A@?<@@?<@@C@@@@@A@@@@') ; yourself); yourself]
   809 !
   810 
   811 iconCenterHInFrame
   812     "This resource specification was automatically generated
   813      by the ImageEditor of ST/X."
   814 
   815     "Do not manually edit this!! If it is corrupted,
   816      the ImageEditor may not be able to read the specification."
   817 
   818     "
   819      self iconCenterHInFrame inspect
   820      ImageEditor openOnClass:self andSelector:#iconCenterHInFrame
   821      Icon flushCachedIcons
   822     "
   823 
   824     <resource: #image>
   825 
   826     ^Icon
   827         constantNamed:'UIPainter class iconCenterHInFrame'
   828         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   829 @@@@@@@@J******@H@@@@@B@HL@@@CB@H8UUUR2@HH???RB@H8@@@B2@HH@@@BB@H8@@@B2@H@@@@@B@HEUUUUB@HO???=B@H@@@@@B@H8@@@@2@HH@@@@B@
   830 H8@@@@2@HHEUUBB@H8O?=B2@HL@@@CB@H@@@@@B@J******@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@_??8P@@HW??(U?>(U?>(U?>(T@@(T@@(W??(W??(W??(W??+T@@(T@@+T?<(T?<)T?<(W??(P@@H_??9@@@@') ; yourself); yourself]
   831 !
   832 
   833 iconCenterV
   834     "This resource specification was automatically generated
   835      by the ImageEditor of ST/X."
   836 
   837     "Do not manually edit this!! If it is corrupted,
   838      the ImageEditor may not be able to read the specification."
   839 
   840     "
   841      self iconCenterV inspect
   842      ImageEditor openOnClass:self andSelector:#iconCenterV
   843      Icon flushCachedIcons
   844     "
   845 
   846     <resource: #image>
   847 
   848     ^Icon
   849         constantNamed:'UIPainter class iconCenterV'
   850         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   851 @@@@@@@@@@@@@@@@@@@@@@@@B**@J*(@B**MJ*(@@@@M@@@@@@@M@M@@@M@M@M@@@M@M@M@@@M@M@M@@B*****(@B*****(@@M@M@M@@@M@M@M@@@E@M@M@@
   852 @@@M@E@@@@@M@@@@B**EJ*(@B(*@J*(@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@G @@G @@G'' G''''!!G'''' G'''' G'''' O??0O??0G'''' G'''' G'''' G'''' @G''#@G @@G C@@@@@@@@@@@@') ; yourself); yourself]
   853 !
   854 
   855 iconCenterVInFrame
   856     "This resource specification was automatically generated
   857      by the ImageEditor of ST/X."
   858 
   859     "Do not manually edit this!! If it is corrupted,
   860      the ImageEditor may not be able to read the specification."
   861 
   862     "
   863      self iconCenterVInFrame inspect
   864      ImageEditor openOnClass:self andSelector:#iconCenterVInFrame
   865      Icon flushCachedIcons
   866     "
   867 
   868     <resource: #image>
   869 
   870     ^Icon
   871         constantNamed:'UIPainter class iconCenterVInFrame'
   872         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   873 @@@@@@@@J******@H@@@@@B@HL3@L3B@H:*GJ*2@H@@G@@B@HG@G@@B@HG@G@GB@HG@G@GB@HG@G@GB@HG@G@GB@HG@G@GB@HG@G@GB@HG@G@GB@HG@G@EB@
   874 HE@G@@B@H@@G@@B@H:*E@J2@HL3@L3B@H@@@@@B@J******@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@B_??9P@@HW??(TG (W'' (W''''*W''''(W''''*W'''')W''''(W'''')W''''+W''''*W''''*W''''(W'' )TG (W??(P@@H_??8@@@@') ; yourself); yourself]
   875 !
   876 
   877 iconDistributeH
   878     "This resource specification was automatically generated
   879      by the ImageEditor of ST/X."
   880 
   881     "Do not manually edit this!! If it is corrupted,
   882      the ImageEditor may not be able to read the specification."
   883 
   884     "
   885      self iconDistributeH inspect
   886      ImageEditor openOnClass:self andSelector:#iconDistributeH
   887      Icon flushCachedIcons
   888     "
   889 
   890     <resource: #image>
   891 
   892     ^Icon
   893         constantNamed:'UIPainter class iconDistributeH'
   894         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   895 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@E@@E@G@@G@@G@G@@G@@G@GHBGHBG@GHBGHBG@GJ*GJ*G@GHBGHBG@GHBGHBG@GB*GJ G@GB*GJ G@
   896 G@@G@@G@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@<G <<G <<G ?<G =>O1?>O1????<>O1<>O1><G <<G ><G <<G ?@@@A@@@@@@@@@@@@@@@A') ; yourself); yourself]
   897 !
   898 
   899 iconDistributeV
   900     "This resource specification was automatically generated
   901      by the ImageEditor of ST/X."
   902 
   903     "Do not manually edit this!! If it is corrupted,
   904      the ImageEditor may not be able to read the specification."
   905 
   906     "
   907      self iconDistributeV inspect
   908      ImageEditor openOnClass:self andSelector:#iconDistributeV
   909      Icon flushCachedIcons
   910     "
   911 
   912     <resource: #image>
   913 
   914     ^Icon
   915         constantNamed:'UIPainter class iconDistributeV'
   916         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   917 @@@@@@@@@@UUUT@@@@???4@@@@@@@@@@@@@*(@@@@@JB@@@@@@JB@@@@@@JB@@@@@@J*(@@@@@@@@@@@@@UUUT@@@@???4@@@@@@@@@@@@J*(@@@@@JB@@@@
   918 @@JB@@@@@@@B@@@@@@@*(@@@@@@@@@@@@@UUUT@@@@???4@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A??@A??@A??CA??@@G0@@A@@@A@@@A@@@G0CA??@A??@A??@A??@@G0C@A@@@A@@@A@@@G0AA??AA??@A??@A??B') ; yourself); yourself]
   919 !
   920 
   921 iconResizeB
   922     "This resource specification was automatically generated
   923      by the ImageEditor of ST/X."
   924 
   925     "Do not manually edit this!! If it is corrupted,
   926      the ImageEditor may not be able to read the specification."
   927 
   928     "
   929      self iconResizeB inspect
   930      ImageEditor openOnClass:self andSelector:#iconResizeB
   931      Icon flushCachedIcons
   932     "
   933 
   934     <resource: #image>
   935 
   936     ^Icon
   937         constantNamed:'UIPainter class iconResizeB'
   938         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   939 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@M@@@@@@@M@@@@@@@M@M@@@@@M@M@@@@@M@M@@@@@M@M@@@M@M@M@@@M@M@M@@@M@M@M@@@M@M@M@@@@@@@M@@
   940 @@@@@E@@@@@@@@@@B*****(@B*****(@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@G A@G @@G'' @G'' @G''#@G'' G''''"G'''' G''''!!G'''' G'''' O?7 G'''' CCG O??0O??0@@@A@@@@@@@@') ; yourself); yourself]
   941 !
   942 
   943 iconResizeL
   944     "This resource specification was automatically generated
   945      by the ImageEditor of ST/X."
   946 
   947     "Do not manually edit this!! If it is corrupted,
   948      the ImageEditor may not be able to read the specification."
   949 
   950     "
   951      self iconResizeL inspect
   952      ImageEditor openOnClass:self andSelector:#iconResizeL
   953      Icon flushCachedIcons
   954     "
   955 
   956     <resource: #image>
   957 
   958     ^Icon
   959         constantNamed:'UIPainter class iconResizeL'
   960         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   961 @@@@@@@@@@@@@@@@@(@@@@@@@(@@@@@@@(UUUP@I@(_??0@@@(@@@@@@@(@@@@@@@(@@@@@@@(@@@@@@@(AUUU@@@(C???@@@(@@@@@E@(@@@@@@@(@@@@@@
   962 @(@@@@@@@(AU@@@@@(C?@@@@@(@@@@@@@(@@@@@@@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@@@G?>@G?>@G?>@G?>@F@@@FP@@F?? G?? G?? F?? FP@@FP@@F? @G? @G? @F? @FP@@@@@@@@@@') ; yourself); yourself]
   963 !
   964 
   965 iconResizeLR
   966     "This resource specification was automatically generated
   967      by the ImageEditor of ST/X."
   968 
   969     "Do not manually edit this!! If it is corrupted,
   970      the ImageEditor may not be able to read the specification."
   971 
   972     "
   973      self iconResizeLR inspect
   974      ImageEditor openOnClass:self andSelector:#iconResizeLR
   975      Icon flushCachedIcons
   976     "
   977 
   978     <resource: #image>
   979 
   980     ^Icon
   981         constantNamed:'UIPainter class iconResizeLR'
   982         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   983 @@@@@@@@@@@@@@@@@(@@@B @@(@@@B @@(UUUR I@(???2 @@(@@@B @@(@@@B @@(@@@B @@(@@@B @@(AUTB @@(C?<B @@(@@@B E@(@@@B @@(@@@B @
   984 @(@@@B @@(AUTB @@(C?<B @@(@@@B @@(@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@A G?? G?? G?? G?? F@A FPI F?= G?? G?? F?= FPI FPI F?= G?? G?? F?= FPI @@@@@@@@') ; yourself); yourself]
   985 !
   986 
   987 iconResizeR
   988     "This resource specification was automatically generated
   989      by the ImageEditor of ST/X."
   990 
   991     "Do not manually edit this!! If it is corrupted,
   992      the ImageEditor may not be able to read the specification."
   993 
   994     "
   995      self iconResizeR inspect
   996      ImageEditor openOnClass:self andSelector:#iconResizeR
   997      Icon flushCachedIcons
   998     "
   999 
  1000     <resource: #image>
  1001 
  1002     ^Icon
  1003         constantNamed:'UIPainter class iconResizeR'
  1004         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
  1005 @@@@@@@@@@@@@@@@@@@@@B @@@@@@B @@@UUUR I@@???R @@@@@@B @@@@@@B @@@@@@B @@@@@@B @@EUUTB @@O??<B @@@@@@B E@@@@@B @@@@@@B @
  1006 @@@@@B @@@@ETB @@@@O<B @@@@@@B @@@@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@A A?? A?? A?? A?? @@A @@I G?= G?? G?? G?= @@I @@I @G= @G? @G? @G= @@I @@@@@@@@') ; yourself); yourself]
  1007 !
  1008 
  1009 iconResizeT
  1010     "This resource specification was automatically generated
  1011      by the ImageEditor of ST/X."
  1012 
  1013     "Do not manually edit this!! If it is corrupted,
  1014      the ImageEditor may not be able to read the specification."
  1015 
  1016     "
  1017      self iconResizeT inspect
  1018      ImageEditor openOnClass:self andSelector:#iconResizeT
  1019      Icon flushCachedIcons
  1020     "
  1021 
  1022     <resource: #image>
  1023 
  1024     ^Icon
  1025         constantNamed:'UIPainter class iconResizeT'
  1026         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
  1027 @@@@@@@@@@@@@@@@@@@@@@@@B*****(@B*****(@@@@@@@@@@@@@@E@@@@@@@M@@@M@M@M@@@M@M@M@@@M@M@M@@@M@M@M@@@@@M@M@@@@@M@M@@@@@M@M@@
  1028 @@@M@M@@@@@M@@@@@@@M@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@AO??0O??0CCG G'''' O?7 G'''' G'''' G''''!!G'''' G''''"@G'' @G''#@G'' @G'' @G @@G A@@@@@@@@@@@@') ; yourself); yourself]
  1029 !
  1030 
  1031 iconResizeTB
  1032     "This resource specification was automatically generated
  1033      by the ImageEditor of ST/X."
  1034 
  1035     "Do not manually edit this!! If it is corrupted,
  1036      the ImageEditor may not be able to read the specification."
  1037 
  1038     "
  1039      self iconResizeTB inspect
  1040      ImageEditor openOnClass:self andSelector:#iconResizeTB
  1041      Icon flushCachedIcons
  1042     "
  1043 
  1044     <resource: #image>
  1045 
  1046     ^Icon
  1047         constantNamed:'UIPainter class iconResizeTB'
  1048         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
  1049 @@@@@@@@@@@@@@@@@@@@@@@@B*****(@B*****(@@@@@@@@@@G@@@@@@@G@@@@@@@G@G@G@@@G@G@G@@@G@G@G@@@G@G@G@@@G@G@G@@@G@G@G@@@G@@@@@@
  1050 @G@@@@@@@@@@@@@@B*****(@B*****(@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@B@@@@@@@BO??0O??2G#C@G'''' G/?0G''''#G'''' G'''' G'''' G'''' G''''"G/?0G'''' G#C@O??1O??0@@@A@@@B@@@@') ; yourself); yourself]
  1051 ! !
  1052 
  1053 !UIPainter class methodsFor:'interface specs'!
  1054 
  1055 dialogSpecForDefiningClassAndSelector
  1056     "This resource specification was automatically generated
  1057      by the UIPainter of ST/X."
  1058 
  1059     "Do not manually edit this!! If it is corrupted,
  1060      the UIPainter may not be able to read the specification."
  1061 
  1062     "
  1063      UIPainter new openOnClass:UIPainter andSelector:#dialogSpecForDefiningClassAndSelector
  1064      UIPainter new openInterface:#dialogSpecForDefiningClassAndSelector
  1065     "
  1066 
  1067     <resource: #canvas>
  1068 
  1069     ^
  1070      
  1071        #(#FullSpec
  1072           #window: 
  1073            #(#WindowSpec
  1074               #name: 'GUI Painter'
  1075               #layout: #(#LayoutFrame 291 0 130 0 637 0 289 0)
  1076               #label: 'GUI Painter'
  1077               #min: #(#Point 350 160)
  1078               #max: #(#Point 500 160)
  1079               #bounds: #(#Rectangle 291 130 638 290)
  1080               #usePreferredExtent: false
  1081           )
  1082           #component: 
  1083            #(#SpecCollection
  1084               #collection: 
  1085                #(
  1086                  #(#FramedBoxSpec
  1087                     #name: 'FramedBox'
  1088                     #layout: #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -35 1.0)
  1089                     #component: 
  1090                      #(#SpecCollection
  1091                         #collection: 
  1092                          #(
  1093                            #(#LabelSpec
  1094                               #name: 'selectorLabel'
  1095                               #layout: #(#AlignmentOrigin 67 0.11 29 0 1 0.5)
  1096                               #label: 'Selector:'
  1097                               #translateLabel: true
  1098                               #adjust: #right
  1099                               #resizeForLabel: true
  1100                           )
  1101                            #(#InputFieldSpec
  1102                               #name: 'methodNameField'
  1103                               #layout: #(#LayoutFrame 70 0.11 18 0 4 1.0 40 0)
  1104                               #tabable: true
  1105                               #model: #methodNameChannel
  1106                               #group: #inputGroup
  1107                           )
  1108                            #(#LabelSpec
  1109                               #name: 'classLabel'
  1110                               #layout: #(#AlignmentOrigin 67 0.11 54 0 1 0.5)
  1111                               #label: 'Class:'
  1112                               #translateLabel: true
  1113                               #adjust: #right
  1114                               #resizeForLabel: true
  1115                           )
  1116                            #(#InputFieldSpec
  1117                               #name: 'classNameField'
  1118                               #layout: #(#LayoutFrame 70 0.11 43 0 4 1.0 65 0)
  1119                               #tabable: true
  1120                               #model: #classNameChannel
  1121                               #group: #inputGroup
  1122                           )
  1123                            #(#LabelSpec
  1124                               #name: 'superClassLabel'
  1125                               #layout: #(#AlignmentOrigin 67 0.11 79 0 1 0.5)
  1126                               #label: 'Superclass:'
  1127                               #translateLabel: true
  1128                               #adjust: #right
  1129                               #resizeForLabel: true
  1130                           )
  1131                            #(#ComboBoxSpec
  1132                               #name: 'superclassNameComboBox'
  1133                               #layout: #(#LayoutFrame 70 0.11 68 0 4 1.0 90 0)
  1134                               #tabable: true
  1135                               #model: #superclassNameChannel
  1136                               #comboList: #superclassNameDefaults
  1137                           )
  1138                         )
  1139                     )
  1140                     #label: 'Define Class And Selector'
  1141                     #labelPosition: #topLeft
  1142                     #translateLabel: true
  1143                 )
  1144                  #(#UISubSpecification
  1145                     #name: 'subSpec'
  1146                     #layout: #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
  1147                     #majorKey: #ToolApplicationModel
  1148                     #minorKey: #windowSpecForCommitWithoutChannels
  1149                 )
  1150               )
  1151           )
  1152       )
  1153 
  1154     "Modified: / 13.8.1998 / 19:59:44 / cg"
  1155 !
  1156 
  1157 dialogSpecForDefiningGridParameters
  1158     "This resource specification was automatically generated
  1159      by the UIPainter of ST/X."
  1160 
  1161     "Do not manually edit this!! If it is corrupted,
  1162      the UIPainter may not be able to read the specification."
  1163 
  1164     "
  1165      UIPainter new openOnClass:UIPainter andSelector:#dialogSpecForDefiningGridParameters
  1166      UIPainter new openInterface:#dialogSpecForDefiningGridParameters
  1167     "
  1168 
  1169     <resource: #canvas>
  1170 
  1171     ^ 
  1172      #(FullSpec
  1173         name: dialogSpecForDefiningGridParameters
  1174         window: 
  1175        (WindowSpec
  1176           label: 'GUI Painter'
  1177           name: 'GUI Painter'
  1178           min: (Point 300 200)
  1179           max: (Point 300 200)
  1180           bounds: (Rectangle 16 46 298 244)
  1181         )
  1182         component: 
  1183        (SpecCollection
  1184           collection: (
  1185            (FramedBoxSpec
  1186               label: 'Grid Parameter'
  1187               name: 'FramedBox'
  1188               layout: (LayoutFrame 0 0.0 3 0.0 0 1.0 -35 1.0)
  1189               labelPosition: topLeft
  1190               translateLabel: true
  1191               component: 
  1192              (SpecCollection
  1193                 collection: (
  1194                  (CheckBoxSpec
  1195                     label: 'Show Grid'
  1196                     name: 'ShowGridCheckBox'
  1197                     layout: (Point 13 14)
  1198                     model: showGrid
  1199                     translateLabel: true
  1200             activeHelpKey: showGrid
  1201                   )
  1202                  (CheckBoxSpec
  1203                     label: 'Align To Grid'
  1204                     name: 'AlignCheckBox'
  1205                     layout: (Point 13 42)
  1206                     model: alignToGrid
  1207                     translateLabel: true
  1208             activeHelpKey: alignToGrid
  1209                   )
  1210                  (LabelSpec
  1211                     label: 'Horizontal Pixels:'
  1212                     name: 'HorizontalPixelsLabel'
  1213                     layout: (AlignmentOrigin 138 0 89 0 1 0.5)
  1214                     translateLabel: true
  1215                     resizeForLabel: true
  1216                     adjust: right
  1217                   )
  1218                  (InputFieldSpec
  1219                     name: 'HorizontalPixelsField'
  1220                     layout: (LayoutFrame 144 0 77 0 197 0 99 0)
  1221                     model: hspace
  1222                     group: inputGroup
  1223                     type: numberOrNil
  1224                     acceptOnPointerLeave: false
  1225                   )
  1226                  (LabelSpec
  1227                     label: 'Vertical Pixels:'
  1228                     name: 'VerticalPixelsLabel'
  1229                     layout: (AlignmentOrigin 139 0 114 0 1 0.5)
  1230                     translateLabel: true
  1231                     resizeForLabel: true
  1232                     adjust: right
  1233                   )
  1234                  (InputFieldSpec
  1235                     name: 'VerticalPixelsField'
  1236                     layout: (LayoutFrame 144 0 102 0 197 0 124 0)
  1237                     model: vspace
  1238                     group: inputGroup
  1239                     type: numberOrNil
  1240                     acceptOnPointerLeave: false
  1241                   )
  1242                  )
  1243                
  1244               )
  1245             )
  1246            (UISubSpecification
  1247               name: 'subSpec'
  1248               layout: (LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
  1249               majorKey: ToolApplicationModel
  1250               minorKey: windowSpecForCommitWithoutChannels
  1251             )
  1252            )
  1253          
  1254         )
  1255       )
  1256 !
  1257 
  1258 dialogSpecForDefiningPortAndPageName
  1259     "This resource specification was automatically generated
  1260      by the UIPainter of ST/X."
  1261 
  1262     "Do not manually edit this!! If it is corrupted,
  1263      the UIPainter may not be able to read the specification."
  1264 
  1265     "
  1266      UIPainter new openOnClass:UIPainter andSelector:#dialogSpecForDefiningPortAndPageName
  1267      UIPainter new openInterface:#dialogSpecForDefiningPortAndPageName
  1268     "
  1269 
  1270     <resource: #canvas>
  1271 
  1272     ^ 
  1273      #(FullSpec
  1274         name: dialogSpecForDefiningPortAndPageName
  1275         window: 
  1276        (WindowSpec
  1277           label: 'GUI Painter'
  1278           name: 'GUI Painter'
  1279           min: (Point 350 140)
  1280           max: (Point 500 140)
  1281           bounds: (Rectangle 0 0 346 138)
  1282         )
  1283         component: 
  1284        (SpecCollection
  1285           collection: (
  1286            (FramedBoxSpec
  1287               label: 'Define Service and Pagename'
  1288               name: 'FramedBox'
  1289               layout: (LayoutFrame 0 0.0 3 0.0 0 1.0 -34 1.0)
  1290               labelPosition: topLeft
  1291               translateLabel: true
  1292               component: 
  1293              (SpecCollection
  1294                 collection: (
  1295                  (LabelSpec
  1296                     label: 'Service (or Port):'
  1297                     name: 'portLabel'
  1298                     layout: (AlignmentOrigin 67 0.11 29 0 1 0.5)
  1299                     translateLabel: true
  1300                     resizeForLabel: true
  1301                     adjust: right
  1302                   )
  1303                  (ComboBoxSpec
  1304                     name: 'ComboBox1'
  1305                     layout: (LayoutFrame 70 0.11 18 0 4 1.0 40 0)
  1306                     model: serviceOrPortNameChannel
  1307                     acceptOnPointerLeave: false
  1308                     comboList: runningServerPorts
  1309                   )
  1310                  (LabelSpec
  1311                     label: 'Pagename:'
  1312                     name: 'pageNameLabel'
  1313                     layout: (AlignmentOrigin 67 0.11 54 0 1 0.5)
  1314                     translateLabel: true
  1315                     resizeForLabel: true
  1316                     adjust: right
  1317                   )
  1318                  (InputFieldSpec
  1319                     name: 'pageNameNameField'
  1320                     layout: (LayoutFrame 70 0.11 43 0 4 1.0 65 0)
  1321                     tabable: true
  1322                     model: pageNameNameChannel
  1323                     group: inputGroup
  1324                     acceptOnPointerLeave: false
  1325                   )
  1326                  )
  1327                
  1328               )
  1329             )
  1330            (UISubSpecification
  1331               name: 'subSpec'
  1332               layout: (LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
  1333               majorKey: ToolApplicationModel
  1334               minorKey: windowSpecForCommitWithoutChannels
  1335             )
  1336            )
  1337          
  1338         )
  1339       )
  1340 !
  1341 
  1342 windowSpec
  1343     "This resource specification was automatically generated
  1344      by the UIPainter of ST/X."
  1345 
  1346     "Do not manually edit this!! If it is corrupted,
  1347      the UIPainter may not be able to read the specification."
  1348 
  1349     "
  1350      UIPainter new openOnClass:UIPainter andSelector:#windowSpec
  1351      UIPainter new openInterface:#windowSpec
  1352      UIPainter open
  1353     "
  1354 
  1355     <resource: #canvas>
  1356 
  1357     ^ 
  1358      #(FullSpec
  1359         name: windowSpec
  1360         window: 
  1361        (WindowSpec
  1362           label: 'GUI Painter'
  1363           name: 'GUI Painter'
  1364           min: (Point 560 460)
  1365           bounds: (Rectangle 0 0 683 568)
  1366           menu: menu
  1367           icon: defaultIcon
  1368         )
  1369         component: 
  1370        (SpecCollection
  1371           collection: (
  1372            (ViewSpec
  1373               name: 'mainPanel'
  1374               layout: (LayoutFrame 0 0 0 0 0 1 -24 1)
  1375               component: 
  1376              (SpecCollection
  1377                 collection: (
  1378                  (ViewSpec
  1379                     name: 'ToolBar'
  1380                     layout: (LayoutFrame 0 0 0 0 0 1 32 0)
  1381                     visibilityChannel: toolBarVisibleHolder
  1382                     component: 
  1383                    (SpecCollection
  1384                       collection: (
  1385                        (ActionButtonSpec
  1386                           label: 'hideToolBarIcon'
  1387                           name: 'HideToolBarButton'
  1388                           layout: (LayoutFrame 0 0 0 0 13 0 0 1)
  1389                           activeHelpKey: hideToolBar
  1390                           hasCharacterOrientedLabel: false
  1391                           translateLabel: true
  1392                           model: hideToolbar
  1393                           postBuildCallback: hideToolBarButtonCreated:
  1394                         )
  1395                        (MenuPanelSpec
  1396                           name: 'menuToolbarView'
  1397                           layout: (LayoutFrame 13 0.0 0 0.0 0 1.0 0 1.0)
  1398                           visibilityChannel: toolBarVisibleHolder
  1399                           menu: menuToolbar
  1400                           textDefault: true
  1401                         )
  1402                        )
  1403                      
  1404                     )
  1405                   )
  1406                  (ViewSpec
  1407                     name: 'EditToolBar'
  1408                     layout: (LayoutFrame 0 0 30 0 0 1 62 0)
  1409                     visibilityChannel: editToolBarVisibleHolder
  1410                     component: 
  1411                    (SpecCollection
  1412                       collection: (
  1413                        (ActionButtonSpec
  1414                           label: 'hideToolBarIcon'
  1415                           name: 'HideEditToolBarButton'
  1416                           layout: (LayoutFrame 0 0 0 0 13 0 0 1)
  1417                           activeHelpKey: hideToolBar
  1418                           hasCharacterOrientedLabel: false
  1419                           translateLabel: true
  1420                           model: hideEditToolbar
  1421                           postBuildCallback: hideToolBarButtonCreated:
  1422                         )
  1423                        (MenuPanelSpec
  1424                           name: 'EditToolBar1'
  1425                           layout: (LayoutFrame 13 0.0 0 0.0 0 1.0 0 1.0)
  1426                           visibilityChannel: editToolBarVisibleHolder
  1427                           menu: editToolbar
  1428                           textDefault: true
  1429                         )
  1430                        )
  1431                      
  1432                     )
  1433                   )
  1434                  (VariableHorizontalPanelSpec
  1435                     name: 'Painter'
  1436                     layout: (LayoutFrame 0 0.0 60 0.0 0 1.0 0 1.0)
  1437                     level: 1
  1438                     component: 
  1439                    (SpecCollection
  1440                       collection: (
  1441                        (ArbitraryComponentSpec
  1442                           name: 'treeView'
  1443                           tabable: true
  1444                           menu: menuEdit
  1445                           hasHorizontalScrollBar: true
  1446                           hasVerticalScrollBar: true
  1447                           miniScrollerHorizontal: true
  1448                           miniScrollerVertical: true
  1449                           hasBorder: false
  1450                           component: treeView
  1451                         )
  1452                        (ViewSpec
  1453                           name: 'specHolderView'
  1454                           level: 0
  1455                           component: 
  1456                          (SpecCollection
  1457                             collection: (
  1458                              (MenuPanelSpec
  1459                                 name: 'menuToolbar2View'
  1460                                 layout: (LayoutFrame 2 0.0 2 0 -2 1.0 32 0)
  1461                                 level: 0
  1462                                 tabable: true
  1463                                 menu: menuToolbar2
  1464                               )
  1465                              (NoteBookViewSpec
  1466                                 name: 'noteBook'
  1467                                 layout: (LayoutFrame 2 0.0 32 0.0 -2 1.0 -28 1.0)
  1468                                 level: 0
  1469                                 enableChannel: enableChannel
  1470                                 tabable: true
  1471                                 model: tabModel
  1472                                 menu: tabList
  1473                                 translateLabel: true
  1474                                 canvas: noteBookView
  1475                               )
  1476                              (HorizontalPanelViewSpec
  1477                                 name: 'HorizontalPanel1'
  1478                                 layout: (LayoutFrame 2 0 -26 1 -2 1 -2 1)
  1479                                 horizontalLayout: fit
  1480                                 verticalLayout: fit
  1481                                 horizontalSpace: 3
  1482                                 verticalSpace: 3
  1483                                 reverseOrderIfOKAtLeft: true
  1484                                 component: 
  1485                                (SpecCollection
  1486                                   collection: (
  1487                                    (ActionButtonSpec
  1488                                       label: 'Cancel'
  1489                                       name: 'cancelButton'
  1490                                       activeHelpKey: commitCancel
  1491                                       translateLabel: true
  1492                                       tabable: true
  1493                                       model: cancel
  1494                                       enableChannel: modifiedChannel
  1495                                       extent: (Point 231 24)
  1496                                     )
  1497                                    (ActionButtonSpec
  1498                                       label: 'OK'
  1499                                       name: 'acceptButton'
  1500                                       activeHelpKey: commitOK
  1501                                       translateLabel: true
  1502                                       tabable: true
  1503                                       model: accept
  1504                                       enableChannel: modifiedChannel
  1505                                       extent: (Point 231 24)
  1506                                     )
  1507                                    )
  1508                                  
  1509                                 )
  1510                               )
  1511                              )
  1512                            
  1513                           )
  1514                         )
  1515                        )
  1516                      
  1517                     )
  1518                     handles: (Any 0.30592105263158 1.0)
  1519                   )
  1520                  )
  1521                
  1522               )
  1523             )
  1524            (UISubSpecification
  1525               name: 'infoBarSubSpec'
  1526               layout: (LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
  1527               level: 1
  1528               majorKey: ToolApplicationModel
  1529               minorKey: windowSpecForInfoBar
  1530             )
  1531            )
  1532          
  1533         )
  1534       )
  1535 ! !
  1536 
  1537 !UIPainter class methodsFor:'menu specs'!
  1538 
  1539 cutCopyPasteMenuSlice
  1540     "This resource specification was automatically generated
  1541      by the MenuEditor of ST/X."
  1542 
  1543     "Do not manually edit this!! If it is corrupted,
  1544      the MenuEditor may not be able to read the specification."
  1545 
  1546     "
  1547      MenuEditor new openOnClass:UIPainter andSelector:#menuToolbar
  1548      (Menu new fromLiteralArrayEncoding:(UIPainter menuToolbar)) startUp
  1549     "
  1550 
  1551     <resource: #menu>
  1552 
  1553     ^ 
  1554      #(Menu
  1555         (
  1556          (MenuItem
  1557             activeHelpKey: editCut
  1558             enabled: canCutHolder
  1559             label: 'Cut'
  1560             itemValue: deleteSelection
  1561             translateLabel: true
  1562             isButton: true
  1563             labelImage: (ResourceRetriever ToolbarIconLibrary cutWidgetIcon)
  1564           )
  1565          (MenuItem
  1566             activeHelpKey: editCopy
  1567             enabled: canCopyHolder
  1568             label: 'Copy'
  1569             itemValue: copySelection
  1570             translateLabel: true
  1571             isButton: true
  1572             labelImage: (ResourceRetriever ToolbarIconLibrary copyWidgetIcon)
  1573           )
  1574          (MenuItem
  1575             activeHelpKey: editPaste
  1576             enabled: canPasteKeepingLayoutHolder
  1577             label: 'Paste with Layout'
  1578             itemValue: pasteWithLayout
  1579             translateLabel: true
  1580             isButton: true
  1581             labelImage: (ResourceRetriever ToolbarIconLibrary pasteWidgetIcon)
  1582           )
  1583          (MenuItem
  1584             activeHelpKey: editDelete
  1585             enabled: canCutHolder
  1586             label: 'Delete'
  1587             itemValue: deleteTotalSelection
  1588             translateLabel: true
  1589             isButton: true
  1590             isVisible: false
  1591             labelImage: (ResourceRetriever ToolbarIconLibrary deleteWidgetIcon)
  1592           )
  1593          (MenuItem
  1594             label: '-'
  1595           )
  1596          (MenuItem
  1597             activeHelpKey: editUndo
  1598             enabled: hasUndoHistoryHolder
  1599             label: 'Undo'
  1600             itemValue: undoLast
  1601             translateLabel: true
  1602             isButton: true
  1603             labelImage: (ResourceRetriever ToolbarIconLibrary undoIcon)
  1604           )
  1605          )
  1606         nil
  1607         nil
  1608       )
  1609 !
  1610 
  1611 editToolbar
  1612     "This resource specification was automatically generated
  1613      by the MenuEditor of ST/X."
  1614 
  1615     "Do not manually edit this!! If it is corrupted,
  1616      the MenuEditor may not be able to read the specification."
  1617 
  1618     "
  1619      MenuEditor new openOnClass:UIPainter andSelector:#editToolbar
  1620      (Menu new fromLiteralArrayEncoding:(UIPainter editToolbar)) startUp
  1621     "
  1622 
  1623     <resource: #menu>
  1624 
  1625     ^ 
  1626      #(Menu
  1627         (
  1628          (MenuItem
  1629             label: 'moveItems'
  1630             translateLabel: true
  1631             submenuChannel: moveInListMenuSlice
  1632             isMenuSlice: true
  1633           )
  1634          (MenuItem
  1635             label: '-'
  1636           )
  1637          (MenuItem
  1638             label: 'gridItems'
  1639             translateLabel: true
  1640             submenuChannel: gridMenuSlice
  1641             isMenuSlice: true
  1642           )
  1643          )
  1644         nil
  1645         nil
  1646       )
  1647 !
  1648 
  1649 gridMenuSlice
  1650     "This resource specification was automatically generated
  1651      by the MenuEditor of ST/X."
  1652 
  1653     "Do not manually edit this!! If it is corrupted,
  1654      the MenuEditor may not be able to read the specification."
  1655 
  1656     "
  1657      MenuEditor new openOnClass:Workflow::WorksheetEditor andSelector:#zoomMenuSlice
  1658      (Menu new fromLiteralArrayEncoding:(Workflow::WorksheetEditor zoomMenuSlice)) startUp
  1659     "
  1660 
  1661     <resource: #menu>
  1662 
  1663     ^ 
  1664      #(Menu
  1665         (
  1666          (MenuItem
  1667             label: 'ShowGrid'
  1668             translateLabel: true
  1669             isButton: true
  1670             indication: gridShownHolder
  1671             labelImage: (ResourceRetriever ToolbarIconLibrary gridIcon)
  1672             activeHelpKey: showGrid
  1673           )
  1674          (MenuItem
  1675             label: 'AlignToGrid'
  1676             translateLabel: true
  1677             isButton: true
  1678             indication: alignToGridHolder
  1679             labelImage: (ResourceRetriever ToolbarIconLibrary gridAlignIcon)
  1680             activeHelpKey: alignToGrid
  1681           )
  1682          )
  1683         nil
  1684         nil
  1685       )
  1686 !
  1687 
  1688 menu
  1689     "This resource specification was automatically generated
  1690      by the MenuEditor of ST/X."
  1691 
  1692     "Do not manually edit this!! If it is corrupted,
  1693      the MenuEditor may not be able to read the specification."
  1694 
  1695 
  1696     "
  1697      MenuEditor new openOnClass:UIPainter andSelector:#menu
  1698      (Menu new fromLiteralArrayEncoding:(UIPainter menu)) startUp
  1699     "
  1700 
  1701     <resource: #menu>
  1702 
  1703     ^ 
  1704      #(Menu
  1705         (
  1706          (MenuItem
  1707             label: '&File'
  1708             translateLabel: true
  1709             submenuChannel: menuFile
  1710             keepLinkedMenu: true
  1711           )
  1712          (MenuItem
  1713             label: 'Edit'
  1714             translateLabel: true
  1715             submenuChannel: menuEdit
  1716           )
  1717          (MenuItem
  1718             label: 'View'
  1719             translateLabel: true
  1720             submenu: 
  1721            (Menu
  1722               (
  1723                (MenuItem
  1724                   activeHelpKey: settingsCanvas
  1725                   label: 'Canvas'
  1726                   translateLabel: true
  1727                   indication: painterShown
  1728                 )
  1729                (MenuItem
  1730                   activeHelpKey: settingsGallery
  1731                   label: 'Gallery'
  1732                   translateLabel: true
  1733                   indication: galleryShown
  1734                 )
  1735                (MenuItem
  1736                   label: '-'
  1737                 )
  1738                (MenuItem
  1739                   label: 'Toolbar'
  1740                   translateLabel: true
  1741                   hideMenuOnActivated: false
  1742                   indication: toolBarVisibleHolder
  1743                 )
  1744                (MenuItem
  1745                   label: 'Editor Toolbar'
  1746                   translateLabel: true
  1747                   hideMenuOnActivated: false
  1748                   indication: editToolBarVisibleHolder
  1749                 )
  1750                (MenuItem
  1751                   label: '-'
  1752                 )
  1753                (MenuItem
  1754                   label: 'Load Sketch as Background...'
  1755                   itemValue: useSketch
  1756                   translateLabel: true
  1757                 )
  1758                (MenuItem
  1759                   label: 'Load Image as Background...'
  1760                   itemValue: useBackgroundImage
  1761                   translateLabel: true
  1762                 )
  1763                )
  1764               nil
  1765               nil
  1766             )
  1767           )
  1768          (MenuItem
  1769             label: 'Align'
  1770             translateLabel: true
  1771             submenuChannel: menuAlign
  1772           )
  1773          (MenuItem
  1774             label: 'Generate'
  1775             translateLabel: true
  1776             isVisible: isNotEditingSpecOnly
  1777             submenu: 
  1778            (Menu
  1779               (
  1780                (MenuItem
  1781                   activeHelpKey: generateAspectMethods
  1782                   enabled: hasSpecClass
  1783                   label: 'Aspect Methods'
  1784                   itemValue: doGenerateAspectMethods
  1785                   translateLabel: true
  1786                 )
  1787                (MenuItem
  1788                   activeHelpKey: generateAspectMethodFor
  1789                   enabled: hasSpecClass
  1790                   label: 'Aspect Method For...'
  1791                   itemValue: doGenerateAspectMethodFor
  1792                   translateLabel: true
  1793                 )
  1794                (MenuItem
  1795                   enabled: hasSpecClass
  1796                   label: 'Menu Stub Methods'
  1797                   itemValue: doGenerateMenuMethods
  1798                   translateLabel: true
  1799                 )
  1800                (MenuItem
  1801                   label: '-'
  1802                 )
  1803                (MenuItem
  1804                   activeHelpKey: generateHookMethods
  1805                   enabled: hasSpecClass
  1806                   label: 'Hook Methods'
  1807                   itemValue: doGenerateHookMethods
  1808                   translateLabel: true
  1809                 )
  1810                )
  1811               nil
  1812               nil
  1813             )
  1814           )
  1815          (MenuItem
  1816             label: 'Test'
  1817             translateLabel: true
  1818             submenu: 
  1819            (Menu
  1820               (
  1821                (MenuItem
  1822                   activeHelpKey: testStartApplication
  1823                   label: 'Start Application'
  1824                   itemValue: doStartApplication
  1825                   translateLabel: true
  1826                   isVisible: isNotEditingSpecOnly
  1827                 )
  1828                (MenuItem
  1829                   label: '-'
  1830                   isVisible: isNotEditingSpecOnly
  1831                 )
  1832                (MenuItem
  1833                   activeHelpKey: testGeometryTestMode
  1834                   label: 'Geometry Test/Set Mode'
  1835                   translateLabel: true
  1836                   indication: testMode:
  1837                 )
  1838                )
  1839               nil
  1840               nil
  1841             )
  1842           )
  1843          (MenuItem
  1844             label: 'Settings'
  1845             translateLabel: true
  1846             submenu: 
  1847            (Menu
  1848               (
  1849                (MenuItem
  1850                   activeHelpKey: settingsAspectsAsInstances
  1851                   label: 'Aspects as InstanceVariables'
  1852                   translateLabel: true
  1853                   isVisible: isNotEditingSpecOnly
  1854                   indication: generateAspectsAsInstanceVariables:
  1855                 )
  1856                (MenuItem
  1857                   activeHelpKey: settingsRedefineAspectMethods
  1858                   label: 'Redefine Aspect Methods'
  1859                   translateLabel: true
  1860                   isVisible: isNotEditingSpecOnly
  1861                   indication: redefineAspectMethods:
  1862                 )
  1863                (MenuItem
  1864                   activeHelpKey: settingsGenerateCommentedCode
  1865                   label: 'Generate Commented Code'
  1866                   translateLabel: true
  1867                   isVisible: isNotEditingSpecOnly
  1868                   indication: generateCommentedCode:
  1869                 )
  1870                (MenuItem
  1871                   label: 'AutoAccept on Selection-Change '
  1872                   translateLabel: true
  1873                   indication: autoAcceptOnSelectionChange
  1874                 )
  1875                (MenuItem
  1876                   label: '-'
  1877                 )
  1878                (MenuItem
  1879                   activeHelpKey: settingsUndoManager
  1880                   enabled: hasUndoHistory
  1881                   label: 'Undo Manager...'
  1882                   itemValue: openUndoMenu
  1883                   translateLabel: true
  1884                 )
  1885                (MenuItem
  1886                   activeHelpKey: settingsGridManager
  1887                   label: 'Grid Manager...'
  1888                   itemValue: doDefineGrid
  1889                   translateLabel: true
  1890                 )
  1891                )
  1892               nil
  1893               nil
  1894             )
  1895           )
  1896          (MenuItem
  1897             label: 'History'
  1898             translateLabel: true
  1899             isVisible: isStandAlone
  1900             submenuChannel: menuHistory
  1901           )
  1902          (MenuItem
  1903             label: 'MENU_Help'
  1904             translateLabel: true
  1905             startGroup: conditionalRight
  1906             submenu: 
  1907            (Menu
  1908               (
  1909                (MenuItem
  1910                   activeHelpKey: helpTutorial
  1911                   label: 'Tutorial'
  1912                   itemValue: openHTMLDocument:
  1913                   translateLabel: true
  1914                   argument: 'tools/uipainter/TOP.html'
  1915                 )
  1916                (MenuItem
  1917                   label: '-'
  1918                 )
  1919                (MenuItem
  1920                   activeHelpKey: helpFunctions
  1921                   label: 'Functions'
  1922                   itemValue: openHTMLDocument:
  1923                   translateLabel: true
  1924                   argument: 'tools/uipainter/Functions.html'
  1925                 )
  1926                (MenuItem
  1927                   activeHelpKey: helpExamples
  1928                   label: 'Examples'
  1929                   itemValue: openHTMLDocument:
  1930                   translateLabel: true
  1931                   argument: 'tools/uipainter/Examples.html'
  1932                 )
  1933                (MenuItem
  1934                   label: '-'
  1935                 )
  1936                (MenuItem
  1937                   activeHelpKey: helpHelpTool
  1938                   label: 'Help Tool'
  1939                   itemValue: openHTMLDocument:
  1940                   translateLabel: true
  1941                   argument: 'tools/uipainter/HelpTool.html'
  1942                 )
  1943                (MenuItem
  1944                   activeHelpKey: helpLayoutTool
  1945                   label: 'Layout Tool'
  1946                   itemValue: openHTMLDocument:
  1947                   translateLabel: true
  1948                   argument: 'tools/uipainter/LayoutTool.html'
  1949                 )
  1950                (MenuItem
  1951                   label: '-'
  1952                 )
  1953                (MenuItem
  1954                   activeHelpKey: helpSelectedWidget
  1955                   label: 'Selected Widget'
  1956                   itemValue: doOpenWidgetDocumentation
  1957                   translateLabel: true
  1958                 )
  1959                (MenuItem
  1960                   label: '-'
  1961                 )
  1962                (MenuItem
  1963                   activeHelpKey: helpShowHelp
  1964                   label: 'Show Help Texts'
  1965                   translateLabel: true
  1966                   indication: showingHelp:
  1967                 )
  1968                (MenuItem
  1969                   label: '-'
  1970                 )
  1971                (MenuItem
  1972                   activeHelpKey: aboutThisAppliaction
  1973                   label: 'About this Application...'
  1974                   itemValue: openAboutThisApplication
  1975                   translateLabel: true
  1976                 )
  1977                )
  1978               nil
  1979               nil
  1980             )
  1981           )
  1982          )
  1983         nil
  1984         nil
  1985       )
  1986 !
  1987 
  1988 menuAlign
  1989     "This resource specification was automatically generated
  1990      by the MenuEditor of ST/X."
  1991 
  1992     "Do not manually edit this!! If it is corrupted,
  1993      the MenuEditor may not be able to read the specification."
  1994 
  1995     "
  1996      MenuEditor new openOnClass:UIPainter andSelector:#menuAlign
  1997      (Menu new fromLiteralArrayEncoding:(UIPainter menuAlign)) startUp
  1998     "
  1999 
  2000     <resource: #menu>
  2001 
  2002     ^ 
  2003      #(Menu
  2004         (
  2005          (MenuItem
  2006             activeHelpKey: alignSelectionLeft
  2007             enabled: canMoveOrAlignSelection
  2008             label: 'Left'
  2009             itemValue: alignSelectionLeft
  2010             translateLabel: true
  2011             labelImage: (ResourceRetriever UIPainter iconAlignL 'Left')
  2012           )
  2013          (MenuItem
  2014             activeHelpKey: alignSelectionRight
  2015             enabled: canMoveOrAlignSelection
  2016             label: 'Right'
  2017             itemValue: alignSelectionRight
  2018             translateLabel: true
  2019             labelImage: (ResourceRetriever UIPainter iconAlignR 'Right')
  2020           )
  2021          (MenuItem
  2022             activeHelpKey: alignSelectionTop
  2023             enabled: canMoveOrAlignSelection
  2024             label: 'Top'
  2025             itemValue: alignSelectionTop
  2026             translateLabel: true
  2027             labelImage: (ResourceRetriever UIPainter iconAlignT 'Top')
  2028           )
  2029          (MenuItem
  2030             activeHelpKey: alignSelectionBottom
  2031             enabled: canMoveOrAlignSelection
  2032             label: 'Bottom'
  2033             itemValue: alignSelectionBottom
  2034             translateLabel: true
  2035             labelImage: (ResourceRetriever UIPainter iconAlignB 'Bottom')
  2036           )
  2037          (MenuItem
  2038             label: '-'
  2039           )
  2040          (MenuItem
  2041             activeHelpKey: alignResizeSelectionLeft
  2042             enabled: canMoveOrAlignSelection
  2043             label: 'Resize Left'
  2044             itemValue: alignResizeSelectionLeft
  2045             translateLabel: true
  2046             labelImage: (ResourceRetriever UIPainter iconResizeL 'Resize Left')
  2047           )
  2048          (MenuItem
  2049             activeHelpKey: alignResizeSelectionRight
  2050             enabled: canMoveOrAlignSelection
  2051             label: 'Resize Right'
  2052             itemValue: alignResizeSelectionRight
  2053             translateLabel: true
  2054             labelImage: (ResourceRetriever UIPainter iconResizeR 'Resize Right')
  2055           )
  2056          (MenuItem
  2057             activeHelpKey: alignResizeSelectionTop
  2058             enabled: canMoveOrAlignSelection
  2059             label: 'Resize Top'
  2060             itemValue: alignResizeSelectionTop
  2061             translateLabel: true
  2062             labelImage: (ResourceRetriever UIPainter iconResizeT 'Resize Top')
  2063           )
  2064          (MenuItem
  2065             activeHelpKey: alignResizeSelectionBottom
  2066             enabled: canMoveOrAlignSelection
  2067             label: 'Resize Bottom'
  2068             itemValue: alignResizeSelectionBottom
  2069             translateLabel: true
  2070             labelImage: (ResourceRetriever UIPainter iconResizeB 'Resize Bottom')
  2071           )
  2072          (MenuItem
  2073             activeHelpKey: alignSelectionLeftAndRight
  2074             enabled: canResizeSelection
  2075             label: 'Left && Right'
  2076             itemValue: alignSelectionLeftAndRight
  2077             translateLabel: true
  2078             labelImage: (ResourceRetriever UIPainter iconResizeLR 'Left && Right')
  2079           )
  2080          (MenuItem
  2081             activeHelpKey: alignSelectionTopAndBottom
  2082             enabled: canResizeSelection
  2083             label: 'Top && Bottom'
  2084             itemValue: alignSelectionTopAndBottom
  2085             translateLabel: true
  2086             labelImage: (ResourceRetriever UIPainter iconResizeTB 'Top && Bottom')
  2087           )
  2088          (MenuItem
  2089             label: '-'
  2090           )
  2091          (MenuItem
  2092             activeHelpKey: alignSelectionCenterHor
  2093             enabled: canMoveOrAlignSelection
  2094             label: 'Center Horizontal'
  2095             itemValue: alignSelectionCenterHor
  2096             translateLabel: true
  2097             labelImage: (ResourceRetriever UIPainter iconCenterH 'Center Horizontal')
  2098           )
  2099          (MenuItem
  2100             activeHelpKey: centerSelectionHor
  2101             enabled: canMoveOrAlignSelection
  2102             label: 'Center Horizontal in Frame'
  2103             itemValue: centerSelectionHor
  2104             translateLabel: true
  2105             labelImage: (ResourceRetriever UIPainter iconCenterHInFrame 'Center Horizontal in Frame')
  2106           )
  2107          (MenuItem
  2108             activeHelpKey: alignSelectionCenterVer
  2109             enabled: canMoveOrAlignSelection
  2110             label: 'Center Vertical'
  2111             itemValue: alignSelectionCenterVer
  2112             translateLabel: true
  2113             labelImage: (ResourceRetriever UIPainter iconCenterV 'Center Vertical')
  2114           )
  2115          (MenuItem
  2116             activeHelpKey: centerSelectionVer
  2117             enabled: canMoveOrAlignSelection
  2118             label: 'Center Vertical in Frame'
  2119             itemValue: centerSelectionVer
  2120             translateLabel: true
  2121             labelImage: (ResourceRetriever UIPainter iconCenterVInFrame 'Center Vertical in Frame')
  2122           )
  2123          (MenuItem
  2124             label: '-'
  2125           )
  2126          (MenuItem
  2127             activeHelpKey: spreadSelectionHor
  2128             enabled: canMoveOrAlignSelection
  2129             label: 'Distribute Horizontal'
  2130             itemValue: spreadSelectionHor
  2131             translateLabel: true
  2132             labelImage: (ResourceRetriever UIPainter iconDistributeH 'Distribute Horizontal')
  2133           )
  2134          (MenuItem
  2135             activeHelpKey: spreadSelectionVer
  2136             enabled: canMoveOrAlignSelection
  2137             label: 'Distribute Vertical'
  2138             itemValue: spreadSelectionVer
  2139             translateLabel: true
  2140             labelImage: (ResourceRetriever UIPainter iconDistributeV 'Distribute Vertical')
  2141           )
  2142          )
  2143         nil
  2144         nil
  2145       )
  2146 !
  2147 
  2148 menuEdit
  2149     "This resource specification was automatically generated
  2150      by the MenuEditor of ST/X."
  2151 
  2152     "Do not manually edit this!! If it is corrupted,
  2153      the MenuEditor may not be able to read the specification."
  2154 
  2155     "
  2156      MenuEditor new openOnClass:UIPainter andSelector:#menuEdit
  2157      (Menu new fromLiteralArrayEncoding:(UIPainter menuEdit)) startUp
  2158     "
  2159 
  2160     <resource: #menu>
  2161 
  2162     ^ 
  2163      #(Menu
  2164         (
  2165          (MenuItem
  2166             activeHelpKey: editUndo
  2167             enabled: hasUndoHistory
  2168             label: 'Undo'
  2169             itemValue: undoLast
  2170             nameKey: undo
  2171             translateLabel: true
  2172           )
  2173          (MenuItem
  2174             label: '-'
  2175           )
  2176          (MenuItem
  2177             activeHelpKey: editCut
  2178             enabled: canCutHolder
  2179             label: 'Cut'
  2180             itemValue: deleteSelection
  2181             translateLabel: true
  2182           )
  2183          (MenuItem
  2184             activeHelpKey: editCopy
  2185             enabled: canCopyHolder
  2186             label: 'Copy'
  2187             itemValue: copySelection
  2188             translateLabel: true
  2189           )
  2190          (MenuItem
  2191             activeHelpKey: editPaste
  2192             enabled: canPasteHolder
  2193             label: 'Paste'
  2194             itemValue: pasteBuffer
  2195             translateLabel: true
  2196           )
  2197          (MenuItem
  2198             activeHelpKey: pasteWithLayout
  2199             enabled: canPasteKeepingLayoutHolder
  2200             label: 'Paste with Layout'
  2201             itemValue: pasteWithLayout
  2202             translateLabel: true
  2203           )
  2204          (MenuItem
  2205             activeHelpKey: editPaste
  2206             enabled: canPasteKeepingLayoutHolder
  2207             label: 'Paste Keeping Absolute Position'
  2208             itemValue: pasteKeepingPosition
  2209             translateLabel: true
  2210           )
  2211          (MenuItem
  2212             activeHelpKey: editDelete
  2213             enabled: canCutHolder
  2214             label: 'Delete'
  2215             itemValue: deleteTotalSelection
  2216             translateLabel: true
  2217           )
  2218          (MenuItem
  2219             activeHelpKey: replaceBy
  2220             enabled: canReplaceSelection
  2221             label: 'Replace By...'
  2222             itemValue: doAskAndReplaceWidgetBy
  2223             translateLabel: true
  2224           )
  2225          (MenuItem
  2226             label: '-'
  2227           )
  2228          (MenuItem
  2229             enabled: canMoveSelection
  2230             label: 'Move'
  2231             translateLabel: true
  2232             submenuChannel: menuMove
  2233           )
  2234          (MenuItem
  2235             enabled: canMoveOrAlignSelection
  2236             label: 'Align'
  2237             translateLabel: true
  2238             submenuChannel: menuAlign
  2239           )
  2240          (MenuItem
  2241             enabled: hasSelection
  2242             label: 'Dimension'
  2243             translateLabel: true
  2244             submenu: 
  2245            (Menu
  2246               (
  2247                (MenuItem
  2248                   activeHelpKey: editDimensionCopyLayout
  2249                   enabled: hasSingleSelection
  2250                   label: 'Copy Layout'
  2251                   itemValue: copyLayout
  2252                   translateLabel: true
  2253                 )
  2254                (MenuItem
  2255                   activeHelpKey: editDimensionPasteLayout
  2256                   enabled: canMoveOrAlignSelection
  2257                   label: 'Paste Layout'
  2258                   itemValue: pasteLayout
  2259                   translateLabel: true
  2260                 )
  2261                (MenuItem
  2262                   activeHelpKey: editDimensionExchangeLayouts
  2263                   enabled: canExchangeSelectionLayouts
  2264                   label: 'Exchange Layouts'
  2265                   itemValue: exchangeLayouts
  2266                   translateLabel: true
  2267                 )
  2268                (MenuItem
  2269                   label: '-'
  2270                 )
  2271                (MenuItem
  2272                   activeHelpKey: editDimensionCopyExtent
  2273                   enabled: hasSingleSelection
  2274                   label: 'Copy Extent'
  2275                   itemValue: copyExtent
  2276                   translateLabel: true
  2277                 )
  2278                (MenuItem
  2279                   activeHelpKey: editDimensionPasteExtent
  2280                   enabled: canMoveOrAlignSelection
  2281                   label: 'Paste Extent'
  2282                   itemValue: pasteExtent
  2283                   translateLabel: true
  2284                 )
  2285                (MenuItem
  2286                   activeHelpKey: editDimensionPasteWidth
  2287                   enabled: canMoveOrAlignSelection
  2288                   label: 'Paste Width'
  2289                   itemValue: pasteWidth
  2290                   translateLabel: true
  2291                 )
  2292                (MenuItem
  2293                   activeHelpKey: editDimensionPasteHeight
  2294                   enabled: canMoveOrAlignSelection
  2295                   label: 'Paste Height'
  2296                   itemValue: pasteHeight
  2297                   translateLabel: true
  2298                 )
  2299                (MenuItem
  2300                   label: '-'
  2301                 )
  2302                (MenuItem
  2303                   activeHelpKey: editDimensionDefaultExtent
  2304                   enabled: canMoveOrAlignSelection
  2305                   label: 'Set Default Extent'
  2306                   itemValue: setToDefaultExtent
  2307                   translateLabel: true
  2308                 )
  2309                (MenuItem
  2310                   activeHelpKey: editDimensionDefaultWidth
  2311                   enabled: canMoveOrAlignSelection
  2312                   label: 'Set Default Width'
  2313                   itemValue: setToDefaultWidth
  2314                   translateLabel: true
  2315                 )
  2316                (MenuItem
  2317                   activeHelpKey: editDimensionDefaultHeight
  2318                   enabled: canMoveOrAlignSelection
  2319                   label: 'Set Default Height'
  2320                   itemValue: setToDefaultHeight
  2321                   translateLabel: true
  2322                 )
  2323                )
  2324               nil
  2325               nil
  2326             )
  2327           )
  2328          (MenuItem
  2329             label: '-'
  2330           )
  2331          (MenuItem
  2332             activeHelpKey: editOpenSpecDocumentation
  2333             label: 'Open Widget Documentation'
  2334             itemValue: doOpenWidgetDocumentation
  2335             translateLabel: true
  2336           )
  2337          (MenuItem
  2338             activeHelpKey: referToCOnfigDatabase
  2339             label: 'Refer to Config Database'
  2340             itemValue: configSelection
  2341             translateLabel: true
  2342             isVisible: false
  2343           )
  2344          (MenuItem
  2345             label: '-'
  2346             isVisible: false
  2347           )
  2348          (MenuItem
  2349             activeHelpKey: drawEdit
  2350             label: 'Draw Edit'
  2351             itemValue: shapeEdit
  2352             translateLabel: true
  2353             isVisible: false
  2354           )
  2355          (MenuItem
  2356             label: '-'
  2357           )
  2358          (MenuItem
  2359             activeHelpKey: sortItems
  2360             label: 'Sort Selected Items by Position'
  2361             itemValue: doSortItems
  2362             translateLabel: true
  2363           )
  2364 "/         (MenuItem
  2365 "/            label: 'Action'
  2366 "/            translateLabel: true
  2367 "/          )
  2368          (MenuItem
  2369             activeHelpKey: groupWithLayout
  2370             enabled: canGroup
  2371             label: 'Group with Layout'
  2372             itemValue: groupWithLayout
  2373             translateLabel: true
  2374           )
  2375          (MenuItem
  2376             activeHelpKey: ungroup
  2377             enabled: canUngroup
  2378             label: 'Ungroup'
  2379             itemValue: ungroup
  2380             translateLabel: true
  2381           )
  2382          (MenuItem
  2383             activeHelpKey: ungroupWithLayout
  2384             enabled: canGroup
  2385             label: 'Ungroup with Layout'
  2386             itemValue: ungroupWithLayout
  2387             translateLabel: true
  2388           )
  2389          (MenuItem
  2390             label: '-'
  2391           )
  2392          (MenuItem
  2393             activeHelpKey: editBrowseViewClass
  2394             enabled: hasOneSelectionOtherThanCanvas
  2395             label: 'Browse Widget Class'
  2396             itemValue: doBrowseViewClass
  2397             translateLabel: true
  2398           )
  2399          (MenuItem
  2400             activeHelpKey: editInspectView
  2401             enabled: hasOneSelectionOtherThanCanvas
  2402             label: 'Inspect Widget'
  2403             itemValue: doInspectView
  2404             translateLabel: true
  2405           )
  2406          (MenuItem
  2407             activeHelpKey: editBrowseViewClass
  2408             label: 'Browse Specification Class'
  2409             itemValue: doBrowseSpecificationClass
  2410             translateLabel: true
  2411           )
  2412          (MenuItem
  2413             activeHelpKey: editInspectSpec
  2414             label: 'Inspect Spec'
  2415             itemValue: doInspectSpec
  2416             translateLabel: true
  2417           )
  2418          )
  2419         nil
  2420         nil
  2421       )
  2422 !
  2423 
  2424 menuFile
  2425     "This resource specification was automatically generated
  2426      by the MenuEditor of ST/X."
  2427 
  2428     "Do not manually edit this!! If it is corrupted,
  2429      the MenuEditor may not be able to read the specification."
  2430 
  2431     "
  2432      MenuEditor new openOnClass:UIPainter andSelector:#menuFile
  2433      (Menu new fromLiteralArrayEncoding:(UIPainter menuFile)) startUp
  2434     "
  2435 
  2436     <resource: #menu>
  2437 
  2438     ^ 
  2439      #(Menu
  2440               (
  2441                (MenuItem
  2442                   activeHelpKey: fileNew
  2443                   label: 'New'
  2444                   itemValue: doNew
  2445                   translateLabel: true
  2446                   isVisible: isStandAlone
  2447                 )
  2448                (MenuItem
  2449                   label: '-'
  2450                   isVisible: isStandAlone
  2451                 )
  2452                (MenuItem
  2453                   activeHelpKey: fileLoad
  2454                   label: 'Load...'
  2455                   itemValue: doLoad
  2456                   translateLabel: true
  2457                   isVisible: isStandAlone
  2458                 )
  2459                (MenuItem
  2460                   activeHelpKey: fileLoadSubspec
  2461                   label: 'Load Subspec...'
  2462                   itemValue: doLoadSubspec
  2463                   translateLabel: true
  2464                   isVisible: isStandAlone
  2465                 )
  2466                (MenuItem
  2467                   label: '-'
  2468                   isVisible: isStandAlone
  2469                 )
  2470                (MenuItem
  2471                   activeHelpKey: fileSave
  2472                   label: 'Save'
  2473                   itemValue: doSave
  2474                   translateLabel: true
  2475                 )
  2476                (MenuItem
  2477                   activeHelpKey: fileSaveAs
  2478                   label: 'Save As...'
  2479                   itemValue: doSaveAs
  2480                   translateLabel: true
  2481                 )
  2482                (MenuItem
  2483                   label: '-'
  2484                 )
  2485                (MenuItem
  2486                   activeHelpKey: fileSaveAs
  2487                   label: 'Define Class and Selector...'
  2488                   itemValue: doDefineClassAndSelector
  2489                   translateLabel: true
  2490                   isVisible: isStandAlone
  2491                 )
  2492                (MenuItem
  2493                   activeHelpKey: filePickAnInterface
  2494                   label: 'Pick a Window Spec...'
  2495                   itemValue: doPickAView
  2496                   translateLabel: true
  2497                 )
  2498                (MenuItem
  2499                   label: '-'
  2500                 )
  2501                (MenuItem
  2502                   label: 'Launch'
  2503                   itemValue: doStartApplication
  2504                   translateLabel: true
  2505                 )
  2506                (MenuItem
  2507                   enabled: canInstallAsWebPageHolder
  2508                   label: 'Install as WebPage'
  2509                   itemValue: doInstallAsWebPage
  2510                   translateLabel: true
  2511                 )
  2512                (MenuItem
  2513                   label: '-'
  2514                 )
  2515                (MenuItem
  2516                   activeHelpKey: fileShowWindowSpec
  2517                   label: 'Show Window Spec'
  2518                   itemValue: doWindowSpec
  2519                   translateLabel: true
  2520                   isVisible: isStandAlone
  2521                 )
  2522                (MenuItem
  2523                   activeHelpKey: fileBrowseClass
  2524                   enabled: hasSpecClass
  2525                   label: 'Browse Applications Class'
  2526                   itemValue: doBrowseClass
  2527                   translateLabel: true
  2528                   isVisible: isStandAlone
  2529                 )
  2530                (MenuItem
  2531                   activeHelpKey: fileBrowseAspectMethods
  2532                   enabled: hasSpecClass
  2533                   label: 'Browse Applications Aspect Methods'
  2534                   itemValue: doBrowseAspectMethods
  2535                   translateLabel: true
  2536                 )
  2537                (MenuItem
  2538                   label: '-'
  2539                   isVisible: isStandAlone
  2540                 )
  2541                (MenuItem
  2542                   activeHelpKey: fileExit
  2543                   label: 'Exit'
  2544                   itemValue: closeRequest
  2545                   translateLabel: true
  2546                   isVisible: isStandAlone
  2547                 )
  2548                )
  2549               nil
  2550               nil
  2551             )
  2552 !
  2553 
  2554 menuMove
  2555     "This resource specification was automatically generated
  2556      by the MenuEditor of ST/X."
  2557 
  2558     "Do not manually edit this!! If it is corrupted,
  2559      the MenuEditor may not be able to read the specification."
  2560 
  2561     "
  2562      MenuEditor new openOnClass:UIPainter andSelector:#menuMove
  2563      (Menu new fromLiteralArrayEncoding:(UIPainter menuMove)) startUp
  2564     "
  2565 
  2566     <resource: #menu>
  2567 
  2568     ^
  2569      
  2570        #(#Menu
  2571           
  2572            #(
  2573              #(#MenuItem
  2574                 #label: 'Up'
  2575                 #translateLabel: true
  2576                 #value: #doStepUp
  2577                 #activeHelpKey: #moveWidgetUp
  2578                 #enabled: #canChangeOrderInContainer
  2579                 #labelImage: #(#ResourceRetriever #Icon #upIcon 'Up')
  2580             )
  2581              #(#MenuItem
  2582                 #label: 'Down'
  2583                 #translateLabel: true
  2584                 #value: #doStepDown
  2585                 #activeHelpKey: #moveWidgetDown
  2586                 #enabled: #canChangeOrderInContainer
  2587                 #labelImage: #(#ResourceRetriever #Icon #downIcon 'Down')
  2588             )
  2589              #(#MenuItem
  2590                 #label: 'Into'
  2591                 #translateLabel: true
  2592                 #value: #doStepIn
  2593                 #activeHelpKey: #moveWidgetInto
  2594                 #enabled: #canMoveSelectionIntoContainer
  2595                 #labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Into')
  2596             )
  2597              #(#MenuItem
  2598                 #label: 'Out'
  2599                 #translateLabel: true
  2600                 #value: #doStepOut
  2601                 #activeHelpKey: #moveWidgetOut
  2602                 #enabled: #canMoveSelectionOutOfContainer
  2603                 #labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Out')
  2604             )
  2605           ) nil
  2606           nil
  2607       )
  2608 !
  2609 
  2610 menuReplaceWidget
  2611     "This resource specification was automatically generated
  2612      by the MenuEditor of ST/X."
  2613 
  2614     "Do not manually edit this!! If it is corrupted,
  2615      the MenuEditor may not be able to read the specification."
  2616 
  2617     "
  2618      MenuEditor new openOnClass:UIPainter andSelector:#menuReplaceWidget
  2619      (Menu new fromLiteralArrayEncoding:(UIPainter menuReplaceWidget)) startUp
  2620     "
  2621 
  2622     <resource: #menu>
  2623 
  2624     ^ 
  2625      #(Menu
  2626         (
  2627          (MenuItem
  2628             activeHelpKey: replaceBy
  2629             enabled: canChangeOrderInContainer
  2630             label: 'Replace By...'
  2631             itemValue: doAskAndReplaceWidgetBy
  2632             translateLabel: true
  2633           )
  2634          )
  2635         nil
  2636         nil
  2637       )
  2638 !
  2639 
  2640 menuToolbar
  2641     "This resource specification was automatically generated
  2642      by the MenuEditor of ST/X."
  2643 
  2644     "Do not manually edit this!! If it is corrupted,
  2645      the MenuEditor may not be able to read the specification."
  2646 
  2647     "
  2648      MenuEditor new openOnClass:UIPainter andSelector:#menuToolbar
  2649      (Menu new fromLiteralArrayEncoding:(UIPainter menuToolbar)) startUp
  2650     "
  2651 
  2652     <resource: #menu>
  2653 
  2654     ^ 
  2655      #(Menu
  2656         (
  2657          (MenuItem
  2658             activeHelpKey: testStartApplication
  2659             label: 'Start'
  2660             itemValue: doStartApplication
  2661             translateLabel: true
  2662             isButton: true
  2663             labelImage: (ResourceRetriever ToolbarIconLibrary start22x22Icon)
  2664           )
  2665          (MenuItem
  2666             enabled: canInstallAsWebPageHolder
  2667             label: 'Install as WebPage'
  2668             itemValue: doInstallAsWebPage
  2669             translateLabel: true
  2670             isButton: true
  2671             isVisible: installAsWebPageVisible
  2672             labelImage: (ResourceRetriever XPToolbarIconLibrary installAsWebPage24x24Icon)
  2673           )
  2674          (MenuItem
  2675             label: '-'
  2676           )
  2677          (MenuItem
  2678             activeHelpKey: fileNew
  2679             label: 'New'
  2680             itemValue: doNew
  2681             translateLabel: true
  2682             isButton: true
  2683             isVisible: isStandAlone
  2684             labelImage: (ResourceRetriever ToolbarIconLibrary newWindowSpecIcon)
  2685           )
  2686          (MenuItem
  2687             label: '-'
  2688             isVisible: isStandAlone
  2689           )
  2690          (MenuItem
  2691             activeHelpKey: fileLoad
  2692             label: 'Load'
  2693             itemValue: doLoad
  2694             translateLabel: true
  2695             isButton: true
  2696             isVisible: isStandAlone
  2697             labelImage: (ResourceRetriever ToolbarIconLibrary loadFromMethodIcon)
  2698           )
  2699          (MenuItem
  2700             activeHelpKey: fileSave
  2701             label: 'Save'
  2702             itemValue: doSave
  2703             translateLabel: true
  2704             isButton: true
  2705             labelImage: (ResourceRetriever ToolbarIconLibrary saveAsMethodIcon)
  2706           )
  2707          (MenuItem
  2708             label: '-'
  2709           )
  2710          (MenuItem
  2711             label: 'CutCopyPaste'
  2712             translateLabel: true
  2713             submenuChannel: cutCopyPasteMenuSlice
  2714             isMenuSlice: true
  2715           )
  2716          (MenuItem
  2717             label: '-'
  2718             startGroup: right
  2719           )
  2720          (MenuItem
  2721             activeHelpKey: settingsCanvas
  2722             label: 'Canvas'
  2723             translateLabel: true
  2724             indication: painterShown
  2725           )
  2726          (MenuItem
  2727             activeHelpKey: settingsGallery
  2728             label: 'Gallery'
  2729             translateLabel: true
  2730             indication: galleryShown
  2731           )
  2732          )
  2733         nil
  2734         nil
  2735       )
  2736 !
  2737 
  2738 menuToolbar2
  2739     "This resource specification was automatically generated
  2740      by the MenuEditor of ST/X."
  2741 
  2742     "Do not manually edit this!! If it is corrupted,
  2743      the MenuEditor may not be able to read the specification."
  2744 
  2745     "
  2746      MenuEditor new openOnClass:UIPainter andSelector:#menuToolbar2
  2747      (Menu new fromLiteralArrayEncoding:(UIPainter menuToolbar2)) startUp
  2748     "
  2749 
  2750     <resource: #menu>
  2751 
  2752     ^ 
  2753      #(Menu
  2754         (
  2755          (MenuItem
  2756             activeHelpKey: alignSelectionLeft
  2757             enabled: canMoveOrAlignSelection
  2758             label: 'Align Left'
  2759             itemValue: alignSelectionLeft
  2760             translateLabel: true
  2761             isButton: true
  2762             labelImage: (ResourceRetriever nil iconAlignL)
  2763           )
  2764          (MenuItem
  2765             activeHelpKey: alignSelectionRight
  2766             enabled: canMoveOrAlignSelection
  2767             label: 'Align Right'
  2768             itemValue: alignSelectionRight
  2769             translateLabel: true
  2770             isButton: true
  2771             labelImage: (ResourceRetriever nil iconAlignR)
  2772           )
  2773          (MenuItem
  2774             activeHelpKey: alignSelectionTop
  2775             enabled: canMoveOrAlignSelection
  2776             label: 'Align Top'
  2777             itemValue: alignSelectionTop
  2778             translateLabel: true
  2779             isButton: true
  2780             labelImage: (ResourceRetriever nil iconAlignT)
  2781           )
  2782          (MenuItem
  2783             activeHelpKey: alignSelectionBottom
  2784             enabled: canMoveOrAlignSelection
  2785             label: 'Align Bottom'
  2786             itemValue: alignSelectionBottom
  2787             translateLabel: true
  2788             isButton: true
  2789             labelImage: (ResourceRetriever nil iconAlignB)
  2790           )
  2791          (MenuItem
  2792             activeHelpKey: alignSelectionLeftAndRight
  2793             enabled: canResizeSelection
  2794             label: 'Align Left & Right'
  2795             itemValue: alignSelectionLeftAndRight
  2796             translateLabel: true
  2797             isButton: true
  2798             labelImage: (ResourceRetriever nil iconResizeLR)
  2799           )
  2800          (MenuItem
  2801             activeHelpKey: alignSelectionTopAndBottom
  2802             enabled: canResizeSelection
  2803             label: 'Align Top & Bottom'
  2804             itemValue: alignSelectionTopAndBottom
  2805             translateLabel: true
  2806             isButton: true
  2807             labelImage: (ResourceRetriever nil iconResizeTB)
  2808           )
  2809          (MenuItem
  2810             label: ''
  2811           )
  2812          (MenuItem
  2813             activeHelpKey: changePositionLeft
  2814             enabled: canMoveOrAlignSelection
  2815             label: 'Move Left'
  2816             itemValue: moveSelectionLeft
  2817             translateLabel: true
  2818             isButton: true
  2819             hideMenuOnActivated: false
  2820             triggerOnDown: true
  2821             labelImage: (ResourceRetriever nil arrowLeft)
  2822           )
  2823          (MenuItem
  2824             activeHelpKey: changePositionRight
  2825             enabled: canMoveOrAlignSelection
  2826             label: 'Move Right'
  2827             itemValue: moveSelectionRight
  2828             translateLabel: true
  2829             isButton: true
  2830             hideMenuOnActivated: false
  2831             triggerOnDown: true
  2832             labelImage: (ResourceRetriever nil arrowRight)
  2833           )
  2834          (MenuItem
  2835             activeHelpKey: changePositionUp
  2836             enabled: canMoveOrAlignSelection
  2837             label: 'Move Up'
  2838             itemValue: moveSelectionUp
  2839             translateLabel: true
  2840             isButton: true
  2841             hideMenuOnActivated: false
  2842             triggerOnDown: true
  2843             labelImage: (ResourceRetriever nil arrowUp)
  2844           )
  2845          (MenuItem
  2846             activeHelpKey: changePositionDown
  2847             enabled: canMoveOrAlignSelection
  2848             label: 'Move Down'
  2849             itemValue: moveSelectionDown
  2850             translateLabel: true
  2851             isButton: true
  2852             hideMenuOnActivated: false
  2853             triggerOnDown: true
  2854             labelImage: (ResourceRetriever nil arrowDown)
  2855           )
  2856          (MenuItem
  2857             activeHelpKey: editOpenSpecDocumentation
  2858             label: 'Widget Documentation'
  2859             itemValue: doOpenWidgetDocumentation
  2860             translateLabel: true
  2861             isButton: true
  2862             startGroup: right
  2863             labelImage: (ResourceRetriever Icon helpIcon)
  2864           )
  2865          )
  2866         nil
  2867         nil
  2868       )
  2869 
  2870     "Modified: / 18-07-2011 / 17:25:31 / cg"
  2871 !
  2872 
  2873 moveInListMenuSlice
  2874     "This resource specification was automatically generated
  2875      by the MenuEditor of ST/X."
  2876 
  2877     "Do not manually edit this!! If it is corrupted,
  2878      the MenuEditor may not be able to read the specification."
  2879 
  2880     "
  2881      MenuEditor new openOnClass:UIPainter andSelector:#editToolbar
  2882      (Menu new fromLiteralArrayEncoding:(UIPainter editToolbar)) startUp
  2883     "
  2884 
  2885     <resource: #menu>
  2886 
  2887     ^ 
  2888      #(Menu
  2889         (
  2890          (MenuItem
  2891             activeHelpKey: moveWidgetUp
  2892             enabled: canChangeOrderInContainer
  2893             label: 'Move Up'
  2894             itemValue: doStepUp
  2895             translateLabel: true
  2896             isButton: true
  2897             labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetUpIcon)
  2898           )
  2899          (MenuItem
  2900             activeHelpKey: moveWidgetDown
  2901             enabled: canChangeOrderInContainer
  2902             label: 'Move Down'
  2903             itemValue: doStepDown
  2904             translateLabel: true
  2905             isButton: true
  2906             labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownIcon)
  2907           )
  2908          (MenuItem
  2909             activeHelpKey: moveWidgetInto
  2910             enabled: canMoveSelectionIntoContainer
  2911             label: 'Move Into'
  2912             itemValue: doStepIn
  2913             translateLabel: true
  2914             isButton: true
  2915             labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetDownRightIcon)
  2916           )
  2917          (MenuItem
  2918             activeHelpKey: moveWidgetOut
  2919             enabled: canMoveSelectionOutOfContainer
  2920             label: 'Move Out'
  2921             itemValue: doStepOut
  2922             translateLabel: true
  2923             isButton: true
  2924             labelImage: (ResourceRetriever ToolbarIconLibrary moveWidgetLeftDownIcon)
  2925           )
  2926          )
  2927         nil
  2928         nil
  2929       )
  2930 ! !
  2931 
  2932 !UIPainter methodsFor:'aspects'!
  2933 
  2934 alignToGridHolder
  2935     |holder|
  2936 
  2937     (holder := builder bindingAt:#alignToGridHolder) isNil ifTrue:[
  2938         holder := (self class settings at: #GridAlign ifAbsent: [painter gridAlign]) asValue.
  2939         builder aspectAt:#alignToGridHolder put: holder.
  2940         holder addDependent:self.
  2941     ].
  2942     ^ holder
  2943 !
  2944 
  2945 aspectFor:aKey
  2946     "returns the aspect for aKey or nil"
  2947 
  2948     ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
  2949 !
  2950 
  2951 canChangeOrderInContainer
  2952     "returns a boolean value holder which is true if the widget order can be changed 
  2953      within their container"
  2954 
  2955     ^ builder booleanValueAspectFor:#canChangeOrderInContainer
  2956 !
  2957 
  2958 canExchangeSelectionLayouts
  2959     "returns a boolean value holder which is true in case that the selection 
  2960      consists of exactly 2 components
  2961      and all widgets in the selection can change its layout through to a move or
  2962      align operation"
  2963 
  2964     ^ builder booleanValueAspectFor:#canExchangeSelectionLayouts
  2965 !
  2966 
  2967 canInstallAsWebPage
  2968     ^ self specClass notNil
  2969        and:[ self specClass isSubclassOf:WebApplicationModel ]
  2970 
  2971     "Created: / 14-01-2008 / 17:34:56 / cg"
  2972 !
  2973 
  2974 canInstallAsWebPageHolder
  2975     |a|
  2976 
  2977     a := builder booleanValueAspectFor:#canInstallAsWebPageHolder.
  2978     a value:self canInstallAsWebPage.
  2979     ^ a
  2980 
  2981     "Created: / 14-01-2008 / 17:36:04 / cg"
  2982 !
  2983 
  2984 canMoveOrAlignSelection
  2985     "returns a boolean value holder which is true in case that any selection exists
  2986      and all widgets in the selection can change their layout through to a move or
  2987      align operation"
  2988 
  2989     ^ builder booleanValueAspectFor:#canMoveOrAlignSelection
  2990 !
  2991 
  2992 canMoveSelection
  2993     "true if move-in/move-out/move-up and down are enabled"
  2994 
  2995     ^ self canChangeOrderInContainer value 
  2996      or: [ self canMoveSelectionOutOfContainer value 
  2997      or: [ self canMoveSelectionIntoContainer value ]]
  2998 !
  2999 
  3000 canMoveSelectionIntoContainer
  3001     "returns true in case that at least one widget is selected and can change its container
  3002      widget to an element below"
  3003 
  3004     ^ builder booleanValueAspectFor:#canMoveSelectionIntoContainer
  3005 !
  3006 
  3007 canMoveSelectionOutOfContainer
  3008     "returns a boolean value holder which is true in case that at least one widget is selected
  3009      which is contained within another component"
  3010 
  3011     ^ builder booleanValueAspectFor:#canMoveSelectionOutOfContainer
  3012 !
  3013 
  3014 canPasteHolder
  3015 
  3016     |holder|
  3017     (holder := builder bindingAt:#canPasteHolder) isNil ifTrue:[
  3018         holder := [ self canPaste ].
  3019     ].
  3020     ^ holder
  3021 !
  3022 
  3023 canPasteKeepingLayoutHolder
  3024     ^ self canPasteHolder
  3025 !
  3026 
  3027 canReplaceSelection
  3028     treeView isCanvasSelected ifTrue:[^ false].
  3029     ^ true
  3030 !
  3031 
  3032 canResizeSelection
  3033     "returns a boolean value holder which is true in case that any selection exists
  3034      and all widgets in the selection can be resized"
  3035 
  3036     ^ builder booleanValueAspectFor:#canResizeSelection
  3037 !
  3038 
  3039 editToolBarVisibleHolder
  3040     |holder|
  3041 
  3042     (holder := builder bindingAt:#editToolBarVisibleHolder) isNil ifTrue:[
  3043         holder := self class defaultEditToolbarVisible asValue.
  3044         builder aspectAt:#editToolBarVisibleHolder put: holder.
  3045         holder addDependent:self.
  3046     ].
  3047     ^ holder
  3048 !
  3049 
  3050 enableChannel
  3051     "true if modifications are allowed otherwise in test mode"
  3052 
  3053     ^ builder valueAspectFor:#enableChannel initialValue:true
  3054 !
  3055 
  3056 enableChannel2
  3057     "true if modifications are allowed otherwise running test"
  3058 
  3059     ^ self painter enableChannel
  3060 !
  3061 
  3062 galleryShown
  3063     "returns a boolean value holder which is set to true if the gallery is shown"
  3064 
  3065     |holder|
  3066 
  3067     (holder := builder bindingAt:#galleryShown) isNil ifTrue:[
  3068         builder aspectAt:#galleryShown put:(holder :=  true asValue).
  3069         holder addDependent:self
  3070     ].
  3071     ^ holder
  3072 
  3073 !
  3074 
  3075 gridShownHolder
  3076     |holder|
  3077 
  3078     (holder := builder bindingAt:#gridShownHolder) isNil ifTrue:[
  3079         holder := (self class settings at: #GridShown ifAbsent: [painter gridShown]) asValue.
  3080         builder aspectAt:#gridShownHolder put: holder.
  3081         holder addDependent:self.
  3082     ].
  3083     ^ holder
  3084 !
  3085 
  3086 hasOneSelectionOtherThanCanvas
  3087     "returns a value holder which is true in case that one widget is selected
  3088      other than the root"
  3089 
  3090     ^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas
  3091 !
  3092 
  3093 hasUndoHistory
  3094     ^ self painter hasUndoHistory
  3095 !
  3096 
  3097 hasUndoHistoryHolder
  3098     ^ self painter hasUndoHistoryHolder
  3099 !
  3100 
  3101 installAsWebPageVisible
  3102     ^ true
  3103 
  3104     "Created: / 14-01-2008 / 17:46:05 / cg"
  3105 !
  3106 
  3107 noteBookView
  3108     "returns the notebook view; initialize the tools embedded in the notebook"
  3109 
  3110     |noteBook|
  3111 
  3112     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
  3113         noteBook := View new.
  3114         builder aspectAt:#noteBookView put:noteBook.
  3115 
  3116         layoutTool := self createToolApplication:UILayoutTool        spec:#windowSpec in:noteBook.
  3117         helpTool   := self createToolApplication:UIHelpTool          spec:#innerSpec  in:noteBook.
  3118         specTool   := self createToolApplication:UISpecificationTool spec:#windowSpec in:noteBook.
  3119 
  3120         helpTool loadFromClass:specClass.
  3121     ].
  3122     ^ noteBook
  3123 
  3124     "Modified: / 31-08-2006 / 10:11:15 / cg"
  3125 !
  3126 
  3127 painterShown
  3128     "returns a boolean value holder which is set to true if the painter is shown"
  3129 
  3130     |holder|
  3131 
  3132     (holder := builder bindingAt:#painterShown) isNil ifTrue:[
  3133         builder aspectAt:#painterShown put:(holder :=  true asValue).
  3134         holder addDependent:self
  3135     ].
  3136     ^ holder
  3137 
  3138 !
  3139 
  3140 tabList
  3141     "returns a value holder which keeps a list of the section labels in the notebook"
  3142 
  3143     |tabs holder|
  3144 
  3145     (holder := builder bindingAt:#tabList) isNil ifTrue:[
  3146         tabs := #(Basics Details Layout).
  3147         builder aspectAt:#tabList put:(holder :=  (resources array:tabs) asValue).
  3148     ].
  3149     ^ holder
  3150 !
  3151 
  3152 tabModel
  3153     "returns a value holder which keeps the label of the current section in the notebook"
  3154 
  3155     |holder|
  3156 
  3157     (holder := builder bindingAt:#tabModel) isNil ifTrue:[
  3158         holder := AspectAdaptor new subject:self; forAspect:#tabSelection.
  3159         builder aspectAt:#tabModel put:holder.
  3160     ].
  3161     ^ holder
  3162 !
  3163 
  3164 toolBarVisibleHolder
  3165     |holder|
  3166 
  3167     (holder := builder bindingAt:#toolBarVisibleHolder) isNil ifTrue:[
  3168         holder := self class defaultToolbarVisible asValue.
  3169         builder aspectAt:#toolBarVisibleHolder put: holder.
  3170         holder addDependent:self.
  3171     ].
  3172     ^ holder
  3173 !
  3174 
  3175 treeView
  3176     "returns the tree view which holds all widget"
  3177 
  3178     ^ treeView
  3179 !
  3180 
  3181 valueOfCanPasteWithKeepingLayout
  3182     <resource: #obsolete>
  3183     self obsoleteMethodWarning:'stupid name - use #canPasteKeepingLayoutHolder'.
  3184     ^ self canPasteKeepingLayoutHolder
  3185 ! !
  3186 
  3187 !UIPainter methodsFor:'building editors'!
  3188 
  3189 XXopenDataSetColumnEditor
  3190     "opens a Table Column Editor on current widget"
  3191 
  3192     |cls editor specTool columnHolder tableSelector columns isEditingSpecOnly|
  3193 
  3194     isEditingSpecOnly := self isEditingSpecOnly.
  3195 
  3196     isEditingSpecOnly ifFalse:[
  3197         (cls := self resolveName:specClassName) isNil ifTrue:[
  3198             self askForSaving ifTrue:[cls := self resolveName:specClassName].
  3199         ].
  3200         cls isNil ifTrue:[^ self].
  3201     ].
  3202 
  3203     self acceptOrIgnoreSectionModification.
  3204 
  3205     editor   := DataSetBuilder new.
  3206     editor masterApplication:self.
  3207     specTool := self specTool.
  3208 
  3209     isEditingSpecOnly ifFalse:[
  3210         editor specClass: cls.
  3211         editor rowClassName:(specTool specification rowClassName).
  3212     ].
  3213     columnHolder  := specTool aspectFor:#columnHolder.
  3214     tableSelector := columnHolder value.
  3215 
  3216     tableSelector := tableSelector notEmptyOrNil 
  3217                         ifTrue:[tableSelector asSymbol]
  3218                         ifFalse:[nil].
  3219 
  3220     (isEditingSpecOnly not
  3221     and:[tableSelector notNil 
  3222     and:[cls class includesSelector:tableSelector]]) ifTrue:[
  3223         editor openModalOnClass:cls andSelector:tableSelector
  3224     ] ifFalse:[
  3225         editor editingSpecOnly:true.
  3226 
  3227         columns := specTool specification columns.
  3228         columns size ~~ 0 ifTrue:[
  3229             editor openModalOnResourceSpec:columns
  3230         ] ifFalse:[
  3231             editor openModal
  3232         ].
  3233     ].
  3234 
  3235     isEditingSpecOnly ifFalse:[
  3236         editor hasSaved ifTrue:[
  3237             specTool specification 
  3238                 columns:nil;
  3239                 rowClassName:(editor rowClassName).
  3240 
  3241             tableSelector = editor specSelector ifFalse:[
  3242                 columnHolder value:(editor specSelector).
  3243                 self accept.
  3244             ].
  3245             ^ self
  3246         ].
  3247     ].
  3248 
  3249     tableSelector isNil ifTrue:[
  3250         editor hasSaved ifTrue:[
  3251             editor modified ifFalse:[
  3252                 specTool specification 
  3253                     columns:(editor acceptedColumns);
  3254                     rowClassName:(editor rowClassName).
  3255                 self modifiedChannel value:true.
  3256             ].
  3257         ].
  3258     ].
  3259 
  3260     "Modified: / 12-01-2008 / 10:31:47 / cg"
  3261 !
  3262 
  3263 openDataSetColumnEditor
  3264     "opens a Table Column Editor on current widget"
  3265 
  3266     |cls editor specTool columnHolder tableSelector columns isEditingSpecOnly|
  3267 
  3268     self isModified ifTrue:[
  3269         "/ force editFields to accept
  3270         self acceptChannel value:true; value:false.
  3271     ].
  3272 
  3273     specTool := self specTool.
  3274     columnHolder := specTool aspectFor:#columnHolder.
  3275     tableSelector := columnHolder value.
  3276 
  3277     tableSelector notEmptyOrNil ifTrue:[
  3278         tableSelector := tableSelector asSymbol.
  3279     ] ifFalse:[
  3280         tableSelector := nil.
  3281     ].
  3282 
  3283     isEditingSpecOnly := true.
  3284 
  3285     (tableSelector notNil and:[self isEditingSpecOnly not]) ifTrue:[
  3286         (cls := self resolveName:specClassName) notNil ifTrue:[
  3287             isEditingSpecOnly := false.
  3288         ].
  3289     ].
  3290     editor := DataSetBuilder new.
  3291     editor masterApplication:self.
  3292 
  3293     isEditingSpecOnly ifFalse:[
  3294         editor specClass:cls.
  3295         editor rowClassName:(specTool specification rowClassName).
  3296     ].
  3297 
  3298     isEditingSpecOnly ifFalse:[
  3299         editor openModalOnClass:cls andSelector:tableSelector.
  3300 
  3301         editor hasSaved ifTrue:[
  3302             specTool specification 
  3303                 columns:nil;
  3304                 rowClassName:(editor rowClassName).
  3305 
  3306             tableSelector = editor specSelector ifFalse:[
  3307                 columnHolder value:(editor specSelector).
  3308                 self accept.
  3309             ].
  3310         ].
  3311         ^ self
  3312     ].
  3313 
  3314     editor editingSpecOnly:true.
  3315 
  3316     columns := specTool specification columns.
  3317 
  3318     columns size ~~ 0 ifTrue:[
  3319         editor openModalOnResourceSpec:columns
  3320     ] ifFalse:[
  3321         editor openModal
  3322     ].
  3323 
  3324     editor hasSaved ifTrue:[
  3325         columnHolder value:nil.
  3326 
  3327         specTool specification 
  3328             columns:(editor acceptedColumns);
  3329             rowClassName:(editor rowClassName).
  3330 
  3331         columnHolder value:nil.
  3332         self modifiedChannel value:true.
  3333     ].
  3334 !
  3335 
  3336 openEditMenu
  3337     "opens a Menu Editor on current widget"
  3338 
  3339     |cls selectorOrMenu editor selectedSpec windowSpec holder|
  3340 
  3341     self isEditingSpecOnly ifFalse:[
  3342         "/ normal mode
  3343         (cls := self resolveName:specClassName) isNil ifTrue:[
  3344             self askForSaving ifTrue:[cls := self resolveName:specClassName].
  3345         ].
  3346         cls isNil ifTrue:[^ self].
  3347     ].
  3348 
  3349     self acceptOrIgnoreSectionModification.
  3350     windowSpec := self specTool specification.
  3351 
  3352     self isEditingSpecOnly ifTrue:[
  3353         selectorOrMenu := windowSpec menu
  3354     ] ifFalse:[
  3355         (selectorOrMenu := windowSpec menuSelector) notNil ifTrue:[
  3356             selectorOrMenu := selectorOrMenu asSymbol
  3357         ] ifFalse:[
  3358             "/ cg: q&d hack ...
  3359             selectorOrMenu := nil.
  3360 
  3361             (selectedSpec := treeView propertySelected) notNil ifTrue:[
  3362                 Error handle:[:ex |
  3363                     selectorOrMenu := nil.
  3364                 ] do:[
  3365                     selectorOrMenu := selectedSpec view asMenu.
  3366                 ]
  3367             ].
  3368         ].
  3369     ].
  3370 
  3371     editor := MenuEditor new.
  3372     editor masterApplication:self.
  3373     self isEditingSpecOnly ifFalse:[
  3374         editor specClass: cls.
  3375         editor useHelpTool:(self helpTool).
  3376     ].
  3377 
  3378     (self isEditingSpecOnly or:[selectorOrMenu class == Menu]) ifTrue: [
  3379         editor openModalOnMenu:(selectorOrMenu).
  3380         editor hasSaved ifTrue:[
  3381             windowSpec menu:(editor savedSpec).
  3382             self accept.
  3383         ].
  3384     ] ifFalse: [
  3385         editor openModalOnClass:cls andSelector:selectorOrMenu.
  3386         editor hasSaved ifTrue:[
  3387             holder := self specTool aspectFor:#menuSelector.
  3388             holder value:(editor specSelector).
  3389             self accept.
  3390         ].
  3391     ].
  3392 
  3393     "Modified: / 12-01-2008 / 10:31:41 / cg"
  3394 !
  3395 
  3396 openHierarchicalListEditor
  3397     "opens a Hierarchical List Editor on current widget"
  3398 
  3399     |selector editor spec|
  3400 
  3401     (self resolveName:specClassName) isNil ifTrue:[
  3402         self askForSaving ifFalse: [^self]
  3403     ].
  3404 
  3405     spec := self specTool specification.
  3406     (selector := spec hierarchicalList) notNil ifTrue:[
  3407         selector := selector asSymbol
  3408     ].
  3409 
  3410     editor := HierarchicalListEditor new.
  3411     editor masterApplication:self.
  3412     editor openModalOnClass:specClassName andSelector:selector.
  3413 
  3414     editor specSelector ~= selector ifTrue:[
  3415         editor hasSaved ifTrue:[
  3416             spec hierarchicalList:editor specSelector.
  3417             self modifiedChannel value:true.
  3418             self accept
  3419         ]
  3420     ]
  3421 
  3422     "Modified: / 16.7.1998 / 18:15:46 / cg"
  3423 !
  3424 
  3425 openSubSpecGUIPainter
  3426     "opens a GUI Painter on the current subspecification"
  3427 
  3428     |spec cls meta sel|
  3429 
  3430     (self resolveName:specClassName) isNil ifTrue:[
  3431         self askForSaving ifFalse: [^self]
  3432     ]. 
  3433 
  3434     spec := self specTool specification.
  3435     cls := spec majorKey.
  3436     cls isNil ifTrue:[
  3437         cls := specClassName.
  3438     ].
  3439     (cls := self resolveName:cls inClass:(Smalltalk at: specClassName asSymbol)) isNil ifTrue:[
  3440         spec majorKey isNil ifTrue:[
  3441             ^ self warn:'Cannot find class (no majorKey specified).'.
  3442         ].
  3443         ^ self warn:('Cannot find class ', spec majorKey asBoldText, '.').
  3444     ].
  3445     sel := spec minorKey.
  3446     meta := cls class whichClassIncludesSelector:sel.
  3447     meta isNil ifTrue:[
  3448         ^ self warn:'Cannot find selector #', (sel ? '') asBoldText, ' in class ', cls name asBoldText, '!!'
  3449     ].
  3450 
  3451     self class 
  3452         openOnClass:meta soleInstance 
  3453         andSelector:spec minorKey.
  3454 
  3455     "Modified: / 5.11.2001 / 16:51:46 / cg"
  3456 !
  3457 
  3458 openTabListEditor
  3459     "opens a Tab List Editor on current widget"
  3460 
  3461     |selector editor spec cls holder|
  3462 
  3463     (cls := self resolveName:specClassName) isNil ifTrue:[
  3464         self askForSaving ifTrue:[cls := self resolveName:specClassName].
  3465     ].
  3466     cls isNil ifTrue:[^ self].
  3467 
  3468     self acceptOrIgnoreSectionModification.
  3469     spec := self specTool specification.
  3470 
  3471     (selector := spec listSelector) isArray 
  3472         ifTrue: [^self warn: 'Cannot open the Tab List Editor on an array!!'].
  3473 
  3474     editor := TabListEditor new.
  3475     editor masterApplication:self.
  3476     editor openModalOnClass:cls andSelector:selector.
  3477 
  3478     editor hasSaved ifTrue:[
  3479         holder := self specTool aspectFor:#listSelector.
  3480 
  3481         holder value ~= editor specSelector ifTrue:[
  3482             holder value:editor specSelector.
  3483             self accept.
  3484         ]
  3485     ].
  3486 
  3487     "Modified: / 12-01-2008 / 10:31:34 / cg"
  3488 ! !
  3489 
  3490 !UIPainter methodsFor:'change & update'!
  3491 
  3492 layoutChanged
  3493     "called by the painter/canvas whenever the layout of the current selected
  3494      widget has changed"
  3495 
  3496     self isModified ifFalse:[
  3497         self layoutTool update.
  3498         self clearModifiedFlag
  3499     ]
  3500 !
  3501 
  3502 propertyChanged
  3503     "called by the painter/canvas whenever the property of the current selected
  3504      widget has changed"
  3505 
  3506     |property spec|
  3507 
  3508     (property := treeView propertySelected) notNil ifTrue:[
  3509         spec := property spec copy.
  3510         self specTool specification:spec.
  3511         self setViewInLayoutTool:(property view) spec:spec.
  3512         self clearModifiedFlag
  3513     ] ifFalse:[
  3514         self layoutTool layoutView notNil ifTrue:[
  3515             self clearModifiedFlag.
  3516             self treeSelectionChanged
  3517         ]
  3518     ]
  3519 !
  3520 
  3521 toolBarVisibilityChanged
  3522     |toolBarVisible editToolBarVisible toolBar editToolBar noteBook topOffset|
  3523 
  3524     topOffset := 0.
  3525 
  3526     toolBar := self componentAt:#ToolBar.
  3527     toolBar notNil ifTrue:[
  3528         toolBarVisible := self toolBarVisibleHolder value.
  3529         DefaultToolBarVisible := toolBarVisible.
  3530         toolBarVisible ifTrue:[
  3531             topOffset := topOffset + toolBar height.
  3532         ]
  3533     ].
  3534 
  3535     editToolBar := self componentAt:#EditToolBar.
  3536     editToolBar notNil ifTrue:[
  3537         editToolBar layout 
  3538             topOffset:topOffset bottomOffset:(topOffset + editToolBar height).
  3539         "/ force it to recompute its dimension
  3540         editToolBar container notNil ifTrue:[
  3541             editToolBar containerChangedSize.
  3542         ].
  3543         editToolBarVisible := self editToolBarVisibleHolder value.
  3544         DefaultEditToolBarVisible := editToolBarVisible.
  3545         editToolBarVisible ifTrue:[
  3546             topOffset := topOffset + editToolBar height.
  3547         ]
  3548     ].
  3549 
  3550     noteBook := self componentAt:#Painter.
  3551     noteBook notNil ifTrue:[
  3552         noteBook layout topOffset:topOffset.
  3553         "/ force it to recompute its dimension
  3554         noteBook container notNil ifTrue:[
  3555             noteBook containerChangedSize.
  3556         ].
  3557     ].
  3558 
  3559     "Created: / 18-02-2007 / 14:46:22 / cg"
  3560 !
  3561 
  3562 update:something with:aParameter from:changedObject
  3563     "catches change notifications"
  3564 
  3565     |window lbl|
  3566 
  3567     ((changedObject == self toolBarVisibleHolder)
  3568     or:[ changedObject == self editToolBarVisibleHolder ]) ifTrue:[
  3569         self toolBarVisibilityChanged.
  3570         ^ self
  3571     ].
  3572     changedObject == self gridShownHolder ifTrue:[
  3573         self class settings at: #GridShown  put: changedObject value.
  3574         painter gridShown:changedObject value.
  3575         ^ self
  3576     ].
  3577     changedObject == self alignToGridHolder ifTrue:[
  3578         self class settings at: #GridAlign  put: changedObject value.
  3579         painter gridAlign:changedObject value.
  3580         ^ self
  3581     ].
  3582 
  3583     changedObject == treeView model ifTrue:[
  3584         (something == #selection
  3585         or:[something == #selectionIndex]) ifTrue:[self treeSelectionChanged].
  3586         ^ self
  3587     ].
  3588 
  3589     changedObject == self galleryShown ifTrue:[
  3590         "/ galleryShown toggle changed
  3591         window := selectionPanel window.
  3592         (changedObject value) ifTrue:[
  3593             self raiseUIView:window
  3594         ] ifFalse:[
  3595             self hideUIView:window
  3596         ].
  3597         ^ self
  3598     ].
  3599 
  3600     changedObject == self painterShown ifTrue:[
  3601         "/ canvasShown toggle changed
  3602         window := self painter topView.
  3603         (changedObject value) ifTrue:[
  3604             self raiseUIView:window
  3605         ] ifFalse:[
  3606             self hideUIView:window
  3607         ].
  3608         ^ self
  3609     ].
  3610 
  3611     changedObject == self autoAcceptOnSelectionChange ifTrue:[
  3612         lbl := changedObject value ifTrue:['Apply'] ifFalse:['OK'].
  3613         (builder componentAt:'acceptButton') label:(resources string:lbl).
  3614         ^ self
  3615     ].
  3616 
  3617     "Modified: / 16.7.1998 / 19:09:57 / cg"
  3618 !
  3619 
  3620 updateChannels
  3621     "updates the channels"
  3622 
  3623     |canCutOrCopy|
  3624 
  3625     self canMoveOrAlignSelection        value:(treeView canMoveOrAlignSelection).
  3626     self canResizeSelection             value:(treeView canResizeSelection).
  3627     self canExchangeSelectionLayouts    value:(treeView canExchangeSelectionLayouts).
  3628     self canChangeOrderInContainer      value:(treeView canChangeOrderInContainer).
  3629     self canMoveSelectionIntoContainer  value:(treeView canMoveSelectionIntoContainer).
  3630     self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer).
  3631     self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas).
  3632 
  3633     "/ the top-node cannot be cut, copied or pasted.
  3634     canCutOrCopy := treeView selection notEmptyOrNil and:[treeView selection first ~~ 1].
  3635 
  3636     self canCutHolder value: canCutOrCopy.
  3637     self canCopyHolder value: canCutOrCopy.
  3638 
  3639 "/    self modifiedChannel value: false.
  3640 
  3641     "Modified: / 16.7.1998 / 19:13:30 / cg"
  3642 ! !
  3643 
  3644 !UIPainter methodsFor:'defaults'!
  3645 
  3646 defaultNameOfCanvas
  3647     ^ self class defaultNameOfCanvas
  3648 !
  3649 
  3650 defaultWindowSpecClass
  3651     ^ WindowSpec
  3652 ! !
  3653 
  3654 !UIPainter methodsFor:'event handling'!
  3655 
  3656 doesNotUnderstand:aMessage
  3657     "forward misunderstood messages to the painter"
  3658 
  3659     |painter|
  3660 
  3661     painter := self painter.
  3662 
  3663     (painter respondsTo:(aMessage selector)) ifTrue:[
  3664         ^ aMessage sendTo:painter
  3665     ].
  3666     super doesNotUnderstand:aMessage
  3667 
  3668 !
  3669 
  3670 processEvent:anEvent
  3671     "filter keyboard events.
  3672      Return true, if I have eaten the event"
  3673 
  3674     |key|
  3675 
  3676     anEvent isKeyPressEvent ifTrue:[ 
  3677         anEvent targetView == treeView ifFalse:[^ false].
  3678         treeView hasFocus ifFalse:[^ false].
  3679 
  3680         key := anEvent key.
  3681 
  3682 "/        (anEvent rawKey == #Cmdr) ifTrue:[
  3683 "/            self openNameEditorOnTreeSelection.
  3684 "/            ^ true.
  3685 "/        ].
  3686         (anEvent rawKey == #CtrlCursorUp) ifTrue:[ 
  3687             self doStepUp.
  3688             ^ true.
  3689         ].
  3690         (anEvent rawKey == #CtrlCursorDown) ifTrue:[ 
  3691             self doStepDown.
  3692             ^ true.
  3693         ].
  3694         (anEvent rawKey == #CtrlCursorLeft) ifTrue:[ 
  3695             self doStepOut.
  3696             ^ true.
  3697         ].
  3698         (anEvent rawKey == #CtrlCursorRight) ifTrue:[ 
  3699             self doStepIn.
  3700             ^ true.
  3701         ].
  3702     ].
  3703 
  3704     ^ false.
  3705 ! !
  3706 
  3707 !UIPainter methodsFor:'help'!
  3708 
  3709 defaultInfoLabel
  3710     "returns the default info label"
  3711 
  3712     specClassName isNil ifTrue: [^'No class defined.'].
  3713     specSelector isNil ifTrue: [^'No selector defined.'].
  3714     ^ specClassName printString, ' >> ', specSelector
  3715 
  3716     "Modified: / 31-08-2006 / 10:12:03 / cg"
  3717 ! !
  3718 
  3719 !UIPainter methodsFor:'help specs'!
  3720 
  3721 basicHelpTextFromSpecification:specification forKey:aKey
  3722     "redefinable, to allow for subclasses to overwrite the helpTexts of the ui-spec"
  3723 
  3724     ^ specification helpSpec at:aKey ifAbsent:nil
  3725 !
  3726 
  3727 flyByHelpSpec
  3728     |spec|
  3729 
  3730     spec := self class flyByHelpSpec.
  3731     spec at:#editUndo put:(resources string:'Undo (%1)' 
  3732                         with:(resources string:self painter undoHistory labelOfLastUndo)).
  3733     ^ spec
  3734 !
  3735 
  3736 helpSpec
  3737     |spec|
  3738 
  3739     spec := self class helpSpec.
  3740     spec at:#editUndo put:(resources string:'Undo (%1)' 
  3741                         with:(resources string:self painter undoHistory labelOfLastUndo)).
  3742     ^ spec
  3743 ! !
  3744 
  3745 !UIPainter methodsFor:'initialization'!
  3746 
  3747 hideToolBarButtonCreated:aButton
  3748     aButton passiveLevel:(MenuPanel defaultLevel). 
  3749 "/    aButton passiveLevel:1.
  3750     aButton activeLevel:-1.
  3751     aButton backgroundColor:(MenuPanel defaultBackgroundColor).
  3752 !
  3753 
  3754 initialize
  3755     |name scroller viewScroller|
  3756 
  3757     super initialize.
  3758 
  3759     modified := false.
  3760 
  3761     aspects := IdentityDictionary new.
  3762     aspects at:#classNameChannel put:'NewApplication' asValue.
  3763     aspects at:#superclassNameChannel put:'ApplicationModel' asValue.
  3764     aspects at:#methodNameChannel put:'windowSpec' asValue.
  3765 
  3766     treeView := TreeView new.
  3767     treeView painter:self.
  3768     treeView windowSpecClass:(self defaultWindowSpecClass).
  3769     treeView selectConditionBlock:[:newSelection | self selectionChangeAllowed:newSelection ].
  3770 
  3771     painterView := StandardSystemView new.
  3772     name := name ? self defaultNameOfCanvas.
  3773     painterView beToolWindow.
  3774     painterView name:name.
  3775     painterView label:name.
  3776     painterView extent:(treeView windowSpecClass defaultExtentInUIPainter).
  3777 
  3778     UseViewScroller == true ifTrue:[
  3779         scroller := HVScrollableView for:ViewScroller in:painterView.
  3780         scroller
  3781             horizontalScrollable:true miniScroller:true;
  3782             verticalScrollable:true; verticalMini:true;
  3783             autoHideScrollBars:false;
  3784             layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.
  3785         viewScroller := scroller scrolledView.
  3786         painter := UIPainterView new.
  3787         painter extent:300@300.
  3788         viewScroller scrolledView:painter.
  3789     ] ifFalse:[
  3790         painter := UIPainterView in:painterView.
  3791         painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.
  3792     ].
  3793 
  3794     treeView := treeView canvas:painter specName:name.
  3795     painter treeView:treeView.
  3796     treeView model addDependent:self.
  3797     painter enableChannel:(self enableChannel).
  3798 
  3799     selectionPanel := self selectionPanelClass new.
  3800     selectionPanel allButOpenInterface:#windowSpec.
  3801 ! !
  3802 
  3803 !UIPainter methodsFor:'menus-dynamic'!
  3804 
  3805 menuEdit
  3806     ^ [
  3807         |m i|
  3808 
  3809         m := self class menuEdit.
  3810         m := m decodeAsLiteralArray.
  3811         i := m detectItem:[:item | item nameKey == #undo] ifNone:nil.
  3812         i notNil ifTrue:[
  3813             i label:(resources string:(i label , ' (%1)') 
  3814                         with:(resources string:self painter undoHistory labelOfLastUndo)).
  3815         ].
  3816         "/ m receiver:self.   -- now done in findGuiResources ...
  3817         m findGuiResourcesIn:self.
  3818         m
  3819       ].
  3820 !
  3821 
  3822 menuReplaceWidget
  3823     ^ [
  3824         |m i specAndView spec usefulReplacementSpecClasses|
  3825 
  3826         m := self class menuReplaceWidget.
  3827         m := m decodeAsLiteralArray.
  3828 
  3829         specAndView := self selectedSpecAndView.
  3830         spec := specAndView first.
  3831         spec notNil ifTrue:[
  3832             usefulReplacementSpecClasses := spec usefulReplacementSpecClasses.
  3833             usefulReplacementSpecClasses notEmptyOrNil ifTrue:[
  3834                 m addSeparator.
  3835                 usefulReplacementSpecClasses do:[:eachClass |      
  3836                     |item|
  3837 
  3838                     item := MenuItem new label:(resources string:'Replace by %1' with:eachClass userFriendlyName).
  3839                     item value:#replaceWidgetByClass:.
  3840                     item argument:eachClass.
  3841                     m addItem:item.
  3842                 ].
  3843             ].
  3844         ].
  3845 
  3846         m findGuiResourcesIn:self.
  3847         m
  3848       ].
  3849 ! !
  3850 
  3851 !UIPainter methodsFor:'private'!
  3852 
  3853 acceptOrIgnoreSectionModification
  3854     self isModified ifTrue:[
  3855         (self confirm:'Accept changes made to spec ?') ifTrue:[
  3856             self accept
  3857         ]
  3858     ].
  3859 
  3860     "Created: / 12-01-2008 / 10:31:20 / cg"
  3861 !
  3862 
  3863 askForModification
  3864     "asks for window spec modification"
  3865 
  3866     |painter|
  3867 
  3868     painter := self painter.
  3869 
  3870     self askForSectionModification.    
  3871 
  3872     (modified or: [painter isModified or: [self helpTool modified]])
  3873     ifTrue:[
  3874         ((YesNoBox title:(resources string:'Window spec was modified. Exit anyway?'))        
  3875             noText:(resources string:'Cancel');
  3876             yesText:(resources string:'Discard Changes and Exit');
  3877             showAtPointer;
  3878             accepted) ifFalse: [^false].
  3879         self clearModified.
  3880         painter resetModification
  3881     ].
  3882     ^ true
  3883 
  3884     "Modified: / 20.5.1998 / 02:03:16 / cg"
  3885 !
  3886 
  3887 askForSaving
  3888     "asks for defining an application class"
  3889 
  3890     self askForSectionModification.    
  3891 
  3892     ((YesNoBox title:'No application class defined yet!!')        
  3893         noText:'Cancel';
  3894         yesText:'Define';
  3895         showAtPointer;
  3896         accepted) ifFalse: [^false].
  3897 
  3898     self doSave.
  3899 
  3900     ^true
  3901 !
  3902 
  3903 askForSectionModification
  3904     "asks for section modification in the notebook"
  3905 
  3906     self isModified ifTrue:[
  3907         (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
  3908             self accept
  3909         ] ifFalse: [
  3910             self cancel
  3911         ]
  3912     ]
  3913 !
  3914 
  3915 checkClassAndSelector
  3916     "checks for class & superclass"
  3917 
  3918     |superclass cls|
  3919 
  3920     specClassName isNil ifTrue:[^ false].
  3921 
  3922     cls := self resolveName:specClassName.
  3923 
  3924     cls isNil ifTrue:[
  3925         superclass := self resolveName:specSuperclassName.
  3926 
  3927         superclass isNil ifTrue:[
  3928             self warn:'No class named ' , specSuperclassName , ' exists!!'.
  3929             ^ false.
  3930         ].
  3931 
  3932         (self confirm:'Create class ' , specClassName asBoldText, '?') ifTrue:[
  3933             cls := superclass 
  3934                         subclass:(specClassName asSymbol)
  3935                         instanceVariableNames:''
  3936                         classVariableNames:''
  3937                         poolDictionaries:''
  3938                         category:'Applications'.
  3939 
  3940             cls name ~= specClassName ifTrue:[
  3941                 self information:'Created new class is ' , cls name.
  3942                 specClassName := cls name
  3943             ].
  3944             ^ true.
  3945         ].
  3946         ^ false.
  3947     ].
  3948     cls isBehavior ifFalse:[
  3949         self warn:'A global named ' , specClassName , ' exists, but it is no class.'.
  3950         ^ false.
  3951     ].
  3952 
  3953     specSuperclassName isBehavior ifFalse:[
  3954         specSuperclassName notEmptyOrNil ifTrue:[
  3955             superclass := self resolveName:specSuperclassName
  3956         ] ifFalse:[
  3957             specSuperclassName := nil.
  3958         ]
  3959     ] ifTrue:[
  3960         superclass := specSuperclassName
  3961     ].
  3962 
  3963     specSuperclassName notNil ifTrue:[
  3964         superclass isNil ifTrue:[
  3965             self warn:'No class named ' , specSuperclassName , ' exists!!'.
  3966             ^ false.
  3967         ].
  3968 
  3969         (cls isSubclassOf:superclass) ifFalse:[
  3970             self information:('A global named ' , specClassName , ' exists,\' ,
  3971                               'but is not a subclass of ' , superclass name , '.\\' ,
  3972                               'Check and try again if that is not what you want.') withCRs.
  3973         ]
  3974     ].
  3975 
  3976     superclass isNil ifTrue:[
  3977         cls notNil ifTrue:[
  3978             specSuperclassName := cls superclass name
  3979         ]
  3980     ].
  3981 
  3982     ^ true
  3983 
  3984     "Modified: 12.8.1997 / 23:39:10 / cg"
  3985 !
  3986 
  3987 createToolApplication:anApplicationClass spec:aSpec in:aView
  3988     |appl applBuilder applWindow|
  3989 
  3990     appl := anApplicationClass new.
  3991     appl createBuilder.
  3992     applBuilder := appl builder.
  3993 
  3994     applWindow  := ApplicationSubView origin:0.0@0.0 corner:1.0@1.0 in:aView.
  3995     applWindow level:0.
  3996     applWindow hiddenOnRealize:true.
  3997 
  3998     appl masterApplication:self.
  3999     applBuilder window:applWindow.
  4000     applWindow client:appl spec:aSpec builder:applBuilder.
  4001     appl modifiedHolder:(self modifiedChannel).
  4002     applBuilder window:applWindow.
  4003 
  4004     ^ appl
  4005 !
  4006 
  4007 hideUIView:aView
  4008     "hides the view which is an application or top view"
  4009 
  4010     aView beIndependent.
  4011     aView unmap.
  4012 !
  4013 
  4014 raiseTabView
  4015     |tool|
  4016 
  4017              self isLayoutToolSelected ifTrue:[tool := layoutTool ]
  4018     ifFalse:[self isHelpToolSelected   ifTrue:[tool := helpTool   ]
  4019     ifFalse:[
  4020         tool := specTool.
  4021         tool notNil ifTrue:[ specTool selection:tabSelection ].
  4022     ]].
  4023 
  4024     (Array with:helpTool with:layoutTool with:specTool) do:[:aTool|
  4025         aTool ~~ tool ifTrue:[
  4026             aTool window beInvisible.
  4027         ].
  4028     ].
  4029     tool notNil ifTrue:[
  4030         tool window beVisible.
  4031     ].
  4032 !
  4033 
  4034 raiseUIView:aView
  4035     "raise the view which is an application or top view"
  4036 
  4037     aView remap.
  4038     aView bePartner.
  4039 !
  4040 
  4041 setClass:cls selector:selector
  4042     "sets the specClass and the specSelector under which the window spec should be saved"
  4043 
  4044     |clsName superClassName|
  4045 
  4046     clsName := cls name.
  4047     superClassName := cls superclass name.
  4048 
  4049     (self aspectFor:#classNameChannel) value:clsName.
  4050     (self aspectFor:#methodNameChannel) value:(selector ? '').
  4051     (self aspectFor:#superclassNameChannel) value:superClassName.
  4052 
  4053     self painter 
  4054             className:clsName 
  4055             superclassName:superClassName
  4056             selector:(selector ? '').
  4057 
  4058     self specClass:clsName.
  4059     specSelector := (selector ? '').
  4060     specSuperclassName := superClassName.
  4061 
  4062     (specClassName notNil and:[ selector notNil ]) ifTrue:[
  4063         self addHistoryEntryForClass:specClass selector:specSelector.
  4064         self updateInfoLabel
  4065     ].
  4066 
  4067     "Modified: / 05-02-1998 / 09:44:58 / stefan"
  4068     "Modified: / 31-08-2006 / 10:14:49 / cg"
  4069 !
  4070 
  4071 setViewInLayoutTool:aView spec:aSpec
  4072     "sets view for layout tool"
  4073 
  4074     |type|
  4075 
  4076     self painter topView == aView ifTrue:[
  4077         type := #Extent
  4078     ] ifFalse:[
  4079         self canvas == aView ifTrue:[
  4080             type := #Extent
  4081         ]
  4082     ].
  4083     self layoutTool layoutView:aView type:type spec:aSpec
  4084 !
  4085 
  4086 specClass
  4087     specClass isNil ifTrue:[
  4088         specClassName notNil ifTrue:[
  4089             specClass := Smalltalk classNamed:specClassName.
  4090             self canInstallAsWebPageHolder value:self canInstallAsWebPage.
  4091         ]
  4092     ].
  4093     ^ specClass
  4094 
  4095     "Created: / 31-08-2006 / 10:08:43 / cg"
  4096     "Modified: / 14-01-2008 / 17:39:32 / cg"
  4097 !
  4098 
  4099 specClass:aClassOrClassName
  4100     "sets the specClass and updates the Help Tool"
  4101 
  4102     aClassOrClassName isBehavior 
  4103         ifTrue: [ specClass := aClassOrClassName.
  4104                   specClassName := aClassOrClassName name ]
  4105         ifFalse:[ specClass := Smalltalk classNamed:aClassOrClassName.
  4106                   specClassName := aClassOrClassName ].
  4107 
  4108     self canInstallAsWebPageHolder value:self canInstallAsWebPage.
  4109     self helpTool loadFromClass:specClass.    
  4110     self clearModifiedFlag.
  4111 
  4112     "Modified: / 14-01-2008 / 17:39:08 / cg"
  4113 ! !
  4114 
  4115 !UIPainter methodsFor:'private-tools'!
  4116 
  4117 canvas
  4118     "returns the canvas view"
  4119 
  4120     UseViewScroller == true ifTrue:[
  4121         ^ painter.
  4122     ].
  4123 
  4124     ^ painter topView.
  4125 "/    ^ treeView canvas
  4126 
  4127     "Modified: / 05-09-2006 / 18:36:32 / cg"
  4128 !
  4129 
  4130 helpTool
  4131     "returns the help tool"
  4132 
  4133     helpTool isNil ifTrue:[self noteBookView].
  4134   ^ helpTool
  4135 !
  4136 
  4137 layoutTool
  4138     "returns the layout tool"
  4139 
  4140     layoutTool isNil ifTrue:[self noteBookView].
  4141   ^ layoutTool
  4142 !
  4143 
  4144 painter
  4145     "returns the canvas view"
  4146 
  4147     ^ painter.
  4148 "/    ^ treeView canvas
  4149 
  4150     "Modified: / 05-09-2006 / 18:36:32 / cg"
  4151 !
  4152 
  4153 specTool
  4154     "returns the spec tool"
  4155 
  4156     specTool isNil ifTrue:[self noteBookView].
  4157   ^ specTool
  4158 ! !
  4159 
  4160 !UIPainter methodsFor:'queries'!
  4161 
  4162 canPaste
  4163     |clipboard sel|
  4164 
  4165     clipboard := painterView getClipboardObject.
  4166 
  4167     (clipboard isCollection 
  4168     and:[ clipboard notEmptyOrNil ]) 
  4169             ifTrue:[sel := clipboard first]
  4170             ifFalse:[sel := clipboard].
  4171 
  4172     ^ (sel isKindOf:UISpecification) 
  4173 "/                    and:[treeSelection size  = 1 
  4174 "/                    and:[treeSelection first == 1 
  4175 "/                         or: [self canPasteInto: treeView selectedNode contents view]]]
  4176 !
  4177 
  4178 hasSpecClass
  4179     "answers whether an application class is defined"
  4180 
  4181     ^ (self resolveName:specClassName) notNil
  4182 !
  4183 
  4184 hasSpecClassAndSelector
  4185     "answers whether an application class and a selector under which
  4186      the window spec is stored is defined"
  4187 
  4188     specSelector size > 1 ifTrue:[
  4189         ^ self hasSpecClass
  4190     ].
  4191     ^ false
  4192 !
  4193 
  4194 isEditingSpecOnly
  4195     ^ self isNotEditingSpecOnly not
  4196 !
  4197 
  4198 isHelpToolSelected
  4199     "answers whether the current selected section in the noteBook is the Help Tool"
  4200 
  4201     ^ tabSelection = UIHelpTool label
  4202 !
  4203 
  4204 isLayoutToolSelected
  4205     "answers whether the current selected section in the noteBook is the Layout Tool"
  4206 
  4207     ^ tabSelection = UILayoutTool label
  4208 !
  4209 
  4210 isModified
  4211     "answers whether the current window spec or a layout is modified"
  4212 
  4213     ^ self modifiedChannel value
  4214 !
  4215 
  4216 isNotEditingSpecOnly
  4217     ^ true
  4218 !
  4219 
  4220 isPainterEnabled
  4221     "answers whether I am running in test mode"
  4222 
  4223     ^ self painter enabled
  4224 !
  4225 
  4226 isUIPainter
  4227     ^ true
  4228 !
  4229 
  4230 listOfAspects
  4231     ^ self painter listOfAspects
  4232 
  4233     "Created: / 12-01-2008 / 19:24:51 / cg"
  4234 !
  4235 
  4236 listOfCallbacks
  4237     ^ self painter listOfCallbacks
  4238 
  4239     "Created: / 12-01-2008 / 19:25:09 / cg"
  4240 ! !
  4241 
  4242 !UIPainter methodsFor:'selection'!
  4243 
  4244 askForUnsavedModifications
  4245     |whatToDo|
  4246 
  4247     self isModified ifFalse:[^ true].
  4248 
  4249     whatToDo := DialogBox 
  4250                     confirmWithCancel:'Accept modifications in section ' , tabSelection printString asBoldText, ' ?'
  4251                     labels:#('Cancel' 'Ignore' 'Accept')
  4252                     default:3.
  4253     whatToDo isNil ifTrue:[^ false].
  4254     whatToDo == true ifTrue:[
  4255         self accept
  4256     ] ifFalse:[
  4257         self cancel
  4258     ].
  4259 
  4260     ^ true
  4261 !
  4262 
  4263 copySelection
  4264     self painter copySelection.
  4265     self updateChannels.
  4266 !
  4267 
  4268 selectedSpec
  4269     |specAndView|
  4270 
  4271     specAndView := self selectedSpecAndView.
  4272     ^ specAndView first
  4273 !
  4274 
  4275 selectedSpecAndView
  4276     |spec view property|
  4277 
  4278     treeView isCanvasSelected ifTrue:[
  4279         spec := treeView canvasSpec.
  4280         view := self canvas. "/ self painter topView.
  4281     ] ifFalse:[
  4282         (property := treeView propertySelected) notNil ifTrue:[
  4283             treeView canResizeSelectedWidget ifTrue:[
  4284                 view := property view.
  4285             ].
  4286             spec := property spec copy.
  4287         ]
  4288     ].
  4289     ^ Array with:spec with:view
  4290 !
  4291 
  4292 tabSelection
  4293     "returns the label of the current section in the notebook"
  4294 
  4295     ^ tabSelection
  4296 !
  4297 
  4298 tabSelection:something
  4299     "called whenever the section of the notebook has changed"
  4300 
  4301     (something isNil or:[tabSelection = something]) ifTrue:[
  4302         ^ self
  4303     ].
  4304 
  4305     self isModified ifTrue:[
  4306         self autoAcceptOnSelectionChange value ifTrue:[
  4307             self accept
  4308         ] ifFalse:[
  4309             self askForUnsavedModifications ifFalse:[^ self].
  4310         ].
  4311     ].
  4312     tabSelection := something.
  4313     self raiseTabView.
  4314     self cancel.
  4315 !
  4316 
  4317 treeSelectionChanged
  4318     "called whenever the selection of the treeview has changed"
  4319 
  4320     |specAndView view spec|
  4321 
  4322     self askForUnsavedModifications ifFalse:[^ self].
  4323 "/    self isModified ifTrue:[
  4324 "/        (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
  4325 "/            self accept
  4326 "/        ]
  4327 "/    ].
  4328 
  4329     specAndView := self selectedSpecAndView.
  4330     spec := specAndView first.
  4331     view := specAndView last.
  4332 
  4333     self setViewInLayoutTool:view spec:spec.
  4334     self specTool specification:spec.
  4335 
  4336     self updateSlicesForSpec:spec andView:view.
  4337     self clearModifiedFlag.
  4338     self updateChannels.
  4339 !
  4340 
  4341 updateSlicesForSpec:spec andView:view
  4342     "fetch slices-info from the spec; add help and geometry slices manually"
  4343 
  4344     |slices "size" list tabComponent|
  4345 
  4346     tabComponent := self componentAt:#noteBook.
  4347 
  4348     spec notNil ifTrue:[
  4349         self helpTool helpKey:(spec activeHelpKey).
  4350         slices := spec class slices.
  4351 
  4352         list := slices collect:[:eachSlice | eachSlice first asString].
  4353         self treeView isCanvasSelected ifFalse:[
  4354             list := list copyWith:(UIHelpTool label)
  4355         ].
  4356         view notNil ifTrue:[
  4357             "/ for now, keep it as an empty slice;
  4358             "/ better when toggling as we do not loos the 'geometry' selection.
  4359             "/ slices notebook should remember the last 'explicit' selected tab.
  4360             true "spec hasLayout" ifTrue:[
  4361                 list := list copyWith:UILayoutTool label.
  4362             ]
  4363         ].
  4364 
  4365 "/        size   := slices size.
  4366 "/        view notNil ifTrue:[
  4367 "/            self treeView isCanvasSelected ifFalse:[
  4368 "/                list := Array new:(size + 2).
  4369 "/                list at:(size + 2) put:(UILayoutTool label).
  4370 "/            ] ifTrue:[
  4371 "/                list := Array new:(size + 1).
  4372 "/                list at:(size + 1) put:(UILayoutTool label).
  4373 "/            ].
  4374 "/        ] ifFalse:[
  4375 "/            list := Array new:(size + 1).
  4376 "/        ].
  4377 "/
  4378 "/        1 to:size do:[:i| list at:i put:((slices at:i) first asString)].
  4379 "/        self treeView isCanvasSelected ifFalse: [
  4380 "/            list at:(size + 1) put:(UIHelpTool label)
  4381 "/        ].
  4382 
  4383         self tabList value:list.
  4384         self showHelp:spec class name for:self.
  4385         tabComponent enabled:true.
  4386 
  4387         (tabSelection := tabComponent selection) isNil ifTrue:[
  4388             tabComponent setSelection:(tabSelection := list first)
  4389         ].
  4390         self raiseTabView
  4391     ] ifFalse:[
  4392         self helpTool helpKey:nil.
  4393         tabComponent enabled:false.
  4394         self defaultInfoLabel.
  4395     ].
  4396 ! !
  4397 
  4398 !UIPainter methodsFor:'settings'!
  4399 
  4400 generateAspectsAsInstanceVariables
  4401     "if on, aspects are held as instance variables;
  4402      if off (the default), they are kept in the bindings dictionary."
  4403 
  4404     ^ UIPainterView generateAspectsAsInstanceVariables
  4405 
  4406     "Created: / 29-07-1998 / 11:17:59 / cg"
  4407     "Modified: / 12-01-2008 / 10:37:43 / cg"
  4408 !
  4409 
  4410 generateAspectsAsInstanceVariables:aBoolean
  4411     "if on, aspects are held as instance variables;
  4412      if off (the default), they are kept in the bindings dictionary."
  4413 
  4414     ^ UIPainterView generateAspectsAsInstanceVariables:aBoolean
  4415 
  4416     "Created: / 29.7.1998 / 11:18:20 / cg"
  4417 !
  4418 
  4419 generateCommentedCode
  4420     "comments in generated aspect methods; yes or no."
  4421 
  4422     ^ UIPainterView generateCommentedCode
  4423 
  4424     "Created: / 12-01-2008 / 10:34:14 / cg"
  4425 !
  4426 
  4427 generateCommentedCode:aBoolean
  4428     "comments in generated aspect methods; yes or no."
  4429 
  4430     UIPainterView generateCommentedCode:aBoolean
  4431 
  4432     "Created: / 12-01-2008 / 10:23:10 / cg"
  4433 !
  4434 
  4435 redefineAspectMethods
  4436     "redefine methods yes or no.
  4437      If a method is defined in super class should the message be reinstalled ?"
  4438 
  4439     ^ UIPainterView redefineAspectMethods
  4440 
  4441     "Modified: / 12-01-2008 / 10:34:07 / cg"
  4442 !
  4443 
  4444 redefineAspectMethods:aBoolean
  4445     "redefine methods yes or no.
  4446      If a method is defined in super class should the message be reinstalled ?"
  4447 
  4448     UIPainterView redefineAspectMethods:aBoolean
  4449 
  4450     "Modified: / 12-01-2008 / 10:23:20 / cg"
  4451 ! !
  4452 
  4453 !UIPainter methodsFor:'startup & release'!
  4454 
  4455 closeRequest
  4456     "asks for permission before closing"
  4457 
  4458     self askForModification ifFalse:[^self].
  4459 
  4460     super closeRequest.
  4461 
  4462     painterView notNil ifTrue:[
  4463         painterView masterApplication:nil.
  4464         painterView closeRequest.
  4465     ].
  4466     treeView notNil ifTrue:[
  4467         treeView model removeDependent:self.
  4468     ].
  4469     selectionPanel notNil ifTrue:[
  4470         selectionPanel masterApplication:nil.
  4471         selectionPanel closeRequest
  4472     ].
  4473     "/ selectionPanel := nil.
  4474     "/ treeView       := nil.
  4475 !
  4476 
  4477 closeRequestFor:aTopView
  4478     "handles a close request for a specific view"
  4479 
  4480     |topView|
  4481 
  4482     (topView := self window) == aTopView ifTrue:[
  4483         super closeRequestFor:aTopView
  4484     ] ifFalse:[
  4485         aTopView = selectionPanel window ifTrue:[
  4486             self galleryShown value:false
  4487         ] ifFalse:[
  4488             aTopView == (self painter topView) ifTrue:[
  4489                 self painterShown value:false
  4490             ] ifFalse:[
  4491                 aTopView closeRequest
  4492             ]
  4493         ].
  4494         topView raise.
  4495     ].
  4496 !
  4497 
  4498 commonPostBuild
  4499     "sets the root of the tree view as first selection;
  4500      sets the grid parameters, if defined"
  4501 
  4502     |cls sel|
  4503 
  4504     cls := self specClass.
  4505     sel := specSelector.
  4506     cls notNil ifTrue:[
  4507         self setClass:cls selector:sel.
  4508 
  4509         (cls respondsTo:sel) ifTrue:[  
  4510             self painter setupFromSpec:(cls perform:sel).
  4511         ]
  4512     ].
  4513 
  4514     self autoAcceptOnSelectionChange addDependent:self.
  4515     self autoAcceptOnSelectionChange value ifTrue:[
  4516         (builder componentAt:'acceptButton') label:(resources string:'Apply')
  4517     ].
  4518 
  4519     "/ using masters infoHolder ?
  4520     (builder aspectAt:#useAlienInfoLabelHolder) == true ifTrue:[
  4521         (builder componentAt:#mainPanel) layout bottomOffset:0.
  4522         (builder componentAt:#infoBarSubSpec) beInvisible
  4523     ].
  4524 
  4525     self updateInfoLabel.
  4526 
  4527     "Modified: / 31-08-2006 / 10:12:53 / cg"
  4528 !
  4529 
  4530 loadFromClass:aClass andSelector:selector
  4531     "loads a window spec by evaluating aMessageString
  4532      (which is something like 'fooClass windowSpec')"
  4533 
  4534     self assert:(aClass isNil or:[aClass isClass]).
  4535 
  4536     self askForModification ifFalse:[^ self].
  4537 
  4538     self setClass:aClass selector:selector.    
  4539 
  4540     (aClass respondsTo:selector) ifTrue:[   
  4541         self loadFromSpec:(aClass perform:selector).
  4542     ]
  4543 !
  4544 
  4545 loadFromMessage:classAndSelector
  4546     "loads a window spec by evaluating aMessageString
  4547      (which is something like 'fooClass windowSpec')"
  4548 
  4549     self askForModification ifFalse:[^ self].
  4550 
  4551     classAndSelector notNil ifTrue:[
  4552         self 
  4553             loadFromClass:classAndSelector methodClass 
  4554             andSelector:classAndSelector methodSelector
  4555     ]
  4556 !
  4557 
  4558 loadFromSpec:aSpec
  4559     "loads a window spec proper"
  4560 
  4561     self askForModification ifFalse:[^ self].
  4562 
  4563     self painter setupFromSpec:aSpec.
  4564 !
  4565 
  4566 openInterface:aSymbol 
  4567     "in addition to opening my interface, also open up a gallery and a painter"
  4568     
  4569     |topView|
  4570 
  4571     self setupSpecClassAndSelector.
  4572 
  4573 "/    treeView := TreeView new.
  4574 "/    treeView windowSpecClass:(self defaultWindowSpecClass).
  4575 "/    treeView 
  4576 "/        selectConditionBlock:[:newSelection | self selectionChangeAllowed:newSelection ].
  4577 
  4578 "/    painterView := StandardSystemView new.
  4579 "/    name := name ? UIPainter defaultNameOfCanvas.
  4580 "/    painterView beToolWindow.
  4581 "/    painterView name:name.
  4582 "/    painterView label:name.
  4583 "/    painterView extent:(treeView windowSpecClass defaultExtentInUIPainter).
  4584 "/    painter := UIPainterView in:painterView.
  4585 "/    painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.
  4586 "/    treeView := treeView canvas:painter specName:name.
  4587 "/    painter treeView:treeView.
  4588 "/    treeView model addDependent:self.
  4589 "/    painter enableChannel:(self enableChannel).
  4590 
  4591     super openInterface:aSymbol.
  4592 
  4593     topView := self window.
  4594     topView label:'GUI Painter'.
  4595 
  4596 "/    self setupCanvasAndSelectionPanel.
  4597 "/
  4598 "/    selectionPanel window waitUntilVisible.
  4599 "/    painterView window waitUntilVisible.
  4600 "/    self window waitUntilVisible.
  4601 "/    [ Delay waitForSeconds:0.5. self window topView raise ] fork.
  4602 
  4603     "Modified: / 31-08-2006 / 10:13:16 / cg"
  4604 !
  4605 
  4606 openOnClass:aClass
  4607     "opens the GUI Painter on aClass and #windowSpec"
  4608 
  4609     self openOnClass:aClass andSelector:#windowSpec
  4610 !
  4611 
  4612 openOnClass:aClass andSelector:aSelector
  4613     "opens the GUI Painter on aClass and aSelector"
  4614 
  4615     aClass isNil ifTrue:[
  4616         (self confirm:'No class given to the GUI Painter (class was probably renamed?)\\Open anyway (to create a new window spec) ?' withCRs)
  4617         ifFalse:[^ nil].
  4618     ].
  4619 
  4620     specSelector := aSelector.
  4621     specClass := aClass.
  4622     specClassName := aClass name.
  4623 
  4624     self openInterface.
  4625 
  4626 "/    specSelector := aSelector.
  4627 "/    specClass := aClass.
  4628 
  4629     "Modified: / 31-08-2006 / 10:13:31 / cg"
  4630 !
  4631 
  4632 postBuildWith: aBuilder
  4633     super postBuildWith:aBuilder.
  4634 
  4635     (self toolBarVisibleHolder value 
  4636     or:[ self editToolBarVisibleHolder value ]) ifTrue:[ self toolBarVisibilityChanged ].
  4637 
  4638     "Created: / 18-02-2007 / 15:03:08 / cg"
  4639 
  4640     self setupPainter.
  4641 
  4642     "Modified: / 22.8.1998 / 17:41:34 / cg"
  4643 !
  4644 
  4645 postOpenWith: aBuilder
  4646     "spread the painter and gallery views on the screen"
  4647 
  4648     |myWindow canvasWindow canvasOrg galleryWindow 
  4649      galleryOrg myOrg myCorner windowGroup|
  4650 
  4651     super postOpenWith: aBuilder.
  4652 
  4653     windowGroup := self topApplication windowGroup.
  4654     windowGroup addPreEventHook:self.
  4655 
  4656     treeView selection: #(1).
  4657     aBuilder keyboardProcessor menuBar:nil.
  4658 
  4659     myWindow := self window.
  4660     canvasWindow := self painter topView.
  4661     [selectionPanel isNil] whileTrue:[
  4662         Delay waitForSeconds:0.1.
  4663     ].
  4664 
  4665     galleryWindow := selectionPanel window.
  4666 
  4667     myOrg := myWindow origin.
  4668     myCorner := myWindow corner.
  4669 
  4670     "/ try to lay out things non-overlapping
  4671     true
  4672 
  4673     "/ but only, if the window manager placed all windows
  4674     "/ on top of each other
  4675     "/ myOrg = canvasWindow origin 
  4676 
  4677     ifTrue:[
  4678 
  4679         canvasOrg := 10@20.
  4680 "/        myOrg := (device width - myWindow width - 20) @ 20.
  4681         galleryOrg := (device width - galleryWindow width - 20) 
  4682                       @ 
  4683                       ((myWindow height + 20) min:(device height - galleryWindow height - 20)).
  4684         myWindow origin:myOrg.
  4685 
  4686         canvasWindow origin:canvasOrg.
  4687         galleryWindow origin:galleryOrg.
  4688 
  4689         galleryWindow raise.
  4690         canvasWindow raise.
  4691     ].
  4692 
  4693     self setupCanvasAndSelectionPanel.
  4694 
  4695 "/    selectionPanel window waitUntilVisible.
  4696 "/    painterView window waitUntilVisible.
  4697 "/    self window waitUntilVisible.
  4698     [   Delay waitForSeconds:0.1. 
  4699         self window topView raise.
  4700         Delay waitForSeconds:0.25. 
  4701         self window topView raise 
  4702     ] fork.
  4703     "Modified: / 13.7.1999 / 21:26:52 / cg"
  4704 !
  4705 
  4706 release
  4707     super release.
  4708 
  4709     painterView notNil ifTrue:[
  4710         painterView destroy.
  4711     ].
  4712     selectionPanel notNil ifTrue:[
  4713         selectionPanel masterApplication:nil.
  4714         selectionPanel window destroy
  4715     ].
  4716     selectionPanel := nil.
  4717     treeView       := nil.
  4718     painterView    := nil.
  4719 !
  4720 
  4721 selectionPanelClass
  4722     ^ SelectionPanelClass
  4723 !
  4724 
  4725 setupCanvasAndSelectionPanel
  4726     |topView galleryWindow icon|
  4727 
  4728     icon := Smalltalk imageFromFileNamed:'UIPainter.xbm' forClass:self class.
  4729 
  4730     topView := self window.
  4731 
  4732     painterView openInGroup:(topView windowGroup).
  4733     painterView application:self.
  4734 
  4735     galleryWindow := selectionPanel window.
  4736     galleryWindow beToolWindow.
  4737     galleryWindow openInGroup:(topView windowGroup).
  4738 
  4739     selectionPanel masterApplication:self.
  4740 
  4741     topView iconLabel:'GUI Painter'.
  4742     topView icon:icon.
  4743     painterView iconLabel:'GUI Canvas'.
  4744     painterView icon:icon.
  4745     galleryWindow iconLabel:'GUI Gallery'.
  4746     galleryWindow icon:icon.
  4747     
  4748     topView isModal ifFalse:[
  4749         topView bePartner.
  4750         painterView bePartner.
  4751         galleryWindow bePartner.
  4752     ]
  4753 !
  4754 
  4755 setupPainter
  4756     "sets the painter's grid parameters, if defined"
  4757 
  4758     |painter settings gridPara hspace vspace|
  4759 
  4760     painter  := self painter.
  4761     settings := self class settings.
  4762     gridPara := painter gridParameters copy.
  4763     hspace   := settings at: #HGridSpace ifAbsent:10.
  4764     vspace   := settings at: #VGridSpace ifAbsent:10.
  4765     gridPara at:1 put:hspace; at:2 put:vspace; at:5 put:hspace; at:6 put:vspace.
  4766     painter gridParameters:gridPara.
  4767     painter gridShown: (settings at: #GridShown ifAbsent:false).
  4768     painter gridAlign: (settings at: #GridAlign ifAbsent:false).
  4769     painter shown ifTrue:[painter clearView].
  4770 
  4771     "Modified: / 22.8.1998 / 17:41:34 / cg"
  4772 !
  4773 
  4774 setupSpecClassAndSelector
  4775     |cls name|
  4776 
  4777     self specClass notNil ifTrue:[
  4778         specClassName isBehavior ifTrue:[
  4779             name := specClassName nameWithoutPrefix.
  4780         ] ifFalse:[
  4781             name := specClassName printString string
  4782         ]
  4783     ].
  4784     (aspects at:#classNameChannel) value:(specClassName ? 'NewApplication').
  4785 
  4786     specSuperclassName isNil ifTrue:[
  4787         specClassName notNil ifTrue:[
  4788             (cls := self resolveName:specClassName) notNil ifTrue:[
  4789                 specSuperclassName := cls superclass name.
  4790             ]
  4791         ]
  4792     ].
  4793     aspects at:#superclassNameChannel
  4794         put:((specSuperclassName notNil 
  4795                 ifTrue:[ specSuperclassName ]
  4796                 ifFalse:[ 'ApplicationModel' ]) asValue).
  4797     aspects at:#superclassNameDefaults
  4798         put:#( 'ApplicationModel' 'SimpleDialog' 'WebApplicationModel') asValue.
  4799     aspects at:#methodNameChannel
  4800         put:((specSelector notNil 
  4801                 ifTrue:[ specSelector asValue ]
  4802                 ifFalse:[ #windowSpec ]) asValue).
  4803 
  4804     "Modified: / 16-01-2008 / 10:44:55 / cg"
  4805 ! !
  4806 
  4807 !UIPainter methodsFor:'user actions'!
  4808 
  4809 accept
  4810     "accepts all modifications done to the attributes of the current section"
  4811 
  4812     |painter layout spec layoutTool layoutView t|
  4813 
  4814     self acceptChannel value:true; value:false.  "/ force editFields to accept
  4815     self clearModifiedFlag.
  4816 
  4817     painter := self painter.
  4818     spec := self specTool specification.
  4819 
  4820     self isLayoutToolSelected ifTrue:[
  4821         layoutTool := self layoutTool.
  4822 
  4823         (layout := layoutTool layout) notNil ifTrue:[
  4824             layoutTool layoutType == #Extent ifTrue:[
  4825                 layoutView := layoutTool layoutView.
  4826 
  4827                 layoutView == self canvas ifTrue:[
  4828                     layoutView extent:layout.
  4829                     UseViewScroller == true ifTrue:[
  4830                         layoutView container container sizeChanged:nil.
  4831                     ].
  4832                 ] ifFalse:[
  4833                     spec useDefaultExtent:(layoutTool aspectFor:#useDefaultExtent) value.
  4834                     spec useDefaultExtent ifTrue:[
  4835                         "/ temporarily unfreeze the widgets size
  4836                         "/ (but remember, the old setting, which is actually
  4837                         "/ controlled by the resizeForLabel attribute)
  4838                         t := layoutView sizeFixed.
  4839                         layoutView sizeFixed:false.
  4840                         layout := layoutView preferredExtent.    
  4841                         layoutView sizeFixed:t.
  4842                     ].
  4843                     spec usePreferredWidth:(layoutTool aspectFor:#usePreferredWidth) value.
  4844                     spec usePreferredHeight:(layoutTool aspectFor:#usePreferredHeight) value.
  4845                     spec useDynamicPreferredWidth:(layoutTool aspectFor:#useDynamicPreferredWidth) value.
  4846                     spec useDynamicPreferredHeight:(layoutTool aspectFor:#useDynamicPreferredHeight) value.
  4847                     painter setExtent:layout.
  4848                     painter updateFromSpec:spec.
  4849                 ]
  4850             ] ifFalse:[
  4851                 spec useDefaultExtent:false.
  4852                 spec usePreferredWidth:(layoutTool aspectFor:#usePreferredWidth) value.
  4853                 spec usePreferredHeight:(layoutTool aspectFor:#usePreferredHeight) value.
  4854                 spec useDynamicPreferredWidth:(layoutTool aspectFor:#useDynamicPreferredWidth) value.
  4855                 spec useDynamicPreferredHeight:(layoutTool aspectFor:#useDynamicPreferredHeight) value.
  4856                 painter setLayout:layout.
  4857                 spec layout:layout.
  4858                 painter updateFromSpec:spec.
  4859             ].
  4860         ]
  4861     ] ifFalse:[
  4862         self isHelpToolSelected ifTrue:[
  4863             self helpTool accept.      
  4864             spec activeHelpKey:self helpTool helpKey.
  4865         ].      
  4866         painter updateFromSpec:spec
  4867     ].
  4868 
  4869     self clearModified
  4870 !
  4871 
  4872 addWidget: aSpecClass
  4873     "adds a widget from aSpecClass to the current widget"
  4874 
  4875     self addWidgetOfSpec: (Array with: (Smalltalk at: aSpecClass) new)
  4876 
  4877 !
  4878 
  4879 addWidgetOfSpec: aSpec
  4880     "adds a widget from aSpec to the current widget"
  4881 
  4882     |newSel|
  4883 
  4884     (newSel := painter pasteSpecifications:aSpec keepLayout:false at:0@0) notNil
  4885     ifTrue:[
  4886         painter select: newSel
  4887     ] ifFalse:[   
  4888         ((treeView selection size = 0) or: [treeView selectedNode isNil])
  4889         ifTrue:[                          
  4890             treeView selection: #(1).
  4891         ] ifFalse:[  
  4892             treeView selectNode: (treeView detectNode: [:n| n = treeView selectedNode parent])
  4893         ].
  4894         self addWidgetOfSpec: aSpec
  4895     ]
  4896 
  4897     "Modified: / 05-09-2006 / 18:37:12 / cg"
  4898 !
  4899 
  4900 cancel
  4901     "cancels all modifications done to the attributes of the current section; 
  4902      reread the old attributes"
  4903 
  4904     |spec key view|
  4905 
  4906     self isModified ifTrue:[
  4907         (spec := self painter specForSelection) notNil ifTrue:[
  4908             key := spec activeHelpKey.
  4909         ].
  4910         self helpTool helpKey:key.
  4911 
  4912         treeView isCanvasSelected ifTrue: [
  4913             spec := treeView canvasSpec.
  4914         ].
  4915 
  4916         self specTool specification:spec.
  4917         view := self layoutTool layoutView.
  4918 
  4919         self setViewInLayoutTool:view spec:spec.
  4920         spec class == DataSetSpec ifTrue:[
  4921             view notNil ifTrue:[
  4922                 view columnDescriptors:(spec columns)
  4923             ]
  4924         ].        
  4925         self clearModifiedFlag.
  4926         self clearModified.
  4927     ]
  4928 !
  4929 
  4930 doAskAndReplaceWidgetBy
  4931     |widgetClass list common selectedSpec|
  4932 
  4933     selectedSpec := self selectedSpec.
  4934     selectedSpec isNil ifTrue:[^ self].
  4935 
  4936     list :=  UISpecification allSubclasses
  4937                 select:[:cls | Error handle:[ false ] do:[ cls viewClass notNil]].
  4938     list sort:[:a :b | a name < b name].
  4939 
  4940     common := selectedSpec class commonReplacementClasses.
  4941     common notEmpty ifTrue:[
  4942         list addAllFirst:(common , (Array with:'-')).
  4943     ].
  4944     widgetClass := Dialog 
  4945                         requestClass:'Spec- or View-Class:'
  4946                         list:list
  4947                         okLabel:'OK' 
  4948                         initialAnswer:nil.
  4949     widgetClass isNil ifTrue:[
  4950         ^ self
  4951     ].
  4952     self replaceWidgetByClass:widgetClass
  4953 
  4954     "Modified: / 12-01-2008 / 23:50:25 / cg"
  4955 !
  4956 
  4957 doBrowseActionMethod:aspectSelector
  4958     "browse or create the action method as entered in the field (button beside input filed pressed)"
  4959 
  4960     self acceptOrIgnoreSectionModification.
  4961 
  4962     self doBrowseActionMethod:aspectSelector nameAs:aspectSelector
  4963 
  4964     "Modified: / 12-01-2008 / 10:32:12 / cg"
  4965 !
  4966 
  4967 doBrowseActionMethod:aspectSelector nameAs:aspectNameShown
  4968     "browse or create the action method as entered in the field"
  4969 
  4970     |cls spec aspect code|
  4971 
  4972     cls := self specClass.
  4973     cls isNil ifTrue:[
  4974         Dialog information:'No application class defined.'.
  4975         ^ self
  4976     ].
  4977 
  4978     spec := painter specForSelection.
  4979     spec isNil ifTrue:[^ self].
  4980     aspect := spec perform:aspectSelector.
  4981     aspect isNil ifTrue:[
  4982         Dialog information:(resources 
  4983                                 string:'Please enter an action method name for "%1" first.'
  4984                                 with:(resources string:aspectNameShown) allBold).
  4985         ^ self
  4986     ].
  4987         
  4988     (cls includesSelector:aspect asSymbol) ifFalse:[
  4989         (Dialog confirm:(resources 
  4990                             stringWithCRs:'%1 does not implement %2.\\Create ?'
  4991                             with:(cls name allBold)
  4992                             with:aspect allBold)) 
  4993         ifFalse:[
  4994             (Dialog confirm:(resources 
  4995                                 stringWithCRs:'Browse implementors of %1 ?'
  4996                                 with:aspect allBold)) 
  4997             ifTrue:[
  4998                 UserPreferences current systemBrowserClass browseImplementorsOf:aspect
  4999             ].
  5000             ^ self
  5001         ].
  5002         code := painter
  5003             generateActionMethodFor:aspect 
  5004             spec:nil 
  5005             inClass:cls.
  5006         code readStream fileIn.
  5007     ].
  5008     UserPreferences current systemBrowserClass openInClass:cls selector:aspect
  5009 !
  5010 
  5011 doBrowseAspectMethod:aspectSelector
  5012     "browse or create the aspect method as entered in the field (button beside input fieled pressed)"
  5013 
  5014     self isModified ifTrue:[ self accept ].
  5015     "/ self acceptOrIgnoreSectionModification.
  5016     self doBrowseAspectMethod:aspectSelector nameAs:aspectSelector
  5017 
  5018     "Modified: / 12-01-2008 / 10:32:15 / cg"
  5019 !
  5020 
  5021 doBrowseAspectMethod:aspectSelector nameAs:aspectNameShown
  5022     "browse or create the aspect method as entered in the field"
  5023 
  5024     |cls spec aspect implementingClass answer|
  5025 
  5026     cls := self specClass.
  5027     cls isNil ifTrue:[
  5028         Dialog information:'No Application Class defined.'.
  5029         ^ self
  5030     ].
  5031 
  5032     spec := painter specForSelection.
  5033     spec isNil ifTrue:[self halt. ^ self].
  5034 
  5035     aspect := spec perform:aspectSelector.
  5036     aspect isString ifFalse:[
  5037         "ignore non-strings (list may be an Array)"
  5038         aspect isNil ifTrue:[
  5039             Dialog information:(resources 
  5040                                     string:'Please enter a Method name for "%1" first.'
  5041                                     with:(resources string:aspectNameShown) allBold).
  5042         ].
  5043         ^ self
  5044     ].
  5045 
  5046     implementingClass := (cls whichClassIncludesSelector:aspect asSymbol).
  5047     implementingClass isNil ifTrue:[
  5048         implementingClass := (cls class whichClassIncludesSelector:aspect asSymbol).
  5049     ].
  5050     implementingClass isNil ifTrue:[
  5051         answer := OptionBox
  5052                           request:(resources 
  5053                                     stringWithCRs:'%1 does not implement %2.\\Create ?'
  5054                                     with:(cls name allBold)
  5055                                     with:aspect allBold)
  5056                           label:'Create/Browse Aspect Method'
  5057                           image:(WarningBox iconBitmap)
  5058                           buttonLabels:#('Cancel' 'Browse Implementors' 'Create & Browse' 'Create' )
  5059                           values:#(abort browseImplementors createAndBrowse create )
  5060                           default:#create
  5061                           onCancel:#abort.
  5062 
  5063         answer == #browseImplementors ifTrue:[
  5064             UserPreferences current systemBrowserClass browseImplementorsOf:aspect.
  5065             ^ self
  5066         ].
  5067         answer == #abort ifTrue:[
  5068             ^ self
  5069         ].
  5070 
  5071         self doGenerateAspectMethodsForAll:(Array with:aspect).
  5072         implementingClass := self painter targetClass.
  5073 
  5074         answer == #create ifTrue:[^ self].
  5075     ] ifFalse:[
  5076         (Dialog confirm:(resources string:'Browse the implementation of "%1" ?' with:aspect)) ifFalse:[
  5077             ^ self.
  5078         ].
  5079     ].
  5080 
  5081     UserPreferences current systemBrowserClass 
  5082         openInClass:implementingClass selector:aspect
  5083 !
  5084 
  5085 doBrowseAspectMethods
  5086     "opens a browser on all the aspect methods"
  5087 
  5088     |methods|
  5089 
  5090     self painter isModified ifTrue:[
  5091         self warn:'The current window spec has not yet been saved!!\\The System Browser may show the code of the old aspect methods.' withCRs.
  5092     ].
  5093 
  5094     (methods := self painter aspectMethods) isEmpty ifTrue:[
  5095         self warn:'No aspect methods found !!'.
  5096         ^ self.
  5097     ].
  5098     UserPreferences systemBrowserClass 
  5099         browseMethods:methods 
  5100         title:'Aspect methods'.
  5101 !
  5102 
  5103 doBrowseClass
  5104     "opens a System Browser on the specClass"
  5105 
  5106     self painter isModified ifTrue:[
  5107         self warn:'The current window spec has not yet been saved!!\\The System Browser will show the code of the old window spec.' withCRs.
  5108     ].
  5109 
  5110     Smalltalk browseInClass:(self resolveName:specClassName)
  5111 !
  5112 
  5113 doBrowseSpecificationClass
  5114     "opens an browser on the spec class of the selected widget"
  5115 
  5116     |spec|
  5117 
  5118     (spec := self painter specForSelection) isNil ifTrue:[
  5119         treeView isCanvasSelected ifTrue:[
  5120             spec := treeView canvasSpec.
  5121         ]
  5122     ].
  5123     spec notNil ifTrue:[
  5124         spec class browse
  5125     ]
  5126 !
  5127 
  5128 doBrowseViewClass
  5129     "opens a browser on the selected widgets class"
  5130 
  5131     |selection widget|
  5132 
  5133     ((selection := self painter selection) isCollection and: [selection size >= 1]) ifTrue:[
  5134         widget := selection first
  5135     ] ifFalse:[
  5136         widget := selection
  5137     ].
  5138 
  5139     widget scrolledView class browse
  5140 
  5141     "Modified: / 22-01-2011 / 12:02:31 / cg"
  5142 !
  5143 
  5144 doDefineClassAndSelector
  5145     "launches a dialog for defining class, superclass, and selector of the application"
  5146 
  5147     |again readFromModelKeyed|
  5148 
  5149     readFromModelKeyed := [:aKey| |ret|
  5150         ret := (self aspectFor:aKey) value.
  5151         ret isEmptyOrNil ifTrue:[
  5152             ret := nil
  5153         ] ifFalse:[
  5154             ret isString ifTrue:[
  5155                 ret := ret string withoutSeparators.
  5156                 ret := ret isEmpty ifTrue:[nil] ifFalse:[ret asSymbol].
  5157             ].
  5158         ].
  5159         ret
  5160     ].
  5161 
  5162     [
  5163         again := false.
  5164 
  5165         aspects at:#classNameChannel      put:(specClassName  ? 'NewApplication')   asValue.
  5166         aspects at:#methodNameChannel     put:(specSelector   ? 'windowSpec')       asValue.
  5167         aspects at:#superclassNameChannel put:(specSuperclassName ? 'ApplicationModel') asValue.
  5168 
  5169         (self openDialogInterface:#dialogSpecForDefiningClassAndSelector) ifTrue:[
  5170             specClassName  := readFromModelKeyed value:#classNameChannel.
  5171             specSelector   := readFromModelKeyed value:#methodNameChannel.
  5172             specSuperclassName := readFromModelKeyed value:#superclassNameChannel.
  5173 
  5174             (again := self checkClassAndSelector not) ifFalse:[
  5175                 self painter 
  5176                     className:specClassName
  5177                     superclassName:specSuperclassName
  5178                     selector:specSelector.
  5179             ].
  5180 
  5181             again ifFalse:[
  5182                 ((Smalltalk at:specClassName asSymbol) notNil
  5183                 and:[ (Smalltalk at:specClassName asSymbol) class includesSelector:specSelector ])
  5184                 ifTrue:[
  5185                     (self confirm:('%1 already implements %2. Overwrite ?' bindWith:specClassName with:specSelector))
  5186                     ifFalse:[
  5187                         again := true.
  5188                     ].
  5189                 ].
  5190             ].
  5191         ] ifFalse: [
  5192             ^nil
  5193         ]
  5194 
  5195     ] doWhile:[again].
  5196 
  5197     specClassName := specClassName isBehavior 
  5198                         ifTrue:[specClassName name]
  5199                         ifFalse:[specClassName].
  5200 
  5201     self clearModifiedFlag.
  5202     self helpTool buildAndMergeFromClass:specClassName.
  5203     self updateInfoLabel
  5204 
  5205     "Modified: / 16.7.1998 / 18:26:33 / cg"
  5206 !
  5207 
  5208 doDefineGrid
  5209     "opens a dialog for the grid parameters"
  5210 
  5211     |hspace vspace bindings painter gridPara settings|
  5212 
  5213     painter  := self painter.
  5214     bindings := IdentityDictionary new.
  5215     gridPara := painter gridParameters copy.
  5216     settings := self class settings.
  5217 
  5218     bindings at:#showGrid    put:((settings at: #GridShown ifAbsent: [painter gridShown]) asValue).
  5219     bindings at:#alignToGrid put:((settings at: #GridAlign ifAbsent: [painter gridAlign]) asValue).
  5220     bindings at:#hspace      put:((gridPara at:1) asValue).
  5221     bindings at:#vspace      put:((gridPara at:2) asValue).
  5222 
  5223     (self openDialogInterface:#dialogSpecForDefiningGridParameters withBindings:bindings) ifFalse:[
  5224         ^ self
  5225     ].
  5226 
  5227     hspace := (bindings at:#hspace) value ? 5.
  5228     vspace := (bindings at:#vspace) value ? 5.
  5229 
  5230     gridPara at:1 put:hspace.
  5231     gridPara at:2 put:vspace.
  5232     gridPara at:5 put:hspace.
  5233     gridPara at:6 put:vspace.
  5234 
  5235     painter gridShown:false. 
  5236     painter gridAlign:false. 
  5237     painter gridParameters:gridPara.
  5238     painter gridAlign:(bindings at:#alignToGrid) value.
  5239     painter gridShown:(bindings at:#showGrid) value.
  5240 
  5241     settings at: #GridShown  put: (bindings at:#showGrid) value.
  5242     settings at: #GridAlign  put: (bindings at:#alignToGrid) value.
  5243     settings at: #HGridSpace put: hspace.
  5244     settings at: #VGridSpace put: vspace.
  5245     painter clearView.
  5246 
  5247     "Modified: / 4.2.1999 / 15:36:34 / cg"
  5248 !
  5249 
  5250 doEditList:listSelector
  5251     "browse or create the aspect method as entered in the field (button beside input fieled pressed)"
  5252 
  5253     |spec list editor|
  5254 
  5255     self acceptOrIgnoreSectionModification.
  5256 
  5257     UIListEditor isNil ifTrue:[^ self].
  5258 
  5259     spec := painter specForSelection.
  5260     spec isNil ifTrue:[^ self].
  5261 
  5262     "Kludge: subject - fetch the AspectAdaptor behind the TypeConverter"
  5263     list := (specTool aspectFor:listSelector) subject value.
  5264     list isNil ifTrue:[
  5265         list := #()
  5266     ].
  5267 
  5268     editor := UIListEditor new.
  5269     editor
  5270         informationLabel:'Edit List';
  5271         list:list;
  5272         useSymbols:(list notEmpty and:[list conform:[:e| e isSymbol]]);    "set use symbols, if all elements are symbols"
  5273         open.
  5274 
  5275 
  5276     editor accepted ifTrue:[
  5277         "Kludge: subject - fetch the AspectAdaptor behind the TypeConverter"
  5278         (specTool aspectFor:listSelector) subject value:editor list.
  5279     ].
  5280 !
  5281 
  5282 doGenerateAspectMethodFor
  5283     |cls aspectList displayedList selectorsToGenerateCode 
  5284      doBrowse methods|
  5285 
  5286     self askForSectionModification.
  5287 
  5288     cls := self painter targetClass.
  5289 
  5290     aspectList := OrderedCollection new.
  5291 
  5292     self painter aspectSelectorsAndTypesDo:
  5293         [:selector :type |
  5294             |newEntry|
  5295 
  5296             ( #(#modelAspect channelAspect actionSelector valueSelector) includes:type) ifTrue:[
  5297                 ((cls canUnderstand:selector) or:[cls class canUnderstand:selector]) ifFalse:[
  5298                     newEntry := Array with:selector with:type.    
  5299                     (aspectList contains:[:entry | entry = newEntry]) ifFalse:[    
  5300                         aspectList add:newEntry.
  5301                     ]
  5302                 ]
  5303             ]
  5304         ].
  5305     
  5306     aspectList isEmpty ifTrue:[
  5307         self information:'All aspect methods exist.'.
  5308         ^ self.
  5309     ].
  5310 
  5311     aspectList sort:[:a :b | a first < b first].
  5312     displayedList := aspectList collect:[:entry | (((entry first) paddedTo:25) contractTo:25) , ' -> ' , entry second ].
  5313     aspectList := aspectList collect:[:each | each first].
  5314 
  5315     doBrowse := false.    
  5316     selectorsToGenerateCode := Dialog
  5317         choose:'Select aspect(s) for which code shall be generated:' 
  5318         fromList:displayedList 
  5319         values:aspectList 
  5320         initialSelection:nil
  5321         buttons:nil 
  5322         values:nil 
  5323         lines:15 
  5324         cancel:nil 
  5325         multiple:true
  5326         postBuildBlock:[:dialog | 
  5327                             |b|
  5328 
  5329                             b := Button label:'Generate & Browse'.
  5330                             b action:[doBrowse := true. dialog okPressed].
  5331                             b := dialog addButton:b before:dialog okButton.
  5332                        ].
  5333 
  5334     selectorsToGenerateCode isEmptyOrNil ifTrue:[^ self].
  5335 
  5336     self doGenerateAspectMethodsForAll:selectorsToGenerateCode.
  5337 
  5338     "/ refetch - cls is now obsolete
  5339     cls := self painter targetClass.
  5340 
  5341     doBrowse ifTrue:[
  5342         methods := selectorsToGenerateCode 
  5343                         collect:[:sel | cls compiledMethodAt:sel]
  5344                         thenSelect:[:m | m notNil].
  5345 
  5346         UserPreferences systemBrowserClass 
  5347             browseMethods:methods 
  5348             title:'Some Aspect methods'.
  5349     ].
  5350 !
  5351 
  5352 doGenerateAspectMethods
  5353     "generates aspect and action methods for the application class"
  5354 
  5355     self askForSectionModification.
  5356     self withWaitCursorDo:[
  5357         |code|
  5358 
  5359         code := self painter generateAspectMethodCode.
  5360         code readStream fileIn.
  5361     ]
  5362 !
  5363 
  5364 doGenerateAspectMethodsForAll:selectorsToGenerateCode
  5365     |code|
  5366 
  5367     code := self painter generateAspectMethodCodeFiltering:selectorsToGenerateCode.
  5368     code readStream fileIn.
  5369 !
  5370 
  5371 doGenerateAspectSelectorsMethod
  5372     "generates aspectSelectors method for the exported aspects"
  5373 
  5374     |aspectSelectorsAsString|
  5375 
  5376     self askForSectionModification.
  5377     aspectSelectorsAsString := self painter generateAspectSelectorsMethod.
  5378     aspectSelectorsAsString notEmptyOrNil ifTrue:[
  5379         (ReadStream on:aspectSelectorsAsString) fileIn.
  5380     ].
  5381 !
  5382 
  5383 doGenerateHookMethods
  5384     "generates hook methods for the application class"
  5385 
  5386     self askForSectionModification.
  5387 
  5388     (ReadStream on:self painter generateHookMethods) fileIn.
  5389 
  5390 !
  5391 
  5392 doGenerateMenuMethods
  5393     "generates menu stub methods for the application class"
  5394 
  5395     self askForSectionModification.
  5396 
  5397     (ReadStream on:self painter generateMenuMethods) fileIn.
  5398 
  5399     "Created: / 23.8.1998 / 16:10:04 / cg"
  5400 !
  5401 
  5402 doInspectSpec
  5403     "opens an inspector on the spec of the selected widget"
  5404 
  5405     |spec|
  5406 
  5407     (spec := self painter specForSelection) isNil ifTrue:[
  5408         treeView isCanvasSelected ifTrue:[
  5409             spec := treeView canvasSpec.
  5410         ]
  5411     ].
  5412     spec notNil ifTrue:[
  5413         spec inspect.
  5414     ]
  5415 !
  5416 
  5417 doInspectView
  5418     "opens an inspector on the view of the selected widget"
  5419 
  5420     |selection|
  5421 
  5422     ((selection := self painter selection) isCollection and: [selection size >= 1]) ifTrue:[
  5423         selection first inspect
  5424     ] ifFalse: [
  5425         selection inspect
  5426     ]
  5427 
  5428 !
  5429 
  5430 doInstallAsWebPage
  5431     "lets user select a service, page-name and installs the page"
  5432 
  5433     |runningServerPorts again serviceOrPort pageName port serviceLinkName service server app|
  5434 
  5435     runningServerPorts := (HTTPServer runningServers collect:[:s | s port printString]) asOrderedCollection sort.
  5436     serviceOrPort := lastPort ? LastPort ? '8080'.
  5437     pageName := lastPage ? LastPage ? 'myPage'.
  5438 
  5439     [
  5440         again := false.
  5441 
  5442         aspects at:#serviceOrPortNameChannel put:serviceOrPort printString  asValue.
  5443         aspects at:#pageNameNameChannel      put:pageName printString asValue.
  5444         aspects at:#runningServerPorts       put:runningServerPorts.
  5445 
  5446         (self openDialogInterface:#dialogSpecForDefiningPortAndPageName) ifFalse:[^ nil].
  5447 
  5448         port := Integer readFrom:(aspects at:#serviceOrPortNameChannel) value onError:nil.
  5449         port isNil ifTrue:[
  5450             serviceLinkName := (aspects at:#serviceOrPortNameChannel) value.
  5451             service := HTTPPortalService allSubInstances select:[:s | s linkName = serviceLinkName].
  5452             service notEmptyOrNil ifTrue:[
  5453                 again := false.
  5454                 service := service first.    
  5455             ] ifFalse:[
  5456                 Dialog warn:'No such service'
  5457             ].
  5458         ] ifFalse:[
  5459             server := HTTPServer serverOnPort:port.
  5460             service := server 
  5461                         serviceForLink:'/portal'
  5462                         ifAbsent:[
  5463                             service := HTTPPortalService new.
  5464                             service linkName:'/portal'.
  5465                             service class unRegisterServiceOn:server.
  5466                             service registerServiceOn:server.
  5467                         ].
  5468         ].
  5469 
  5470         pageName := (aspects at:#pageNameNameChannel) value.
  5471     ] doWhile:[again].
  5472 
  5473     lastPage := LastPage := pageName.
  5474     lastPort := LastPort := port.
  5475 
  5476     app := self specClass new.
  5477     app webLink:pageName.
  5478     app service:service.
  5479     app defineInterface:(self specSelector).
  5480     app addToService.
  5481 
  5482 "/    self clearModifiedFlag.
  5483 "/    self helpTool buildAndMergeFromClass:specClassName.
  5484     self updateInfoLabel
  5485 
  5486     "Modified: / 15-01-2008 / 14:18:53 / cg"
  5487 !
  5488 
  5489 doLoad
  5490     "opens a ResourceSelectionBrowser for loading a window spec from a class"
  5491 
  5492     self askForModification ifFalse: [^nil].
  5493 
  5494     self loadFromMessage: 
  5495         (ResourceSelectionBrowser
  5496             request: 'Load Window Spec From Class'
  5497             onSuperclass: nil
  5498             andClass: self specClass
  5499             andSelector: specSelector ? #windowSpec
  5500             withResourceTypes: #(canvas))
  5501 
  5502     "Modified: / 31-08-2006 / 10:14:01 / cg"
  5503 !
  5504 
  5505 doLoadSubspec
  5506     "opens a ResourceSelectionBrowser for loading a sub spec from a class"
  5507 
  5508     |classAndSelector class selector|
  5509 
  5510     self askForSectionModification.
  5511 
  5512     classAndSelector := ResourceSelectionBrowser
  5513             request: 'Load Subspec From Class'
  5514             onSuperclass: nil
  5515             andClass: self specClass
  5516             andSelector: specSelector
  5517             withResourceTypes: #(canvas).
  5518 
  5519     classAndSelector isNil ifTrue:[^ self].
  5520     class := classAndSelector methodClass.
  5521     selector := classAndSelector methodSelector.
  5522     (class == specClassName and: [selector == specSelector]) ifTrue: [
  5523         self warn: 'Current interface as subspec not allowed!!'.
  5524         ^ self.
  5525     ].
  5526     (class respondsTo:selector) ifTrue:[
  5527         self addWidgetOfSpec:(Array with: (UISubSpecification new majorKey: class name; minorKey: selector))
  5528     ]
  5529 
  5530     "Modified: / 31-08-2006 / 10:13:56 / cg"
  5531 !
  5532 
  5533 doNew
  5534     "removes all widgets, specClass, and specSelector"
  5535 
  5536     self askForModification ifFalse: [^nil].
  5537     specClass := specClassName := specSelector := nil.
  5538     self painter removeAll.
  5539 "/ self halt.
  5540     treeView canvas topView 
  5541         name:  self defaultNameOfCanvas;
  5542         label: self defaultNameOfCanvas.
  5543     self helpTool doNew.
  5544     self treeSelectionChanged.
  5545     treeView selectedNode changed.
  5546     self tabModel value: self tabList value first.
  5547     self updateInfoLabel.
  5548 
  5549     "Modified: / 31-08-2006 / 10:14:10 / cg"
  5550 !
  5551 
  5552 doOpenWidgetDocumentation
  5553     "opens documentation for the selected widget"
  5554 
  5555     |spec document|
  5556 
  5557     (spec := self specForSelection) isNil ifTrue:[
  5558 "/        treeView isCanvasSelected ifTrue:[
  5559 "/            spec := nil
  5560 "/        ]
  5561     ].
  5562     spec notNil ifTrue:[
  5563         document := 'tools/uipainter/', spec documentFileName,'.html'
  5564     ] ifFalse: [
  5565         document := 'tools/uipainter/WindowSpec.html'
  5566     ].
  5567     HTMLDocumentView openFullOnDocumentationFile: document 
  5568 !
  5569 
  5570 doPickAView
  5571     "changes the cursor for picking a view and builds a window spec from it"
  5572 
  5573     |view|
  5574 
  5575     self askForModification ifFalse: [^nil].
  5576 
  5577     (view := Screen current viewFromUser) notNil ifTrue:[
  5578         view == Screen current rootView ifFalse:[
  5579             self painter setupFromSpec:(UISpecification fromView:view topView).
  5580         ]
  5581     ].
  5582 
  5583     self updateInfoLabel
  5584 
  5585 !
  5586 
  5587 doSave
  5588     "saves the window spec"
  5589     
  5590     |code painter specClass extentUsed|
  5591 
  5592     self askForSectionModification.
  5593     self hasSpecClassAndSelector ifFalse:[
  5594         self doDefineClassAndSelector isNil ifTrue:[
  5595             ^ nil
  5596         ]
  5597     ].
  5598 
  5599     specClass := self resolveName:specClassName.
  5600     (specClass notNil and:[ specClass isClass ]) ifFalse:[
  5601         self warn:('Oops - cannot save - class not found: ' , specClassName).
  5602         ^ nil
  5603     ].
  5604 
  5605     painter := self painter.
  5606     painter 
  5607         class:specClass
  5608         superclassName:specSuperclassName
  5609         selector:specSelector.
  5610 
  5611 "/    Transcript showCR:'generating windowSpec code...'.
  5612 
  5613     extentUsed := self canvas extent.
  5614     (extentUsed > (1024 @ 768)) ifTrue:[
  5615         Dialog 
  5616             warn:(resources
  5617                 stringWithCRs:'The application''s default window-size is taken from the current size and will be %1.\\This may be too large for some displays - if required, resize and save again.'
  5618                 with:extentUsed printString allBold)
  5619     ].
  5620     (self canvas maxExtent notNil
  5621     and:[ extentUsed > self canvas maxExtent ]) ifTrue:[
  5622         Dialog 
  5623             warn:(resources
  5624                 stringWithCRs:'The window-size is larger than its max-extent.\\This may lead to trouble (lost extent) later. I suggest removal of the max or resizing.'
  5625                 with:extentUsed printString allBold)
  5626     ].
  5627 
  5628     code := painter generateWindowSpecMethodSource withCRs.
  5629     (ReadStream on:code) fileIn.
  5630     self doGenerateAspectSelectorsMethod.
  5631     self helpTool doSave.
  5632     self updateInfoLabel.
  5633     self clearModified.
  5634     painter resetModification.
  5635     (specClass respondsTo:specSelector) ifTrue:[
  5636         self addHistoryEntryForClass:specClass selector:specSelector.
  5637     ].
  5638 !
  5639 
  5640 doSaveAs
  5641     "opens a ResourceSelectionBrowser for saving the window spec on a class"
  5642 
  5643     |classAndSelector|
  5644 
  5645     self askForSectionModification.
  5646 "/    self hasSpecClassAndSelector ifTrue:[
  5647 "/        self askForModification ifFalse:[^ false].
  5648 "/    ].
  5649 
  5650     classAndSelector := ResourceSelectionBrowser
  5651             request: 'Save Window Spec In Class'
  5652             onSuperclass: #Object
  5653             andClass: (specClassName ? #ApplicationModel) asSymbol
  5654             andSelector: specSelector ? #windowSpec
  5655             withResourceTypes: #(canvas).
  5656 
  5657     classAndSelector isNil ifTrue:[^ false].
  5658 
  5659     self clearModified.
  5660     self painter resetModification.
  5661 
  5662     specClass := classAndSelector methodClass.
  5663     specClassName := classAndSelector methodClass name.
  5664     specSelector := classAndSelector methodSelector.
  5665     specSuperclassName := specClass superclass name.
  5666     self doSave.
  5667     ^ true
  5668 !
  5669 
  5670 doSelectAspectMethod:aspectSelector
  5671     "open a dialog to select an existing aspect method and enter in the field"
  5672 
  5673     self doSelectAspectMethod:aspectSelector nameAs:aspectSelector
  5674 !
  5675 
  5676 doSelectAspectMethod:aspectSelector nameAs:aspectNameShown
  5677 "/    |cls spec aspect code|
  5678 "/
  5679 "/    cls := self specClass.
  5680 "/    cls isNil ifTrue:[
  5681 "/        Dialog information:'No Application Class defined.'.
  5682 "/        ^ self
  5683 "/    ].
  5684 "/
  5685 "/    spec := painter specForSelection.
  5686 "/    spec isNil ifTrue:[^ self].
  5687 "/    aspect := spec perform:aspectSelector.
  5688 "/    aspect isNil ifTrue:[
  5689 "/        Dialog information:(resources 
  5690 "/                                string:'Please enter a Method name for "%1" first.'
  5691 "/                                with:(resources string:aspectNameShown) allBold).
  5692 "/        ^ self
  5693 "/    ].
  5694 "/        
  5695 "/    (cls implements:aspect asSymbol) ifFalse:[
  5696 "/        (Dialog confirm:(resources 
  5697 "/                            stringWithCRs:'%1 does not implement %2.\\Create ?'
  5698 "/                            with:(cls name allBold)
  5699 "/                            with:aspect allBold)) 
  5700 "/        ifFalse:[
  5701 "/            (Dialog confirm:(resources 
  5702 "/                                stringWithCRs:'Browse implementors of %1 ?'
  5703 "/                                with:aspect allBold)) 
  5704 "/            ifTrue:[
  5705 "/                UserPreferences current systemBrowserClass browseImplementorsOf:aspect
  5706 "/            ].
  5707 "/            ^ self
  5708 "/        ].
  5709 "/        code := painter
  5710 "/            generateAspectMethodFor:aspect 
  5711 "/            spec:nil 
  5712 "/            inClass:cls.
  5713 "/        code readStream fileIn.
  5714 "/    ].
  5715 "/    UserPreferences current systemBrowserClass openInClass:cls selector:aspect
  5716 !
  5717 
  5718 doSortItems
  5719     "sort the selected items by position"
  5720 
  5721     treeView doSortItems
  5722 !
  5723 
  5724 doStartApplication
  5725     "starts the application on the editing window spec"
  5726 
  5727     |cls application|
  5728 
  5729     self hasSpecClassAndSelector ifFalse:[
  5730         self doSave isNil ifTrue: [^nil].
  5731     ] ifTrue: [
  5732         self askForSectionModification.    
  5733         (modified or: [self painter isModified or: [self helpTool modified]])
  5734         ifTrue:
  5735         [
  5736             ((YesNoBox title:'Window Spec was modified!!')        
  5737                 noText:'Cancel';
  5738                 yesText:'Save it and start';
  5739                 showAtPointer;
  5740                 accepted) ifFalse: [^nil].
  5741             self doSave isNil ifTrue: [^nil]
  5742         ]
  5743     ].
  5744 
  5745     cls := self resolveName:specClassName.
  5746     cls isNil ifTrue:[
  5747         self warn:'Oops cannot start application - no class:' , specClassName.
  5748         ^ nil
  5749     ].
  5750     application := cls new.
  5751     (application respondsTo:#openInterface:) ifFalse:[
  5752         (self confirm:('The application does not respond to the ''openInterface:'' message.\(maybe the spec is supposed to be used as subApplication/subCanvas)\\Shall I try to open this as a standAlone dialog ?') withCRs)
  5753         ifTrue:[
  5754             SimpleDialog new openSpec:(cls perform:specSelector) withBindings:nil.
  5755         ].
  5756         ^ self.
  5757     ].        
  5758     application openInterface:specSelector
  5759 !
  5760 
  5761 doStepDown
  5762     "moves the selected widget one step down in the hierarchy"
  5763 
  5764     treeView doStepOver:1
  5765 !
  5766 
  5767 doStepIn
  5768     "moves the selected widget into the next widget as child"
  5769 
  5770     treeView doStepIn
  5771 !
  5772 
  5773 doStepOut
  5774     "moves the selected widget out of the parent widget"
  5775 
  5776     treeView doStepOut
  5777 !
  5778 
  5779 doStepUp
  5780     "moves the selected widget one step up in the hierarchy"
  5781 
  5782     treeView doStepOver:-1
  5783 !
  5784 
  5785 doWindowSpec
  5786     "opens a code view with the contents of the window spec"
  5787 
  5788     self askForSectionModification.
  5789 
  5790     CodeView 
  5791         openWith: self painter generateWindowSpecMethodSource 
  5792         title: 'Window Spec'
  5793 
  5794 !
  5795 
  5796 hideEditToolbar
  5797     self editToolBarVisibleHolder value:false
  5798 !
  5799 
  5800 hideToolbar
  5801     self toolBarVisibleHolder value:false
  5802 !
  5803 
  5804 replaceWidgetByClass:aSpecOrWidgetClass
  5805     |specClass oldSpec newSpec painter|
  5806 
  5807     (aSpecOrWidgetClass isSubclassOf:UISpecification) ifTrue:[
  5808         specClass := aSpecOrWidgetClass.
  5809     ] ifFalse:[
  5810         (aSpecOrWidgetClass isSubclassOf:View) ifTrue:[
  5811             specClass := aSpecOrWidgetClass basicNew specClass.
  5812         ] ifFalse:[
  5813         ].
  5814     ].
  5815     specClass isNil ifTrue:[
  5816         Dialog warn:'Invalid Spec- or View-Class: ' , aSpecOrWidgetClass name.
  5817         ^ self.
  5818     ].
  5819 
  5820     treeView isCanvasSelected ifTrue:[
  5821         ^ self
  5822     ].
  5823     oldSpec := self selectedSpec.
  5824     newSpec := specClass cloneFrom:oldSpec.
  5825 
  5826     painter := self painter.
  5827     painter replaceSelectionBy:newSpec.
  5828 !
  5829 
  5830 useBackgroundImage
  5831     "select bitmap to underly"
  5832 
  5833     |fn|
  5834 
  5835     fn := Dialog requestFileName:'Bitmap Image File ?' pattern:'*.gif;*.tiff;*.jpg;*.png' fromDirectory:'f:'.
  5836     fn isNil ifTrue:[
  5837         ^ self
  5838     ].
  5839     painter useSketchFile:fn
  5840 
  5841     "Created: / 16-01-2008 / 17:49:20 / cg"
  5842 !
  5843 
  5844 useSketch
  5845     "select sketchfile to underly.
  5846      Sketchfiles are generated by notepads, which can offline-store drawn sketches"
  5847 
  5848     |fn|
  5849 
  5850     fn := Dialog requestFileName:'Sketch (Notepad Drawing) ?' pattern:'*.TOP' fromDirectory:'f:'.
  5851     fn isNil ifTrue:[
  5852         ^ self
  5853     ].
  5854     painter useSketchFile:fn
  5855 
  5856     "Created: / 16-01-2008 / 17:49:20 / cg"
  5857 ! !
  5858 
  5859 !UIPainter::TreeView class methodsFor:'documentation'!
  5860 
  5861 documentation
  5862 "
  5863     selection in tree view; only used by the UIPainter
  5864 
  5865     [see also:]
  5866         SelectionInTreeView
  5867         SelectionInTree
  5868         TreeItem
  5869         UIPainter
  5870 
  5871     [author:]
  5872         Claus Atzkern
  5873 "
  5874 
  5875 
  5876 ! !
  5877 
  5878 !UIPainter::TreeView methodsFor:'accessing'!
  5879 
  5880 canvas
  5881     "returns the canvas (UIPainterView)"
  5882 
  5883     ^ model root contents view
  5884 
  5885 
  5886 !
  5887 
  5888 canvas:aCanvas
  5889     "install canvas (UIPainterView)"
  5890 
  5891     self canvas:aCanvas specName:nil
  5892 !
  5893 
  5894 canvas:aCanvas specName:nameOfSpec
  5895     "install canvas (UIPainterView)"
  5896 
  5897     |props|
  5898 
  5899     props := UIPainterView::ViewProperty new.
  5900     props view:aCanvas.
  5901 
  5902     model root:(TreeItem 
  5903                     name:(nameOfSpec ? painter defaultNameOfCanvas) asBoldText 
  5904                     contents:props).
  5905 
  5906     model root expand.
  5907     self enableChannel:(aCanvas enableChannel).
  5908 !
  5909 
  5910 canvasSpec
  5911     "returns spec assigned to canvas"
  5912 
  5913     |spec list cls canvas|
  5914 
  5915     spec := self windowSpecClass new.
  5916     canvas := self canvas.
  5917 
  5918     spec fromView:(canvas topView) callBack:nil.
  5919 
  5920     windowSpec notNil ifTrue:[
  5921         spec copyValuesFromSpec:windowSpec.
  5922     ].
  5923 
  5924     spec exportedAspects isNil ifTrue:[
  5925         (     (cls  := canvas className) notNil
  5926          and:[(cls  := canvas resolveName:cls) notNil]
  5927         ) ifTrue:[
  5928             list := cls perform:#aspectSelectors ifNotUnderstood:nil.
  5929         ].
  5930         spec setExportedAspectsFrom:list.
  5931         windowSpec notNil ifTrue:[
  5932             windowSpec exportedAspects:(spec exportedAspects).
  5933         ]
  5934     ].
  5935 
  5936     self propertiesDo:[:aProp| 
  5937         |propsSpec|
  5938 
  5939         spec exportedAspectsAddKey:(aProp model) type:nil.
  5940         propsSpec := aProp spec.
  5941         propsSpec aspectSelectors 
  5942                 select:[:a | a isString or:[a isSymbol]] 
  5943                 thenDo:[:aKey|spec exportedAspectsAddKey:aKey type:nil].
  5944         propsSpec actionSelectors 
  5945                 select:[:a | a isString or:[a isSymbol]] 
  5946                 thenDo:[:aKey|spec exportedAspectsAddKey:aKey type:#action].
  5947     ].
  5948   ^ spec
  5949 !
  5950 
  5951 canvasSpec:aSpec
  5952     "update canvas from spec"
  5953 
  5954     |spec|
  5955 
  5956     self setAttributesFromWindowSpec:aSpec.
  5957     spec := aSpec copy.
  5958     spec  menu:nil.
  5959     spec flags:nil.
  5960 
  5961     spec setAttributesIn:(self canvas "topView") with:(UIBuilder new isEditing:true).
  5962 !
  5963 
  5964 exportedAspects
  5965     "returns spec assigned to canvas"
  5966 
  5967     windowSpec isNil ifTrue:[^ #()].
  5968     ^ windowSpec exportedAspects ? #()
  5969 
  5970 !
  5971 
  5972 itemOfView:aView
  5973     "returns item assigned to view or nil"
  5974 
  5975     aView notNil ifTrue:[
  5976         self allItemsDo:[:anItem|
  5977             (anItem contents view == aView) ifTrue:[^ anItem]
  5978         ]
  5979     ].
  5980     ^ nil
  5981 
  5982 
  5983 !
  5984 
  5985 lastDrawnMaster
  5986     "returns the lastDrawnMaster"
  5987 
  5988     ^ lastDrawnMaster
  5989 
  5990 
  5991 !
  5992 
  5993 painter
  5994     ^ painter
  5995 !
  5996 
  5997 painter:something
  5998     painter := something.
  5999 !
  6000 
  6001 windowSpecClass
  6002     "returns the default  windowSpecClass (WindowSpec)"
  6003 
  6004     ^ windowSpecClass ? WindowSpec
  6005 !
  6006 
  6007 windowSpecClass:aClass
  6008     "set the default windowSpecClass"
  6009 
  6010     ^ windowSpecClass := aClass
  6011 ! !
  6012 
  6013 !UIPainter::TreeView methodsFor:'accessing-property'!
  6014 
  6015 propertiesDo:aOneArgBlock
  6016     "evaluates the argument a block on each property"
  6017 
  6018     self allItemsDo:[:anItem| aOneArgBlock value:(anItem contents)]
  6019 
  6020 
  6021 !
  6022 
  6023 propertyDetect:aOneArgBlock
  6024     "evaluates the block on each property"
  6025 
  6026     self allItemsDo:[:anItem|
  6027         (aOneArgBlock value:(anItem contents)) ifTrue:[^ anItem contents]
  6028     ].
  6029     ^ nil
  6030 
  6031 !
  6032 
  6033 propertySelected
  6034     "returns current selected property or nil in case of multi selection
  6035      or empty selection "
  6036 
  6037     |idx|
  6038 
  6039     selection size == 1 ifTrue:[
  6040         (idx := selection first) ~~ 1 ifTrue:[          "canvas: not yet supported"
  6041             ^ (listOfNodes at:idx) contents
  6042         ]
  6043     ].
  6044     ^ nil
  6045 
  6046 ! !
  6047 
  6048 !UIPainter::TreeView methodsFor:'adding & removing'!
  6049 
  6050 addProperty:aProperty
  6051     "adds a new item"
  6052 
  6053     ^ self addProperty:aProperty beforeIndex:nil.
  6054 !
  6055 
  6056 addProperty:aProperty beforeIndex:anIndex
  6057     "adds a new item"
  6058 
  6059     |parent treeItem index| 
  6060 
  6061     parent := self detectItemCorespondingToView:(aProperty view superView).
  6062     parent isNil ifTrue:[^ nil ].
  6063 
  6064     treeItem := TreeItem new contents:aProperty.
  6065     index := parent numberOfChildren + 1.
  6066 
  6067     (anIndex notNil and:[anIndex > 0]) ifTrue:[
  6068         index := anIndex min:index.
  6069     ].
  6070     model add:treeItem beforeIndex:index below:parent.
  6071     ^ treeItem
  6072 !
  6073 
  6074 removeAll
  6075     "removes all items other than canvas"
  6076 
  6077     lastDrawnMaster := nil.
  6078     windowSpec := nil.
  6079 
  6080     self canvas components copy do:[:aView|
  6081         aView destroy
  6082     ].
  6083     self canvas subViews copy do:[:aView|
  6084         "/ care to not destroy the transparent input view
  6085         (aView isInputOnly) ifFalse:[aView destroy]
  6086     ].
  6087     model root name: painter defaultNameOfCanvas asBoldText.
  6088     model removeAllOtherThanRoot.
  6089 !
  6090 
  6091 removeView:aView
  6092     "removes a view"
  6093 
  6094     |item prnt|
  6095 
  6096     ((item := self itemOfView:aView) notNil and:[(prnt := item parent) notNil]) ifTrue:[
  6097         aView destroy.
  6098         prnt contents view sizeChanged:nil.
  6099         model remove:item
  6100     ]
  6101 
  6102 
  6103 ! !
  6104 
  6105 !UIPainter::TreeView methodsFor:'building'!
  6106 
  6107 generateFullSpecForComponents:aSpecArray named:specNameSymbol
  6108     "generates a full spec from aSpecArray"
  6109 
  6110     |fullSpec winSpec|
  6111 
  6112     fullSpec := FullSpec new.
  6113     fullSpec name:specNameSymbol.
  6114 
  6115     fullSpec fromBuilder:(self canvas)
  6116               components:(SpecCollection new collection:aSpecArray).
  6117 
  6118     winSpec := fullSpec window.
  6119     windowSpec isNil ifTrue:[
  6120         "/ kludge: if grid was on, its now present in the windowSpec (which should not)
  6121         self canvas gridShown ifTrue:[
  6122             fullSpec window backgroundColor:nil.    
  6123         ].
  6124     ] ifFalse:[
  6125         winSpec copyValuesFromSpec:windowSpec.
  6126     ].    
  6127     winSpec name: winSpec label.
  6128     ^ fullSpec.
  6129 !
  6130 
  6131 setAttributesFromWindowSpec:aWindowSpec
  6132     "sets a window spec from aWindowSpec and applies some attributes
  6133      to the canvas."
  6134 
  6135     |name canvasView builder|
  6136 
  6137     windowSpec := (self windowSpecClass) new copyValuesFromSpec:aWindowSpec.
  6138     canvasView := self canvas.
  6139 
  6140     builder := UIBuilder new isEditing:true.
  6141     aWindowSpec setAttributesIn:canvasView with:builder.
  6142 
  6143     name := aWindowSpec label.
  6144     canvasView topView name:name.
  6145     self canvasNameChanged:name.
  6146     self application treeSelectionChanged.
  6147 ! !
  6148 
  6149 !UIPainter::TreeView methodsFor:'canvas selection'!
  6150 
  6151 canvasSelection:aSelection
  6152     "canvas changed its selection
  6153     "
  6154     |sel list size|
  6155 
  6156     ((sel := aSelection) isNil or:[sel isCollection]) ifFalse:[
  6157         sel := Array with:sel
  6158     ].
  6159 
  6160     (size := sel size) ~~ 0 ifTrue:[
  6161         list := OrderedCollection new:size.
  6162 
  6163         sel do:[:aView|
  6164             |item|
  6165 
  6166             (item := self itemOfView:aView) notNil ifTrue:[
  6167                 list add:item.
  6168                 model doMakeVisible:item.
  6169             ]
  6170         ].
  6171         sel := list collect:[:anItem| self indexOfNode:anItem ].
  6172     ].
  6173     self canvasEventsDisabledDo:[ self selection:sel ].            
  6174 !
  6175 
  6176 canvasSelectionAdd:aView
  6177     "canvas adds a view to current selection
  6178     "
  6179     |item index oldSel|
  6180 
  6181     item := self itemOfView:aView.
  6182 
  6183     item notNil ifTrue:[
  6184         model doMakeVisible:item.
  6185 
  6186         (index := self indexOfNode:item) ~~ 0 ifTrue:[
  6187             oldSel := selection copy.
  6188             self addToSelection:index.
  6189             self selectionChangedFrom:oldSel
  6190         ]        
  6191     ]            
  6192 !
  6193 
  6194 canvasSelectionRemove:aView
  6195     "canvas removes a view from current selection
  6196     "
  6197     |item index oldSel|
  6198 
  6199     (     (item := self itemOfView:aView) notNil
  6200      and:[(index := self indexOfNode:item) ~~ 0
  6201      and:[self isInSelection:index]]
  6202     ) ifTrue:[
  6203         oldSel := selection copy.
  6204         self removeFromSelection:index.
  6205         self selectionChangedFrom:oldSel.
  6206     ].
  6207 !
  6208 
  6209 selectedViews
  6210     ^ self selection 
  6211         collect:[:index |
  6212             |node view|
  6213 
  6214             node := listOfNodes at:index.
  6215             view := node contents view.
  6216             view
  6217         ]
  6218 ! !
  6219 
  6220 !UIPainter::TreeView methodsFor:'change & update'!
  6221 
  6222 canvasNameChanged:aName
  6223     "called if identification name assigned to window (canvas) changed
  6224     "
  6225     |name node|
  6226 
  6227     node := listOfNodes at:1.
  6228 
  6229     (    aName size ~~ 0
  6230      and:[(name := aName string withoutSeparators) size ~~ 0
  6231      and:[(self propertyDetect:[:p| p name = name]) isNil
  6232      and:[node name ~= name]]]
  6233     ) ifTrue:[
  6234         node name: name asBoldText.
  6235         node changed.   
  6236     ].
  6237 !
  6238 
  6239 layoutChanged
  6240     "layout of any component changed; in case of single selection, the
  6241      application will be informed to update its layout
  6242     "
  6243     selection size == 1 ifTrue:[
  6244         self application layoutChanged
  6245     ]
  6246 
  6247 
  6248 !
  6249 
  6250 propertyChanged:aProperty
  6251     "property of view derived from argument a property changed
  6252     "
  6253     |item idx end|
  6254 
  6255     item := self itemOfView:(aProperty view).
  6256 
  6257     item notNil ifTrue:[
  6258         item contents:aProperty.
  6259 
  6260         item name = aProperty name ifFalse:[
  6261             idx := self firstLineShown.
  6262 
  6263             (end := self lastLineShown) > listOfNodes size ifTrue:[
  6264                 end := listOfNodes size
  6265             ].                          
  6266             item changed.   
  6267 
  6268             [idx <= end] whileTrue:[
  6269                 (listOfNodes at:idx) == item ifTrue:[
  6270                     self redrawLine:idx.                "/ is visible; redraw line
  6271                     end := 0
  6272                 ] ifFalse:[
  6273                     idx := idx + 1
  6274                 ]
  6275             ]
  6276         ].
  6277 
  6278         self selectedNode == item ifTrue:[              "/ inform application
  6279             self application propertyChanged
  6280         ]
  6281     ].
  6282 
  6283 
  6284 ! !
  6285 
  6286 !UIPainter::TreeView methodsFor:'drag & drop'!
  6287 
  6288 canDrop:aDropContext
  6289     "can drop ? -> delegate to canvas"
  6290 
  6291     ^ self canvas canDrop:aDropContext
  6292 
  6293     "Modified: / 13-10-2006 / 16:08:43 / cg"
  6294 !
  6295 
  6296 canDrop:aDropContext at:aPoint
  6297     "can drop ? -> delegate to canvas"
  6298 
  6299     ^ self canvas canDrop:aDropContext at:aPoint
  6300 
  6301     "Created: / 13-10-2006 / 12:35:53 / cg"
  6302     "Modified: / 13-10-2006 / 16:08:46 / cg"
  6303 !
  6304 
  6305 canDropObjects:aCollectionOfDropObjects
  6306     "can drop ? -> delegate to canvas"
  6307 
  6308     ^ self canvas canDropObjects:aCollectionOfDropObjects
  6309 
  6310     "Created: / 13-10-2006 / 16:08:31 / cg"
  6311 !
  6312 
  6313 canDropObjects:aCollectionOfDropObjects at:aPoint
  6314     "can drop ? -> delegate to canvas"
  6315 
  6316     ^ self canvas canDropObjects:aCollectionOfDropObjects at:aPoint
  6317 
  6318     "Created: / 13-10-2006 / 16:08:35 / cg"
  6319 !
  6320 
  6321 drop:aDropContext
  6322     "drop objects -> delegate to canvas"
  6323 
  6324     self canvas drop:aDropContext
  6325 
  6326     "Created: / 13-10-2006 / 12:35:59 / cg"
  6327     "Modified: / 13-10-2006 / 16:09:04 / cg"
  6328 !
  6329 
  6330 drop:aDropContext at:aPoint
  6331     "drop objects -> delegate to canvas"
  6332 
  6333     self canvas drop:aDropContext at:nil
  6334 
  6335     "Modified: / 13-10-2006 / 16:09:07 / cg"
  6336 !
  6337 
  6338 dropObjects:aCollectionOfDropObjects
  6339     "drop objects -> delegate to canvas"
  6340 
  6341     self canvas dropObjects:aCollectionOfDropObjects
  6342 
  6343     "Created: / 13-10-2006 / 16:08:51 / cg"
  6344 !
  6345 
  6346 dropObjects:aCollectionOfDropObjects at:aPoint
  6347     "drop objects -> delegate to canvas"
  6348 
  6349     self canvas dropObjects:aCollectionOfDropObjects at:nil
  6350 
  6351     "Created: / 13-10-2006 / 16:08:56 / cg"
  6352 ! !
  6353 
  6354 !UIPainter::TreeView methodsFor:'enumerating'!
  6355 
  6356 allItemsDo:aOneArgBlock
  6357     "evaluates the argument a block on each item other than the canvas"
  6358 
  6359     model root allChildrenDo:aOneArgBlock
  6360 
  6361 
  6362 ! !
  6363 
  6364 !UIPainter::TreeView methodsFor:'event handling'!
  6365 
  6366 canvasEventsDisabledDo:aBlock
  6367     "evaluates the block without raising selection changed notifications to canvas"
  6368 
  6369     |restoreCanvasEvents|
  6370 
  6371     restoreCanvasEvents  := canvasEventsDisabled.
  6372     canvasEventsDisabled := true.
  6373     aBlock value.
  6374     canvasEventsDisabled := restoreCanvasEvents.
  6375 !
  6376 
  6377 doubleClicked
  6378     "disables collapsing of the root item"
  6379 
  6380     self selectedNode == model root ifFalse:[
  6381         super doubleClicked
  6382     ]
  6383 
  6384 
  6385 !
  6386 
  6387 redrawLabelAt:x y:yTop index:anIndex
  6388     "draws a tiny rectangle for indicating the master node (first selected node)"
  6389 
  6390     |dX|
  6391 
  6392     super redrawLabelAt:x y:yTop index:anIndex.
  6393 
  6394     ((selection size > 1) and: [selection first == anIndex]) ifTrue:[
  6395         dX := textInset - 1.
  6396         self paint:(Color red). "/ self application painter handleMasterColor.
  6397         self fillRectangleX:(x - dX - 2)
  6398                           y:yTop + ((fontHeight - dX) // 2)
  6399                       width:dX
  6400                      height:dX
  6401     ]
  6402 ! !
  6403 
  6404 !UIPainter::TreeView methodsFor:'initialization'!
  6405 
  6406 iconForNode:aNode
  6407     |spec|       
  6408 
  6409     spec := aNode contents spec.
  6410     spec isNil ifTrue: [
  6411         ^ WindowSpec icon
  6412     ] ifFalse:[
  6413         ^ spec icon
  6414     ]
  6415 !
  6416 
  6417 initialize
  6418     "initialize the tree view; multiple select and tree item actions"
  6419 
  6420     super initialize.
  6421 
  6422     self multipleSelectOk:true.
  6423     canvasEventsDisabled := false.
  6424     self showDirectoryIndicator: true.
  6425     self showDirectoryIndicatorForRoot: false.
  6426 
  6427     self model 
  6428         iconAction:[:aNode| self iconForNode:aNode];
  6429         labelAction: [:aNode | self labelForNode:aNode].
  6430 !
  6431 
  6432 labelForNode:aNode
  6433     |spec|
  6434 
  6435     spec := aNode contents spec.
  6436     spec notNil ifTrue: [
  6437         ^ self nameForSpecInList:spec
  6438     ] ifFalse:[
  6439         ^ aNode name
  6440     ]
  6441 ! !
  6442 
  6443 !UIPainter::TreeView methodsFor:'private'!
  6444 
  6445 nameForSpecInList:aSpec
  6446     "returns the tree item label for aSpec"
  6447 
  6448     |aspect aspectPrefix nameString viewClassString|
  6449 
  6450     nameString := aSpec name ? ''.
  6451     viewClassString := '[',aSpec viewClass name,']' .
  6452 
  6453     aspect := aSpec nameOfMainAspect.
  6454     aspect notNil ifTrue:[
  6455         aspectPrefix := '(',aspect allBold ,') '
  6456     ] ifFalse:[
  6457         aspectPrefix := ''.
  6458     ].
  6459 
  6460     ^ aspectPrefix, nameString, ': ', viewClassString
  6461 
  6462     "Modified: / 17-08-2011 / 09:10:31 / cg"
  6463 !
  6464 
  6465 selectionChangedFrom:oldSelection
  6466     "selection has changed. update master selection and raise notification
  6467      to canvas in case of enabled cvs events
  6468     "
  6469     |sel size|
  6470 
  6471     super selectionChangedFrom:oldSelection.
  6472     size := selection size.
  6473 
  6474     canvasEventsDisabled ifFalse:[
  6475         (size ~~ 0 and:[size ~~ 1 or:[selection first ~~ 1]]) ifTrue:[
  6476             sel := OrderedCollection new.
  6477 
  6478             selection do:[:i|
  6479                 i ~~ 1 ifTrue:[sel add:(listOfNodes at:i) contents view]
  6480             ]
  6481         ].
  6482         self canvas updateSelectionFromModel:sel
  6483     ].             
  6484     size = 1 ifTrue:[
  6485         oldSelection size > 1 ifTrue: [
  6486             (listOfNodes at:lastDrawnMaster) retrieveLabel.
  6487             self redrawLine: lastDrawnMaster. 
  6488             lastDrawnMaster := selection first
  6489         ]
  6490     ].
  6491     size > 1 ifTrue:[
  6492         selection first ~~ lastDrawnMaster ifTrue: [
  6493             (listOfNodes at:selection first) retrieveLabel.
  6494             lastDrawnMaster notNil ifTrue: [(listOfNodes at:lastDrawnMaster) retrieveLabel].
  6495             self redrawLine: lastDrawnMaster. 
  6496             self redrawLine: (lastDrawnMaster := selection first)
  6497         ]
  6498     ]         
  6499     ifFalse: [
  6500         lastDrawnMaster := nil
  6501     ] 
  6502 ! !
  6503 
  6504 !UIPainter::TreeView methodsFor:'queries'!
  6505 
  6506 canChangeOrderInContainer
  6507     "returns true if any selection exists and all widgets in the selection
  6508      can change their layout through to a move or align operation"
  6509 
  6510     ^(selection size == 1)  and: 
  6511     [(selection at: 1) ~~ 1 and:   
  6512     [self selectedNode parent children size > 1]] 
  6513 
  6514 
  6515 !
  6516 
  6517 canExchangeSelectionLayouts 
  6518     "returns true if the selections size is exactly 2
  6519      and all widgets in the selection
  6520      can change their layout through to a move or align operation"
  6521 
  6522     selection size == 2 ifFalse:[
  6523         ^ false
  6524     ].
  6525     ^ self canMoveOrAlignSelection
  6526 !
  6527 
  6528 canMoveOrAlignSelection
  6529     "returns true if any selection exists and all widgets in the selection
  6530      can change their layout through to a move or align operation"
  6531 
  6532     selection isEmptyOrNil ifTrue:[
  6533         ^ false
  6534     ].
  6535 
  6536     selection do:[:i|
  6537         |node view|
  6538 
  6539         i == 1 ifTrue:[
  6540             "/ the tree node for the canvas itself.
  6541             ^ false
  6542         ].
  6543         node := listOfNodes at:i.
  6544         view := node contents view.
  6545         (self canvas canChangeLayoutOfView:view) ifFalse:[
  6546             ^ false
  6547         ]
  6548     ].
  6549     ^ true
  6550 !
  6551 
  6552 canMoveSelectionIntoContainer
  6553     "returns true in case that one widget is selected and can change its container
  6554      widget to an element below"
  6555 
  6556     |item oldParentItem newParentItem idx|
  6557 
  6558     item := self selectedNode.
  6559     (item notNil and:[(oldParentItem := item parent) notNil]) ifTrue:[
  6560         idx := (oldParentItem indexOfChild:item) + 1.
  6561         newParentItem := oldParentItem children detect:[:eachChild|
  6562             eachChild contents spec class supportsSubComponents
  6563         ] startingAt:idx ifNone:nil.
  6564         ^ newParentItem notNil.
  6565     ].
  6566 
  6567     ^ false
  6568 !
  6569 
  6570 canMoveSelectionOutOfContainer
  6571     "returns true in case that one widget is selected which is contained within
  6572      another widget"
  6573 
  6574     |item prnt|
  6575 
  6576     (     (item := self selectedNode) isNil
  6577       or:[(prnt := item parent) isNil
  6578       or:[prnt parent isNil]]
  6579     ) ifTrue:[
  6580         ^ false
  6581     ].
  6582     ^ true
  6583 !
  6584 
  6585 canResizeSelectedWidget
  6586     "returns true in case of one widget selected and is contained
  6587      within a widget which allows to resize sub components"
  6588 
  6589     |selectedNode|
  6590 
  6591     (selectedNode := self selectedNode) notNil ifTrue:[
  6592         (selectedNode := selectedNode parent) notNil ifTrue:[
  6593             ^ (selectedNode parent isNil or:[selectedNode contents spec class canResizeSubComponents])
  6594         ]
  6595     ].
  6596     ^ false
  6597 !
  6598 
  6599 canResizeSelection
  6600     "returns true if all selected widgets can be resized"
  6601 
  6602     selection isEmptyOrNil ifTrue:[ ^ false ].
  6603     ^ self canvas canResize:(self selectedViews)
  6604 !
  6605 
  6606 hasOneSelectionOtherThanCanvas
  6607     "returns true in case that one selection exists other than the canvas"
  6608 
  6609     ^ selection size == 1 and:[selection first ~~ 1]
  6610 !
  6611 
  6612 isCanvasSelected
  6613     "returns true in case of a single selection and the
  6614      selection is the canvas (index 1)"
  6615 
  6616     ^ selection size == 1 and:[self isInSelection:1]
  6617 ! !
  6618 
  6619 !UIPainter::TreeView methodsFor:'searching'!
  6620 
  6621 detectItemCorespondingToView:aView
  6622     "detects the item coresponding to the view. The item of the view or the first
  6623      subview providing the item is returned. If no property is detected nil is
  6624      returned"
  6625 
  6626     |view item|
  6627 
  6628     (view := aView) isNil ifTrue:[ ^ nil ].
  6629 
  6630     [(item := self itemOfView:view) isNil] whileTrue:[
  6631         (view := view superView) isNil ifTrue:[^ listOfNodes at:1]
  6632     ].
  6633     ^ item
  6634 ! !
  6635 
  6636 !UIPainter::TreeView methodsFor:'user interaction'!
  6637 
  6638 askForSelectionChangeAllowed 
  6639     selectConditionBlock notNil ifTrue:[
  6640         ^ selectConditionBlock value:nil 
  6641     ].
  6642     ^ true
  6643 !
  6644 
  6645 doChangeParentOfSelectedItemTo:newParentItem
  6646 
  6647     |canvas|
  6648 
  6649     newParentItem isNil ifTrue:[
  6650         ^ self
  6651     ].
  6652     self askForSelectionChangeAllowed ifFalse:[^ self].    
  6653     self setSelection:nil.
  6654 
  6655     canvas := self canvas.
  6656     canvas deleteSelection.
  6657     canvas setSelection:(newParentItem contents view) withRedraw:false.
  6658     canvas pasteWithLayout.
  6659 !
  6660 
  6661 doSortItems
  6662     "sort items by their top-left position"
  6663 
  6664     |selectedItems parent sortedItems newChildren itemList parentView|
  6665 
  6666     self askForSelectionChangeAllowed ifFalse:[^ self].
  6667 
  6668     selectedItems := self selectedNodes.
  6669     selectedItems size <= 1 ifTrue:[^ self].
  6670     parent := selectedItems first parent.
  6671     (parent isNil or:[(selectedItems conform:[:e| e parent == parent]) not]) ifTrue:[^ self].
  6672 
  6673     sortedItems := selectedItems sort:[:a :b| 
  6674                             a contents view origin isLeftOrAbove:(b contents view origin)].
  6675     itemList := selectedItems asIdentitySet.
  6676 
  6677     newChildren := parent children collect:[:eachChild|
  6678         (itemList includes:eachChild) ifTrue:[
  6679             sortedItems removeFirst.
  6680         ] ifFalse:[
  6681             eachChild.
  6682         ].
  6683     ].
  6684 
  6685     self setSelection:nil.
  6686     model remove:parent children.
  6687     model add:newChildren beforeIndex:1 below:parent.
  6688 
  6689     parentView := parent contents view.
  6690 
  6691     self canvas hideSelection.
  6692     newChildren keysAndValuesDo:[:idx :eachItem|
  6693         parentView changeSequenceOrderFor:eachItem contents view to:idx.
  6694     ].
  6695     parentView specClass isLayoutContainer ifFalse:[
  6696         parentView components notEmptyOrNil ifTrue:[ self halt ].
  6697         parentView subViews do:[:v| v raise ].
  6698     ].
  6699     self canvas showSelection.
  6700 
  6701     self selectNodes:itemList asOrderedCollection.
  6702 !
  6703