MenuEditor.st
author Claus Gittinger <cg@exept.de>
Wed, 29 Jul 2009 20:02:02 +0200
changeset 2570 4e663bc64364
parent 2569 b55aeaecefda
child 2580 1ed737f4f840
permissions -rw-r--r--
changed #requestPackage
ca@199
     1
"
tz@738
     2
 COPYRIGHT (c) 1997 by eXept Software AG
ca@1606
     3
	      All Rights Reserved
ca@199
     4
ca@199
     5
 This software is furnished under a license and may be used
ca@199
     6
 only in accordance with the terms of that license and with the
tz@738
     7
 inclusion of the above copyright notice. This software may not
ca@199
     8
 be provided or otherwise made available to, or used by, any
ca@199
     9
 other person.  No title to or ownership of the software is
ca@199
    10
 hereby transferred.
ca@199
    11
"
cg@1372
    12
"{ Package: 'stx:libtool2' }"
cg@1372
    13
tz@738
    14
ResourceSpecEditor subclass:#MenuEditor
ca@1606
    15
	instanceVariableNames:'selectionHolder tabHolder listOfItems listOfTabs
ca@1618
    16
		selectedSuperItems notifyDisabledCounter wizards listOfItemsView
cg@2569
    17
		dropOverLine savedSpec'
ca@1462
    18
	classVariableNames:'ImageRetrieverClasses'
ca@220
    19
	poolDictionaries:''
ca@220
    20
	category:'Interface-UIPainter'
ca@199
    21
!
ca@199
    22
ca@1606
    23
HierarchicalItem subclass:#Item
ca@1606
    24
	instanceVariableNames:'menuItem'
cg@1407
    25
	classVariableNames:''
cg@1407
    26
	poolDictionaries:''
cg@1407
    27
	privateIn:MenuEditor
cg@1407
    28
!
cg@1407
    29
cg@1631
    30
MenuEditor::Item subclass:#ActionItem
sv@1454
    31
	instanceVariableNames:''
sv@1454
    32
	classVariableNames:''
sv@1454
    33
	poolDictionaries:''
sv@1454
    34
	privateIn:MenuEditor
sv@1454
    35
!
sv@1454
    36
cg@1631
    37
MenuEditor::Item subclass:#LinkedMenuItem
ca@1606
    38
	instanceVariableNames:''
ca@1606
    39
	classVariableNames:''
ca@1606
    40
	poolDictionaries:''
ca@1606
    41
	privateIn:MenuEditor
ca@1606
    42
!
ca@1606
    43
ca@1844
    44
MenuEditor::Item subclass:#MenuSliceItem
ca@1844
    45
	instanceVariableNames:''
ca@1844
    46
	classVariableNames:''
ca@1844
    47
	poolDictionaries:''
ca@1844
    48
	privateIn:MenuEditor
ca@1844
    49
!
ca@1844
    50
ca@1633
    51
MenuEditor::Item subclass:#RegularMenuItem
ca@1606
    52
	instanceVariableNames:''
ca@1606
    53
	classVariableNames:''
ca@1606
    54
	poolDictionaries:''
ca@1606
    55
	privateIn:MenuEditor
ca@1606
    56
!
ca@1606
    57
ca@1606
    58
ApplicationModel subclass:#ResourceEditor
ca@1606
    59
	instanceVariableNames:'selectorHolder iconAndLabelHolder retrieverHolder imageHolder
ca@1606
    60
		imageList imageViewer'
ca@1606
    61
	classVariableNames:''
ca@1606
    62
	poolDictionaries:''
ca@1606
    63
	privateIn:MenuEditor
ca@1606
    64
!
ca@1606
    65
ca@1606
    66
HierarchicalItem subclass:#ResourceEditorItem
ca@1606
    67
	instanceVariableNames:'selector icon'
ca@1606
    68
	classVariableNames:''
ca@1606
    69
	poolDictionaries:''
ca@1606
    70
	privateIn:MenuEditor
ca@1606
    71
!
ca@1606
    72
ca@1633
    73
MenuEditor::RegularMenuItem subclass:#RootItem
cg@1631
    74
	instanceVariableNames:''
cg@1631
    75
	classVariableNames:''
cg@1631
    76
	poolDictionaries:''
cg@1631
    77
	privateIn:MenuEditor
cg@1631
    78
!
cg@1631
    79
cg@1631
    80
MenuEditor::Item subclass:#SeparatorItem
cg@1631
    81
	instanceVariableNames:''
cg@1631
    82
	classVariableNames:''
cg@1631
    83
	poolDictionaries:''
cg@1631
    84
	privateIn:MenuEditor
cg@1631
    85
!
cg@1631
    86
ca@199
    87
!MenuEditor class methodsFor:'documentation'!
ca@199
    88
ca@199
    89
copyright
ca@199
    90
"
tz@738
    91
 COPYRIGHT (c) 1997 by eXept Software AG
ca@1606
    92
	      All Rights Reserved
ca@199
    93
ca@199
    94
 This software is furnished under a license and may be used
ca@199
    95
 only in accordance with the terms of that license and with the
tz@738
    96
 inclusion of the above copyright notice. This software may not
ca@199
    97
 be provided or otherwise made available to, or used by, any
ca@199
    98
 other person.  No title to or ownership of the software is
ca@199
    99
 hereby transferred.
ca@199
   100
"
ca@199
   101
!
ca@199
   102
ca@199
   103
documentation
ca@199
   104
"
tz@728
   105
    The MenuEditor allows you to create, modify or just inspect
ca@1606
   106
    menus.
ca@1606
   107
ca@1606
   108
ca@1606
   109
    [Instance variables:]
ca@1606
   110
cg@2188
   111
	listOfItemsView         <HierarcicalListView>  the view which shows the list of items
cg@2188
   112
	listOfItems             <HierarchicalList>     hierarchical list of menu items
cg@2188
   113
	listOfTabs              <List>                 list of current shown tab-labels
cg@2188
   114
cg@2188
   115
	selectionHolder         <ValueHolder>          collection of current selected items
cg@2188
   116
	selectedSuperItems      <Collection>           collection of superItems derived from selection
cg@2188
   117
cg@2188
   118
	tabHolder               <ValueHolder>          selected tab label holder
cg@2188
   119
	notifyDisabledCounter   <SmallInteger>         ~~ 0 than change notifications are discard
cg@2188
   120
	wizards                 <IdentityDictionary>   keeps all created wizard dialogs
cg@2188
   121
cg@2188
   122
	dropOverLine            <nil or SmallInteger>  nil: drop context not dropabel.
cg@2188
   123
						       = 0: drop context dropable but no item specified
cg@2188
   124
						       ~ 0: drop context dropable for item at lineNumber
cg@2188
   125
						       used t6o restore drop indication drawings
cg@2188
   126
ca@1606
   127
    [Class variables:]
cg@2188
   128
	ImageRetrieverClasses   <Collection>        sorted collection of image receivers
ca@199
   129
ca@199
   130
    [start with:]
cg@2188
   131
	MenuEditor open
cg@2188
   132
	MenuEditor openOnClass:MenuEditor andSelector:#menu
ca@199
   133
ca@199
   134
    [author:]
cg@2188
   135
	Claus Atzkern, eXept Software AG
cg@2188
   136
	Thomas Zwick, eXept Software AG
ca@199
   137
"
ca@199
   138
! !
ca@199
   139
ca@1462
   140
!MenuEditor class methodsFor:'initialization'!
ca@1462
   141
ca@1462
   142
initialize
cg@2188
   143
    ImageRetrieverClasses := #(
ca@1606
   144
				Icon
cg@2188
   145
				SystemBrowser
ca@1606
   146
				ToolbarIconLibrary
cg@2188
   147
			      ).
cg@1546
   148
cg@1546
   149
    "
cg@1546
   150
     self initialize
cg@1546
   151
    "
ca@1462
   152
! !
ca@1462
   153
tz@728
   154
!MenuEditor class methodsFor:'instance creation'!
tz@728
   155
tz@728
   156
openModalOnMenu: aMenu
ca@1606
   157
    "Open a MenuEditor modal on aMenu
ca@1606
   158
     self openModalOnMenu: (self perform: #menu) decodeAsLiteralArray
tz@734
   159
    "
ca@1606
   160
    ^self new openModalOnMenu:aMenu
tz@508
   161
! !
tz@508
   162
ca@1462
   163
!MenuEditor class methodsFor:'accessing image retriever'!
ca@1462
   164
ca@1462
   165
addNewImageRetriever:aSymbolOrClass
cg@1546
   166
    "add a class to the imageRetriever list"
cg@1546
   167
ca@1462
   168
    |key|
ca@1462
   169
cg@1546
   170
    aSymbolOrClass isBehavior ifTrue:[
ca@1606
   171
	key := aSymbolOrClass nameWithNameSpacePrefix
cg@1546
   172
    ] ifFalse:[
ca@1606
   173
	key := aSymbolOrClass
ca@1462
   174
    ].
ca@1463
   175
ca@1462
   176
    key size ~~ 0 ifTrue:[
ca@1606
   177
	key := key asSymbol.
ca@1606
   178
ca@1606
   179
	(ImageRetrieverClasses includes:key) ifFalse:[
ca@1606
   180
	    ImageRetrieverClasses := ImageRetrieverClasses asOrderedCollection.
ca@1606
   181
	    ImageRetrieverClasses add:key.
ca@1606
   182
	    ImageRetrieverClasses sort.
ca@1606
   183
	]
ca@1462
   184
    ].
ca@1462
   185
!
ca@1462
   186
ca@1462
   187
imageRetrieverClasses
ca@1462
   188
    "returns a collection of image retrievers
ca@1462
   189
    "
ca@1462
   190
    ^ ImageRetrieverClasses
ca@1462
   191
! !
ca@1462
   192
tz@633
   193
!MenuEditor class methodsFor:'aspects'!
tz@633
   194
tz@633
   195
aspects
tz@728
   196
    "get the aspects for the attributes of the menu components"
tz@728
   197
tz@728
   198
    ^#(
cg@2188
   199
	rawLabel
cg@2188
   200
	accessCharacterPosition
cg@2188
   201
	showBusyCursorWhilePerforming
cg@2188
   202
	horizontalLayout
cg@2188
   203
	triggerOnDown
cg@2188
   204
	font
cg@2188
   205
	argument
cg@2188
   206
	submenuChannel
cg@2188
   207
	keepLinkedMenu
cg@2188
   208
	enabled
cg@2188
   209
	itemValue
cg@2188
   210
	nameKey
cg@2188
   211
	indication
cg@2188
   212
	choice
cg@2188
   213
	choiceValue
cg@2188
   214
	translateLabel
cg@2188
   215
	isButton
cg@2188
   216
	shortcutKeyCharacter
cg@2188
   217
	startGroup
cg@2188
   218
	isVisible
cg@2188
   219
	hideMenuOnActivated
cg@2188
   220
	auxValue
cg@2188
   221
	activeHelpKey
cg@2188
   222
	resourceRetriever
cg@2188
   223
	sendToOriginator
cg@2188
   224
	ignoreMnemonicKeys
cg@2188
   225
	ignoreShortcutKeys
cg@2188
   226
	isMenuSlice
tz@633
   227
     )
tz@633
   228
! !
tz@633
   229
ca@1606
   230
!MenuEditor class methodsFor:'defaults'!
ca@1606
   231
ca@1606
   232
aboutImage
ca@1606
   233
    "the image to be displayed in my about-box;
ca@1606
   234
     If nil is returned, the ST/X default image is used.
ca@1606
   235
    "
ca@1606
   236
    ^ Image fromFile:'bitmaps/xpmBitmaps/misc_tools/setup_menus.xpm'
ca@1606
   237
!
ca@1606
   238
ca@1606
   239
resourceType
ca@1606
   240
    "get the type of the resource of the method generated by the MenuEditor
ca@1606
   241
    "
ca@1606
   242
    ^ #menu
ca@1606
   243
! !
ca@1606
   244
ca@371
   245
!MenuEditor class methodsFor:'help specs'!
ca@371
   246
cg@1545
   247
flyByHelpSpec
cg@1629
   248
    ^super flyByHelpSpec addPairsFrom:(self localFlyHelpSpecStrings)
cg@1545
   249
!
cg@1545
   250
ca@371
   251
helpSpec
cg@1690
   252
    "This resource specification was automatically generated
cg@1690
   253
     by the UIHelpTool of ST/X."
cg@1690
   254
cg@1690
   255
    "Do not manually edit this!! If it is corrupted,
cg@1690
   256
     the UIHelpTool may not be able to read the specification."
cg@1690
   257
cg@1690
   258
    "
cg@2188
   259
     UIHelpTool openOnClass:MenuEditor
cg@1690
   260
    "
cg@1690
   261
cg@1690
   262
    <resource: #help>
cg@1690
   263
cg@1690
   264
    ^ super helpSpec addPairsFrom:#(
cg@1690
   265
cg@1690
   266
#addDelayedMenu
cg@1690
   267
'Add a new delayed menu to item.'
cg@1690
   268
cg@1690
   269
#addDelayedSubMenuLink
cg@1690
   270
'Add a new linked delayed menu to item.'
cg@1690
   271
cg@1690
   272
#addMenuItem
cg@1690
   273
'Add a new menu item.'
cg@1690
   274
cg@1690
   275
#addMenuSeparator
cg@1690
   276
'Add a new menu separator.'
cg@1690
   277
ca@1844
   278
#addMenuSliceItem
ca@1844
   279
'Add a new menu slice.'
ca@1844
   280
cg@1690
   281
#addSubMenu
cg@1690
   282
'Add a new sub menu.'
cg@1690
   283
cg@1690
   284
#addSubMenuLink
cg@1690
   285
'Add a new linked sub menu.'
cg@1690
   286
cg@1690
   287
#basicsAction
cg@1690
   288
'An action selector with 0, 1 (the argument field), or 2 (the selected item) arguments.'
cg@1690
   289
cg@1690
   290
#basicsArgument
cg@1690
   291
'An optional arg passed with above selector, if it is a 1 or 2 arg selector (enter a Smalltalk literal).'
cg@1690
   292
cg@1690
   293
#basicsChoice
cg@1690
   294
'Aspect for a boolean holder, block or method, specifying the choices state (RadioButton behavior).'
cg@1690
   295
cg@1690
   296
#basicsChoiceValue
cg@1690
   297
'That choices value (typically number or symbol).'
cg@1690
   298
cg@1690
   299
#basicsIndication
cg@1690
   300
'Aspect for boolean holder, block, or method, specifying the indication state (CheckToggle behavior).'
cg@1690
   301
cg@1690
   302
#basicsIsButton
cg@1690
   303
'Button-like look and behavior.'
cg@1690
   304
cg@1690
   305
#basicsKey
cg@1690
   306
'Internal key of the item (optional, for programmed accesses).'
cg@1690
   307
cg@1690
   308
#basicsLabel
cg@1690
   309
'Label of the item.'
cg@1690
   310
cg@1690
   311
#basicsMenu
cg@1690
   312
'Aspect providing the sub menu to be opened if item is selected (provide spec or valueHolder).'
cg@1690
   313
cg@1690
   314
#basicsMenuArgument
cg@1690
   315
'An argument passed with the menu selector.'
cg@1690
   316
cg@1690
   317
#basicsNameKey
cg@1690
   318
'Unique identifier of the item (optional).'
cg@1690
   319
cg@1690
   320
#basicsSelector
cg@1690
   321
'Selector under which the generated menu spec is saved.'
cg@1690
   322
cg@1690
   323
#basicsSeparatorType
cg@1690
   324
'List of valid separators.'
cg@1690
   325
cg@1690
   326
#basicsTranslateLabel
cg@1690
   327
'Translate the label via the classes resource file (internationalization).'
cg@1690
   328
cg@1690
   329
#browseResource
cg@1690
   330
'Search for methods with image resource.'
cg@1690
   331
cg@1690
   332
#detailsAccelerator
cg@1690
   333
'Accelerator key to select the menu item from the keyboard (Cmdx or Ctrlx).'
cg@1690
   334
ca@1844
   335
#detailsAccessCharaterPosition
ca@1844
   336
'Index of the access character position of the textual label (obsolete, VW compatibility).'
ca@1844
   337
ca@1844
   338
#detailsAuxValue
ca@1844
   339
'Some additional value - for arbitrary use by the program.'
ca@1844
   340
ca@1844
   341
#detailsEnabled
ca@1844
   342
'Aspect or binding providing a boolean value holder to enable/disable the menu item.'
ca@1844
   343
ca@1778
   344
#detailsIgnoreAcceleratorKeys
ca@1778
   345
'Ignore accelerator keys in submenu(s).'
ca@1778
   346
ca@1778
   347
#detailsIgnoreMnemonicKeys
ca@1778
   348
'Ignore mnemonic keys (access characters) in submenu(s).'
ca@1778
   349
cg@1690
   350
#detailsStartGroup
cg@2123
   351
'Specify start of a specially aligned group.'
cg@1690
   352
cg@1690
   353
#detailsVisibility
cg@1690
   354
'Boolean, or aspect or binding for a boolean holder controlling the visibility of the menu item.'
cg@1690
   355
cg@1690
   356
#fileLoad
cg@1690
   357
'Load a menu spec from a class.'
cg@1690
   358
cg@1690
   359
#fileNew
cg@1690
   360
'Create a new menu spec.'
cg@1690
   361
cg@1690
   362
#filePickAMenu
cg@1690
   363
'Select a menu from an open view and read its specification'
cg@1690
   364
cg@2331
   365
#fileChooseAMenu
cg@2331
   366
'Select a menu from an open view and edit its spec-method'
cg@2331
   367
cg@1690
   368
#fileSave
cg@1690
   369
'Save the menu spec (and the help spec, if modified).'
cg@1690
   370
cg@1690
   371
#fileSaveAs
cg@1690
   372
'Open a dialog to save the menu spec (and the help spec, if modified).'
cg@1690
   373
cg@1690
   374
#fileShowMenuSpec
cg@1690
   375
