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