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