'Opens a Workspace showing the current menu spec.'
cg@1690
   376
cg@1690
   377
#generateAspectMethods
cg@1690
   378
'Generates aspect methods for defined aspect selectors of the menu.'
cg@1690
   379
cg@1690
   380
#hideMenuOnActivated
cg@1702
   381
'If on, the menu hides itself after the item was activated (PopUp/PullDown-Menus only).'
cg@1690
   382
cg@1690
   383
#horizontalLayout
cg@1690
   384
'If on, the submenu organizes its items horizontal insteat of vertical (default).'
cg@1690
   385
cg@1690
   386
#imageImageAndLabel
cg@1690
   387
'Toggle display of both image and textual label.'
cg@1690
   388
cg@1690
   389
#imageImageEditor
cg@1690
   390
'Open an Image Editor on the resource method defined by retriever and selector.'
cg@1690
   391
cg@1690
   392
#imageImageList
cg@1690
   393
'Currently existing image resources.'
cg@1690
   394
cg@1690
   395
#imageRetriever
cg@1702
   396
'Class implementing the image resource method. If unspecified, the application class is taken.'
cg@1690
   397
cg@1690
   398
#imageSelector
cg@1690
   399
'Selector returning an image (sent to above or the application).'
cg@1690
   400
cg@1690
   401
#keepLinkedMenu
cg@2055
   402
'Keep the linked menu after activation (do not destroy; if off, menu is rebuild for every activation).'
cg@1690
   403
cg@1690
   404
#sendToOriginator
cg@1702
   405
'Send action-Message to widget (instead of application); only valid for PopUpMenus.'
cg@1690
   406
cg@1690
   407
#settingsRedefineAspectMethods
cg@1690
   408
'Toggles the permission to overwrite existing aspect methods.'
cg@1690
   409
cg@1690
   410
#showBusyCursorWhilePerforming
cg@1690
   411
'If on, a busy cursor is shown while the items action is performing.'
cg@1690
   412
cg@1690
   413
#triggerOnDown
cg@1702
   414
'If on, the items action is performed on mouse-button press (default is: on button-release).'
cg@1690
   415
cg@1690
   416
)
cg@2055
   417
cg@2123
   418
    "Modified: / 16-10-2006 / 13:20:38 / cg"
ca@1606
   419
!
ca@1606
   420
cg@1629
   421
localFlyHelpSpecStrings
cg@1629
   422
    "This resource specification was automatically generated
cg@1629
   423
     by the UIHelpTool of ST/X."
cg@1629
   424
cg@1629
   425
    "Do not manually edit this!! If it is corrupted,
cg@1629
   426
     the UIHelpTool may not be able to read the specification."
cg@1629
   427
cg@1629
   428
    "
cg@2188
   429
     UIHelpTool openOnClass:MenuEditor
cg@1629
   430
    "
cg@1629
   431
cg@1629
   432
    <resource: #help>
cg@1629
   433
cg@1629
   434
    ^ #(
cg@1629
   435
cg@1820
   436
#editCut
cg@1820
   437
'Cut Item'
cg@1820
   438
cg@1820
   439
#editCopy
cg@1820
   440
'Copy Item'
cg@1820
   441
cg@1820
   442
#editPaste
cg@1820
   443
'Paste Item'
cg@1820
   444
cg@1629
   445
#fileLoad
cg@1886
   446
'Load Menuspec from Method'
cg@1629
   447
cg@1629
   448
#fileSave
cg@1886
   449
'Save Menuspec as Method'
cg@1629
   450
cg@2569
   451
#fileSaveSpec
cg@2569
   452
'Save Menuspec'
cg@2569
   453
cg@1629
   454
#fileSaveAs
cg@1886
   455
'Save Menuspec as Method...'
cg@1629
   456
cg@1629
   457
#addMenuSeparator
cg@1629
   458
'Add Separator'
cg@1629
   459
cg@1629
   460
#addMenuItem
cg@1629
   461
'Add Item'
cg@1629
   462
cg@1891
   463
#addMenuSlice
cg@1891
   464
'Add Menuslice'
cg@1891
   465
cg@1629
   466
#addSubMenu
cg@1629
   467
'Add Submenu'
cg@1629
   468
cg@1629
   469
#addDelayedMenu
cg@1629
   470
'Add Delayed Menu'
cg@1629
   471
cg@1629
   472
#addDelayedSubMenuLink
cg@1891
   473
'Add Delayed Linked Menu'
cg@1629
   474
cg@1629
   475
#addSubMenuLink
cg@1656
   476
'Add Linked Submenu'
cg@1629
   477
cg@1629
   478
#fileNew
cg@1886
   479
'New Menuspec'
cg@1629
   480
)
ca@371
   481
! !
ca@371
   482
tz@734
   483
!MenuEditor class methodsFor:'image specs'!
tz@734
   484
cg@2297
   485
browseActionImage
cg@2297
   486
    <resource: #programImage>
cg@2297
   487
cg@2297
   488
    ^ UIPainter browseActionImage
cg@2297
   489
!
cg@2297
   490
sv@2156
   491
defaultIcon
sv@2156
   492
    <resource: #programImage>
sv@2156
   493
sv@2156
   494
    ^ ToolbarIconLibrary startMenuEditorIcon
sv@2156
   495
!
sv@2156
   496
ca@1606
   497
iconUnknown
ca@1606
   498
    "returns an image used for picked items containing an image
ca@1606
   499
    "
cg@2271
   500
    <resource: #programImage>
ca@1606
   501
ca@1606
   502
    ^ MenuPanelSpec icon
ca@1606
   503
! !
ca@1606
   504
ca@1606
   505
!MenuEditor class methodsFor:'interface specs'!
ca@1606
   506
ca@1606
   507
windowSpec
ca@1606
   508
    "This resource specification was automatically generated
ca@1606
   509
     by the UIPainter of ST/X."
ca@1606
   510
ca@1606
   511
    "Do not manually edit this!! If it is corrupted,
ca@1606
   512
     the UIPainter may not be able to read the specification."
ca@1606
   513
ca@1606
   514
    "
ca@1606
   515
     UIPainter new openOnClass:MenuEditor andSelector:#windowSpec
ca@1606
   516
     MenuEditor new openInterface:#windowSpec
ca@1606
   517
     MenuEditor open
ca@1606
   518
    "
ca@1606
   519
ca@1606
   520
    <resource: #canvas>
ca@1606
   521
cg@2188
   522
    ^
sv@1737
   523
     #(FullSpec
cg@2188
   524
	name: windowSpec
cg@2188
   525
	window:
sv@1737
   526
       (WindowSpec
cg@2188
   527
	  label: 'Menu Editor'
cg@2188
   528
	  name: 'Menu Editor'
cg@2188
   529
	  min: (Point 550 385)
cg@2188
   530
	  bounds: (Rectangle 0 0 574 473)
cg@2188
   531
	  menu: menu
cg@2188
   532
	  icon: defaultIcon
cg@2188
   533
	  returnIsOKInDialog: false
cg@2188
   534
	  escapeIsCancelInDialog: false
cg@2188
   535
	)
cg@2188
   536
	component:
sv@1737
   537
       (SpecCollection
cg@2188
   538
	  collection: (
cg@2188
   539
	   (MenuPanelSpec
cg@2188
   540
	      name: 'toolbar'
cg@2188
   541
	      layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0)
cg@2188
   542
	      tabable: true
cg@2188
   543
	      menu: toolbar
cg@2188
   544
	      showSeparatingLines: true
cg@2188
   545
	    )
cg@2188
   546
	   (VariableHorizontalPanelSpec
cg@2188
   547
	      name: 'mainPanel'
cg@2188
   548
	      layout: (LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0)
cg@2188
   549
	      component:
cg@2188
   550
	     (SpecCollection
cg@2188
   551
		collection: (
cg@2188
   552
		 (HierarchicalListViewSpec
cg@2188
   553
		    name: 'ListOfItemsView'
cg@2188
   554
		    model: selectionHolder
cg@2188
   555
		    menu: editMenu
cg@2188
   556
		    hasHorizontalScrollBar: true
cg@2188
   557
		    hasVerticalScrollBar: true
cg@2188
   558
		    miniScrollerHorizontal: true
cg@2188
   559
		    miniScrollerVertical: true
cg@2188
   560
		    listModel: listOfItems
cg@2188
   561
		    multipleSelectOk: true
cg@2188
   562
		    useIndex: false
cg@2188
   563
		    highlightMode: label
cg@2188
   564
		    doubleClickSelector: indicatorClickedAt:
cg@2188
   565
		    selectConditionSelector: canSelect:
cg@2188
   566
		    showLeftIndicators: false
cg@2188
   567
		    indicatorSelector: indicatorClickedAt:
cg@2188
   568
		    properties:
cg@2188
   569
		   (PropertyListDictionary
cg@2188
   570
		      dropSelector: doDrop:
cg@2188
   571
		      dragArgument: nil
cg@2188
   572
		      dropObjectSelector: dropObjects
cg@2188
   573
		      overSelector: dropOver:
cg@2188
   574
		      dropArgument: nil
cg@2188
   575
		      leaveSelector: dropLeave:
cg@2188
   576
		      canDropSelector: canDrop:
cg@2188
   577
		      enterSelector: dropEnter:
cg@2188
   578
		    )
cg@2188
   579
		    postBuildCallback: postBuildListOfItemsView:
cg@2188
   580
		  )
cg@2188
   581
		 (ViewSpec
cg@2188
   582
		    name: 'Box'
cg@2188
   583
		    level: -1
cg@2188
   584
		    component:
cg@2188
   585
		   (SpecCollection
cg@2188
   586
		      collection: (
cg@2188
   587
		       (NoteBookViewSpec
cg@2188
   588
			  name: 'NoteBook'
cg@2188
   589
			  layout: (LayoutFrame 1 0.0 0 0.0 1 1.0 -30 1.0)
cg@2188
   590
			  enableChannel: hasSingleSelectionChannel
cg@2188
   591
			  tabable: true
cg@2188
   592
			  model: tabHolder
cg@2188
   593
			  menu: listOfTabs
cg@2188
   594
			  fitLastRow: false
cg@2188
   595
			  translateLabel: true
cg@2188
   596
			  canvas: wizardHolder
cg@2188
   597
			  keepCanvasAlive: true
cg@2188
   598
			  postBuildCallback: postBuildNoteBook:
cg@2188
   599
			)
cg@2188
   600
		       (UISubSpecification
cg@2188
   601
			  name: 'SubSpecification'
cg@2188
   602
			  layout: (LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1.0)
cg@2188
   603
			  majorKey: ToolApplicationModel
cg@2188
   604
			  minorKey: windowSpecForCommit
cg@2188
   605
			)
cg@2188
   606
		       )
cg@2188
   607
cg@2188
   608
		    )
cg@2188
   609
		  )
cg@2188
   610
		 )
cg@2188
   611
cg@2188
   612
	      )
cg@2188
   613
	      handles: (Any 0.300493 1.0)
cg@2188
   614
	    )
cg@2188
   615
	   (UISubSpecification
cg@2188
   616
	      name: 'infoBarSubSpec'
cg@2188
   617
	      layout: (LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
cg@2188
   618
	      majorKey: ToolApplicationModel
cg@2188
   619
	      minorKey: windowSpecForInfoBar
cg@2188
   620
	    )
cg@2188
   621
	   )
cg@2188
   622
cg@2188
   623
	)
ca@1606
   624
      )
ca@1606
   625
! !
ca@1606
   626
ca@1606
   627
!MenuEditor class methodsFor:'menu specs'!
ca@1606
   628
ca@1606
   629
addMenu
ca@1606
   630
    "This resource specification was automatically generated
ca@1606
   631
     by the MenuEditor of ST/X."
ca@1606
   632
ca@1606
   633
    "Do not manually edit this!! If it is corrupted,
ca@1606
   634
     the MenuEditor may not be able to read the specification."
ca@1606
   635
ca@1606
   636
    "
ca@1606
   637
     MenuEditor new openOnClass:MenuEditor andSelector:#addMenu
ca@1606
   638
     (Menu new fromLiteralArrayEncoding:(MenuEditor addMenu)) startUp
ca@1606
   639
    "
ca@1606
   640
ca@1606
   641
    <resource: #menu>
ca@1606
   642
cg@2188
   643
    ^
ca@1844
   644
     #(Menu
cg@2275
   645
        (
cg@2275
   646
         (MenuItem
cg@2275
   647
            activeHelpKey: addMenuSeparator
cg@2275
   648
            label: 'Separator'
cg@2275
   649
            itemValue: doCreateSep
cg@2275
   650
            translateLabel: true
cg@2275
   651
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconSeparator '')
cg@2275
   652
          )
cg@2275
   653
         (MenuItem
cg@2275
   654
            activeHelpKey: addMenuItem
cg@2275
   655
            label: 'Item'
cg@2275
   656
            itemValue: doCreateItem
cg@2275
   657
            translateLabel: true
cg@2275
   658
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconItem '')
cg@2275
   659
          )
cg@2275
   660
         (MenuItem
cg@2275
   661
            activeHelpKey: addMenuSliceItem
cg@2275
   662
            label: 'Menu Slice'
cg@2275
   663
            itemValue: doCreateMenuSliceItem
cg@2275
   664
            translateLabel: true
cg@2275
   665
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconSliceMenu '')
cg@2275
   666
          )
cg@2275
   667
         (MenuItem
cg@2275
   668
            activeHelpKey: addMenuItem
cg@2275
   669
            label: 'Menu'
cg@2275
   670
            itemValue: doCreateMenu
cg@2275
   671
            translateLabel: true
cg@2275
   672
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconMenu '')
cg@2275
   673
          )
cg@2275
   674
         (MenuItem
cg@2275
   675
            activeHelpKey: addSubMenuLink
cg@2275
   676
            label: 'Linked Menu'
cg@2275
   677
            itemValue: doCreateLinkedMenu
cg@2275
   678
            translateLabel: true
cg@2275
   679
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconLinkedMenu '')
cg@2275
   680
          )
cg@2275
   681
         (MenuItem
cg@2275
   682
            label: '-'
cg@2275
   683
          )
cg@2275
   684
         (MenuItem
cg@2275
   685
            activeHelpKey: addDelayedMenu
cg@2275
   686
            enabled: canCreateDelayedMenuChannel
cg@2275
   687
            label: 'Delayed Menu'
cg@2275
   688
            itemValue: doCreateDelayedMenu:
cg@2275
   689
            translateLabel: true
cg@2275
   690
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconDelayedMenu '')
cg@2275
   691
            argument: menu
cg@2275
   692
          )
cg@2275
   693
         (MenuItem
cg@2275
   694
            activeHelpKey: addDelayedSubMenuLink
cg@2275
   695
            enabled: canCreateDelayedMenuChannel
cg@2275
   696
            label: 'Delayed Linked Menu'
cg@2275
   697
            itemValue: doCreateDelayedMenu:
cg@2275
   698
            translateLabel: true
cg@2275
   699
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconDelayedLinkedMenu '')
cg@2275
   700
            argument: linkedMenu
cg@2275
   701
          )
cg@2275
   702
         (MenuItem
cg@2275
   703
            label: '-'
cg@2275
   704
          )
cg@2275
   705
         (MenuItem
cg@2275
   706
            label: 'Standard Menus'
cg@2275
   707
            translateLabel: true
cg@2275
   708
            submenuChannel: standardMenus
cg@2275
   709
            keepLinkedMenu: true
cg@2275
   710
          )
cg@2275
   711
         )
cg@2275
   712
"/        nil
cg@2275
   713
"/        nil
ca@1606
   714
      )
ca@1606
   715
!
ca@1606
   716
ca@1606
   717
editMenu
ca@1606
   718
    "This resource specification was automatically generated
ca@1606
   719
     by the MenuEditor of ST/X."
ca@1606
   720
ca@1606
   721
    "Do not manually edit this!! If it is corrupted,
ca@1606
   722
     the MenuEditor may not be able to read the specification."
ca@1606
   723
ca@1606
   724
    "
ca@1606
   725
     MenuEditor new openOnClass:MenuEditor andSelector:#editMenu
ca@1606
   726
     (Menu new fromLiteralArrayEncoding:(MenuEditor editMenu)) startUp
ca@1606
   727
    "
ca@1606
   728
ca@1606
   729
    <resource: #menu>
ca@1606
   730
cg@2275
   731
    ^ 
cg@2186
   732
     #(Menu
