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