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