cg@2275
   733
        (
cg@2275
   734
         (MenuItem
cg@2275
   735
            activeHelpKey: editCut
cg@2275
   736
            enabled: hasSelectionChannel
cg@2275
   737
            label: 'Cut'
cg@2275
   738
            itemValue: doCut
cg@2275
   739
            translateLabel: true
cg@2275
   740
            shortcutKey: Cut
cg@2275
   741
          )
cg@2275
   742
         (MenuItem
cg@2275
   743
            activeHelpKey: editCopy
cg@2275
   744
            enabled: hasSelectionChannel
cg@2275
   745
            label: 'Copy'
cg@2275
   746
            itemValue: doCopy
cg@2275
   747
            translateLabel: true
cg@2275
   748
            shortcutKey: Copy
cg@2275
   749
          )
cg@2275
   750
         (MenuItem
cg@2275
   751
            activeHelpKey: editPaste
cg@2275
   752
            enabled: canPasteHolder
cg@2275
   753
            label: 'Paste'
cg@2275
   754
            itemValue: doPaste
cg@2275
   755
            translateLabel: true
cg@2275
   756
            shortcutKey: Paste
cg@2275
   757
          )
cg@2275
   758
         (MenuItem
cg@2275
   759
            activeHelpKey: editDelete
cg@2275
   760
            enabled: hasSelectionChannel
cg@2275
   761
            label: 'Delete'
cg@2275
   762
            itemValue: doDelete
cg@2275
   763
            translateLabel: true
cg@2275
   764
            isVisible: false
cg@2275
   765
          )
cg@2275
   766
         (MenuItem
cg@2275
   767
            label: '-'
cg@2275
   768
          )
cg@2275
   769
         (MenuItem
cg@2275
   770
            activeHelpKey: editMoveUp
cg@2275
   771
            enabled: enableMovingUpOrDownHolder
cg@2275
   772
            label: 'Move Up'
cg@2275
   773
            itemValue: doMoveUpOrDown:
cg@2275
   774
            translateLabel: true
cg@2275
   775
            startGroup: right
cg@2275
   776
            shortcutKey: CtrlCursorUp
cg@2275
   777
            labelImage: (ResourceRetriever Icon upIcon 'Move Up')
cg@2275
   778
            argument: up
cg@2275
   779
          )
cg@2275
   780
         (MenuItem
cg@2275
   781
            activeHelpKey: editMoveDown
cg@2275
   782
            enabled: enableMovingUpOrDownHolder
cg@2275
   783
            label: 'Move Down'
cg@2275
   784
            itemValue: doMoveUpOrDown:
cg@2275
   785
            translateLabel: true
cg@2275
   786
            shortcutKey: CtrlCursorDown
cg@2275
   787
            labelImage: (ResourceRetriever Icon downIcon 'Move Down')
cg@2275
   788
            argument: down
cg@2275
   789
          )
cg@2275
   790
         (MenuItem
cg@2275
   791
            activeHelpKey: editMoveIn
cg@2275
   792
            enabled: enableMovingInHolder
cg@2275
   793
            label: 'Move Into Next'
cg@2275
   794
            itemValue: doMoveIn:
cg@2275
   795
            translateLabel: true
cg@2275
   796
            shortcutKey: CtrlCursorRight
cg@2275
   797
            labelImage: (ResourceRetriever Icon downRightIcon 'Move Into Next')
cg@2275
   798
            argument: inNext
cg@2275
   799
          )
cg@2275
   800
         (MenuItem
cg@2275
   801
            activeHelpKey: editMoveInAbove
cg@2275
   802
            enabled: enableMovingInAboveHolder
cg@2275
   803
            label: 'Move Into Previous'
cg@2275
   804
            itemValue: doMoveIn:
cg@2275
   805
            translateLabel: true
cg@2275
   806
            labelImage: (ResourceRetriever Icon upRightIcon 'Move Into Previous' )
cg@2275
   807
            argument: inPrev
cg@2275
   808
          )
cg@2275
   809
         (MenuItem
cg@2275
   810
            activeHelpKey: editMoveOut
cg@2275
   811
            enabled: enableMovingOutHolder
cg@2275
   812
            label: 'Move Out'
cg@2275
   813
            itemValue: doMoveOut
cg@2275
   814
            translateLabel: true
cg@2275
   815
            shortcutKey: CtrlCursorLeft
cg@2275
   816
            labelImage: (ResourceRetriever Icon leftDownIcon 'Move Out' )
cg@2275
   817
          )
cg@2275
   818
         )
cg@2275
   819
        nil
cg@2275
   820
        nil
ca@1606
   821
      )
ca@1606
   822
!
ca@1606
   823
cg@2187
   824
editMenuForMainMenuWithoutAccelerators
cg@2187
   825
    "This resource specification was automatically generated
cg@2187
   826
     by the MenuEditor of ST/X."
cg@2187
   827
cg@2187
   828
    "Do not manually edit this!! If it is corrupted,
cg@2187
   829
     the MenuEditor may not be able to read the specification."
cg@2187
   830
cg@2187
   831
    "
cg@2187
   832
     MenuEditor new openOnClass:MenuEditor andSelector:#editMenuForMainMenuWithoutAccelerators
cg@2187
   833
     (Menu new fromLiteralArrayEncoding:(MenuEditor editMenuForMainMenuWithoutAccelerators)) startUp
cg@2187
   834
    "
cg@2187
   835
cg@2187
   836
    <resource: #menu>
cg@2187
   837
cg@2188
   838
    ^
cg@2187
   839
     #(Menu
cg@2188
   840
	(
cg@2188
   841
	 (MenuItem
cg@2188
   842
	    activeHelpKey: editCut
cg@2188
   843
	    enabled: hasSelectionChannel
cg@2188
   844
	    label: 'Cut'
cg@2188
   845
	    itemValue: doCut
cg@2188
   846
	    translateLabel: true
cg@2188
   847
	  )
cg@2188
   848
	 (MenuItem
cg@2188
   849
	    activeHelpKey: editCopy
cg@2188
   850
	    enabled: hasSelectionChannel
cg@2188
   851
	    label: 'Copy'
cg@2188
   852
	    itemValue: doCopy
cg@2188
   853
	    translateLabel: true
cg@2188
   854
	  )
cg@2188
   855
	 (MenuItem
cg@2188
   856
	    activeHelpKey: editPaste
cg@2188
   857
	    enabled: canPasteHolder
cg@2188
   858
	    label: 'Paste'
cg@2188
   859
	    itemValue: doPaste
cg@2188
   860
	    translateLabel: true
cg@2188
   861
	  )
cg@2188
   862
	 (MenuItem
cg@2188
   863
	    activeHelpKey: editDelete
cg@2188
   864
	    enabled: hasSelectionChannel
cg@2188
   865
	    label: 'Delete'
cg@2188
   866
	    itemValue: doDelete
cg@2188
   867
	    translateLabel: true
cg@2188
   868
	    isVisible: false
cg@2188
   869
	  )
cg@2188
   870
	 (MenuItem
cg@2188
   871
	    label: '-'
cg@2188
   872
	  )
cg@2188
   873
	 (MenuItem
cg@2188
   874
	    activeHelpKey: editMoveUp
cg@2188
   875
	    enabled: enableMovingUpOrDownHolder
cg@2188
   876
	    label: 'Move Up'
cg@2188
   877
	    itemValue: doMoveUpOrDown:
cg@2188
   878
	    translateLabel: true
cg@2188
   879
	    startGroup: right
cg@2188
   880
	    labelImage: (ResourceRetriever Icon upIcon 'Move Up')
cg@2188
   881
	    argument: up
cg@2188
   882
	  )
cg@2188
   883
	 (MenuItem
cg@2188
   884
	    activeHelpKey: editMoveDown
cg@2188
   885
	    enabled: enableMovingUpOrDownHolder
cg@2188
   886
	    label: 'Move Down'
cg@2188
   887
	    itemValue: doMoveUpOrDown:
cg@2188
   888
	    translateLabel: true
cg@2188
   889
	    labelImage: (ResourceRetriever Icon downIcon 'Move Down')
cg@2188
   890
	    argument: down
cg@2188
   891
	  )
cg@2188
   892
	 (MenuItem
cg@2188
   893
	    activeHelpKey: editMoveIn
cg@2188
   894
	    enabled: enableMovingInHolder
cg@2188
   895
	    label: 'Move Into Next'
cg@2188
   896
	    itemValue: doMoveIn:
cg@2188
   897
	    translateLabel: true
cg@2188
   898
	    labelImage: (ResourceRetriever Icon downRightIcon 'Move Into Next')
cg@2188
   899
	    argument: inNext
cg@2188
   900
	  )
cg@2188
   901
	 (MenuItem
cg@2188
   902
	    activeHelpKey: editMoveInAbove
cg@2188
   903
	    enabled: enableMovingInAboveHolder
cg@2188
   904
	    label: 'Move Into Previous'
cg@2188
   905
	    itemValue: doMoveIn:
cg@2188
   906
	    translateLabel: true
cg@2188
   907
	    labelImage: (ResourceRetriever Icon upRightIcon 'Move Into Previous')
cg@2188
   908
	    argument: inPrev
cg@2188
   909
	  )
cg@2188
   910
	 (MenuItem
cg@2188
   911
	    activeHelpKey: editMoveOut
cg@2188
   912
	    enabled: enableMovingOutHolder
cg@2188
   913
	    label: 'Move Out'
cg@2188
   914
	    itemValue: doMoveOut
cg@2188
   915
	    translateLabel: true
cg@2188
   916
	    labelImage: (ResourceRetriever Icon leftDownIcon 'Move Out')
cg@2188
   917
	  )
cg@2188
   918
	 )
cg@2188
   919
	nil
cg@2188
   920
	nil
cg@2187
   921
      )
cg@2187
   922
!
cg@2187
   923
ca@1606
   924
fileMenu
ca@1606
   925
    "This resource specification was automatically generated
ca@1606
   926
     by the MenuEditor of ST/X."
ca@1606
   927
ca@1606
   928
    "Do not manually edit this!! If it is corrupted,
ca@1606
   929
     the MenuEditor may not be able to read the specification."
ca@1606
   930
ca@1606
   931
    "
ca@1606
   932
     MenuEditor new openOnClass:MenuEditor andSelector:#fileMenu
ca@1606
   933
     (Menu new fromLiteralArrayEncoding:(MenuEditor fileMenu)) startUp
ca@1606
   934
    "
ca@1606
   935
ca@1606
   936
    <resource: #menu>
ca@1606
   937
cg@2331
   938
    ^ 
cg@1971
   939
     #(Menu
cg@2331
   940
        (
cg@2331
   941
         (MenuItem
cg@2331
   942
            activeHelpKey: fileNew
cg@2331
   943
            label: 'New'
cg@2331
   944
            itemValue: doNew
cg@2331
   945
            translateLabel: true
cg@2331
   946
          )
cg@2331
   947
         (MenuItem
cg@2331
   948
            label: '-'
cg@2331
   949
          )
cg@2331
   950
         (MenuItem
cg@2569
   951
            isVisible: isNotEditingSpecOnly
cg@2331
   952
            activeHelpKey: fileLoad
cg@2331
   953
            label: 'Load...'
cg@2331
   954
            itemValue: doLoad
cg@2331
   955
            translateLabel: true
cg@2331
   956
          )
cg@2331
   957
         (MenuItem
cg@2569
   958
            isVisible: isNotEditingSpecOnly
cg@2331
   959
            label: '-'
cg@2331
   960
          )
cg@2331
   961
         (MenuItem
cg@2569
   962
            isVisible: isEditingSpecOnly
cg@2569
   963
            activeHelpKey: fileSaveSpec
cg@2569
   964
            label: 'Save'
cg@2569
   965
            itemValue: doSave
cg@2569
   966
            translateLabel: true
cg@2569
   967
          )
cg@2569
   968
         (MenuItem
cg@2569
   969
            isVisible: isNotEditingSpecOnly
cg@2331
   970
            activeHelpKey: fileSave
cg@2331
   971
            label: 'Save'
cg@2331
   972
            itemValue: doSave
cg@2331
   973
            translateLabel: true
cg@2331
   974
          )
cg@2331
   975
         (MenuItem
cg@2569
   976
            isVisible: isNotEditingSpecOnly
cg@2331
   977
            activeHelpKey: fileSaveAs
cg@2331
   978
            label: 'Save As...'
cg@2331
   979
            itemValue: doSaveAs
cg@2331
   980
            translateLabel: true
cg@2331
   981
          )
cg@2331
   982
         (MenuItem
cg@2331
   983
            label: '-'
cg@2331
   984
          )
cg@2331
   985
         (MenuItem
cg@2331
   986
            activeHelpKey: filePickAMenu
cg@2331
   987
            label: 'Pick a Menu...'
cg@2331
   988
            itemValue: doPickAMenu
cg@2331
   989
            translateLabel: true
cg@2331
   990
          )
cg@2331
   991
         (MenuItem
cg@2331
   992
            activeHelpKey: fileChooseAMenu
cg@2331
   993
            label: 'Choose a Menu...'
cg@2331
   994
            itemValue: doChooseAMenu
cg@2331
   995
            translateLabel: true
cg@2331
   996
          )
cg@2331
   997
         (MenuItem
cg@2331
   998
            label: '-'
cg@2331
   999
            isVisible: isStandAlone
cg@2331
  1000
          )
cg@2331
  1001
         (MenuItem
cg@2331
  1002
            activeHelpKey: fileBrowseClass
cg@2331
  1003
            enabled: hasValidSpecClass
cg@2331
  1004
            label: 'Browse Class'
cg@2331
  1005
            itemValue: doBrowseClass
cg@2331
  1006
            translateLabel: true
cg@2331
  1007
            isVisible: isStandAlone
cg@2331
  1008
          )
cg@2331
  1009
         (MenuItem
cg@2331
  1010
            activeHelpKey: fileShowMenuSpec
cg@2331
  1011
            label: 'Show Menu Spec'
cg@2331
  1012
            itemValue: doShowMenuSpec
cg@2331
  1013
            translateLabel: true
cg@2331
  1014
            isVisible: isStandAlone
cg@2331
  1015
          )
cg@2331
  1016
         (MenuItem
cg@2331
  1017
            label: '-'
cg@2331
  1018
            isVisible: isStandAlone
cg@2331
  1019
          )
cg@2331
  1020
         (MenuItem
cg@2331
  1021
            activeHelpKey: fileExit
cg@2331
  1022
            label: 'Exit'
cg@2331
  1023
            itemValue: closeRequest
cg@2331
  1024
            translateLabel: true
cg@2331
  1025
            isVisible: isStandAlone
cg@2331
  1026
          )
cg@2331
  1027
         )
cg@2331
  1028
        nil
cg@2331
  1029
        nil
ca@1606
  1030
      )
ca@1606
  1031
!
ca@1606
  1032
ca@1614
  1033
generateMenu
ca@1614
  1034
    "This resource specification was automatically generated
ca@1614
  1035
     by the MenuEditor of ST/X."
ca@1614
  1036
ca@1614
  1037
    "Do not manually edit this!! If it is corrupted,
ca@1614
  1038
     the MenuEditor may not be able to read the specification."
ca@1614
  1039
ca@1614
  1040
    "
ca@1614
  1041
     MenuEditor new openOnClass:MenuEditor andSelector:#generateMenu
ca@1614
  1042
     (Menu new fromLiteralArrayEncoding:(MenuEditor generateMenu)) startUp
ca@1614
  1043
    "
ca@1614
  1044
ca@1614
  1045
    <resource: #menu>
ca@1614
  1046
cg@2188
  1047
    ^
ca@1614
  1048
     #(#Menu
cg@2188
  1049
	#(
cg@2188
  1050
	 #(#MenuItem
cg@2188
  1051
	    #activeHelpKey: #generateAspectMethods
cg@2188
  1052
	    #enabled: #hasValidSpecClass
cg@2188
  1053
	    #label: 'Aspect Methods'
cg@2188
  1054
	    #itemValue: #doGenerateAspectMethods
cg@2188
  1055
	    #translateLabel: true
cg@2188
  1056
	  )
cg@2188
  1057
	 )
cg@2188
  1058
	nil
cg@2188
  1059
	nil
ca@1614
  1060
      )
ca@1614
  1061
!
ca@1614
  1062
ca@1606
  1063
helpMenu
ca@1606
  1064
    "This resource specification was automatically generated
ca@1606
  1065
     by the MenuEditor of ST/X."
ca@1606
  1066
ca@1606
  1067
    "Do not manually edit this!! If it is corrupted,
ca@1606
  1068
     the MenuEditor may not be able to read the specification."
ca@1606
  1069
ca@1606
  1070
    "
ca@1606
  1071
     MenuEditor new openOnClass:MenuEditor andSelector:#helpMenu
ca@1606
  1072
     (Menu new fromLiteralArrayEncoding:(MenuEditor helpMenu)) startUp
ca@1606
  1073
    "
ca@1606
  1074
ca@1606
  1075
    <resource: #menu>
ca@1606
  1076
cg@2188
  1077
    ^
ca@1606
  1078
     #(#Menu
cg@2188
  1079
	#(
cg@2188
  1080
	 #(#MenuItem
cg@2188
  1081
	    #activeHelpKey: #helpTutorial
cg@2188
  1082
	    #label: 'Documentation'
cg@2188
  1083
	    #itemValue: #openHTMLDocument:
cg@2188
  1084
	    #translateLabel: true
cg@2188
  1085
	    #argument: 'tools/uipainter/MenuEditor.html'
cg@2188
  1086
	  )
cg@2188
  1087
	 #(#MenuItem
cg@2188
  1088
	    #label: '-'
cg@2188
  1089
	  )
cg@2188
  1090
	 #(#MenuItem
cg@2188
  1091
	    #activeHelpKey: #helpHelpTool
cg@2188
  1092
	    #label: 'Help Tool'
cg@2188
  1093
	    #itemValue: #openHTMLDocument:
cg@2188
  1094
	    #translateLabel: true
cg@2188
  1095
	    #argument: 'tools/uipainter/HelpTool.html'
cg@2188
  1096
	  )
cg@2188
  1097
	 #(#MenuItem
cg@2188
  1098
	    #label: '-'
cg@2188
  1099
	  )
cg@2188
  1100
	 #(#MenuItem
cg@2188
  1101
	    #activeHelpKey: #helpShowHelp
cg@2188
  1102
	    #label: 'Show Help Texts'
cg@2188
  1103
	    #translateLabel: true
cg@2188
  1104
	    #indication: #showingHelp:
cg@2188
  1105
	  )
cg@2188
  1106
	 #(#MenuItem
cg@2188
  1107
	    #label: '-'
cg@2188
  1108
	  )
cg@2188
  1109
	 #(#MenuItem
cg@2188
  1110
	    #activeHelpKey: #aboutThisAppliaction
cg@2188
  1111
	    #label: 'About MenuEditor...'
cg@2188
  1112
	    #itemValue: #openAboutThisApplication
cg@2188
  1113
	    #translateLabel: true
cg@2188
  1114
	  )
cg@2188
  1115
	 )
cg@2188
  1116
	nil
cg@2188
  1117
	nil
ca@1606
  1118
      )
ca@1606
  1119
!
ca@1606
  1120
ca@1606
  1121
menu
ca@1606
  1122
    "This resource specification was automatically generated
ca@1606
  1123
     by the MenuEditor of ST/X."
ca@1606
  1124
ca@1606
  1125
    "Do not manually edit this!! If it is corrupted,
ca@1606
  1126
     the MenuEditor may not be able to read the specification."
