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