1 " |
1 " |
2 COPYRIGHT (c) 1997 by eXept Software AG |
2 COPYRIGHT (c) 1997 by eXept Software AG |
3 All Rights Reserved |
3 All Rights Reserved |
4 |
4 |
5 This software is furnished under a license and may be used |
5 This software is furnished under a license and may be used |
6 only in accordance with the terms of that license and with the |
6 only in accordance with the terms of that license and with the |
7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 |
|
14 |
|
15 "{ Package: 'stx:libtool2' }" |
13 "{ Package: 'stx:libtool2' }" |
16 |
14 |
17 ResourceSpecEditor subclass:#MenuEditor |
15 ResourceSpecEditor subclass:#MenuEditor |
18 instanceVariableNames:'treeView typeOfCanvas listOfCanvas listOfSlices |
16 instanceVariableNames:'selectionHolder tabHolder listOfItems listOfTabs |
19 lastImageRetriever slices' |
17 selectedSuperItems notifyDisabledCounter wizards listOfItemsView' |
20 classVariableNames:'ImageRetrieverClasses' |
18 classVariableNames:'ImageRetrieverClasses' |
21 poolDictionaries:'' |
19 poolDictionaries:'' |
22 category:'Interface-UIPainter' |
20 category:'Interface-UIPainter' |
23 ! |
21 ! |
24 |
22 |
25 Object subclass:#Item |
23 HierarchicalItem subclass:#Item |
26 instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey |
24 instanceVariableNames:'menuItem' |
27 accessCharacterPos retriever icon iconAndLabel submenuChannel |
|
28 startGroup argument translateLabel isButton isVisible choice |
|
29 choiceValue auxValue hideMenuOnActivated font horizontalLayout |
|
30 showBusyCursorWhilePerforming keepLinkedMenu triggerOnDown' |
|
31 classVariableNames:'' |
25 classVariableNames:'' |
32 poolDictionaries:'' |
26 poolDictionaries:'' |
33 privateIn:MenuEditor |
27 privateIn:MenuEditor |
34 ! |
28 ! |
35 |
29 |
36 SelectionInTreeView subclass:#TreeView |
30 MenuEditor::Item subclass:#ItemAction |
37 instanceVariableNames:'' |
31 instanceVariableNames:'' |
38 classVariableNames:'' |
32 classVariableNames:'' |
39 poolDictionaries:'' |
33 poolDictionaries:'' |
40 privateIn:MenuEditor |
34 privateIn:MenuEditor |
41 ! |
35 ! |
42 |
36 |
|
37 MenuEditor::Item subclass:#ItemLinkedMenu |
|
38 instanceVariableNames:'' |
|
39 classVariableNames:'' |
|
40 poolDictionaries:'' |
|
41 privateIn:MenuEditor |
|
42 ! |
|
43 |
|
44 MenuEditor::Item subclass:#ItemMenu |
|
45 instanceVariableNames:'' |
|
46 classVariableNames:'' |
|
47 poolDictionaries:'' |
|
48 privateIn:MenuEditor |
|
49 ! |
|
50 |
|
51 MenuEditor::ItemMenu subclass:#ItemRoot |
|
52 instanceVariableNames:'' |
|
53 classVariableNames:'' |
|
54 poolDictionaries:'' |
|
55 privateIn:MenuEditor |
|
56 ! |
|
57 |
|
58 MenuEditor::Item subclass:#ItemSeparator |
|
59 instanceVariableNames:'' |
|
60 classVariableNames:'' |
|
61 poolDictionaries:'' |
|
62 privateIn:MenuEditor |
|
63 ! |
|
64 |
|
65 ApplicationModel subclass:#ResourceEditor |
|
66 instanceVariableNames:'selectorHolder iconAndLabelHolder retrieverHolder imageHolder |
|
67 imageList imageViewer' |
|
68 classVariableNames:'' |
|
69 poolDictionaries:'' |
|
70 privateIn:MenuEditor |
|
71 ! |
|
72 |
|
73 HierarchicalItem subclass:#ResourceEditorItem |
|
74 instanceVariableNames:'selector icon' |
|
75 classVariableNames:'' |
|
76 poolDictionaries:'' |
|
77 privateIn:MenuEditor |
|
78 ! |
|
79 |
43 !MenuEditor class methodsFor:'documentation'! |
80 !MenuEditor class methodsFor:'documentation'! |
44 |
81 |
45 copyright |
82 copyright |
46 " |
83 " |
47 COPYRIGHT (c) 1997 by eXept Software AG |
84 COPYRIGHT (c) 1997 by eXept Software AG |
48 All Rights Reserved |
85 All Rights Reserved |
49 |
86 |
50 This software is furnished under a license and may be used |
87 This software is furnished under a license and may be used |
51 only in accordance with the terms of that license and with the |
88 only in accordance with the terms of that license and with the |
52 inclusion of the above copyright notice. This software may not |
89 inclusion of the above copyright notice. This software may not |
53 be provided or otherwise made available to, or used by, any |
90 be provided or otherwise made available to, or used by, any |
54 other person. No title to or ownership of the software is |
91 other person. No title to or ownership of the software is |
55 hereby transferred. |
92 hereby transferred. |
56 " |
93 " |
57 |
|
58 |
|
59 ! |
94 ! |
60 |
95 |
61 documentation |
96 documentation |
62 " |
97 " |
63 The MenuEditor allows you to create, modify or just inspect |
98 The MenuEditor allows you to create, modify or just inspect |
64 hierarchical menus of menu bars, popup menu, or tool bar menus. |
99 menus. |
|
100 |
|
101 |
|
102 [Instance variables:] |
|
103 |
|
104 selectionHolder <ValueHolder> collection of current selected items |
|
105 tabHolder <ValueHolder> selected tab label holder |
|
106 listOfItems <HierarchicalList> hierarchical list of menu items |
|
107 listOfTabs <List> list of current shown tab-labels |
|
108 wizards <IdentityDictionary> keeps all created wizard dialogs |
|
109 selectedSuperItems <Collection> collection of superItems derived from selection |
|
110 notifyDisabledCounter <SmallInteger> ~~ 0 than change notifications are discard |
|
111 |
|
112 [Class variables:] |
|
113 ImageRetrieverClasses <Collection> sorted collection of image receivers |
65 |
114 |
66 [start with:] |
115 [start with:] |
67 MenuEditor open |
116 MenuEditor open |
68 MenuEditor openOnClass:MenuEditor andSelector:#menu |
117 MenuEditor openOnClass:MenuEditor andSelector:#menu |
69 |
|
70 [see also:] |
|
71 UIPainter |
|
72 |
118 |
73 [author:] |
119 [author:] |
74 Claus Atzkern, eXept Software AG |
120 Claus Atzkern, eXept Software AG |
75 Thomas Zwick, eXept Software AG |
121 Thomas Zwick, eXept Software AG |
76 " |
122 " |
77 |
|
78 ! ! |
123 ! ! |
79 |
124 |
80 !MenuEditor class methodsFor:'initialization'! |
125 !MenuEditor class methodsFor:'initialization'! |
81 |
126 |
82 initialize |
127 initialize |
83 ImageRetrieverClasses := #( |
128 ImageRetrieverClasses := #( |
84 Icon |
129 Icon |
85 NewLauncher |
130 SystemBrowser |
86 SystemBrowser |
131 ToolbarIconLibrary |
87 ToolbarIconLibrary |
132 ). |
88 ) |
|
89 |
133 |
90 " |
134 " |
91 self initialize |
135 self initialize |
92 " |
136 " |
93 ! ! |
137 ! ! |
94 |
138 |
95 !MenuEditor class methodsFor:'instance creation'! |
139 !MenuEditor class methodsFor:'instance creation'! |
96 |
140 |
97 openModalOnMenu: aMenu |
141 openModalOnMenu: aMenu |
98 "Open a MenuEditor modal on aMenu" |
142 "Open a MenuEditor modal on aMenu |
99 "self openModalOnMenu: (self perform: #menu) decodeAsLiteralArray" |
143 self openModalOnMenu: (self perform: #menu) decodeAsLiteralArray |
100 |
144 " |
101 ^self new openModalOnMenu: aMenu |
145 ^self new openModalOnMenu:aMenu |
102 ! ! |
146 ! ! |
103 |
147 |
104 !MenuEditor class methodsFor:'accessing'! |
148 !MenuEditor class methodsFor:'accessing image retriever'! |
|
149 |
|
150 addNewImageRetriever:aSymbolOrClass |
|
151 "add a class to the imageRetriever list" |
|
152 |
|
153 |key| |
|
154 |
|
155 aSymbolOrClass isBehavior ifTrue:[ |
|
156 key := aSymbolOrClass nameWithNameSpacePrefix |
|
157 ] ifFalse:[ |
|
158 key := aSymbolOrClass |
|
159 ]. |
|
160 |
|
161 key size ~~ 0 ifTrue:[ |
|
162 key := key asSymbol. |
|
163 |
|
164 (ImageRetrieverClasses includes:key) ifFalse:[ |
|
165 ImageRetrieverClasses := ImageRetrieverClasses asOrderedCollection. |
|
166 ImageRetrieverClasses add:key. |
|
167 ImageRetrieverClasses sort. |
|
168 ] |
|
169 ]. |
|
170 ! |
|
171 |
|
172 imageRetrieverClasses |
|
173 "returns a collection of image retrievers |
|
174 " |
|
175 ^ ImageRetrieverClasses |
|
176 ! ! |
|
177 |
|
178 !MenuEditor class methodsFor:'aspects'! |
|
179 |
|
180 aspects |
|
181 "get the aspects for the attributes of the menu components" |
|
182 |
|
183 ^#( |
|
184 rawLabel |
|
185 accessCharacterPosition |
|
186 showBusyCursorWhilePerforming |
|
187 horizontalLayout |
|
188 triggerOnDown |
|
189 font |
|
190 argument |
|
191 submenuChannel |
|
192 keepLinkedMenu |
|
193 enabled |
|
194 value |
|
195 nameKey |
|
196 indication |
|
197 choice |
|
198 choiceValue |
|
199 translateLabel |
|
200 isButton |
|
201 shortcutKeyCharacter |
|
202 startGroup |
|
203 isVisible |
|
204 hideMenuOnActivated |
|
205 auxValue |
|
206 activeHelpKey |
|
207 resourceRetriever |
|
208 ) |
|
209 ! ! |
|
210 |
|
211 !MenuEditor class methodsFor:'defaults'! |
|
212 |
|
213 aboutImage |
|
214 "the image to be displayed in my about-box; |
|
215 If nil is returned, the ST/X default image is used. |
|
216 " |
|
217 ^ Image fromFile:'bitmaps/xpmBitmaps/misc_tools/setup_menus.xpm' |
|
218 ! |
|
219 |
|
220 resourceType |
|
221 "get the type of the resource of the method generated by the MenuEditor |
|
222 " |
|
223 ^ #menu |
|
224 ! ! |
|
225 |
|
226 !MenuEditor class methodsFor:'help specs'! |
|
227 |
|
228 flyByHelpSpec |
|
229 ^super flyByHelpSpec addPairsFrom:(self localHelpSpecStrings) |
|
230 ! |
|
231 |
|
232 helpSpec |
|
233 ^super helpSpec addPairsFrom:(self localHelpSpecStrings) |
|
234 ! |
|
235 |
|
236 localHelpSpecStrings |
|
237 "This resource specification was automatically generated |
|
238 by the UIHelpTool of ST/X." |
|
239 |
|
240 "Do not manually edit this!! If it is corrupted, |
|
241 the UIHelpTool may not be able to read the specification." |
|
242 |
|
243 " |
|
244 UIHelpTool openOnClass:MenuEditor |
|
245 " |
|
246 |
|
247 <resource: #help> |
|
248 |
|
249 ^ #( |
|
250 |
|
251 #addDelayedMenu |
|
252 'Add a new delayed menu to item.' |
|
253 |
|
254 #addDelayedSubMenuLink |
|
255 'Add a new linked delayed menu to item.' |
|
256 |
|
257 #addMenuItem |
|
258 'Add a new menu item.' |
|
259 |
|
260 #addMenuSeparator |
|
261 'Add a new menu separator.' |
|
262 |
|
263 #addSubMenu |
|
264 'Add a new sub menu.' |
|
265 |
|
266 #addSubMenuLink |
|
267 'Add a new linked sub menu.' |
|
268 |
|
269 #basicsAction |
|
270 'An action selector with 0, 1 (the argument field), or 2 (the selected item) arguments.' |
|
271 |
|
272 #basicsArgument |
|
273 'An optional arg passed with above selector, if it is a 1 or 2 arg selector (enter a Smalltalk literal).' |
|
274 |
|
275 #basicsChoice |
|
276 'Aspect for a boolean holder, block or method, specifying the choices state (RadioButton behavior).' |
|
277 |
|
278 #basicsChoiceValue |
|
279 'That choices value (typically number or symbol).' |
|
280 |
|
281 #basicsIndication |
|
282 'Aspect for boolean holder, block, or method, specifying the indication state (CheckToggle behavior).' |
|
283 |
|
284 #basicsIsButton |
|
285 'Enable/disable button-like behavior.' |
|
286 |
|
287 #basicsKey |
|
288 'Internal key of the item (optional, for programmed accesses).' |
|
289 |
|
290 #basicsLabel |
|
291 'Label of the item.' |
|
292 |
|
293 #basicsMenu |
|
294 'Aspect providing the sub menu to be opened if item is selected (provide spec or valueHolder).' |
|
295 |
|
296 #basicsMenuArgument |
|
297 'An argument passed with the menu selector.' |
|
298 |
|
299 #basicsNameKey |
|
300 'Unique identifier of the item (optional).' |
|
301 |
|
302 #basicsSelector |
|
303 'Selector under which the generated menu spec is saved.' |
|
304 |
|
305 #basicsSeparatorType |
|
306 'List of valid separators.' |
|
307 |
|
308 #basicsTranslateLabel |
|
309 'Translate the label via the classes resource file (internationalization).' |
|
310 |
|
311 #browseResource |
|
312 'Search for methods with image resource.' |
|
313 |
|
314 #detailsAccelerator |
|
315 'Accelerator key to select the menu item from the keyboard (Cmdx or Ctrlx).' |
|
316 |
|
317 #detailsAccessCharaterPosition |
|
318 'Index of the access character position of the textual label (obsolete, VW compatibility).' |
|
319 |
|
320 #detailsAuxValue |
|
321 'Some additional value - for arbitrary use by the program' |
|
322 |
|
323 #detailsEnabled |
|
324 'Aspect or binding providing a boolean value holder for the enable-state of the menu item.' |
|
325 |
|
326 #detailsStartGroup |
|
327 'Specify start of a right-aligned item group.' |
|
328 |
|
329 #detailsVisibility |
|
330 'Aspect or binding providing a boolean value holder for the visibility-state of the menu item.' |
|
331 |
|
332 #fileLoad |
|
333 'Open a dialog to select and load a menu spec from a class.' |
|
334 |
|
335 #fileNew |
|
336 'Create a new menu spec.' |
|
337 |
|
338 #filePickAMenu |
|
339 'Select a menu from an open view and read its specification' |
|
340 |
|
341 #fileSave |
|
342 'Save the menu spec (and the help spec, if modified).' |
|
343 |
|
344 #fileSaveAs |
|
345 'Open a dialog to save the menu spec (and the help spec, if modified).' |
|
346 |
|
347 #fileShowMenuSpec |
|
348 'Opens a Workspace showing the current menu spec.' |
|
349 |
|
350 #hideMenuOnActivated |
|
351 'If on, the menu hides itself after the item was activated.' |
|
352 |
|
353 #horizontalLayout |
|
354 'If on, the submenu organizes its items horizontal insteat of vertical (default).' |
|
355 |
|
356 #imageImageAndLabel |
|
357 'Toggle display of both image and textual label.' |
|
358 |
|
359 #imageImageEditor |
|
360 'Open an Image Editor on the resource method defined by retriever and selector.' |
|
361 |
|
362 #imageImageList |
|
363 'Currently existing image resources.' |
|
364 |
|
365 #imageRetriever |
|
366 'Class implementing the image resource method. If no class is given, the current application class will be taken.' |
|
367 |
|
368 #imageSelector |
|
369 'Selector returning an image (sent to above or the application).' |
|
370 |
|
371 #keepLinkedMenu |
|
372 'Keep the linked menu after activation (do not destroy).' |
|
373 |
|
374 #showBusyCursorWhilePerforming |
|
375 'If on, a busy cursor is shown while the items action is performing.' |
|
376 |
|
377 #triggerOnDown |
|
378 'If on, the items action is performed on mouse-button press (default is on button-release).' |
|
379 |
|
380 ) |
|
381 ! ! |
|
382 |
|
383 !MenuEditor class methodsFor:'image specs'! |
105 |
384 |
106 iconUnknown |
385 iconUnknown |
107 "returns an image used for picked items containing an image |
386 "returns an image used for picked items containing an image |
108 " |
387 " |
109 <resource: #fileImage> |
388 <resource: #fileImage> |
110 |
389 |
111 ^ MenuPanelSpec icon |
390 ^ MenuPanelSpec icon |
112 ! |
391 ! ! |
113 |
392 |
114 resourceType |
393 !MenuEditor class methodsFor:'interface specs'! |
115 "get the type of resource of the method generated by the MenuEditor" |
394 |
116 |
395 windowSpec |
117 ^#menu |
396 "This resource specification was automatically generated |
118 |
397 by the UIPainter of ST/X." |
119 |
398 |
120 |
399 "Do not manually edit this!! If it is corrupted, |
121 |
400 the UIPainter may not be able to read the specification." |
122 ! ! |
401 |
123 |
402 " |
124 !MenuEditor class methodsFor:'accessing image retriever'! |
403 UIPainter new openOnClass:MenuEditor andSelector:#windowSpec |
125 |
404 MenuEditor new openInterface:#windowSpec |
126 addNewImageRetriever:aSymbolOrClass |
405 MenuEditor open |
127 "add a class to the imageRetriever list" |
406 " |
128 |
407 |
129 |key| |
408 <resource: #canvas> |
130 |
409 |
131 aSymbolOrClass isBehavior ifTrue:[ |
410 ^ |
132 key := aSymbolOrClass nameWithNameSpacePrefix |
411 #(#FullSpec |
|
412 #name: #windowSpec |
|
413 #window: |
|
414 #(#WindowSpec |
|
415 #label: 'Menu Editor' |
|
416 #name: 'Menu Editor' |
|
417 #min: #(#Point 550 385) |
|
418 #max: #(#Point 1152 900) |
|
419 #bounds: #(#Rectangle 117 275 693 750) |
|
420 #menu: #menu |
|
421 #returnIsOKInDialog: false |
|
422 #escapeIsCancelInDialog: false |
|
423 ) |
|
424 #component: |
|
425 #(#SpecCollection |
|
426 #collection: #( |
|
427 #(#MenuPanelSpec |
|
428 #name: 'toolbar' |
|
429 #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
430 #tabable: true |
|
431 #menu: #toolbar |
|
432 #showSeparatingLines: true |
|
433 ) |
|
434 #(#VariableHorizontalPanelSpec |
|
435 #name: 'VariableHorizontalPanel' |
|
436 #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) |
|
437 #component: |
|
438 #(#SpecCollection |
|
439 #collection: #( |
|
440 #(#HierarchicalListViewSpec |
|
441 #name: 'ListOfItemsView' |
|
442 #model: #selectionHolder |
|
443 #menu: #editMenu |
|
444 #hasHorizontalScrollBar: true |
|
445 #hasVerticalScrollBar: true |
|
446 #miniScrollerHorizontal: true |
|
447 #miniScrollerVertical: true |
|
448 #listModel: #listOfItems |
|
449 #multipleSelectOk: true |
|
450 #useIndex: false |
|
451 #highlightMode: #label |
|
452 #doubleClickSelector: #indicatorClickedAt: |
|
453 #selectConditionSelector: #canSelect: |
|
454 #showLeftIndicators: false |
|
455 #indicatorSelector: #indicatorClickedAt: |
|
456 #properties: |
|
457 #(#PropertyListDictionary |
|
458 #dragArgument: nil |
|
459 #dropObjectSelector: #dropObjects |
|
460 #dropArgument: nil |
|
461 #canDropSelector: #canDrop: |
|
462 #dropSelector: #doDrop: |
|
463 ) |
|
464 #postBuildCallback: #postBuildListOfItemsView: |
|
465 ) |
|
466 #(#ViewSpec |
|
467 #name: 'Box' |
|
468 #level: -1 |
|
469 #component: |
|
470 #(#SpecCollection |
|
471 #collection: #( |
|
472 #(#NoteBookViewSpec |
|
473 #name: 'NoteBook' |
|
474 #layout: #(#LayoutFrame 1 0.0 0 0.0 1 1.0 -30 1.0) |
|
475 #enableChannel: #hasSingleSelectionChannel |
|
476 #tabable: true |
|
477 #model: #tabHolder |
|
478 #menu: #listOfTabs |
|
479 #fitLastRow: false |
|
480 #canvas: #wizardHolder |
|
481 #keepCanvasAlive: true |
|
482 ) |
|
483 #(#UISubSpecification |
|
484 #name: 'SubSpecification' |
|
485 #layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1.0) |
|
486 #majorKey: #ToolApplicationModel |
|
487 #minorKey: #windowSpecForCommit |
|
488 ) |
|
489 ) |
|
490 |
|
491 ) |
|
492 ) |
|
493 ) |
|
494 |
|
495 ) |
|
496 #handles: #(#Any 0.300493 1.0) |
|
497 ) |
|
498 #(#UISubSpecification |
|
499 #name: 'InfoBarSubSpec' |
|
500 #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
|
501 #majorKey: #ToolApplicationModel |
|
502 #minorKey: #windowSpecForInfoBar |
|
503 ) |
|
504 ) |
|
505 |
|
506 ) |
|
507 ) |
|
508 ! ! |
|
509 |
|
510 !MenuEditor class methodsFor:'menu specs'! |
|
511 |
|
512 addMenu |
|
513 "This resource specification was automatically generated |
|
514 by the MenuEditor of ST/X." |
|
515 |
|
516 "Do not manually edit this!! If it is corrupted, |
|
517 the MenuEditor may not be able to read the specification." |
|
518 |
|
519 " |
|
520 MenuEditor new openOnClass:MenuEditor andSelector:#addMenu |
|
521 (Menu new fromLiteralArrayEncoding:(MenuEditor addMenu)) startUp |
|
522 " |
|
523 |
|
524 <resource: #menu> |
|
525 |
|
526 ^ |
|
527 #(#Menu |
|
528 #( |
|
529 #(#MenuItem |
|
530 #label: 'Separator' |
|
531 #translateLabel: true |
|
532 #value: #doCreateSep |
|
533 #activeHelpKey: #addMenuSeparator |
|
534 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconSeparator '') |
|
535 ) |
|
536 #(#MenuItem |
|
537 #label: 'Item' |
|
538 #translateLabel: true |
|
539 #value: #doCreateItem |
|
540 #activeHelpKey: #addMenuItem |
|
541 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconItem '') |
|
542 ) |
|
543 #(#MenuItem |
|
544 #label: 'Menu' |
|
545 #translateLabel: true |
|
546 #value: #doCreateMenu |
|
547 #activeHelpKey: #addMenuItem |
|
548 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconMenu '') |
|
549 ) |
|
550 #(#MenuItem |
|
551 #label: 'Linked Menu' |
|
552 #value: #doCreateLinkedMenu |
|
553 #activeHelpKey: #addSubMenuLink |
|
554 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconLinkedMenu '') |
|
555 ) |
|
556 #(#MenuItem |
|
557 #label: '-' |
|
558 ) |
|
559 #(#MenuItem |
|
560 #label: 'Delayed Menu' |
|
561 #value: #doCreateDelayedMenu: |
|
562 #enabled: #canCreateDelayedMenuChannel |
|
563 #activeHelpKey: #addDelayedMenu |
|
564 #argument: #menu |
|
565 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconDelayedMenu '') |
|
566 ) |
|
567 #(#MenuItem |
|
568 #label: 'Delayed Linked Menu' |
|
569 #value: #doCreateDelayedMenu: |
|
570 #enabled: #canCreateDelayedMenuChannel |
|
571 #activeHelpKey: #addDelayedSubMenuLink |
|
572 #argument: #linkedMenu |
|
573 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconDelayedLinkedMenu '') |
|
574 ) |
|
575 #(#MenuItem |
|
576 #label: '-' |
|
577 ) |
|
578 #(#MenuItem |
|
579 #label: 'Standard Menus' |
|
580 #translateLabel: true |
|
581 #submenuChannel: #standardMenus |
|
582 #keepLinkedMenu: true |
|
583 ) |
|
584 ) |
|
585 nil |
|
586 nil |
|
587 ) |
|
588 ! |
|
589 |
|
590 editMenu |
|
591 "This resource specification was automatically generated |
|
592 by the MenuEditor of ST/X." |
|
593 |
|
594 "Do not manually edit this!! If it is corrupted, |
|
595 the MenuEditor may not be able to read the specification." |
|
596 |
|
597 " |
|
598 MenuEditor new openOnClass:MenuEditor andSelector:#editMenu |
|
599 (Menu new fromLiteralArrayEncoding:(MenuEditor editMenu)) startUp |
|
600 " |
|
601 |
|
602 <resource: #menu> |
|
603 |
|
604 ^ |
|
605 #(#Menu |
|
606 #( |
|
607 #(#MenuItem |
|
608 #label: 'Cut' |
|
609 #value: #doCut |
|
610 #activeHelpKey: #editCut |
|
611 #enabled: #hasSelectionChannel |
|
612 ) |
|
613 #(#MenuItem |
|
614 #label: 'Copy' |
|
615 #value: #doCopy |
|
616 #activeHelpKey: #editCopy |
|
617 #enabled: #hasSelectionChannel |
|
618 ) |
|
619 #(#MenuItem |
|
620 #label: 'Paste' |
|
621 #value: #doPaste |
|
622 #activeHelpKey: #editPaste |
|
623 #enabled: #valueOfCanPaste |
|
624 ) |
|
625 #(#MenuItem |
|
626 #label: 'Delete' |
|
627 #value: #doDelete |
|
628 #activeHelpKey: #editDelete |
|
629 #enabled: #hasSelectionChannel |
|
630 ) |
|
631 #(#MenuItem |
|
632 #label: '-' |
|
633 ) |
|
634 #(#MenuItem |
|
635 #label: 'Move Up' |
|
636 #startGroup: #right |
|
637 #value: #doMoveUpOrDown: |
|
638 #activeHelpKey: #editMoveUp |
|
639 #enabled: #valueOfEnableMovingUpOrDown |
|
640 #argument: #up |
|
641 #labelImage: #(#ResourceRetriever #Icon #upIcon 'Move Up') |
|
642 ) |
|
643 #(#MenuItem |
|
644 #label: 'Move Down' |
|
645 #value: #doMoveUpOrDown: |
|
646 #activeHelpKey: #editMoveDown |
|
647 #enabled: #valueOfEnableMovingUpOrDown |
|
648 #argument: #down |
|
649 #labelImage: #(#ResourceRetriever #Icon #downIcon 'Move Down') |
|
650 ) |
|
651 #(#MenuItem |
|
652 #label: 'Move In' |
|
653 #value: #doMoveIn: |
|
654 #activeHelpKey: #editMoveIn |
|
655 #enabled: #valueOfEnableMovingIn |
|
656 #argument: #inNext |
|
657 #labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Move In') |
|
658 ) |
|
659 #(#MenuItem |
|
660 #label: 'Move In Above' |
|
661 #value: #doMoveIn: |
|
662 #activeHelpKey: #editMoveInAbove |
|
663 #enabled: #valueOfEnableMovingInAbove |
|
664 #argument: #inPrev |
|
665 #labelImage: #(#ResourceRetriever #Icon #upRightIcon 'Move In Above') |
|
666 ) |
|
667 #(#MenuItem |
|
668 #label: 'Move Out' |
|
669 #value: #doMoveOut |
|
670 #activeHelpKey: #editMoveOut |
|
671 #enabled: #valueOfEnableMovingOut |
|
672 #labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Move Out') |
|
673 ) |
|
674 ) |
|
675 nil |
|
676 nil |
|
677 ) |
|
678 ! |
|
679 |
|
680 fileMenu |
|
681 "This resource specification was automatically generated |
|
682 by the MenuEditor of ST/X." |
|
683 |
|
684 "Do not manually edit this!! If it is corrupted, |
|
685 the MenuEditor may not be able to read the specification." |
|
686 |
|
687 " |
|
688 MenuEditor new openOnClass:MenuEditor andSelector:#fileMenu |
|
689 (Menu new fromLiteralArrayEncoding:(MenuEditor fileMenu)) startUp |
|
690 " |
|
691 |
|
692 <resource: #menu> |
|
693 |
|
694 ^ |
|
695 #(#Menu |
|
696 #( |
|
697 #(#MenuItem |
|
698 #label: 'New' |
|
699 #translateLabel: true |
|
700 #value: #doNew |
|
701 #activeHelpKey: #fileNew |
|
702 ) |
|
703 #(#MenuItem |
|
704 #label: '-' |
|
705 ) |
|
706 #(#MenuItem |
|
707 #label: 'Load...' |
|
708 #translateLabel: true |
|
709 #value: #doLoad |
|
710 #activeHelpKey: #fileLoad |
|
711 ) |
|
712 #(#MenuItem |
|
713 #label: '-' |
|
714 ) |
|
715 #(#MenuItem |
|
716 #label: 'Save' |
|
717 #translateLabel: true |
|
718 #value: #doSave |
|
719 #activeHelpKey: #fileSave |
|
720 ) |
|
721 #(#MenuItem |
|
722 #label: 'Save As...' |
|
723 #translateLabel: true |
|
724 #value: #doSaveAs |
|
725 #activeHelpKey: #fileSaveAs |
|
726 ) |
|
727 #(#MenuItem |
|
728 #label: '-' |
|
729 ) |
|
730 #(#MenuItem |
|
731 #label: 'Pick a Menu...' |
|
732 #translateLabel: true |
|
733 #value: #doPickAMenu |
|
734 #activeHelpKey: #filePickAMenu |
|
735 ) |
|
736 #(#MenuItem |
|
737 #label: '-' |
|
738 ) |
|
739 #(#MenuItem |
|
740 #label: 'Show Menu Spec' |
|
741 #translateLabel: true |
|
742 #value: #doShowMenuSpec |
|
743 #activeHelpKey: #fileShowMenuSpec |
|
744 ) |
|
745 #(#MenuItem |
|
746 #label: 'Browse Class' |
|
747 #translateLabel: true |
|
748 #value: #doBrowseClass |
|
749 #activeHelpKey: #fileBrowseClass |
|
750 #enabled: #hasValidSpecClass |
|
751 ) |
|
752 #(#MenuItem |
|
753 #label: '-' |
|
754 ) |
|
755 #(#MenuItem |
|
756 #label: 'Exit' |
|
757 #translateLabel: true |
|
758 #value: #closeRequest |
|
759 #activeHelpKey: #fileExit |
|
760 ) |
|
761 ) |
|
762 nil |
|
763 nil |
|
764 ) |
|
765 ! |
|
766 |
|
767 helpMenu |
|
768 "This resource specification was automatically generated |
|
769 by the MenuEditor of ST/X." |
|
770 |
|
771 "Do not manually edit this!! If it is corrupted, |
|
772 the MenuEditor may not be able to read the specification." |
|
773 |
|
774 " |
|
775 MenuEditor new openOnClass:MenuEditor andSelector:#helpMenu |
|
776 (Menu new fromLiteralArrayEncoding:(MenuEditor helpMenu)) startUp |
|
777 " |
|
778 |
|
779 <resource: #menu> |
|
780 |
|
781 ^ |
|
782 #(#Menu |
|
783 #( |
|
784 #(#MenuItem |
|
785 #label: 'Documentation' |
|
786 #translateLabel: true |
|
787 #value: #openHTMLDocument: |
|
788 #activeHelpKey: #helpTutorial |
|
789 #argument: 'tools/uipainter/MenuEditor.html' |
|
790 ) |
|
791 #(#MenuItem |
|
792 #label: '-' |
|
793 ) |
|
794 #(#MenuItem |
|
795 #label: 'Help Tool' |
|
796 #translateLabel: true |
|
797 #value: #openHTMLDocument: |
|
798 #activeHelpKey: #helpHelpTool |
|
799 #argument: 'tools/uipainter/HelpTool.html' |
|
800 ) |
|
801 #(#MenuItem |
|
802 #label: '-' |
|
803 ) |
|
804 #(#MenuItem |
|
805 #label: 'Show Help Texts' |
|
806 #translateLabel: true |
|
807 #activeHelpKey: #helpShowHelp |
|
808 #indication: #showingHelp: |
|
809 ) |
|
810 #(#MenuItem |
|
811 #label: '-' |
|
812 ) |
|
813 #(#MenuItem |
|
814 #label: 'About MenuEditor...' |
|
815 #translateLabel: true |
|
816 #value: #openAboutThisApplication |
|
817 #activeHelpKey: #aboutThisAppliaction |
|
818 ) |
|
819 ) |
|
820 nil |
|
821 nil |
|
822 ) |
|
823 ! |
|
824 |
|
825 menu |
|
826 "This resource specification was automatically generated |
|
827 by the MenuEditor of ST/X." |
|
828 |
|
829 "Do not manually edit this!! If it is corrupted, |
|
830 the MenuEditor may not be able to read the specification." |
|
831 |
|
832 " |
|
833 MenuEditor new openOnClass:MenuEditor andSelector:#menu |
|
834 (Menu new fromLiteralArrayEncoding:(MenuEditor menu)) startUp |
|
835 " |
|
836 |
|
837 <resource: #menu> |
|
838 |
|
839 ^ |
|
840 #(#Menu |
|
841 #( |
|
842 #(#MenuItem |
|
843 #label: '&File' |
|
844 #translateLabel: true |
|
845 #activeHelpKey: #file |
|
846 #submenuChannel: #fileMenu |
|
847 #keepLinkedMenu: true |
|
848 ) |
|
849 #(#MenuItem |
|
850 #label: '&Edit' |
|
851 #translateLabel: true |
|
852 #activeHelpKey: #edit |
|
853 #submenuChannel: #editMenu |
|
854 #keepLinkedMenu: true |
|
855 ) |
|
856 #(#MenuItem |
|
857 #label: 'Add' |
|
858 #translateLabel: true |
|
859 #activeHelpKey: #add |
|
860 #enabled: #hasSingleSelectionChannel |
|
861 #submenuChannel: #addMenu |
|
862 #keepLinkedMenu: true |
|
863 ) |
|
864 #(#MenuItem |
|
865 #label: 'Test' |
|
866 #translateLabel: true |
|
867 #activeHelpKey: #test |
|
868 #submenuChannel: #submenuTest |
|
869 ) |
|
870 #(#MenuItem |
|
871 #label: 'History' |
|
872 #translateLabel: true |
|
873 #activeHelpKey: #history |
|
874 #submenuChannel: #menuHistory |
|
875 ) |
|
876 #(#MenuItem |
|
877 #label: '&Help' |
|
878 #translateLabel: true |
|
879 #activeHelpKey: #help |
|
880 #submenuChannel: #helpMenu |
|
881 #keepLinkedMenu: true |
|
882 ) |
|
883 ) |
|
884 nil |
|
885 nil |
|
886 ) |
|
887 ! |
|
888 |
|
889 standardMenus |
|
890 "This resource specification was automatically generated |
|
891 by the MenuEditor of ST/X." |
|
892 |
|
893 "Do not manually edit this!! If it is corrupted, |
|
894 the MenuEditor may not be able to read the specification." |
|
895 |
|
896 " |
|
897 MenuEditor new openOnClass:MenuEditor andSelector:#standardMenus |
|
898 (Menu new fromLiteralArrayEncoding:(MenuEditor standardMenus)) startUp |
|
899 " |
|
900 |
|
901 <resource: #menu> |
|
902 |
|
903 ^ |
|
904 #(#Menu |
|
905 #( |
|
906 #(#MenuItem |
|
907 #label: 'Standard Menu: Edit' |
|
908 #translateLabel: true |
|
909 #value: #doCreateStandardEditMenu |
|
910 ) |
|
911 #(#MenuItem |
|
912 #label: 'Standard Menu: Help' |
|
913 #translateLabel: true |
|
914 #value: #doCreateStandardHelpMenu |
|
915 ) |
|
916 #(#MenuItem |
|
917 #label: 'Standard Menu: File' |
|
918 #translateLabel: true |
|
919 #value: #doCreateStandardFileMenu |
|
920 ) |
|
921 ) |
|
922 nil |
|
923 nil |
|
924 ) |
|
925 ! |
|
926 |
|
927 toolbar |
|
928 "This resource specification was automatically generated |
|
929 by the MenuEditor of ST/X." |
|
930 |
|
931 "Do not manually edit this!! If it is corrupted, |
|
932 the MenuEditor may not be able to read the specification." |
|
933 |
|
934 " |
|
935 MenuEditor new openOnClass:MenuEditor andSelector:#toolbar |
|
936 (Menu new fromLiteralArrayEncoding:(MenuEditor toolbar)) startUp |
|
937 " |
|
938 |
|
939 <resource: #menu> |
|
940 |
|
941 ^ |
|
942 #(#Menu |
|
943 #( |
|
944 #(#MenuItem |
|
945 #label: 'Load' |
|
946 #isButton: true |
|
947 #value: #doLoad |
|
948 #activeHelpKey: #fileLoad |
|
949 #labelImage: #(#ResourceRetriever #Icon #loadIcon) |
|
950 #submenuChannel: #menuHistory |
|
951 ) |
|
952 #(#MenuItem |
|
953 #label: 'Save' |
|
954 #isButton: true |
|
955 #value: #doSave |
|
956 #activeHelpKey: #fileSave |
|
957 #labelImage: #(#ResourceRetriever #Icon #saveIcon) |
|
958 ) |
|
959 #(#MenuItem |
|
960 #label: '' |
|
961 ) |
|
962 #(#MenuItem |
|
963 #label: 'Cut' |
|
964 #isButton: true |
|
965 #value: #doCut |
|
966 #activeHelpKey: #editCut |
|
967 #enabled: #hasSelectionChannel |
|
968 #labelImage: #(#ResourceRetriever #Icon #cutIcon) |
|
969 ) |
|
970 #(#MenuItem |
|
971 #label: 'Copy' |
|
972 #isButton: true |
|
973 #value: #doCopy |
|
974 #activeHelpKey: #editCopy |
|
975 #enabled: #hasSelectionChannel |
|
976 #labelImage: #(#ResourceRetriever #Icon #copyIcon) |
|
977 ) |
|
978 #(#MenuItem |
|
979 #label: 'Paste' |
|
980 #isButton: true |
|
981 #value: #doPaste |
|
982 #activeHelpKey: #editPaste |
|
983 #enabled: #valueOfCanPaste |
|
984 #labelImage: #(#ResourceRetriever #Icon #pasteIcon) |
|
985 ) |
|
986 #(#MenuItem |
|
987 #label: '' |
|
988 ) |
|
989 #(#MenuItem |
|
990 #label: 'Add Separator' |
|
991 #isButton: true |
|
992 #value: #doCreateSep |
|
993 #activeHelpKey: #addMenuSeparator |
|
994 #enabled: #hasSingleSelectionChannel |
|
995 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconSeparator) |
|
996 ) |
|
997 #(#MenuItem |
|
998 #label: 'Add Item' |
|
999 #isButton: true |
|
1000 #value: #doCreateItem |
|
1001 #activeHelpKey: #addMenuItem |
|
1002 #enabled: #hasSingleSelectionChannel |
|
1003 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconItem) |
|
1004 ) |
|
1005 #(#MenuItem |
|
1006 #label: 'Add Menu' |
|
1007 #isButton: true |
|
1008 #value: #doCreateMenu |
|
1009 #activeHelpKey: #addSubMenu |
|
1010 #enabled: #hasSingleSelectionChannel |
|
1011 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconMenu) |
|
1012 #submenuChannel: #standardMenus |
|
1013 #keepLinkedMenu: true |
|
1014 ) |
|
1015 #(#MenuItem |
|
1016 #label: 'Add Linked Menu' |
|
1017 #isButton: true |
|
1018 #value: #doCreateLinkedMenu |
|
1019 #activeHelpKey: #addSubMenuLink |
|
1020 #enabled: #hasSingleSelectionChannel |
|
1021 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconLinkedMenu) |
|
1022 ) |
|
1023 #(#MenuItem |
|
1024 #label: '' |
|
1025 ) |
|
1026 #(#MenuItem |
|
1027 #label: 'Add Delayed Menu' |
|
1028 #isButton: true |
|
1029 #value: #doCreateDelayedMenu: |
|
1030 #activeHelpKey: #addDelayedMenu |
|
1031 #enabled: #canCreateDelayedMenuChannel |
|
1032 #argument: #menu |
|
1033 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconDelayedMenu) |
|
1034 ) |
|
1035 #(#MenuItem |
|
1036 #label: 'Add Delayed Linked Menu' |
|
1037 #isButton: true |
|
1038 #value: #doCreateDelayedMenu: |
|
1039 #activeHelpKey: #addDelayedSubMenuLink |
|
1040 #enabled: #canCreateDelayedMenuChannel |
|
1041 #argument: #linkedMenu |
|
1042 #labelImage: #(#ResourceRetriever #'MenuEditor::Item' #iconDelayedLinkedMenu) |
|
1043 ) |
|
1044 #(#MenuItem |
|
1045 #label: 'Move Up' |
|
1046 #isButton: true |
|
1047 #startGroup: #right |
|
1048 #value: #doMoveUpOrDown: |
|
1049 #activeHelpKey: #editMoveUp |
|
1050 #enabled: #valueOfEnableMovingUpOrDown |
|
1051 #argument: #up |
|
1052 #labelImage: #(#ResourceRetriever #Icon #upIcon) |
|
1053 ) |
|
1054 #(#MenuItem |
|
1055 #label: 'Move Down' |
|
1056 #isButton: true |
|
1057 #value: #doMoveUpOrDown: |
|
1058 #activeHelpKey: #editMoveDown |
|
1059 #enabled: #valueOfEnableMovingUpOrDown |
|
1060 #argument: #down |
|
1061 #labelImage: #(#ResourceRetriever #Icon #downIcon) |
|
1062 ) |
|
1063 #(#MenuItem |
|
1064 #label: 'Move In' |
|
1065 #isButton: true |
|
1066 #value: #doMoveIn: |
|
1067 #activeHelpKey: #editMoveIn |
|
1068 #enabled: #valueOfEnableMovingIn |
|
1069 #argument: #inNext |
|
1070 #labelImage: #(#ResourceRetriever #Icon #downRightIcon) |
|
1071 ) |
|
1072 #(#MenuItem |
|
1073 #label: 'Move In Above' |
|
1074 #isButton: true |
|
1075 #value: #doMoveIn: |
|
1076 #activeHelpKey: #editMoveInAbove |
|
1077 #enabled: #valueOfEnableMovingInAbove |
|
1078 #argument: #inPrev |
|
1079 #labelImage: #(#ResourceRetriever #Icon #upRightIcon) |
|
1080 ) |
|
1081 #(#MenuItem |
|
1082 #label: 'Move Out' |
|
1083 #isButton: true |
|
1084 #value: #doMoveOut |
|
1085 #activeHelpKey: #editMoveOut |
|
1086 #enabled: #valueOfEnableMovingOut |
|
1087 #labelImage: #(#ResourceRetriever #Icon #leftDownIcon) |
|
1088 ) |
|
1089 ) |
|
1090 nil |
|
1091 nil |
|
1092 ) |
|
1093 ! ! |
|
1094 |
|
1095 !MenuEditor class methodsFor:'menu specs - standard'! |
|
1096 |
|
1097 standardEditMenu |
|
1098 "This resource specification was automatically generated |
|
1099 by the MenuEditor of ST/X." |
|
1100 |
|
1101 "Do not manually edit this!! If it is corrupted, |
|
1102 the MenuEditor may not be able to read the specification." |
|
1103 |
|
1104 " |
|
1105 MenuEditor new openOnClass:MenuEditor andSelector:#standardEditMenu |
|
1106 (Menu new fromLiteralArrayEncoding:(MenuEditor standardEditMenu)) startUp |
|
1107 " |
|
1108 |
|
1109 <resource: #menu> |
|
1110 |
|
1111 ^ |
|
1112 #(#Menu |
|
1113 #( |
|
1114 #(#MenuItem |
|
1115 #label: 'Copy' |
|
1116 #translateLabel: true |
|
1117 #value: #copySelection |
|
1118 ) |
|
1119 #(#MenuItem |
|
1120 #label: 'Cut' |
|
1121 #translateLabel: true |
|
1122 #value: #cutSelection |
|
1123 ) |
|
1124 #(#MenuItem |
|
1125 #label: 'Paste' |
|
1126 #translateLabel: true |
|
1127 #value: #paste |
|
1128 ) |
|
1129 ) |
|
1130 nil |
|
1131 nil |
|
1132 ) |
|
1133 ! |
|
1134 |
|
1135 standardFileMenu |
|
1136 "This resource specification was automatically generated |
|
1137 by the MenuEditor of ST/X." |
|
1138 |
|
1139 "Do not manually edit this!! If it is corrupted, |
|
1140 the MenuEditor may not be able to read the specification." |
|
1141 |
|
1142 " |
|
1143 MenuEditor new openOnClass:MenuEditor andSelector:#standardFileMenu |
|
1144 (Menu new fromLiteralArrayEncoding:(MenuEditor standardFileMenu)) startUp |
|
1145 " |
|
1146 |
|
1147 <resource: #menu> |
|
1148 |
|
1149 ^ |
|
1150 #(#Menu |
|
1151 #( |
|
1152 #(#MenuItem |
|
1153 #label: 'New' |
|
1154 #translateLabel: true |
|
1155 #value: #menuNew |
|
1156 ) |
|
1157 #(#MenuItem |
|
1158 #label: '-' |
|
1159 ) |
|
1160 #(#MenuItem |
|
1161 #label: 'Open...' |
|
1162 #translateLabel: true |
|
1163 #value: #menuOpen |
|
1164 ) |
|
1165 #(#MenuItem |
|
1166 #label: '-' |
|
1167 ) |
|
1168 #(#MenuItem |
|
1169 #label: 'Save' |
|
1170 #translateLabel: true |
|
1171 #value: #menuSave |
|
1172 ) |
|
1173 #(#MenuItem |
|
1174 #label: 'Save As...' |
|
1175 #translateLabel: true |
|
1176 #value: #menuSaveAs |
|
1177 ) |
|
1178 #(#MenuItem |
|
1179 #label: '-' |
|
1180 ) |
|
1181 #(#MenuItem |
|
1182 #label: 'Exit' |
|
1183 #translateLabel: true |
|
1184 #value: #closeRequest |
|
1185 ) |
|
1186 ) |
|
1187 nil |
|
1188 nil |
|
1189 ) |
|
1190 ! |
|
1191 |
|
1192 standardHelpMenu |
|
1193 "This resource specification was automatically generated |
|
1194 by the MenuEditor of ST/X." |
|
1195 |
|
1196 "Do not manually edit this!! If it is corrupted, |
|
1197 the MenuEditor may not be able to read the specification." |
|
1198 |
|
1199 " |
|
1200 MenuEditor new openOnClass:MenuEditor andSelector:#standardHelpMenu |
|
1201 (Menu new fromLiteralArrayEncoding:(MenuEditor standardHelpMenu)) startUp |
|
1202 " |
|
1203 |
|
1204 <resource: #menu> |
|
1205 |
|
1206 ^ |
|
1207 #(#Menu |
|
1208 #( |
|
1209 #(#MenuItem |
|
1210 #label: 'Documentation' |
|
1211 #translateLabel: true |
|
1212 #value: #openDocumentation |
|
1213 ) |
|
1214 #(#MenuItem |
|
1215 #label: '-' |
|
1216 ) |
|
1217 #(#MenuItem |
|
1218 #label: 'About this Application' |
|
1219 #translateLabel: true |
|
1220 #value: #openAboutThisApplication |
|
1221 ) |
|
1222 ) |
|
1223 nil |
|
1224 nil |
|
1225 ) |
|
1226 ! ! |
|
1227 |
|
1228 !MenuEditor methodsFor:'accessing'! |
|
1229 |
|
1230 helpTool |
|
1231 "get the help tool application |
|
1232 " |
|
1233 ^ wizards at:#help ifAbsentPut:[ |tool| |
|
1234 tool := UIHelpTool new createBuilder. |
|
1235 tool masterApplication:self. |
|
1236 tool modifiedHolder: self valueOfEnablingCommitButtons. |
|
1237 tool builder window:(ApplicationSubView new client:tool). |
|
1238 tool masterApplication:self. |
|
1239 tool |
|
1240 ] |
|
1241 ! |
|
1242 |
|
1243 imageTool |
|
1244 "get the image tool application |
|
1245 " |
|
1246 ^ wizards at:#image ifAbsentPut:[ |tool| |
|
1247 tool := ResourceEditor new createBuilder. |
|
1248 tool masterApplication:self. |
|
1249 tool modifiedChannel: self valueOfEnablingCommitButtons. |
|
1250 tool builder window:(ApplicationSubView new client:tool). |
|
1251 tool |
|
1252 ] |
|
1253 ! |
|
1254 |
|
1255 useHelpTool:aHelpTool |
|
1256 "take the help dictionaries from aHelpTool into my helpTool |
|
1257 " |
|
1258 |tool| |
|
1259 |
|
1260 tool := self helpTool. |
|
1261 |
|
1262 tool buildFromClass:(aHelpTool specClass). |
|
1263 tool dictionaries:(aHelpTool dictionaries). |
|
1264 tool dictionary:(aHelpTool dictionary). |
|
1265 ! ! |
|
1266 |
|
1267 !MenuEditor methodsFor:'actions'! |
|
1268 |
|
1269 accept |
|
1270 "accept modifications |
|
1271 " |
|
1272 self accept:true. |
|
1273 ! |
|
1274 |
|
1275 accept:ok |
|
1276 "ok if true the modifications are accepted |
|
1277 than reload from item |
|
1278 " |
|
1279 |selectedItem rscRetrHolder helpKeyHolder helpTool imageTool acceptChannel| |
|
1280 |
|
1281 selectedItem := self selectedItem. |
|
1282 |
|
1283 selectedItem ifNotNil:[ |
|
1284 self withoutNotifyDo:[ |
|
1285 rscRetrHolder := aspects at:#resourceRetriever. |
|
1286 helpKeyHolder := aspects at:#activeHelpKey. |
|
1287 imageTool := self imageTool. |
|
1288 helpTool := self helpTool. |
|
1289 acceptChannel := self acceptChannel. |
|
1290 |
|
1291 acceptChannel triggerValue:true. |
|
1292 acceptChannel setValue:false. |
|
1293 |
|
1294 ok ifTrue:[ |
|
1295 rscRetrHolder value:(imageTool resourceRetriever). |
|
1296 helpKeyHolder value:(helpTool helpKey). |
|
1297 selectedItem fromAspects:aspects. |
|
1298 modified := true. |
|
1299 |
|
1300 selectedItem isRootItem ifTrue:[ |
|
1301 "/ update specSelector |
|
1302 specSelector := selectedItem rawLabel. |
|
1303 ]. |
|
1304 ]. |
|
1305 selectedItem toAspects:aspects. |
|
1306 helpTool setHelpKey:(helpKeyHolder value). |
|
1307 imageTool resourceRetriever:(rscRetrHolder value). |
|
1308 ] |
|
1309 ]. |
|
1310 self updateChannels. |
|
1311 self clearModified. |
|
1312 ! |
|
1313 |
|
1314 cancel |
|
1315 "reload aspects from current selected item; reset modification flag |
|
1316 " |
|
1317 self accept:false. |
|
1318 ! |
|
1319 |
|
1320 indicatorClickedAt:atLine |
|
1321 "indicator clicked at line number; toggle expand of item at line |
|
1322 " |
|
1323 |item| |
|
1324 |
|
1325 item := listOfItems at:atLine ifAbsent:nil. |
|
1326 item ifNotNil:[ item toggleExpand ]. |
|
1327 ! ! |
|
1328 |
|
1329 !MenuEditor methodsFor:'aspects'! |
|
1330 |
|
1331 canCreateDelayedMenuChannel |
|
1332 "boolean holder, true if the current selected item accepts a delayed menu |
|
1333 " |
|
1334 ^ builder booleanValueAspectFor:#canCreateDelayedMenuChannel |
|
1335 ! |
|
1336 |
|
1337 hasSelectionChannel |
|
1338 "boolean holder, true if any item is selected |
|
1339 " |
|
1340 ^ builder booleanValueAspectFor:#hasSelectionChannel |
|
1341 ! |
|
1342 |
|
1343 hasSingleSelectionChannel |
|
1344 "boolean holder, true if one item is selected |
|
1345 " |
|
1346 ^ builder booleanValueAspectFor:#hasSingleSelectionChannel |
|
1347 ! |
|
1348 |
|
1349 listOfItems |
|
1350 "returns the hierarchical list of menuItems |
|
1351 " |
|
1352 ^ listOfItems |
|
1353 ! |
|
1354 |
|
1355 listOfTabs |
|
1356 "returns the list of current shown tab-labels retrieved |
|
1357 from the current selected item. |
|
1358 " |
|
1359 ^ listOfTabs |
|
1360 ! |
|
1361 |
|
1362 selectionHolder |
|
1363 "value holder, which keeps the current selected items |
|
1364 " |
|
1365 ^ selectionHolder |
|
1366 ! |
|
1367 |
|
1368 tabHolder |
|
1369 "value holder, which keeps the current selected tab label or nil |
|
1370 " |
|
1371 ^ tabHolder |
|
1372 ! |
|
1373 |
|
1374 wizardHolder |
|
1375 "holder, which keeps the current wizard window |
|
1376 " |
|
1377 |holder| |
|
1378 |
|
1379 holder := builder bindingAt:#wizardHolder. |
|
1380 |
|
1381 holder ifNil:[ |
|
1382 holder := nil asValue. |
|
1383 builder aspectAt:#wizardHolder put:holder. |
|
1384 ]. |
|
1385 ^ holder |
|
1386 ! ! |
|
1387 |
|
1388 !MenuEditor methodsFor:'building'! |
|
1389 |
|
1390 buildFromClass:aSpecClass andSelector:aSpecSelector |
|
1391 "rebuild menu from a class and selector |
|
1392 " |
|
1393 |cls menu| |
|
1394 |
|
1395 menu := nil. |
|
1396 |
|
1397 self isStandAlone ifTrue:[ self helpTool buildFromClass:aSpecClass ]. |
|
1398 |
|
1399 aSpecSelector notNil ifTrue:[ |
|
1400 aSpecClass ifNotNil:[ |
|
1401 cls := self resolveName:aSpecClass. |
|
1402 menu := cls perform:aSpecSelector ifNotUnderstood:nil. |
|
1403 |
|
1404 menu ifNotNil:[ |
|
1405 (menu isMemberOf:Menu) ifFalse:[ |
|
1406 menu := Menu new fromLiteralArrayEncoding:menu |
|
1407 ]. |
|
1408 ] |
|
1409 ]. |
|
1410 ]. |
|
1411 self buildFromMenu:menu selector:aSpecSelector. |
|
1412 ! |
|
1413 |
|
1414 buildFromMenu:aMenu selector:aSelector |
|
1415 "rebuild menu from a Menu |
|
1416 " |
|
1417 |root menu| |
|
1418 |
|
1419 aMenu isCollection ifTrue:[menu := aMenu decodeAsLiteralArray] |
|
1420 ifFalse:[menu := aMenu]. |
|
1421 |
|
1422 self valueOfEnablingCommitButtons value:false. |
|
1423 root := listOfItems root. |
|
1424 |
|
1425 self withoutNotifyDo:[ |
|
1426 selectionHolder setValue:#(). |
|
1427 root menu:aMenu labeled:(aSelector ? specSelector). |
|
1428 ]. |
|
1429 self selectedItem:root. |
|
1430 self updateHistory. |
|
1431 ! |
|
1432 |
|
1433 buildFromResourceSpec:aResourceSpec |
|
1434 "rebuild menu from a resource spec |
|
1435 " |
|
1436 self buildFromMenu:aResourceSpec selector:nil |
|
1437 ! ! |
|
1438 |
|
1439 !MenuEditor methodsFor:'change & update'! |
|
1440 |
|
1441 selectedSuperItems |
|
1442 "returns collection of superItems derived from selection |
|
1443 " |
|
1444 |selection size root| |
|
1445 |
|
1446 selectedSuperItems ifNotNil:[ ^ selectedSuperItems ]. |
|
1447 |
|
1448 selection := selectionHolder value. |
|
1449 size := selection size. |
|
1450 |
|
1451 size <= 1 ifTrue:[ |
|
1452 selectedSuperItems := selection ? #(). |
|
1453 ^ selectedSuperItems |
|
1454 ]. |
|
1455 |
|
1456 root := listOfItems root. |
|
1457 |
|
1458 (selection includesIdentical:root) ifTrue:[ |
|
1459 selectedSuperItems := Array with:root. |
|
1460 ^ selectedSuperItems |
|
1461 ]. |
|
1462 selectedSuperItems := OrderedCollection new. |
|
1463 |
|
1464 selection do:[:anItem| |
|
1465 anItem parentsDetect:[:el| selection includesIdentical:el ] |
|
1466 ifNone:[ selectedSuperItems add:anItem ]. |
|
1467 ]. |
|
1468 ^ selectedSuperItems |
|
1469 ! |
|
1470 |
|
1471 selectionChanged |
|
1472 "called if the selection has changed |
|
1473 " |
|
1474 |newTabList selection| |
|
1475 |
|
1476 selection := selectionHolder value. |
|
1477 |
|
1478 selection size == 1 ifTrue:[ |
|
1479 selectedSuperItems := selection. |
|
1480 |
|
1481 newTabList := selection first slices collect:[:el| ' ', el first, ' ' ]. |
|
1482 newTabList = listOfTabs ifFalse:[ |
|
1483 listOfTabs contents:newTabList. |
|
1484 ]. |
133 ] ifFalse:[ |
1485 ] ifFalse:[ |
134 key := aSymbolOrClass |
1486 "must compute selected super items on request |
135 ]. |
1487 " |
136 |
1488 selectedSuperItems := nil. |
137 key size ~~ 0 ifTrue:[ |
1489 ]. |
138 key := key asSymbol. |
1490 self cancel. |
139 |
1491 self tabChanged. |
140 (ImageRetrieverClasses includes:key) ifFalse:[ |
1492 self updateChannels. |
141 ImageRetrieverClasses := ImageRetrieverClasses asOrderedCollection. |
1493 ! |
142 ImageRetrieverClasses add:key. |
1494 |
143 ImageRetrieverClasses sort. |
1495 tabChanged |
|
1496 "called if the tab changed |
|
1497 " |
|
1498 |tab selector item canvas wizardHolder| |
|
1499 |
|
1500 wizardHolder := self wizardHolder. |
|
1501 item := self selectedItem. |
|
1502 item ifNil:[ ^ wizardHolder value:nil ]. |
|
1503 |
|
1504 tab := tabHolder value. |
|
1505 |
|
1506 tab ifNotNil:[ |
|
1507 tab := tab withoutSeparators. |
|
1508 tab := item slices detect:[:el| el first = tab ] ifNone:nil. |
|
1509 ]. |
|
1510 tab ifNil:[ |
|
1511 ^ tabHolder value:( listOfTabs at:1 ifAbsent:nil ) |
|
1512 ]. |
|
1513 selector := tab last. |
|
1514 |
|
1515 selector == #help ifTrue:[ ^ wizardHolder value:(self helpTool window) ]. |
|
1516 selector == #image ifTrue:[ ^ wizardHolder value:(self imageTool window) ]. |
|
1517 |
|
1518 canvas := wizards at:(item class name, selector) asSymbol |
|
1519 ifAbsentPut:[ SimpleView new client:self |
|
1520 spec:(item class perform:selector) |
|
1521 builder:(self builder) |
|
1522 ]. |
|
1523 |
|
1524 wizardHolder value:canvas. |
|
1525 ! |
|
1526 |
|
1527 update:something with:aParameter from:changedObject |
|
1528 "Invoked when an object that I depend upon sends a change notification. |
|
1529 " |
|
1530 notifyDisabledCounter ~~ 0 ifTrue:[ ^ self ]. |
|
1531 |
|
1532 changedObject == selectionHolder ifTrue:[ ^ self selectionChanged ]. |
|
1533 changedObject == tabHolder ifTrue:[ ^ self tabChanged ]. |
|
1534 |
|
1535 super update:something with:aParameter from:changedObject |
|
1536 ! |
|
1537 |
|
1538 updateChannels |
|
1539 "update all channels |
|
1540 " |
|
1541 |selection sizeOfSel selectedItem| |
|
1542 |
|
1543 super updateChannels. |
|
1544 |
|
1545 selection := selectionHolder value. |
|
1546 sizeOfSel := selection size. |
|
1547 |
|
1548 sizeOfSel == 1 ifTrue:[selectedItem := selection at:1] |
|
1549 ifFalse:[selectedItem := nil]. |
|
1550 |
|
1551 self hasSelectionChannel value:(sizeOfSel ~~ 0). |
|
1552 self hasSingleSelectionChannel value:(selectedItem notNil). |
|
1553 |
|
1554 selectedItem isNil ifTrue:[ |
|
1555 self valueOfEnableMovingIn value:false. |
|
1556 self valueOfEnableMovingOut value:false. |
|
1557 self valueOfEnableMovingUpOrDown value:false. |
|
1558 self valueOfEnableMovingInAbove value:false. |
|
1559 self canCreateDelayedMenuChannel value:false. |
|
1560 ] ifFalse:[ |
|
1561 self valueOfEnableMovingUpOrDown value:(selectedItem canMoveUpOrDown). |
|
1562 self valueOfEnableMovingOut value:(selectedItem canMoveOut). |
|
1563 self valueOfEnableMovingIn value:(selectedItem canMoveInNext). |
|
1564 self valueOfEnableMovingInAbove value:(selectedItem canMoveInAbove). |
|
1565 self canCreateDelayedMenuChannel value:(selectedItem canAddDelayedMenu). |
|
1566 ]. |
|
1567 ! ! |
|
1568 |
|
1569 !MenuEditor methodsFor:'defaults'! |
|
1570 |
|
1571 aboutImage |
|
1572 "the image to be displayed in my about-box; |
|
1573 If nil is returned, the ST/X default image is used. |
|
1574 " |
|
1575 ^ self class aboutImage |
|
1576 ! ! |
|
1577 |
|
1578 !MenuEditor methodsFor:'drag & drop'! |
|
1579 |
|
1580 canDrop:aContext |
|
1581 "return true, if the DropContext can be dropped into |
|
1582 the hierachical list of items |
|
1583 " |
|
1584 |objects modified| |
|
1585 |
|
1586 modified := self valueOfEnablingCommitButtons value. |
|
1587 modified ifTrue:[^ false]. |
|
1588 |
|
1589 self selectedItem ifNil:[^ false]. |
|
1590 |
|
1591 aContext sourceWidget == aContext targetWidget ifTrue:[ |
|
1592 ^ false |
|
1593 ]. |
|
1594 |
|
1595 objects := aContext dropObjects. |
|
1596 objects isEmpty ifTrue:[ ^ false ]. |
|
1597 |
|
1598 objects do:[:el| |
|
1599 el theObject class == MenuItem ifFalse:[^ false]. |
|
1600 ]. |
|
1601 ^ true |
|
1602 ! |
|
1603 |
|
1604 doDrop:aDropContext |
|
1605 "drop the DropContext into the hierachical list of items |
|
1606 " |
|
1607 |objects| |
|
1608 |
|
1609 (self canDrop:aDropContext) ifFalse:[^ false]. |
|
1610 |
|
1611 objects := aDropContext dropObjects collect:[:el| el theObject ]. |
|
1612 self doPaste:objects. |
|
1613 ^ true |
|
1614 ! |
|
1615 |
|
1616 dropObjects |
|
1617 "returns list of DropObjects |
|
1618 " |
|
1619 |obj items| |
|
1620 |
|
1621 items := self selectedSuperItems. |
|
1622 items isEmpty ifTrue:[ ^ nil ]. |
|
1623 |
|
1624 ^ items collect:[:el| |
|
1625 obj := DropObject new:(el menuItem). |
|
1626 obj displayObject:(el rawLabel). |
|
1627 obj |
|
1628 ]. |
|
1629 ! ! |
|
1630 |
|
1631 !MenuEditor methodsFor:'event processing'! |
|
1632 |
|
1633 processEvent:anEvent |
|
1634 "filter keyboard edit-events typed into the listOfItemsView |
|
1635 " |
|
1636 |evView inView rawKey key| |
|
1637 |
|
1638 anEvent isKeyPressEvent ifFalse:[^ false]. |
|
1639 |
|
1640 evView := anEvent targetView. |
|
1641 evView ifNil:[ ^ false ]. |
|
1642 |
|
1643 inView := evView isSameOrComponentOf:listOfItemsView. |
|
1644 inView ifFalse:[^ false]. |
|
1645 |
|
1646 key := anEvent key. |
|
1647 rawKey := anEvent rawKey. |
|
1648 |
|
1649 ( key == #Delete |
|
1650 or:[key == #BackSpace |
|
1651 or:[key == #Cut]] |
|
1652 ) ifTrue:[ |
|
1653 self doCut. |
|
1654 ^ true. |
|
1655 ]. |
|
1656 |
|
1657 key == #Copy ifTrue:[ self doCopy. ^ true ]. |
|
1658 key == #Paste ifTrue:[ self doPaste. ^ true ]. |
|
1659 |
|
1660 ^ false |
|
1661 ! ! |
|
1662 |
|
1663 !MenuEditor methodsFor:'initialization & release'! |
|
1664 |
|
1665 closeRequest |
|
1666 "ask for modification |
|
1667 " |
|
1668 self valueOfEnablingCommitButtons value ifTrue:[ |
|
1669 modified := true. |
|
1670 self askForListModification. |
|
1671 modified ifTrue:[^ self]. |
|
1672 self clearModified. |
|
1673 ]. |
|
1674 ^ super closeRequest |
|
1675 ! |
|
1676 |
|
1677 initialize |
|
1678 "setup aspects, ... |
|
1679 " |
|
1680 super initialize. |
|
1681 notifyDisabledCounter := 0. |
|
1682 |
|
1683 Item withAllSubclasses do:[:aClass| |
|
1684 aClass addBindingsTo:aspects for:self. |
|
1685 ]. |
|
1686 |
|
1687 selectionHolder := #() asValue. |
|
1688 selectionHolder addDependent:self. |
|
1689 |
|
1690 listOfItems := HierarchicalList new. |
|
1691 listOfItems application:self. |
|
1692 listOfItems root:(ItemRoot new). |
|
1693 |
|
1694 tabHolder := nil asValue. |
|
1695 tabHolder addDependent:self. |
|
1696 |
|
1697 listOfTabs := List new. |
|
1698 wizards := IdentityDictionary new. |
|
1699 ! |
|
1700 |
|
1701 openModalOnMenu:aMenu |
|
1702 "build a tree from aMenu and open it modal |
|
1703 " |
|
1704 self openModalOnResourceSpec:aMenu |
|
1705 ! |
|
1706 |
|
1707 postBuildListOfItemsView:aView |
|
1708 listOfItemsView := aView. |
|
1709 ! |
|
1710 |
|
1711 postOpenWith:aBuilder |
|
1712 "reset keyboardProcessor for menuBar |
|
1713 " |
|
1714 super postOpenWith: aBuilder. |
|
1715 aBuilder keyboardProcessor menuBar:nil. |
|
1716 self windowGroup addPreEventHook:self. |
|
1717 ! ! |
|
1718 |
|
1719 !MenuEditor methodsFor:'private'! |
|
1720 |
|
1721 addAndSelect:aNoneArgBlockOrItem |
|
1722 "add an item(s) derived from the block; test if add operation |
|
1723 is enabled. On success the new item(s) are returned otherwise nil. |
|
1724 " |
|
1725 |intoItem index newItem| |
|
1726 |
|
1727 intoItem := self selectedItem. |
|
1728 intoItem ifNil:[ ^ nil]. |
|
1729 |
|
1730 self askForItemModification ifFalse:[ ^ nil ]. |
|
1731 |
|
1732 index := 1. |
|
1733 |
|
1734 ( intoItem canAddChildren |
|
1735 and:[(intoItem isExpanded or:[intoItem isDelayedMenu]) ] |
|
1736 ) ifFalse:[ |
|
1737 [ intoItem parent canAddChildren ] whileFalse:[ |
|
1738 intoItem := intoItem parent. |
|
1739 ]. |
|
1740 index := intoItem parent identityIndexOf:intoItem. |
|
1741 index := index + 1. |
|
1742 intoItem := intoItem parent. |
|
1743 ]. |
|
1744 newItem := aNoneArgBlockOrItem value. |
|
1745 |
|
1746 newItem ifNotNil:[ |
|
1747 selectionHolder setValue:nil. |
|
1748 intoItem expand. |
|
1749 |
|
1750 newItem isCollection ifTrue:[ |
|
1751 intoItem addAll:newItem beforeIndex:index. |
|
1752 selectionHolder value:newItem. |
|
1753 ] ifFalse:[ |
|
1754 intoItem add:newItem beforeIndex:index. |
|
1755 selectionHolder value:(Array with:newItem). |
|
1756 ]. |
|
1757 modified := true. |
|
1758 ]. |
|
1759 ^ newItem |
|
1760 ! |
|
1761 |
|
1762 clearModified |
|
1763 "clear the modifiedChannel and the commitPanel |
|
1764 " |
|
1765 self valueOfEnablingCommitButtons value:false. |
|
1766 self clearModifiedFlag. |
|
1767 ! |
|
1768 |
|
1769 generateMenuSpec |
|
1770 "generate and returns the current menu spec or nil |
|
1771 " |
|
1772 |menu spec| |
|
1773 |
|
1774 menu := listOfItems root submenu. |
|
1775 menu ifNil:[^ nil]. |
|
1776 menu := menu literalArrayEncoding. |
|
1777 spec := WriteStream on:String new. |
|
1778 UISpecification prettyPrintSpecArray:menu on:spec indent:5. |
|
1779 ^ spec contents. |
|
1780 ! |
|
1781 |
|
1782 submenuTest |
|
1783 "returns a menu on the current editing menu |
|
1784 " |
|
1785 |menu indication choice submenu retriever| |
|
1786 |
|
1787 menu := listOfItems root submenu. |
|
1788 menu ifNil:[^ nil ]. |
|
1789 |
|
1790 menu allItemsDo:[:anItem| |
|
1791 anItem isVisible:true. |
|
1792 anItem enabled:true. |
|
1793 anItem translateLabel:false. |
|
1794 |
|
1795 anItem value ifNotNil:[ |
|
1796 anItem value:[ Transcript showCR:(anItem label) ]. |
|
1797 ]. |
|
1798 anItem indication ifNotNil:[ |
|
1799 indication ifNil:[ indication := true asValue ]. |
|
1800 anItem indication:indication |
|
1801 ]. |
|
1802 anItem choice ifNotNil:[ |
|
1803 choice ifNil:[ choice := anItem choiceValue asValue ]. |
|
1804 anItem choice:choice |
|
1805 ]. |
|
1806 |
|
1807 anItem submenuChannel ifNotNil:[ |
|
1808 anItem submenuChannel:nil. |
|
1809 anItem submenu ifNil:[ |
|
1810 submenu ifNil:[ |
|
1811 submenu := Menu new. |
|
1812 submenu addItem:(MenuItem labeled:'Linked Menu...'). |
|
1813 ]. |
|
1814 anItem submenu:submenu. |
|
1815 ]. |
|
1816 ]. |
|
1817 retriever := anItem resourceRetriever. |
|
1818 retriever ifNotNil:[ |
|
1819 retriever labelText ifNotNil:[ retriever labelText:(anItem label) ] |
|
1820 ]. |
|
1821 ]. |
|
1822 menu findGuiResourcesIn:(self resolveName:specClass). |
|
1823 ^ menu |
|
1824 ! |
|
1825 |
|
1826 withoutNotifyDo:aBlock |
|
1827 "evaluate the block; all change notifications are |
|
1828 discard during the block is evaluated. |
|
1829 " |
|
1830 |blockResult| |
|
1831 |
|
1832 [ notifyDisabledCounter := notifyDisabledCounter + 1. |
|
1833 blockResult := aBlock value. |
|
1834 ] valueNowOrOnUnwindDo:[ |
|
1835 notifyDisabledCounter := notifyDisabledCounter - 1 |
|
1836 ]. |
|
1837 ^ blockResult |
|
1838 ! ! |
|
1839 |
|
1840 !MenuEditor methodsFor:'queries'! |
|
1841 |
|
1842 hasValidSpecClass |
|
1843 "returns true if a valid specClass exists |
|
1844 " |
|
1845 |cls| |
|
1846 |
|
1847 specClass ifNil:[^ false]. |
|
1848 cls := self resolveName:specClass. |
|
1849 ^ cls notNil |
|
1850 ! ! |
|
1851 |
|
1852 !MenuEditor methodsFor:'selection'! |
|
1853 |
|
1854 canSelect:anIndex |
|
1855 "called whenever the selection changed; test whether |
|
1856 current item is not modified .... |
|
1857 " |
|
1858 |oldSelectedItem newSelectedItem| |
|
1859 |
|
1860 self valueOfEnablingCommitButtons value ifFalse:[ |
|
1861 ^ true |
|
1862 ]. |
|
1863 oldSelectedItem := self selectedItem. |
|
1864 oldSelectedItem ifNil:[^ true]. |
|
1865 |
|
1866 newSelectedItem := listOfItems at:anIndex ifAbsent:nil. |
|
1867 oldSelectedItem == newSelectedItem ifTrue:[ |
|
1868 ^ true |
|
1869 ]. |
|
1870 ^ self askForItemModification |
|
1871 ! |
|
1872 |
|
1873 selectedItem |
|
1874 "returns the selected item or nil (none or multiple selected) |
|
1875 " |
|
1876 |selection| |
|
1877 |
|
1878 selection := selectionHolder value. |
|
1879 selection size == 1 ifTrue:[ ^ selection first ]. |
|
1880 ^ nil |
|
1881 ! |
|
1882 |
|
1883 selectedItem:anItem |
|
1884 "change selection to an item |
|
1885 " |
|
1886 |selection| |
|
1887 |
|
1888 anItem notNil ifTrue:[ selection := Array with:anItem ] |
|
1889 ifFalse:[ selection := #() ]. |
|
1890 |
|
1891 selectionHolder value:selection. |
|
1892 ! ! |
|
1893 |
|
1894 !MenuEditor methodsFor:'user actions - building'! |
|
1895 |
|
1896 doNew |
|
1897 "clear editing menu; start from scratch |
|
1898 " |
|
1899 super doNew ifTrue:[ self helpTool doNew ]. |
|
1900 ! |
|
1901 |
|
1902 doPickAMenu |
|
1903 "pick a menu from user |
|
1904 " |
|
1905 |view| |
|
1906 |
|
1907 self askForModification ifTrue:[ |
|
1908 ( (view := Screen current viewFromUser) isNil |
|
1909 or:[view == Screen current rootView] |
|
1910 ) ifTrue:[ |
|
1911 ^ self |
|
1912 ]. |
|
1913 view specClass == MenuPanelSpec ifTrue:[ |
|
1914 specSelector := #pickedMenu. |
|
1915 ^ self buildFromMenu:(view asMenu) selector:specSelector. |
|
1916 ]. |
|
1917 ]. |
|
1918 ! |
|
1919 |
|
1920 doSave |
|
1921 "save current editing menu to |
|
1922 class: specClass |
|
1923 selector: specSelector |
|
1924 " |
|
1925 |cls spec mthd category code excla| |
|
1926 |
|
1927 super doSave ifFalse: [^nil]. |
|
1928 spec := self generateMenuSpec. |
|
1929 spec ifNil:[^ nil]. |
|
1930 |
|
1931 cls := self resolveName:specClass. |
|
1932 |
|
1933 "/ if that method already exists, do not overwrite the category |
|
1934 |
|
1935 category := 'menu specs'. |
|
1936 (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[ |
|
1937 category := mthd category. |
|
1938 ]. |
|
1939 |
|
1940 excla := Character excla asString. |
|
1941 |
|
1942 code := excla |
|
1943 , (cls name , ' class methodsFor:' , category storeString) |
|
1944 , excla , '\\' |
|
1945 |
|
1946 , specSelector , '\' |
|
1947 , (self class codeGenerationComment replChar:$!! withString:'!!!!') |
|
1948 , '\\ "\' |
|
1949 , (' MenuEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\') |
|
1950 , (' (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , specSelector , ')) startUp\') |
|
1951 , ' "\'. |
|
1952 |
|
1953 code := code |
|
1954 , '\' |
|
1955 , ' <resource: #menu>\\' |
|
1956 , ' ^ ' , spec |
|
1957 , '\' |
|
1958 , (excla , ' ' , excla) |
|
1959 , '\\'. |
|
1960 |
|
1961 code := code withCRs. |
|
1962 (ReadStream on:code) fileIn. |
|
1963 |
|
1964 self isStandAlone ifTrue: [self helpTool installHelpSpecsOnClass:self specClass]. |
|
1965 |
|
1966 self updateHistory. |
|
1967 hasSaved := true. |
|
1968 modified := false. |
|
1969 ! |
|
1970 |
|
1971 doSaveAs |
|
1972 "save current editing menu to class and selector |
|
1973 defined by the user. |
|
1974 " |
|
1975 super doSaveAs ifTrue:[ |
|
1976 listOfItems root rawLabel:specSelector |
|
1977 ]. |
|
1978 ! |
|
1979 |
|
1980 doShowMenuSpec |
|
1981 "opens a code view with the contents of the menu spec |
|
1982 " |
|
1983 |spec| |
|
1984 |
|
1985 spec := self generateMenuSpec. |
|
1986 |
|
1987 spec ifNotNil:[ |
|
1988 CodeView openWith:spec title: 'Menu Spec' |
|
1989 ]. |
|
1990 ! ! |
|
1991 |
|
1992 !MenuEditor methodsFor:'user actions - creation'! |
|
1993 |
|
1994 doCreateDelayedMenu:what |
|
1995 |selectedItem delayedItem| |
|
1996 |
|
1997 selectedItem := self selectedItem. |
|
1998 selectedItem ifNil:[^ self]. |
|
1999 |
|
2000 selectedItem canAddDelayedMenu ifFalse:[ ^ self ]. |
|
2001 self askForItemModification ifFalse:[ ^ self ]. |
|
2002 |
|
2003 what == #menu ifTrue:[ delayedItem := ItemMenu new ] |
|
2004 ifFalse:[ delayedItem := ItemLinkedMenu new ]. |
|
2005 |
|
2006 delayedItem setExpanded:true. |
|
2007 delayedItem := selectedItem add:delayedItem. |
|
2008 |
|
2009 delayedItem ifNotNil:[ |
|
2010 self selectedItem:delayedItem. |
|
2011 ]. |
|
2012 ! |
|
2013 |
|
2014 doCreateItem |
|
2015 "create a new Item |
|
2016 " |
|
2017 self addAndSelect:[ ItemAction new ]. |
|
2018 ! |
|
2019 |
|
2020 doCreateLinkedMenu |
|
2021 "create a new Linked Menu |
|
2022 " |
|
2023 self addAndSelect:[ ItemLinkedMenu new ]. |
|
2024 ! |
|
2025 |
|
2026 doCreateMenu |
|
2027 "create a new Menu |
|
2028 " |
|
2029 self addAndSelect:[ |item| |
|
2030 item := ItemMenu new. |
|
2031 item expand. |
|
2032 item |
|
2033 ]. |
|
2034 ! |
|
2035 |
|
2036 doCreateSep |
|
2037 "create a new Separator Item |
|
2038 " |
|
2039 self addAndSelect:[ ItemSeparator new ]. |
|
2040 ! |
|
2041 |
|
2042 doCreateStandardEditMenu |
|
2043 "create a standart edit menu |
|
2044 " |
|
2045 self addAndSelect:[ |
|
2046 ItemMenu menu:(self class standardEditMenu) labeled:'Edit' |
|
2047 ]. |
|
2048 ! |
|
2049 |
|
2050 doCreateStandardFileMenu |
|
2051 "create a standart file menu |
|
2052 " |
|
2053 self addAndSelect:[ |
|
2054 ItemMenu menu:(self class standardFileMenu) labeled:'File' |
|
2055 ]. |
|
2056 ! |
|
2057 |
|
2058 doCreateStandardHelpMenu |
|
2059 "create a standart help menu |
|
2060 " |
|
2061 |item| |
|
2062 |
|
2063 self addAndSelect:[ |
|
2064 item := ItemMenu menu:(self class standardHelpMenu) labeled:'Help'. |
|
2065 item aspectAt:#startGroup put:#right. |
|
2066 item |
|
2067 ]. |
|
2068 ! ! |
|
2069 |
|
2070 !MenuEditor methodsFor:'user actions - editing'! |
|
2071 |
|
2072 doCopy |
|
2073 "copy selected menuItems to the clipboard |
|
2074 " |
|
2075 |clip items| |
|
2076 |
|
2077 items := self selectedSuperItems. |
|
2078 items isEmpty ifTrue:[ ^ self ]. |
|
2079 |
|
2080 clip := OrderedCollection new. |
|
2081 items do:[:el| clip add:(el menuItem) ]. |
|
2082 |
|
2083 self clipboard:clip. |
|
2084 self updateAllToolInstances. |
|
2085 ! |
|
2086 |
|
2087 doCut |
|
2088 "copy selected menuItems to the clipboard and delete |
|
2089 " |
|
2090 self doCopy. |
|
2091 self doDelete. |
|
2092 ! |
|
2093 |
|
2094 doDelete |
|
2095 "delete selected menuItems |
|
2096 " |
|
2097 |selectedItem parent toDelete behind nextItem prevItem| |
|
2098 |
|
2099 toDelete := self selectedSuperItems. |
|
2100 toDelete isEmpty ifTrue:[ ^ self ]. |
|
2101 |
|
2102 self clearModified. |
|
2103 |
|
2104 selectedItem := toDelete first. |
|
2105 |
|
2106 selectedItem isRootItem ifTrue:[ |
|
2107 ^ selectedItem removeAll. |
|
2108 ]. |
|
2109 "/ compute the new selection |
|
2110 |
|
2111 prevItem := parent := selectedItem parent. |
|
2112 nextItem := nil. |
|
2113 |
|
2114 parent children size ~~ 1 ifTrue:[ |
|
2115 behind := false. |
|
2116 |
|
2117 parent do:[:el| |
|
2118 behind ifTrue:[ |
|
2119 (nextItem notNil or:[toDelete includesIdentical:el]) ifFalse:[ nextItem := el ]. |
|
2120 ] ifFalse:[ |
|
2121 behind := el == selectedItem. |
|
2122 (behind or:[toDelete includesIdentical:el]) ifFalse:[ prevItem := el ]. |
|
2123 ] |
144 ] |
2124 ] |
145 ]. |
2125 ]. |
146 ! |
2126 self withoutNotifyDo:[ |
147 |
2127 toDelete do:[:el| el remove ]. |
148 imageRetrieverClasses |
2128 ]. |
149 "returns a collection of image retrievers |
2129 self selectedItem:(nextItem ? prevItem). |
150 " |
2130 modified := true. |
151 ^ ImageRetrieverClasses |
2131 self updateChannels. |
152 ! ! |
2132 ! |
153 |
2133 |
154 !MenuEditor class methodsFor:'aspects'! |
2134 doPaste |
155 |
2135 "paste from clipboard |
156 aspects |
2136 " |
157 "get the aspects for the attributes of the menu components" |
2137 ^ self doPaste:(self clipboard) |
158 |
2138 ! |
159 ^#( |
2139 |
160 label |
2140 doPaste:aCollection |
161 accessCharacterPos |
2141 "paste collection of MenuItems |
162 showBusyCursorWhilePerforming |
2142 " |
163 horizontalLayout |
2143 |item loMenuItems| |
164 triggerOnDown |
2144 |
165 font |
2145 aCollection size == 0 ifTrue:[ ^ self ]. |
166 argument |
2146 |
167 submenuChannel |
2147 item := self selectedItem. |
168 keepLinkedMenu |
2148 item ifNil:[ ^ self ]. |
169 enabled |
2149 |
170 value |
2150 loMenuItems := OrderedCollection new. |
171 nameKey |
2151 aCollection do:[:el| |
172 indication |
2152 el class == MenuItem ifTrue:[ loMenuItems add:el ]. |
173 choice |
2153 ]. |
174 choiceValue |
2154 loMenuItems isEmpty ifTrue:[ ^ self ]. |
175 translateLabel |
2155 |
176 isButton |
2156 self addAndSelect:[ |
177 shortcutKey |
2157 loMenuItems collect:[:el| Item menuItem:el ] |
178 startGroup |
2158 ]. |
179 retriever |
2159 ! ! |
180 iconAndLabel |
2160 |
181 icon |
2161 !MenuEditor methodsFor:'user actions - hierarchy'! |
182 isVisible |
2162 |
183 hideMenuOnActivated |
2163 doMoveIn:aDirection |
184 auxValue |
2164 "move selected item into the next (#inNext) or previous (#inPrev) item |
185 ) |
2165 " |
186 |
2166 |item idx parent toParent| |
187 "Modified: / 14.8.1998 / 14:46:36 / cg" |
2167 |
188 ! ! |
2168 item := self selectedItem. |
189 |
2169 item ifNil:[^ self]. |
190 !MenuEditor class methodsFor:'help specs'! |
2170 |
191 |
2171 aDirection == #inNext ifTrue:[ item canMoveInNext ifFalse:[^ self] ] |
192 flyByHelpSpec |
2172 ifFalse:[ item canMoveInAbove ifFalse:[^ self] ]. |
193 <resource: #help> |
2173 |
194 |
2174 self askForItemModification ifFalse:[ ^ self ]. |
195 ^super flyByHelpSpec addPairsFrom:#( |
2175 |
196 |
2176 parent := item parent. |
197 #addMenuItem |
2177 idx := parent identityIndexOf:item. |
198 'Add Item' |
2178 |
199 |
2179 aDirection == #inNext ifTrue:[ toParent := parent at:(idx + 1) ifAbsent:nil ] |
200 #addMenuSeparator |
2180 ifFalse:[ toParent := parent at:(idx - 1) ifAbsent:nil ]. |
201 'Add Separator' |
2181 |
202 |
2182 self withoutNotifyDo:[ |
203 #addSubMenu |
2183 selectionHolder setValue:#(). |
204 'Add SubMenu' |
2184 parent removeIndex:idx. |
205 |
2185 |
206 #addSubMenuLink |
2186 aDirection == #inNext ifTrue:[ toParent addFirst:item ] |
207 'Add linked SubMenu' |
2187 ifFalse:[ toParent addLast:item ]. |
208 |
2188 item makeVisible. |
209 #fileLoad |
2189 ]. |
210 'Load Menu' |
2190 self selectedItem:item. |
211 |
2191 modified := true. |
212 #fileNew |
2192 ! |
213 'New Menu' |
2193 |
214 |
2194 doMoveOut |
215 #filePickAMenu |
2195 "move selected item out of current item |
216 'Pick a menu' |
2196 " |
217 |
2197 |item parent grandParent index| |
218 #fileSave |
2198 |
219 'Save Menu' |
2199 item := self selectedItem. |
220 |
2200 item ifNil:[^ self]. |
221 #fileSaveAs |
2201 item canMoveOut ifFalse:[^ self]. |
222 'Save Menu' |
2202 |
223 |
2203 self askForItemModification ifFalse:[ ^ self ]. |
224 ) |
2204 |
225 ! |
2205 parent := item parent. |
226 |
2206 grandParent := parent parent. |
227 helpSpec |
2207 index := grandParent identityIndexOf:parent. |
228 "This resource specification was automatically generated |
2208 |
229 by the UIHelpTool of ST/X." |
2209 self withoutNotifyDo:[ |
230 |
2210 selectionHolder setValue:#(). |
231 "Do not manually edit this!! If it is corrupted, |
2211 parent remove:item. |
232 the UIHelpTool may not be able to read the specification." |
2212 index > grandParent size ifTrue:[ grandParent add:item ] |
233 |
2213 ifFalse:[ grandParent add:item afterIndex:index ] |
234 " |
2214 ]. |
235 UIHelpTool openOnClass:MenuEditor |
2215 self selectedItem:item. |
236 " |
2216 modified := true. |
237 |
2217 ! |
238 <resource: #help> |
2218 |
239 |
2219 doMoveUpOrDown:aDirection |
240 ^super helpSpec addPairsFrom:#( |
2220 "move selected item up (#up) or down (#down) |
241 |
2221 " |
242 #addMenuItem |
2222 |item index parent children| |
243 'Add a new menu item.' |
2223 |
244 |
2224 item := self selectedItem. |
245 #addMenuSeparator |
2225 item ifNil:[^ self]. |
246 'Add a new menu separator.' |
2226 item canMoveUpOrDown ifFalse:[^ self]. |
247 |
2227 |
248 #addSubMenu |
2228 self askForItemModification ifFalse:[ ^ self ]. |
249 'Add a new sub menu.' |
2229 |
250 |
2230 self withoutNotifyDo:[ |
251 #addSubMenuLink |
2231 parent := item parent. |
252 'Add a new linked sub menu.' |
2232 children := parent children. |
253 |
2233 index := children identityIndexOf:item. |
254 #basicsAction |
2234 |
255 'An action selector with 0, 1 (the argument field), or 2 (the selected item) arguments.' |
2235 selectionHolder setValue:#(). |
256 |
2236 children removeIndex:index. |
257 #basicsArgument |
2237 |
258 'An optional arg passed with above selector, if it is a 1 or 2 arg selector (enter a Smalltalk literal).' |
2238 aDirection == #up ifTrue:[ |
259 |
2239 index == 1 ifTrue:[ children add:item ] |
260 #basicsChoice |
2240 ifFalse:[ children add:item beforeIndex:index - 1 ] |
261 'Aspect for a boolean holder, block or method, specifying the choices state (RadioButton behavior).' |
2241 ] ifFalse:[ |
262 |
2242 index > children size ifTrue:[ children addFirst:item ] |
263 #basicsChoiceValue |
2243 ifFalse:[ children add:item afterIndex:index ] |
264 'That choices value (typically number or symbol).' |
2244 ]. |
265 |
2245 parent childrenOrderChanged. |
266 #basicsIndication |
2246 ]. |
267 'Aspect for boolean holder, block, or method, specifying the indication state (CheckToggle behavior).' |
2247 self selectedItem:item. |
268 |
2248 modified := true. |
269 #basicsIsButton |
2249 ! ! |
270 'Enable/disable button-like behavior.' |
2250 |
271 |
2251 !MenuEditor::Item class methodsFor:'defaults'! |
272 #basicsKey |
2252 |
273 'Internal key of the item (optional, for programmed accesses).' |
2253 defaultLabel |
274 |
2254 ^ self subclassResponsibility |
275 #basicsLabel |
2255 ! ! |
276 'Label of the item.' |
2256 |
277 |
2257 !MenuEditor::Item class methodsFor:'image specs'! |
278 #basicsMenu |
2258 |
279 'Aspect providing the sub menu to be opened if item is selected (provide spec or valueHolder).' |
2259 iconDelayedLinkedMenu |
280 |
|
281 #basicsMenuArgument |
|
282 'An argument passed with the menu selector.' |
|
283 |
|
284 #basicsNameKey |
|
285 'Unique identifier of the item (optional).' |
|
286 |
|
287 #basicsSelector |
|
288 'Selector under which the generated menu spec is saved.' |
|
289 |
|
290 #basicsSeparatorType |
|
291 'List of valid separators.' |
|
292 |
|
293 #basicsTranslateLabel |
|
294 'Translate the label via the classes resource file (internationalization).' |
|
295 |
|
296 #browseResource |
|
297 'Search for methods with image resource.' |
|
298 |
|
299 #detailsAccelerator |
|
300 'Accelerator key to select the menu item from the keyboard (Cmdx or Ctrlx).' |
|
301 |
|
302 #detailsAccessCharaterPosition |
|
303 'Index of the access character position of the textual label (obsolete, VW compatibility).' |
|
304 |
|
305 #detailsAuxValue |
|
306 'Some additional value - for arbitrary use by the program' |
|
307 |
|
308 #detailsEnabled |
|
309 'Aspect or binding providing a boolean value holder for the enable-state of the menu item.' |
|
310 |
|
311 #detailsStartGroup |
|
312 'Specify start of a right-aligned item group.' |
|
313 |
|
314 #detailsVisibility |
|
315 'Aspect or binding providing a boolean value holder for the visibility-state of the menu item.' |
|
316 |
|
317 #fileLoad |
|
318 'Open a dialog to select and load a menu spec from a class.' |
|
319 |
|
320 #fileNew |
|
321 'Create a new menu spec.' |
|
322 |
|
323 #filePickAMenu |
|
324 'Select a menu from an open view and read its specification' |
|
325 |
|
326 #fileSave |
|
327 'Save the menu spec (and the help spec, if modified).' |
|
328 |
|
329 #fileSaveAs |
|
330 'Open a dialog to save the menu spec (and the help spec, if modified).' |
|
331 |
|
332 #hideMenuOnActivated |
|
333 'If on, the menu hides itself after the item was activated.' |
|
334 |
|
335 #imageImageAndLabel |
|
336 'Toggle display of both image and textual label.' |
|
337 |
|
338 #imageImageEditor |
|
339 'Open an Image Editor on the resource method defined by retriever and selector.' |
|
340 |
|
341 #imageImageList |
|
342 'Currently existing image resources.' |
|
343 |
|
344 #imageRetriever |
|
345 'Class implementing the image resource method. If no class is given, the current application class will be taken.' |
|
346 |
|
347 #imageSelector |
|
348 'Selector returning an image (sent to above or the application).' |
|
349 |
|
350 #keepLinkedMenu |
|
351 'Keep the linked menu after activation (do not destroy).' |
|
352 |
|
353 #showBusyCursorWhilePerforming |
|
354 'If on, a busy cursor is shown while the items action is performing.' |
|
355 |
|
356 #triggerOnDown |
|
357 'If on, the items action is performed on mouse-button press (default is on button-release).' |
|
358 |
|
359 #horizontalLayout |
|
360 'If on, the submenu organizes its items horizontal insteat of vertical (default).' |
|
361 |
|
362 ) |
|
363 ! ! |
|
364 |
|
365 !MenuEditor class methodsFor:'image specs'! |
|
366 |
|
367 linkSubmenuImage |
|
368 "This resource specification was automatically generated |
2260 "This resource specification was automatically generated |
369 by the ImageEditor of ST/X." |
2261 by the ImageEditor of ST/X." |
370 |
2262 |
371 "Do not manually edit this!!!! If it is corrupted, |
2263 "Do not manually edit this!! If it is corrupted, |
372 the ImageEditor may not be able to read the specification." |
2264 the ImageEditor may not be able to read the specification." |
373 |
2265 |
374 " |
2266 " |
375 ImageEditor openOnClass:self andSelector:#linkSubmenuImage |
2267 self iconDelayedLinkedMenu inspect |
|
2268 ImageEditor openOnClass:self andSelector:#iconDelayedLinkedMenu |
|
2269 Icon flushCachedIcons |
376 " |
2270 " |
377 |
2271 |
378 <resource: #image> |
2272 <resource: #image> |
379 |
2273 |
380 ^Icon |
2274 ^Icon |
381 constantNamed:#'MenuEditor linkSubmenuImage' |
2275 constantNamed:#'MenuEditor::Item class iconDelayedLinkedMenu' |
382 ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@ADQDQDQDQDQDQH@D"H"H"H"H"H"K0@RH"H"H"H"H"H/@A????????????<@D@@@@@@@@@@@C0@PL3L0DQDQDQD_@A@3L3LBH"H"H"<@DCL3L3@"H"H"K0@PL3L3L0??????@A@@@@L3L@@@@@<@DQDQDCL3@PLAG0@RH"H"@3L0@3@/@AH"H"H L3L3L0<@G?????<CL3L3L@@P@@@@@@@3L3LO@ADQDQDQDP@CLA<@D"H"H"H"H LBK0@RH"H"H"H"@BH/@B????????????<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 255 0 0 0 255 0 0 0 255 0 255 255 255 255 0 255 0 255 127 0 0 0 127 0 0 0 127 0 127 127 127 127 0 127 0 127 127 127 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself] |
2276 ifAbsentPut:[(Depth4Image new) width: 20; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
383 ! |
2277 @@@@@@@@@@@@@@DQDQDQDQDQDR@AH"H"H"H"H"H0@@@BH"H"@@@BL@QDPBH"H"@@H#@DQDPBH@H"@"H0ADQDPBA@H"H"L@@@QDP@Q@@@@@@ADPQDQDQ@DQD |
384 |
2278 @RH QDQDQ@H"L@D"H QDQD@"H#@A@@@@@DP@@@@0@QDQDQA@DQDQL@D"H"H @"H"H#@BL3L3L3L3L3L0@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127 255 0 0]; mask:((Depth1Image new) width: 20; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???0???0???0???0???0???0???0???0???0???0???0???0???0???0???0???0') ; yourself); yourself] |
385 menuItemImage |
2279 ! |
|
2280 |
|
2281 iconDelayedMenu |
386 "This resource specification was automatically generated |
2282 "This resource specification was automatically generated |
387 by the ImageEditor of ST/X." |
2283 by the ImageEditor of ST/X." |
388 |
2284 |
389 "Do not manually edit this!!!! If it is corrupted, |
2285 "Do not manually edit this!! If it is corrupted, |
390 the ImageEditor may not be able to read the specification." |
2286 the ImageEditor may not be able to read the specification." |
391 |
2287 |
392 " |
2288 " |
393 ImageEditor openOnClass:self andSelector:#menuItemImage |
2289 self iconDelayedMenu inspect |
|
2290 ImageEditor openOnClass:self andSelector:#iconDelayedMenu |
|
2291 Icon flushCachedIcons |
394 " |
2292 " |
395 |
2293 |
396 <resource: #image> |
2294 <resource: #image> |
397 |
2295 |
398 ^Icon |
2296 ^Icon |
399 constantNamed:#'MenuEditor menuItemImage' |
2297 constantNamed:#'MenuEditor::Item class iconDelayedMenu' |
400 ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUQUUUUUUUPUUUUUUU_UUUUUUUPUUUUUUUP@@@@@@@@EUUUUUVAF*****+HF:?+::;@F:.+*?;@F:.+::;@F:.+*:;@F:.+::;@F*****+DK??????A@@@@@@@@UUUUUUUPUUUUUUUXUUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUX') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@???<???<???<???<???<???<???<???<???<???<???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself] |
2298 ifAbsentPut:[(Depth2Image new) width: 20; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@UUUUUVA*****,F***@B0Z***@+A****J,F*****0@@@@@@AUUUUUXF*****0Z****+A@@@@@LEUUUUU0Z****+B?????<@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 20; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???0???0???0???0???0???0???0???0???0???0???0???0???0???0???0???0') ; yourself); yourself] |
401 ! |
2299 ! |
402 |
2300 |
403 menuSeparatorImage |
2301 iconItem |
404 "This resource specification was automatically generated |
2302 "This resource specification was automatically generated |
405 by the ImageEditor of ST/X." |
2303 by the ImageEditor of ST/X." |
406 |
2304 |
407 "Do not manually edit this!!!! If it is corrupted, |
2305 "Do not manually edit this!! If it is corrupted, |
408 the ImageEditor may not be able to read the specification." |
2306 the ImageEditor may not be able to read the specification." |
409 |
2307 |
410 " |
2308 " |
411 ImageEditor openOnClass:self andSelector:#menuSeparatorImage |
2309 self iconItem inspect |
|
2310 ImageEditor openOnClass:self andSelector:#iconItem |
|
2311 Icon flushCachedIcons |
412 " |
2312 " |
413 |
2313 |
414 <resource: #image> |
2314 <resource: #image> |
415 |
2315 |
416 ^Icon |
2316 ^Icon |
417 constantNamed:#'MenuEditor menuSeparatorImage' |
2317 constantNamed:#'MenuEditor::Item class iconItem' |
418 ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUURUUUUUUUPUUUUUUUPUUUUUUUPUUUUUUUP@@@@@@@@EUUUUUV@F*****+DF*****+CF?????+@F0@@@@[@F%UUUU[HF*****+@F*****+@K??????N@@@@@@@HUUUUUUUPUUUUUUUPUUUUUUUWUUUUUUUXUUUUUUUPUUUUUUUP') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@???<???<???<???<???<???<???<???<???<???<???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself] |
2318 ifAbsentPut:[(Depth2Image new) width: 20; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUUUUUUUP@@@@@@EUUUUU Z****+A.?/;+,F:::/>0[++>:;A...++,F::?..0Z****+B?????<@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 20; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@???0???0???0???0???0???0???0???0???0???0???0@@@@@@@@@@@@') ; yourself); yourself] |
419 ! |
2319 ! |
420 |
2320 |
421 submenuImage |
2321 iconLinkedMenu |
422 "This resource specification was automatically generated |
2322 "This resource specification was automatically generated |
423 by the ImageEditor of ST/X." |
2323 by the ImageEditor of ST/X." |
424 |
2324 |
425 "Do not manually edit this!!!! If it is corrupted, |
2325 "Do not manually edit this!! If it is corrupted, |
426 the ImageEditor may not be able to read the specification." |
2326 the ImageEditor may not be able to read the specification." |
427 |
2327 |
428 " |
2328 " |
429 ImageEditor openOnClass:self andSelector:#submenuImage |
2329 self iconLinkedMenu inspect |
|
2330 ImageEditor openOnClass:self andSelector:#iconLinkedMenu |
|
2331 Icon flushCachedIcons |
430 " |
2332 " |
431 |
2333 |
432 <resource: #image> |
2334 <resource: #image> |
433 |
2335 |
434 ^Icon |
2336 ^Icon |
435 constantNamed:#'MenuEditor submenuImage' |
2337 constantNamed:#'MenuEditor::Item class iconLinkedMenu' |
436 ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@EUUUUUV@F*****+@F*****+@G??????GD@@@@@C@EUUUUUWLF*****+@F*****+@G??????HD@@@@@C@EUUUUUW@F*****+@F*****+OG??????@D@@@@@C@EUUUUUW@F*****+@F*****+@K??????@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself] |
2338 ifAbsentPut:[(Depth4Image new) width: 20; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
437 ! ! |
2339 @@@@@@@@@@@@@@QDQDQDQDQDQA@DH"H"H"H"H"HPABH@@@H"H"H"D@PQ@3L0DQDQDQ@D@@L3L0@@@@@PADPCL3L0PCADD@P"@@@3L0@3@!!@DH"H"@3L3L3@P |
438 |
2340 AADQDQ@3L3L3@@P@@@@@@3L3LA@DQDQDQD@@L0PPABH"H"H"HC@"D@P"H"H"H"@BH!!@BDQDQDQDQDQDP@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 127 127 127 170 170 170 255 0 0 255 255 255]; mask:((Depth1Image new) width: 20; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???0???0???0???0???0???0???0???0???0???0???0???0???0???0???0???0') ; yourself); yourself] |
439 !MenuEditor class methodsFor:'interface specs'! |
2341 ! |
440 |
2342 |
441 basicsItemSpec |
2343 iconMenu |
|
2344 "This resource specification was automatically generated |
|
2345 by the ImageEditor of ST/X." |
|
2346 |
|
2347 "Do not manually edit this!! If it is corrupted, |
|
2348 the ImageEditor may not be able to read the specification." |
|
2349 |
|
2350 " |
|
2351 self iconMenu inspect |
|
2352 ImageEditor openOnClass:self andSelector:#iconMenu |
|
2353 Icon flushCachedIcons |
|
2354 " |
|
2355 |
|
2356 <resource: #image> |
|
2357 |
|
2358 ^Icon |
|
2359 constantNamed:#'MenuEditor::Item class iconMenu' |
|
2360 ifAbsentPut:[(Depth2Image new) width: 20; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@?????=C*****$N*****P5UUUUUC@@@@@DO?????P:****)C*****$MUUUUUP0@@@@AC?????4N*****P:****)BUUUUUT@@@@@@@b') ; colorMapFromArray:#[0 0 0 127 127 127 170 170 170 255 255 255]; mask:((Depth1Image new) width: 20; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???0???0???0???0???0???0???0???0???0???0???0???0???0???0???0???0') ; yourself); yourself] |
|
2361 ! |
|
2362 |
|
2363 iconSeparator |
|
2364 "This resource specification was automatically generated |
|
2365 by the ImageEditor of ST/X." |
|
2366 |
|
2367 "Do not manually edit this!! If it is corrupted, |
|
2368 the ImageEditor may not be able to read the specification." |
|
2369 |
|
2370 " |
|
2371 self iconSeparator inspect |
|
2372 ImageEditor openOnClass:self andSelector:#iconSeparator |
|
2373 Icon flushCachedIcons |
|
2374 " |
|
2375 |
|
2376 <resource: #image> |
|
2377 |
|
2378 ^Icon |
|
2379 constantNamed:#'MenuEditor::Item class iconSeparator' |
|
2380 ifAbsentPut:[(Depth2Image new) width: 20; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUUUUUUUUP@@@@@@EUUUUU Z****+A*****,F????:0[@@@@[A)UUUU,F*****0Z****+B?????<@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 20; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@???0???0???0???0???0???0???0???0???0???0???0@@@@@@@@@@@@') ; yourself); yourself] |
|
2381 ! ! |
|
2382 |
|
2383 !MenuEditor::Item class methodsFor:'instance creation'! |
|
2384 |
|
2385 classFor:aMenuItem |
|
2386 |
|
2387 aMenuItem ifNil:[ ^ nil ]. |
|
2388 |
|
2389 aMenuItem value ifNil:[ |
|
2390 aMenuItem submenu ifNotNil:[ ^ MenuEditor::ItemMenu ]. |
|
2391 aMenuItem submenuChannel ifNotNil:[ ^ MenuEditor::ItemLinkedMenu ]. |
|
2392 |
|
2393 (self separatorTypeOf:(aMenuItem rawLabel)) notNil ifTrue:[ |
|
2394 ^ MenuEditor::ItemSeparator |
|
2395 ] |
|
2396 ]. |
|
2397 ^ MenuEditor::ItemAction |
|
2398 ! |
|
2399 |
|
2400 menuItem:aMenuItem |
|
2401 |item cls| |
|
2402 |
|
2403 cls := self classFor:aMenuItem. |
|
2404 cls ifNil:[^ nil]. |
|
2405 |
|
2406 item := cls new. |
|
2407 item menuItem:aMenuItem. |
|
2408 ^ item |
|
2409 ! ! |
|
2410 |
|
2411 !MenuEditor::Item class methodsFor:'interface - editor'! |
|
2412 |
|
2413 addBindingsTo:aspects for:aMenuEditor |
|
2414 "add additional bindings to the aspects |
|
2415 " |
|
2416 aspects at:#falseChannel ifAbsentPut:[ |
|
2417 false asValue |
|
2418 ]. |
|
2419 aspects at:#notDelayedMenu ifAbsentPut:[ |
|
2420 true asValue |
|
2421 ]. |
|
2422 ! ! |
|
2423 |
|
2424 !MenuEditor::Item class methodsFor:'interface - specs'! |
|
2425 |
|
2426 detailsEditSpec |
442 "This resource specification was automatically generated |
2427 "This resource specification was automatically generated |
443 by the UIPainter of ST/X." |
2428 by the UIPainter of ST/X." |
444 |
2429 |
445 "Do not manually edit this!! If it is corrupted, |
2430 "Do not manually edit this!! If it is corrupted, |
446 the UIPainter may not be able to read the specification." |
2431 the UIPainter may not be able to read the specification." |
447 |
2432 |
448 " |
2433 " |
449 UIPainter new openOnClass:MenuEditor andSelector:#basicsItemSpec |
2434 UIPainter new openOnClass:MenuEditor::Item andSelector:#detailsEditSpec |
450 MenuEditor new openInterface:#basicsItemSpec |
|
451 " |
2435 " |
452 |
2436 |
453 <resource: #canvas> |
2437 <resource: #canvas> |
454 |
2438 |
455 ^ |
2439 ^ |
456 #(#FullSpec |
2440 #(#FullSpec |
457 #name: #basicsItemSpec |
2441 #name: #detailsEditSpec |
|
2442 #window: |
|
2443 #(#WindowSpec |
|
2444 #label: 'Details Edit' |
|
2445 #name: 'Details Edit' |
|
2446 #min: #(#Point 10 10) |
|
2447 #max: #(#Point 1280 1024) |
|
2448 #bounds: #(#Rectangle 43 153 303 398) |
|
2449 ) |
|
2450 #component: |
|
2451 #(#SpecCollection |
|
2452 #collection: #( |
|
2453 #(#LabelSpec |
|
2454 #label: 'Accelerator:' |
|
2455 #name: 'shortcutKeyLabel' |
|
2456 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
|
2457 #activeHelpKey: #detailsAccelerator |
|
2458 #resizeForLabel: true |
|
2459 #adjust: #right |
|
2460 ) |
|
2461 #(#InputFieldSpec |
|
2462 #name: 'shortcutKeyField' |
|
2463 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
|
2464 #activeHelpKey: #detailsAccelerator |
|
2465 #tabable: true |
|
2466 #model: #shortcutKeyCharacter |
|
2467 #group: #inputGroup |
|
2468 #type: #symbolOrNil |
|
2469 #immediateAccept: false |
|
2470 #acceptOnReturn: true |
|
2471 #acceptOnTab: true |
|
2472 #acceptChannel: #acceptChannel |
|
2473 #modifiedChannel: #modifiedChannel |
|
2474 #acceptOnPointerLeave: false |
|
2475 ) |
|
2476 #(#LabelSpec |
|
2477 #label: 'Enabled:' |
|
2478 #name: 'enabledLabel' |
|
2479 #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
|
2480 #activeHelpKey: #detailsEnabled |
|
2481 #resizeForLabel: true |
|
2482 #adjust: #right |
|
2483 ) |
|
2484 #(#InputFieldSpec |
|
2485 #name: 'enabledField' |
|
2486 #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
|
2487 #activeHelpKey: #detailsEnabled |
|
2488 #tabable: true |
|
2489 #model: #enabled |
|
2490 #group: #inputGroup |
|
2491 #type: #symbolOrNil |
|
2492 #immediateAccept: false |
|
2493 #acceptOnReturn: true |
|
2494 #acceptOnTab: true |
|
2495 #acceptChannel: #acceptChannel |
|
2496 #modifiedChannel: #modifiedChannel |
|
2497 #acceptOnPointerLeave: false |
|
2498 ) |
|
2499 #(#LabelSpec |
|
2500 #label: 'Visibility:' |
|
2501 #name: 'visibilityLabel' |
|
2502 #layout: #(#AlignmentOrigin 107 0 76 0 1 0.5) |
|
2503 #activeHelpKey: #detailsVisibility |
|
2504 #resizeForLabel: true |
|
2505 #adjust: #right |
|
2506 ) |
|
2507 #(#InputFieldSpec |
|
2508 #name: 'isVisibleInputField' |
|
2509 #layout: #(#LayoutFrame 110 0 65 0 -5 1.0 87 0) |
|
2510 #activeHelpKey: #detailsVisibility |
|
2511 #tabable: true |
|
2512 #model: #isVisible |
|
2513 #group: #inputGroup |
|
2514 #type: #symbolOrNil |
|
2515 #immediateAccept: false |
|
2516 #acceptOnReturn: true |
|
2517 #acceptOnTab: true |
|
2518 #acceptChannel: #acceptChannel |
|
2519 #modifiedChannel: #modifiedChannel |
|
2520 #acceptOnPointerLeave: false |
|
2521 ) |
|
2522 #(#LabelSpec |
|
2523 #label: 'Aux Value' |
|
2524 #name: 'auxLabel' |
|
2525 #layout: #(#AlignmentOrigin 107 0 101 0 1 0.5) |
|
2526 #activeHelpKey: #detailsAuxValue |
|
2527 #translateLabel: true |
|
2528 #resizeForLabel: true |
|
2529 #adjust: #right |
|
2530 ) |
|
2531 #(#InputFieldSpec |
|
2532 #name: 'auxInputField' |
|
2533 #layout: #(#LayoutFrame 110 0 90 0 -5 1.0 112 0) |
|
2534 #activeHelpKey: #detailsAuxValue |
|
2535 #tabable: true |
|
2536 #model: #auxValue |
|
2537 #group: #inputGroup |
|
2538 #type: #smalltalkObject |
|
2539 #immediateAccept: false |
|
2540 #acceptOnReturn: true |
|
2541 #acceptOnTab: true |
|
2542 #acceptChannel: #acceptChannel |
|
2543 #modifiedChannel: #modifiedChannel |
|
2544 #acceptOnPointerLeave: false |
|
2545 ) |
|
2546 #(#LabelSpec |
|
2547 #label: 'Start Group:' |
|
2548 #name: 'StartGroupLabel' |
|
2549 #layout: #(#AlignmentOrigin 107 0 139 0 1 0.5) |
|
2550 #activeHelpKey: #detailsStartGroup |
|
2551 #resizeForLabel: true |
|
2552 #adjust: #right |
|
2553 ) |
|
2554 #(#PopUpListSpec |
|
2555 #label: 'left' |
|
2556 #name: 'StartGroupPopUp' |
|
2557 #layout: #(#LayoutFrame 110 0 128 0 -5 1.0 150 0) |
|
2558 #activeHelpKey: #detailsStartGroup |
|
2559 #tabable: true |
|
2560 #model: #startGroup |
|
2561 #menu: |
|
2562 #(#left |
|
2563 #right |
|
2564 ) |
|
2565 ) |
|
2566 #(#LabelSpec |
|
2567 #label: 'Access Character Position:' |
|
2568 #name: 'accessCharLabel' |
|
2569 #layout: #(#AlignmentOrigin 217 0 170 0 1 0.5) |
|
2570 #activeHelpKey: #detailsAccessCharaterPosition |
|
2571 #resizeForLabel: true |
|
2572 #adjust: #right |
|
2573 ) |
|
2574 #(#InputFieldSpec |
|
2575 #name: 'accessCharField' |
|
2576 #layout: #(#LayoutFrame 220 0 159 0 -5 1.0 181 0) |
|
2577 #activeHelpKey: #detailsAccessCharaterPosition |
|
2578 #tabable: true |
|
2579 #model: #accessCharacterPosition |
|
2580 #group: #inputGroup |
|
2581 #type: #numberOrNil |
|
2582 #immediateAccept: false |
|
2583 #acceptOnReturn: true |
|
2584 #acceptOnTab: true |
|
2585 #acceptChannel: #acceptChannel |
|
2586 #modifiedChannel: #modifiedChannel |
|
2587 #acceptOnPointerLeave: false |
|
2588 ) |
|
2589 #(#LabelSpec |
|
2590 #label: 'Font:' |
|
2591 #name: 'fontLabel' |
|
2592 #layout: #(#AlignmentOrigin 75 0 219 0 1 0.5) |
|
2593 #resizeForLabel: true |
|
2594 #adjust: #right |
|
2595 ) |
|
2596 #(#FontMenuSpec |
|
2597 #attributes: |
|
2598 #(#tabable |
|
2599 true |
|
2600 ) |
|
2601 #name: 'fontMenu' |
|
2602 #layout: #(#LayoutFrame 78 0 208 0 -5 1.0 230 0) |
|
2603 #activeHelpKey: #fontMenu |
|
2604 #model: #font |
|
2605 ) |
|
2606 ) |
|
2607 |
|
2608 ) |
|
2609 ) |
|
2610 ! ! |
|
2611 |
|
2612 !MenuEditor::Item class methodsFor:'testing'! |
|
2613 |
|
2614 separatorTypeOf:aString |
|
2615 |size first| |
|
2616 |
|
2617 size := aString size. |
|
2618 |
|
2619 size == 0 ifTrue:[ ^ #blank ]. |
|
2620 |
|
2621 size == 1 ifTrue:[ |
|
2622 first := aString first. |
|
2623 first == $- ifTrue:[ ^ #single ]. |
|
2624 first == $= ifTrue:[ ^ #double ]. |
|
2625 first == (Character space) ifTrue:[ ^ #blank ]. |
|
2626 ]. |
|
2627 ^ nil |
|
2628 ! ! |
|
2629 |
|
2630 !MenuEditor::Item methodsFor:'accessing'! |
|
2631 |
|
2632 children |
|
2633 "optimize access; do not ask the model for unspecified children |
|
2634 " |
|
2635 ^ children |
|
2636 ! |
|
2637 |
|
2638 menuItem |
|
2639 "returns self as a MenuItem |
|
2640 " |
|
2641 ^ MenuItem new fromLiteralArrayEncoding:(menuItem literalArrayEncoding). |
|
2642 ! |
|
2643 |
|
2644 menuItem:aMenuItem |
|
2645 "rebuild self from a MenuItem |
|
2646 " |
|
2647 |value| |
|
2648 |
|
2649 menuItem := MenuItem labeled:(self rawLabel). |
|
2650 |
|
2651 MenuEditor aspects do:[:aKey| |
|
2652 value := aMenuItem perform:aKey. |
|
2653 value ifNotNil:[ self aspectAt:aKey put:value ] |
|
2654 ]. |
|
2655 ! |
|
2656 |
|
2657 rawLabel |
|
2658 "returns the label assigned to the item |
|
2659 " |
|
2660 ^ menuItem rawLabel |
|
2661 ! |
|
2662 |
|
2663 rawLabel:aValue |
|
2664 "set the label assigned to the item |
|
2665 " |
|
2666 aValue isString ifTrue:[ |
|
2667 (self class separatorTypeOf:aValue) ifNil:[ |
|
2668 menuItem rawLabel:aValue |
|
2669 ] |
|
2670 ]. |
|
2671 ! |
|
2672 |
|
2673 slices |
|
2674 "returns a sequence of supported slices |
|
2675 " |
|
2676 ^ self subclassResponsibility |
|
2677 ! |
|
2678 |
|
2679 submenu |
|
2680 "returns the submenu (of class Menu) or nil |
|
2681 " |
|
2682 ^ nil |
|
2683 ! ! |
|
2684 |
|
2685 !MenuEditor::Item methodsFor:'aspects'! |
|
2686 |
|
2687 aspectAt:aKey put:aValue |
|
2688 "set a specific aspect named aKey to the aValue |
|
2689 " |
|
2690 aKey == #rawLabel ifTrue:[ ^ self rawLabel:aValue ]. |
|
2691 aKey == #submenuChannel ifTrue:[ ^ self ]. |
|
2692 |
|
2693 menuItem perform:((aKey, ':') asSymbol) with:aValue. |
|
2694 ! |
|
2695 |
|
2696 fromAspects:aspects |
|
2697 "read values from aspects |
|
2698 " |
|
2699 MenuEditor aspects do:[:aKey| |
|
2700 self aspectAt:aKey put:((aspects at:aKey) value) |
|
2701 ]. |
|
2702 self changed. |
|
2703 ! |
|
2704 |
|
2705 toAspects:aspects |
|
2706 "write values to aspects |
|
2707 " |
|
2708 MenuEditor aspects do:[:aKey| |
|
2709 (aspects at:aKey) value:(menuItem perform:aKey) |
|
2710 ]. |
|
2711 (aspects at:#notDelayedMenu) value:(self isDelayedMenu not). |
|
2712 ! ! |
|
2713 |
|
2714 !MenuEditor::Item methodsFor:'displaying'! |
|
2715 |
|
2716 displayLabel |
|
2717 "returns the label on default displayed on the screen |
|
2718 " |
|
2719 ^ menuItem rawLabel |
|
2720 ! |
|
2721 |
|
2722 displayOn:aGC x:x y:y h:h |
|
2723 "display the item in the graphicsContext, aGC. |
|
2724 " |
|
2725 |label| |
|
2726 |
|
2727 label := self displayLabel. |
|
2728 |
|
2729 label notNil ifTrue:[ |
|
2730 self displayLabel:label h:(self heightOn:aGC) on:aGC x:x y:y h:h |
|
2731 ]. |
|
2732 ! |
|
2733 |
|
2734 heightOn:aGC |
|
2735 "returns the height of the label on a GC |
|
2736 " |
|
2737 height ifNil:[ height := parent heightOn:aGC ]. |
|
2738 ^ height |
|
2739 ! |
|
2740 |
|
2741 label |
|
2742 "get the rawLabel assigned to the item |
|
2743 " |
|
2744 ^ menuItem rawLabel |
|
2745 ! |
|
2746 |
|
2747 label:aLabel |
|
2748 "set the rawLabel assigned to the item |
|
2749 " |
|
2750 self rawLabel:aLabel |
|
2751 ! |
|
2752 |
|
2753 widthOn:aGC |
|
2754 "returns the height of the displayLabel on a GC |
|
2755 " |
|
2756 width ifNil:[ width := self widthOf:(self displayLabel) on:aGC ]. |
|
2757 ^ width |
|
2758 ! ! |
|
2759 |
|
2760 !MenuEditor::Item methodsFor:'initialization'! |
|
2761 |
|
2762 initialize |
|
2763 super initialize. |
|
2764 menuItem := MenuItem label:(self class defaultLabel). |
|
2765 ! ! |
|
2766 |
|
2767 !MenuEditor::Item methodsFor:'queries'! |
|
2768 |
|
2769 isAction |
|
2770 "returns true if the item is an Action |
|
2771 " |
|
2772 ^ false |
|
2773 ! |
|
2774 |
|
2775 isDelayedMenu |
|
2776 "returns true if the item is a Delayed (Linked) Menu |
|
2777 " |
|
2778 ^ parent isAction |
|
2779 ! |
|
2780 |
|
2781 isKindOfMenu |
|
2782 "returns true if the item is a Linked Menu or Menu |
|
2783 " |
|
2784 ^ false |
|
2785 ! |
|
2786 |
|
2787 isRootItem |
|
2788 "returns true if the item is the root item |
|
2789 " |
|
2790 ^ false |
|
2791 ! ! |
|
2792 |
|
2793 !MenuEditor::Item methodsFor:'queries - operation'! |
|
2794 |
|
2795 canAddChildren |
|
2796 "returns true if children can be added |
|
2797 " |
|
2798 ^ false |
|
2799 ! |
|
2800 |
|
2801 canAddDelayedMenu |
|
2802 "returns true if a delayed menu can be added; |
|
2803 on default false is returned |
|
2804 " |
|
2805 ^ false |
|
2806 ! |
|
2807 |
|
2808 canMoveInAbove |
|
2809 "returns true if the item can become a child of its previous sibling |
|
2810 " |
|
2811 |siblings index nextItem| |
|
2812 |
|
2813 siblings := parent children. |
|
2814 siblings size > 1 ifFalse:[ ^ false ]. |
|
2815 |
|
2816 index := siblings identityIndexOf:self. |
|
2817 nextItem := siblings at:(index - 1) ifAbsent:nil. |
|
2818 |
|
2819 nextItem ifNil:[^ false]. |
|
2820 ^ nextItem canAddChildren |
|
2821 ! |
|
2822 |
|
2823 canMoveInNext |
|
2824 "returns true if the item can become a child of its next sibling |
|
2825 " |
|
2826 |siblings index nextItem| |
|
2827 |
|
2828 siblings := parent children. |
|
2829 siblings size > 1 ifFalse:[ ^ false ]. |
|
2830 |
|
2831 index := siblings identityIndexOf:self. |
|
2832 nextItem := siblings at:(index + 1) ifAbsent:nil. |
|
2833 |
|
2834 nextItem ifNil:[^ false]. |
|
2835 ^ nextItem canAddChildren |
|
2836 ! |
|
2837 |
|
2838 canMoveOut |
|
2839 "returns true if the item can be moved out from its current parent |
|
2840 " |
|
2841 self isDelayedMenu ifTrue:[^ false]. |
|
2842 parent isDelayedMenu ifTrue:[^ false]. |
|
2843 |
|
2844 ^ parent parent notNil |
|
2845 ! |
|
2846 |
|
2847 canMoveUpOrDown |
|
2848 "returns true if the item can change its vertical order in its sibling |
|
2849 " |
|
2850 ^ parent children size > 1 |
|
2851 ! ! |
|
2852 |
|
2853 !MenuEditor::ItemAction class methodsFor:'defaults'! |
|
2854 |
|
2855 defaultLabel |
|
2856 ^ 'Action' |
|
2857 ! ! |
|
2858 |
|
2859 !MenuEditor::ItemAction class methodsFor:'interface - editor'! |
|
2860 |
|
2861 addBindingsTo:aspects for:aMenuEditor |
|
2862 "add additional bindings to the aspects |
|
2863 " |
|
2864 aspects at:#indicationEnabled ifAbsentPut:[ |
|
2865 BlockValue with:[:a | a size == 0 ] argument:(aspects at:#choice) |
|
2866 ]. |
|
2867 |
|
2868 aspects at:#choiceEnabled ifAbsentPut:[ |
|
2869 BlockValue with:[:a | a size == 0 ] argument:(aspects at:#indication) |
|
2870 ]. |
|
2871 |
|
2872 aspects at:#choiceValueEnabled ifAbsentPut:[ |
|
2873 BlockValue with:[:a | a size ~~ 0 ] argument:(aspects at:#choice) |
|
2874 ]. |
|
2875 aspects at:#hasNoDelayedMenuValue ifAbsentPut:[ |
|
2876 true asValue |
|
2877 ]. |
|
2878 ! ! |
|
2879 |
|
2880 !MenuEditor::ItemAction class methodsFor:'interface - specs'! |
|
2881 |
|
2882 basicsEditSpec |
|
2883 "This resource specification was automatically generated |
|
2884 by the UIPainter of ST/X." |
|
2885 |
|
2886 "Do not manually edit this!! If it is corrupted, |
|
2887 the UIPainter may not be able to read the specification." |
|
2888 |
|
2889 " |
|
2890 UIPainter new openOnClass:MenuEditor::ItemAction andSelector:#basicsEditSpec |
|
2891 " |
|
2892 |
|
2893 <resource: #canvas> |
|
2894 |
|
2895 ^ |
|
2896 #(#FullSpec |
|
2897 #name: #basicsEditSpec |
458 #window: |
2898 #window: |
459 #(#WindowSpec |
2899 #(#WindowSpec |
460 #label: 'Basics Item' |
2900 #label: 'basicsEditSpec' |
461 #name: 'Basics Item' |
2901 #name: 'basicsEditSpec' |
462 #min: #(#Point 10 10) |
2902 #min: #(#Point 10 10) |
463 #max: #(#Point 1160 870) |
2903 #max: #(#Point 1160 870) |
464 #bounds: #(#Rectangle 898 390 1173 751) |
2904 #bounds: #(#Rectangle 9 625 349 965) |
465 ) |
2905 ) |
466 #component: |
2906 #component: |
467 #(#SpecCollection |
2907 #(#SpecCollection |
468 #collection: #( |
2908 #collection: #( |
469 #(#LabelSpec |
2909 #(#LabelSpec |
470 #label: 'Name Key:' |
2910 #label: 'Name Key:' |
471 #name: 'nameKeyLabel' |
2911 #name: 'nameKeyLabel' |
472 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
2912 #layout: #(#AlignmentOrigin 107 0 25 0 1 0.5) |
473 #activeHelpKey: #basicsKey |
2913 #activeHelpKey: #basicsKey |
474 #resizeForLabel: true |
2914 #resizeForLabel: true |
475 #adjust: #right |
2915 #adjust: #right |
476 ) |
2916 ) |
477 #(#InputFieldSpec |
2917 #(#InputFieldSpec |
478 #name: 'nameKeyField' |
2918 #name: 'nameKeyField' |
479 #layout: #(#LayoutFrame 110 0 16 0 -5 1.0 38 0) |
2919 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
480 #activeHelpKey: #basicsKey |
2920 #activeHelpKey: #basicsKey |
481 #tabable: true |
2921 #tabable: true |
482 #model: #nameKey |
2922 #model: #nameKey |
483 #group: #inputGroup1 |
2923 #group: #inputGroup |
484 #type: #symbolOrNil |
2924 #type: #symbolOrNil |
|
2925 #immediateAccept: false |
485 #acceptOnLeave: false |
2926 #acceptOnLeave: false |
486 #acceptOnReturn: true |
2927 #acceptOnReturn: true |
487 #acceptOnTab: true |
2928 #acceptOnTab: true |
488 #acceptOnLostFocus: false |
2929 #acceptOnLostFocus: false |
489 #acceptChannel: #acceptChannel |
2930 #acceptChannel: #acceptChannel |
636 #acceptOnPointerLeave: false |
3085 #acceptOnPointerLeave: false |
637 ) |
3086 ) |
638 #(#CheckBoxSpec |
3087 #(#CheckBoxSpec |
639 #label: 'Translate Label' |
3088 #label: 'Translate Label' |
640 #name: 'translateLabelCheckBox' |
3089 #name: 'translateLabelCheckBox' |
641 #layout: #(#Point 20 218) |
3090 #layout: #(#Point 20 213) |
642 #activeHelpKey: #basicsTranslateLabel |
3091 #activeHelpKey: #basicsTranslateLabel |
643 #tabable: true |
3092 #tabable: true |
644 #model: #translateLabel |
3093 #model: #translateLabel |
645 ) |
3094 ) |
646 #(#CheckBoxSpec |
3095 #(#CheckBoxSpec |
647 #label: 'Is Button' |
3096 #label: 'Is Button' |
648 #name: 'isButtonCheckBox' |
3097 #name: 'isButtonCheckBox' |
649 #layout: #(#Point 20 243) |
3098 #layout: #(#Point 20 238) |
650 #activeHelpKey: #basicsIsButton |
3099 #activeHelpKey: #basicsIsButton |
651 #tabable: true |
3100 #tabable: true |
652 #model: #isButton |
3101 #model: #isButton |
653 ) |
3102 ) |
654 #(#CheckBoxSpec |
3103 #(#CheckBoxSpec |
655 #label: 'Hide Menu after Activation' |
3104 #label: 'Hide Menu after Activation' |
656 #name: 'hideMenuOnActivated' |
3105 #name: 'hideMenuOnActivated' |
657 #layout: #(#Point 20 267) |
3106 #layout: #(#Point 20 263) |
658 #activeHelpKey: #hideMenuOnActivated |
3107 #activeHelpKey: #hideMenuOnActivated |
659 #tabable: true |
3108 #tabable: true |
660 #model: #hideMenuOnActivated |
3109 #model: #hideMenuOnActivated |
661 ) |
3110 ) |
662 #(#CheckBoxSpec |
3111 #(#CheckBoxSpec |
663 #label: 'BusyCursor while Active' |
3112 #label: 'BusyCursor while Active' |
664 #name: 'showBusyCursorWhilePerforming' |
3113 #name: 'showBusyCursorWhilePerforming' |
665 #layout: #(#Point 20 291) |
3114 #layout: #(#Point 20 288) |
666 #activeHelpKey: #showBusyCursorWhilePerforming |
3115 #activeHelpKey: #showBusyCursorWhilePerforming |
667 #tabable: true |
3116 #tabable: true |
668 #model: #showBusyCursorWhilePerforming |
3117 #model: #showBusyCursorWhilePerforming |
669 #translateLabel: true |
3118 #translateLabel: true |
670 ) |
3119 ) |
671 #(#CheckBoxSpec |
3120 #(#CheckBoxSpec |
672 #label: 'Trigger On Down' |
3121 #label: 'Trigger On Down' |
673 #name: 'triggerOnDown' |
3122 #name: 'triggerOnDown' |
674 #layout: #(#Point 20 315) |
3123 #layout: #(#Point 20 313) |
675 #activeHelpKey: #triggerOnDown |
3124 #activeHelpKey: #triggerOnDown |
|
3125 #visibilityChannel: #hasNoDelayedMenuValue |
676 #tabable: true |
3126 #tabable: true |
677 #model: #triggerOnDown |
3127 #model: #triggerOnDown |
678 #translateLabel: true |
3128 #translateLabel: true |
679 ) |
3129 ) |
680 ) |
3130 ) |
681 |
3131 |
682 ) |
3132 ) |
683 ) |
3133 ) |
684 ! |
3134 ! ! |
685 |
3135 |
686 basicsLinkSpec |
3136 !MenuEditor::ItemAction methodsFor:'accessing'! |
|
3137 |
|
3138 menuItem |
|
3139 |item| |
|
3140 |
|
3141 item := super menuItem. |
|
3142 |
|
3143 self hasDelayedMenu ifTrue:[ |
|
3144 children first setDelayedAttributesTo:item. |
|
3145 |
|
3146 menuItem value ifNil:[ |
|
3147 menuItem value:#unspecified |
|
3148 ] |
|
3149 ]. |
|
3150 ^ item |
|
3151 ! |
|
3152 |
|
3153 menuItem:anItem |
|
3154 |submenu item| |
|
3155 |
|
3156 super menuItem:anItem. |
|
3157 submenu := anItem submenu. |
|
3158 |
|
3159 submenu notNil ifTrue:[ |
|
3160 item := MenuEditor::ItemMenu new |
|
3161 ] ifFalse:[ |
|
3162 anItem submenuChannel ifNil:[ |
|
3163 ^ self |
|
3164 ]. |
|
3165 item := MenuEditor::ItemLinkedMenu new |
|
3166 ]. |
|
3167 item getDelayedAttributesFrom:anItem. |
|
3168 self add:item. |
|
3169 ! |
|
3170 |
|
3171 slices |
|
3172 ^ #( |
|
3173 (Basics basicsEditSpec ) |
|
3174 (Details detailsEditSpec) |
|
3175 (Image image ) |
|
3176 (Help help) |
|
3177 ) |
|
3178 ! ! |
|
3179 |
|
3180 !MenuEditor::ItemAction methodsFor:'adding & removing'! |
|
3181 |
|
3182 add:anItem |
|
3183 "add an item; test whether the item is a delayed menu and |
|
3184 not already a delayed menu exists. |
|
3185 " |
|
3186 (anItem isKindOfMenu and:[self canAddDelayedMenu]) ifFalse:[ |
|
3187 ^ nil |
|
3188 ]. |
|
3189 "/ reset values not setable if a delayed menu is configured |
|
3190 |
|
3191 menuItem choice:nil. |
|
3192 menuItem indication:nil. |
|
3193 menuItem choiceValue:nil. |
|
3194 menuItem triggerOnDown:false. |
|
3195 |
|
3196 anItem argument:(menuItem argument). |
|
3197 |
|
3198 isExpanded := false. |
|
3199 anItem parent:self. |
|
3200 children := Array with:anItem. |
|
3201 self expand. |
|
3202 ^ anItem |
|
3203 ! ! |
|
3204 |
|
3205 !MenuEditor::ItemAction methodsFor:'aspects'! |
|
3206 |
|
3207 aspectAt:aKey put:aValue |
|
3208 "pass the argument to the delayed menu if existant |
|
3209 " |
|
3210 aKey == #argument ifTrue:[ |
|
3211 self hasDelayedMenu ifTrue:[ |
|
3212 children first argument:aValue |
|
3213 ]. |
|
3214 menuItem argument:aValue. |
|
3215 ^ self |
|
3216 ]. |
|
3217 super aspectAt:aKey put:aValue. |
|
3218 ! |
|
3219 |
|
3220 toAspects:aspects |
|
3221 "write values to aspects |
|
3222 " |
|
3223 super toAspects:aspects. |
|
3224 |
|
3225 (aspects at:#hasNoDelayedMenuValue) value:(self hasDelayedMenu not). |
|
3226 ! ! |
|
3227 |
|
3228 !MenuEditor::ItemAction methodsFor:'displaying'! |
|
3229 |
|
3230 icon |
|
3231 ^ self class iconItem |
|
3232 ! ! |
|
3233 |
|
3234 !MenuEditor::ItemAction methodsFor:'initialization'! |
|
3235 |
|
3236 initialize |
|
3237 super initialize. |
|
3238 isExpanded := true. |
|
3239 ! ! |
|
3240 |
|
3241 !MenuEditor::ItemAction methodsFor:'queries'! |
|
3242 |
|
3243 canCollapse |
|
3244 ^ false |
|
3245 ! |
|
3246 |
|
3247 hasDelayedMenu |
|
3248 "returns true if a delayed menu exists |
|
3249 " |
|
3250 ^ children size ~~ 0 |
|
3251 ! |
|
3252 |
|
3253 hasIndicator |
|
3254 ^ false |
|
3255 ! |
|
3256 |
|
3257 isAction |
|
3258 ^ true |
|
3259 ! ! |
|
3260 |
|
3261 !MenuEditor::ItemAction methodsFor:'queries - operation'! |
|
3262 |
|
3263 canAddDelayedMenu |
|
3264 "returns true if a delayed menu can be added; |
|
3265 no delayed menu exists and the indication or choice is unspecified |
|
3266 " |
|
3267 self hasDelayedMenu ifTrue:[ ^ false ]. |
|
3268 ^ (menuItem indication isNil and:[menuItem choice isNil]) |
|
3269 ! ! |
|
3270 |
|
3271 !MenuEditor::ItemLinkedMenu class methodsFor:'defaults'! |
|
3272 |
|
3273 defaultLabel |
|
3274 ^ 'Linked Menu' |
|
3275 ! ! |
|
3276 |
|
3277 !MenuEditor::ItemLinkedMenu class methodsFor:'interface - specs'! |
|
3278 |
|
3279 basicsEditSpec |
687 "This resource specification was automatically generated |
3280 "This resource specification was automatically generated |
688 by the UIPainter of ST/X." |
3281 by the UIPainter of ST/X." |
689 |
3282 |
690 "Do not manually edit this!! If it is corrupted, |
3283 "Do not manually edit this!! If it is corrupted, |
691 the UIPainter may not be able to read the specification." |
3284 the UIPainter may not be able to read the specification." |
692 |
3285 |
693 " |
3286 " |
694 UIPainter new openOnClass:MenuEditor andSelector:#basicsLinkSpec |
3287 UIPainter new openOnClass:MenuEditor::ItemLinkedMenu andSelector:#basicsEditSpec |
695 MenuEditor new openInterface:#basicsLinkSpec |
|
696 " |
3288 " |
697 |
3289 |
698 <resource: #canvas> |
3290 <resource: #canvas> |
699 |
3291 |
700 ^ |
3292 ^ |
701 #(#FullSpec |
3293 #(#FullSpec |
702 #name: #basicsLinkSpec |
3294 #name: #basicsEditSpec |
703 #window: |
3295 #window: |
704 #(#WindowSpec |
3296 #(#WindowSpec |
705 #label: 'Basics Link' |
3297 #label: 'basicsEditSpec' |
706 #name: 'Basics Link' |
3298 #name: 'basicsEditSpec' |
707 #min: #(#Point 10 10) |
3299 #min: #(#Point 10 10) |
708 #max: #(#Point 1280 1024) |
3300 #max: #(#Point 1160 870) |
709 #bounds: #(#Rectangle 900 124 1167 443) |
3301 #bounds: #(#Rectangle 346 355 686 695) |
710 ) |
3302 ) |
711 #component: |
3303 #component: |
712 #(#SpecCollection |
3304 #(#SpecCollection |
713 #collection: #( |
3305 #collection: #( |
714 #(#LabelSpec |
3306 #(#LabelSpec |
715 #label: 'Name Key:' |
3307 #label: 'Name Key:' |
716 #name: 'nameKeyLabel' |
3308 #name: 'nameKeyLabel' |
717 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
3309 #layout: #(#AlignmentOrigin 107 0 25 0 1 0.5) |
718 #activeHelpKey: #nameKey |
3310 #activeHelpKey: #basicsKey |
|
3311 #visibilityChannel: #notDelayedMenu |
719 #resizeForLabel: true |
3312 #resizeForLabel: true |
720 #adjust: #right |
3313 #adjust: #right |
721 ) |
3314 ) |
722 #(#InputFieldSpec |
3315 #(#InputFieldSpec |
723 #name: 'nameKeyField' |
3316 #name: 'nameKeyField' |
724 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
3317 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
725 #activeHelpKey: #basicsNameKey |
3318 #activeHelpKey: #basicsKey |
|
3319 #visibilityChannel: #notDelayedMenu |
726 #tabable: true |
3320 #tabable: true |
727 #model: #nameKey |
3321 #model: #nameKey |
728 #group: #inputGroup2 |
3322 #group: #inputGroup |
729 #type: #symbolOrNil |
3323 #type: #symbolOrNil |
|
3324 #immediateAccept: false |
|
3325 #acceptOnLeave: false |
730 #acceptOnReturn: true |
3326 #acceptOnReturn: true |
731 #acceptOnTab: true |
3327 #acceptOnTab: true |
|
3328 #acceptOnLostFocus: false |
732 #acceptChannel: #acceptChannel |
3329 #acceptChannel: #acceptChannel |
733 #modifiedChannel: #modifiedChannel |
3330 #modifiedChannel: #modifiedChannel |
734 #acceptOnPointerLeave: false |
3331 #acceptOnPointerLeave: false |
735 ) |
3332 ) |
736 #(#LabelSpec |
3333 #(#LabelSpec |
737 #label: 'Label:' |
3334 #label: 'Label:' |
738 #name: 'labelLabel' |
3335 #name: 'labelLabel' |
739 #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
3336 #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
|
3337 #activeHelpKey: #basicsLabel |
|
3338 #visibilityChannel: #notDelayedMenu |
740 #resizeForLabel: true |
3339 #resizeForLabel: true |
|
3340 #adjust: #right |
741 ) |
3341 ) |
742 #(#InputFieldSpec |
3342 #(#InputFieldSpec |
743 #name: 'labelField' |
3343 #name: 'labelField' |
744 #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
3344 #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
745 #activeHelpKey: #basicsLabel |
3345 #activeHelpKey: #basicsLabel |
|
3346 #visibilityChannel: #notDelayedMenu |
746 #tabable: true |
3347 #tabable: true |
747 #model: #label |
3348 #model: #rawLabel |
748 #group: #inputGroup2 |
3349 #group: #inputGroup |
|
3350 #immediateAccept: false |
749 #acceptOnReturn: true |
3351 #acceptOnReturn: true |
750 #acceptOnTab: true |
3352 #acceptOnTab: true |
|
3353 #acceptOnLostFocus: false |
751 #acceptChannel: #acceptChannel |
3354 #acceptChannel: #acceptChannel |
752 #modifiedChannel: #modifiedChannel |
3355 #modifiedChannel: #modifiedChannel |
753 #acceptOnPointerLeave: false |
3356 #acceptOnPointerLeave: false |
754 ) |
3357 ) |
755 #(#LabelSpec |
3358 #(#LabelSpec |
756 #label: 'Menu:' |
3359 #label: 'Menu:' |
757 #name: 'menuLabel' |
3360 #name: 'menuLabel' |
758 #layout: #(#AlignmentOrigin 107 0 76 0 1 0.5) |
3361 #layout: #(#AlignmentOrigin 107 0 90 0 1 0.5) |
|
3362 #activeHelpKey: #basicsLabel |
759 #resizeForLabel: true |
3363 #resizeForLabel: true |
|
3364 #adjust: #right |
760 ) |
3365 ) |
761 #(#InputFieldSpec |
3366 #(#InputFieldSpec |
762 #name: 'menuField' |
3367 #name: 'menuField' |
763 #layout: #(#LayoutFrame 110 0 65 0 -5 1.0 87 0) |
3368 #layout: #(#LayoutFrame 110 0 79 0 -5 1.0 101 0) |
764 #activeHelpKey: #basicsMenu |
3369 #activeHelpKey: #basicsMenu |
765 #tabable: true |
3370 #tabable: true |
766 #model: #submenuChannel |
3371 #model: #submenuChannel |
767 #group: #inputGroup2 |
3372 #group: #inputGroup |
768 #type: #symbolOrNil |
3373 #type: #symbolOrNil |
|
3374 #immediateAccept: false |
769 #acceptOnReturn: true |
3375 #acceptOnReturn: true |
770 #acceptOnTab: true |
3376 #acceptOnTab: true |
|
3377 #acceptOnLostFocus: false |
771 #acceptChannel: #acceptChannel |
3378 #acceptChannel: #acceptChannel |
772 #modifiedChannel: #modifiedChannel |
3379 #modifiedChannel: #modifiedChannel |
773 #acceptOnPointerLeave: false |
3380 #acceptOnPointerLeave: false |
774 ) |
3381 ) |
775 #(#LabelSpec |
3382 #(#LabelSpec |
776 #label: 'Argument:' |
3383 #label: 'Argument:' |
777 #name: 'ArgumentLabel' |
3384 #name: 'argumentLabel' |
778 #layout: #(#AlignmentOrigin 107 0 100 0 1 0.5) |
3385 #layout: #(#AlignmentOrigin 107 0 115 0 1 0.5) |
|
3386 #activeHelpKey: #basicsLabel |
779 #resizeForLabel: true |
3387 #resizeForLabel: true |
|
3388 #adjust: #right |
780 ) |
3389 ) |
781 #(#InputFieldSpec |
3390 #(#InputFieldSpec |
782 #name: 'argumentField' |
3391 #name: 'argumentField' |
783 #layout: #(#LayoutFrame 110 0 90 0 -5 1.0 112 0) |
3392 #layout: #(#LayoutFrame 110 0 104 0 -5 1.0 126 0) |
784 #activeHelpKey: #basicsMenuArgument |
3393 #activeHelpKey: #basicsMenuArgument |
785 #tabable: true |
3394 #tabable: true |
786 #model: #argument |
3395 #model: #argument |
787 #group: #inputGroup2 |
3396 #group: #inputGroup |
|
3397 #type: #smalltalkObject |
|
3398 #immediateAccept: false |
788 #acceptOnReturn: true |
3399 #acceptOnReturn: true |
789 #acceptOnTab: true |
3400 #acceptOnTab: true |
|
3401 #acceptOnLostFocus: false |
790 #acceptChannel: #acceptChannel |
3402 #acceptChannel: #acceptChannel |
791 #modifiedChannel: #modifiedChannel |
3403 #modifiedChannel: #modifiedChannel |
792 #acceptOnPointerLeave: false |
3404 #acceptOnPointerLeave: false |
793 ) |
3405 ) |
794 #(#CheckBoxSpec |
3406 #(#CheckBoxSpec |
795 #label: 'Translate Label' |
3407 #label: 'Translate Label' |
796 #name: 'translateLabelCheckBox' |
3408 #name: 'translateLabelCheckBox' |
797 #layout: #(#Point 20 190) |
3409 #layout: #(#Point 20 213) |
798 #activeHelpKey: #basicsTranslateLabel |
3410 #activeHelpKey: #basicsTranslateLabel |
|
3411 #visibilityChannel: #notDelayedMenu |
799 #tabable: true |
3412 #tabable: true |
800 #model: #translateLabel |
3413 #model: #translateLabel |
801 ) |
3414 ) |
802 #(#CheckBoxSpec |
3415 #(#CheckBoxSpec |
|
3416 #label: 'Is Button' |
|
3417 #name: 'isButtonCheckBox' |
|
3418 #layout: #(#Point 20 238) |
|
3419 #activeHelpKey: #basicsIsButton |
|
3420 #visibilityChannel: #notDelayedMenu |
|
3421 #tabable: true |
|
3422 #model: #isButton |
|
3423 ) |
|
3424 #(#CheckBoxSpec |
803 #label: 'Has Horizontal Layout' |
3425 #label: 'Has Horizontal Layout' |
804 #name: 'horizontalLayout' |
3426 #name: 'horizontalLayout' |
805 #layout: #(#Point 20 217) |
3427 #layout: #(#Point 20 263) |
806 #activeHelpKey: #horizontalLayout |
3428 #activeHelpKey: #horizontalLayout |
807 #tabable: true |
3429 #tabable: true |
808 #model: #horizontalLayout |
3430 #model: #horizontalLayout |
809 ) |
3431 ) |
810 #(#CheckBoxSpec |
3432 #(#CheckBoxSpec |
811 #label: 'Do not destroy linked Menu' |
3433 #label: 'Do not destroy linked Menu' |
812 #name: 'keepLinkedMenu' |
3434 #name: 'keepLinkedMenu' |
813 #layout: #(#Point 20 244) |
3435 #layout: #(#Point 20 288) |
|
3436 #activeHelpKey: #keepLinkedMenu |
814 #tabable: true |
3437 #tabable: true |
815 #activeHelpKey: #keepLinkedMenu |
|
816 #model: #keepLinkedMenu |
3438 #model: #keepLinkedMenu |
817 #translateLabel: true |
3439 #translateLabel: true |
818 ) |
3440 ) |
819 ) |
3441 ) |
820 |
3442 |
821 ) |
3443 ) |
822 ) |
3444 ) |
823 ! |
3445 ! ! |
824 |
3446 |
825 basicsMenuSpec |
3447 !MenuEditor::ItemLinkedMenu methodsFor:'accessing'! |
|
3448 |
|
3449 argument:aValue |
|
3450 menuItem argument:aValue. |
|
3451 ! |
|
3452 |
|
3453 menuItem |
|
3454 "returns self as a MenuItem |
|
3455 " |
|
3456 |item| |
|
3457 |
|
3458 item := super menuItem. |
|
3459 item submenuChannel:(self submenuChannel). |
|
3460 ^ item |
|
3461 ! |
|
3462 |
|
3463 slices |
|
3464 self isDelayedMenu ifTrue:[ |
|
3465 ^ #( |
|
3466 (Basics basicsEditSpec ) |
|
3467 ) |
|
3468 ]. |
|
3469 |
|
3470 ^ #( |
|
3471 (Basics basicsEditSpec ) |
|
3472 (Details detailsEditSpec) |
|
3473 (Image image ) |
|
3474 (Help help) |
|
3475 ) |
|
3476 ! |
|
3477 |
|
3478 submenuChannel |
|
3479 ^ menuItem submenuChannel ? #unspecified |
|
3480 ! |
|
3481 |
|
3482 submenuChannel:aValue |
|
3483 menuItem submenuChannel:aValue. |
|
3484 ! ! |
|
3485 |
|
3486 !MenuEditor::ItemLinkedMenu methodsFor:'aspects'! |
|
3487 |
|
3488 aspectAt:aKey put:aValue |
|
3489 "set a specific aspect named aKey to the aValue |
|
3490 " |
|
3491 aKey == #submenuChannel ifTrue:[ ^ self submenuChannel:aValue ]. |
|
3492 super aspectAt:aKey put:aValue. |
|
3493 ! |
|
3494 |
|
3495 getDelayedAttributesFrom:aMenuItem |
|
3496 menuItem rawLabel:'Delayed'. |
|
3497 |
|
3498 menuItem submenuChannel:(aMenuItem submenuChannel). |
|
3499 menuItem horizontalLayout:(aMenuItem horizontalLayout). |
|
3500 menuItem keepLinkedMenu:(aMenuItem keepLinkedMenu). |
|
3501 ! |
|
3502 |
|
3503 setDelayedAttributesTo:aMenuItem |
|
3504 aMenuItem submenuChannel:(self submenuChannel). |
|
3505 aMenuItem horizontalLayout:(menuItem horizontalLayout). |
|
3506 aMenuItem keepLinkedMenu:(menuItem keepLinkedMenu). |
|
3507 ! ! |
|
3508 |
|
3509 !MenuEditor::ItemLinkedMenu methodsFor:'displaying'! |
|
3510 |
|
3511 displayLabel |
|
3512 "returns the label dependent on is delayed or not |
|
3513 " |
|
3514 self isDelayedMenu ifTrue:[ ^ self submenuChannel ]. |
|
3515 ^ menuItem rawLabel |
|
3516 ! |
|
3517 |
|
3518 icon |
|
3519 self isDelayedMenu ifTrue:[ ^ self class iconDelayedLinkedMenu ]. |
|
3520 ^ self class iconLinkedMenu |
|
3521 ! ! |
|
3522 |
|
3523 !MenuEditor::ItemLinkedMenu methodsFor:'queries'! |
|
3524 |
|
3525 isKindOfMenu |
|
3526 ^ true |
|
3527 ! ! |
|
3528 |
|
3529 !MenuEditor::ItemMenu class methodsFor:'defaults'! |
|
3530 |
|
3531 defaultDelayedLabel |
|
3532 ^ 'delayed' |
|
3533 ! |
|
3534 |
|
3535 defaultLabel |
|
3536 ^ 'Menu' |
|
3537 ! ! |
|
3538 |
|
3539 !MenuEditor::ItemMenu class methodsFor:'instance creation'! |
|
3540 |
|
3541 menu:aMenu labeled:aString |
|
3542 |item| |
|
3543 |
|
3544 item := self new. |
|
3545 item menu:aMenu labeled:aString. |
|
3546 ^ item |
|
3547 ! ! |
|
3548 |
|
3549 !MenuEditor::ItemMenu class methodsFor:'interface - specs'! |
|
3550 |
|
3551 basicsEditSpec |
826 "This resource specification was automatically generated |
3552 "This resource specification was automatically generated |
827 by the UIPainter of ST/X." |
3553 by the UIPainter of ST/X." |
828 |
3554 |
829 "Do not manually edit this!! If it is corrupted, |
3555 "Do not manually edit this!! If it is corrupted, |
830 the UIPainter may not be able to read the specification." |
3556 the UIPainter may not be able to read the specification." |
831 |
3557 |
832 " |
3558 " |
833 UIPainter new openOnClass:MenuEditor andSelector:#basicsMenuSpec |
3559 UIPainter new openOnClass:MenuEditor::ItemMenu andSelector:#basicsEditSpec |
834 MenuEditor new openInterface:#basicsMenuSpec |
|
835 " |
3560 " |
836 |
3561 |
837 <resource: #canvas> |
3562 <resource: #canvas> |
838 |
3563 |
839 ^ |
3564 ^ |
840 #(#FullSpec |
3565 #(#FullSpec |
841 #name: #basicsMenuSpec |
3566 #name: #basicsEditSpec |
842 #window: |
3567 #window: |
843 #(#WindowSpec |
3568 #(#WindowSpec |
844 #label: 'Basics Menu' |
3569 #label: 'basicsEditSpec' |
845 #name: 'Basics Menu' |
3570 #name: 'basicsEditSpec' |
846 #min: #(#Point 10 10) |
3571 #min: #(#Point 10 10) |
847 #max: #(#Point 1280 1024) |
3572 #max: #(#Point 1160 870) |
848 #bounds: #(#Rectangle 93 223 360 542) |
3573 #bounds: #(#Rectangle 810 135 1150 475) |
849 ) |
3574 ) |
850 #component: |
3575 #component: |
851 #(#SpecCollection |
3576 #(#SpecCollection |
852 #collection: #( |
3577 #collection: #( |
853 #(#LabelSpec |
3578 #(#LabelSpec |
854 #label: 'Name Key:' |
3579 #label: 'Name Key:' |
855 #name: 'nameKeyLabel' |
3580 #name: 'nameKeyLabel' |
856 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
3581 #layout: #(#AlignmentOrigin 107 0 25 0 1 0.5) |
|
3582 #activeHelpKey: #basicsKey |
|
3583 #visibilityChannel: #notDelayedMenu |
857 #resizeForLabel: true |
3584 #resizeForLabel: true |
858 #adjust: #right |
3585 #adjust: #right |
859 ) |
3586 ) |
860 #(#InputFieldSpec |
3587 #(#InputFieldSpec |
861 #name: 'nameKeyField' |
3588 #name: 'nameKeyField' |
862 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
3589 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
863 #activeHelpKey: #basicsNameKey |
3590 #activeHelpKey: #basicsKey |
|
3591 #visibilityChannel: #notDelayedMenu |
864 #tabable: true |
3592 #tabable: true |
865 #model: #nameKey |
3593 #model: #nameKey |
866 #group: #inputGroup3 |
3594 #group: #inputGroup |
867 #type: #symbolOrNil |
3595 #type: #symbolOrNil |
|
3596 #immediateAccept: false |
|
3597 #acceptOnLeave: false |
868 #acceptOnReturn: true |
3598 #acceptOnReturn: true |
869 #acceptOnTab: true |
3599 #acceptOnTab: true |
|
3600 #acceptOnLostFocus: false |
870 #acceptChannel: #acceptChannel |
3601 #acceptChannel: #acceptChannel |
871 #modifiedChannel: #modifiedChannel |
3602 #modifiedChannel: #modifiedChannel |
872 #acceptOnPointerLeave: false |
3603 #acceptOnPointerLeave: false |
873 ) |
3604 ) |
874 #(#LabelSpec |
3605 #(#LabelSpec |
875 #label: 'Label:' |
3606 #label: 'Label:' |
876 #name: 'labelLabel' |
3607 #name: 'labelLabel' |
877 #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
3608 #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
|
3609 #activeHelpKey: #basicsLabel |
|
3610 #visibilityChannel: #notDelayedMenu |
878 #resizeForLabel: true |
3611 #resizeForLabel: true |
879 #adjust: #right |
3612 #adjust: #right |
880 ) |
3613 ) |
881 #(#InputFieldSpec |
3614 #(#InputFieldSpec |
882 #name: 'labelField' |
3615 #name: 'labelField' |
883 #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
3616 #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
884 #activeHelpKey: #basicsLabel |
3617 #activeHelpKey: #basicsLabel |
|
3618 #visibilityChannel: #notDelayedMenu |
885 #tabable: true |
3619 #tabable: true |
886 #model: #label |
3620 #model: #rawLabel |
887 #group: #inputGroup3 |
3621 #group: #inputGroup |
|
3622 #immediateAccept: false |
888 #acceptOnReturn: true |
3623 #acceptOnReturn: true |
889 #acceptOnTab: true |
3624 #acceptOnTab: true |
|
3625 #acceptOnLostFocus: false |
890 #acceptChannel: #acceptChannel |
3626 #acceptChannel: #acceptChannel |
891 #modifiedChannel: #modifiedChannel |
3627 #modifiedChannel: #modifiedChannel |
892 #acceptOnPointerLeave: false |
3628 #acceptOnPointerLeave: false |
893 ) |
3629 ) |
894 #(#CheckBoxSpec |
3630 #(#CheckBoxSpec |
895 #label: 'Translate Label' |
3631 #label: 'Translate Label' |
896 #name: 'translateLabelCheckBox' |
3632 #name: 'translateLabelCheckBox' |
897 #layout: #(#Point 20 190) |
3633 #layout: #(#Point 20 213) |
898 #activeHelpKey: #basicsTranslateLabel |
3634 #activeHelpKey: #basicsTranslateLabel |
|
3635 #visibilityChannel: #notDelayedMenu |
899 #tabable: true |
3636 #tabable: true |
900 #model: #translateLabel |
3637 #model: #translateLabel |
901 ) |
3638 ) |
902 #(#CheckBoxSpec |
3639 #(#CheckBoxSpec |
903 #label: 'Has Horizontal Orientation' |
3640 #label: 'Is Button' |
|
3641 #name: 'isButtonCheckBox' |
|
3642 #layout: #(#Point 20 238) |
|
3643 #activeHelpKey: #basicsIsButton |
|
3644 #visibilityChannel: #notDelayedMenu |
|
3645 #tabable: true |
|
3646 #model: #isButton |
|
3647 ) |
|
3648 #(#CheckBoxSpec |
|
3649 #label: 'Has Horizontal Layout' |
904 #name: 'horizontalLayout' |
3650 #name: 'horizontalLayout' |
905 #layout: #(#Point 20 217) |
3651 #layout: #(#Point 20 263) |
906 #activeHelpKey: #horizontalLayout |
3652 #activeHelpKey: #horizontalLayout |
907 #tabable: true |
3653 #tabable: true |
908 #model: #horizontalLayout |
3654 #model: #horizontalLayout |
909 ) |
|
910 |
|
911 ) |
|
912 |
|
913 ) |
|
914 ) |
|
915 ! |
|
916 |
|
917 basicsRootSpec |
|
918 "This resource specification was automatically generated |
|
919 by the UIPainter of ST/X." |
|
920 |
|
921 "Do not manually edit this!! If it is corrupted, |
|
922 the UIPainter may not be able to read the specification." |
|
923 |
|
924 " |
|
925 UIPainter new openOnClass:MenuEditor andSelector:#basicsRootSpec |
|
926 MenuEditor new openInterface:#basicsRootSpec |
|
927 " |
|
928 |
|
929 <resource: #canvas> |
|
930 |
|
931 ^ |
|
932 #(#FullSpec |
|
933 #name: #basicsRootSpec |
|
934 #window: |
|
935 #(#WindowSpec |
|
936 #label: 'Basics Root' |
|
937 #name: 'Basics Root' |
|
938 #layout: #(#LayoutFrame 11 0 100 0 277 0 418 0) |
|
939 #level: 0 |
|
940 #min: #(#Point 10 10) |
|
941 #max: #(#Point 1280 1024) |
|
942 #bounds: #(#Rectangle 11 100 278 419) |
|
943 #usePreferredExtent: false |
|
944 #returnIsOKInDialog: true |
|
945 #escapeIsCancelInDialog: true |
|
946 ) |
|
947 #component: |
|
948 #(#SpecCollection |
|
949 #collection: #( |
|
950 #(#LabelSpec |
|
951 #label: 'Selector:' |
|
952 #name: 'selectorLabel' |
|
953 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
|
954 #resizeForLabel: true |
|
955 #adjust: #right |
|
956 #activeHelpKey: #basicsSelector |
|
957 ) |
|
958 #(#InputFieldSpec |
|
959 #name: 'selectorField' |
|
960 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
|
961 #activeHelpKey: #basicsSelector |
|
962 #tabable: true |
|
963 #model: #label |
|
964 #group: #inputGroup |
|
965 #acceptOnReturn: true |
|
966 #acceptOnTab: true |
|
967 #acceptChannel: #acceptChannel |
|
968 #modifiedChannel: #modifiedChannel |
|
969 #acceptOnPointerLeave: false |
|
970 ) |
3655 ) |
971 ) |
3656 ) |
972 |
3657 |
973 ) |
3658 ) |
974 ) |
3659 ) |
975 ! |
3660 ! ! |
976 |
3661 |
977 basicsSeparatorSpec |
3662 !MenuEditor::ItemMenu methodsFor:'accessing'! |
|
3663 |
|
3664 argument:aValue |
|
3665 "/ ignorred. |
|
3666 ! |
|
3667 |
|
3668 menu:aMenu labeled:aString |
|
3669 |expanded item menu| |
|
3670 |
|
3671 self criticalDo:[ |
|
3672 self isRootItem ifTrue:[ expanded := true ] |
|
3673 ifFalse:[ expanded := isExpanded ]. |
|
3674 |
|
3675 self removeAll. |
|
3676 self rawLabel:aString. |
|
3677 |
|
3678 aMenu ifNotNil:[ |
|
3679 aMenu isCollection ifTrue:[ menu := Menu new fromLiteralArrayEncoding:aMenu ] |
|
3680 ifFalse:[ menu := aMenu ]. |
|
3681 |
|
3682 menu numberOfItems == 0 ifTrue:[ |
|
3683 menu := nil |
|
3684 ]. |
|
3685 ]. |
|
3686 menu ifNotNil:[ |
|
3687 isExpanded := false. "/ discard change notifications |
|
3688 children := OrderedCollection new. |
|
3689 |
|
3690 menu itemsDo:[:el| |
|
3691 item := self class menuItem:el. |
|
3692 item parent:self. |
|
3693 children add:item. |
|
3694 ]. |
|
3695 expanded ifTrue:[ self expand ]. |
|
3696 ]. |
|
3697 isExpanded := expanded. |
|
3698 ]. |
|
3699 self changed |
|
3700 ! |
|
3701 |
|
3702 menuItem |
|
3703 "returns self as a MenuItem |
|
3704 " |
|
3705 |item| |
|
3706 |
|
3707 item := super menuItem. |
|
3708 item submenu:(self submenu). |
|
3709 ^ item |
|
3710 ! |
|
3711 |
|
3712 menuItem:anItem |
|
3713 |
|
3714 super menuItem:anItem. |
|
3715 self menu:(anItem submenu) labeled:nil. |
|
3716 ! |
|
3717 |
|
3718 slices |
|
3719 self isDelayedMenu ifTrue:[ |
|
3720 ^ #( |
|
3721 (Basics basicsEditSpec ) |
|
3722 ) |
|
3723 ]. |
|
3724 |
|
3725 ^ #( |
|
3726 (Basics basicsEditSpec ) |
|
3727 (Details detailsEditSpec) |
|
3728 (Image image ) |
|
3729 (Help help) |
|
3730 ) |
|
3731 ! |
|
3732 |
|
3733 submenu |
|
3734 |menu| |
|
3735 |
|
3736 menu := Menu new. |
|
3737 |
|
3738 children size ~~ 0 ifTrue:[ |
|
3739 children do:[:el| menu addItem:(el menuItem) ]. |
|
3740 ]. |
|
3741 ^ menu |
|
3742 ! ! |
|
3743 |
|
3744 !MenuEditor::ItemMenu methodsFor:'aspects'! |
|
3745 |
|
3746 getDelayedAttributesFrom:aMenuItem |
|
3747 |
|
3748 self menu:(aMenuItem submenu) labeled:nil. |
|
3749 menuItem horizontalLayout:(aMenuItem horizontalLayout). |
|
3750 ! |
|
3751 |
|
3752 setDelayedAttributesTo:aMenuItem |
|
3753 aMenuItem submenu:(self submenu). |
|
3754 aMenuItem horizontalLayout:(menuItem horizontalLayout). |
|
3755 ! ! |
|
3756 |
|
3757 !MenuEditor::ItemMenu methodsFor:'displaying'! |
|
3758 |
|
3759 displayLabel |
|
3760 "returns the label dependent on is delayed or not |
|
3761 " |
|
3762 self isDelayedMenu ifTrue:[ ^ self class defaultDelayedLabel ]. |
|
3763 ^ menuItem rawLabel |
|
3764 ! |
|
3765 |
|
3766 icon |
|
3767 self isDelayedMenu ifTrue:[ ^ self class iconDelayedMenu ]. |
|
3768 ^ self class iconMenu |
|
3769 ! ! |
|
3770 |
|
3771 !MenuEditor::ItemMenu methodsFor:'queries'! |
|
3772 |
|
3773 canAddChildren |
|
3774 "children can be added |
|
3775 " |
|
3776 ^ true |
|
3777 ! |
|
3778 |
|
3779 canExpand |
|
3780 "returns true if the item is expandable |
|
3781 " |
|
3782 ^ isExpanded == false |
|
3783 ! |
|
3784 |
|
3785 hasIndicator |
|
3786 ^ true |
|
3787 ! |
|
3788 |
|
3789 isKindOfMenu |
|
3790 ^ true |
|
3791 ! ! |
|
3792 |
|
3793 !MenuEditor::ItemRoot class methodsFor:'defaults'! |
|
3794 |
|
3795 defaultLabel |
|
3796 ^ MenuEditor resourceType |
|
3797 ! ! |
|
3798 |
|
3799 !MenuEditor::ItemRoot class methodsFor:'interface - editor'! |
|
3800 |
|
3801 addBindingsTo:aspects for:aMenuEditor |
|
3802 "add additional bindings to the aspects |
|
3803 " |
|
3804 ! ! |
|
3805 |
|
3806 !MenuEditor::ItemRoot class methodsFor:'interface - specs'! |
|
3807 |
|
3808 basicsEditSpec |
978 "This resource specification was automatically generated |
3809 "This resource specification was automatically generated |
979 by the UIPainter of ST/X." |
3810 by the UIPainter of ST/X." |
980 |
3811 |
981 "Do not manually edit this!! If it is corrupted, |
3812 "Do not manually edit this!! If it is corrupted, |
982 the UIPainter may not be able to read the specification." |
3813 the UIPainter may not be able to read the specification." |
983 |
3814 |
984 " |
3815 " |
985 UIPainter new openOnClass:MenuEditor andSelector:#basicsSeparatorSpec |
3816 UIPainter new openOnClass:MenuEditor::ItemRoot andSelector:#basicsEditSpec |
986 MenuEditor new openInterface:#basicsSeparatorSpec |
|
987 " |
3817 " |
988 |
3818 |
989 <resource: #canvas> |
3819 <resource: #canvas> |
990 |
3820 |
991 ^ |
3821 ^ |
992 #(#FullSpec |
3822 #(#FullSpec |
993 #name: #basicsSeparatorSpec |
3823 #name: #basicsEditSpec |
994 #window: |
3824 #window: |
995 #(#WindowSpec |
3825 #(#WindowSpec |
996 #label: 'Basics Separator' |
3826 #label: 'basicsEditSpec' |
997 #name: 'Basics Separator' |
3827 #name: 'basicsEditSpec' |
998 #layout: #(#LayoutFrame 9 0 149 0 275 0 467 0) |
3828 #min: #(#Point 10 10) |
999 #level: 0 |
3829 #max: #(#Point 1280 1024) |
1000 #min: #(#Point 10 10) |
3830 #bounds: #(#Rectangle 644 547 904 593) |
1001 #max: #(#Point 1160 870) |
3831 ) |
1002 #bounds: #(#Rectangle 9 149 276 468) |
3832 #component: |
1003 #usePreferredExtent: false |
|
1004 #returnIsOKInDialog: true |
|
1005 #escapeIsCancelInDialog: true |
|
1006 ) |
|
1007 #component: |
|
1008 #(#SpecCollection |
3833 #(#SpecCollection |
1009 #collection: #( |
3834 #collection: #( |
1010 #(#LabelSpec |
3835 #(#LabelSpec |
1011 #label: 'Separator Type:' |
3836 #label: 'Selector:' |
1012 #name: 'separatorLabel' |
3837 #name: 'selectorLabel' |
1013 #layout: #(#AlignmentOrigin 127 0 26 0 1 0.5) |
3838 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
1014 #resizeForLabel: true |
3839 #activeHelpKey: #basicsSelector |
1015 #adjust: #right |
3840 #resizeForLabel: true |
1016 ) |
3841 #adjust: #right |
1017 #(#ComboListSpec |
3842 ) |
1018 #name: 'seperatorList' |
3843 #(#InputFieldSpec |
1019 #layout: #(#LayoutFrame 132 0 15 0 -5 1.0 37 0) |
3844 #name: 'selectorField' |
1020 #activeHelpKey: #basicsSeparatorType |
3845 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
1021 #tabable: true |
3846 #activeHelpKey: #basicsSelector |
1022 #model: #seperatorSelection |
3847 #tabable: true |
1023 #useIndex: true |
3848 #model: #rawLabel |
1024 ) |
3849 #group: #inputGroup |
1025 #(#LabelSpec |
3850 #type: #string |
1026 #label: 'Visibility:' |
3851 #immediateAccept: false |
1027 #name: 'visibilityLabel' |
3852 #acceptOnReturn: true |
1028 #layout: #(#AlignmentOrigin 127 0 76 0 1 0.5) |
3853 #acceptOnTab: true |
1029 #resizeForLabel: true |
3854 #acceptChannel: #acceptChannel |
1030 #adjust: #right |
3855 #modifiedChannel: #modifiedChannel |
1031 ) |
3856 #acceptOnPointerLeave: false |
1032 #(#InputFieldSpec |
3857 ) |
1033 #name: 'visibilityInputField' |
3858 ) |
1034 #layout: #(#LayoutFrame 132 0 65 0 -5 1.0 87 0) |
|
1035 #activeHelpKey: #detailsVisibility |
|
1036 #tabable: true |
|
1037 #model: #isVisible |
|
1038 #group: #inputGroup |
|
1039 #type: #symbolOrNil |
|
1040 #acceptOnReturn: true |
|
1041 #acceptOnTab: true |
|
1042 #acceptChannel: #acceptChannel |
|
1043 #modifiedChannel: #modifiedChannel |
|
1044 #acceptOnPointerLeave: false |
|
1045 ) |
|
1046 ) |
|
1047 |
3859 |
1048 ) |
3860 ) |
1049 ) |
3861 ) |
1050 ! |
3862 ! ! |
1051 |
3863 |
1052 detailsEditSpec |
3864 !MenuEditor::ItemRoot methodsFor:'accessing'! |
|
3865 |
|
3866 menuItem:aMenuItem |
|
3867 "rebuild self from a MenuItem |
|
3868 " |
|
3869 |submenu selector| |
|
3870 |
|
3871 aMenuItem notNil ifTrue:[ |
|
3872 submenu := aMenuItem submenu. |
|
3873 selector := aMenuItem rawLabel. |
|
3874 ] ifFalse:[ |
|
3875 selector := submenu := nil. |
|
3876 ]. |
|
3877 self menu:submenu labeled:selector. |
|
3878 ! |
|
3879 |
|
3880 rawLabel:aValue |
|
3881 "set the label assigned to the item |
|
3882 " |
|
3883 |value| |
|
3884 |
|
3885 aValue isString ifTrue:[ |
|
3886 value := aValue withoutSeparators. |
|
3887 |
|
3888 (value notEmpty and:[value first isLetter]) ifTrue:[ |
|
3889 menuItem rawLabel:(value asSymbol) |
|
3890 ]. |
|
3891 ]. |
|
3892 ! |
|
3893 |
|
3894 slices |
|
3895 ^ #( |
|
3896 (Basics basicsEditSpec) |
|
3897 ) |
|
3898 ! ! |
|
3899 |
|
3900 !MenuEditor::ItemRoot methodsFor:'adding & removing'! |
|
3901 |
|
3902 remove |
|
3903 "cannot remove the root item; delete all my children |
|
3904 " |
|
3905 self removeAll. |
|
3906 ! ! |
|
3907 |
|
3908 !MenuEditor::ItemRoot methodsFor:'aspects'! |
|
3909 |
|
3910 aspectAt:aKey put:aValue |
|
3911 "discard all other than the rawLabel |
|
3912 " |
|
3913 aKey == #rawLabel ifTrue:[ self rawLabel:aValue ]. |
|
3914 ! ! |
|
3915 |
|
3916 !MenuEditor::ItemRoot methodsFor:'displaying'! |
|
3917 |
|
3918 heightOn:aGC |
|
3919 height ifNil:[ height := aGC font heightOn:aGC device ]. |
|
3920 ^ height |
|
3921 ! ! |
|
3922 |
|
3923 !MenuEditor::ItemRoot methodsFor:'initialization'! |
|
3924 |
|
3925 initialize |
|
3926 super initialize. |
|
3927 isExpanded := true. |
|
3928 ! ! |
|
3929 |
|
3930 !MenuEditor::ItemRoot methodsFor:'queries'! |
|
3931 |
|
3932 canCollapse |
|
3933 ^ false |
|
3934 ! |
|
3935 |
|
3936 hasIndicator |
|
3937 ^ false |
|
3938 ! |
|
3939 |
|
3940 isDelayedMenu |
|
3941 ^ false |
|
3942 ! |
|
3943 |
|
3944 isRootItem |
|
3945 ^ true |
|
3946 ! ! |
|
3947 |
|
3948 !MenuEditor::ItemRoot methodsFor:'queries - operation'! |
|
3949 |
|
3950 canMoveInAbove |
|
3951 ^ false |
|
3952 ! |
|
3953 |
|
3954 canMoveInNext |
|
3955 ^ false |
|
3956 ! |
|
3957 |
|
3958 canMoveOut |
|
3959 ^ false |
|
3960 ! |
|
3961 |
|
3962 canMoveUpOrDown |
|
3963 ^ false |
|
3964 ! ! |
|
3965 |
|
3966 !MenuEditor::ItemSeparator class methodsFor:'interface - editor'! |
|
3967 |
|
3968 addBindingsTo:aspects for:aMenuEditor |
|
3969 "add additional bindings to the aspects |
|
3970 " |
|
3971 |holder| |
|
3972 |
|
3973 aspects at:#seperatorList ifAbsentPut:[ |
|
3974 self separatorSlices collect:[:el| el last ] |
|
3975 ]. |
|
3976 |
|
3977 aspects at:#seperatorSelection ifAbsentPut:[ |
|
3978 holder := 0 asValue. |
|
3979 holder addDependent:aMenuEditor. |
|
3980 holder |
|
3981 ]. |
|
3982 ! |
|
3983 |
|
3984 defaultLabel |
|
3985 ^ '-' |
|
3986 ! |
|
3987 |
|
3988 separatorSlices |
|
3989 "get the list of menu spec values of the corresponding separator types |
|
3990 " |
|
3991 ^ #( |
|
3992 ( #blank '' 'blank' ) |
|
3993 ( #single '-' 'single line') |
|
3994 ( #double '=' 'double line') |
|
3995 ) |
|
3996 ! ! |
|
3997 |
|
3998 !MenuEditor::ItemSeparator class methodsFor:'interface - specs'! |
|
3999 |
|
4000 basicsEditSpec |
1053 "This resource specification was automatically generated |
4001 "This resource specification was automatically generated |
1054 by the UIPainter of ST/X." |
4002 by the UIPainter of ST/X." |
1055 |
4003 |
1056 "Do not manually edit this!! If it is corrupted, |
4004 "Do not manually edit this!! If it is corrupted, |
1057 the UIPainter may not be able to read the specification." |
4005 the UIPainter may not be able to read the specification." |
1058 |
4006 |
1059 " |
4007 " |
1060 UIPainter new openOnClass:MenuEditor andSelector:#detailsEditSpec |
4008 UIPainter new openOnClass:MenuEditor::ItemSeparator andSelector:#basicsEditSpec |
1061 MenuEditor new openInterface:#detailsEditSpec |
|
1062 " |
4009 " |
1063 |
4010 |
1064 <resource: #canvas> |
4011 <resource: #canvas> |
1065 |
4012 |
1066 ^ |
4013 ^ |
1067 #(#FullSpec |
4014 #(#FullSpec |
1068 #name: #detailsEditSpec |
4015 #name: #basicsEditSpec |
1069 #window: |
4016 #window: |
1070 #(#WindowSpec |
4017 #(#WindowSpec |
1071 #label: 'Details Edit' |
4018 #label: 'basicsEditSpec' |
1072 #name: 'Details Edit' |
4019 #name: 'basicsEditSpec' |
1073 #min: #(#Point 10 10) |
4020 #min: #(#Point 10 10) |
1074 #max: #(#Point 1280 1024) |
4021 #max: #(#Point 1160 870) |
1075 #bounds: #(#Rectangle 12 22 327 306) |
4022 #bounds: #(#Rectangle 160 398 420 643) |
1076 ) |
4023 ) |
1077 #component: |
4024 #component: |
1078 #(#SpecCollection |
4025 #(#SpecCollection |
1079 #collection: #( |
4026 #collection: #( |
1080 #(#LabelSpec |
4027 #(#LabelSpec |
1081 #label: 'Accelerator:' |
4028 #label: 'Separator:' |
1082 #name: 'shortcutKeyLabel' |
4029 #name: 'separatorLabel' |
1083 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
4030 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
1084 #activeHelpKey: #detailsAccelerator |
4031 #resizeForLabel: true |
1085 #resizeForLabel: true |
4032 #adjust: #right |
1086 #adjust: #right |
4033 ) |
1087 ) |
4034 #(#ComboListSpec |
1088 #(#InputFieldSpec |
4035 #name: 'seperatorList' |
1089 #name: 'shortcutKeyField' |
4036 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
1090 #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
4037 #activeHelpKey: #basicsSeparatorType |
1091 #activeHelpKey: #detailsAccelerator |
4038 #tabable: true |
1092 #tabable: true |
4039 #model: #seperatorSelection |
1093 #model: #shortcutKey |
4040 #comboList: #seperatorList |
1094 #group: #inputGroup4 |
4041 #useIndex: true |
1095 #type: #symbolOrNil |
4042 ) |
1096 #acceptOnReturn: true |
4043 #(#LabelSpec |
1097 #acceptOnTab: true |
4044 #label: 'Visibility:' |
1098 #acceptChannel: #acceptChannel |
4045 #name: 'visibilityLabel' |
1099 #modifiedChannel: #modifiedChannel |
4046 #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
1100 #acceptOnPointerLeave: false |
4047 #resizeForLabel: true |
1101 ) |
4048 #adjust: #right |
1102 #(#LabelSpec |
4049 ) |
1103 #label: 'Enabled:' |
4050 #(#InputFieldSpec |
1104 #name: 'enabledLabel' |
4051 #name: 'visibilityInputField' |
1105 #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
4052 #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
1106 #activeHelpKey: #detailsEnabled |
4053 #activeHelpKey: #detailsVisibility |
1107 #resizeForLabel: true |
4054 #tabable: true |
1108 #adjust: #right |
4055 #model: #isVisible |
1109 ) |
4056 #group: #inputGroup |
1110 #(#InputFieldSpec |
4057 #type: #symbolOrNil |
1111 #name: 'enabledField' |
4058 #immediateAccept: false |
1112 #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
4059 #acceptOnReturn: true |
1113 #activeHelpKey: #detailsEnabled |
4060 #acceptOnTab: true |
1114 #tabable: true |
4061 #acceptChannel: #acceptChannel |
1115 #model: #enabled |
4062 #modifiedChannel: #modifiedChannel |
1116 #group: #inputGroup4 |
4063 #acceptOnPointerLeave: false |
1117 #type: #symbolOrNil |
4064 ) |
1118 #acceptOnReturn: true |
4065 #(#LabelSpec |
1119 #acceptOnTab: true |
4066 #label: 'Start Group:' |
1120 #acceptChannel: #acceptChannel |
4067 #name: 'startGroupLabel' |
1121 #modifiedChannel: #modifiedChannel |
4068 #layout: #(#AlignmentOrigin 107 0 88 0 1 0.5) |
1122 #acceptOnPointerLeave: false |
4069 #resizeForLabel: true |
1123 ) |
4070 #adjust: #right |
1124 #(#LabelSpec |
4071 ) |
1125 #label: 'Visibility:' |
4072 #(#PopUpListSpec |
1126 #name: 'visibilityLabel' |
4073 #label: 'left' |
1127 #layout: #(#AlignmentOrigin 107 0 76 0 1 0.5) |
4074 #name: 'startGroupPopUp' |
1128 #activeHelpKey: #detailsVisibility |
4075 #layout: #(#LayoutFrame 110 0 77 0 -5 1.0 99 0) |
1129 #resizeForLabel: true |
4076 #activeHelpKey: #detailsStartGroup |
1130 #adjust: #right |
4077 #tabable: true |
1131 ) |
4078 #model: #startGroup |
1132 #(#InputFieldSpec |
4079 #menu: |
1133 #name: 'isVisibleInputField' |
4080 #(#left |
1134 #layout: #(#LayoutFrame 110 0 65 0 -5 1.0 87 0) |
4081 #right |
1135 #activeHelpKey: #detailsVisibility |
4082 ) |
1136 #tabable: true |
4083 ) |
1137 #model: #isVisible |
4084 ) |
1138 #group: #inputGroup4 |
|
1139 #type: #symbolOrNil |
|
1140 #acceptOnReturn: true |
|
1141 #acceptOnTab: true |
|
1142 #acceptChannel: #acceptChannel |
|
1143 #modifiedChannel: #modifiedChannel |
|
1144 #acceptOnPointerLeave: false |
|
1145 ) |
|
1146 #(#LabelSpec |
|
1147 #label: 'Aux Value' |
|
1148 #name: 'auxLabel' |
|
1149 #layout: #(#AlignmentOrigin 107 0 101 0 1 0.5) |
|
1150 #activeHelpKey: #detailsAuxValue |
|
1151 #translateLabel: true |
|
1152 #resizeForLabel: true |
|
1153 #adjust: #right |
|
1154 ) |
|
1155 #(#InputFieldSpec |
|
1156 #name: 'auxInputField' |
|
1157 #layout: #(#LayoutFrame 110 0 90 0 -5 1.0 112 0) |
|
1158 #activeHelpKey: #detailsAuxValue |
|
1159 #tabable: true |
|
1160 #model: #auxValue |
|
1161 #group: #inputGroup4 |
|
1162 #type: #smalltalkObject |
|
1163 #acceptOnReturn: true |
|
1164 #acceptOnTab: true |
|
1165 #acceptChannel: #acceptChannel |
|
1166 #modifiedChannel: #modifiedChannel |
|
1167 #acceptOnPointerLeave: false |
|
1168 ) |
|
1169 #(#LabelSpec |
|
1170 #label: 'Start Group:' |
|
1171 #name: 'StartGroupLabel' |
|
1172 #layout: #(#AlignmentOrigin 107 0 139 0 1 0.5) |
|
1173 #activeHelpKey: #detailsStartGroup |
|
1174 #resizeForLabel: true |
|
1175 #adjust: #right |
|
1176 ) |
|
1177 #(#PopUpListSpec |
|
1178 #label: 'left' |
|
1179 #name: 'StartGroupPopUp' |
|
1180 #layout: #(#LayoutFrame 110 0 128 0 -5 1.0 150 0) |
|
1181 #activeHelpKey: #detailsStartGroup |
|
1182 #tabable: true |
|
1183 #model: #startGroup |
|
1184 #menu: |
|
1185 #(#left |
|
1186 #right |
|
1187 ) |
|
1188 #useIndex: false |
|
1189 ) |
|
1190 #(#LabelSpec |
|
1191 #label: 'Access Character Position:' |
|
1192 #name: 'accessCharLabel' |
|
1193 #layout: #(#AlignmentOrigin 217 0 170 0 1 0.5) |
|
1194 #activeHelpKey: #detailsAccessCharaterPosition |
|
1195 #resizeForLabel: true |
|
1196 #adjust: #right |
|
1197 ) |
|
1198 #(#InputFieldSpec |
|
1199 #name: 'accessCharField' |
|
1200 #layout: #(#LayoutFrame 220 0 159 0 -5 1.0 181 0) |
|
1201 #activeHelpKey: #detailsAccessCharaterPosition |
|
1202 #tabable: true |
|
1203 #model: #accessCharacterPos |
|
1204 #group: #inputGroup4 |
|
1205 #type: #numberOrNil |
|
1206 #immediateAccept: false |
|
1207 #acceptOnReturn: true |
|
1208 #acceptOnTab: true |
|
1209 #acceptChannel: #acceptChannel |
|
1210 #modifiedChannel: #modifiedChannel |
|
1211 #acceptOnPointerLeave: false |
|
1212 ) |
|
1213 #(#LabelSpec |
|
1214 #label: 'Font:' |
|
1215 #name: 'fontLabel' |
|
1216 #layout: #(#AlignmentOrigin 75 0 231 0 1 0.5) |
|
1217 #resizeForLabel: true |
|
1218 #adjust: #right |
|
1219 ) |
|
1220 #(#FontMenuSpec |
|
1221 #attributes: |
|
1222 #(#tabable |
|
1223 true |
|
1224 ) |
|
1225 #name: 'fontMenu' |
|
1226 #layout: #(#LayoutFrame 78 0 220 0 -5 1.0 242 0) |
|
1227 #activeHelpKey: #fontMenu |
|
1228 #model: #font |
|
1229 ) |
|
1230 ) |
|
1231 |
4085 |
1232 ) |
4086 ) |
1233 ) |
4087 ) |
1234 ! |
4088 ! ! |
1235 |
4089 |
1236 imageEditSpec |
4090 !MenuEditor::ItemSeparator methodsFor:'accessing'! |
1237 "This resource specification was automatically generated |
4091 |
1238 by the UIPainter of ST/X." |
4092 icon |
1239 |
4093 ^ self class iconSeparator |
1240 "Do not manually edit this!! If it is corrupted, |
4094 ! |
1241 the UIPainter may not be able to read the specification." |
4095 |
1242 |
4096 rawLabel:aValue |
1243 " |
4097 |value| |
1244 UIPainter new openOnClass:MenuEditor andSelector:#imageEditSpec |
4098 |
1245 MenuEditor new openInterface:#imageEditSpec |
4099 aValue isString ifTrue:[ |
1246 " |
4100 value := aValue withoutSeparators. |
1247 |
4101 |
1248 <resource: #canvas> |
4102 (self class separatorTypeOf:value) ifNotNil:[ |
1249 |
4103 menuItem rawLabel:value |
1250 ^ |
4104 ] |
1251 #(#FullSpec |
4105 ]. |
1252 #name: #imageEditSpec |
4106 ! |
1253 #window: |
4107 |
1254 #(#WindowSpec |
4108 separatorType |
1255 #label: 'Image Item' |
4109 ^ self class separatorTypeOf:(menuItem rawLabel). |
1256 #name: 'Image Item' |
4110 ! |
1257 #min: #(#Point 10 10) |
4111 |
1258 #max: #(#Point 1280 1024) |
4112 slices |
1259 #bounds: #(#Rectangle 12 22 300 317) |
4113 ^ #( |
1260 ) |
4114 (Basics basicsEditSpec) |
1261 #component: |
4115 ) |
1262 #(#SpecCollection |
4116 ! ! |
1263 #collection: #( |
4117 |
1264 #(#LabelSpec |
4118 !MenuEditor::ItemSeparator methodsFor:'aspects'! |
1265 #label: 'Retriever:' |
4119 |
1266 #name: 'retrieverLabel' |
4120 fromAspects:aspects |
1267 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
4121 "put my values into the values of aspects |
1268 #activeHelpKey: #imageRetriever |
4122 " |
1269 #resizeForLabel: true |
4123 |index slice| |
1270 #adjust: #right |
4124 |
1271 ) |
4125 index := (aspects at:#seperatorSelection) value ? 0. |
1272 #(#ComboBoxSpec |
4126 slice := self class separatorSlices at:index ifAbsent:nil. |
1273 #name: 'retrieverField' |
4127 |
1274 #layout: #(#LayoutFrame 110 0 15 0 -20 1.0 37 0) |
4128 slice ifNotNil:[ slice := slice at:2 ]. |
1275 #activeHelpKey: #imageRetriever |
4129 |
1276 #tabable: true |
4130 (aspects at:#rawLabel) value:slice. |
1277 #model: #retriever |
4131 ^ super fromAspects:aspects. |
1278 #type: #symbolOrNil |
4132 ! |
1279 #acceptOnReturn: true |
4133 |
1280 #acceptOnTab: true |
4134 toAspects:aspects |
1281 #acceptChannel: #acceptChannel |
4135 "put my values into the values of aspects |
1282 #acceptOnPointerLeave: false |
4136 " |
1283 #comboList: #retrieverClassList |
4137 |index type| |
1284 ) |
4138 |
1285 #(#LabelSpec |
4139 type := self separatorType. |
1286 #label: 'Selector:' |
4140 index := self class separatorSlices findFirst:[:el| el first == type ]. |
1287 #name: 'iconLabel' |
4141 |
1288 #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
4142 (aspects at:#seperatorSelection) value:index. |
1289 #activeHelpKey: #imageSelector |
4143 ^ super toAspects:aspects. |
1290 #resizeForLabel: true |
4144 ! ! |
1291 #adjust: #right |
4145 |
1292 ) |
4146 !MenuEditor::ItemSeparator methodsFor:'displaying'! |
1293 #(#InputFieldSpec |
4147 |
1294 #name: 'iconField' |
4148 displayOn:aGC x:x y:y h:h |
1295 #layout: #(#LayoutFrame 110 0 40 0 -42 1.0 62 0) |
4149 "draw the receiver in the graphicsContext, aGC. |
1296 #activeHelpKey: #imageSelector |
4150 " |
1297 #tabable: true |
4151 |x1 y0 type| |
1298 #model: #icon |
4152 |
1299 #group: #inputGroup5 |
4153 type := self separatorType. |
1300 #type: #symbolOrNil |
4154 type == #blank ifTrue:[ ^ self ]. |
1301 #acceptOnReturn: true |
4155 |
1302 #acceptOnTab: true |
4156 x1 := x + (self widthOn:aGC). |
1303 #acceptChannel: #acceptChannel |
4157 y0 := y + (h // 2) - 1. |
1304 #modifiedChannel: #modifiedChannel |
4158 |
1305 #acceptOnPointerLeave: false |
4159 type == #double ifTrue:[ |
1306 ) |
4160 y0 := y0 + 1. |
1307 #(#ActionButtonSpec |
4161 aGC displayLineFromX:x y:y0 toX:x1 y:y0. |
1308 #label: '...' |
4162 y0 := y0 - 2 |
1309 #name: 'browseButton' |
4163 ]. |
1310 #layout: #(#LayoutFrame -40 1 40 0 -20 1 62 0) |
4164 aGC displayLineFromX:x y:y0 toX:x1 y:y0 |
1311 #activeHelpKey: #browseResource |
4165 ! |
1312 #tabable: true |
4166 |
1313 #model: #doBrowseForImageResource |
4167 widthOn:aGC |
1314 ) |
4168 width ifNil:[ width := 60 ]. |
1315 #(#SelectionInListModelViewSpec |
4169 ^ width |
1316 #name: 'selectionOfImage' |
4170 ! ! |
1317 #layout: #(#LayoutFrame 20 0.0 67 0 -20 1.0 -30 1.0) |
4171 |
1318 #activeHelpKey: #imageImageList |
4172 !MenuEditor::ResourceEditor class methodsFor:'interface specs'! |
1319 #tabable: true |
|
1320 #model: #selectionOfImage |
|
1321 #menu: #menuEditImage |
|
1322 #hasHorizontalScrollBar: true |
|
1323 #hasVerticalScrollBar: true |
|
1324 #miniScrollerHorizontal: true |
|
1325 #listModel: #listOfImages |
|
1326 #useIndex: false |
|
1327 #highlightMode: #line |
|
1328 #doubleClickSelector: #doEditImage |
|
1329 #valueChangeSelector: #imageSelected |
|
1330 ) |
|
1331 #(#ViewSpec |
|
1332 #name: 'Box1' |
|
1333 #layout: #(#LayoutFrame 20 0.0 -30 1.0 -20 1.0 0 1.0) |
|
1334 #level: 0 |
|
1335 #component: |
|
1336 #(#SpecCollection |
|
1337 #collection: #( |
|
1338 #(#CheckBoxSpec |
|
1339 #label: 'Image & Label' |
|
1340 #name: 'iconAndLabelCheckBox' |
|
1341 #layout: #(#AlignmentOrigin 0 0 0 0.5 0 0.5) |
|
1342 #activeHelpKey: #imageImageAndLabel |
|
1343 #tabable: true |
|
1344 #model: #iconAndLabel |
|
1345 ) |
|
1346 #(#ActionButtonSpec |
|
1347 #label: 'Image Editor' |
|
1348 #name: 'imageEditorButton' |
|
1349 #layout: #(#AlignmentOrigin 0 1.0 0 0.5 1 0.5) |
|
1350 #activeHelpKey: #imageImageEditor |
|
1351 #tabable: true |
|
1352 #model: #doEditImage |
|
1353 ) |
|
1354 ) |
|
1355 |
|
1356 ) |
|
1357 ) |
|
1358 ) |
|
1359 |
|
1360 ) |
|
1361 ) |
|
1362 ! |
|
1363 |
4173 |
1364 windowSpec |
4174 windowSpec |
1365 "This resource specification was automatically generated |
4175 "This resource specification was automatically generated |
1366 by the UIPainter of ST/X." |
4176 by the UIPainter of ST/X." |
1367 |
4177 |
1368 "Do not manually edit this!! If it is corrupted, |
4178 "Do not manually edit this!! If it is corrupted, |
1369 the UIPainter may not be able to read the specification." |
4179 the UIPainter may not be able to read the specification." |
1370 |
4180 |
1371 " |
4181 " |
1372 UIPainter new openOnClass:MenuEditor andSelector:#windowSpec |
4182 UIPainter new openOnClass:MenuEditor::ResourceEditor andSelector:#windowSpec |
1373 MenuEditor new openInterface:#windowSpec |
4183 MenuEditor::ResourceEditor new openInterface:#windowSpec |
1374 MenuEditor open |
4184 MenuEditor::ResourceEditor open |
1375 " |
4185 " |
1376 |
4186 |
1377 <resource: #canvas> |
4187 <resource: #canvas> |
1378 |
4188 |
1379 ^ |
4189 ^ |
1380 #(#FullSpec |
4190 #(#FullSpec |
1381 #name: #windowSpec |
4191 #name: #windowSpec |
1382 #window: |
4192 #window: |
1383 #(#WindowSpec |
4193 #(#WindowSpec |
1384 #label: 'Menu Editor' |
4194 #label: 'Image Item' |
1385 #name: 'Menu Editor' |
4195 #name: 'Image Item' |
1386 #min: #(#Point 550 440) |
4196 #min: #(#Point 10 10) |
1387 #max: #(#Point 1152 900) |
4197 #max: #(#Point 1280 1024) |
1388 #bounds: #(#Rectangle 61 493 618 974) |
4198 #bounds: #(#Rectangle 333 290 621 585) |
1389 #menu: #menu |
4199 ) |
1390 #returnIsOKInDialog: false |
4200 #component: |
1391 #escapeIsCancelInDialog: false |
|
1392 ) |
|
1393 #component: |
|
1394 #(#SpecCollection |
4201 #(#SpecCollection |
1395 #collection: #( |
4202 #collection: #( |
1396 #(#MenuPanelSpec |
4203 #(#LabelSpec |
1397 #name: 'menuToolbarView' |
4204 #label: 'Retriever:' |
1398 #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
4205 #name: 'retrieverLabel' |
1399 #tabable: true |
4206 #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
1400 #menu: #menuToolbar |
4207 #activeHelpKey: #imageRetriever |
1401 #showSeparatingLines: true |
4208 #resizeForLabel: true |
1402 ) |
4209 #adjust: #right |
1403 #(#VariableHorizontalPanelSpec |
4210 ) |
1404 #name: 'VariableHorizontalPanel' |
4211 #(#ComboBoxSpec |
1405 #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) |
4212 #name: 'retrieverHolder' |
1406 #component: |
4213 #layout: #(#LayoutFrame 110 0 15 0 -20 1.0 37 0) |
1407 #(#SpecCollection |
4214 #activeHelpKey: #imageRetriever |
1408 #collection: #( |
4215 #tabable: true |
1409 #(#ArbitraryComponentSpec |
4216 #model: #retrieverHolder |
1410 #name: 'TreeView' |
4217 #type: #symbolOrNil |
1411 #menu: #menuEdit |
4218 #immediateAccept: true |
1412 #hasHorizontalScrollBar: true |
4219 #acceptOnReturn: false |
1413 #hasVerticalScrollBar: true |
4220 #acceptOnTab: false |
1414 #hasBorder: false |
4221 #acceptOnPointerLeave: false |
1415 #component: #treeView |
4222 #comboList: #retrieverList |
1416 ) |
4223 #isFilenameBox: false |
1417 #(#ViewSpec |
4224 ) |
1418 #name: 'Box' |
4225 #(#LabelSpec |
1419 #level: -1 |
4226 #label: 'Selector:' |
1420 #component: |
4227 #name: 'iconLabel' |
1421 #(#SpecCollection |
4228 #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
1422 #collection: #( |
4229 #activeHelpKey: #imageSelector |
1423 #(#NoteBookViewSpec |
4230 #resizeForLabel: true |
1424 #name: 'NoteBook' |
4231 #adjust: #right |
1425 #layout: #(#LayoutFrame 1 0.0 0 0.0 1 1.0 -30 1.0) |
4232 ) |
1426 #enableChannel: #hasAnySingleSelection |
4233 #(#InputFieldSpec |
1427 #tabable: true |
4234 #name: 'selectorHolder' |
1428 #model: #tabModel |
4235 #layout: #(#LayoutFrame 110 0 40 0 -42 1.0 62 0) |
1429 #menu: #tabList |
4236 #activeHelpKey: #imageSelector |
1430 #useIndex: true |
4237 #tabable: true |
1431 #canvas: #tabCanvasHolder |
4238 #model: #selectorHolder |
1432 #keepCanvasAlive: true |
4239 #group: #inputGroup |
1433 ) |
4240 #type: #symbolOrNil |
1434 #(#UISubSpecification |
4241 #immediateAccept: true |
1435 #name: 'SubSpecification' |
4242 #acceptOnReturn: false |
1436 #layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1.0) |
4243 #acceptOnTab: false |
1437 #majorKey: #ToolApplicationModel |
4244 #modifiedChannel: #modifiedChannel |
1438 #minorKey: #windowSpecForCommit |
4245 #acceptOnPointerLeave: false |
1439 ) |
4246 ) |
1440 ) |
4247 #(#ActionButtonSpec |
1441 |
4248 #label: '...' |
1442 ) |
4249 #name: 'browseButton' |
1443 ) |
4250 #layout: #(#LayoutFrame -40 1 40 0 -20 1 62 0) |
1444 ) |
4251 #activeHelpKey: #browseResource |
|
4252 #tabable: true |
|
4253 #model: #doBrowseForImageResource |
|
4254 ) |
|
4255 #(#HierarchicalListViewSpec |
|
4256 #name: 'imageList' |
|
4257 #layout: #(#LayoutFrame 20 0.0 67 0 -20 1.0 -30 1.0) |
|
4258 #activeHelpKey: #imageImageList |
|
4259 #model: #imageHolder |
|
4260 #menu: #menuEditImage |
|
4261 #hasHorizontalScrollBar: true |
|
4262 #hasVerticalScrollBar: true |
|
4263 #miniScrollerHorizontal: true |
|
4264 #listModel: #imageList |
|
4265 #useIndex: false |
|
4266 #highlightMode: #label |
|
4267 #postBuildCallback: #postBuildImageViewer: |
|
4268 ) |
|
4269 #(#ViewSpec |
|
4270 #name: 'Box1' |
|
4271 #layout: #(#LayoutFrame 20 0.0 -30 1.0 -20 1.0 0 1.0) |
|
4272 #level: 0 |
|
4273 #component: |
|
4274 #(#SpecCollection |
|
4275 #collection: #( |
|
4276 #(#CheckBoxSpec |
|
4277 #label: 'Image & Label' |
|
4278 #name: 'iconAndLabelCheckBox' |
|
4279 #layout: #(#AlignmentOrigin 0 0 0 0.5 0 0.5) |
|
4280 #activeHelpKey: #imageImageAndLabel |
|
4281 #tabable: true |
|
4282 #model: #iconAndLabelHolder |
|
4283 ) |
|
4284 #(#ActionButtonSpec |
|
4285 #label: 'Image Editor' |
|
4286 #name: 'imageEditorButton' |
|
4287 #layout: #(#AlignmentOrigin 0 1.0 0 0.5 1 0.5) |
|
4288 #activeHelpKey: #imageImageEditor |
|
4289 #tabable: true |
|
4290 #model: #doEditImage |
|
4291 ) |
|
4292 ) |
1445 |
4293 |
1446 ) |
4294 ) |
1447 #handles: #(#Any 0.346499 1.0) |
4295 ) |
1448 ) |
4296 ) |
1449 #(#UISubSpecification |
|
1450 #name: 'InfoBarSubSpec' |
|
1451 #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
|
1452 #majorKey: #ToolApplicationModel |
|
1453 #minorKey: #windowSpecForInfoBar |
|
1454 ) |
|
1455 ) |
|
1456 |
4297 |
1457 ) |
4298 ) |
1458 ) |
4299 ) |
1459 ! ! |
4300 ! ! |
1460 |
4301 |
1461 !MenuEditor class methodsFor:'menu specs'! |
4302 !MenuEditor::ResourceEditor methodsFor:'accessing'! |
1462 |
4303 |
1463 menu |
4304 resourceRetriever |
1464 "This resource specification was automatically generated |
4305 |rcv sel cls| |
1465 by the MenuEditor of ST/X." |
4306 |
1466 |
4307 sel := selectorHolder value. |
1467 "Do not manually edit this!! If it is corrupted, |
4308 sel size == 0 ifTrue:[ ^ nil ]. |
1468 the MenuEditor may not be able to read the specification." |
4309 cls := self retrieverClass. |
1469 |
4310 cls ifNotNil:[ cls := cls name asSymbol ]. |
1470 " |
4311 |
1471 MenuEditor new openOnClass:MenuEditor andSelector:#menu |
4312 rcv := ResourceRetriever new. |
1472 (Menu new fromLiteralArrayEncoding:(MenuEditor menu)) startUp |
4313 rcv className:cls. |
1473 " |
4314 rcv selector:sel. |
1474 |
4315 |
1475 <resource: #menu> |
4316 iconAndLabelHolder value ifTrue:[ rcv labelText:'' ]. |
1476 |
4317 ^ rcv |
1477 ^ |
4318 ! |
1478 #(#Menu |
4319 |
1479 #( |
4320 resourceRetriever:aResourceRetriever |
1480 #(#MenuItem |
4321 |cls sel isOn| |
1481 #label: '&File' |
4322 |
1482 #translateLabel: true |
4323 aResourceRetriever notNil ifTrue:[ |
1483 #activeHelpKey: #file |
4324 cls := aResourceRetriever className. |
1484 #submenu: |
4325 cls ifNotNil:[ |
1485 #(#Menu |
4326 cls isBehavior ifTrue:[cls := cls name asSymbol]. |
1486 #( |
4327 ]. |
1487 #(#MenuItem |
4328 sel := aResourceRetriever selector. |
1488 #label: 'New' |
4329 isOn := aResourceRetriever labelText notNil. |
1489 #translateLabel: true |
|
1490 #value: #doNew |
|
1491 #activeHelpKey: #fileNew |
|
1492 ) |
|
1493 #(#MenuItem |
|
1494 #label: '-' |
|
1495 ) |
|
1496 #(#MenuItem |
|
1497 #label: 'Load...' |
|
1498 #translateLabel: true |
|
1499 #value: #doLoad |
|
1500 #activeHelpKey: #fileLoad |
|
1501 ) |
|
1502 #(#MenuItem |
|
1503 #label: '-' |
|
1504 ) |
|
1505 #(#MenuItem |
|
1506 #label: 'Save' |
|
1507 #translateLabel: true |
|
1508 #value: #doSave |
|
1509 #activeHelpKey: #fileSave |
|
1510 ) |
|
1511 #(#MenuItem |
|
1512 #label: 'Save As...' |
|
1513 #translateLabel: true |
|
1514 #value: #doSaveAs |
|
1515 #activeHelpKey: #fileSaveAs |
|
1516 ) |
|
1517 #(#MenuItem |
|
1518 #label: '-' |
|
1519 ) |
|
1520 #(#MenuItem |
|
1521 #label: 'Pick a Menu...' |
|
1522 #translateLabel: true |
|
1523 #value: #doPickAMenu |
|
1524 #activeHelpKey: #filePickAMenu |
|
1525 ) |
|
1526 #(#MenuItem |
|
1527 #label: '-' |
|
1528 ) |
|
1529 #(#MenuItem |
|
1530 #label: 'Browse Class' |
|
1531 #translateLabel: true |
|
1532 #value: #doBrowseClass |
|
1533 #activeHelpKey: #fileBrowseClass |
|
1534 ) |
|
1535 #(#MenuItem |
|
1536 #label: '-' |
|
1537 ) |
|
1538 #(#MenuItem |
|
1539 #label: 'Exit' |
|
1540 #translateLabel: true |
|
1541 #value: #closeRequest |
|
1542 #activeHelpKey: #fileExit |
|
1543 ) |
|
1544 ) |
|
1545 nil |
|
1546 nil |
|
1547 ) |
|
1548 ) |
|
1549 #(#MenuItem |
|
1550 #label: 'Edit' |
|
1551 #translateLabel: true |
|
1552 #activeHelpKey: #edit |
|
1553 #submenuChannel: #menuEdit |
|
1554 ) |
|
1555 #(#MenuItem |
|
1556 #label: 'Add' |
|
1557 #translateLabel: true |
|
1558 #activeHelpKey: #add |
|
1559 #submenuChannel: #menuAdd |
|
1560 ) |
|
1561 #(#MenuItem |
|
1562 #label: 'Test' |
|
1563 #translateLabel: true |
|
1564 #activeHelpKey: #test |
|
1565 #submenuChannel: #submenuTest |
|
1566 ) |
|
1567 #(#MenuItem |
|
1568 #label: 'History' |
|
1569 #translateLabel: true |
|
1570 #activeHelpKey: #history |
|
1571 #submenuChannel: #menuHistory |
|
1572 ) |
|
1573 #(#MenuItem |
|
1574 #label: 'Help' |
|
1575 #translateLabel: true |
|
1576 #startGroup: #right |
|
1577 #submenu: |
|
1578 #(#Menu |
|
1579 #( |
|
1580 #(#MenuItem |
|
1581 #label: 'Documentation' |
|
1582 #translateLabel: true |
|
1583 #value: #openHTMLDocument: |
|
1584 #activeHelpKey: #helpTutorial |
|
1585 #argument: 'tools/uipainter/MenuEditor.html' |
|
1586 ) |
|
1587 #(#MenuItem |
|
1588 #label: '-' |
|
1589 ) |
|
1590 #(#MenuItem |
|
1591 #label: 'Help Tool' |
|
1592 #translateLabel: true |
|
1593 #value: #openHTMLDocument: |
|
1594 #activeHelpKey: #helpHelpTool |
|
1595 #argument: 'tools/uipainter/HelpTool.html' |
|
1596 ) |
|
1597 #(#MenuItem |
|
1598 #label: '-' |
|
1599 ) |
|
1600 #(#MenuItem |
|
1601 #label: 'Show Help Texts' |
|
1602 #translateLabel: true |
|
1603 #activeHelpKey: #helpShowHelp |
|
1604 #indication: #showingHelp: |
|
1605 ) |
|
1606 #(#MenuItem |
|
1607 #label: '-' |
|
1608 ) |
|
1609 #(#MenuItem |
|
1610 #label: 'About MenuEditor...' |
|
1611 #translateLabel: true |
|
1612 #value: #openAboutThisApplication |
|
1613 #activeHelpKey: #aboutThisAppliaction |
|
1614 ) |
|
1615 ) |
|
1616 nil |
|
1617 nil |
|
1618 ) |
|
1619 ) |
|
1620 ) |
|
1621 nil |
|
1622 nil |
|
1623 ) |
|
1624 ! |
|
1625 |
|
1626 menuAdd |
|
1627 "This resource specification was automatically generated |
|
1628 by the MenuEditor of ST/X." |
|
1629 |
|
1630 "Do not manually edit this!! If it is corrupted, |
|
1631 the MenuEditor may not be able to read the specification." |
|
1632 |
|
1633 " |
|
1634 MenuEditor new openOnClass:MenuEditor andSelector:#menuAdd |
|
1635 (Menu new fromLiteralArrayEncoding:(MenuEditor menuAdd)) startUp |
|
1636 " |
|
1637 |
|
1638 <resource: #menu> |
|
1639 |
|
1640 ^ |
|
1641 |
|
1642 #(#Menu |
|
1643 |
|
1644 #( |
|
1645 #(#MenuItem |
|
1646 #label: 'Menu Item' |
|
1647 #translateLabel: true |
|
1648 #value: #doCreateItem |
|
1649 #activeHelpKey: #addMenuItem |
|
1650 #labelImage: #(#ResourceRetriever #MenuEditor #menuItemImage 'Menu Item') |
|
1651 ) |
|
1652 #(#MenuItem |
|
1653 #label: 'Menu Separator' |
|
1654 #translateLabel: true |
|
1655 #value: #doCreateSep |
|
1656 #activeHelpKey: #addMenuSeparator |
|
1657 #labelImage: #(#ResourceRetriever #MenuEditor #menuSeparatorImage 'Menu Separator') |
|
1658 ) |
|
1659 #(#MenuItem |
|
1660 #label: '-' |
|
1661 ) |
|
1662 #(#MenuItem |
|
1663 #label: 'Submenu' |
|
1664 #translateLabel: true |
|
1665 #value: #doCreateMenu |
|
1666 #activeHelpKey: #addSubMenu |
|
1667 #labelImage: #(#ResourceRetriever #MenuEditor #submenuImage 'Submenu') |
|
1668 ) |
|
1669 #(#MenuItem |
|
1670 #label: 'Submenu Link' |
|
1671 #translateLabel: true |
|
1672 #value: #doCreateLink |
|
1673 #activeHelpKey: #addSubMenuLink |
|
1674 #labelImage: #(#ResourceRetriever #MenuEditor #linkSubmenuImage 'Submenu Link') |
|
1675 ) |
|
1676 #(#MenuItem |
|
1677 #label: '-' |
|
1678 ) |
|
1679 #(#MenuItem |
|
1680 #label: 'Standard Submenu' |
|
1681 #translateLabel: true |
|
1682 #submenu: |
|
1683 #(#Menu |
|
1684 |
|
1685 #( |
|
1686 #(#MenuItem |
|
1687 #label: 'Standard Menu: File' |
|
1688 #translateLabel: true |
|
1689 #value: #doCreateStandardFileMenu |
|
1690 ) |
|
1691 #(#MenuItem |
|
1692 #label: 'Standard Menu: Edit' |
|
1693 #translateLabel: true |
|
1694 #value: #doCreateStandardEditMenu |
|
1695 ) |
|
1696 #(#MenuItem |
|
1697 #label: 'Standard Menu: Help' |
|
1698 #translateLabel: true |
|
1699 #value: #doCreateStandardHelpMenu |
|
1700 ) |
|
1701 ) nil |
|
1702 nil |
|
1703 ) |
|
1704 ) |
|
1705 ) nil |
|
1706 nil |
|
1707 ) |
|
1708 |
|
1709 "Modified: / 23.8.1998 / 15:48:21 / cg" |
|
1710 ! |
|
1711 |
|
1712 menuDefaultLink |
|
1713 "This resource specification was automatically generated |
|
1714 by the MenuEditor of ST/X." |
|
1715 |
|
1716 "Do not manually edit this!! If it is corrupted, |
|
1717 the MenuEditor may not be able to read the specification." |
|
1718 |
|
1719 " |
|
1720 MenuEditor new openOnClass:MenuEditor andSelector:#menuDefaultLink |
|
1721 (Menu new fromLiteralArrayEncoding:(MenuEditor menuDefaultLink)) startUp |
|
1722 " |
|
1723 |
|
1724 <resource: #menu> |
|
1725 |
|
1726 ^ |
|
1727 |
|
1728 #(#Menu |
|
1729 |
|
1730 #( |
|
1731 #(#MenuItem |
|
1732 #'label:' '!!!! derives from application !!!!' |
|
1733 ) |
|
1734 ) nil |
|
1735 nil |
|
1736 ) |
|
1737 ! |
|
1738 |
|
1739 menuEdit |
|
1740 "This resource specification was automatically generated |
|
1741 by the MenuEditor of ST/X." |
|
1742 |
|
1743 "Do not manually edit this!! If it is corrupted, |
|
1744 the MenuEditor may not be able to read the specification." |
|
1745 |
|
1746 " |
|
1747 MenuEditor new openOnClass:MenuEditor andSelector:#menuEdit |
|
1748 (Menu new fromLiteralArrayEncoding:(MenuEditor menuEdit)) startUp |
|
1749 " |
|
1750 |
|
1751 <resource: #menu> |
|
1752 |
|
1753 ^ |
|
1754 |
|
1755 #(#Menu |
|
1756 |
|
1757 #( |
|
1758 #(#MenuItem |
|
1759 #label: 'Cut' |
|
1760 #translateLabel: true |
|
1761 #value: #doCut |
|
1762 #activeHelpKey: #editCut |
|
1763 #enabled: #hasValidSelection |
|
1764 ) |
|
1765 #(#MenuItem |
|
1766 #label: 'Copy' |
|
1767 #translateLabel: true |
|
1768 #value: #doCopy |
|
1769 #activeHelpKey: #editCopy |
|
1770 #enabled: #hasValidSelection |
|
1771 ) |
|
1772 #(#MenuItem |
|
1773 #label: 'Paste' |
|
1774 #translateLabel: true |
|
1775 #value: #doPaste |
|
1776 #activeHelpKey: #editPaste |
|
1777 #enabled: #valueOfCanPaste |
|
1778 ) |
|
1779 #(#MenuItem |
|
1780 #label: 'Delete' |
|
1781 #translateLabel: true |
|
1782 #value: #doDelete |
|
1783 #activeHelpKey: #editDelete |
|
1784 #enabled: #hasValidSelection |
|
1785 ) |
|
1786 #(#MenuItem |
|
1787 #label: '-' |
|
1788 ) |
|
1789 #(#MenuItem |
|
1790 #label: 'Move Up' |
|
1791 #translateLabel: true |
|
1792 #value: #doStepUp |
|
1793 #activeHelpKey: #editMoveUp |
|
1794 #enabled: #valueOfEnableMovingUpOrDown |
|
1795 #labelImage: #(#ResourceRetriever #Icon #upIcon 'Move Up') |
|
1796 ) |
|
1797 #(#MenuItem |
|
1798 #label: 'Move Down' |
|
1799 #translateLabel: true |
|
1800 #value: #doStepDown |
|
1801 #activeHelpKey: #editMoveDown |
|
1802 #enabled: #valueOfEnableMovingUpOrDown |
|
1803 #labelImage: #(#ResourceRetriever #Icon #downIcon 'Move Down') |
|
1804 ) |
|
1805 #(#MenuItem |
|
1806 #label: 'Move In' |
|
1807 #translateLabel: true |
|
1808 #value: #doStepIn |
|
1809 #activeHelpKey: #editMoveIn |
|
1810 #enabled: #valueOfEnableMovingIn |
|
1811 #labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Move In') |
|
1812 ) |
|
1813 #(#MenuItem |
|
1814 #label: 'Move Out' |
|
1815 #translateLabel: true |
|
1816 #value: #doStepOut |
|
1817 #activeHelpKey: #editMoveOut |
|
1818 #enabled: #valueOfEnableMovingOut |
|
1819 #labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Move Out') |
|
1820 ) |
|
1821 ) nil |
|
1822 nil |
|
1823 ) |
|
1824 ! |
|
1825 |
|
1826 menuEditImage |
|
1827 "This resource specification was automatically generated |
|
1828 by the MenuEditor of ST/X." |
|
1829 |
|
1830 "Do not manually edit this!! If it is corrupted, |
|
1831 the MenuEditor may not be able to read the specification." |
|
1832 |
|
1833 " |
|
1834 MenuEditor new openOnClass:MenuEditor andSelector:#menuEditImage |
|
1835 (Menu new fromLiteralArrayEncoding:(MenuEditor menuEditImage)) startUp |
|
1836 " |
|
1837 |
|
1838 <resource: #menu> |
|
1839 |
|
1840 ^ |
|
1841 |
|
1842 #(#Menu |
|
1843 |
|
1844 #( |
|
1845 #(#MenuItem |
|
1846 #label: 'Edit' |
|
1847 #translateLabel: true |
|
1848 #value: #doEditImage |
|
1849 #activeHelpKey: #editCut |
|
1850 #enabled: #hasValidSelection |
|
1851 ) |
|
1852 #(#MenuItem |
|
1853 #label: 'Remove' |
|
1854 #translateLabel: true |
|
1855 #value: #doRemoveImage |
|
1856 #activeHelpKey: #editCopy |
|
1857 #enabled: #hasValidSelection |
|
1858 ) |
|
1859 ) nil |
|
1860 nil |
|
1861 ) |
|
1862 ! |
|
1863 |
|
1864 menuToolbar |
|
1865 "This resource specification was automatically generated |
|
1866 by the MenuEditor of ST/X." |
|
1867 |
|
1868 "Do not manually edit this!! If it is corrupted, |
|
1869 the MenuEditor may not be able to read the specification." |
|
1870 |
|
1871 " |
|
1872 MenuEditor new openOnClass:MenuEditor andSelector:#menuToolbar |
|
1873 (Menu new fromLiteralArrayEncoding:(MenuEditor menuToolbar)) startUp |
|
1874 " |
|
1875 |
|
1876 <resource: #menu> |
|
1877 |
|
1878 ^ |
|
1879 #(#Menu |
|
1880 #( |
|
1881 #(#MenuItem |
|
1882 #label: 'New' |
|
1883 #isButton: true |
|
1884 #value: #doNew |
|
1885 #activeHelpKey: #fileNew |
|
1886 #labelImage: #(#ResourceRetriever #Icon #newIcon) |
|
1887 ) |
|
1888 #(#MenuItem |
|
1889 #label: 'Load' |
|
1890 #isButton: true |
|
1891 #value: #doLoad |
|
1892 #activeHelpKey: #fileLoad |
|
1893 #labelImage: #(#ResourceRetriever #Icon #loadIcon) |
|
1894 ) |
|
1895 #(#MenuItem |
|
1896 #label: 'Save' |
|
1897 #isButton: true |
|
1898 #value: #doSave |
|
1899 #activeHelpKey: #fileSave |
|
1900 #labelImage: #(#ResourceRetriever #Icon #saveIcon) |
|
1901 ) |
|
1902 #(#MenuItem |
|
1903 #label: '' |
|
1904 ) |
|
1905 #(#MenuItem |
|
1906 #label: 'Cut' |
|
1907 #isButton: true |
|
1908 #value: #doCut |
|
1909 #activeHelpKey: #editCut |
|
1910 #enabled: #hasValidSelection |
|
1911 #labelImage: #(#ResourceRetriever #Icon #cutIcon) |
|
1912 ) |
|
1913 #(#MenuItem |
|
1914 #label: 'Copy' |
|
1915 #isButton: true |
|
1916 #value: #doCopy |
|
1917 #activeHelpKey: #editCopy |
|
1918 #enabled: #hasValidSelection |
|
1919 #labelImage: #(#ResourceRetriever #Icon #copyIcon) |
|
1920 ) |
|
1921 #(#MenuItem |
|
1922 #label: 'Paste' |
|
1923 #isButton: true |
|
1924 #value: #doPaste |
|
1925 #activeHelpKey: #editPaste |
|
1926 #enabled: #valueOfCanPaste |
|
1927 #labelImage: #(#ResourceRetriever #Icon #pasteIcon) |
|
1928 ) |
|
1929 #(#MenuItem |
|
1930 #label: 'Delete' |
|
1931 #isButton: true |
|
1932 #value: #doDelete |
|
1933 #activeHelpKey: #editDelete |
|
1934 #enabled: #hasValidSelection |
|
1935 #labelImage: #(#ResourceRetriever #Icon #deleteIcon) |
|
1936 ) |
|
1937 #(#MenuItem |
|
1938 #label: '' |
|
1939 ) |
|
1940 #(#MenuItem |
|
1941 #label: 'Add Item' |
|
1942 #isButton: true |
|
1943 #value: #doCreateItem |
|
1944 #activeHelpKey: #addMenuItem |
|
1945 #enabled: #hasAnySingleSelection |
|
1946 #labelImage: #(#ResourceRetriever nil #menuItemImage) |
|
1947 ) |
|
1948 #(#MenuItem |
|
1949 #label: 'Add Separator' |
|
1950 #isButton: true |
|
1951 #value: #doCreateSep |
|
1952 #activeHelpKey: #addMenuSeparator |
|
1953 #enabled: #hasAnySingleSelection |
|
1954 #labelImage: #(#ResourceRetriever nil #menuSeparatorImage) |
|
1955 ) |
|
1956 #(#MenuItem |
|
1957 #label: 'Add Submenu' |
|
1958 #isButton: true |
|
1959 #value: #doCreateMenu |
|
1960 #activeHelpKey: #addSubMenu |
|
1961 #enabled: #hasAnySingleSelection |
|
1962 #labelImage: #(#ResourceRetriever nil #submenuImage) |
|
1963 ) |
|
1964 #(#MenuItem |
|
1965 #label: 'Add Linked Submenu' |
|
1966 #isButton: true |
|
1967 #value: #doCreateLink |
|
1968 #activeHelpKey: #addSubMenuLink |
|
1969 #enabled: #hasAnySingleSelection |
|
1970 #labelImage: #(#ResourceRetriever nil #linkSubmenuImage) |
|
1971 ) |
|
1972 #(#MenuItem |
|
1973 #label: '' |
|
1974 ) |
|
1975 #(#MenuItem |
|
1976 #label: 'Move Up' |
|
1977 #isButton: true |
|
1978 #value: #doStepUp |
|
1979 #activeHelpKey: #editMoveUp |
|
1980 #enabled: #valueOfEnableMovingUpOrDown |
|
1981 #labelImage: #(#ResourceRetriever #Icon #upIcon) |
|
1982 ) |
|
1983 #(#MenuItem |
|
1984 #label: 'Move Down' |
|
1985 #isButton: true |
|
1986 #value: #doStepDown |
|
1987 #activeHelpKey: #editMoveDown |
|
1988 #enabled: #valueOfEnableMovingUpOrDown |
|
1989 #labelImage: #(#ResourceRetriever #Icon #downIcon) |
|
1990 ) |
|
1991 #(#MenuItem |
|
1992 #label: 'Move In' |
|
1993 #isButton: true |
|
1994 #value: #doStepIn |
|
1995 #activeHelpKey: #editMoveIn |
|
1996 #enabled: #valueOfEnableMovingIn |
|
1997 #labelImage: #(#ResourceRetriever #Icon #downRightIcon) |
|
1998 ) |
|
1999 #(#MenuItem |
|
2000 #label: 'Move In Above' |
|
2001 #isButton: true |
|
2002 #value: #doStepInAbove |
|
2003 #activeHelpKey: #editMoveInAbove |
|
2004 #enabled: #valueOfEnableMovingInAbove |
|
2005 #labelImage: #(#ResourceRetriever #Icon #upRightIcon) |
|
2006 ) |
|
2007 #(#MenuItem |
|
2008 #label: 'Move Out' |
|
2009 #isButton: true |
|
2010 #value: #doStepOut |
|
2011 #activeHelpKey: #editMoveOut |
|
2012 #enabled: #valueOfEnableMovingOut |
|
2013 #labelImage: #(#ResourceRetriever #Icon #leftDownIcon) |
|
2014 ) |
|
2015 ) |
|
2016 nil |
|
2017 nil |
|
2018 ) |
|
2019 ! ! |
|
2020 |
|
2021 !MenuEditor class methodsFor:'queries'! |
|
2022 |
|
2023 getAllImageSelectorsFrom: aClass |
|
2024 "returns all image selectors implementing an image spec in class aClass" |
|
2025 |
|
2026 |iconClass imageMethodSelectors r| |
|
2027 |
|
2028 aClass isNil ifTrue:[ |
|
2029 ^ #() |
|
2030 ]. |
|
2031 |
|
2032 aClass isSymbol |
|
2033 ifTrue: [iconClass := Smalltalk at: aClass] |
|
2034 ifFalse: [iconClass := aClass]. |
|
2035 aClass isBehavior ifFalse:[ |
|
2036 ^ #() |
|
2037 ]. |
|
2038 |
|
2039 imageMethodSelectors := OrderedCollection new. |
|
2040 |
|
2041 iconClass withAllSuperclassesDo:[:cls | |
|
2042 cls class selectorsAndMethodsDo:[:sel :m | |
|
2043 ((r := m resourceType) == #image |
|
2044 or:[r == #programImage]) ifTrue:[ |
|
2045 imageMethodSelectors add:sel |
|
2046 ] |
|
2047 ] |
|
2048 ]. |
|
2049 |
|
2050 ^ imageMethodSelectors sort |
|
2051 |
|
2052 "Modified: / 24.8.1998 / 21:42:34 / cg" |
|
2053 "Created: / 24.8.1998 / 21:53:20 / cg" |
|
2054 ! ! |
|
2055 |
|
2056 !MenuEditor class methodsFor:'slices'! |
|
2057 |
|
2058 slicesItem |
|
2059 ^#( |
|
2060 (Basics basicsItemSpec) |
|
2061 (Details detailsEditSpec) |
|
2062 (Image imageEditSpec) |
|
2063 ) |
|
2064 |
|
2065 ! |
|
2066 |
|
2067 slicesLink |
|
2068 ^#( |
|
2069 (Basics basicsLinkSpec) |
|
2070 (Details detailsEditSpec) |
|
2071 (Image imageEditSpec) |
|
2072 ) |
|
2073 |
|
2074 ! |
|
2075 |
|
2076 slicesMenu |
|
2077 ^#( |
|
2078 (Basics basicsMenuSpec) |
|
2079 (Details detailsEditSpec) |
|
2080 (Image imageEditSpec) |
|
2081 ) |
|
2082 |
|
2083 ! |
|
2084 |
|
2085 slicesRootMenu |
|
2086 ^#( |
|
2087 (Basics basicsRootSpec) |
|
2088 ) |
|
2089 |
|
2090 ! |
|
2091 |
|
2092 slicesSeparatorMenu |
|
2093 ^#( |
|
2094 (Basics basicsSeparatorSpec) |
|
2095 ) |
|
2096 |
|
2097 ! ! |
|
2098 |
|
2099 !MenuEditor methodsFor:'accessing'! |
|
2100 |
|
2101 submenuTest |
|
2102 "return the submenu assigned to item test; |
|
2103 this is dynamically constructed, to reflect the current |
|
2104 edited menu." |
|
2105 |
|
2106 |menu cls| |
|
2107 |
|
2108 menu := treeView asMenu. |
|
2109 menu ifNotNil:[ |
|
2110 (menu := treeView asMenu) allItemsDo:[:anItem| |
|
2111 anItem value:nil. |
|
2112 anItem enabled:true. |
|
2113 ]. |
|
2114 |
|
2115 cls := self resolveName:specClass. |
|
2116 menu findGuiResourcesIn:cls. |
|
2117 menu receiver:nil. |
|
2118 ]. |
|
2119 ^ menu |
|
2120 ! |
|
2121 |
|
2122 useHelpTool: aHelpTool |
|
2123 "take the help dictionaries from aHelpTool into my helpTool" |
|
2124 |
|
2125 self helpTool buildFromClass: aHelpTool specClass. |
|
2126 self helpTool dictionaries: aHelpTool dictionaries. |
|
2127 self helpTool dictionary: aHelpTool dictionary |
|
2128 |
|
2129 |
|
2130 ! ! |
|
2131 |
|
2132 !MenuEditor methodsFor:'aspects'! |
|
2133 |
|
2134 hasAnySingleSelection |
|
2135 |
|
2136 ^builder booleanValueAspectFor: #hasAnySingleSelection |
|
2137 ! |
|
2138 |
|
2139 hasValidSelection |
|
2140 |
|
2141 ^builder booleanValueAspectFor: #hasValidSelection |
|
2142 ! |
|
2143 |
|
2144 listOfImages |
|
2145 "get a list of the images |
|
2146 " |
|
2147 |list| |
|
2148 |
|
2149 (list := builder bindingAt:#listOfImages) isNil ifTrue:[ |
|
2150 builder aspectAt:#listOfImages put: (list := List new). |
|
2151 ]. |
|
2152 ^ list |
|
2153 |
|
2154 |
|
2155 ! |
|
2156 |
|
2157 selectionOfImage |
|
2158 "get selection of list of the images as value" |
|
2159 |
|
2160 |holder| |
|
2161 (holder := builder bindingAt:#selectionOfImage) isNil ifTrue:[ |
|
2162 builder aspectAt:#selectionOfImage put: (holder := nil asValue). |
|
2163 ]. |
|
2164 ^ holder |
|
2165 |
|
2166 |
|
2167 ! |
|
2168 |
|
2169 tabCanvasHolder |
|
2170 "keep the canvas for the current selected item or nil |
|
2171 " |
|
2172 |holder| |
|
2173 |
|
2174 (holder := builder bindingAt:#tabCanvasHolder) isNil ifTrue:[ |
|
2175 builder aspectAt:#tabCanvasHolder put: (holder := ValueHolder new). |
|
2176 ]. |
|
2177 ^ holder |
|
2178 |
|
2179 |
|
2180 ! |
|
2181 |
|
2182 tabList |
|
2183 "get a value holder with the list of the attribute sections (slices)" |
|
2184 |
|
2185 |holder| |
|
2186 |
|
2187 (holder := builder bindingAt:#tabList) isNil ifTrue:[ |
|
2188 builder aspectAt:#tabList put:(holder := nil asValue). |
|
2189 ]. |
|
2190 ^ holder |
|
2191 |
|
2192 |
|
2193 ! |
|
2194 |
|
2195 treeView |
|
2196 "get a tree view representing hierarchically the menu items" |
|
2197 |
|
2198 ^ treeView |
|
2199 ! ! |
|
2200 |
|
2201 !MenuEditor methodsFor:'building'! |
|
2202 |
|
2203 buildFromClass:aClass andSelector:aSelector |
|
2204 |
|
2205 self isStandAlone ifTrue:[ |
|
2206 self helpTool buildFromClass:specClass |
|
2207 ]. |
|
2208 treeView buildFromClass: aClass andSelector: aSelector. |
|
2209 |
|
2210 self updateHistory. |
|
2211 self updateInfoLabel. |
|
2212 |
|
2213 ! |
|
2214 |
|
2215 buildFromResourceSpec:aResourceSpec |
|
2216 |spec| |
|
2217 |
|
2218 spec := aResourceSpec isCollection ifTrue:[aResourceSpec decodeAsLiteralArray] |
|
2219 ifFalse:[aResourceSpec]. |
|
2220 |
|
2221 self buildFromMenu:spec |
|
2222 ! ! |
|
2223 |
|
2224 !MenuEditor methodsFor:'change & update'! |
|
2225 |
|
2226 update:something with:aParameter from:changedObject |
|
2227 super update:something with:aParameter from:changedObject. |
|
2228 |
|
2229 changedObject == (aspects at:#retriever) ifTrue:[ |
|
2230 self updateImageView. |
|
2231 ]. |
|
2232 |
|
2233 "Modified: / 24.8.1998 / 21:47:48 / cg" |
|
2234 ! |
|
2235 |
|
2236 updateChannels |
|
2237 "update channels" |
|
2238 |
|
2239 |node parent next prev state canPaste selectedNodes firstParent |
|
2240 enableMovingOut enableMovingIn indexOfLast| |
|
2241 |
|
2242 enableMovingOut := enableMovingIn := false. |
|
2243 |
|
2244 state := false. |
|
2245 node := treeView selectedNode. |
|
2246 |
|
2247 node notNil ifTrue:[ |
|
2248 "/ single node selected |
|
2249 self hasAnySingleSelection value:true. |
|
2250 canPaste := self valueOfCanPaste value. |
|
2251 |
|
2252 (parent := node parent) notNil ifTrue:[ |
|
2253 next := parent childAt:((parent indexOfChild:node) + 1). |
|
2254 prev := parent childAt:((parent indexOfChild:node) - 1). |
|
2255 self valueOfEnableMovingIn value:(next notNil and:[next hasChildren]). |
|
2256 self valueOfEnableMovingInAbove value:(prev notNil and:[prev hasChildren]). |
|
2257 self valueOfEnableMovingUpOrDown value:(parent children size > 1). |
|
2258 self valueOfEnableMovingOut value:parent parent notNil. |
|
2259 self hasValidSelection value:true. |
|
2260 self valueOfCanPaste value:canPaste. |
|
2261 ^ self |
|
2262 ]. |
|
2263 ] ifFalse:[ |
4330 ] ifFalse:[ |
2264 "/ multiple nodes selected |
4331 cls := sel := nil. |
2265 canPaste := false. |
4332 isOn := false. |
2266 |
4333 ]. |
2267 self hasAnySingleSelection value:false. |
4334 |
2268 |
4335 retrieverHolder value:cls. |
2269 treeView numberOfSelections ~~ 0 ifTrue:[ |
4336 selectorHolder value:sel. |
2270 canPaste := false. |
4337 iconAndLabelHolder value:isOn. |
2271 state := (treeView isInSelection:1) not. |
4338 ! |
2272 |
4339 |
2273 selectedNodes := treeView selectedNodes. |
4340 retrieverClass |
2274 |
4341 |cls| |
2275 "/ see if all selected nodes have a common parent. |
4342 |
2276 firstParent := selectedNodes first parent. |
4343 cls := retrieverHolder value. |
2277 (selectedNodes conform:[:eachNode | eachNode parent == firstParent]) ifTrue:[ |
4344 |
2278 "/ yes - they have |
4345 cls size ~~ 0 ifTrue:[ |
2279 "/ next := firstParent childAt:((firstParent indexOfChild:node) + 1). |
4346 cls := Smalltalk at:cls ifAbsent:nil. |
2280 "/ self valueOfEnableMovingIn value:(next notNil and:[next hasChildren]). |
4347 |
2281 enableMovingOut := firstParent parent notNil. |
4348 (cls notNil and:[cls isBehavior]) ifTrue:[ |
2282 "/ self halt. |
4349 ^ cls |
2283 |
4350 ]. |
2284 indexOfLast := (selectedNodes collect:[:eachNode | firstParent indexOfChild:eachNode]) max. |
|
2285 next := firstParent childAt:(indexOfLast + 1). |
|
2286 enableMovingIn := (next notNil and:[next hasChildren]). |
|
2287 ] ifFalse:[ |
|
2288 "/ self halt. |
|
2289 ]. |
|
2290 ] |
|
2291 ]. |
|
2292 self valueOfEnableMovingUpOrDown value:false. |
|
2293 self valueOfEnableMovingIn value:enableMovingIn. |
|
2294 self valueOfEnableMovingOut value:enableMovingOut. |
|
2295 self hasValidSelection value:state. |
|
2296 self valueOfCanPaste value:canPaste. |
|
2297 ! |
|
2298 |
|
2299 updateImageView |
|
2300 "update the image view |
|
2301 " |
|
2302 |cls newList icon| |
|
2303 |
|
2304 self isImageViewSelected ifFalse:[ |
|
2305 ^ self |
|
2306 ]. |
|
2307 cls := self currentImageRetrieverClass. |
|
2308 |
|
2309 lastImageRetriever == cls ifTrue:[ |
|
2310 newList := self listOfImages |
|
2311 ] ifFalse:[ |
|
2312 cls notNil ifTrue:[ |
|
2313 self withWaitCursorDo:[ |
|
2314 lastImageRetriever := cls. |
|
2315 |
|
2316 newList := self class getAllImageSelectorsFrom:cls. |
|
2317 newList := newList collect: [:sel| |img| |
|
2318 img := cls perform: sel. |
|
2319 img height > 32 ifTrue:[ |
|
2320 img := img magnifiedBy: 32 / img extent y |
|
2321 ]. |
|
2322 LabelAndIcon icon:img string:sel |
|
2323 ]. |
|
2324 ]. |
|
2325 ] ifFalse:[ |
|
2326 newList := #() |
|
2327 ]. |
|
2328 self listOfImages contents:newList. |
|
2329 ]. |
|
2330 |
|
2331 icon := (aspects at:#icon) value. |
|
2332 |
|
2333 icon notNil ifTrue:[ |
|
2334 icon := newList detect:[:el| el string == icon] ifNone:nil. |
|
2335 ]. |
|
2336 self selectionOfImage value:icon. |
|
2337 ! ! |
|
2338 |
|
2339 !MenuEditor methodsFor:'defaults'! |
|
2340 |
|
2341 aboutImage |
|
2342 "the image to be displayed in my about-box; |
|
2343 If nil is returned, thhe ST/X default image is used." |
|
2344 |
|
2345 ^ Image fromFile:'bitmaps/xpmBitmaps/misc_tools/setup_menus.xpm' |
|
2346 |
|
2347 "Created: / 25.7.1998 / 20:48:12 / cg" |
|
2348 "Modified: / 27.7.1998 / 10:21:55 / cg" |
|
2349 ! ! |
|
2350 |
|
2351 !MenuEditor methodsFor:'event handling'! |
|
2352 |
|
2353 doesNotUnderstand: aMessage |
|
2354 "detour incoming messages to the tree view" |
|
2355 |
|
2356 ^ aMessage sendTo:treeView |
|
2357 ! ! |
|
2358 |
|
2359 !MenuEditor methodsFor:'private'! |
|
2360 |
|
2361 currentImageRetrieverClass |
|
2362 "returns the current class which provides the images dependent on |
|
2363 the retriver or the current spec. |
|
2364 " |
|
2365 |clsName| |
|
2366 |
|
2367 clsName := (aspects at: #retriever) value. |
|
2368 |
|
2369 clsName size == 0 ifTrue:[ |
|
2370 clsName := specClass. |
|
2371 clsName isNil ifTrue:[^ nil]. |
|
2372 ]. |
|
2373 ^ Smalltalk at:clsName ifAbsent:nil |
|
2374 ! |
|
2375 |
|
2376 helpKey |
|
2377 "get the help key of the selected menu item" |
|
2378 |
|
2379 |node| |
|
2380 |
|
2381 (node := treeView selectedNode) notNil ifTrue:[ |
|
2382 ^ node contents activeHelpKey |
|
2383 ]. |
4351 ]. |
2384 ^ nil |
4352 ^ nil |
2385 ! |
4353 ! ! |
2386 |
4354 |
2387 helpTool |
4355 !MenuEditor::ResourceEditor methodsFor:'actions'! |
2388 "get the help tool application |
|
2389 " |
|
2390 |helpView helpTool| |
|
2391 |
|
2392 helpTool := listOfCanvas at:#help ifAbsent:nil. |
|
2393 |
|
2394 helpTool isNil ifTrue:[ |
|
2395 helpTool := UIHelpTool new createBuilder. |
|
2396 helpTool masterApplication:self. |
|
2397 helpTool modifiedHolder: self valueOfEnablingCommitButtons. |
|
2398 helpView := ApplicationSubView new client:helpTool. |
|
2399 helpTool builder window:helpView. |
|
2400 helpTool masterApplication:self. |
|
2401 listOfCanvas at:#help put:helpTool. |
|
2402 ]. |
|
2403 ^ helpTool |
|
2404 |
|
2405 |
|
2406 ! ! |
|
2407 |
|
2408 !MenuEditor methodsFor:'queries'! |
|
2409 |
|
2410 isHelpToolSelected |
|
2411 "return true if current selection is help tool |
|
2412 " |
|
2413 ^ typeOfCanvas == #help |
|
2414 |
|
2415 ! |
|
2416 |
|
2417 isImageViewSelected |
|
2418 "return true if current selection is help tool |
|
2419 " |
|
2420 ^ typeOfCanvas == #imageEditSpec |
|
2421 |
|
2422 ! |
|
2423 |
|
2424 preferredExtent |
|
2425 |
|
2426 ^super preferredExtent max: (Screen current width//3)@(Screen current height//2.5) |
|
2427 |
|
2428 |
|
2429 ! ! |
|
2430 |
|
2431 !MenuEditor methodsFor:'selection'! |
|
2432 |
|
2433 imageSelected |
|
2434 |imgSel| |
|
2435 |
|
2436 imgSel := self selectionOfImage value. |
|
2437 imgSel notNil ifTrue:[ |
|
2438 (aspects at: #icon) value: imgSel string |
|
2439 ] |
|
2440 ! |
|
2441 |
|
2442 menuChanged |
|
2443 |
|
2444 |node item myClass oldLabel oldSlices newList index| |
|
2445 |
|
2446 node := treeView selectedNode. |
|
2447 |
|
2448 node isNil ifTrue:[ |
|
2449 slices := nil. |
|
2450 index := 0. |
|
2451 ] ifFalse:[ |
|
2452 oldSlices := slices. |
|
2453 myClass := self class. |
|
2454 item := node contents. |
|
2455 |
|
2456 item isSeparator ifFalse:[ |
|
2457 node parent isNil ifFalse:[ |
|
2458 node hasChildren ifTrue:[ |
|
2459 slices := #slicesMenu |
|
2460 ] ifFalse:[ |
|
2461 item submenuChannel isNil ifTrue:[slices := #slicesItem] |
|
2462 ifFalse:[slices := #slicesLink] |
|
2463 ]. |
|
2464 slices := listOfSlices at:slices |
|
2465 ifAbsentPut:[(myClass perform:slices) copyWith:#('Help' #help)]. |
|
2466 ] ifTrue:[ |
|
2467 slices := listOfSlices at:#slicesRootMenu |
|
2468 ifAbsentPut:[myClass perform:#slicesRootMenu]. |
|
2469 ]. |
|
2470 ] ifTrue:[ |
|
2471 slices := myClass perform:#slicesSeparatorMenu. |
|
2472 ]. |
|
2473 index := tabSelection ? 0. |
|
2474 |
|
2475 slices ~~ oldSlices ifTrue:[ |
|
2476 tabSelection := 0. |
|
2477 typeOfCanvas := 0. |
|
2478 |
|
2479 self tabCanvasHolder value:nil. |
|
2480 |
|
2481 newList := slices collect:[:el| el first]. |
|
2482 |
|
2483 index ~~ 0 ifTrue:[ |
|
2484 oldLabel := self tabList value at:index ifAbsent:nil. |
|
2485 |
|
2486 oldLabel notNil ifTrue:[ |
|
2487 index := newList indexOf:oldLabel. |
|
2488 ] |
|
2489 ]. |
|
2490 self tabList value:newList. |
|
2491 ]. |
|
2492 index := index max:1. |
|
2493 ]. |
|
2494 self tabModel value:index. |
|
2495 aspects do:[:a| a removeDependent:self]. |
|
2496 self cancel. |
|
2497 self updateChannels. |
|
2498 aspects do:[:a| a addDependent:self]. |
|
2499 |
|
2500 ! |
|
2501 |
|
2502 tabSelection:aSelection |
|
2503 "put the section aSelection into the note book |
|
2504 " |
|
2505 |view| |
|
2506 |
|
2507 aSelection = tabSelection ifTrue:[^self]. |
|
2508 |
|
2509 (tabSelection := aSelection) isNil ifTrue:[ |
|
2510 tabSelection == 0 ifTrue:[^ self]. |
|
2511 tabSelection := 0. |
|
2512 ]. |
|
2513 |
|
2514 "/ before bringing up the new notebook page, |
|
2515 "/ we must disable all now invisible input fields ... |
|
2516 "/ (otherwise, those would fire on #accept. |
|
2517 |
|
2518 (view := self tabCanvasHolder value) notNil ifTrue:[ |
|
2519 view allSubViewsDo:[:aComponent | |
|
2520 aComponent isInputField ifTrue:[ |
|
2521 aComponent disableIfInvisible:true |
|
2522 ] |
|
2523 ] |
|
2524 ]. |
|
2525 |
|
2526 tabSelection == 0 ifTrue:[ |
|
2527 ^ self tabCanvasHolder value:nil. |
|
2528 ]. |
|
2529 |
|
2530 typeOfCanvas := (slices at:tabSelection) last. |
|
2531 |
|
2532 self isHelpToolSelected ifTrue:[ |
|
2533 view := self helpTool window. |
|
2534 ] ifFalse:[ |
|
2535 self updateImageView. |
|
2536 |
|
2537 view := listOfCanvas at:typeOfCanvas |
|
2538 ifAbsentPut:[SimpleView new client:self spec:typeOfCanvas builder:(self builder)]. |
|
2539 ]. |
|
2540 self tabCanvasHolder value:view. |
|
2541 |
|
2542 ! ! |
|
2543 |
|
2544 !MenuEditor methodsFor:'startup / release'! |
|
2545 |
|
2546 initialize |
|
2547 "initialize value holders for the attributes of the menu components" |
|
2548 |
|
2549 |holder| |
|
2550 |
|
2551 super initialize. |
|
2552 |
|
2553 aspects at:#seperatorSelection put:(holder := SelectionInList new). |
|
2554 holder list: Item separatorList. |
|
2555 holder addDependent:self. |
|
2556 |
|
2557 listOfCanvas := IdentityDictionary new. |
|
2558 listOfSlices := IdentityDictionary new. |
|
2559 |
|
2560 treeView := TreeView new. |
|
2561 treeView action:[:dummy| self menuChanged ]. |
|
2562 |
|
2563 aspects at:#indicationEnabled put:(BlockValue |
|
2564 with:[:a | a size == 0] |
|
2565 argument:(aspects at:#choice)). |
|
2566 aspects at:#choiceEnabled put:(BlockValue |
|
2567 with:[:a | a size == 0] |
|
2568 argument:(aspects at:#indication)). |
|
2569 aspects at:#choiceValueEnabled put:(BlockValue |
|
2570 with:[:a | a size > 0] |
|
2571 argument:(aspects at:#choice)). |
|
2572 |
|
2573 aspects at:#retrieverClassList put:self class imageRetrieverClasses asValue. |
|
2574 |
|
2575 aspects do: [:holder| holder addDependent:self]. |
|
2576 ! |
|
2577 |
|
2578 openModalOnMenu: aMenu |
|
2579 "build a tree from aMenu and open it modal" |
|
2580 |
|
2581 super openModalOnResourceSpec: aMenu |
|
2582 ! |
|
2583 |
|
2584 postOpenWith:aBuilder |
|
2585 "reset keyboardProcessor for menuBar |
|
2586 " |
|
2587 super postOpenWith: aBuilder. |
|
2588 aBuilder keyboardProcessor menuBar:nil. |
|
2589 ! ! |
|
2590 |
|
2591 !MenuEditor methodsFor:'user actions'! |
|
2592 |
|
2593 accept |
|
2594 "invoked by button 'OK' and by save requests of menu item changes" |
|
2595 |
|
2596 |node item| |
|
2597 |
|
2598 super accept. |
|
2599 |
|
2600 (node := treeView selectedNode) notNil ifTrue:[ |
|
2601 item := node contents. |
|
2602 |
|
2603 self isHelpToolSelected ifTrue:[ |
|
2604 self helpTool accept. |
|
2605 item activeHelpKey: self helpTool helpKey. |
|
2606 self valueOfEnablingCommitButtons value: false. |
|
2607 self clearModifiedFlag. |
|
2608 ] ifFalse:[ |
|
2609 item buildFromAspects:aspects. |
|
2610 node changed. |
|
2611 specSelector := treeView selectorName. |
|
2612 ] |
|
2613 ]. |
|
2614 self updateInfoLabel. |
|
2615 |
|
2616 ! |
|
2617 |
|
2618 cancel |
|
2619 "invoked by button 'Cancel'" |
|
2620 |node item| |
|
2621 |
|
2622 node := treeView selectedNode. |
|
2623 |
|
2624 aspects keysAndValuesDo:[:aKey :anAspect| |
|
2625 aKey ~~ #retrieverClassList ifTrue:[ |
|
2626 anAspect setValue:''. "/ to clear the field. |
|
2627 anAspect value:'' |
|
2628 ] |
|
2629 ]. |
|
2630 |
|
2631 node notNil ifTrue:[ |
|
2632 item := node contents. |
|
2633 item toAspects:aspects. |
|
2634 self helpTool helpKey:(item activeHelpKey). |
|
2635 ]. |
|
2636 self updateImageView. |
|
2637 self valueOfEnablingCommitButtons value:false. |
|
2638 self clearModifiedFlag. |
|
2639 ! |
|
2640 |
4356 |
2641 doBrowseForImageResource |
4357 doBrowseForImageResource |
2642 "opens a browser on image-resource methods" |
4358 "opens a browser on image-resource methods" |
2643 |
4359 |
2644 |msg currClass w cls sel| |
4360 |msg| |
2645 |
4361 |
2646 currClass := self currentImageRetrieverClass. |
4362 msg := ResourceSelectionBrowser |
2647 msg := |
4363 request:'Use Image From Class' |
2648 (ResourceSelectionBrowser |
4364 onSuperclass:nil |
2649 request: 'Use Image From Class' |
4365 andClass:(self retrieverClass) |
2650 onSuperclass: nil |
4366 andSelector:(selectorHolder value) |
2651 andClass: currClass |
4367 withResourceTypes:#(image fileImage programImage). |
2652 andSelector: (aspects at: #icon) |
4368 |
2653 withResourceTypes: #(image fileImage programImage)). |
4369 msg ifNil:[ ^ self ]. |
2654 |
4370 msg := msg asCollectionOfWords. |
2655 msg notNil ifTrue:[ |
4371 msg size == 2 ifFalse:[ ^ self ]. |
2656 (w := msg asCollectionOfWords) size == 2 ifTrue:[ |
4372 |
2657 cls := w at:1. |
4373 retrieverHolder value:(msg first asSymbol). |
2658 sel := w at:2. |
4374 selectorHolder value:(msg last asSymbol). |
2659 cls ~= currClass ifTrue:[ |
|
2660 (aspects at: #retriever) value:cls asSymbol. |
|
2661 ]. |
|
2662 sel ~= (aspects at:#icon) ifTrue:[ |
|
2663 (aspects at: #icon) value:sel asSymbol. |
|
2664 ]. |
|
2665 self updateImageView. |
|
2666 ]. |
|
2667 ]. |
|
2668 |
|
2669 |
|
2670 ! |
4375 ! |
2671 |
4376 |
2672 doEditImage |
4377 doEditImage |
2673 "opens a Image Editor on the resource retriever and the icon selector; |
4378 |item| |
2674 then updates the list of images and select the line of the image" |
4379 |
2675 |
4380 item := imageHolder value. |
2676 super doEditImage. |
4381 item ifNotNil:[ item doEdit ]. |
2677 lastImageRetriever := nil. |
4382 ! ! |
2678 self updateImageView. |
4383 |
2679 ! |
4384 !MenuEditor::ResourceEditor methodsFor:'aspects'! |
2680 |
4385 |
2681 doNew |
4386 iconAndLabelHolder |
2682 |
4387 ^ iconAndLabelHolder |
2683 super doNew ifTrue: [self helpTool doNew] |
4388 ! |
2684 ! |
4389 |
2685 |
4390 imageHolder |
2686 doPickAMenu |
4391 ^ imageHolder. |
2687 |
4392 ! |
2688 |view| |
4393 |
2689 |
4394 imageList |
2690 self askForModification ifTrue:[ |
4395 ^ imageList. |
2691 ((view := Screen current viewFromUser) isNil or: |
4396 ! |
2692 [view == Screen current rootView]) ifTrue:[ |
4397 |
2693 ^ self |
4398 modifiedChannel |
2694 ]. |
4399 ^ builder booleanValueAspectFor: #modifiedChannel |
2695 view specClass == MenuPanelSpec ifTrue:[ |
4400 ! |
2696 ^ treeView buildFromMenu: view asMenu |
4401 |
2697 ]. |
4402 modifiedChannel:aChannel |
2698 ]. |
4403 builder aspectAt:#modifiedChannel put:aChannel. |
2699 ^ nil |
4404 ! |
2700 ! |
4405 |
2701 |
4406 retrieverHolder |
2702 doRemoveImage |
4407 ^ retrieverHolder |
2703 "removes the image of the selected line" |
4408 ! |
2704 |cls sel| |
4409 |
2705 |
4410 retrieverList |
2706 sel := self selectionOfImage value. |
4411 |list| |
2707 |
4412 |
2708 sel size ~~ 0 ifTrue:[ |
4413 list := builder bindingAt:#retrieverList. |
2709 cls := self currentImageRetrieverClass. |
4414 |
2710 cls notNil ifTrue:[ |
4415 list ifNil:[ |
2711 cls class removeSelector:(sel string) |
4416 list := MenuEditor imageRetrieverClasses asList. |
2712 ]. |
4417 builder aspectAt:#retrieverList put:list. |
2713 (aspects at:#icon) value:nil. |
4418 ]. |
2714 lastImageRetriever := nil. |
4419 ^ list |
2715 self updateImageView. |
4420 ! |
2716 ] |
4421 |
2717 ! |
4422 selectorHolder |
2718 |
4423 ^ selectorHolder. |
2719 doSave |
4424 ! ! |
2720 |cls menu spec mthd category code excla| |
4425 |
2721 |
4426 !MenuEditor::ResourceEditor methodsFor:'change & update'! |
2722 super doSave ifFalse: [^nil]. |
4427 |
2723 |
4428 retrieverChanged |
2724 cls := self resolveName: specClass. |
4429 "called if the retriever changed |
2725 menu := treeView asMenu literalArrayEncoding. |
4430 " |
2726 spec := WriteStream on:String new. |
4431 |retriever list name| |
2727 UISpecification prettyPrintSpecArray:menu on:spec indent:5. |
4432 |
2728 spec := spec contents. |
4433 retriever := self retrieverClass. |
2729 |
4434 imageHolder setValue:nil. |
2730 "/ if that method already exists, do not overwrite the category |
4435 |
2731 |
4436 imageList root fromClass:retriever. |
2732 category := 'menu specs'. |
4437 self selectorChanged. |
2733 (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[ |
4438 |
2734 category := mthd category. |
4439 (retriever notNil and:[imageList size ~~ 0]) ifTrue:[ |
2735 ]. |
4440 list := self retrieverList. |
2736 |
4441 name := retriever name. |
2737 excla := Character excla asString. |
4442 |
2738 |
4443 (list includes:name) ifFalse:[ |
2739 code := excla |
4444 list add:(name asSymbol). |
2740 , (cls name , ' class methodsFor:' , category storeString) |
4445 ] |
2741 , excla , '\\' |
4446 ]. |
2742 |
4447 ! |
2743 , specSelector , '\' |
4448 |
2744 , (self class codeGenerationComment replChar:$!! withString:'!!!!') |
4449 selectorChanged |
2745 , '\\ "\' |
4450 |item selector line| |
2746 , (' MenuEditor new openOnClass:' , cls name , ' andSelector:#' , specSelector , '\') |
4451 |
2747 , (' (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , specSelector , ')) startUp\') |
4452 imageList isEmpty ifTrue:[^ self]. |
2748 , ' "\'. |
4453 |
2749 |
4454 selector := selectorHolder value. |
2750 code := code |
4455 selector size == 0 ifTrue:[ ^ imageHolder value:nil ]. |
2751 , '\' |
4456 |
2752 , ' <resource: #menu>\\' |
4457 item := nil. |
2753 , ' ^ ' , spec |
4458 selector := selector asSymbol. |
2754 , '\' |
4459 |
2755 , (excla , ' ' , excla) |
4460 imageList do:[:anItem| |sel| |
2756 , '\\'. |
4461 sel := anItem selector. |
2757 |
4462 selector == sel ifTrue:[ |
2758 code := code withCRs. |
4463 ^ imageHolder value:anItem |
2759 (ReadStream on:code) fileIn. |
4464 ]. |
2760 |
4465 item ifNil:[ |
2761 self isStandAlone ifTrue: [self helpTool installHelpSpecsOnClass:self specClass]. |
4466 (sel startsWith:selector) ifTrue:[ item := anItem ] |
2762 |
4467 ] |
2763 self updateHistory. |
4468 ]. |
2764 self updateInfoLabel. |
4469 imageHolder value:nil. |
2765 |
4470 |
2766 hasSaved := true. |
4471 item ifNotNil:[ |
2767 modified := false. |
4472 line := imageList identityIndexOf:item. |
2768 |
4473 imageViewer scrollToLine:line |
2769 ! |
4474 ]. |
2770 |
4475 ! |
2771 doSaveAs |
4476 |
2772 |
4477 update:what with:aPara from:aModel |
2773 super doSaveAs ifTrue: [treeView selectorName:specSelector] |
4478 "Invoked when an object that I depend upon sends a change notification." |
2774 ! |
4479 |
2775 |
4480 |item| |
2776 doStepDown |
4481 |
2777 "shift selected menu item one step down" |
4482 self modifiedChannel value:true. |
2778 |
4483 |
2779 treeView selectedNodeChangeSequenceOrder:1. |
4484 aModel == retrieverHolder ifTrue:[ ^ self retrieverChanged ]. |
2780 modified := true. |
4485 aModel == selectorHolder ifTrue:[ ^ self selectorChanged ]. |
2781 |
4486 |
2782 |
4487 aModel == imageHolder ifTrue:[ |
2783 |
4488 item := imageHolder value. |
2784 |
4489 item ifNotNil:[ selectorHolder value:(item label) ]. |
2785 ! |
4490 ^ self |
2786 |
4491 ]. |
2787 doStepIn |
4492 super update:what with:aPara from:aModel |
2788 "move selected menu item into next submenu" |
4493 ! ! |
2789 |
4494 |
2790 "/ treeView selectedNodeBecomeChildOfNext. |
4495 !MenuEditor::ResourceEditor methodsFor:'initialization'! |
2791 treeView selectedNodesBecomeChildrenOfNext. |
4496 |
2792 modified := true. |
4497 initialize |
2793 ! |
4498 super initialize. |
2794 |
4499 |
2795 doStepInAbove |
4500 iconAndLabelHolder := true asValue. |
2796 "move selected menu item into previous submenu" |
4501 iconAndLabelHolder addDependent:self. |
2797 |
4502 |
2798 treeView selectedNodeBecomeChildOfPrevious. |
4503 imageHolder := nil asValue. |
2799 modified := true. |
4504 |
2800 ! |
4505 selectorHolder := nil asValue. |
2801 |
4506 selectorHolder addDependent:self. |
2802 doStepOut |
4507 |
2803 "move selected menu item(s) out from parent submenu" |
4508 imageList := HierarchicalList new. |
2804 |
4509 imageList application:self. |
2805 treeView selectedNodesBecomeSistersOfParent. |
4510 imageList root:(MenuEditor::ResourceEditorItem new). |
2806 modified := true. |
4511 imageList showRoot:false. |
2807 ! |
4512 |
2808 |
4513 imageHolder := nil asValue. |
2809 doStepUp |
4514 imageHolder addDependent:self. |
2810 "shift selected menu item one step up" |
4515 |
2811 |
4516 retrieverHolder := nil asValue. |
2812 treeView selectedNodeChangeSequenceOrder:-1. |
4517 retrieverHolder addDependent:self. |
2813 modified := true. |
4518 ! |
2814 ! ! |
4519 |
2815 |
4520 postBuildImageViewer:aWidget |
2816 !MenuEditor::Item class methodsFor:'constants'! |
4521 imageViewer := aWidget. |
2817 |
4522 ! ! |
2818 separatorList |
4523 |
2819 "get the list of available separator types" |
4524 !MenuEditor::ResourceEditorItem class methodsFor:'instance creation'! |
2820 |
4525 |
2821 ^#('blank' 'single line' 'double line') |
4526 fromClass:aClass selector:aSelector |
2822 ! |
4527 |item| |
2823 |
4528 |
2824 separatorSlices |
4529 item := self new. |
2825 "get the list of menu spec values of the corresponding separator types" |
4530 item fromClass:aClass selector:aSelector. |
2826 |
4531 ^ item |
2827 ^ #( |
4532 ! ! |
2828 ( #blank '' ) |
4533 |
2829 ( #single '-' ) |
4534 !MenuEditor::ResourceEditorItem methodsFor:'accessing'! |
2830 ( #double '=' ) |
4535 |
2831 ) |
4536 icon |
2832 ! ! |
4537 ^ icon |
2833 |
|
2834 !MenuEditor::Item class methodsFor:'documentation'! |
|
2835 |
|
2836 documentation |
|
2837 " |
|
2838 implements the contents assigned to a TreeItem. An instance |
|
2839 is associated with one item and keeps all its information |
|
2840 |
|
2841 [see also:] |
|
2842 TreeItem |
|
2843 MenuEditor |
|
2844 |
|
2845 [author:] |
|
2846 Claus Atzkern |
|
2847 " |
|
2848 |
|
2849 |
|
2850 ! ! |
|
2851 |
|
2852 !MenuEditor::Item methodsFor:'accessing'! |
|
2853 |
|
2854 activeHelpKey |
|
2855 "get the help key of the menu item" |
|
2856 |
|
2857 ^activeHelpKey |
|
2858 ! |
|
2859 |
|
2860 activeHelpKey:aKey |
|
2861 "set the help key of the menu item" |
|
2862 |
|
2863 activeHelpKey := aKey |
|
2864 ! |
4538 ! |
2865 |
4539 |
2866 label |
4540 label |
2867 "get the value of the menu item" |
4541 ^ selector |
2868 |
4542 ! |
2869 ^label |
4543 |
2870 ! |
4544 selector |
2871 |
4545 ^ selector |
2872 label:something |
4546 ! ! |
2873 "set the value of the menu item" |
4547 |
2874 |
4548 !MenuEditor::ResourceEditorItem methodsFor:'instance creation'! |
2875 label := something ? '-' |
4549 |
2876 ! |
4550 fromClass:aClass |
2877 |
4551 |r item| |
2878 separatorType |
4552 |
2879 "get the separator type assigned to item or nil" |
4553 (aClass notNil and:[aClass isBehavior]) ifFalse:[ |
2880 |
4554 ^ self collapse. |
2881 label size > 1 |
4555 ]. |
2882 ifFalse: |
4556 aClass == selector ifTrue:[ |
2883 [ |
4557 ^ self expand |
2884 label size == 0 ifTrue:[^#blank]. |
4558 ]. |
2885 label first == $- ifTrue:[^#single]. |
4559 self collapse. |
2886 label first == $= ifTrue:[^#double]. |
4560 |
2887 ]. |
4561 selector := aClass. |
2888 ^nil |
4562 children := SortedCollection sortBlock:[:a :b| a label < b label ]. |
2889 |
4563 |
2890 ! |
4564 self application withWaitCursorDo:[ |
2891 |
4565 aClass withAllSuperclassesDo:[:aClass| |
2892 startGroup:aSymbolOrNil |
4566 aClass class selectorsAndMethodsDo:[:sel :m| |
2893 "set the startGroup attribute" |
4567 ((r := m resourceType) == #image or:[r == #programImage]) ifTrue:[ |
2894 |
4568 item := self class fromClass:aClass selector:sel. |
2895 startGroup := aSymbolOrNil |
4569 item parent:self. |
2896 |
4570 children add:item |
2897 "Created: / 23.8.1998 / 15:56:03 / cg" |
4571 ] |
2898 ! |
4572 ] |
2899 |
4573 ]. |
2900 submenuChannel |
4574 self expand |
2901 "return the value of the instance variable 'submenuChannel' (automatically generated)" |
4575 ]. |
2902 |
4576 ! |
2903 ^submenuChannel |
4577 |
2904 ! |
4578 fromClass:aClass selector:aSelector |
2905 |
4579 |w h magnify| |
2906 submenuChannel:aChannel |
4580 |
2907 "get the submenuChannel" |
4581 selector := aSelector asSymbol. |
2908 |
4582 icon := aClass perform:selector. |
2909 submenuChannel := aChannel |
4583 |
2910 ! |
4584 w := icon width. |
2911 |
4585 h := icon height. |
2912 translateLabel:aBoolean |
4586 |
2913 "set/clear the translate to national-language flag" |
4587 w > 32 ifTrue:[ |
2914 |
4588 magnify := 32 / w. |
2915 translateLabel := aBoolean |
4589 h > 32 ifTrue:[ magnify := (32 / h) max:magnify ]. |
2916 |
|
2917 "Created: / 6.6.1998 / 17:23:33 / cg" |
|
2918 ! |
|
2919 |
|
2920 value:aSymbol |
|
2921 "set the value attribute" |
|
2922 |
|
2923 value := aSymbol |
|
2924 |
|
2925 "Created: / 23.8.1998 / 16:02:10 / cg" |
|
2926 ! ! |
|
2927 |
|
2928 !MenuEditor::Item methodsFor:'building'! |
|
2929 |
|
2930 buildFromAspects:aspects |
|
2931 "read the values of the aspects into my values" |
|
2932 |
|
2933 |name| |
|
2934 self isSeparator |
|
2935 ifFalse: |
|
2936 [ |
|
2937 name := label. |
|
2938 label := (aspects at:#label) value. |
|
2939 |
|
2940 (label isNil or:[self isSeparator]) ifTrue:[ |
|
2941 (aspects at:#label) value:(label := name) |
|
2942 ]. |
|
2943 |
|
2944 enabled := (aspects at:#enabled) value. |
|
2945 value := (aspects at:#value) value. |
|
2946 nameKey := (aspects at:#nameKey) value. |
|
2947 indication := (aspects at:#indication) value. |
|
2948 choice := (aspects at:#choice) value. |
|
2949 choiceValue := (aspects at:#choiceValue) value. |
|
2950 shortcutKey := (aspects at:#shortcutKey) value. |
|
2951 startGroup := (aspects at:#startGroup) value. |
|
2952 accessCharacterPos := (aspects at:#accessCharacterPos) value. |
|
2953 showBusyCursorWhilePerforming := (aspects at:#showBusyCursorWhilePerforming) value. |
|
2954 triggerOnDown := (aspects at:#triggerOnDown) value. |
|
2955 keepLinkedMenu := (aspects at:#keepLinkedMenu) value ? false. |
|
2956 font := (aspects at:#font) value. |
|
2957 argument := (aspects at:#argument) value. |
|
2958 translateLabel := (aspects at:#translateLabel) value. |
|
2959 isButton := (aspects at:#isButton) value. |
|
2960 auxValue := (aspects at:#auxValue) value. |
|
2961 horizontalLayout := (aspects at:#horizontalLayout) value. |
|
2962 |
|
2963 argument isString ifTrue:[ |
|
2964 argument size > 1 ifTrue:[ |
|
2965 (argument at:1) == $# ifTrue:[ |
|
2966 argument := (argument copyFrom:2) asSymbol |
|
2967 ] |
|
2968 ] |
|
2969 ]. |
|
2970 submenuChannel := (aspects at:#submenuChannel) value. |
|
2971 retriever := (aspects at:#retriever) value. |
|
2972 icon := (aspects at:#icon) value. |
|
2973 iconAndLabel := (aspects at:#iconAndLabel) value. |
|
2974 ] |
|
2975 ifTrue: |
|
2976 [ |
|
2977 name := (aspects at:#seperatorSelection) selectionIndex. |
|
2978 label := (self class separatorSlices at:name) last. |
|
2979 ]. |
|
2980 isVisible := (aspects at:#isVisible) value. |
|
2981 hideMenuOnActivated := (aspects at:#hideMenuOnActivated) value. |
|
2982 |
|
2983 "Modified: / 14.8.1998 / 15:36:38 / cg" |
|
2984 ! |
|
2985 |
|
2986 buildFromMenuItem:anItem |
|
2987 "read the attributes of anItem into my values" |
|
2988 |
|
2989 |rtv| |
|
2990 |
|
2991 self label:(anItem rawLabel). |
|
2992 activeHelpKey := anItem activeHelpKey. |
|
2993 |
|
2994 (enabled := anItem enabled) isSymbol ifFalse:[ |
|
2995 enabled := nil |
|
2996 ]. |
|
2997 (value := anItem value) isSymbol ifFalse:[ |
|
2998 value := nil. |
|
2999 ]. |
|
3000 (indication := anItem indication) isSymbol ifFalse:[ |
|
3001 indication := nil |
|
3002 ]. |
|
3003 (choice := anItem choice) isSymbol ifFalse:[ |
|
3004 choice := nil |
|
3005 ]. |
|
3006 choiceValue := anItem choiceValue. |
|
3007 nameKey := anItem nameKey. |
|
3008 shortcutKey := anItem shortcutKeyCharacter. |
|
3009 startGroup := anItem startGroup. |
|
3010 accessCharacterPos := anItem accessCharacterPosition. |
|
3011 showBusyCursorWhilePerforming := anItem showBusyCursorWhilePerforming. |
|
3012 triggerOnDown := anItem triggerOnDown. |
|
3013 keepLinkedMenu := anItem keepLinkedMenu. |
|
3014 font := anItem font. |
|
3015 argument := anItem argument. |
|
3016 |
|
3017 submenuChannel := anItem submenuChannel. |
|
3018 translateLabel := anItem translateLabel. |
|
3019 isButton := anItem isButton. |
|
3020 isVisible := anItem isVisible. |
|
3021 hideMenuOnActivated := anItem hideMenuOnActivated. |
|
3022 auxValue := anItem auxValue. |
|
3023 horizontalLayout := anItem horizontalLayout. |
|
3024 |
|
3025 (((rtv := anItem adornment) notNil) |
|
3026 and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever]) |
|
3027 ifTrue: |
|
3028 [ |
|
3029 retriever := rtv className. |
|
3030 icon := rtv selector. |
|
3031 (iconAndLabel := rtv labelText notNil) ifTrue:[ |
|
3032 label := rtv labelText. |
|
3033 ] |
|
3034 ] |
|
3035 |
|
3036 "Modified: / 29.9.1998 / 11:18:25 / cg" |
|
3037 ! ! |
|
3038 |
|
3039 !MenuEditor::Item methodsFor:'conversion'! |
|
3040 |
|
3041 asMenuItem |
|
3042 "converts self to a menu item" |
|
3043 |
|
3044 |item rcv| |
|
3045 |
|
3046 item := MenuItem labeled:label. |
|
3047 item isVisible:isVisible. |
|
3048 item hideMenuOnActivated:hideMenuOnActivated. |
|
3049 |
|
3050 self isSeparator ifFalse:[ |
|
3051 item activeHelpKey:activeHelpKey. |
|
3052 item enabled:enabled. |
|
3053 item accessCharacterPosition:accessCharacterPos. |
|
3054 item showBusyCursorWhilePerforming:showBusyCursorWhilePerforming. |
|
3055 item triggerOnDown:triggerOnDown. |
|
3056 item keepLinkedMenu:keepLinkedMenu. |
|
3057 item font:font. |
|
3058 item argument:argument. |
|
3059 item submenuChannel:submenuChannel. |
|
3060 item nameKey:nameKey. |
|
3061 item shortcutKeyCharacter:shortcutKey. |
|
3062 item startGroup:startGroup. |
|
3063 item value:value. |
|
3064 item indication:indication. |
|
3065 item choice:choice. |
|
3066 item choiceValue:choiceValue. |
|
3067 item translateLabel: translateLabel. |
|
3068 item isButton: isButton. |
|
3069 item auxValue: auxValue. |
|
3070 |
|
3071 horizontalLayout == true ifTrue:[ |
|
3072 item horizontalLayout:true. |
|
3073 ]. |
|
3074 |
|
3075 icon notNil ifTrue:[ |
|
3076 rcv := ResourceRetriever new. |
|
3077 rcv className:retriever. |
|
3078 rcv selector:icon. |
|
3079 iconAndLabel == true ifTrue:[ |
|
3080 rcv labelText:label |
|
3081 ]. |
|
3082 item labelImage:rcv |
|
3083 ] |
|
3084 ]. |
|
3085 ^item |
|
3086 |
|
3087 "Modified: / 14.8.1998 / 15:36:35 / cg" |
|
3088 ! |
|
3089 |
|
3090 toAspects:aspects |
|
3091 "put my values into the values of aspects" |
|
3092 |
|
3093 |type| |
|
3094 (type := self separatorType) notNil ifTrue: [ |
|
3095 type := self class separatorSlices findFirst:[:el| el first == type ]. |
|
3096 (aspects at:#seperatorSelection) selectionIndex:type. |
|
3097 ] ifFalse: [ |
|
3098 (aspects at:#label) value:label. |
|
3099 (aspects at:#enabled) value:enabled. |
|
3100 (aspects at:#value) value:value. |
|
3101 (aspects at:#nameKey) value:nameKey. |
|
3102 (aspects at:#indication) value:indication. |
|
3103 (aspects at:#choice) value:choice. |
|
3104 (aspects at:#choiceValue) value:choiceValue. |
|
3105 (aspects at:#shortcutKey) value:shortcutKey. |
|
3106 (aspects at:#startGroup) value:startGroup. |
|
3107 (aspects at:#accessCharacterPos) value:accessCharacterPos. |
|
3108 (aspects at:#showBusyCursorWhilePerforming) value:showBusyCursorWhilePerforming. |
|
3109 (aspects at:#triggerOnDown) value:triggerOnDown. |
|
3110 (aspects at:#keepLinkedMenu) value:(keepLinkedMenu ? false). |
|
3111 (aspects at:#font) value:font. |
|
3112 (aspects at:#translateLabel) value:translateLabel. |
|
3113 (aspects at:#submenuChannel) value:submenuChannel. |
|
3114 (aspects at:#retriever) value:retriever. |
|
3115 (aspects at:#icon) value:icon. |
|
3116 (aspects at:#iconAndLabel) value:iconAndLabel. |
|
3117 (aspects at:#isButton) value:isButton. |
|
3118 (aspects at:#auxValue) value:auxValue. |
|
3119 (aspects at:#horizontalLayout) value:(horizontalLayout ? false). |
|
3120 |
|
3121 (aspects at:#argument) |
|
3122 value:(argument isSymbol |
|
3123 ifTrue: ['#', argument] |
|
3124 ifFalse:[argument]). |
|
3125 ]. |
|
3126 (aspects at:#isVisible) value:isVisible. |
|
3127 (aspects at:#hideMenuOnActivated) value:(hideMenuOnActivated ? true). |
|
3128 |
|
3129 "Modified: / 14.8.1998 / 15:37:29 / cg" |
|
3130 ! ! |
|
3131 |
|
3132 !MenuEditor::Item methodsFor:'queries'! |
|
3133 |
|
3134 iconFor: aNode |
|
3135 "get the icon of the menu item for the tree view" |
|
3136 |
|
3137 (aNode hasChildren or: [aNode parent isNil]) |
|
3138 ifTrue: |
|
3139 [ |
|
3140 ^MenuEditor submenuImage |
|
3141 ] |
|
3142 ifFalse: |
|
3143 [ |
|
3144 submenuChannel notNil |
|
3145 ifTrue: |
|
3146 [ |
|
3147 ^MenuEditor linkSubmenuImage |
|
3148 ] |
|
3149 ifFalse: |
|
3150 [ |
|
3151 self isSeparator |
|
3152 ifTrue: [^MenuEditor menuSeparatorImage] |
|
3153 ifFalse: [^MenuEditor menuItemImage] |
|
3154 ] |
|
3155 ] |
|
3156 ! |
|
3157 |
|
3158 isSeparator |
|
3159 "return true if item is a seperator" |
|
3160 |
|
3161 ^self separatorType notNil |
|
3162 ! |
|
3163 |
|
3164 treeViewLabel |
|
3165 "get the label of the menu item for the tree view" |
|
3166 |
|
3167 ^label |
|
3168 " asBoldText, |
|
3169 (value notNil ifTrue: [': [', |
|
3170 value , |
|
3171 (argument isString ifTrue: [' ', (Text string: argument emphasis: #italic)] ifFalse: ['']), |
|
3172 ']'] ifFalse: ['']) |
|
3173 |
|
3174 |
|
3175 " |
|
3176 ! ! |
|
3177 |
|
3178 !MenuEditor::TreeView class methodsFor:'documentation'! |
|
3179 |
|
3180 documentation |
|
3181 " |
|
3182 This tree view class provides a hierarchical representation |
|
3183 of the components of a menu. |
|
3184 |
|
3185 [see also:] |
|
3186 SelectionInTreeView |
|
3187 SelectionInTree |
|
3188 TreeItem |
|
3189 |
|
3190 [author:] |
|
3191 Claus Atzkern |
|
3192 " |
|
3193 ! ! |
|
3194 |
|
3195 !MenuEditor::TreeView methodsFor:'accessing'! |
|
3196 |
|
3197 canTab |
|
3198 ^ true |
|
3199 ! |
|
3200 |
|
3201 selectorName |
|
3202 "get the selector of the menu spec" |
|
3203 |
|
3204 ^(listOfNodes first contents label) asSymbol |
|
3205 ! |
|
3206 |
|
3207 selectorName: aSymbol |
|
3208 "set the selector for the menu spec" |
|
3209 |
|
3210 listOfNodes first contents label: aSymbol |
|
3211 ! ! |
|
3212 |
|
3213 !MenuEditor::TreeView methodsFor:'building'! |
|
3214 |
|
3215 buildFromClass:aClass andSelector:aSelector |
|
3216 "read a menu spec from aClass and aSelector and put |
|
3217 the encoded menu into the tree view" |
|
3218 |
|
3219 |spec cls menu firstNode firstNodeLabel| |
|
3220 |
|
3221 "if opened on a menu" |
|
3222 (aClass isNil and: [aSelector isNil and: [listOfNodes size > 0]]) ifTrue: [^nil]. |
|
3223 |
|
3224 self selection:nil. |
|
3225 |
|
3226 (aClass notNil and:[aSelector notNil]) ifTrue:[ |
|
3227 cls := self application resolveName:aClass. |
|
3228 |
|
3229 (cls respondsTo:aSelector) ifTrue:[ |
|
3230 spec := cls perform:aSelector |
|
3231 ] |
|
3232 ]. |
|
3233 |
|
3234 spec isNil ifFalse:[ |
|
3235 (spec isMemberOf:Menu) ifFalse:[ |
|
3236 menu := Menu new fromLiteralArrayEncoding:spec. |
|
3237 ] ifTrue:[ |
|
3238 menu := spec. |
|
3239 ]. |
|
3240 firstNode := self nodeLabel:(aSelector asString). |
|
3241 self subMenu:menu parent:firstNode. |
|
3242 ] ifTrue:[ |
|
3243 (aClass notNil and: [aSelector isNil and: [listOfNodes size > 0]]) |
|
3244 ifTrue: |
|
3245 [ |
|
3246 firstNode := listOfNodes first |
|
3247 ] |
|
3248 ifFalse: |
|
3249 [ |
|
3250 aSelector notNil ifTrue:[firstNodeLabel := aSelector asString] |
|
3251 ifFalse:[firstNodeLabel := 'menu']. |
|
3252 firstNode := self nodeLabel:firstNodeLabel. |
|
3253 ] |
|
3254 ]. |
|
3255 |
|
3256 firstNode expand. |
|
3257 model root: firstNode. |
|
3258 |
|
3259 firstNode hasChildren ifFalse:[ |
|
3260 model add:(self nodeLabel:'Item 1') below:firstNode |
|
3261 ]. |
|
3262 |
|
3263 |
|
3264 ! |
|
3265 |
|
3266 buildFromMenu:aMenu |
|
3267 "put aMenu into the tree view" |
|
3268 |
|
3269 |node| |
|
3270 |
|
3271 self selection:nil. |
|
3272 |
|
3273 node := self nodeLabel:'menu'. |
|
3274 self subMenu:aMenu parent:node. |
|
3275 |
|
3276 node hasChildren ifFalse:[ |
|
3277 node add:(self nodeLabel:'Item 1') |
|
3278 ]. |
|
3279 node expand. |
|
3280 model root:node. |
|
3281 ! |
|
3282 |
|
3283 menuItem:anItem |
|
3284 |
|
3285 |node| |
|
3286 |
|
3287 node := self nodeLabel: anItem label. |
|
3288 node contents buildFromMenuItem:anItem. |
|
3289 self subMenu: anItem submenu parent:node. |
|
3290 ^node. |
|
3291 |
|
3292 |
|
3293 ! |
|
3294 |
|
3295 subMenu:aMenu parent:aParent |
|
3296 |
|
3297 |idx grp| |
|
3298 |
|
3299 aMenu isNil ifFalse:[ |
|
3300 grp := aMenu groupSizes. |
|
3301 aMenu itemsDo:[:i| aParent add:(self menuItem:i)]. |
|
3302 |
|
3303 grp notNil ifTrue:[ |
|
3304 idx := 0. |
|
3305 |
|
3306 grp do:[:i| |
|
3307 idx := idx + i + 1. |
|
3308 aParent add:(self nodeLabel:nil) beforeIndex:idx. |
|
3309 ] |
|
3310 ] |
|
3311 ] |
|
3312 ! ! |
|
3313 |
|
3314 !MenuEditor::TreeView methodsFor:'conversion'! |
|
3315 |
|
3316 asMenu |
|
3317 |menu root| |
|
3318 |
|
3319 root := self root. |
|
3320 |
|
3321 root hasChildren ifTrue:[ |
|
3322 menu := Menu new. |
|
3323 root children do:[:aChild| menu addItem:(self asMenuItem:aChild)]. |
|
3324 ]. |
|
3325 ^ menu |
|
3326 ! |
|
3327 |
|
3328 asMenuItem:aNode |
|
3329 |
|
3330 |menu item| |
|
3331 |
|
3332 item := aNode contents asMenuItem. |
|
3333 |
|
3334 aNode hasChildren ifTrue:[ |
|
3335 menu := Menu new. |
|
3336 aNode children do:[:aChild| menu addItem:(self asMenuItem:aChild)]. |
|
3337 item submenu:menu |
|
3338 ]. |
|
3339 ^ item |
|
3340 |
|
3341 ! ! |
|
3342 |
|
3343 !MenuEditor::TreeView methodsFor:'drawing basics'! |
|
3344 |
|
3345 redrawLabelAt:x y:yTop index:anIndex |
|
3346 "draw text label assigned to a node at x y( center)" |
|
3347 |
|
3348 |isSelected y0 x0 x1 w type item| |
|
3349 |
|
3350 item := (listOfNodes at:anIndex) contents. |
|
3351 type := item separatorType. |
|
3352 |
|
3353 type isNil ifTrue:[ |
|
3354 ^ super redrawLabelAt:x y:yTop index:anIndex |
|
3355 ]. |
|
3356 isSelected := self isInSelection:anIndex. |
|
3357 x0 := x. |
|
3358 |
|
3359 highlightMode == #label ifTrue:[ |
|
3360 x0 := x + 4. |
|
3361 |
|
3362 isSelected ifTrue:[ |
|
3363 w := 80 + 8. |
|
3364 self paint:hilightBgColor. |
|
3365 self fillRectangleX:x y:yTop width:w height:fontHeight. |
|
3366 ] |
|
3367 ] ifFalse:[ |
4590 ] ifFalse:[ |
3368 w := 0. |
4591 h > 32 ifFalse:[^ self]. |
3369 ]. |
4592 magnify := 32 / h. |
3370 type == #blank ifFalse:[ |
4593 ]. |
3371 isSelected ifTrue:[self paint:hilightFgColor] |
4594 icon := icon magnifiedBy: magnify. |
3372 ifFalse:[self paint:fgColor]. |
4595 ! |
3373 |
|
3374 x1 := x0 + 80. |
|
3375 y0 := yTop - 1 + (fontHeight // 2). |
|
3376 self displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
3377 |
|
3378 type == #double ifTrue:[ |
|
3379 y0 := y0 + 2. |
|
3380 self displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
3381 ] |
|
3382 ]. |
|
3383 |
|
3384 (isSelected and:[highlightMode == #label]) ifTrue:[ |
|
3385 self redrawSelFrameAtX:x y:yTop toX:(x + w) |
|
3386 ]. |
|
3387 |
|
3388 ! ! |
|
3389 |
|
3390 !MenuEditor::TreeView methodsFor:'event handling'! |
|
3391 |
|
3392 keyPress:key x:x y:y |
|
3393 "invoked if any key was pressed" |
|
3394 |
|
3395 <resource: #keyboard (#Delete #BackSpace #Cut #Copy #Paste)> |
|
3396 |
|
3397 (key == #Delete or:[key == #BackSpace]) ifTrue: [^self doDelete]. |
|
3398 key == #Cut ifTrue:[^self doCut]. |
|
3399 key == #Copy ifTrue:[^self doCopy]. |
|
3400 key == #Paste ifTrue:[^self doPaste]. |
|
3401 |
|
3402 super keyPress:key x:x y:y |
|
3403 |
|
3404 ! ! |
|
3405 |
|
3406 !MenuEditor::TreeView methodsFor:'initialization'! |
|
3407 |
4596 |
3408 initialize |
4597 initialize |
3409 "initialize the tree view of the menu components" |
|
3410 |
|
3411 super initialize. |
4598 super initialize. |
3412 |
4599 children := #(). |
3413 self multipleSelectOk:true. |
4600 ! ! |
3414 self showDirectoryIndicator: true. |
4601 |
3415 self showDirectoryIndicatorForRoot: false. |
4602 !MenuEditor::ResourceEditorItem methodsFor:'user operations'! |
3416 self selectConditionBlock: [:i|self application askForItemModification]. |
4603 |
3417 self validateDoubleClickBlock: [:node| node ~~ listOfNodes first]. |
4604 doEdit |
3418 self model iconAction: [:aNode| aNode contents iconFor: aNode]. |
4605 "open image browser on self |
3419 self model labelAction: [:aNode| aNode contents treeViewLabel] |
4606 " |
3420 ! ! |
4607 |parent| |
3421 |
4608 |
3422 !MenuEditor::TreeView methodsFor:'menus'! |
4609 parent := self parent. |
3423 |
4610 |
3424 XXdoDeleteSelectionBuffered:aBool |
4611 parent ifNotNil:[ |
3425 |appl idx| |
4612 ImageEditor openOnClass:(parent selector) andSelector:selector |
3426 |
4613 ]. |
3427 appl := self topView application. |
|
3428 |
|
3429 (appl hasValidSelection value and: [self askForItemModification]) ifFalse:[ |
|
3430 ^ self |
|
3431 ]. |
|
3432 aBool ifTrue:[ |
|
3433 self doCopy |
|
3434 ]. |
|
3435 |
|
3436 idx := 10000. |
|
3437 self selection do:[:aNumber| idx := idx min:aNumber ]. |
|
3438 |
|
3439 self selectedNodesRemove. |
|
3440 self selection:(idx min:(self list size)). |
|
3441 self setModified. |
|
3442 |
|
3443 aBool ifTrue:[ |
|
3444 "/ must update copy&paste indication |
|
3445 appl updateAllToolInstances. |
|
3446 ] |
|
3447 ! |
|
3448 |
|
3449 doCopy |
|
3450 |clip| |
|
3451 |
|
3452 self hasSelection ifTrue:[ |
|
3453 self application clipboard:(clip := OrderedCollection new). |
|
3454 self selectionDo:[:i | clip add:((listOfNodes at:i) copy)]. |
|
3455 self topView application updateAllToolInstances. |
|
3456 ] |
|
3457 ! |
|
3458 |
|
3459 doCreateItem |
|
3460 |
|
3461 self addElement: (self nodeLabel:'Item') |
|
3462 ! |
|
3463 |
|
3464 doCreateLink |
|
3465 |
|
3466 |node item| |
|
3467 |
|
3468 node := self nodeLabel:'Submenu Link'. |
|
3469 item := node contents. |
|
3470 item submenuChannel:#menuDefaultLink. |
|
3471 self addElement:node. |
|
3472 self setModified. |
|
3473 |
|
3474 |
|
3475 ! |
|
3476 |
|
3477 doCreateMenu |
|
3478 |node| |
|
3479 |
|
3480 node := self nodeLabel:'Submenu'. |
|
3481 node parent: self selectedNode. |
|
3482 node add:(self nodeLabel:'Item 1'). |
|
3483 self addElement:node |
|
3484 ! |
|
3485 |
|
3486 doCreateSep |
|
3487 |
|
3488 self addElement:(self nodeLabel:nil) |
|
3489 ! |
|
3490 |
|
3491 doCreateStandardEditMenu |
|
3492 |
|
3493 |node| |
|
3494 node := self nodeLabel:'Edit'. |
|
3495 node parent: self selectedNode. |
|
3496 node add:(self nodeLabel:'Copy' selector:#copySelection). |
|
3497 node add:(self nodeLabel:'Cut' selector:#cutSelection). |
|
3498 node add:(self nodeLabel:'Paste' selector:#paste). |
|
3499 self addElement:node |
|
3500 |
|
3501 "Created: / 23.8.1998 / 15:52:16 / cg" |
|
3502 "Modified: / 23.8.1998 / 15:59:36 / cg" |
|
3503 ! |
|
3504 |
|
3505 doCreateStandardFileMenu |
|
3506 |
|
3507 |node| |
|
3508 node := self nodeLabel:'File'. |
|
3509 node parent: self selectedNode. |
|
3510 node add:(self nodeLabel:'New' selector:#menuNew). |
|
3511 node add:(self nodeLabel:'-' ). |
|
3512 node add:(self nodeLabel:'Open...' selector:#menuOpen). |
|
3513 node add:(self nodeLabel:'-' ). |
|
3514 node add:(self nodeLabel:'Save' selector:#menuSave). |
|
3515 node add:(self nodeLabel:'Save As...' selector:#menuSaveAs). |
|
3516 node add:(self nodeLabel:'-' ). |
|
3517 node add:(self nodeLabel:'Exit' selector:#closeRequest). |
|
3518 self addElement:node |
|
3519 |
|
3520 "Created: / 23.8.1998 / 15:51:55 / cg" |
|
3521 "Modified: / 23.8.1998 / 16:04:24 / cg" |
|
3522 ! |
|
3523 |
|
3524 doCreateStandardHelpMenu |
|
3525 |
|
3526 |node| |
|
3527 node := self nodeLabel:'Help'. |
|
3528 node parent: self selectedNode. |
|
3529 node contents startGroup:#right. |
|
3530 node add:(self nodeLabel:'Documentation' selector:#openDocumentation). |
|
3531 node add:(self nodeLabel:'-'). |
|
3532 node add:(self nodeLabel:'About this Application' selector:#openAboutThisApplication). |
|
3533 self addElement:node |
|
3534 |
|
3535 "Created: / 23.8.1998 / 15:52:46 / cg" |
|
3536 "Modified: / 23.8.1998 / 17:30:12 / cg" |
|
3537 ! |
|
3538 |
|
3539 doCut |
|
3540 ^ self doDeleteSelectionBuffered:true |
|
3541 ! |
|
3542 |
|
3543 doDelete |
|
3544 ^ self doDeleteSelectionBuffered:false |
|
3545 ! |
|
3546 |
|
3547 doDeleteSelectionBuffered:aBool |
|
3548 |appl nsel list item prnt| |
|
3549 |
|
3550 appl := self topView application. |
|
3551 |
|
3552 (appl hasValidSelection value and: [self askForItemModification]) ifFalse:[ |
|
3553 ^ self |
|
3554 ]. |
|
3555 aBool ifTrue:[ |
|
3556 self doCopy |
|
3557 ]. |
|
3558 list := self list. |
|
3559 nsel := list size. |
|
3560 self selection do:[:aNumber| nsel := nsel min:aNumber ]. |
|
3561 |
|
3562 ( (item := list at:nsel ifAbsent:nil) notNil |
|
3563 and:[(prnt := item parent) notNil |
|
3564 and:[prnt children last == item]] |
|
3565 ) ifTrue:[ |
|
3566 nsel := nsel - 1 |
|
3567 ]. |
|
3568 |
|
3569 self selectedNodesRemove. |
|
3570 self selection:(nsel min:(list size)). |
|
3571 self setModified. |
|
3572 |
|
3573 aBool ifTrue:[ |
|
3574 "/ must update copy&paste indication |
|
3575 appl updateAllToolInstances. |
|
3576 ] |
|
3577 ! |
|
3578 |
|
3579 doPaste |
|
3580 |clip| |
|
3581 |
|
3582 clip := self application clipboard. |
|
3583 (clip notNil and:[self selectedNode notNil]) ifTrue:[ |
|
3584 self addElement:(clip collect:[:el| el copy]) |
|
3585 ]. |
|
3586 ! ! |
|
3587 |
|
3588 !MenuEditor::TreeView methodsFor:'private'! |
|
3589 |
|
3590 addElement: aNode |
|
3591 "add something after selection" |
|
3592 |
|
3593 |label sel selParent| |
|
3594 |
|
3595 self askForItemModification ifFalse:[^ self]. |
|
3596 |
|
3597 self selectedNodeAdd:aNode. |
|
3598 (aNode isCollection not and:[aNode name = 'Item']) |
|
3599 ifTrue:[ |
|
3600 sel := self selectedNode. |
|
3601 selParent := sel parent. |
|
3602 label := aNode name |
|
3603 , |
|
3604 ' ' |
|
3605 , |
|
3606 (selParent notNil |
|
3607 ifTrue:[ |
|
3608 (((sel children size = 0 |
|
3609 ifTrue: [selParent children] |
|
3610 ifFalse: [sel children]) |
|
3611 select:[:node| |
|
3612 |lab| |
|
3613 lab := node contents label. |
|
3614 ((node children size = 0) & |
|
3615 node contents submenuChannel isNil & |
|
3616 (lab ~= '-') & (lab ~= '=') & (lab ~= '')) |
|
3617 ]) size) printString |
|
3618 ] |
|
3619 ifFalse: ['1']). |
|
3620 |
|
3621 aNode name: label string asBoldText. |
|
3622 aNode contents label: label string. |
|
3623 ]. |
|
3624 aNode isCollection ifFalse: [ |
|
3625 self selectNode: aNode |
|
3626 ] ifTrue: [ |
|
3627 self selection: (aNode collect: [:node| self indexOfNode: node]) |
|
3628 ]. |
|
3629 self setModified. |
|
3630 ! |
|
3631 |
|
3632 askForItemModification |
|
3633 |
|
3634 ^self topView application askForItemModification |
|
3635 ! |
|
3636 |
|
3637 nodeLabel:aLabel |
|
3638 |
|
3639 ^TreeItem new contents: ((MenuEditor::Item new label:aLabel) translateLabel:true) |
|
3640 |
|
3641 "Modified: / 6.6.1998 / 17:22:35 / cg" |
|
3642 ! |
|
3643 |
|
3644 nodeLabel:aLabel selector:aSelector |
|
3645 |
|
3646 ^TreeItem new contents: (((MenuEditor::Item new label:aLabel) value:aSelector) translateLabel:true) |
|
3647 |
|
3648 "Modified: / 6.6.1998 / 17:22:35 / cg" |
|
3649 "Created: / 23.8.1998 / 15:58:59 / cg" |
|
3650 ! |
|
3651 |
|
3652 selectedNodeAdd:something |
|
3653 |
|
3654 |node numChildren| |
|
3655 |
|
3656 something notNil ifTrue:[ |
|
3657 (node := self selectedNode) notNil ifTrue:[ |
|
3658 numChildren := node children size. |
|
3659 |
|
3660 node parent notNil ifTrue:[ |
|
3661 node isCollapsable ifTrue:[ |
|
3662 model add:something afterIndex:numChildren below:node |
|
3663 ] ifFalse:[ |
|
3664 model add:something after:node |
|
3665 ] |
|
3666 ] ifFalse:[ |
|
3667 model add:something afterIndex:numChildren below:(self root) |
|
3668 ] |
|
3669 ] |
|
3670 ] |
|
3671 |
|
3672 |
|
3673 ! |
|
3674 |
|
3675 setModified |
|
3676 |app| |
|
3677 |
|
3678 (app := self topView application) modified: true. |
|
3679 app updateChannels |
|
3680 ! ! |
4614 ! ! |
3681 |
4615 |
3682 !MenuEditor class methodsFor:'documentation'! |
4616 !MenuEditor class methodsFor:'documentation'! |
3683 |
4617 |
3684 version |
4618 version |
3685 ^ '$Header$' |
4619 ^ '$Header$' |
3686 ! ! |
4620 ! ! |
|
4621 |
3687 MenuEditor initialize! |
4622 MenuEditor initialize! |