ca@1606
  1127
ca@1606
  1128
    "
ca@1606
  1129
     MenuEditor new openOnClass:MenuEditor andSelector:#menu
ca@1606
  1130
     (Menu new fromLiteralArrayEncoding:(MenuEditor menu)) startUp
ca@1606
  1131
    "
ca@1606
  1132
ca@1606
  1133
    <resource: #menu>
ca@1606
  1134
cg@2355
  1135
    ^ 
ca@1775
  1136
     #(Menu
cg@2355
  1137
        (
cg@2355
  1138
         (MenuItem
cg@2355
  1139
            label: '&File'
cg@2355
  1140
            translateLabel: true
cg@2355
  1141
            submenuChannel: fileMenu
cg@2355
  1142
            keepLinkedMenu: true
cg@2355
  1143
            ignoreMnemonicKeys: true
cg@2355
  1144
            ignoreShortcutKeys: true
cg@2355
  1145
          )
cg@2355
  1146
         (MenuItem
cg@2355
  1147
            label: '&Edit'
cg@2355
  1148
            translateLabel: true
cg@2355
  1149
            submenuChannel: editMenuForMainMenuWithoutAccelerators
cg@2355
  1150
            keepLinkedMenu: true
cg@2355
  1151
          )
cg@2355
  1152
         (MenuItem
cg@2355
  1153
            enabled: hasSingleSelectionChannel
cg@2355
  1154
            label: 'Item'
cg@2355
  1155
            translateLabel: true
cg@2355
  1156
            submenuChannel: addMenu
cg@2355
  1157
            keepLinkedMenu: true
cg@2355
  1158
            ignoreMnemonicKeys: true
cg@2355
  1159
            ignoreShortcutKeys: true
cg@2355
  1160
          )
cg@2355
  1161
         (MenuItem
cg@2569
  1162
            isVisible: isNotEditingSpecOnly
cg@2355
  1163
            label: 'Generate'
cg@2355
  1164
            translateLabel: true
cg@2355
  1165
            submenuChannel: generateMenu
cg@2355
  1166
            keepLinkedMenu: true
cg@2355
  1167
            ignoreMnemonicKeys: true
cg@2355
  1168
            ignoreShortcutKeys: true
cg@2355
  1169
          )
cg@2355
  1170
         (MenuItem
cg@2355
  1171
            label: 'Test'
cg@2355
  1172
            translateLabel: true
cg@2355
  1173
            submenuChannel: submenuTest
cg@2355
  1174
            ignoreMnemonicKeys: true
cg@2355
  1175
            ignoreShortcutKeys: true
cg@2355
  1176
          )
cg@2355
  1177
         (MenuItem
cg@2355
  1178
            label: 'Settings'
cg@2355
  1179
            translateLabel: true
cg@2355
  1180
            submenuChannel: settingsMenu
cg@2355
  1181
            keepLinkedMenu: true
cg@2355
  1182
            ignoreMnemonicKeys: true
cg@2355
  1183
            ignoreShortcutKeys: true
cg@2355
  1184
          )
cg@2355
  1185
         (MenuItem
cg@2355
  1186
            label: 'History'
cg@2355
  1187
            translateLabel: true
cg@2355
  1188
            isVisible: isStandAlone
cg@2355
  1189
            submenuChannel: menuHistory
cg@2355
  1190
            ignoreMnemonicKeys: true
cg@2355
  1191
            ignoreShortcutKeys: true
cg@2355
  1192
          )
cg@2355
  1193
         (MenuItem
cg@2355
  1194
            label: 'MENU_Help'
cg@2355
  1195
            translateLabel: true
cg@2355
  1196
            startGroup: conditionalRight
cg@2355
  1197
            submenuChannel: helpMenu
cg@2355
  1198
            keepLinkedMenu: true
cg@2355
  1199
            ignoreMnemonicKeys: true
cg@2355
  1200
            ignoreShortcutKeys: true
cg@2355
  1201
          )
cg@2355
  1202
         )
cg@2355
  1203
        nil
cg@2355
  1204
        nil
ca@1606
  1205
      )
ca@1606
  1206
!
ca@1606
  1207
cg@1631
  1208
settingsMenu
cg@1631
  1209
    "This resource specification was automatically generated
cg@1631
  1210
     by the MenuEditor of ST/X."
cg@1631
  1211
cg@1631
  1212
    "Do not manually edit this!! If it is corrupted,
cg@1631
  1213
     the MenuEditor may not be able to read the specification."
cg@1631
  1214
cg@1631
  1215
    "
cg@1632
  1216
     MenuEditor new openOnClass:MenuEditor andSelector:#settingsMenu
cg@1632
  1217
     (Menu new fromLiteralArrayEncoding:(MenuEditor settingsMenu)) startUp
cg@1631
  1218
    "
cg@1631
  1219
cg@1631
  1220
    <resource: #menu>
cg@1631
  1221
cg@2188
  1222
    ^
cg@1631
  1223
     #(#Menu
cg@2569
  1224
        #(
cg@2569
  1225
         #(#MenuItem
cg@2569
  1226
            isVisible: isNotEditingSpecOnly
cg@2569
  1227
            #activeHelpKey: #settingsRedefineAspectMethods
cg@2569
  1228
            #enabled: #hasValidSpecClass
cg@2569
  1229
            #label: 'Redefine Aspect Methods'
cg@2569
  1230
            #translateLabel: true
cg@2569
  1231
            #hideMenuOnActivated: false
cg@2569
  1232
            #indication: #redefineAspectMethodsChannel
cg@2569
  1233
          )
cg@2569
  1234
         #(#MenuItem
cg@2569
  1235
            #activeHelpKey: #settingsRedefineAspectMethods
cg@2569
  1236
            #label: 'AutoAccept on Selection-Change'
cg@2569
  1237
            #translateLabel: true
cg@2569
  1238
            #hideMenuOnActivated: false
cg@2569
  1239
            #indication: #autoAcceptOnSelectionChange
cg@2569
  1240
          )
cg@2569
  1241
         )
cg@2569
  1242
        nil
cg@2569
  1243
        nil
cg@1631
  1244
      )
cg@1631
  1245
!
cg@1631
  1246
ca@1606
  1247
standardMenus
ca@1606
  1248
    "This resource specification was automatically generated
ca@1606
  1249
     by the MenuEditor of ST/X."
ca@1606
  1250
ca@1606
  1251
    "Do not manually edit this!! If it is corrupted,
ca@1606
  1252
     the MenuEditor may not be able to read the specification."
ca@1606
  1253
ca@1606
  1254
    "
ca@1606
  1255
     MenuEditor new openOnClass:MenuEditor andSelector:#standardMenus
ca@1606
  1256
     (Menu new fromLiteralArrayEncoding:(MenuEditor standardMenus)) startUp
ca@1606
  1257
    "
ca@1606
  1258
ca@1606
  1259
    <resource: #menu>
ca@1606
  1260
cg@2188
  1261
    ^
ca@1606
  1262
     #(#Menu
cg@2188
  1263
	#(
cg@2188
  1264
	 #(#MenuItem
cg@2188
  1265
	    #label: 'Standard Menu: File'
cg@2188
  1266
	    #itemValue: #doCreateStandardFileMenu
cg@2188
  1267
	    #translateLabel: true
cg@2188
  1268
	  )
cg@2188
  1269
	 #(#MenuItem
cg@2188
  1270
	    #label: 'Standard Menu: Edit'
cg@2188
  1271
	    #itemValue: #doCreateStandardEditMenu
cg@2188
  1272
	    #translateLabel: true
cg@2188
  1273
	  )
cg@2188
  1274
	 #(#MenuItem
cg@2188
  1275
	    #label: 'Standard Menu: Help'
cg@2188
  1276
	    #itemValue: #doCreateStandardHelpMenu
cg@2188
  1277
	    #translateLabel: true
cg@2188
  1278
	  )
cg@2188
  1279
	 )
cg@2188
  1280
	nil
cg@2188
  1281
	nil
ca@1606
  1282
      )
ca@1606
  1283
!
ca@1606
  1284
ca@1606
  1285
toolbar
ca@1606
  1286
    "This resource specification was automatically generated
ca@1606
  1287
     by the MenuEditor of ST/X."
ca@1606
  1288
ca@1606
  1289
    "Do not manually edit this!! If it is corrupted,
ca@1606
  1290
     the MenuEditor may not be able to read the specification."
ca@1606
  1291
ca@1606
  1292
    "
ca@1606
  1293
     MenuEditor new openOnClass:MenuEditor andSelector:#toolbar
ca@1606
  1294
     (Menu new fromLiteralArrayEncoding:(MenuEditor toolbar)) startUp
ca@1606
  1295
    "
ca@1606
  1296
ca@1606
  1297
    <resource: #menu>
ca@1606
  1298
cg@2188
  1299
    ^
cg@1749
  1300
     #(Menu
cg@2569
  1301
        (
cg@2569
  1302
         (MenuItem
cg@2569
  1303
            activeHelpKey: fileNew
cg@2569
  1304
            label: 'New'
cg@2569
  1305
            itemValue: doNew
cg@2569
  1306
            translateLabel: true
cg@2569
  1307
            isButton: true
cg@2569
  1308
            labelImage: (ResourceRetriever ToolbarIconLibrary newMenuIcon)
cg@2569
  1309
          )
cg@2569
  1310
         (MenuItem
cg@2569
  1311
            label: '-'
cg@2569
  1312
          )
cg@2569
  1313
         (MenuItem
cg@2569
  1314
            isVisible: isNotEditingSpecOnly
cg@2569
  1315
            activeHelpKey: fileLoad
cg@2569
  1316
            label: 'Load'
cg@2569
  1317
            itemValue: doLoad
cg@2569
  1318
            translateLabel: true
cg@2569
  1319
            isButton: true
cg@2569
  1320
            submenuChannel: menuHistory
cg@2569
  1321
            labelImage: (ResourceRetriever ToolbarIconLibrary loadFromMethodIcon)
cg@2569
  1322
            keepLinkedMenu: true
cg@2569
  1323
          )
cg@2569
  1324
         (MenuItem
cg@2569
  1325
            isVisible: isNotEditingSpecOnly
cg@2569
  1326
            activeHelpKey: fileSave
cg@2569
  1327
            label: 'Save'
cg@2569
  1328
            itemValue: doSave
cg@2569
  1329
            translateLabel: true
cg@2569
  1330
            isButton: true
cg@2569
  1331
            labelImage: (ResourceRetriever ToolbarIconLibrary saveAsMethodIcon)
cg@2569
  1332
          )
cg@2569
  1333
         (MenuItem  
cg@2569
  1334
            isVisible: isEditingSpecOnly
cg@2569
  1335
            activeHelpKey: fileSaveSpec
cg@2569
  1336
            label: 'Save'
cg@2569
  1337
            itemValue: doSave
cg@2569
  1338
            translateLabel: true
cg@2569
  1339
            isButton: true
cg@2569
  1340
            labelImage: (ResourceRetriever XPToolbarIconLibrary saveImageIcon)
cg@2569
  1341
          )
cg@2569
  1342
         (MenuItem
cg@2569
  1343
            label: '-'
cg@2569
  1344
          )
cg@2569
  1345
         (MenuItem
cg@2569
  1346
            activeHelpKey: editCut
cg@2569
  1347
            enabled: hasSelectionChannel
cg@2569
  1348
            label: 'Cut'
cg@2569
  1349
            itemValue: doCut
cg@2569
  1350
            translateLabel: true
cg@2569
  1351
            isButton: true
cg@2569
  1352
            labelImage: (ResourceRetriever ToolbarIconLibrary cutMenuItemIcon)
cg@2569
  1353
          )
cg@2569
  1354
         (MenuItem
cg@2569
  1355
            activeHelpKey: editCopy
cg@2569
  1356
            enabled: hasSelectionChannel
cg@2569
  1357
            label: 'Copy'
cg@2569
  1358
            itemValue: doCopy
cg@2569
  1359
            translateLabel: true
cg@2569
  1360
            isButton: true
cg@2569
  1361
            labelImage: (ResourceRetriever ToolbarIconLibrary copyMenuItemIcon)
cg@2569
  1362
          )
cg@2569
  1363
         (MenuItem
cg@2569
  1364
            activeHelpKey: editPaste
cg@2569
  1365
            enabled: canPasteHolder
cg@2569
  1366
            label: 'Paste'
cg@2569
  1367
            itemValue: doPaste
cg@2569
  1368
            translateLabel: true
cg@2569
  1369
            isButton: true
cg@2569
  1370
            labelImage: (ResourceRetriever ToolbarIconLibrary pasteMenuItemIcon)
cg@2569
  1371
          )
cg@2569
  1372
         (MenuItem
cg@2569
  1373
            label: '-'
cg@2569
  1374
          )
cg@2569
  1375
         (MenuItem
cg@2569
  1376
            activeHelpKey: addMenuItem
cg@2569
  1377
            enabled: hasSingleSelectionChannel
cg@2569
  1378
            label: 'Add Item'
cg@2569
  1379
            itemValue: doCreateItem
cg@2569
  1380
            translateLabel: true
cg@2569
  1381
            isButton: true
cg@2569
  1382
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconItem)
cg@2569
  1383
          )
cg@2569
  1384
         (MenuItem
cg@2569
  1385
            activeHelpKey: addMenuSeparator
cg@2569
  1386
            enabled: hasSingleSelectionChannel
cg@2569
  1387
            label: 'Add Separator'
cg@2569
  1388
            itemValue: doCreateSep
cg@2569
  1389
            translateLabel: true
cg@2569
  1390
            isButton: true
cg@2569
  1391
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconSeparator)
cg@2569
  1392
          )
cg@2569
  1393
         (MenuItem
cg@2569
  1394
            activeHelpKey: addMenuSlice
cg@2569
  1395
            enabled: hasSingleSelectionChannel
cg@2569
  1396
            label: 'Menu Slice'
cg@2569
  1397
            itemValue: doCreateMenuSliceItem
cg@2569
  1398
            translateLabel: true
cg@2569
  1399
            isButton: true
cg@2569
  1400
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconSliceMenu)
cg@2569
  1401
          )
cg@2569
  1402
         (MenuItem
cg@2569
  1403
            activeHelpKey: addSubMenu
cg@2569
  1404
            enabled: hasSingleSelectionChannel
cg@2569
  1405
            label: 'Add Menu'
cg@2569
  1406
            itemValue: doCreateMenu
cg@2569
  1407
            translateLabel: true
cg@2569
  1408
            isButton: true
cg@2569
  1409
            submenuChannel: standardMenus
cg@2569
  1410
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconMenu)
cg@2569
  1411
            keepLinkedMenu: true
cg@2569
  1412
          )
cg@2569
  1413
         (MenuItem
cg@2569
  1414
            activeHelpKey: addSubMenuLink
cg@2569
  1415
            enabled: hasSingleSelectionChannel
cg@2569
  1416
            label: 'Add Linked Menu'
cg@2569
  1417
            itemValue: doCreateLinkedMenu
cg@2569
  1418
            translateLabel: true
cg@2569
  1419
            isButton: true
cg@2569
  1420
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconLinkedMenu)
cg@2569
  1421
          )
cg@2569
  1422
         (MenuItem
cg@2569
  1423
            activeHelpKey: addDelayedMenu
cg@2569
  1424
            enabled: canCreateDelayedMenuChannel
cg@2569
  1425
            label: 'Add Delayed Menu'
cg@2569
  1426
            itemValue: doCreateDelayedMenu:
cg@2569
  1427
            translateLabel: true
cg@2569
  1428
            isButton: true
cg@2569
  1429
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconDelayedMenu)
cg@2569
  1430
            argument: menu
cg@2569
  1431
          )
cg@2569
  1432
         (MenuItem
cg@2569
  1433
            activeHelpKey: addDelayedSubMenuLink
cg@2569
  1434
            enabled: canCreateDelayedMenuChannel
cg@2569
  1435
            label: 'Add Delayed Linked Menu'
cg@2569
  1436
            itemValue: doCreateDelayedMenu:
cg@2569
  1437
            translateLabel: true
cg@2569
  1438
            isButton: true
cg@2569
  1439
            labelImage: (ResourceRetriever #'MenuEditor::Item' iconDelayedLinkedMenu)
cg@2569
  1440
            argument: linkedMenu
cg@2569
  1441
          )
cg@2569
  1442
         (MenuItem
cg@2569
  1443
            label: ''
cg@2569
  1444
          )
cg@2569
  1445
         (MenuItem
cg@2569
  1446
            activeHelpKey: editMoveUp
cg@2569
  1447
            enabled: enableMovingUpOrDownHolder
cg@2569
  1448
            label: 'Move Up'
cg@2569
  1449
            itemValue: doMoveUp
cg@2569
  1450
            translateLabel: true
cg@2569
  1451
            isButton: true
cg@2569
  1452
            startGroup: right
cg@2569
  1453
            labelImage: (ResourceRetriever Icon upIcon)
cg@2569
  1454
          )
cg@2569
  1455
         (MenuItem
cg@2569
  1456
            activeHelpKey: editMoveDown
cg@2569
  1457
            enabled: enableMovingUpOrDownHolder
cg@2569
  1458
            label: 'Move Down'
cg@2569
  1459
            itemValue: doMoveDown
cg@2569
  1460
            translateLabel: true
cg@2569
  1461
            isButton: true
cg@2569
  1462
            labelImage: (ResourceRetriever Icon downIcon)
cg@2569
  1463
          )
cg@2569
  1464
         (MenuItem
cg@2569
  1465
            activeHelpKey: editMoveIn
cg@2569
  1466
            enabled: enableMovingInHolder
cg@2569
  1467
            label: 'Move Into Next'
cg@2569
  1468
            itemValue: doMoveInNext
cg@2569
  1469
            translateLabel: true
cg@2569
  1470
            isButton: true
cg@2569
  1471
            labelImage: (ResourceRetriever Icon downRightIcon)
cg@2569
  1472
          )
cg@2569
  1473
         (MenuItem
cg@2569
  1474
            activeHelpKey: editMoveInAbove
cg@2569
  1475
            enabled: enableMovingInAboveHolder
cg@2569
  1476
            label: 'Move Into Previous'
cg@2569
  1477
            itemValue: doMoveInPrevious
cg@2569
  1478
            translateLabel: true
cg@2569
  1479
            isButton: true
cg@2569
  1480
            labelImage: (ResourceRetriever Icon upRightIcon)
cg@2569
  1481
          )
cg@2569
  1482
         (MenuItem
cg@2569
  1483
            activeHelpKey: editMoveOut
cg@2569
  1484
            enabled: enableMovingOutHolder
cg@2569
  1485
            label: 'Move Out'
cg@2569
  1486
            itemValue: doMoveOut
cg@2569
  1487
            translateLabel: true
cg@2569
  1488
            isButton: true
cg@2569
  1489
            labelImage: (ResourceRetriever Icon leftDownIcon)
cg@2569
  1490
          )
cg@2569
  1491
         )
