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