cg@2569
  1492
        nil
cg@2569
  1493
        nil
ca@1606
  1494
      )
ca@1606
  1495
! !
ca@1606
  1496
cg@1725
  1497
!MenuEditor class methodsFor:'menu specs-standard'!
ca@1606
  1498
ca@1606
  1499
standardEditMenu
ca@1606
  1500
    "This resource specification was automatically generated
ca@1606
  1501
     by the MenuEditor of ST/X."
ca@1606
  1502
ca@1606
  1503
    "Do not manually edit this!! If it is corrupted,
ca@1606
  1504
     the MenuEditor may not be able to read the specification."
ca@1606
  1505
ca@1606
  1506
    "
ca@1606
  1507
     MenuEditor new openOnClass:MenuEditor andSelector:#standardEditMenu
ca@1606
  1508
     (Menu new fromLiteralArrayEncoding:(MenuEditor standardEditMenu)) startUp
ca@1606
  1509
    "
ca@1606
  1510
ca@1606
  1511
    <resource: #menu>
ca@1606
  1512
cg@2188
  1513
    ^
ca@1606
  1514
     #(#Menu
cg@2188
  1515
	#(
cg@2188
  1516
	 #(#MenuItem
cg@2188
  1517
	    #label: 'Cut'
cg@2188
  1518
	    #translateLabel: true
cg@2188
  1519
	    #value: #cutSelection
cg@2188
  1520
	  )
cg@2188
  1521
	 #(#MenuItem
cg@2188
  1522
	    #label: 'Copy'
cg@2188
  1523
	    #translateLabel: true
cg@2188
  1524
	    #value: #copySelection
cg@2188
  1525
	  )
cg@2188
  1526
	 #(#MenuItem
cg@2188
  1527
	    #label: 'Paste'
cg@2188
  1528
	    #translateLabel: true
cg@2188
  1529
	    #value: #paste
cg@2188
  1530
	  )
cg@2188
  1531
	 )
cg@2188
  1532
	nil
cg@2188
  1533
	nil
ca@1606
  1534
      )
ca@1606
  1535
!
ca@1606
  1536
ca@1606
  1537
standardFileMenu
ca@1606
  1538
    "This resource specification was automatically generated
ca@1606
  1539
     by the MenuEditor of ST/X."
ca@1606
  1540
ca@1606
  1541
    "Do not manually edit this!! If it is corrupted,
ca@1606
  1542
     the MenuEditor may not be able to read the specification."
ca@1606
  1543
ca@1606
  1544
    "
ca@1606
  1545
     MenuEditor new openOnClass:MenuEditor andSelector:#standardFileMenu
ca@1606
  1546
     (Menu new fromLiteralArrayEncoding:(MenuEditor standardFileMenu)) startUp
ca@1606
  1547
    "
ca@1606
  1548
ca@1606
  1549
    <resource: #menu>
ca@1606
  1550
cg@2188
  1551
    ^
ca@1606
  1552
     #(#Menu
ca@1606
  1553
	#(
ca@1606
  1554
	 #(#MenuItem
ca@1606
  1555
	    #label: 'New'
ca@1606
  1556
	    #translateLabel: true
ca@1606
  1557
	    #value: #menuNew
ca@1606
  1558
	  )
ca@1606
  1559
	 #(#MenuItem
ca@1606
  1560
	    #label: '-'
ca@1606
  1561
	  )
ca@1606
  1562
	 #(#MenuItem
ca@1606
  1563
	    #label: 'Open...'
ca@1606
  1564
	    #translateLabel: true
ca@1606
  1565
	    #value: #menuOpen
ca@1606
  1566
	  )
ca@1606
  1567
	 #(#MenuItem
ca@1606
  1568
	    #label: '-'
ca@1606
  1569
	  )
ca@1606
  1570
	 #(#MenuItem
ca@1606
  1571
	    #label: 'Save'
ca@1606
  1572
	    #translateLabel: true
ca@1606
  1573
	    #value: #menuSave
ca@1606
  1574
	  )
ca@1606
  1575
	 #(#MenuItem
ca@1606
  1576
	    #label: 'Save As...'
ca@1606
  1577
	    #translateLabel: true
ca@1606
  1578
	    #value: #menuSaveAs
ca@1606
  1579
	  )
ca@1606
  1580
	 #(#MenuItem
ca@1606
  1581
	    #label: '-'
ca@1606
  1582
	  )
ca@1606
  1583
	 #(#MenuItem
ca@1606
  1584
	    #label: 'Exit'
ca@1606
  1585
	    #translateLabel: true
ca@1606
  1586
	    #value: #closeRequest
ca@1606
  1587
	  )
ca@1606
  1588
	 )
ca@1606
  1589
	nil
ca@1606
  1590
	nil
ca@1606
  1591
      )
ca@1606
  1592
!
ca@1606
  1593
ca@1606
  1594
standardHelpMenu
ca@1606
  1595
    "This resource specification was automatically generated
ca@1606
  1596
     by the MenuEditor of ST/X."
ca@1606
  1597
ca@1606
  1598
    "Do not manually edit this!! If it is corrupted,
ca@1606
  1599
     the MenuEditor may not be able to read the specification."
ca@1606
  1600
ca@1606
  1601
    "
ca@1606
  1602
     MenuEditor new openOnClass:MenuEditor andSelector:#standardHelpMenu
ca@1606
  1603
     (Menu new fromLiteralArrayEncoding:(MenuEditor standardHelpMenu)) startUp
ca@1606
  1604
    "
ca@1606
  1605
ca@1606
  1606
    <resource: #menu>
ca@1606
  1607
cg@2188
  1608
    ^
ca@1606
  1609
     #(#Menu
cg@2188
  1610
	#(
cg@2188
  1611
	 #(#MenuItem
cg@2188
  1612
	    #label: 'Documentation'
cg@2188
  1613
	    #translateLabel: true
cg@2188
  1614
	    #value: #openDocumentation
cg@2188
  1615
	  )
cg@2188
  1616
	 #(#MenuItem
cg@2188
  1617
	    #label: '-'
cg@2188
  1618
	  )
cg@2188
  1619
	 #(#MenuItem
cg@2188
  1620
	    #label: 'About this Application...'
cg@2188
  1621
	    #translateLabel: true
cg@2188
  1622
	    #value: #openAboutThisApplication
cg@2188
  1623
	  )
cg@2188
  1624
	 )
cg@2188
  1625
	nil
cg@2188
  1626
	nil
ca@1606
  1627
      )
ca@1606
  1628
! !
ca@1606
  1629
ca@1606
  1630
!MenuEditor methodsFor:'accessing'!
ca@1606
  1631
cg@2123
  1632
helpSpec
cg@2123
  1633
    |spec sel t g|
cg@2123
  1634
cg@2123
  1635
    spec := super helpSpec.
cg@2123
  1636
    t := spec at:#detailsStartGroup.
cg@2123
  1637
    g := (aspects at:#startGroup ifAbsent:nil) value.
cg@2123
  1638
    g == #conditionalRight ifTrue:[
cg@2188
  1639
	t := t , ' #conditionalRight means: "right on non-win32 systems"'
cg@2123
  1640
    ].
cg@2123
  1641
    g == #right ifTrue:[
cg@2188
  1642
	t := t , ' #right means: "right align from here"'
cg@2123
  1643
    ].
cg@2123
  1644
    g == #left ifTrue:[
cg@2188
  1645
	t := t , ' #left means: "left align group"'
cg@2123
  1646
    ].
cg@2123
  1647
    spec at:#detailsStartGroup put:t.
cg@2123
  1648
cg@2123
  1649
    ^ spec.
cg@2123
  1650
"/ #detailsStartGroup
cg@2123
  1651
"/ 'Specify start of a right-aligned item group.'
cg@2123
  1652
cg@2123
  1653
    "Created: / 16-10-2006 / 13:19:14 / cg"
cg@2123
  1654
!
cg@2123
  1655
ca@1606
  1656
helpTool
ca@1606
  1657
    "get the help tool application
ca@1606
  1658
    "
ca@1669
  1659
    ^ wizards at:#help ifAbsentPut:[ |tool|
cg@2188
  1660
	tool := UIHelpTool new.
cg@2188
  1661
	tool masterApplication:self.
cg@2188
  1662
	tool modifiedHolder: self enablingCommitButtonsHolder.
cg@2188
  1663
	tool builder window:(ApplicationSubView new client:tool spec:#innerSpec).
cg@2188
  1664
	tool masterApplication:self.
cg@2188
  1665
	tool
ca@1606
  1666
    ]
ca@1606
  1667
!
ca@1606
  1668
ca@1606
  1669
imageTool
ca@1606
  1670
    "get the image tool application
ca@1606
  1671
    "
ca@1606
  1672
  ^ wizards at:#image ifAbsentPut:[ |tool|
cg@2188
  1673
	tool := ResourceEditor new createBuilder.
cg@2188
  1674
	tool masterApplication:self.
cg@2188
  1675
	tool modifiedChannel: self enablingCommitButtonsHolder.
cg@2188
  1676
	tool builder window:(ApplicationSubView new client:tool).
cg@2188
  1677
	tool
ca@1606
  1678
    ]
ca@1606
  1679
!
ca@1606
  1680
cg@2569
  1681
savedSpec
cg@2569
  1682
    ^ savedSpec
cg@2569
  1683
!
cg@2569
  1684
ca@1606
  1685
useHelpTool:aHelpTool
ca@1606
  1686
    "take the help dictionaries from aHelpTool into my helpTool
ca@1606
  1687
    "
cg@1971
  1688
    self helpTool loadFromHelpTool:aHelpTool.
ca@1606
  1689
! !
ca@1606
  1690
ca@1606
  1691
!MenuEditor methodsFor:'actions'!
ca@1606
  1692
ca@1606
  1693
accept
ca@1606
  1694
    "accept modifications
ca@1606
  1695
    "
ca@1606
  1696
    self accept:true.
ca@1606
  1697
!
ca@1606
  1698
ca@1606
  1699
accept:ok
cg@2297
  1700
    "if ok is true, the modifications are accepted.
cg@2297
  1701
     then reload from item
ca@1606
  1702
    "
ca@1606
  1703
    |selectedItem rscRetrHolder helpKeyHolder helpTool imageTool acceptChannel|
ca@1606
  1704
ca@1606
  1705
    selectedItem := self selectedItem.
ca@1606
  1706
ca@1606
  1707
    selectedItem ifNotNil:[
cg@2297
  1708
        self withoutNotifyDo:[
cg@2297
  1709
            rscRetrHolder := aspects at:#resourceRetriever.
cg@2297
  1710
            helpKeyHolder := aspects at:#activeHelpKey.
cg@2297
  1711
            imageTool     := self imageTool.
cg@2297
  1712
            helpTool      := self helpTool.
cg@2297
  1713
            acceptChannel := self acceptChannel.
cg@2297
  1714
cg@2297
  1715
            acceptChannel triggerValue:true.
cg@2297
  1716
            acceptChannel setValue:false.
cg@2297
  1717
cg@2297
  1718
            ok ifTrue:[
cg@2297
  1719
                helpTool accept.
cg@2297
  1720
                rscRetrHolder value:(imageTool resourceRetriever).
cg@2297
  1721
                helpKeyHolder value:(helpTool  helpKey).
cg@2297
  1722
                selectedItem  fromAspects:aspects.
cg@2297
  1723
                self setModified.
cg@2297
  1724
cg@2297
  1725
                selectedItem isRootItem ifTrue:[
cg@2297
  1726
                    "/ update specSelector
cg@2297
  1727
                    specSelector := selectedItem rawLabel.
cg@2297
  1728
                ].
cg@2297
  1729
            ].
cg@2297
  1730
            selectedItem toAspects:aspects.
cg@2297
  1731
            helpTool     helpKey:(helpKeyHolder value).
cg@2297
  1732
            imageTool    resourceRetriever:(rscRetrHolder value).
cg@2297
  1733
        ]
ca@1606
  1734
    ].
ca@1606
  1735
    self updateChannels.
cg@2075
  1736
"/    self clearModified.
cg@2075
  1737
    self clearModifiedFlag.
cg@2075
  1738
cg@2075
  1739
    self enablingCommitButtonsHolder value:false.
cg@2075
  1740
cg@2075
  1741
    "Modified: / 05-09-2006 / 18:43:30 / cg"
ca@1606
  1742
!
ca@1606
  1743
ca@1606
  1744
cancel
cg@2070
  1745
    "reload aspects from current selected item; reset modification flag"
cg@2070
  1746
ca@1606
  1747
    self accept:false.
cg@2070
  1748
cg@2070
  1749
    "Modified: / 29-08-2006 / 10:20:46 / cg"
ca@1606
  1750
!
ca@1606
  1751
ca@1606
  1752
indicatorClickedAt:atLine
ca@1606
  1753
    "indicator clicked at line number; toggle expand of item at line
ca@1606
  1754
    "
ca@1606
  1755
    |item|
ca@1606
  1756
ca@1606
  1757
    item := listOfItems at:atLine ifAbsent:nil.
ca@1610
  1758
    item ifNotNil:[
cg@2188
  1759
	item toggleExpand.
cg@2188
  1760
	self hasSelection ifFalse:[
cg@2188
  1761
	    self selectedItem:item
cg@2188
  1762
	]
ca@1610
  1763
    ].
ca@1606
  1764
! !
ca@1606
  1765
ca@1606
  1766
!MenuEditor methodsFor:'aspects'!
ca@1606
  1767
ca@1606
  1768
canCreateDelayedMenuChannel
ca@1606
  1769
    "boolean holder, true if the current selected item accepts a delayed menu
ca@1606
  1770
    "
ca@1606
  1771
    ^ builder booleanValueAspectFor:#canCreateDelayedMenuChannel
ca@1606
  1772
!
ca@1606
  1773
cg@1636
  1774
hasItemValue
cg@1636
  1775
    "boolean holder, true if any item is selected
cg@1636
  1776
    "
cg@2188
  1777
    ^ BlockValue
cg@2188
  1778
	with:[:holder | holder size > 0]
cg@2188
  1779
	argument:(self aspectFor:#itemValue)
cg@2161
  1780
cg@2161
  1781
    "Modified: / 08-03-2007 / 22:59:42 / cg"
cg@1636
  1782
!
cg@1636
  1783
ca@1606
  1784
hasSelectionChannel
ca@1606
  1785
    "boolean holder, true if any item is selected
ca@1606
  1786
    "
ca@1606
  1787
    ^ builder booleanValueAspectFor:#hasSelectionChannel
ca@1606
  1788
!
ca@1606
  1789
ca@1606
  1790
hasSingleSelectionChannel
ca@1606
  1791
    "boolean holder, true if one item is selected
ca@1606
  1792
    "
ca@1606
  1793
    ^ builder booleanValueAspectFor:#hasSingleSelectionChannel
ca@1606
  1794
!
ca@1606
  1795
ca@1606
  1796
listOfItems
ca@1606
  1797
    "returns the hierarchical list of menuItems
ca@1606
  1798
    "
ca@1606
  1799
    ^ listOfItems
ca@1606
  1800
!
ca@1606
  1801
ca@1606
  1802
listOfTabs
ca@1606
  1803
    "returns the list of current shown tab-labels retrieved
ca@1606
  1804
     from the current selected item.
ca@1606
  1805
    "
ca@1606
  1806
    ^ listOfTabs
ca@1606
  1807
!
ca@1606
  1808
ca@1617
  1809
redefineAspectMethodsChannel
cg@2188
  1810
    "boolean holder, true if aspects should be generated in only implemented
ca@1617
  1811
     in superClass by calling #super ...
ca@1617
  1812
    "
ca@1617
  1813
    ^ builder booleanValueAspectFor:#redefineAspectMethodsChannel
ca@1617
  1814
!
ca@1617
  1815
ca@1606
  1816
selectionHolder
ca@1606
  1817
    "value holder, which keeps the current selected items
ca@1606
  1818
    "
ca@1606
  1819
    ^ selectionHolder
ca@1606
  1820
!
ca@1606
  1821
ca@1606
  1822
tabHolder
ca@1606
  1823
    "value holder, which keeps the current selected tab label or nil
ca@1606
  1824
    "
ca@1606
  1825
    ^ tabHolder
ca@1606
  1826
!
ca@1606
  1827
ca@1606
  1828
wizardHolder
ca@1606
  1829
    "holder, which keeps the current wizard window
ca@1606
  1830
    "
ca@1606
  1831
    |holder|
ca@1606
  1832
ca@1606
  1833
    holder := builder bindingAt:#wizardHolder.
ca@1606
  1834
cg@2151
  1835
    holder isNil ifTrue:[
cg@2188
  1836
	holder := nil asValue.
cg@2188
  1837
	builder aspectAt:#wizardHolder put:holder.
ca@1606
  1838
    ].
ca@1606
  1839
    ^ holder
ca@1606
  1840
! !
ca@1606
  1841
ca@1606
  1842
!MenuEditor methodsFor:'building'!
ca@1606
  1843
ca@1606
  1844
buildFromMenu:aMenu selector:aSelector
ca@1606
  1845
    "rebuild menu from a Menu
ca@1606
  1846
    "
ca@1606
  1847
    |root menu|
ca@1606
  1848
ca@1606
  1849
    aMenu isCollection ifTrue:[menu := aMenu decodeAsLiteralArray]
cg@2188
  1850
		      ifFalse:[menu := aMenu].
cg@1988
  1851
cg@1988
  1852
    self enablingCommitButtonsHolder value:false.
ca@1606
  1853
    root := listOfItems root.
ca@1606
  1854
ca@1606
  1855
    self withoutNotifyDo:[
cg@2188
  1856
	selectionHolder setValue:#().
cg@2188
  1857
	root menu:aMenu labeled:(aSelector ? specSelector).
ca@1606
  1858
    ].
ca@1606
  1859
    self selectedItem:root.
ca@1606
  1860
    self updateHistory.
ca@1606
  1861
!
ca@1606
  1862
cg@2019
  1863
buildFromResourceSpec:aResourceSpec
cg@2019
  1864
    "rebuild the menu from a resource spec"
cg@2019
  1865
cg@2019
  1866
    self buildFromMenu:aResourceSpec selector:nil
cg@2019
  1867
!
cg@2019
  1868
cg@1971
  1869
loadFromClass:aClass andSelector:aSelector
cg@1971
  1870
    "rebuild menu from a class and selector"
cg@1971
  1871
cg@1971
  1872
    |cls menu|
cg@1971
  1873
cg@1971
  1874
    self assert:(aClass isNil or:[aClass isClass]).
cg@1971
  1875
cg@1971
  1876
    menu := nil.
cg@1971
  1877
cg@2188
  1878
    self isStandAlone ifTrue:[ self helpTool loadFromClass:aClass ].
cg@1971
  1879
cg@1971
  1880
    specClass := aClass.
cg@1971
  1881
    specSelector := aSelector.
cg@1971
  1882
cg@1971
  1883
    aSelector notNil ifTrue:[
cg@2569
  1884
        aClass notNil ifTrue:[
cg@2569
  1885
            cls := aClass isBehavior ifTrue:[ aClass ] ifFalse:[ self resolveName:aClass].
cg@2569
  1886
cg@2569
  1887
            (cls respondsTo:aSelector) ifTrue:[
cg@2569
  1888
                menu := cls perform: aSelector.
cg@2569
  1889
            ].
cg@2569
  1890
        ].
cg@1971
  1891
    ].
cg@2569
  1892
    self loadFromMenu:menu selector:aSelector.
cg@2569
  1893
!
cg@2569
  1894
cg@2569
  1895
loadFromMenu:menuArg selector:selectorOrNil
cg@2569
  1896
    "rebuild menu"
cg@2569
  1897
cg@2569
  1898
    |menu|
cg@2569
  1899
cg@2569
  1900
    menu := menuArg.
cg@2569
  1901
    menu notNil ifTrue:[
cg@2569
  1902
        (menu isCollection) ifTrue:[
cg@2569
  1903
            menu := Menu decodeFromLiteralArray:menu
cg@2569
  1904
        ].
cg@2569
  1905
    ].
cg@2569
  1906
    self buildFromMenu:menu selector:selectorOrNil.
cg@1971
  1907
    self clearModified.
cg@2168
  1908
cg@2169
  1909
    "Modified: / 27-03-2007 / 11:16:47 / cg"
ca@1606
  1910
! !
ca@1606
  1911
ca@1606
  1912
!MenuEditor methodsFor:'change & update'!
ca@1606
  1913
ca@1606
  1914
selectedSuperItems
ca@1606
  1915
    "returns collection of superItems derived from selection
ca@1606
  1916
    "
ca@1606
  1917
    |selection size root|
ca@1606
  1918
ca@1606
  1919
    selectedSuperItems ifNotNil:[ ^ selectedSuperItems ].
ca@1606
  1920
ca@1606
  1921
    selection := selectionHolder value.
ca@1606
  1922
    size      := selection size.
ca@1606
  1923
ca@1606
  1924
    size <= 1 ifTrue:[
cg@2188
  1925
	selectedSuperItems := selection ? #().
ca@1606
  1926
      ^ selectedSuperItems
ca@1606
  1927
    ].
ca@1606
  1928
ca@1606
  1929
    root := listOfItems root.
ca@1606
  1930
ca@1606
  1931
    (selection includesIdentical:root) ifTrue:[
cg@2188
  1932
	selectedSuperItems := Array with:root.
cg@2188
  1933
      ^ selectedSuperItems
ca@1606
  1934
    ].
ca@1606
  1935
    selectedSuperItems := OrderedCollection new.
ca@1606
  1936
ca@1606
  1937
    selection do:[:anItem|
cg@2188
  1938
	anItem parentsDetect:[:el| selection includesIdentical:el ]
cg@2188
  1939
		      ifNone:[ selectedSuperItems add:anItem ].
ca@1606
  1940
    ].
ca@1606
  1941
    ^ selectedSuperItems
ca@1606
  1942
!
ca@1606
  1943
ca@1606
  1944
selectionChanged
ca@1606
  1945
    "called if the selection has changed
ca@1606
  1946
    "
ca@1606
  1947
    |newTabList selection|
ca@1606
  1948
ca@1606
  1949
    selection := selectionHolder value.
ca@1606
  1950
ca@1606
  1951
    selection size == 1 ifTrue:[
cg@2188
  1952
	selectedSuperItems := selection.
cg@2188
  1953
cg@2188
  1954
	newTabList := selection first slices collect:[:el| el first ].
cg@2188
  1955
	newTabList = listOfTabs ifFalse:[
cg@2188
  1956
	    listOfTabs contents:newTabList.
cg@2188
  1957
	].
ca@1606
  1958
    ] ifFalse:[
cg@2188
  1959
	"must compute selected super items on request
cg@2188
  1960
	"
cg@2188
  1961
	selectedSuperItems := nil.
ca@1606
  1962
    ].
ca@1606
  1963
    self cancel.
ca@1606
  1964
    self tabChanged.
ca@1606
  1965
    self updateChannels.
ca@1606
  1966
!
ca@1606
  1967
ca@1606
  1968
tabChanged
ca@1606
  1969
    "called if the tab changed
ca@1606
  1970
    "
ca@1606
  1971
    |tab selector item canvas wizardHolder|
ca@1606
  1972
ca@1606
  1973
    wizardHolder := self wizardHolder.
ca@1606
  1974
    item := self selectedItem.
cg@2151
  1975
    item isNil ifTrue:[ ^ wizardHolder value:nil ].
ca@1606
  1976
ca@1606
  1977
    tab := tabHolder value.
ca@1606
  1978
ca@1676
  1979
    tab notNil ifTrue:[
cg@2188
  1980
	tab := item slices detect:[:el| el first = tab ] ifNone:nil.
ca@1606
  1981
    ].
ca@1676
  1982
    tab isNil ifTrue:[
cg@2188
  1983
	^ tabHolder value:( listOfTabs at:1 ifAbsent:nil )
ca@1606
  1984
    ].
ca@1606
  1985
    selector := tab last.
ca@1606
  1986
ca@1606
  1987
    selector == #help  ifTrue:[ ^ wizardHolder value:(self helpTool  window) ].
ca@1606
  1988
    selector == #image ifTrue:[ ^ wizardHolder value:(self imageTool window) ].
ca@1606
  1989
ca@1606
  1990
    canvas := wizards at:(item class name, selector) asSymbol
cg@2188
  1991
	      ifAbsentPut:[ SimpleView new client:self
cg@2188
  1992
					     spec:(item class perform:selector)
cg@2188
  1993
					  builder:(self builder)
cg@2188
  1994
			  ].
ca@1606
  1995
ca@1606
  1996
    wizardHolder value:canvas.
ca@1606
  1997
!
ca@1606
  1998
ca@1606
  1999
update:something with:aParameter from:changedObject
cg@1711
  2000
    |lbl|
cg@1711
  2001
ca@1606
  2002
    notifyDisabledCounter ~~ 0 ifTrue:[ ^ self ].
ca@1606
  2003
ca@1606
  2004
    changedObject == selectionHolder ifTrue:[ ^ self selectionChanged ].
ca@1606
  2005
    changedObject == tabHolder       ifTrue:[ ^ self tabChanged ].
ca@1606
  2006
cg@1711
  2007
    changedObject == self autoAcceptOnSelectionChange ifTrue:[
cg@2188
  2008
	lbl := changedObject value ifTrue:['Apply'] ifFalse:['OK'].
cg@2188
  2009
	(builder componentAt:'okButton') label:(resources string:lbl).
cg@2188
  2010
	^ self
cg@1711
  2011
    ].
cg@1711
  2012
ca@1606
  2013
    super update:something with:aParameter from:changedObject
ca@1606
  2014
!
ca@1606
  2015
ca@1606
  2016
updateChannels
ca@1606
  2017
    "update all channels
ca@1606
  2018
    "
ca@1606
  2019
    |selection sizeOfSel selectedItem|
ca@1606
  2020
ca@1606
  2021
    super updateChannels.
ca@1606
  2022
ca@1606
  2023
    selection := selectionHolder value.
ca@1606
  2024
    sizeOfSel := selection size.
ca@1606
  2025
ca@1606
  2026
    sizeOfSel == 1 ifTrue:[selectedItem := selection at:1]
cg@2188
  2027
		  ifFalse:[selectedItem := nil].
ca@1606
  2028
ca@1606
  2029
    self hasSelectionChannel       value:(sizeOfSel ~~ 0).
ca@1606
  2030
    self hasSingleSelectionChannel value:(selectedItem notNil).
ca@1606
  2031
ca@1606
  2032
    selectedItem isNil ifTrue:[
cg@2188
  2033
	self enableMovingInHolder        value:false.
cg@2188
  2034
	self enableMovingOutHolder       value:false.
cg@2188
  2035
	self enableMovingUpOrDownHolder  value:false.
cg@2188
  2036
	self enableMovingInAboveHolder   value:false.
cg@2188
  2037
	self canCreateDelayedMenuChannel value:false.
ca@1606
  2038
    ] ifFalse:[
cg@2188
  2039
	self enableMovingUpOrDownHolder  value:(selectedItem canMoveUpOrDown).
cg@2188
  2040
	self enableMovingOutHolder       value:(selectedItem canMoveOut).
cg@2188
  2041
	self enableMovingInHolder        value:(selectedItem canMoveInNext).
cg@2188
  2042
	self enableMovingInAboveHolder   value:(selectedItem canMoveInAbove).
cg@2188
  2043
	self canCreateDelayedMenuChannel value:(selectedItem canAddDelayedMenu).
ca@1606
  2044
    ].
ca@1606
  2045
! !
ca@1606
  2046
ca@1606
  2047
!MenuEditor methodsFor:'defaults'!
ca@1606
  2048
ca@1606
  2049
aboutImage
ca@1606
  2050
    "the image to be displayed in my about-box;
ca@1606
  2051
     If nil is returned, the ST/X default image is used.
ca@1606
  2052
    "
ca@1606
  2053
    ^ self class aboutImage
ca@1606
  2054
! !
ca@1606
  2055
ca@1606
  2056
!MenuEditor methodsFor:'drag & drop'!
ca@1606
  2057
cg@2118
  2058
canDrop:aDropContext
ca@1618
  2059
    "return true, if the DropContext can be dropped into the list of items.
cg@1953
  2060
     The dropable objects are already validated by: #dropEnter:"
cg@1953
  2061
ca@1618
  2062
    ^ (dropOverLine notNil and:[dropOverLine ~~ 0])
cg@2118
  2063
cg@2118
  2064
    "Modified: / 13-10-2006 / 16:03:47 / cg"
ca@1618
  2065
!
ca@1618
  2066
ca@1618
  2067
changeDropLineTo:aLineOrNil in:aContext
ca@1618
  2068
    "the over dropLine changed; redraw drop indication stuff
ca@1618
  2069
    "
ca@1618
  2070
    |x0 x1 y0|
ca@1618
  2071
ca@1618
  2072
    aLineOrNil == dropOverLine ifTrue:[
cg@2188
  2073
	^ self. "/ nothing changed
ca@1606
  2074
    ].
ca@1618
  2075
    x0 := listOfItemsView margin + 2.
ca@1618
  2076
    x1 := listOfItemsView width - x0.
ca@1618
  2077
ca@1618
  2078
    "/ inform the DragAndDrop handler that the draw contents will change
ca@1618
  2079
    aContext contentsWillChange.
ca@1618
  2080
ca@1618
  2081
    (dropOverLine notNil and:[dropOverLine ~~ 0]) ifTrue:[
cg@2188
  2082
	"/ restore old draw
cg@2188
  2083
	y0 := listOfItemsView yVisibleOfLine:(dropOverLine + 1).
cg@2188
  2084
	y0 := y0 - 3.
cg@2188
  2085
cg@2188
  2086
	listOfItemsView invalidate:(Rectangle left:x0 top:y0 width:(x1-x0+1) height:2)
cg@2188
  2087
			 repairNow:true.
ca@1606
  2088
    ].
ca@1618
  2089
ca@1618
  2090
    dropOverLine := aLineOrNil.
ca@1618
  2091
ca@1618
  2092
    (dropOverLine notNil and:[dropOverLine ~~ 0]) ifTrue:[
cg@2188
  2093
	"/ highlight new drop target
cg@2188
  2094
	y0 := listOfItemsView yVisibleOfLine:(dropOverLine + 1).
cg@2188
  2095
	y0 := y0 - 3.
cg@2188
  2096
cg@2188
  2097
	listOfItemsView paint:(Color white).
cg@2188
  2098
	listOfItemsView displayLineFromX:x0 y:y0 toX:x1 y:y0.
cg@2188
  2099
	y0 := y0 + 1.
cg@2188
  2100
	listOfItemsView paint:(Color black).
cg@2188
  2101
	listOfItemsView displayLineFromX:x0 y:y0 toX:x1 y:y0.
ca@1618
  2102
    ].
ca@1606
  2103
!
ca@1606
  2104
cg@2118
  2105
doDrop:aDropContext
cg@1702
  2106
    "drop the dropContext into the hierachical list of items
ca@1606
  2107
    "
ca@1618
  2108
    |done item|
ca@1618
  2109
cg@2151
  2110
    dropOverLine isNil ifTrue:[^ false ].      "/ context not valid to me ...
ca@1618
  2111
ca@1618
  2112
    item := listOfItems at:dropOverLine ifAbsent:nil.
cg@2118
  2113
    self dropLeave:aDropContext.
cg@2151
  2114
    item isNil ifTrue:[^ false].
ca@1618
  2115
ca@1618
  2116
    selectionHolder setValue:(Array with:item).
ca@1618
  2117
ca@1618
  2118
    done := false.
ca@1618
  2119
cg@1702
  2120
    self addAndSelectValueOf:[
cg@2188
  2121
	done := true.
cg@2188
  2122
	aDropContext dropObjects collect:[:el| Item menuItem:(el theObject) ]
ca@1618
  2123
    ].
ca@1618
  2124
    ^ done
cg@2118
  2125
cg@2118
  2126
    "Modified: / 13-10-2006 / 16:03:54 / cg"
cg@2118
  2127
!
cg@2118
  2128
cg@2118
  2129
dropEnter:aDropContext
ca@1618
  2130
    "a drop operation enters my widget; validate dropable objects.
ca@1618
  2131
     If the objects are not dropable, dropOverLine is set to nil,
ca@1618
  2132
     otherwise to 0 (can drop the contents but not).
ca@1618
  2133
    "
ca@1606
  2134
    |objects|
ca@1606
  2135
ca@1618
  2136
    dropOverLine := nil.
ca@1618
  2137
cg@1988
  2138
    self enablingCommitButtonsHolder value ifTrue:[
cg@2188
  2139
	"/ current editing spec is modified (couldn't accept operation)
cg@2188
  2140
	^ self
ca@1618
  2141
    ].
cg@2118
  2142
    objects := aDropContext dropObjects.
ca@1618
  2143
    objects isEmpty ifTrue:[ ^ self ].  "/ nothing to drop ???
ca@1618
  2144
ca@1618
  2145
    "/ test whether all objects are dropable (kind of MenuItem)
cg@2113
  2146
    (objects conform:[:el | (el theObject askFor:#isMenuItem)]) ifTrue:[
cg@2188
  2147
	"/ ok, the contents is dropable
cg@2188
  2148
	dropOverLine := 0.
cg@2113
  2149
    ]
cg@2113
  2150
cg@2118
  2151
    "Modified: / 13-10-2006 / 16:04:14 / cg"
cg@2118
  2152
!
cg@2118
  2153
cg@2118
  2154
dropLeave:aDropContext
ca@1618
  2155
    "the widget is leaved; restore drop indications drawn ...
ca@1618
  2156
    "
cg@2118
  2157
    self changeDropLineTo:nil in:aDropContext.
cg@2118
  2158
cg@2118
  2159
    "Modified: / 13-10-2006 / 16:03:59 / cg"
ca@1606
  2160
!
ca@1606
  2161
ca@1606
  2162
dropObjects
ca@1606
  2163
    "returns list of DropObjects
ca@1606
  2164
    "
ca@1606
  2165
    |obj items|
ca@1606
  2166
ca@1606
  2167
    items := self selectedSuperItems.
ca@1606
  2168
    items isEmpty ifTrue:[ ^ nil ].
ca@1606
  2169
ca@1606
  2170
  ^ items collect:[:el|
cg@2188
  2171
	obj := DropObject new:(el menuItem).
cg@2188
  2172
	obj displayObject:(el rawLabel).
cg@2188
  2173
	obj
ca@1606
  2174
    ].
ca@1618
  2175
!
ca@1618
  2176
cg@2118
  2177
dropOver:aDropContext
cg@1685
  2178
    "called during drag & drop while moving over the widget."
cg@1685
  2179
ca@1618
  2180
    |lnNr item|
ca@1618
  2181
cg@2151
  2182
    dropOverLine isNil ifTrue:[^ self ].       "/ context not valid to me ...
ca@1618
  2183
cg@2118
  2184
    lnNr := listOfItemsView yVisibleToLineNr:(aDropContext targetPoint y).
ca@1618
  2185
    item := nil.
ca@1618
  2186
ca@1618
  2187
    lnNr ifNotNil:[
cg@2188
  2188
	item := listOfItems at:lnNr ifAbsent:nil.
cg@2188
  2189
	item ifNotNil:[
cg@2188
  2190
	    (item isAction and:[item hasDelayedMenu]) ifTrue:[
cg@2188
  2191
		item := nil
cg@2188
  2192
	    ]
cg@2188
  2193
	]
ca@1618
  2194
    ].
cg@2151
  2195
    item isNil ifTrue:[ lnNr := 0 ].   "/ not dropable for item
ca@1618
  2196
ca@1618
  2197
    "/ redraw drop indication
cg@2118
  2198
    self changeDropLineTo:lnNr in:aDropContext.
cg@2118
  2199
cg@2118
  2200
    "Modified: / 13-10-2006 / 16:04:05 / cg"
ca@1606
  2201
! !
ca@1606
  2202
ca@1606
  2203
!MenuEditor methodsFor:'event processing'!
ca@1606
  2204
ca@1606
  2205
processEvent:anEvent
cg@1895
  2206
    "filter keyboard edit-events typed into the listOfItemsView.
cg@1895
  2207
     Return true, if I have eaten the event"
cg@1895
  2208
cg@2275
  2209
    |evView rawKey key|
ca@1606
  2210
cg@2187
  2211
    anEvent isKeyPressEvent ifFalse:[^ false].
ca@1606
  2212
ca@1606
  2213
    evView := anEvent targetView.
cg@2151
  2214
    evView isNil ifTrue:[ ^ false ].
ca@1606
  2215
cg@2263
  2216
    "/ only handle keyboard events for the left item list
cg@2263
  2217
    "/ (otherwise, copy-paste would not work in the editFields on the right)
cg@2275
  2218
    (evView isSameOrComponentOf:listOfItemsView) ifFalse:[^ false].
ca@1606
  2219
ca@1606
  2220
    key    := anEvent key.
ca@1606
  2221
    rawKey := anEvent rawKey.
ca@1606
  2222
ca@1606
  2223
    (    key == #Delete
ca@1606
  2224
     or:[key == #BackSpace
ca@1606
  2225
     or:[key == #Cut]]
ca@1606
  2226
    ) ifTrue:[
cg@2263
  2227
        self doCut.
cg@2263
  2228
        ^ true.
ca@1606
  2229
    ].
ca@1606
  2230
ca@1606
  2231
    key == #Copy  ifTrue:[ self doCopy.  ^ true ].
ca@1606
  2232
    key == #Paste ifTrue:[ self doPaste. ^ true ].
ca@1606
  2233
cg@2188
  2234
    (rawKey == #CtrlCursorUp) ifTrue:[
cg@2263
  2235
        self doMoveUp.
cg@2263
  2236
        ^ true.
cg@1958
  2237
    ].
cg@2188
  2238
    (rawKey == #CtrlCursorDown) ifTrue:[
cg@2263
  2239
        self doMoveDown.
cg@2263
  2240
        ^ true.
cg@1958
  2241
    ].
cg@2188
  2242
    (rawKey == #CtrlCursorLeft) ifTrue:[
cg@2263
  2243
        self doMoveOut.
cg@2263
  2244
        ^ true.
cg@1958
  2245
    ].
cg@2188
  2246
    (rawKey == #CtrlCursorRight) ifTrue:[
cg@2263
  2247
        self doMoveInNext.
cg@2263
  2248
        ^ true.
cg@1958
  2249
    ].
cg@1958
  2250
cg@1958
  2251
    ^ false.
ca@1606
  2252
! !
ca@1606
  2253
ca@1606
  2254
!MenuEditor methodsFor:'initialization & release'!
ca@1606
  2255
ca@1606
  2256
closeRequest
cg@2036
  2257
    "asks for permission before closing"
cg@2036
  2258
cg@2075
  2259
    self askForModification ifFalse:[^self].
cg@2075
  2260
cg@2075
  2261
"/    self enablingCommitButtonsHolder value ifTrue:[
cg@2075
  2262
"/        self setModified.
cg@2075
  2263
"/        self askForListModification.
cg@2075
  2264
"/        modified ifTrue:[^ self].
cg@2075
  2265
"/        self clearModified.
cg@2075
  2266
"/    ].
cg@2036
  2267
    super closeRequest
cg@2075
  2268
cg@2075
  2269
    "Modified: / 05-09-2006 / 18:44:15 / cg"
ca@1606
  2270
!
ca@1606
  2271
cg@1992
  2272
commonPostBuild
cg@1711
  2273
    self autoAcceptOnSelectionChange addDependent:self.
cg@1711
  2274
    self autoAcceptOnSelectionChange value ifTrue:[
cg@2188
  2275
	(builder componentAt:'okButton') label:(resources string:'Apply')
cg@1711
  2276
    ].
cg@1992
  2277
cg@1997
  2278
    "/ using masters infoHolder ?
cg@1997
  2279
    (builder aspectAt:#useAlienInfoLabelHolder) == true ifTrue:[
cg@2188
  2280
	(builder componentAt:#mainPanel) layout bottomOffset:0.
cg@2188
  2281
	(builder componentAt:#infoBarSubSpec) beInvisible
cg@1997
  2282
    ]
cg@1992
  2283
!
cg@1992
  2284
cg@1992
  2285
initialize
cg@1992
  2286
    "setup aspects, ...
cg@1992
  2287
    "
cg@1992
  2288
    super initialize.
cg@1992
  2289
    notifyDisabledCounter := 0.
cg@1992
  2290
cg@1992
  2291
    Item withAllSubclasses do:[:aClass|
cg@2188
  2292
	aClass addBindingsTo:aspects for:self.
cg@1992
  2293
    ].
cg@1992
  2294
cg@1992
  2295
    selectionHolder    := #() asValue.
cg@1992
  2296
    selectionHolder addDependent:self.
cg@1992
  2297
cg@1992
  2298
    listOfItems := HierarchicalList new.
cg@1992
  2299
    listOfItems application:self.
cg@1992
  2300
    listOfItems root:(RootItem new).
cg@1992
  2301
cg@1992
  2302
    tabHolder := nil asValue.
cg@1992
  2303
    tabHolder addDependent:self.
cg@1992
  2304
cg@1992
  2305
    listOfTabs := List new.
cg@1992
  2306
    wizards    := IdentityDictionary new.
cg@1992
  2307
!
cg@1992
  2308
cg@2569
  2309
loadFromResourceSpec:aResourceSpec
cg@2569
  2310
    self loadFromMenu:aResourceSpec selector:nil
cg@2569
  2311
!
cg@2569
  2312
cg@2569
  2313
openModalOnMenu:aMenuOrNil
cg@2569
  2314
    "build a tree from aMenu and open it modal"
cg@2569
  2315
cg@2569
  2316
    self openModalOnResourceSpec:aMenuOrNil
cg@1992
  2317
!
cg@1992
  2318
cg@1992
  2319
postBuildListOfItemsView:aSrollableView
cg@1992
  2320
    listOfItemsView := aSrollableView scrolledView.
cg@1992
  2321
!
cg@1992
  2322
cg@1992
  2323
postBuildNoteBook:aNoteBook
cg@1992
  2324
    aNoteBook tabLabelInset:16@4.
cg@1711
  2325
!
cg@1711
  2326
ca@1606
  2327
postOpenWith:aBuilder
cg@2036
  2328
    "reset keyboardProcessor for menuBar"
cg@2036
  2329
ca@1606
  2330
    super postOpenWith: aBuilder.
ca@1606
  2331
    aBuilder keyboardProcessor menuBar:nil.
ca@1606
  2332
    self windowGroup addPreEventHook:self.
ca@1606
  2333
! !
ca@1606
  2334
cg@2275
  2335
!MenuEditor methodsFor:'menus-dynamic'!
cg@2275
  2336
cg@2275
  2337
submenuTest
cg@2275
  2338
    "returns a menu on the current editing menu
cg@2275
  2339
    "
cg@2275
  2340
    |menu indication choice submenu retriever|
cg@2275
  2341
cg@2275
  2342
    menu := listOfItems root submenu.
cg@2275
  2343
    menu isNil ifTrue:[^ nil ].
cg@2275
  2344
cg@2275
  2345
    menu allItemsDo:[:anItem|
cg@2275
  2346
        anItem ignoreShortcutKeys:true.
cg@2275
  2347
        anItem isVisible:true.
cg@2275
  2348
        anItem enabled:true.
cg@2275
  2349
        anItem translateLabel:false.
cg@2275
  2350
cg@2275
  2351
        anItem itemValue notNil ifTrue:[
cg@2275
  2352
            anItem itemValue:[ Transcript showCR:(anItem label) ].
cg@2275
  2353
        ].
cg@2275
  2354
        anItem indication notNil ifTrue:[
cg@2275
  2355
            indication isNil ifTrue:[ indication := true asValue ].
cg@2275
  2356
            anItem indication:indication
cg@2275
  2357
        ].
cg@2275
  2358
        anItem choice notNil ifTrue:[
cg@2275
  2359
            choice isNil ifTrue:[ choice := anItem choiceValue asValue ].
cg@2275
  2360
            anItem choice:choice
cg@2275
  2361
        ].
cg@2275
  2362
        anItem isMenuSlice ifTrue:[
cg@2275
  2363
            anItem submenuChannel:nil.
cg@2275
  2364
            anItem label:'... Slice Menu ...'.
cg@2275
  2365
        ].
cg@2275
  2366
        anItem submenuChannel notNil ifTrue:[
cg@2275
  2367
            anItem submenuChannel:nil.
cg@2275
  2368
            anItem submenu isNil ifTrue:[
cg@2275
  2369
                submenu isNil ifTrue:[
cg@2275
  2370
                    submenu := Menu new.
cg@2275
  2371
                    submenu addItem:(MenuItem labeled:'Linked Menu...').
cg@2275
  2372
                ].
cg@2275
  2373
                anItem submenu:submenu.
cg@2275
  2374
            ].
cg@2275
  2375
        ].
cg@2275
  2376
        retriever := anItem resourceRetriever.
cg@2275
  2377
        retriever notNil ifTrue:[
cg@2275
  2378
            retriever labelText notNil ifTrue:[ retriever labelText:(anItem label) ]
cg@2275
  2379
        ].
cg@2275
  2380
    ].
cg@2275
  2381
    menu findGuiResourcesIn:(self resolveName:specClass).
cg@2275
  2382
    ^ menu
cg@2275
  2383
! !
cg@2275
  2384
ca@1606
  2385
!MenuEditor methodsFor:'private'!
ca@1606
  2386
cg@1702
  2387
addAndSelectValueOf:aBlockOrItem
ca@1606
  2388
    "add an item(s) derived from the block; test if add operation
ca@1606
  2389
     is enabled. On success the new item(s) are returned otherwise nil.
ca@1606
  2390
    "
ca@1606
  2391
    |intoItem index newItem|
ca@1606
  2392
ca@1606
  2393
    intoItem := self selectedItem.
cg@2151
  2394
    intoItem isNil ifTrue:[ ^ nil].
ca@1606
  2395
ca@1606
  2396
    self askForItemModification ifFalse:[ ^ nil ].
ca@1606
  2397
ca@1606
  2398
    index := 1.
ca@1606
  2399
ca@1618
  2400
    (intoItem canAddChildren and:[intoItem isExpanded]) ifFalse:[
cg@2188
  2401
	intoItem parent notNil ifTrue:[
cg@2188
  2402
	    [ intoItem parent canAddChildren ] whileFalse:[
cg@2188
  2403
		intoItem := intoItem parent.
cg@2188
  2404
	    ].
cg@2188
  2405
	    index := intoItem parent identityIndexOf:intoItem.
cg@2188
  2406
	    index := index + 1.
cg@2188
  2407
	    intoItem := intoItem parent.
cg@2188
  2408
	].
ca@1606
  2409
    ].
cg@1702
  2410
    newItem := aBlockOrItem value.
ca@1606
  2411
ca@1606
  2412
    newItem ifNotNil:[
cg@2188
  2413
	selectionHolder setValue:nil.
cg@2188
  2414
	intoItem expand.
cg@2188
  2415
cg@2188
  2416
	newItem isCollection ifTrue:[
cg@2188
  2417
	    intoItem addAll:newItem beforeIndex:index.
cg@2188
  2418
	    selectionHolder value:newItem.
cg@2188
  2419
	] ifFalse:[
cg@2188
  2420
	    intoItem add:newItem beforeIndex:index.
cg@2188
  2421
	    selectionHolder value:(Array with:newItem).
cg@2188
  2422
	].
cg@2188
  2423
	self setModified.
ca@1606
  2424
    ].
ca@1606
  2425
    ^ newItem
ca@1606
  2426
!
ca@1606
  2427
ca@1606
  2428
clearModified
cg@1971
  2429
    "clear the modifiedChannel and the commitPanel"
cg@1971
  2430
cg@2008
  2431
    super clearModified.
cg@1988
  2432
    self enablingCommitButtonsHolder value:false.
ca@1606
  2433
    self clearModifiedFlag.
ca@1606
  2434
!
ca@1606
  2435
ca@1606
  2436
generateMenuSpec
cg@2569
  2437
    "generate and returns the current menu spec or nil"
cg@2569
  2438
cg@2569
  2439
    |menu|
ca@1606
  2440
ca@1606
  2441
    menu := listOfItems root submenu.
cg@2151
  2442
    menu isNil ifTrue:[^ nil].
cg@2569
  2443
cg@2569
  2444
    ^ menu literalArrayEncoding.
cg@2569
  2445
!
cg@2569
  2446
cg@2569
  2447
generateMenuSpecString
cg@2569
  2448
    "generate and returns the current menu spec as string or nil"
cg@2569
  2449
cg@2569
  2450
    |menu specStream|
cg@2569
  2451
cg@2569
  2452
    menu := self generateMenuSpec.
cg@2569
  2453
    menu isNil ifTrue:[^ nil].
cg@2569
  2454
cg@2569
  2455
    specStream := WriteStream on:String new.
cg@2569
  2456
    UISpecification prettyPrintSpecArray:menu on:specStream indent:5.
cg@2569
  2457
    ^ specStream contents.
ca@1606
  2458
!
ca@1606
  2459
ca@1606
  2460
withoutNotifyDo:aBlock
ca@1606
  2461
    "evaluate the block; all change notifications are
sv@1722
  2462
     discard during the block is evaluated"
sv@1722
  2463
ca@1606
  2464
    |blockResult|
ca@1606
  2465
cg@2188
  2466
    [
cg@2188
  2467
	notifyDisabledCounter := notifyDisabledCounter + 1.
cg@2188
  2468
	blockResult := aBlock value.
sv@1722
  2469
    ] ensure:[
cg@2188
  2470
	notifyDisabledCounter := notifyDisabledCounter - 1
cg@2188
  2471
    ].
ca@1606
  2472
    ^ blockResult
ca@1606
  2473
! !
ca@1606
  2474
ca@1606
  2475
!MenuEditor methodsFor:'queries'!
ca@1606
  2476
ca@1606
  2477
hasValidSpecClass
ca@1606
  2478
    "returns true if a valid specClass exists
ca@1606
  2479
    "
ca@1606
  2480
    |cls|
ca@1606
  2481
cg@2151
  2482
    specClass isNil ifTrue:[^ false].
ca@1606
  2483
    cls := self resolveName:specClass.
cg@2151
  2484
    ^ cls notNil
cg@2569
  2485
!
cg@2569
  2486
cg@2569
  2487
isEditingSpecOnly
cg@2569
  2488
    ^ masterApplication notNil and:[ masterApplication isEditingSpecOnly ]
cg@2569
  2489
!
cg@2569
  2490
cg@2569
  2491
isNotEditingSpecOnly
cg@2569
  2492
    ^ self isEditingSpecOnly not
ca@1606
  2493
! !
ca@1606
  2494
ca@1606
  2495
!MenuEditor methodsFor:'selection'!
ca@1606
  2496
ca@1606
  2497
canSelect:anIndex
ca@1606
  2498
    "called whenever the selection changed; test whether
ca@1606
  2499
     current item is not modified ....
ca@1606
  2500
    "
cg@1711
  2501
    |oldSelectedItem newSelectedItem anythingChanged|
ca@1606
  2502
cg@1988
  2503
    self enablingCommitButtonsHolder value ifFalse:[
cg@2188
  2504
	^ true
ca@1606
  2505
    ].
ca@1606
  2506
    oldSelectedItem := self selectedItem.
cg@2151
  2507
    oldSelectedItem isNil ifTrue:[^ true].
ca@1606
  2508
ca@1606
  2509
    newSelectedItem := listOfItems at:anIndex ifAbsent:nil.
ca@1606
  2510
    oldSelectedItem == newSelectedItem ifTrue:[
cg@2188
  2511
	^ true
ca@1606
  2512
    ].
cg@1711
  2513
cg@1988
  2514
    anythingChanged := self enablingCommitButtonsHolder value.
cg@2188
  2515
    anythingChanged ifTrue:[
cg@2188
  2516
	self autoAcceptOnSelectionChange value ifTrue:[
cg@2188
  2517
	    self accept.
cg@2188
  2518
	    ^ true
cg@2188
  2519
	].
cg@1711
  2520
    ].
cg@1711
  2521
ca@1606
  2522
    ^ self askForItemModification
ca@1606
  2523
!
ca@1606
  2524
ca@1610
  2525
hasSelection
ca@1610
  2526
    "returns true if a selection exists
ca@1610
  2527
    "
ca@1610
  2528
    ^ selectionHolder value size ~~ 0
ca@1610
  2529
!
ca@1610
  2530
ca@1606
  2531
selectedItem
ca@1606
  2532
    "returns the selected item or nil (none or multiple selected)
ca@1606
  2533
    "
ca@1606
  2534
    |selection|
ca@1606
  2535
ca@1606
  2536
    selection := selectionHolder value.
ca@1606
  2537
    selection size == 1 ifTrue:[ ^ selection first ].
ca@1606
  2538
  ^ nil
ca@1606
  2539
!
ca@1606
  2540
ca@1606
  2541
selectedItem:anItem
ca@1606
  2542
    "change selection to an item
ca@1606
  2543
    "
ca@1606
  2544
    |selection|
ca@1606
  2545
ca@1606
  2546
    anItem notNil ifTrue:[ selection := Array with:anItem ]
ca@1606
  2547
		 ifFalse:[ selection := #() ].
ca@1606
  2548
ca@1606
  2549
    selectionHolder value:selection.
ca@1606
  2550
! !
ca@1606
  2551
cg@1715
  2552
!MenuEditor methodsFor:'user actions-aspects'!
ca@1614
  2553
ca@1614
  2554
collectActionSelectors
ca@1614
  2555
    |selectors|
ca@1614
  2556
ca@1614
  2557
    selectors := IdentitySet new.
ca@1614
  2558
ca@1614
  2559
    listOfItems root recursiveDo:[:el|
cg@2188
  2560
	el actionSelectors do:[:s| selectors add:s ].
ca@1614
  2561
    ].
ca@1614
  2562
    ^ selectors asOrderedCollection
ca@1614
  2563
!
ca@1614
  2564
ca@1614
  2565
collectAspectSelectors
ca@1614
  2566
    |selectors|
ca@1614
  2567
ca@1614
  2568
    selectors := IdentitySet new.
ca@1614
  2569
ca@1614
  2570
    listOfItems root recursiveDo:[:el|
cg@2252
  2571
        selectors addAll:(el aspectSelectors).
ca@1614
  2572
    ].
ca@1614
  2573
    ^ selectors asOrderedCollection
ca@1614
  2574
!
ca@1614
  2575
cg@2297
  2576
doBrowseActionMethod
cg@2297
  2577
    |selector cls category|
cg@2297
  2578
cg@2297
  2579
    selector := (self aspectFor:#itemValue) value.
cg@2297
  2580
cg@2297
  2581
    selector isEmptyOrNil ifTrue:[
cg@2297
  2582
        Dialog information:(resources 
cg@2297
  2583
                                string:'Please enter an action method name.').
cg@2297
  2584
        ^ self
cg@2297
  2585
    ].
cg@2297
  2586
cg@2297
  2587
    selector := selector asSymbol.
cg@2297
  2588
cg@2297
  2589
    specClass isNil ifTrue:[
cg@2297
  2590
        self warn:'Please define the application class first.'.
cg@2297
  2591
        ^ self
cg@2297
  2592
    ].
cg@2297
  2593
cg@2297
  2594
    cls := self resolveName:specClass.
cg@2297
  2595
    cls isNil ifTrue:[
cg@2297
  2596
        self warn:'Class ', specClass asString, ' does not exist!!'.
cg@2297
  2597
        ^ self
cg@2297
  2598
    ].
cg@2297
  2599
cg@2297
  2600
    (cls implements:selector) ifFalse:[
cg@2297
  2601
        category := UserPreferences current categoryForMenuActionsMethods.
cg@2297
  2602
cg@2297
  2603
        CodeGeneratorTool
cg@2297
  2604
            createActionMethodFor:selector in:cls
cg@2297
  2605
            category:category
cg@2297
  2606
            redefine:(self redefineAspectMethodsChannel value).
cg@2297
  2607
    ].
cg@2297
  2608
cg@2331
  2609
    UserPreferences current systemBrowse 
cg@2297
  2610
!
cg@2297
  2611
ca@1614
  2612
doGenerateAspectMethods
cg@1805
  2613
    "compile aspect and action methods"
cg@1805
  2614
cg@1805
  2615
    |cls redefineAspectMethods category|
ca@1614
  2616
cg@2151
  2617
    specClass isNil ifTrue:[
cg@2275
  2618
        self warn:'Define the class first !!'.
cg@2275
  2619
        ^ self
ca@1614
  2620
    ].
ca@1617
  2621
    redefineAspectMethods := self redefineAspectMethodsChannel value.
ca@1614
  2622
ca@1614
  2623
    cls := self resolveName:specClass.
cg@2151
  2624
    cls isNil ifTrue:[
cg@2275
  2625
        self warn:'Class ', specClass asString, ' does not exist!!'.
cg@2275
  2626
        ^ self
ca@1614
  2627
    ].
ca@1617
  2628
cg@1805
  2629
    category := UserPreferences current categoryForMenuActionsMethods.
cg@1805
  2630
ca@1617
  2631
    self collectActionSelectors do:[:aSelector|
cg@2275
  2632
        CodeGeneratorTool
cg@2275
  2633
            createActionMethodFor:aSelector in:cls
cg@2275
  2634
            category:category
cg@2275
  2635
            redefine:redefineAspectMethods.
ca@1614
  2636
    ].
ca@1614
  2637
ca@1617
  2638
    self collectAspectSelectors do:[:anAspect|
cg@2275
  2639
        CodeGeneratorTool
cg@2275
  2640
            createAspectMethodFor:anAspect in:cls
cg@2275
  2641
            category:category
cg@2275
  2642
            redefine:redefineAspectMethods
ca@1614
  2643
    ].
ca@1614
  2644
! !
ca@1614
  2645
cg@1715
  2646
!MenuEditor methodsFor:'user actions-building'!
ca@1606
  2647
cg@2331
  2648
doChooseAMenu
cg@2331
  2649
    "pick a menu and edit its spec method"
cg@2331
  2650
cg@2331
  2651
    |view subSpec app bldr spec menuSelector1 menuSelector2 info|
cg@2331
  2652
cg@2331
  2653
    self askForModification ifTrue:[
cg@2331
  2654
        view := Screen current viewFromUser.
cg@2331
  2655
        (view isNil or:[view == Screen current rootView]) ifTrue:[
cg@2331
  2656
            ^ self
cg@2331
  2657
        ].
cg@2331
  2658
        view specClass == MenuPanelSpec ifTrue:[
cg@2331
  2659
            (app := view application) isNil ifTrue:[
cg@2331
  2660
                info := 'Could not figure out the application class.'
cg@2331
  2661
            ] ifFalse:[
cg@2331
  2662
                (bldr := app builder) isNil ifTrue:[ 
cg@2331
  2663
                    info := 'Application has no builder.'
cg@2331
  2664
                ] ifFalse:[
cg@2331
  2665
                    menuSelector1 := bldr namedComponents keyAtValue:view ifAbsent:nil.
cg@2331
  2666
                    (spec := bldr spec) isNil ifTrue:[
cg@2331
  2667
                        info := 'Cannot fetch spec from applications builder.'
cg@2331
  2668
                    ] ifFalse:[
cg@2331
  2669
                        subSpec := spec findSpecForWhich:[:subSpec | subSpec name = view name].
cg@2331
  2670
                        subSpec isNil ifTrue:[
cg@2331
  2671
                            info := 'Cannot find view-spec for ',view name asString,'.'
cg@2331
  2672
                        ] ifFalse:[
cg@2331
  2673
                            menuSelector2 := subSpec menu.
cg@2331
  2674
                        ]
cg@2331
  2675
                    ].
cg@2331
  2676
                    (menuSelector1 isNil and:[ menuSelector2 isNil ]) ifTrue:[
cg@2331
  2677
                        info := 'menu is probably not provided by a menuSelector.'
cg@2331
  2678
                    ] ifFalse:[
cg@2331
  2679
                        (app class respondsTo:menuSelector1) ifTrue:[
cg@2331
  2680
                            self loadFromClass:app class andSelector:menuSelector1.
cg@2331
  2681
                            ^ self.
cg@2331
  2682
                        ].
cg@2331
  2683
                        (app class respondsTo:menuSelector2) ifTrue:[
cg@2331
  2684
                            self loadFromClass:app class andSelector:menuSelector2.
cg@2331
  2685
                            ^ self.
cg@2331
  2686
                        ].
cg@2331
  2687
                        info := 'menu is probably not provided by a menuSelector.'
cg@2331
  2688
                    ].
cg@2331
  2689
                ]
cg@2331
  2690
            ].
cg@2331
  2691
            info notNil ifTrue:[
cg@2331
  2692
                app notNil ifTrue:[
cg@2331
  2693
                    (Dialog confirm:(info,'\\Browse ?' withCRs)) ifTrue:[
cg@2331
  2694
                        app browse.
cg@2331
  2695
                    ].
cg@2331
  2696
                ] ifFalse:[
cg@2331
  2697
                    Dialog information:info.
cg@2331
  2698
                ].
cg@2331
  2699
            ].
cg@2331
  2700
            ^ self.
cg@2331
  2701
        ].
cg@2331
  2702
    ].
cg@2331
  2703
!
cg@2331
  2704
ca@1606
  2705
doNew
ca@1606
  2706
    "clear editing menu; start from scratch
ca@1606
  2707
    "
ca@1606
  2708
    super doNew ifTrue:[ self helpTool doNew ].
ca@1606
  2709
!
ca@1606
  2710
ca@1606
  2711
doPickAMenu
cg@2331
  2712
    "let user pick a menu and create a new spec"
cg@1971
  2713
ca@1606
  2714
    |view|
ca@1606
  2715
ca@1606
  2716
    self askForModification ifTrue:[
cg@2331
  2717
        view := Screen current viewFromUser.
cg@2331
  2718
        (view isNil or:[view == Screen current rootView]) ifTrue:[
cg@2331
  2719
            ^ self
cg@2331
  2720
        ].
cg@2331
  2721
        view specClass == MenuPanelSpec ifTrue:[
cg@2331
  2722
            specSelector := #pickedMenu.
cg@2331
  2723
            self buildFromMenu:(view asMenu) selector:specSelector.
cg@2331
  2724
        ].
ca@1606
  2725
    ].
ca@1606
  2726
!
ca@1606
  2727
ca@1606
  2728
doSave
ca@1606
  2729
    "save current editing menu to
cg@2569
  2730
           class: specClass
cg@2569
  2731
        selector: specSelector
cg@2569
  2732
    "
cg@2569
  2733
    |cls specCode mthd category code excla|
cg@2569
  2734
cg@2569
  2735
    self isEditingSpecOnly ifTrue:[
cg@2569
  2736
        savedSpec := self generateMenuSpec.
cg@2569
  2737
        hasSaved := true.
cg@2569
  2738
        self clearModified.
cg@2569
  2739
        ^ self
cg@2569
  2740
    ].
ca@1606
  2741
ca@1606
  2742
    super doSave ifFalse: [^nil].
cg@2569
  2743
    specCode := self generateMenuSpecString.
cg@2569
  2744
    specCode isNil ifTrue:[^ nil].
ca@1606
  2745
ca@1606
  2746
    cls  := self resolveName:specClass.
ca@1606
  2747
ca@1606
  2748
    "/ if that method already exists, do not overwrite the category
ca@1606
  2749
ca@1606
  2750
    category := 'menu specs'.
ca@1606
  2751
    (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[
cg@2569
  2752
        category := mthd category.
ca@1606
  2753
    ].
ca@1606
  2754
ca@1606
  2755
    excla := Character excla asString.
ca@1606
  2756
ca@1606
  2757
    code := excla
cg@2569
  2758
            , (cls name , ' class methodsFor:' , category storeString)
cg@2569
  2759
            , excla , '\\'
cg@2569
  2760
cg@2569
  2761
            , specSelector , '\'
cg@2569
  2762
            , (self class codeGenerationComment replChar:$!! withString:'!!!!')
cg@2569
  2763
            , '\\    "\'
cg@2569
  2764
            , ('     MenuEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\')
cg@2569
  2765
            , ('     (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , specSelector , ')) startUp\')
cg@2569
  2766
            , '    "\'.
cg@2188
  2767
cg@2188
  2768
    code := code
cg@2569
  2769
            , '\'
cg@2569
  2770
            , '    <resource: #menu>\\'
cg@2569
  2771
            , '    ^ ' , specCode
cg@2569
  2772
            , '\'
cg@2569
  2773
            , (excla , ' ' , excla)
cg@2569
  2774
            , '\\'.
ca@1606
  2775
ca@1606
  2776
    code := code withCRs.
ca@1606
  2777
    (ReadStream on:code) fileIn.
ca@1606
  2778
ca@1669
  2779
    self isStandAlone ifTrue:[
cg@2569
  2780
        self helpTool doSave
ca@1669
  2781
    ].
ca@1606
  2782
ca@1606
  2783
    self updateHistory.
ca@1606
  2784
    hasSaved := true.
cg@1971
  2785
    self clearModified.
ca@1606
  2786
!
ca@1606
  2787
ca@1606
  2788
doSaveAs
ca@1606
  2789
    "save current editing menu to class and selector
ca@1606
  2790
     defined by the user.
ca@1606
  2791
    "
ca@1606
  2792
    super doSaveAs ifTrue:[
ca@1606
  2793
	listOfItems root rawLabel:specSelector
ca@1606
  2794
    ].
ca@1606
  2795
!
ca@1606
  2796
ca@1606
  2797
doShowMenuSpec
cg@2569
  2798
    "opens a code view with the contents of the menu spec"
cg@2569
  2799
cg@2569
  2800
    |code|
cg@2569
  2801
cg@2569
  2802
    code := self generateMenuSpecString.
cg@2569
  2803
cg@2569
  2804
    code ifNotNil:[
cg@2569
  2805
        CodeView openWith:code title: 'Menu Spec'
ca@1606
  2806
    ].
cg@1971
  2807
!
cg@1971
  2808
cg@1971
  2809
save
cg@1971
  2810
    self doSave
ca@1606
  2811
! !
ca@1606
  2812
cg@1715
  2813
!MenuEditor methodsFor:'user actions-creation'!
ca@1606
  2814
ca@1606
  2815
doCreateDelayedMenu:what
ca@1606
  2816
    |selectedItem delayedItem|
ca@1606
  2817
ca@1606
  2818
    selectedItem := self selectedItem.
cg@2151
  2819
    selectedItem isNil ifTrue:[^ self].
ca@1606
  2820
ca@1606
  2821
    selectedItem canAddDelayedMenu      ifFalse:[ ^ self ].
ca@1606
  2822
    self askForItemModification ifFalse:[ ^ self ].
ca@1606
  2823
ca@1633
  2824
    what == #menu ifTrue:[ delayedItem := RegularMenuItem new ]
cg@2188
  2825
		 ifFalse:[ delayedItem := LinkedMenuItem new ].
ca@1606
  2826
ca@1606
  2827
    delayedItem setExpanded:true.
ca@1606
  2828
    delayedItem := selectedItem add:delayedItem.
ca@1606
  2829
ca@1606
  2830
    delayedItem ifNotNil:[
cg@2188
  2831
	self selectedItem:delayedItem.
ca@1606
  2832
    ].
ca@1606
  2833
!
ca@1606
  2834
ca@1606
  2835
doCreateItem
ca@1606
  2836
    "create a new Item
ca@1606
  2837
    "
cg@1702
  2838
    self addAndSelectValueOf:[ ActionItem new translateLabel:true ].
ca@1606
  2839
!
ca@1606
  2840
ca@1606
  2841
doCreateLinkedMenu
ca@1606
  2842
    "create a new Linked Menu
ca@1606
  2843
    "
cg@1702
  2844
    self addAndSelectValueOf:[ LinkedMenuItem new ].
ca@1606
  2845
!
ca@1606
  2846
ca@1606
  2847
doCreateMenu
ca@1606
  2848
    "create a new Menu
ca@1606
  2849
    "
cg@1702
  2850
    self addAndSelectValueOf:
cg@2188
  2851
	[ |item|
cg@2188
  2852
	    item := RegularMenuItem new.
cg@2188
  2853
	    "/ --- do not add it expanded - because that makes it hard to add multipe menus
cg@2188
  2854
	    "/ item expand.
cg@2188
  2855
	    item
cg@2188
  2856
	].
ca@1606
  2857
!
ca@1606
  2858
ca@1844
  2859
doCreateMenuSliceItem
ca@1844
  2860
    "create a new MenuSlice Item
ca@1844
  2861
    "
ca@1844
  2862
    self addAndSelectValueOf:[ MenuSliceItem new ].
ca@1844
  2863
!
ca@1844
  2864
ca@1606
  2865
doCreateSep
ca@1606
  2866
    "create a new Separator Item
ca@1606
  2867
    "
cg@1702
  2868
    self addAndSelectValueOf:[ SeparatorItem new ].
ca@1606
  2869
!
ca@1606
  2870
ca@1606
  2871
doCreateStandardEditMenu
cg@2345
  2872
    "create a standard edit menu
ca@1606
  2873
    "
cg@1702
  2874
    self addAndSelectValueOf:[
cg@2345
  2875
        RegularMenuItem menu:(self class standardEditMenu) labeled:'Edit' translateLabel:true
ca@1606
  2876
    ].
ca@1606
  2877
!
ca@1606
  2878
ca@1606
  2879
doCreateStandardFileMenu
cg@2345
  2880
    "create a standard file menu
ca@1606
  2881
    "
cg@1702
  2882
    self addAndSelectValueOf:[
cg@2345
  2883
        RegularMenuItem menu:(self class standardFileMenu) labeled:'File' translateLabel:true
ca@1606
  2884
    ].
ca@1606
  2885
!
ca@1606
  2886
ca@1606
  2887
doCreateStandardHelpMenu
cg@2345
  2888
    "create a standard help menu
ca@1606
  2889
    "
ca@1606
  2890
    |item|
ca@1606
  2891
cg@1702
  2892
    self addAndSelectValueOf:[
cg@2345
  2893
        item := RegularMenuItem menu:(self class standardHelpMenu) labeled:'Help' translateLabel:true.
cg@2345
  2894
        item aspectAt:#startGroup put:#conditionalRight.
cg@2345
  2895
        item
ca@1606
  2896
    ].