author | Claus Gittinger <cg@exept.de> |
Mon, 11 Nov 2002 18:54:12 +0100 | |
changeset 1654 | 26f59bf8b78c |
parent 1653 | 1798c7bcb787 |
child 1656 | f5c0716efd78 |
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 |
" |
|
1645 | 1441 |
self helpTool buildFromHelpTool:aHelpTool. |
1606 | 1442 |
! ! |
1443 |
||
1444 |
!MenuEditor methodsFor:'actions'! |
|
1445 |
||
1446 |
accept |
|
1447 |
"accept modifications |
|
1448 |
" |
|
1449 |
self accept:true. |
|
1450 |
! |
|
1451 |
||
1452 |
accept:ok |
|
1453 |
"ok if true the modifications are accepted |
|
1454 |
than reload from item |
|
1455 |
" |
|
1456 |
|selectedItem rscRetrHolder helpKeyHolder helpTool imageTool acceptChannel| |
|
1457 |
||
1458 |
selectedItem := self selectedItem. |
|
1459 |
||
1460 |
selectedItem ifNotNil:[ |
|
1461 |
self withoutNotifyDo:[ |
|
1462 |
rscRetrHolder := aspects at:#resourceRetriever. |
|
1463 |
helpKeyHolder := aspects at:#activeHelpKey. |
|
1464 |
imageTool := self imageTool. |
|
1465 |
helpTool := self helpTool. |
|
1466 |
acceptChannel := self acceptChannel. |
|
1467 |
||
1468 |
acceptChannel triggerValue:true. |
|
1469 |
acceptChannel setValue:false. |
|
1470 |
||
1471 |
ok ifTrue:[ |
|
1472 |
rscRetrHolder value:(imageTool resourceRetriever). |
|
1473 |
helpKeyHolder value:(helpTool helpKey). |
|
1474 |
selectedItem fromAspects:aspects. |
|
1475 |
modified := true. |
|
1476 |
||
1477 |
selectedItem isRootItem ifTrue:[ |
|
1478 |
"/ update specSelector |
|
1479 |
specSelector := selectedItem rawLabel. |
|
1480 |
]. |
|
1481 |
]. |
|
1482 |
selectedItem toAspects:aspects. |
|
1483 |
helpTool setHelpKey:(helpKeyHolder value). |
|
1484 |
imageTool resourceRetriever:(rscRetrHolder value). |
|
1485 |
] |
|
218 | 1486 |
]. |
1606 | 1487 |
self updateChannels. |
1488 |
self clearModified. |
|
1489 |
! |
|
1490 |
||
1491 |
cancel |
|
1492 |
"reload aspects from current selected item; reset modification flag |
|
1493 |
" |
|
1494 |
self accept:false. |
|
287 | 1495 |
! |
1496 |
||
1606 | 1497 |
indicatorClickedAt:atLine |
1498 |
"indicator clicked at line number; toggle expand of item at line |
|
1499 |
" |
|
1500 |
|item| |
|
1501 |
||
1502 |
item := listOfItems at:atLine ifAbsent:nil. |
|
1610
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
1503 |
item ifNotNil:[ |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
1504 |
item toggleExpand. |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
1505 |
self hasSelection ifFalse:[ |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
1506 |
self selectedItem:item |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
1507 |
] |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
1508 |
]. |
199 | 1509 |
! ! |
1510 |
||
1511 |
!MenuEditor methodsFor:'aspects'! |
|
1512 |
||
1606 | 1513 |
canCreateDelayedMenuChannel |
1514 |
"boolean holder, true if the current selected item accepts a delayed menu |
|
1515 |
" |
|
1516 |
^ builder booleanValueAspectFor:#canCreateDelayedMenuChannel |
|
220 | 1517 |
! |
1518 |
||
1636 | 1519 |
hasItemValue |
1520 |
"boolean holder, true if any item is selected |
|
1521 |
" |
|
1522 |
^ BlockValue |
|
1523 |
with:[:holder | holder value size > 0] |
|
1524 |
argument:(self aspectFor:#itemValue) |
|
1525 |
! |
|
1526 |
||
1606 | 1527 |
hasSelectionChannel |
1528 |
"boolean holder, true if any item is selected |
|
1529 |
" |
|
1530 |
^ builder booleanValueAspectFor:#hasSelectionChannel |
|
220 | 1531 |
! |
1532 |
||
1606 | 1533 |
hasSingleSelectionChannel |
1534 |
"boolean holder, true if one item is selected |
|
1535 |
" |
|
1536 |
^ builder booleanValueAspectFor:#hasSingleSelectionChannel |
|
1537 |
! |
|
1538 |
||
1539 |
listOfItems |
|
1540 |
"returns the hierarchical list of menuItems |
|
1244 | 1541 |
" |
1606 | 1542 |
^ listOfItems |
1543 |
! |
|
1544 |
||
1545 |
listOfTabs |
|
1546 |
"returns the list of current shown tab-labels retrieved |
|
1547 |
from the current selected item. |
|
1548 |
" |
|
1549 |
^ listOfTabs |
|
1550 |
! |
|
1551 |
||
1617 | 1552 |
redefineAspectMethodsChannel |
1553 |
"boolean holder, true if aspects should be generated in only implemented |
|
1554 |
in superClass by calling #super ... |
|
1555 |
" |
|
1556 |
^ builder booleanValueAspectFor:#redefineAspectMethodsChannel |
|
1557 |
! |
|
1558 |
||
1606 | 1559 |
selectionHolder |
1560 |
"value holder, which keeps the current selected items |
|
1561 |
" |
|
1562 |
^ selectionHolder |
|
199 | 1563 |
! |
1564 |
||
1606 | 1565 |
tabHolder |
1566 |
"value holder, which keeps the current selected tab label or nil |
|
1567 |
" |
|
1568 |
^ tabHolder |
|
1569 |
! |
|
1570 |
||
1571 |
wizardHolder |
|
1572 |
"holder, which keeps the current wizard window |
|
1573 |
" |
|
879 | 1574 |
|holder| |
1606 | 1575 |
|
1576 |
holder := builder bindingAt:#wizardHolder. |
|
1577 |
||
1578 |
holder ifNil:[ |
|
1579 |
holder := nil asValue. |
|
1580 |
builder aspectAt:#wizardHolder put:holder. |
|
879 | 1581 |
]. |
1582 |
^ holder |
|
199 | 1583 |
! ! |
1584 |
||
728 | 1585 |
!MenuEditor methodsFor:'building'! |
1586 |
||
1606 | 1587 |
buildFromClass:aSpecClass andSelector:aSpecSelector |
1588 |
"rebuild menu from a class and selector |
|
1589 |
" |
|
1590 |
|cls menu| |
|
1591 |
||
1592 |
menu := nil. |
|
1593 |
||
1594 |
self isStandAlone ifTrue:[ self helpTool buildFromClass:aSpecClass ]. |
|
1595 |
||
1596 |
aSpecSelector notNil ifTrue:[ |
|
1597 |
aSpecClass ifNotNil:[ |
|
1598 |
cls := self resolveName:aSpecClass. |
|
1599 |
menu := cls perform:aSpecSelector ifNotUnderstood:nil. |
|
1600 |
||
1601 |
menu ifNotNil:[ |
|
1602 |
(menu isMemberOf:Menu) ifFalse:[ |
|
1603 |
menu := Menu new fromLiteralArrayEncoding:menu |
|
1604 |
]. |
|
1605 |
] |
|
1606 |
]. |
|
1607 |
]. |
|
1608 |
self buildFromMenu:menu selector:aSpecSelector. |
|
1609 |
! |
|
1610 |
||
1611 |
buildFromMenu:aMenu selector:aSelector |
|
1612 |
"rebuild menu from a Menu |
|
1613 |
" |
|
1614 |
|root menu| |
|
1615 |
||
1616 |
aMenu isCollection ifTrue:[menu := aMenu decodeAsLiteralArray] |
|
1617 |
ifFalse:[menu := aMenu]. |
|
1618 |
||
1619 |
self valueOfEnablingCommitButtons value:false. |
|
1620 |
root := listOfItems root. |
|
1621 |
||
1622 |
self withoutNotifyDo:[ |
|
1623 |
selectionHolder setValue:#(). |
|
1624 |
root menu:aMenu labeled:(aSelector ? specSelector). |
|
1625 |
]. |
|
1626 |
self selectedItem:root. |
|
734 | 1627 |
self updateHistory. |
1628 |
! |
|
1629 |
||
1244 | 1630 |
buildFromResourceSpec:aResourceSpec |
1606 | 1631 |
"rebuild menu from a resource spec |
1632 |
" |
|
1633 |
self buildFromMenu:aResourceSpec selector:nil |
|
728 | 1634 |
! ! |
1635 |
||
199 | 1636 |
!MenuEditor methodsFor:'change & update'! |
1637 |
||
1606 | 1638 |
selectedSuperItems |
1639 |
"returns collection of superItems derived from selection |
|
1640 |
" |
|
1641 |
|selection size root| |
|
1642 |
||
1643 |
selectedSuperItems ifNotNil:[ ^ selectedSuperItems ]. |
|
1644 |
||
1645 |
selection := selectionHolder value. |
|
1646 |
size := selection size. |
|
1647 |
||
1648 |
size <= 1 ifTrue:[ |
|
1649 |
selectedSuperItems := selection ? #(). |
|
1650 |
^ selectedSuperItems |
|
1651 |
]. |
|
1652 |
||
1653 |
root := listOfItems root. |
|
1654 |
||
1655 |
(selection includesIdentical:root) ifTrue:[ |
|
1656 |
selectedSuperItems := Array with:root. |
|
1657 |
^ selectedSuperItems |
|
1658 |
]. |
|
1659 |
selectedSuperItems := OrderedCollection new. |
|
1660 |
||
1661 |
selection do:[:anItem| |
|
1662 |
anItem parentsDetect:[:el| selection includesIdentical:el ] |
|
1663 |
ifNone:[ selectedSuperItems add:anItem ]. |
|
1664 |
]. |
|
1665 |
^ selectedSuperItems |
|
1666 |
! |
|
1667 |
||
1668 |
selectionChanged |
|
1669 |
"called if the selection has changed |
|
1670 |
" |
|
1671 |
|newTabList selection| |
|
1672 |
||
1673 |
selection := selectionHolder value. |
|
1674 |
||
1675 |
selection size == 1 ifTrue:[ |
|
1676 |
selectedSuperItems := selection. |
|
1677 |
||
1678 |
newTabList := selection first slices collect:[:el| ' ', el first, ' ' ]. |
|
1679 |
newTabList = listOfTabs ifFalse:[ |
|
1680 |
listOfTabs contents:newTabList. |
|
1681 |
]. |
|
1682 |
] ifFalse:[ |
|
1683 |
"must compute selected super items on request |
|
1684 |
" |
|
1685 |
selectedSuperItems := nil. |
|
1686 |
]. |
|
1687 |
self cancel. |
|
1688 |
self tabChanged. |
|
1689 |
self updateChannels. |
|
1690 |
! |
|
1691 |
||
1692 |
tabChanged |
|
1693 |
"called if the tab changed |
|
1694 |
" |
|
1695 |
|tab selector item canvas wizardHolder| |
|
1696 |
||
1697 |
wizardHolder := self wizardHolder. |
|
1698 |
item := self selectedItem. |
|
1699 |
item ifNil:[ ^ wizardHolder value:nil ]. |
|
1700 |
||
1701 |
tab := tabHolder value. |
|
1702 |
||
1703 |
tab ifNotNil:[ |
|
1704 |
tab := tab withoutSeparators. |
|
1705 |
tab := item slices detect:[:el| el first = tab ] ifNone:nil. |
|
1706 |
]. |
|
1707 |
tab ifNil:[ |
|
1708 |
^ tabHolder value:( listOfTabs at:1 ifAbsent:nil ) |
|
1709 |
]. |
|
1710 |
selector := tab last. |
|
1711 |
||
1712 |
selector == #help ifTrue:[ ^ wizardHolder value:(self helpTool window) ]. |
|
1713 |
selector == #image ifTrue:[ ^ wizardHolder value:(self imageTool window) ]. |
|
1714 |
||
1715 |
canvas := wizards at:(item class name, selector) asSymbol |
|
1716 |
ifAbsentPut:[ SimpleView new client:self |
|
1717 |
spec:(item class perform:selector) |
|
1718 |
builder:(self builder) |
|
1719 |
]. |
|
1720 |
||
1721 |
wizardHolder value:canvas. |
|
1722 |
! |
|
1723 |
||
970 | 1724 |
update:something with:aParameter from:changedObject |
1606 | 1725 |
"Invoked when an object that I depend upon sends a change notification. |
1726 |
" |
|
1727 |
notifyDisabledCounter ~~ 0 ifTrue:[ ^ self ]. |
|
1728 |
||
1729 |
changedObject == selectionHolder ifTrue:[ ^ self selectionChanged ]. |
|
1730 |
changedObject == tabHolder ifTrue:[ ^ self tabChanged ]. |
|
1731 |
||
1732 |
super update:something with:aParameter from:changedObject |
|
970 | 1733 |
! |
1734 |
||
748 | 1735 |
updateChannels |
1606 | 1736 |
"update all channels |
1737 |
" |
|
1738 |
|selection sizeOfSel selectedItem| |
|
1739 |
||
1740 |
super updateChannels. |
|
1741 |
||
1742 |
selection := selectionHolder value. |
|
1743 |
sizeOfSel := selection size. |
|
1744 |
||
1745 |
sizeOfSel == 1 ifTrue:[selectedItem := selection at:1] |
|
1746 |
ifFalse:[selectedItem := nil]. |
|
1747 |
||
1748 |
self hasSelectionChannel value:(sizeOfSel ~~ 0). |
|
1749 |
self hasSingleSelectionChannel value:(selectedItem notNil). |
|
1750 |
||
1751 |
selectedItem isNil ifTrue:[ |
|
1752 |
self valueOfEnableMovingIn value:false. |
|
1753 |
self valueOfEnableMovingOut value:false. |
|
1754 |
self valueOfEnableMovingUpOrDown value:false. |
|
1755 |
self valueOfEnableMovingInAbove value:false. |
|
1756 |
self canCreateDelayedMenuChannel value:false. |
|
1244 | 1757 |
] ifFalse:[ |
1606 | 1758 |
self valueOfEnableMovingUpOrDown value:(selectedItem canMoveUpOrDown). |
1759 |
self valueOfEnableMovingOut value:(selectedItem canMoveOut). |
|
1760 |
self valueOfEnableMovingIn value:(selectedItem canMoveInNext). |
|
1761 |
self valueOfEnableMovingInAbove value:(selectedItem canMoveInAbove). |
|
1762 |
self canCreateDelayedMenuChannel value:(selectedItem canAddDelayedMenu). |
|
902 | 1763 |
]. |
220 | 1764 |
! ! |
1765 |
||
1617 | 1766 |
!MenuEditor methodsFor:'code generation'! |
1767 |
||
1768 |
createActionMethodFor:aSelector in:aClass category:aCategory redefine:redefine |
|
1769 |
|alreadyInSuperclass numArgs method code| |
|
1770 |
||
1771 |
(aClass includesSelector:aSelector) ifTrue:[ |
|
1772 |
^ nil |
|
1773 |
]. |
|
1774 |
||
1775 |
alreadyInSuperclass := aClass superclass canUnderstand:aSelector. |
|
1776 |
||
1777 |
(alreadyInSuperclass and:[redefine not]) ifTrue:[ |
|
1778 |
^ nil |
|
1779 |
]. |
|
1780 |
||
1781 |
numArgs := aSelector numArgs. |
|
1782 |
||
1783 |
numArgs == 1 ifTrue:[ |
|
1784 |
method := aSelector, 'anArgument'. |
|
1785 |
] ifFalse:[ |
|
1786 |
numArgs == 0 ifTrue:[ |
|
1787 |
method := aSelector |
|
1788 |
] ifFalse:[ |
|
1789 |
method := ''. |
|
1790 |
aSelector keywords keysAndValuesDo:[:i :key| |
|
1791 |
method := method, key, 'arg', i printString, ' '. |
|
1792 |
]. |
|
1793 |
] |
|
1794 |
]. |
|
1795 |
||
1796 |
code := '%1 |
|
1797 |
"automatically generated by UIEditor ..." |
|
1798 |
||
1799 |
"*** the code below performs no action" |
|
1800 |
"*** (except for some feedback on the Transcript)" |
|
1801 |
"*** Please change as required and accept in the browser." |
|
1802 |
"*** (and replace this comment by something more useful ;-)" |
|
1803 |
||
1804 |
"action to be added ..." |
|
1805 |
||
1806 |
Transcript showCR:self class name, '': action for #%2 ...''. |
|
1807 |
' bindWith:method with:aSelector. |
|
1808 |
||
1809 |
alreadyInSuperclass ifTrue:[ |
|
1810 |
code := code, (('\ super %1\' bindWith:method) withCRs). |
|
1811 |
]. |
|
1812 |
CodeGeneratorTool compile:code forClass:aClass inCategory:(aCategory ? 'actions'). |
|
1813 |
^ code |
|
1814 |
! |
|
1815 |
||
1816 |
createAspectMethodFor:anAspect in:aClass category:aCategory redefine:redefine |
|
1817 |
|alreadyInSuperclass numArgs method code text| |
|
1818 |
||
1819 |
(aClass includesSelector:anAspect) ifTrue:[ |
|
1820 |
^ nil |
|
1821 |
]. |
|
1822 |
||
1823 |
alreadyInSuperclass := aClass superclass canUnderstand:anAspect. |
|
1824 |
||
1825 |
(alreadyInSuperclass and:[redefine not]) ifTrue:[ |
|
1826 |
^ nil |
|
1827 |
]. |
|
1828 |
||
1829 |
numArgs := anAspect numArgs. |
|
1830 |
||
1831 |
numArgs == 1 ifTrue:[ |
|
1832 |
method := anAspect, 'anArgument'. |
|
1833 |
] ifFalse:[ |
|
1834 |
numArgs == 0 ifTrue:[ |
|
1835 |
method := anAspect |
|
1836 |
] ifFalse:[ |
|
1837 |
method := ''. |
|
1838 |
anAspect keywords keysAndValuesDo:[:i :key| |
|
1839 |
method := method, key, 'arg', i printString, ' '. |
|
1840 |
]. |
|
1841 |
] |
|
1842 |
]. |
|
1843 |
||
1844 |
code := '%1 |
|
1845 |
"automatically generated by UIEditor ..." |
|
1846 |
||
1847 |
"*** the code below creates a default model when invoked" |
|
1848 |
"*** (which may not be the one you wanted)" |
|
1849 |
"*** Please change as required and accept in the browser." |
|
1850 |
"*** (and replace this comment by something more useful ;-)" |
|
1851 |
||
1852 |
"aspect to be added ..." |
|
1853 |
||
1854 |
Transcript showCR:self class name, '': aspect for #%2 ...''. |
|
1855 |
||
1856 |
' bindWith:method with:anAspect. |
|
1857 |
||
1858 |
alreadyInSuperclass ifTrue:[ |
|
1859 |
text := ' ^ super %1\' bindWith:method. |
|
1860 |
] ifFalse:[ |
|
1861 |
text := ' ^ builder valueAspectFor:#''%1'' initialValue:true\' bindWith:anAspect. |
|
1862 |
]. |
|
1863 |
code := code, (text withCRs). |
|
1864 |
CodeGeneratorTool compile:code forClass:aClass inCategory:(aCategory ? 'actions'). |
|
1865 |
^ code |
|
1866 |
! ! |
|
1867 |
||
916 | 1868 |
!MenuEditor methodsFor:'defaults'! |
1869 |
||
1870 |
aboutImage |
|
1871 |
"the image to be displayed in my about-box; |
|
1606 | 1872 |
If nil is returned, the ST/X default image is used. |
1244 | 1873 |
" |
1606 | 1874 |
^ self class aboutImage |
1875 |
! ! |
|
1876 |
||
1877 |
!MenuEditor methodsFor:'drag & drop'! |
|
1878 |
||
1879 |
canDrop:aContext |
|
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1880 |
"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
|
1881 |
The dropable objects are already validated by: #dropEnter: |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1882 |
" |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1883 |
^ (dropOverLine notNil and:[dropOverLine ~~ 0]) |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1884 |
! |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1885 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1886 |
changeDropLineTo:aLineOrNil in:aContext |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1887 |
"the over dropLine changed; redraw drop indication stuff |
1244 | 1888 |
" |
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1889 |
|x0 x1 y0| |
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 |
aLineOrNil == dropOverLine ifTrue:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1892 |
^ self. "/ nothing changed |
1244 | 1893 |
]. |
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1894 |
x0 := listOfItemsView margin + 2. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1895 |
x1 := listOfItemsView width - x0. |
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 |
"/ 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
|
1898 |
aContext contentsWillChange. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1899 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1900 |
(dropOverLine notNil and:[dropOverLine ~~ 0]) ifTrue:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1901 |
"/ restore old draw |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1902 |
y0 := listOfItemsView yVisibleOfLine:(dropOverLine + 1). |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1903 |
y0 := y0 - 3. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1904 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1905 |
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
|
1906 |
repairNow:true. |
1606 | 1907 |
]. |
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1908 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1909 |
dropOverLine := aLineOrNil. |
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 |
(dropOverLine notNil and:[dropOverLine ~~ 0]) ifTrue:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1912 |
"/ highlight new drop target |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1913 |
y0 := listOfItemsView yVisibleOfLine:(dropOverLine + 1). |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1914 |
y0 := y0 - 3. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1915 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1916 |
listOfItemsView paint:(Color white). |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1917 |
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
|
1918 |
y0 := y0 + 1. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1919 |
listOfItemsView paint:(Color black). |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1920 |
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
|
1921 |
]. |
1606 | 1922 |
! |
1923 |
||
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1924 |
doDrop:aContext |
1606 | 1925 |
"drop the DropContext into the hierachical list of items |
1244 | 1926 |
" |
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1927 |
|done item| |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1928 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1929 |
dropOverLine ifNil:[^ false ]. "/ context not valid to me ... |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1930 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1931 |
item := listOfItems at:dropOverLine ifAbsent:nil. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1932 |
self dropLeave:aContext. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1933 |
item ifNil:[^ false]. |
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 |
selectionHolder setValue:(Array with:item). |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1936 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1937 |
done := false. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1938 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1939 |
self addAndSelect:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1940 |
done := true. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1941 |
aContext dropObjects collect:[:el| Item menuItem:(el theObject) ] |
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 |
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 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1946 |
dropEnter:aContext |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1947 |
"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
|
1948 |
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
|
1949 |
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
|
1950 |
" |
1606 | 1951 |
|objects| |
1952 |
||
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1953 |
dropOverLine := nil. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1954 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1955 |
self valueOfEnablingCommitButtons value ifTrue:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1956 |
"/ 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
|
1957 |
^ self |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1958 |
]. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1959 |
objects := aContext dropObjects. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1960 |
objects isEmpty ifTrue:[ ^ self ]. "/ nothing to drop ??? |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1961 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1962 |
"/ 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
|
1963 |
objects do:[:el| |
1633 | 1964 |
(el theObject askFor:#isMenuItem) ifFalse:[ |
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1965 |
"/ contains none-dropable objects |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1966 |
^ self |
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 |
]. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1969 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1970 |
"/ ok, the contents is dropable |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1971 |
dropOverLine := 0. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1972 |
! |
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 |
dropLeave:aContext |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1975 |
"the widget is leaved; restore drop indications drawn ... |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1976 |
" |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1977 |
self changeDropLineTo:nil in:aContext. |
879 | 1978 |
! |
1979 |
||
1606 | 1980 |
dropObjects |
1981 |
"returns list of DropObjects |
|
1982 |
" |
|
1983 |
|obj items| |
|
1984 |
||
1985 |
items := self selectedSuperItems. |
|
1986 |
items isEmpty ifTrue:[ ^ nil ]. |
|
1987 |
||
1988 |
^ items collect:[:el| |
|
1989 |
obj := DropObject new:(el menuItem). |
|
1990 |
obj displayObject:(el rawLabel). |
|
1991 |
obj |
|
199 | 1992 |
]. |
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1993 |
! |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1994 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1995 |
dropOver:aContext |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1996 |
"called during drag & drop over the widget |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1997 |
compute new drop target source |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1998 |
" |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
1999 |
|lnNr item| |
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 |
dropOverLine ifNil:[^ self ]. "/ context not valid to me ... |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2002 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2003 |
lnNr := listOfItemsView yVisibleToLineNr:(aContext targetPoint y). |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2004 |
item := nil. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2005 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2006 |
lnNr ifNotNil:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2007 |
item := listOfItems at:lnNr ifAbsent:nil. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2008 |
item ifNotNil:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2009 |
(item isAction and:[item hasDelayedMenu]) ifTrue:[ |
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 |
] |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2013 |
]. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2014 |
item ifNil:[ lnNr := 0 ]. "/ not dropable for item |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2015 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2016 |
"/ redraw drop indication |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2017 |
self changeDropLineTo:lnNr in:aContext. |
1606 | 2018 |
! ! |
2019 |
||
2020 |
!MenuEditor methodsFor:'event processing'! |
|
2021 |
||
2022 |
processEvent:anEvent |
|
2023 |
"filter keyboard edit-events typed into the listOfItemsView |
|
1244 | 2024 |
" |
1606 | 2025 |
|evView inView rawKey key| |
2026 |
||
2027 |
anEvent isKeyPressEvent ifFalse:[^ false]. |
|
2028 |
||
2029 |
evView := anEvent targetView. |
|
2030 |
evView ifNil:[ ^ false ]. |
|
2031 |
||
2032 |
inView := evView isSameOrComponentOf:listOfItemsView. |
|
2033 |
inView ifFalse:[^ false]. |
|
2034 |
||
2035 |
key := anEvent key. |
|
2036 |
rawKey := anEvent rawKey. |
|
2037 |
||
2038 |
( key == #Delete |
|
2039 |
or:[key == #BackSpace |
|
2040 |
or:[key == #Cut]] |
|
2041 |
) ifTrue:[ |
|
2042 |
self doCut. |
|
2043 |
^ true. |
|
199 | 2044 |
]. |
1256
38ff328f119b
care for hidden editFields with acceptChannel
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
2045 |
|
1606 | 2046 |
key == #Copy ifTrue:[ self doCopy. ^ true ]. |
2047 |
key == #Paste ifTrue:[ self doPaste. ^ true ]. |
|
2048 |
||
2049 |
^ false |
|
2050 |
! ! |
|
2051 |
||
2052 |
!MenuEditor methodsFor:'initialization & release'! |
|
2053 |
||
2054 |
closeRequest |
|
2055 |
"ask for modification |
|
2056 |
" |
|
2057 |
self valueOfEnablingCommitButtons value ifTrue:[ |
|
2058 |
modified := true. |
|
2059 |
self askForListModification. |
|
2060 |
modified ifTrue:[^ self]. |
|
2061 |
self clearModified. |
|
1301 | 2062 |
]. |
1606 | 2063 |
^ super closeRequest |
2064 |
! |
|
199 | 2065 |
|
738 | 2066 |
initialize |
1606 | 2067 |
"setup aspects, ... |
2068 |
" |
|
738 | 2069 |
super initialize. |
1606 | 2070 |
notifyDisabledCounter := 0. |
2071 |
||
2072 |
Item withAllSubclasses do:[:aClass| |
|
2073 |
aClass addBindingsTo:aspects for:self. |
|
2074 |
]. |
|
2075 |
||
2076 |
selectionHolder := #() asValue. |
|
2077 |
selectionHolder addDependent:self. |
|
2078 |
||
2079 |
listOfItems := HierarchicalList new. |
|
2080 |
listOfItems application:self. |
|
1631 | 2081 |
listOfItems root:(RootItem new). |
1606 | 2082 |
|
2083 |
tabHolder := nil asValue. |
|
2084 |
tabHolder addDependent:self. |
|
2085 |
||
2086 |
listOfTabs := List new. |
|
2087 |
wizards := IdentityDictionary new. |
|
738 | 2088 |
! |
2089 |
||
1606 | 2090 |
openModalOnMenu:aMenu |
2091 |
"build a tree from aMenu and open it modal |
|
2092 |
" |
|
2093 |
self openModalOnResourceSpec:aMenu |
|
2094 |
! |
|
2095 |
||
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2096 |
postBuildListOfItemsView:aSrollableView |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2097 |
listOfItemsView := aSrollableView scrolledView. |
1250 | 2098 |
! |
2099 |
||
2100 |
postOpenWith:aBuilder |
|
2101 |
"reset keyboardProcessor for menuBar |
|
2102 |
" |
|
2103 |
super postOpenWith: aBuilder. |
|
2104 |
aBuilder keyboardProcessor menuBar:nil. |
|
1606 | 2105 |
self windowGroup addPreEventHook:self. |
199 | 2106 |
! ! |
2107 |
||
1606 | 2108 |
!MenuEditor methodsFor:'private'! |
2109 |
||
2110 |
addAndSelect:aNoneArgBlockOrItem |
|
2111 |
"add an item(s) derived from the block; test if add operation |
|
2112 |
is enabled. On success the new item(s) are returned otherwise nil. |
|
2113 |
" |
|
2114 |
|intoItem index newItem| |
|
2115 |
||
2116 |
intoItem := self selectedItem. |
|
2117 |
intoItem ifNil:[ ^ nil]. |
|
2118 |
||
2119 |
self askForItemModification ifFalse:[ ^ nil ]. |
|
2120 |
||
2121 |
index := 1. |
|
2122 |
||
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2123 |
(intoItem canAddChildren and:[intoItem isExpanded]) ifFalse:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2124 |
[ intoItem parent canAddChildren ] whileFalse:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2125 |
intoItem := intoItem parent. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2126 |
]. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2127 |
index := intoItem parent identityIndexOf:intoItem. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2128 |
index := index + 1. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2129 |
intoItem := intoItem parent. |
1606 | 2130 |
]. |
2131 |
newItem := aNoneArgBlockOrItem value. |
|
2132 |
||
2133 |
newItem ifNotNil:[ |
|
1618
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2134 |
selectionHolder setValue:nil. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2135 |
intoItem expand. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2136 |
|
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2137 |
newItem isCollection ifTrue:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2138 |
intoItem addAll:newItem beforeIndex:index. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2139 |
selectionHolder value:newItem. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2140 |
] ifFalse:[ |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2141 |
intoItem add:newItem beforeIndex:index. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2142 |
selectionHolder value:(Array with:newItem). |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2143 |
]. |
9c9b649ce251
support drag & drop inside my widget (highlight the drop target)
ca
parents:
1617
diff
changeset
|
2144 |
modified := true. |
1606 | 2145 |
]. |
2146 |
^ newItem |
|
407 | 2147 |
! |
2148 |
||
1606 | 2149 |
clearModified |
2150 |
"clear the modifiedChannel and the commitPanel |
|
2151 |
" |
|
1244 | 2152 |
self valueOfEnablingCommitButtons value:false. |
1189
0e7e286f864c
code cleanup; care for non-string argument
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
2153 |
self clearModifiedFlag. |
407 | 2154 |
! |
2155 |
||
1606 | 2156 |
generateMenuSpec |
2157 |
"generate and returns the current menu spec or nil |
|
2158 |
" |
|
2159 |
|menu spec| |
|
2160 |
||
2161 |
menu := listOfItems root submenu. |
|
2162 |
menu ifNil:[^ nil]. |
|
2163 |
menu := menu literalArrayEncoding. |
|
2164 |
spec := WriteStream on:String new. |
|
2165 |
UISpecification prettyPrintSpecArray:menu on:spec indent:5. |
|
2166 |
^ spec contents. |
|
2167 |
! |
|
2168 |
||
2169 |
submenuTest |
|
2170 |
"returns a menu on the current editing menu |
|
2171 |
" |
|
2172 |
|menu indication choice submenu retriever| |
|
2173 |
||
2174 |
menu := listOfItems root submenu. |
|
2175 |
menu ifNil:[^ nil ]. |
|
2176 |
||
2177 |
menu allItemsDo:[:anItem| |
|
2178 |
anItem isVisible:true. |
|
2179 |
anItem enabled:true. |
|
2180 |
anItem translateLabel:false. |
|
2181 |
||
1629 | 2182 |
anItem itemValue notNil ifTrue:[ |
2183 |
anItem itemValue:[ Transcript showCR:(anItem label) ]. |
|
1606 | 2184 |
]. |
1629 | 2185 |
anItem indication notNil ifTrue:[ |
2186 |
indication isNil ifTrue:[ indication := true asValue ]. |
|
1606 | 2187 |
anItem indication:indication |
2188 |
]. |
|
1629 | 2189 |
anItem choice notNil ifTrue:[ |
2190 |
choice isNil ifTrue:[ choice := anItem choiceValue asValue ]. |
|
1606 | 2191 |
anItem choice:choice |
2192 |
]. |
|
2193 |
||
1629 | 2194 |
anItem submenuChannel notNil ifTrue:[ |
1606 | 2195 |
anItem submenuChannel:nil. |
1629 | 2196 |
anItem submenu isNil ifTrue:[ |
2197 |
submenu isNil ifTrue:[ |
|
1606 | 2198 |
submenu := Menu new. |
2199 |
submenu addItem:(MenuItem labeled:'Linked Menu...'). |
|
2200 |
]. |
|
2201 |
anItem submenu:submenu. |
|
1020
dcfbf3acb037
added browsing capability to image section.
Claus Gittinger <cg@exept.de>
parents:
1007
diff
changeset
|
2202 |
]. |
1606 | 2203 |
]. |
2204 |
retriever := anItem resourceRetriever. |
|
1629 | 2205 |
retriever notNil ifTrue:[ |
2206 |
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
|
2207 |
]. |
dcfbf3acb037
added browsing capability to image section.
Claus Gittinger <cg@exept.de>
parents:
1007
diff
changeset
|
2208 |
]. |
1606 | 2209 |
menu findGuiResourcesIn:(self resolveName:specClass). |
2210 |
^ menu |
|
1020
dcfbf3acb037
added browsing capability to image section.
Claus Gittinger <cg@exept.de>
parents:
1007
diff
changeset
|
2211 |
! |
dcfbf3acb037
added browsing capability to image section.
Claus Gittinger <cg@exept.de>
parents:
1007
diff
changeset
|
2212 |
|
1606 | 2213 |
withoutNotifyDo:aBlock |
2214 |
"evaluate the block; all change notifications are |
|
2215 |
discard during the block is evaluated. |
|
2216 |
" |
|
2217 |
|blockResult| |
|
2218 |
||
2219 |
[ notifyDisabledCounter := notifyDisabledCounter + 1. |
|
2220 |
blockResult := aBlock value. |
|
2221 |
] valueNowOrOnUnwindDo:[ |
|
2222 |
notifyDisabledCounter := notifyDisabledCounter - 1 |
|
2223 |
]. |
|
2224 |
^ blockResult |
|
2225 |
! ! |
|
2226 |
||
2227 |
!MenuEditor methodsFor:'queries'! |
|
2228 |
||
2229 |
hasValidSpecClass |
|
2230 |
"returns true if a valid specClass exists |
|
2231 |
" |
|
2232 |
|cls| |
|
2233 |
||
2234 |
specClass ifNil:[^ false]. |
|
2235 |
cls := self resolveName:specClass. |
|
2236 |
^ cls notNil |
|
2237 |
! ! |
|
2238 |
||
2239 |
!MenuEditor methodsFor:'selection'! |
|
2240 |
||
2241 |
canSelect:anIndex |
|
2242 |
"called whenever the selection changed; test whether |
|
2243 |
current item is not modified .... |
|
2244 |
" |
|
2245 |
|oldSelectedItem newSelectedItem| |
|
2246 |
||
2247 |
self valueOfEnablingCommitButtons value ifFalse:[ |
|
2248 |
^ true |
|
2249 |
]. |
|
2250 |
oldSelectedItem := self selectedItem. |
|
2251 |
oldSelectedItem ifNil:[^ true]. |
|
2252 |
||
2253 |
newSelectedItem := listOfItems at:anIndex ifAbsent:nil. |
|
2254 |
oldSelectedItem == newSelectedItem ifTrue:[ |
|
2255 |
^ true |
|
2256 |
]. |
|
2257 |
^ self askForItemModification |
|
879 | 2258 |
! |
2259 |
||
1610
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
2260 |
hasSelection |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
2261 |
"returns true if a selection exists |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
2262 |
" |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
2263 |
^ selectionHolder value size ~~ 0 |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
2264 |
! |
cb3e093aa6d5
if after collapse no selection exists, use the collapsed element
ca
parents:
1609
diff
changeset
|
2265 |
|
1606 | 2266 |
selectedItem |
2267 |
"returns the selected item or nil (none or multiple selected) |
|
2268 |
" |
|
2269 |
|selection| |
|
2270 |
||
2271 |
selection := selectionHolder value. |
|
2272 |
selection size == 1 ifTrue:[ ^ selection first ]. |
|
2273 |
^ nil |
|
2274 |
! |
|
2275 |
||
2276 |
selectedItem:anItem |
|
2277 |
"change selection to an item |
|
2278 |
" |
|
2279 |
|selection| |
|
2280 |
||
2281 |
anItem notNil ifTrue:[ selection := Array with:anItem ] |
|
2282 |
ifFalse:[ selection := #() ]. |
|
2283 |
||
2284 |
selectionHolder value:selection. |
|
2285 |
! ! |
|
2286 |
||
1614 | 2287 |
!MenuEditor methodsFor:'user actions - aspects'! |
2288 |
||
2289 |
collectActionSelectors |
|
2290 |
|selectors| |
|
2291 |
||
2292 |
selectors := IdentitySet new. |
|
2293 |
||
2294 |
listOfItems root recursiveDo:[:el| |
|
2295 |
el actionSelectors do:[:s| selectors add:s ]. |
|
2296 |
]. |
|
2297 |
^ selectors asOrderedCollection |
|
2298 |
! |
|
2299 |
||
2300 |
collectAspectSelectors |
|
2301 |
|selectors| |
|
2302 |
||
2303 |
selectors := IdentitySet new. |
|
2304 |
||
2305 |
listOfItems root recursiveDo:[:el| |
|
2306 |
el aspectSelectors do:[:s| selectors add:s ]. |
|
2307 |
]. |
|
2308 |
^ selectors asOrderedCollection |
|
2309 |
! |
|
2310 |
||
2311 |
doGenerateAspectMethods |
|
2312 |
"genearte aspect messages |
|
2313 |
" |
|
1617 | 2314 |
|cls redefineAspectMethods| |
1614 | 2315 |
|
2316 |
specClass ifNil:[ |
|
2317 |
self warn:'Define the class first !!'. |
|
2318 |
^ self |
|
2319 |
]. |
|
1617 | 2320 |
redefineAspectMethods := self redefineAspectMethodsChannel value. |
1614 | 2321 |
|
2322 |
cls := self resolveName:specClass. |
|
2323 |
cls ifNil:[ |
|
2324 |
self warn:'Class ', specClass asString, ' does not exist!!'. |
|
2325 |
^ self |
|
2326 |
]. |
|
1617 | 2327 |
|
2328 |
self collectActionSelectors do:[:aSelector| |
|
2329 |
self createActionMethodFor:aSelector |
|
2330 |
in:cls |
|
2331 |
category:'menu - actions' |
|
2332 |
redefine:redefineAspectMethods. |
|
1614 | 2333 |
]. |
1617 | 2334 |
|
2335 |
self collectAspectSelectors do:[:anAspect| |
|
2336 |
self createAspectMethodFor:anAspect |
|
2337 |
in:cls |
|
2338 |
category:'menu - aspects' |
|
2339 |
redefine:redefineAspectMethods |
|
1614 | 2340 |
]. |
2341 |
! ! |
|
2342 |
||
1606 | 2343 |
!MenuEditor methodsFor:'user actions - building'! |
2344 |
||
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2345 |
doNew |
1606 | 2346 |
"clear editing menu; start from scratch |
2347 |
" |
|
2348 |
super doNew ifTrue:[ self helpTool doNew ]. |
|
199 | 2349 |
! |
2350 |
||
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2351 |
doPickAMenu |
1606 | 2352 |
"pick a menu from user |
2353 |
" |
|
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2354 |
|view| |
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2355 |
|
1244 | 2356 |
self askForModification ifTrue:[ |
1606 | 2357 |
( (view := Screen current viewFromUser) isNil |
2358 |
or:[view == Screen current rootView] |
|
2359 |
) ifTrue:[ |
|
1244 | 2360 |
^ self |
2361 |
]. |
|
2362 |
view specClass == MenuPanelSpec ifTrue:[ |
|
1606 | 2363 |
specSelector := #pickedMenu. |
2364 |
^ self buildFromMenu:(view asMenu) selector:specSelector. |
|
1244 | 2365 |
]. |
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2366 |
]. |
888 | 2367 |
! |
2368 |
||
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2369 |
doSave |
1606 | 2370 |
"save current editing menu to |
2371 |
class: specClass |
|
2372 |
selector: specSelector |
|
2373 |
" |
|
2374 |
|cls spec mthd category code excla| |
|
199 | 2375 |
|
642 | 2376 |
super doSave ifFalse: [^nil]. |
1606 | 2377 |
spec := self generateMenuSpec. |
2378 |
spec ifNil:[^ nil]. |
|
2379 |
||
2380 |
cls := self resolveName:specClass. |
|
199 | 2381 |
|
2382 |
"/ if that method already exists, do not overwrite the category |
|
2383 |
||
576 | 2384 |
category := 'menu specs'. |
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2385 |
(mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[ |
199 | 2386 |
category := mthd category. |
2387 |
]. |
|
2388 |
||
764 | 2389 |
excla := Character excla asString. |
2390 |
||
2391 |
code := excla |
|
654
45cc74ba1113
simplified comma-expression to make microsoft-cc happy
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2392 |
, (cls name , ' class methodsFor:' , category storeString) |
764 | 2393 |
, excla , '\\' |
199 | 2394 |
|
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2395 |
, specSelector , '\' |
738 | 2396 |
, (self class codeGenerationComment replChar:$!! withString:'!!!!') |
2397 |
, '\\ "\' |
|
654
45cc74ba1113
simplified comma-expression to make microsoft-cc happy
Claus Gittinger <cg@exept.de>
parents:
642
diff
changeset
|
2398 |
, (' 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
|
2399 |
, (' (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , specSelector , ')) startUp\') |
199 | 2400 |
, ' "\'. |
2401 |
||
2402 |
code := code |
|
2403 |
, '\' |
|
2404 |
, ' <resource: #menu>\\' |
|
1083 | 2405 |
, ' ^ ' , spec |
199 | 2406 |
, '\' |
764 | 2407 |
, (excla , ' ' , excla) |
199 | 2408 |
, '\\'. |
2409 |
||
2410 |
code := code withCRs. |
|
2411 |
(ReadStream on:code) fileIn. |
|
2412 |
||
764 | 2413 |
self isStandAlone ifTrue: [self helpTool installHelpSpecsOnClass:self specClass]. |
699 | 2414 |
|
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2415 |
self updateHistory. |
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2416 |
hasSaved := true. |
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2417 |
modified := false. |
199 | 2418 |
! |
2419 |
||
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2420 |
doSaveAs |
1606 | 2421 |
"save current editing menu to class and selector |
2422 |
defined by the user. |
|
2423 |
" |
|
2424 |
super doSaveAs ifTrue:[ |
|
2425 |
listOfItems root rawLabel:specSelector |
|
2426 |
]. |
|
2427 |
! |
|
2428 |
||
2429 |
doShowMenuSpec |
|
2430 |
"opens a code view with the contents of the menu spec |
|
2431 |
" |
|
2432 |
|spec| |
|
2433 |
||
2434 |
spec := self generateMenuSpec. |
|
2435 |
||
2436 |
spec ifNotNil:[ |
|
2437 |
CodeView openWith:spec title: 'Menu Spec' |
|
2438 |
]. |
|
2439 |
! ! |
|
2440 |
||
2441 |
!MenuEditor methodsFor:'user actions - creation'! |
|
2442 |
||
2443 |
doCreateDelayedMenu:what |
|
2444 |
|selectedItem delayedItem| |
|
2445 |
||
2446 |
selectedItem := self selectedItem. |
|
2447 |
selectedItem ifNil:[^ self]. |
|
2448 |
||
2449 |
selectedItem canAddDelayedMenu ifFalse:[ ^ self ]. |
|
2450 |
self askForItemModification ifFalse:[ ^ self ]. |
|
2451 |
||
1633 | 2452 |
what == #menu ifTrue:[ delayedItem := RegularMenuItem new ] |
1631 | 2453 |
ifFalse:[ delayedItem := LinkedMenuItem new ]. |
1606 | 2454 |
|
2455 |
delayedItem setExpanded:true. |
|
2456 |
delayedItem := selectedItem add:delayedItem. |
|
2457 |
||
2458 |
delayedItem ifNotNil:[ |
|
2459 |
self selectedItem:delayedItem. |
|
2460 |
]. |
|
2461 |
! |
|
2462 |
||
2463 |
doCreateItem |
|
2464 |
"create a new Item |
|
2465 |
" |
|
1631 | 2466 |
self addAndSelect:[ ActionItem new translateLabel:true ]. |
1606 | 2467 |
! |
2468 |
||
2469 |
doCreateLinkedMenu |
|
2470 |
"create a new Linked Menu |
|
2471 |
" |
|
1631 | 2472 |
self addAndSelect:[ LinkedMenuItem new ]. |
1606 | 2473 |
! |
2474 |
||
2475 |
doCreateMenu |
|
2476 |
"create a new Menu |
|
2477 |
" |
|
2478 |
self addAndSelect:[ |item| |
|
1633 | 2479 |
item := RegularMenuItem new. |
1631 | 2480 |
item expand. |
2481 |
item |
|
1606 | 2482 |
]. |
2483 |
! |
|
2484 |
||
2485 |
doCreateSep |
|
2486 |
"create a new Separator Item |
|
2487 |
" |
|
1631 | 2488 |
self addAndSelect:[ SeparatorItem new ]. |
1606 | 2489 |
! |
2490 |
||
2491 |
doCreateStandardEditMenu |
|
2492 |
"create a standart edit menu |
|
2493 |
" |
|
2494 |
self addAndSelect:[ |
|
1633 | 2495 |
RegularMenuItem menu:(self class standardEditMenu) labeled:'Edit' translateLabel:true |
1606 | 2496 |
]. |
218 | 2497 |
! |
199 | 2498 |
|
1606 | 2499 |
doCreateStandardFileMenu |
2500 |
"create a standart file menu |
|
2501 |
" |
|
2502 |
self addAndSelect:[ |
|
1633 | 2503 |
RegularMenuItem menu:(self class standardFileMenu) labeled:'File' translateLabel:true |
1606 | 2504 |
]. |
2505 |
! |
|
2506 |
||
2507 |
doCreateStandardHelpMenu |
|
2508 |
"create a standart help menu |
|
2509 |
" |
|
2510 |
|item| |
|
2511 |
||
2512 |
self addAndSelect:[ |
|
1633 | 2513 |
item := RegularMenuItem menu:(self class standardHelpMenu) labeled:'Help' translateLabel:true. |
1631 | 2514 |
item aspectAt:#startGroup put:#right. |
2515 |
item |
|
1606 | 2516 |
]. |
2517 |
! ! |
|
2518 |
||
2519 |
!MenuEditor methodsFor:'user actions - editing'! |
|
2520 |
||
2521 |
doCopy |
|
2522 |
"copy selected menuItems to the clipboard |
|
2523 |
" |
|
2524 |
|clip items| |
|
2525 |
||
2526 |
items := self selectedSuperItems. |
|
2527 |
items isEmpty ifTrue:[ ^ self ]. |
|
2528 |
||
2529 |
clip := OrderedCollection new. |
|
2530 |
items do:[:el| clip add:(el menuItem) ]. |
|
2531 |
||
2532 |
self clipboard:clip. |
|
2533 |
self updateAllToolInstances. |
|
2534 |
! |
|
2535 |
||
2536 |
doCut |
|
2537 |
"copy selected menuItems to the clipboard and delete |
|
2538 |
" |
|
2539 |
self doCopy. |
|
2540 |
self doDelete. |
|
2541 |
! |
|
2542 |
||
2543 |
doDelete |
|
2544 |
"delete selected menuItems |
|
2545 |
" |
|
2546 |
|selectedItem parent toDelete behind nextItem prevItem| |
|
2547 |
||
2548 |
toDelete := self selectedSuperItems. |
|
2549 |
toDelete isEmpty ifTrue:[ ^ self ]. |
|
2550 |
||
2551 |
self clearModified. |
|
2552 |
||
2553 |
selectedItem := toDelete first. |
|
2554 |
||
2555 |
selectedItem isRootItem ifTrue:[ |
|
2556 |
^ selectedItem removeAll. |
|
2557 |
]. |
|
2558 |
"/ compute the new selection |
|
2559 |
||
2560 |
prevItem := parent := selectedItem parent. |
|
2561 |
nextItem := nil. |
|
2562 |
||
2563 |
parent children size ~~ 1 ifTrue:[ |
|
2564 |
behind := false. |
|
2565 |
||
2566 |
parent do:[:el| |
|
2567 |
behind ifTrue:[ |
|
2568 |
(nextItem notNil or:[toDelete includesIdentical:el]) ifFalse:[ nextItem := el ]. |
|
2569 |
] ifFalse:[ |
|
2570 |
behind := el == selectedItem. |
|
2571 |
(behind or:[toDelete includesIdentical:el]) ifFalse:[ prevItem := el ]. |
|
2572 |
] |
|
2573 |
] |
|
2574 |
]. |
|
2575 |
self withoutNotifyDo:[ |
|
2576 |
toDelete do:[:el| el remove ]. |
|
2577 |
]. |
|
2578 |
self selectedItem:(nextItem ? prevItem). |
|
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2579 |
modified := true. |
1606 | 2580 |
self updateChannels. |
2581 |
! |
|
2582 |
||
2583 |
doPaste |
|
2584 |
"paste from clipboard |
|
2585 |
" |
|
2586 |
^ self doPaste:(self clipboard) |
|
218 | 2587 |
! |
2588 |
||
1606 | 2589 |
doPaste:aCollection |
2590 |
"paste collection of MenuItems |
|
2591 |
" |
|
2592 |
|item loMenuItems| |
|
2593 |
||
2594 |
aCollection size == 0 ifTrue:[ ^ self ]. |
|
2595 |
||
2596 |
item := self selectedItem. |
|
2597 |
item ifNil:[ ^ self ]. |
|
2598 |
||
2599 |
loMenuItems := OrderedCollection new. |
|
2600 |
aCollection do:[:el| |
|
1633 | 2601 |
(el askFor:#isMenuItem) ifTrue:[ loMenuItems add:el ]. |
1606 | 2602 |
]. |
2603 |
loMenuItems isEmpty ifTrue:[ ^ self ]. |
|
2604 |
||
2605 |
self addAndSelect:[ |
|
1633 | 2606 |
loMenuItems collect:[:el| Item menuItem:el ] |
1606 | 2607 |
]. |
2608 |
! ! |
|
2609 |
||
2610 |
!MenuEditor methodsFor:'user actions - hierarchy'! |
|
2611 |
||
2612 |
doMoveIn:aDirection |
|
2613 |
"move selected item into the next (#inNext) or previous (#inPrev) item |
|
2614 |
" |
|
2615 |
|item idx parent toParent| |
|
2616 |
||
2617 |
item := self selectedItem. |
|
2618 |
item ifNil:[^ self]. |
|
2619 |
||
2620 |
aDirection == #inNext ifTrue:[ item canMoveInNext ifFalse:[^ self] ] |
|
2621 |
ifFalse:[ item canMoveInAbove ifFalse:[^ self] ]. |
|
2622 |
||
2623 |
self askForItemModification ifFalse:[ ^ self ]. |
|
2624 |
||
2625 |
parent := item parent. |
|
2626 |
idx := parent identityIndexOf:item. |
|
2627 |
||
2628 |
aDirection == #inNext ifTrue:[ toParent := parent at:(idx + 1) ifAbsent:nil ] |
|
2629 |
ifFalse:[ toParent := parent at:(idx - 1) ifAbsent:nil ]. |
|
2630 |
||
2631 |
self withoutNotifyDo:[ |
|
2632 |
selectionHolder setValue:#(). |
|
2633 |
parent removeIndex:idx. |
|
2634 |
||
2635 |
aDirection == #inNext ifTrue:[ toParent addFirst:item ] |
|
2636 |
ifFalse:[ toParent addLast:item ]. |
|
2637 |
item makeVisible. |
|
2638 |
]. |
|
2639 |
self selectedItem:item. |
|
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2640 |
modified := true. |
1468 | 2641 |
! |
2642 |
||
1606 | 2643 |
doMoveOut |
2644 |
"move selected item out of current item |
|
2645 |
" |
|
2646 |
|item parent grandParent index| |
|
2647 |
||
2648 |
item := self selectedItem. |
|
2649 |
item ifNil:[^ self]. |
|
2650 |
item canMoveOut ifFalse:[^ self]. |
|
2651 |
||
2652 |
self askForItemModification ifFalse:[ ^ self ]. |
|
2653 |
||
2654 |
parent := item parent. |
|
2655 |
grandParent := parent parent. |
|
2656 |
index := grandParent identityIndexOf:parent. |
|
2657 |
||
2658 |
self withoutNotifyDo:[ |
|
2659 |
selectionHolder setValue:#(). |
|
2660 |
parent remove:item. |
|
2661 |
index > grandParent size ifTrue:[ grandParent add:item ] |
|
2662 |
ifFalse:[ grandParent add:item afterIndex:index ] |
|
2663 |
]. |
|
2664 |
self selectedItem:item. |
|
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2665 |
modified := true. |
218 | 2666 |
! |
2667 |
||
1606 | 2668 |
doMoveUpOrDown:aDirection |
2669 |
"move selected item up (#up) or down (#down) |
|
2670 |
" |
|
2671 |
|item index parent children| |
|
2672 |
||
2673 |
item := self selectedItem. |
|
2674 |
item ifNil:[^ self]. |
|
2675 |
item canMoveUpOrDown ifFalse:[^ self]. |
|
2676 |
||
2677 |
self askForItemModification ifFalse:[ ^ self ]. |
|
2678 |
||
2679 |
self withoutNotifyDo:[ |
|
2680 |
parent := item parent. |
|
2681 |
children := parent children. |
|
2682 |
index := children identityIndexOf:item. |
|
2683 |
||
2684 |
selectionHolder setValue:#(). |
|
2685 |
children removeIndex:index. |
|
2686 |
||
2687 |
aDirection == #up ifTrue:[ |
|
2688 |
index == 1 ifTrue:[ children add:item ] |
|
2689 |
ifFalse:[ children add:item beforeIndex:index - 1 ] |
|
2690 |
] ifFalse:[ |
|
2691 |
index > children size ifTrue:[ children addFirst:item ] |
|
2692 |
ifFalse:[ children add:item afterIndex:index ] |
|
2693 |
]. |
|
2694 |
parent childrenOrderChanged. |
|
2695 |
]. |
|
2696 |
self selectedItem:item. |
|
633
11bbf4599843
uses dynamic tree items and needs ListSpecEditor as superclass (-> libview2)
tz
parents:
627
diff
changeset
|
2697 |
modified := true. |
199 | 2698 |
! ! |
2699 |
||
1606 | 2700 |
!MenuEditor::Item class methodsFor:'defaults'! |
2701 |
||
2702 |
defaultLabel |
|
2703 |
^ self subclassResponsibility |
|
2704 |
! ! |
|
2705 |
||
2706 |
!MenuEditor::Item class methodsFor:'image specs'! |
|
2707 |
||
2708 |
iconDelayedLinkedMenu |
|
2709 |
"This resource specification was automatically generated |
|
2710 |
by the ImageEditor of ST/X." |
|
2711 |
||
2712 |
"Do not manually edit this!! If it is corrupted, |
|
2713 |
the ImageEditor may not be able to read the specification." |
|
2714 |
||
2715 |
" |
|
2716 |
self iconDelayedLinkedMenu inspect |
|
2717 |
ImageEditor openOnClass:self andSelector:#iconDelayedLinkedMenu |
|
2718 |
Icon flushCachedIcons |
|
2719 |
" |
|
2720 |
||
2721 |
<resource: #image> |
|
2722 |
||
2723 |
^Icon |
|
2724 |
constantNamed:#'MenuEditor::Item class iconDelayedLinkedMenu' |
|
2725 |
ifAbsentPut:[(Depth4Image new) width: 20; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2726 |
@@@@@@@@@@@@@@DQDQDQDQDQDR@AH"H"H"H"H"H0@@@BH"H"@@@BL@QDPBH"H"@@H#@DQDPBH@H"@"H0ADQDPBA@H"H"L@@@QDP@Q@@@@@@ADPQDQDQ@DQD |
|
2727 |
@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] |
|
2728 |
! |
|
2729 |
||
2730 |
iconDelayedMenu |
|
2731 |
"This resource specification was automatically generated |
|
2732 |
by the ImageEditor of ST/X." |
|
2733 |
||
2734 |
"Do not manually edit this!! If it is corrupted, |
|
2735 |
the ImageEditor may not be able to read the specification." |
|
2736 |
||
2737 |
" |
|
2738 |
self iconDelayedMenu inspect |
|
2739 |
ImageEditor openOnClass:self andSelector:#iconDelayedMenu |
|
2740 |
Icon flushCachedIcons |
|
2741 |
" |
|
2742 |
||
2743 |
<resource: #image> |
|
2744 |
||
2745 |
^Icon |
|
2746 |
constantNamed:#'MenuEditor::Item class iconDelayedMenu' |
|
2747 |
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] |
|
2748 |
! |
|
2749 |
||
2750 |
iconItem |
|
2751 |
"This resource specification was automatically generated |
|
2752 |
by the ImageEditor of ST/X." |
|
2753 |
||
2754 |
"Do not manually edit this!! If it is corrupted, |
|
2755 |
the ImageEditor may not be able to read the specification." |
|
2756 |
||
2757 |
" |
|
2758 |
self iconItem inspect |
|
2759 |
ImageEditor openOnClass:self andSelector:#iconItem |
|
2760 |
Icon flushCachedIcons |
|
2761 |
" |
|
2762 |
||
2763 |
<resource: #image> |
|
2764 |
||
2765 |
^Icon |
|
2766 |
constantNamed:#'MenuEditor::Item class iconItem' |
|
2767 |
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] |
|
2768 |
! |
|
2769 |
||
2770 |
iconLinkedMenu |
|
2771 |
"This resource specification was automatically generated |
|
2772 |
by the ImageEditor of ST/X." |
|
2773 |
||
2774 |
"Do not manually edit this!! If it is corrupted, |
|
2775 |
the ImageEditor may not be able to read the specification." |
|
2776 |
||
2777 |
" |
|
2778 |
self iconLinkedMenu inspect |
|
2779 |
ImageEditor openOnClass:self andSelector:#iconLinkedMenu |
|
2780 |
Icon flushCachedIcons |
|
2781 |
" |
|
2782 |
||
2783 |
<resource: #image> |
|
2784 |
||
2785 |
^Icon |
|
2786 |
constantNamed:#'MenuEditor::Item class iconLinkedMenu' |
|
2787 |
ifAbsentPut:[(Depth4Image new) width: 20; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2788 |
@@@@@@@@@@@@@@QDQDQDQDQDQA@DH"H"H"H"H"HPABH@@@H"H"H"D@PQ@3L0DQDQDQ@D@@L3L0@@@@@PADPCL3L0PCADD@P"@@@3L0@3@!!@DH"H"@3L3L3@P |
|
2789 |
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] |
|
2790 |
! |
|
2791 |
||
2792 |
iconMenu |
|
2793 |
"This resource specification was automatically generated |
|
2794 |
by the ImageEditor of ST/X." |
|
2795 |
||
2796 |
"Do not manually edit this!! If it is corrupted, |
|
2797 |
the ImageEditor may not be able to read the specification." |
|
2798 |
||
2799 |
" |
|
2800 |
self iconMenu inspect |
|
2801 |
ImageEditor openOnClass:self andSelector:#iconMenu |
|
2802 |
Icon flushCachedIcons |
|
2803 |
" |
|
2804 |
||
2805 |
<resource: #image> |
|
2806 |
||
2807 |
^Icon |
|
2808 |
constantNamed:#'MenuEditor::Item class iconMenu' |
|
2809 |
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] |
|
2810 |
! |
|
2811 |
||
2812 |
iconSeparator |
|
2813 |
"This resource specification was automatically generated |
|
2814 |
by the ImageEditor of ST/X." |
|
2815 |
||
2816 |
"Do not manually edit this!! If it is corrupted, |
|
2817 |
the ImageEditor may not be able to read the specification." |
|
2818 |
||
2819 |
" |
|
2820 |
self iconSeparator inspect |
|
2821 |
ImageEditor openOnClass:self andSelector:#iconSeparator |
|
2822 |
Icon flushCachedIcons |
|
2823 |
" |
|
2824 |
||
2825 |
<resource: #image> |
|
2826 |
||
2827 |
^Icon |
|
2828 |
constantNamed:#'MenuEditor::Item class iconSeparator' |
|
2829 |
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] |
|
2830 |
! ! |
|
2831 |
||
2832 |
!MenuEditor::Item class methodsFor:'instance creation'! |
|
2833 |
||
2834 |
classFor:aMenuItem |
|
2835 |
||
1631 | 2836 |
aMenuItem isNil ifTrue:[ ^ nil ]. |
2837 |
||
2838 |
aMenuItem itemValue isNil ifTrue:[ |
|
1633 | 2839 |
aMenuItem submenu notNil ifTrue:[ ^ MenuEditor::RegularMenuItem ]. |
1631 | 2840 |
aMenuItem submenuChannel notNil ifTrue:[ ^ MenuEditor::LinkedMenuItem ]. |
2841 |
||
2842 |
(self separatorTypeOf:(aMenuItem rawLabel)) notNil ifTrue:[ |
|
2843 |
^ MenuEditor::SeparatorItem |
|
2844 |
] |
|
1606 | 2845 |
]. |
1631 | 2846 |
^ MenuEditor::ActionItem |
1454 | 2847 |
! |
2848 |
||
1606 | 2849 |
menuItem:aMenuItem |
2850 |
|item cls| |
|
2851 |
||
2852 |
cls := self classFor:aMenuItem. |
|
2853 |
cls ifNil:[^ nil]. |
|
2854 |
||
2855 |
item := cls new. |
|
2856 |
item menuItem:aMenuItem. |
|
2857 |
^ item |
|
2858 |
! ! |
|
2859 |
||
2860 |
!MenuEditor::Item class methodsFor:'interface - editor'! |
|
2861 |
||
2862 |
addBindingsTo:aspects for:aMenuEditor |
|
2863 |
"add additional bindings to the aspects |
|
2864 |
" |
|
2865 |
aspects at:#notDelayedMenu ifAbsentPut:[ |
|
2866 |
true asValue |
|
2867 |
]. |
|
2868 |
! ! |
|
2869 |
||
2870 |
!MenuEditor::Item class methodsFor:'interface - specs'! |
|
2871 |
||
2872 |
detailsEditSpec |
|
2873 |
"This resource specification was automatically generated |
|
2874 |
by the UIPainter of ST/X." |
|
2875 |
||
2876 |
"Do not manually edit this!! If it is corrupted, |
|
2877 |
the UIPainter may not be able to read the specification." |
|
2878 |
||
2879 |
" |
|
2880 |
UIPainter new openOnClass:MenuEditor::Item andSelector:#detailsEditSpec |
|
2881 |
" |
|
2882 |
||
2883 |
<resource: #canvas> |
|
2884 |
||
2885 |
^ |
|
2886 |
#(#FullSpec |
|
1636 | 2887 |
#name: #detailsEditSpec |
2888 |
#window: |
|
1606 | 2889 |
#(#WindowSpec |
1636 | 2890 |
#label: 'Details Edit' |
2891 |
#name: 'Details Edit' |
|
2892 |
#min: #(#Point 10 10) |
|
2893 |
#max: #(#Point 1280 1024) |
|
2894 |
#bounds: #(#Rectangle 43 153 303 398) |
|
2895 |
) |
|
2896 |
#component: |
|
1606 | 2897 |
#(#SpecCollection |
1636 | 2898 |
#collection: #( |
2899 |
#(#LabelSpec |
|
2900 |
#label: 'Accelerator:' |
|
2901 |
#name: 'shortcutKeyLabel' |
|
2902 |
#layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
|
2903 |
#activeHelpKey: #detailsAccelerator |
|
2904 |
#resizeForLabel: true |
|
2905 |
#adjust: #right |
|
2906 |
) |
|
2907 |
#(#InputFieldSpec |
|
2908 |
#name: 'shortcutKeyField' |
|
2909 |
#layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
|
2910 |
#activeHelpKey: #detailsAccelerator |
|
2911 |
#tabable: true |
|
2912 |
#model: #shortcutKeyCharacter |
|
2913 |
#group: #inputGroup |
|
2914 |
#type: #symbolOrNil |
|
2915 |
#immediateAccept: false |
|
2916 |
#acceptOnReturn: true |
|
2917 |
#acceptOnTab: true |
|
2918 |
#acceptChannel: #acceptChannel |
|
2919 |
#modifiedChannel: #modifiedChannel |
|
2920 |
#acceptOnPointerLeave: false |
|
2921 |
) |
|
2922 |
#(#LabelSpec |
|
2923 |
#label: 'Enabled:' |
|
2924 |
#name: 'enabledLabel' |
|
2925 |
#layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
|
2926 |
#activeHelpKey: #detailsEnabled |
|
2927 |
#resizeForLabel: true |
|
2928 |
#adjust: #right |
|
2929 |
) |
|
2930 |
#(#InputFieldSpec |
|
2931 |
#name: 'enabledField' |
|
2932 |
#layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
|
2933 |
#activeHelpKey: #detailsEnabled |
|
2934 |
#tabable: true |
|
2935 |
#model: #enabled |
|
2936 |
#group: #inputGroup |
|
2937 |
#type: #symbolOrBooleanOrNil |
|
2938 |
#immediateAccept: false |
|
2939 |
#acceptOnReturn: true |
|
2940 |
#acceptOnTab: true |
|
2941 |
#acceptChannel: #acceptChannel |
|
2942 |
#modifiedChannel: #modifiedChannel |
|
2943 |
#acceptOnPointerLeave: false |
|
2944 |
) |
|
2945 |
#(#LabelSpec |
|
2946 |
#label: 'Visibility:' |
|
2947 |
#name: 'visibilityLabel' |
|
2948 |
#layout: #(#AlignmentOrigin 107 0 76 0 1 0.5) |
|
2949 |
#activeHelpKey: #detailsVisibility |
|
2950 |
#resizeForLabel: true |
|
2951 |
#adjust: #right |
|
2952 |
) |
|
2953 |
#(#InputFieldSpec |
|
2954 |
#name: 'isVisibleInputField' |
|
2955 |
#layout: #(#LayoutFrame 110 0 65 0 -5 1.0 87 0) |
|
2956 |
#activeHelpKey: #detailsVisibility |
|
2957 |
#tabable: true |
|
2958 |
#model: #isVisible |
|
2959 |
#group: #inputGroup |
|
2960 |
#type: #symbolOrBooleanOrNil |
|
2961 |
#immediateAccept: false |
|
2962 |
#acceptOnReturn: true |
|
2963 |
#acceptOnTab: true |
|
2964 |
#acceptChannel: #acceptChannel |
|
2965 |
#modifiedChannel: #modifiedChannel |
|
2966 |
#acceptOnPointerLeave: false |
|
2967 |
) |
|
2968 |
#(#LabelSpec |
|
2969 |
#label: 'Aux Value' |
|
2970 |
#name: 'auxLabel' |
|
2971 |
#layout: #(#AlignmentOrigin 107 0 101 0 1 0.5) |
|
2972 |
#activeHelpKey: #detailsAuxValue |
|
2973 |
#translateLabel: true |
|
2974 |
#resizeForLabel: true |
|
2975 |
#adjust: #right |
|
2976 |
) |
|
2977 |
#(#InputFieldSpec |
|
2978 |
#name: 'auxInputField' |
|
2979 |
#layout: #(#LayoutFrame 110 0 90 0 -5 1.0 112 0) |
|
2980 |
#activeHelpKey: #detailsAuxValue |
|
2981 |
#tabable: true |
|
2982 |
#model: #auxValue |
|
2983 |
#group: #inputGroup |
|
2984 |
#type: #smalltalkObject |
|
2985 |
#immediateAccept: false |
|
2986 |
#acceptOnReturn: true |
|
2987 |
#acceptOnTab: true |
|
2988 |
#acceptChannel: #acceptChannel |
|
2989 |
#modifiedChannel: #modifiedChannel |
|
2990 |
#acceptOnPointerLeave: false |
|
2991 |
) |
|
2992 |
#(#LabelSpec |
|
2993 |
#label: 'Start Group:' |
|
2994 |
#name: 'StartGroupLabel' |
|
2995 |
#layout: #(#AlignmentOrigin 107 0 139 0 1 0.5) |
|
2996 |
#activeHelpKey: #detailsStartGroup |
|
2997 |
#resizeForLabel: true |
|
2998 |
#adjust: #right |
|
2999 |
) |
|
3000 |
#(#PopUpListSpec |
|
3001 |
#label: 'left' |
|
3002 |
#name: 'StartGroupPopUp' |
|
3003 |
#layout: #(#LayoutFrame 110 0 128 0 -5 1.0 150 0) |
|
3004 |
#activeHelpKey: #detailsStartGroup |
|
3005 |
#tabable: true |
|
3006 |
#model: #startGroup |
|
3007 |
#menu: |
|
3008 |
#(#left |
|
3009 |
#right |
|
3010 |
) |
|
3011 |
) |
|
3012 |
#(#LabelSpec |
|
3013 |
#label: 'Access Character Position:' |
|
3014 |
#name: 'accessCharLabel' |
|
3015 |
#layout: #(#AlignmentOrigin 217 0 170 0 1 0.5) |
|
3016 |
#activeHelpKey: #detailsAccessCharaterPosition |
|
3017 |
#resizeForLabel: true |
|
3018 |
#adjust: #right |
|
3019 |
) |
|
3020 |
#(#InputFieldSpec |
|
3021 |
#name: 'accessCharField' |
|
3022 |
#layout: #(#LayoutFrame 220 0 159 0 -5 1.0 181 0) |
|
3023 |
#activeHelpKey: #detailsAccessCharaterPosition |
|
3024 |
#tabable: true |
|
3025 |
#model: #accessCharacterPosition |
|
3026 |
#group: #inputGroup |
|
3027 |
#type: #numberOrNil |
|
3028 |
#immediateAccept: false |
|
3029 |
#acceptOnReturn: true |
|
3030 |
#acceptOnTab: true |
|
3031 |
#acceptChannel: #acceptChannel |
|
3032 |
#modifiedChannel: #modifiedChannel |
|
3033 |
#acceptOnPointerLeave: false |
|
3034 |
) |
|
3035 |
#(#LabelSpec |
|
3036 |
#label: 'Font:' |
|
3037 |
#name: 'fontLabel' |
|
3038 |
#layout: #(#AlignmentOrigin 75 0 219 0 1 0.5) |
|
3039 |
#resizeForLabel: true |
|
3040 |
#adjust: #right |
|
3041 |
) |
|
3042 |
#(#FontMenuSpec |
|
3043 |
#attributes: |
|
3044 |
#(#tabable |
|
3045 |
true |
|
3046 |
) |
|
3047 |
#name: 'fontMenu' |
|
3048 |
#layout: #(#LayoutFrame 78 0 208 0 -5 1.0 230 0) |
|
3049 |
#activeHelpKey: #fontMenu |
|
3050 |
#model: #font |
|
3051 |
) |
|
3052 |
) |
|
1606 | 3053 |
|
1636 | 3054 |
) |
1454 | 3055 |
) |
3056 |
! ! |
|
3057 |
||
1606 | 3058 |
!MenuEditor::Item class methodsFor:'testing'! |
3059 |
||
3060 |
separatorTypeOf:aString |
|
3061 |
|size first| |
|
3062 |
||
3063 |
size := aString size. |
|
3064 |
||
3065 |
size == 0 ifTrue:[ ^ #blank ]. |
|
3066 |
||
3067 |
size == 1 ifTrue:[ |
|
3068 |
first := aString first. |
|
3069 |
first == $- ifTrue:[ ^ #single ]. |
|
3070 |
first == $= ifTrue:[ ^ #double ]. |
|
3071 |
first == (Character space) ifTrue:[ ^ #blank ]. |
|
3072 |
]. |
|
3073 |
^ nil |
|
1454 | 3074 |
! ! |
3075 |
||
3076 |
!MenuEditor::Item methodsFor:'accessing'! |
|
3077 |
||
1606 | 3078 |
children |
3079 |
"optimize access; do not ask the model for unspecified children |
|
3080 |
" |
|
3081 |
^ children |
|
3082 |
! |
|
3083 |
||
3084 |
menuItem |
|
3085 |
"returns self as a MenuItem |
|
3086 |
" |
|
3087 |
^ MenuItem new fromLiteralArrayEncoding:(menuItem literalArrayEncoding). |
|
3088 |
! |
|
3089 |
||
3090 |
menuItem:aMenuItem |
|
3091 |
"rebuild self from a MenuItem |
|
3092 |
" |
|
3093 |
|value| |
|
3094 |
||
3095 |
menuItem := MenuItem labeled:(self rawLabel). |
|
3096 |
||
3097 |
MenuEditor aspects do:[:aKey| |
|
1653
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3098 |
value := self validateValue:(aMenuItem perform:aKey). |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3099 |
|
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3100 |
value notNil ifTrue:[ |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3101 |
self aspectAt:aKey put:value. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3102 |
]. |
1606 | 3103 |
]. |
3104 |
! |
|
3105 |
||
3106 |
rawLabel |
|
3107 |
"returns the label assigned to the item |
|
3108 |
" |
|
3109 |
^ menuItem rawLabel |
|
3110 |
! |
|
3111 |
||
3112 |
rawLabel:aValue |
|
3113 |
"set the label assigned to the item |
|
3114 |
" |
|
3115 |
aValue isString ifTrue:[ |
|
3116 |
(self class separatorTypeOf:aValue) ifNil:[ |
|
3117 |
menuItem rawLabel:aValue |
|
3118 |
] |
|
3119 |
]. |
|
3120 |
! |
|
3121 |
||
3122 |
slices |
|
3123 |
"returns a sequence of supported slices |
|
3124 |
" |
|
3125 |
^ self subclassResponsibility |
|
1454 | 3126 |
! |
3127 |
||
1606 | 3128 |
submenu |
3129 |
"returns the submenu (of class Menu) or nil |
|
3130 |
" |
|
3131 |
^ nil |
|
1631 | 3132 |
! |
3133 |
||
3134 |
translateLabel:aBoolean |
|
3135 |
menuItem translateLabel:aBoolean |
|
1606 | 3136 |
! ! |
3137 |
||
3138 |
!MenuEditor::Item methodsFor:'aspects'! |
|
3139 |
||
3140 |
aspectAt:aKey put:aValue |
|
3141 |
"set a specific aspect named aKey to the aValue |
|
3142 |
" |
|
3143 |
aKey == #rawLabel ifTrue:[ ^ self rawLabel:aValue ]. |
|
3144 |
aKey == #submenuChannel ifTrue:[ ^ self ]. |
|
3145 |
||
3146 |
menuItem perform:((aKey, ':') asSymbol) with:aValue. |
|
3147 |
! |
|
3148 |
||
3149 |
fromAspects:aspects |
|
3150 |
"read values from aspects |
|
3151 |
" |
|
3152 |
MenuEditor aspects do:[:aKey| |
|
3153 |
self aspectAt:aKey put:((aspects at:aKey) value) |
|
3154 |
]. |
|
3155 |
self changed. |
|
3156 |
! |
|
3157 |
||
3158 |
toAspects:aspects |
|
3159 |
"write values to aspects |
|
3160 |
" |
|
3161 |
MenuEditor aspects do:[:aKey| |
|
3162 |
(aspects at:aKey) value:(menuItem perform:aKey) |
|
3163 |
]. |
|
3164 |
(aspects at:#notDelayedMenu) value:(self isDelayedMenu not). |
|
3165 |
! ! |
|
3166 |
||
3167 |
!MenuEditor::Item methodsFor:'displaying'! |
|
3168 |
||
3169 |
displayLabel |
|
3170 |
"returns the label on default displayed on the screen |
|
3171 |
" |
|
3172 |
^ menuItem rawLabel |
|
3173 |
! |
|
3174 |
||
3175 |
displayOn:aGC x:x y:y h:h |
|
3176 |
"display the item in the graphicsContext, aGC. |
|
3177 |
" |
|
3178 |
|label| |
|
3179 |
||
3180 |
label := self displayLabel. |
|
3181 |
||
3182 |
label notNil ifTrue:[ |
|
3183 |
self displayLabel:label h:(self heightOn:aGC) on:aGC x:x y:y h:h |
|
3184 |
]. |
|
3185 |
! |
|
3186 |
||
3187 |
heightOn:aGC |
|
3188 |
"returns the height of the label on a GC |
|
3189 |
" |
|
3190 |
height ifNil:[ height := parent heightOn:aGC ]. |
|
3191 |
^ height |
|
1454 | 3192 |
! |
3193 |
||
3194 |
label |
|
1606 | 3195 |
"get the rawLabel assigned to the item |
3196 |
" |
|
3197 |
^ menuItem rawLabel |
|
1454 | 3198 |
! |
3199 |
||
1606 | 3200 |
label:aLabel |
3201 |
"set the rawLabel assigned to the item |
|
3202 |
" |
|
3203 |
self rawLabel:aLabel |
|
1454 | 3204 |
! |
3205 |
||
1606 | 3206 |
widthOn:aGC |
3207 |
"returns the height of the displayLabel on a GC |
|
3208 |
" |
|
3209 |
width ifNil:[ width := self widthOf:(self displayLabel) on:aGC ]. |
|
3210 |
^ width |
|
1454 | 3211 |
! ! |
3212 |
||
1606 | 3213 |
!MenuEditor::Item methodsFor:'initialization'! |
3214 |
||
3215 |
initialize |
|
3216 |
super initialize. |
|
3217 |
menuItem := MenuItem label:(self class defaultLabel). |
|
1454 | 3218 |
! ! |
3219 |
||
1653
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3220 |
!MenuEditor::Item methodsFor:'private'! |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3221 |
|
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3222 |
validateValue:aValue |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3223 |
"if we pick a menupanel, the values of an item can be |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3224 |
a block model, .... |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3225 |
" |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3226 |
aValue notNil ifTrue:[ |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3227 |
aValue isBlock ifTrue:[ ^ #block ]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3228 |
aValue isValueModel ifTrue:[ ^ #valueModel ]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3229 |
]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3230 |
^ aValue |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3231 |
! ! |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
3232 |
|
1454 | 3233 |
!MenuEditor::Item methodsFor:'queries'! |
3234 |
||
1606 | 3235 |
isAction |
3236 |
"returns true if the item is an Action |
|
3237 |
" |
|
3238 |
^ false |
|
3239 |
! |
|
3240 |
||
3241 |
isDelayedMenu |
|
3242 |
"returns true if the item is a Delayed (Linked) Menu |
|
3243 |
" |
|
3244 |
^ parent isAction |
|
3245 |
! |
|
3246 |
||
3247 |
isKindOfMenu |
|
3248 |
"returns true if the item is a Linked Menu or Menu |
|
3249 |
" |
|
3250 |
^ false |
|
3251 |
! |
|
3252 |
||
1633 | 3253 |
isMenuEditItem |
3254 |
^ true |
|
3255 |
! |
|
3256 |
||
1606 | 3257 |
isRootItem |
3258 |
"returns true if the item is the root item |
|
3259 |
" |
|
3260 |
^ false |
|
3261 |
! ! |
|
3262 |
||
1614 | 3263 |
!MenuEditor::Item methodsFor:'queries - editor'! |
3264 |
||
3265 |
actionSelectors |
|
3266 |
"returns my action selectors |
|
3267 |
" |
|
3268 |
|value| |
|
3269 |
||
3270 |
value := menuItem value. |
|
3271 |
value isSymbol ifTrue:[ ^ Array with:value ]. |
|
3272 |
^ #() |
|
3273 |
! |
|
3274 |
||
3275 |
aspectSelectors |
|
3276 |
"returns my aspect selectors |
|
3277 |
" |
|
3278 |
|aspects| |
|
3279 |
||
3280 |
aspects := OrderedCollection new. |
|
3281 |
||
3282 |
#( indication choice enabled isVisible ) do:[:aKey| |sel| |
|
3283 |
sel := menuItem perform:aKey. |
|
3284 |
sel isSymbol ifTrue:[ aspects add:sel ] |
|
3285 |
]. |
|
3286 |
^ aspects |
|
3287 |
! ! |
|
3288 |
||
1606 | 3289 |
!MenuEditor::Item methodsFor:'queries - operation'! |
3290 |
||
3291 |
canAddChildren |
|
3292 |
"returns true if children can be added |
|
3293 |
" |
|
3294 |
^ false |
|
3295 |
! |
|
3296 |
||
3297 |
canAddDelayedMenu |
|
3298 |
"returns true if a delayed menu can be added; |
|
3299 |
on default false is returned |
|
3300 |
" |
|
3301 |
^ false |
|
3302 |
! |
|
3303 |
||
3304 |
canMoveInAbove |
|
3305 |
"returns true if the item can become a child of its previous sibling |
|
3306 |
" |
|
3307 |
|siblings index nextItem| |
|
3308 |
||
3309 |
siblings := parent children. |
|
3310 |
siblings size > 1 ifFalse:[ ^ false ]. |
|
3311 |
||
3312 |
index := siblings identityIndexOf:self. |
|
3313 |
nextItem := siblings at:(index - 1) ifAbsent:nil. |
|
3314 |
||
3315 |
nextItem ifNil:[^ false]. |
|
3316 |
^ nextItem canAddChildren |
|
1454 | 3317 |
! |
3318 |
||
1606 | 3319 |
canMoveInNext |
3320 |
"returns true if the item can become a child of its next sibling |
|
3321 |
" |
|
3322 |
|siblings index nextItem| |
|
3323 |
||
3324 |
siblings := parent children. |
|
3325 |
siblings size > 1 ifFalse:[ ^ false ]. |
|
3326 |
||
3327 |
index := siblings identityIndexOf:self. |
|
3328 |
nextItem := siblings at:(index + 1) ifAbsent:nil. |
|
3329 |
||
3330 |
nextItem ifNil:[^ false]. |
|
3331 |
^ nextItem canAddChildren |
|
3332 |
! |
|
3333 |
||
3334 |
canMoveOut |
|
3335 |
"returns true if the item can be moved out from its current parent |
|
3336 |
" |
|
3337 |
self isDelayedMenu ifTrue:[^ false]. |
|
3338 |
parent isDelayedMenu ifTrue:[^ false]. |
|
3339 |
||
3340 |
^ parent parent notNil |
|
1454 | 3341 |
! |
3342 |
||
1606 | 3343 |
canMoveUpOrDown |
3344 |
"returns true if the item can change its vertical order in its sibling |
|
3345 |
" |
|
3346 |
^ parent children size > 1 |
|
3347 |
! ! |
|
3348 |
||
1631 | 3349 |
!MenuEditor::ActionItem class methodsFor:'defaults'! |
1606 | 3350 |
|
3351 |
defaultLabel |
|
3352 |
^ 'Action' |
|
3353 |
! ! |
|
3354 |
||
1631 | 3355 |
!MenuEditor::ActionItem class methodsFor:'interface - editor'! |
1606 | 3356 |
|
3357 |
addBindingsTo:aspects for:aMenuEditor |
|
3358 |
"add additional bindings to the aspects |
|
3359 |
" |
|
3360 |
aspects at:#indicationEnabled ifAbsentPut:[ |
|
3361 |
BlockValue with:[:a | a size == 0 ] argument:(aspects at:#choice) |
|
3362 |
]. |
|
3363 |
||
3364 |
aspects at:#choiceEnabled ifAbsentPut:[ |
|
3365 |
BlockValue with:[:a | a size == 0 ] argument:(aspects at:#indication) |
|
3366 |
]. |
|
3367 |
||
3368 |
aspects at:#choiceValueEnabled ifAbsentPut:[ |
|
3369 |
BlockValue with:[:a | a size ~~ 0 ] argument:(aspects at:#choice) |
|
3370 |
]. |
|
3371 |
aspects at:#hasNoDelayedMenuValue ifAbsentPut:[ |
|
3372 |
true asValue |
|
3373 |
]. |
|
1454 | 3374 |
! ! |
3375 |
||
1631 | 3376 |
!MenuEditor::ActionItem class methodsFor:'interface - specs'! |
1606 | 3377 |
|
3378 |
basicsEditSpec |
|
3379 |
"This resource specification was automatically generated |
|
3380 |
by the UIPainter of ST/X." |
|
3381 |
||
3382 |
"Do not manually edit this!! If it is corrupted, |
|
3383 |
the UIPainter may not be able to read the specification." |
|
3384 |
||
3385 |
" |
|
1634 | 3386 |
UIPainter new openOnClass:MenuEditor::ActionItem andSelector:#basicsEditSpec |
1606 | 3387 |
" |
3388 |
||
3389 |
<resource: #canvas> |
|
3390 |
||
3391 |
^ |
|
3392 |
#(#FullSpec |
|
3393 |
#name: #basicsEditSpec |
|
3394 |
#window: |
|
3395 |
#(#WindowSpec |
|
3396 |
#label: 'basicsEditSpec' |
|
3397 |
#name: 'basicsEditSpec' |
|
3398 |
#min: #(#Point 10 10) |
|
3399 |
#max: #(#Point 1160 870) |
|
1636 | 3400 |
#bounds: #(#Rectangle 314 340 654 680) |
1606 | 3401 |
) |
3402 |
#component: |
|
3403 |
#(#SpecCollection |
|
3404 |
#collection: #( |
|
3405 |
#(#LabelSpec |
|
3406 |
#label: 'Name Key:' |
|
3407 |
#name: 'nameKeyLabel' |
|
3408 |
#layout: #(#AlignmentOrigin 107 0 25 0 1 0.5) |
|
3409 |
#activeHelpKey: #basicsKey |
|
3410 |
#resizeForLabel: true |
|
3411 |
#adjust: #right |
|
3412 |
) |
|
3413 |
#(#InputFieldSpec |
|
3414 |
#name: 'nameKeyField' |
|
3415 |
#layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
|
3416 |
#activeHelpKey: #basicsKey |
|
3417 |
#tabable: true |
|
3418 |
#model: #nameKey |
|
3419 |
#group: #inputGroup |
|
3420 |
#type: #symbolOrNil |
|
3421 |
#immediateAccept: false |
|
3422 |
#acceptOnLeave: false |
|
3423 |
#acceptOnReturn: true |
|
3424 |
#acceptOnTab: true |
|
3425 |
#acceptOnLostFocus: false |
|
3426 |
#acceptChannel: #acceptChannel |
|
3427 |
#modifiedChannel: #modifiedChannel |
|
3428 |
#acceptOnPointerLeave: false |
|
3429 |
) |
|
3430 |
#(#LabelSpec |
|
3431 |
#label: 'Label:' |
|
3432 |
#name: 'labelLabel' |
|
3433 |
#layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
|
3434 |
#activeHelpKey: #basicsLabel |
|
3435 |
#resizeForLabel: true |
|
3436 |
#adjust: #right |
|
3437 |
) |
|
3438 |
#(#InputFieldSpec |
|
3439 |
#name: 'labelField' |
|
3440 |
#layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
|
3441 |
#activeHelpKey: #basicsLabel |
|
3442 |
#tabable: true |
|
3443 |
#model: #rawLabel |
|
3444 |
#group: #inputGroup |
|
3445 |
#immediateAccept: false |
|
3446 |
#acceptOnReturn: true |
|
3447 |
#acceptOnTab: true |
|
3448 |
#acceptOnLostFocus: false |
|
3449 |
#acceptChannel: #acceptChannel |
|
3450 |
#modifiedChannel: #modifiedChannel |
|
3451 |
#acceptOnPointerLeave: false |
|
3452 |
) |
|
3453 |
#(#LabelSpec |
|
3454 |
#label: 'Action:' |
|
3455 |
#name: 'valueLabel' |
|
3456 |
#layout: #(#AlignmentOrigin 107 0 82 0 1 0.5) |
|
3457 |
#activeHelpKey: #basicsAction |
|
3458 |
#resizeForLabel: true |
|
3459 |
#adjust: #right |
|
3460 |
) |
|
3461 |
#(#InputFieldSpec |
|
3462 |
#name: 'valueField' |
|
3463 |
#layout: #(#LayoutFrame 110 0 71 0 -5 1.0 93 0) |
|
3464 |
#activeHelpKey: #basicsAction |
|
3465 |
#tabable: true |
|
1632 | 3466 |
#model: #itemValue |
1606 | 3467 |
#group: #inputGroup |
3468 |
#type: #symbolOrNil |
|
3469 |
#immediateAccept: false |
|
1636 | 3470 |
#acceptOnLeave: true |
1606 | 3471 |
#acceptOnReturn: true |
3472 |
#acceptOnTab: true |
|
1636 | 3473 |
#acceptOnLostFocus: true |
1606 | 3474 |
#acceptChannel: #acceptChannel |
3475 |
#modifiedChannel: #modifiedChannel |
|
1636 | 3476 |
#acceptOnPointerLeave: true |
1606 | 3477 |
) |
3478 |
#(#LabelSpec |
|
3479 |
#label: 'Argument:' |
|
3480 |
#name: 'argumentLabel' |
|
3481 |
#layout: #(#AlignmentOrigin 107 0 107 0 1 0.5) |
|
3482 |
#activeHelpKey: #basicsArgument |
|
3483 |
#resizeForLabel: true |
|
3484 |
#adjust: #right |
|
3485 |
) |
|
3486 |
#(#InputFieldSpec |
|
3487 |
#name: 'argumentField' |
|
3488 |
#layout: #(#LayoutFrame 110 0 96 0 -5 1.0 118 0) |
|
3489 |
#activeHelpKey: #basicsArgument |
|
3490 |
#tabable: true |
|
3491 |
#model: #argument |
|
3492 |
#group: #inputGroup |
|
3493 |
#type: #smalltalkObject |
|
3494 |
#immediateAccept: false |
|
3495 |
#acceptOnReturn: true |
|
3496 |
#acceptOnTab: true |
|
3497 |
#acceptOnLostFocus: false |
|
3498 |
#acceptChannel: #acceptChannel |
|
3499 |
#modifiedChannel: #modifiedChannel |
|
3500 |
#acceptOnPointerLeave: false |
|
3501 |
) |
|
3502 |
#(#LabelSpec |
|
3503 |
#label: 'Indication:' |
|
3504 |
#name: 'indicationLabel' |
|
3505 |
#layout: #(#AlignmentOrigin 107 0 138 0 1 0.5) |
|
3506 |
#activeHelpKey: #basicsIndication |
|
3507 |
#resizeForLabel: true |
|
3508 |
#adjust: #right |
|
3509 |
) |
|
3510 |
#(#InputFieldSpec |
|
3511 |
#name: 'indicationField' |
|
3512 |
#layout: #(#LayoutFrame 110 0 127 0 -5 1.0 149 0) |
|
3513 |
#activeHelpKey: #basicsIndication |
|
3514 |
#enableChannel: #indicationEnabled |
|
3515 |
#tabable: true |
|
3516 |
#model: #indication |
|
3517 |
#group: #inputGroup |
|
3518 |
#type: #symbolOrNil |
|
3519 |
#immediateAccept: true |
|
3520 |
#acceptOnReturn: false |
|
3521 |
#acceptOnTab: false |
|
3522 |
#acceptOnLostFocus: false |
|
3523 |
#modifiedChannel: #modifiedChannel |
|
3524 |
#acceptOnPointerLeave: false |
|
3525 |
) |
|
3526 |
#(#LabelSpec |
|
3527 |
#label: 'Choice:' |
|
3528 |
#name: 'choiceLabel' |
|
3529 |
#layout: #(#AlignmentOrigin 107 0 163 0 1 0.5) |
|
3530 |
#activeHelpKey: #basicsChoice |
|
3531 |
#translateLabel: true |
|
3532 |
#resizeForLabel: true |
|
3533 |
#adjust: #right |
|
3534 |
) |
|
3535 |
#(#InputFieldSpec |
|
3536 |
#name: 'choiceField' |
|
3537 |
#layout: #(#LayoutFrame 110 0 152 0 -5 1.0 174 0) |
|
3538 |
#activeHelpKey: #basicsChoice |
|
3539 |
#enableChannel: #choiceEnabled |
|
3540 |
#tabable: true |
|
3541 |
#model: #choice |
|
3542 |
#group: #inputGroup |
|
3543 |
#type: #symbolOrNil |
|
3544 |
#immediateAccept: true |
|
3545 |
#acceptOnReturn: false |
|
3546 |
#acceptOnTab: false |
|
3547 |
#acceptOnLostFocus: false |
|
3548 |
#modifiedChannel: #modifiedChannel |
|
3549 |
#acceptOnPointerLeave: false |
|
3550 |
) |
|
3551 |
#(#LabelSpec |
|
3552 |
#label: 'Value:' |
|
3553 |
#name: 'choiceValueLabel' |
|
3554 |
#layout: #(#AlignmentOrigin 107 0 188 0 1 0.5) |
|
3555 |
#activeHelpKey: #basicsChoiceValue |
|
3556 |
#translateLabel: true |
|
3557 |
#resizeForLabel: true |
|
3558 |
#adjust: #right |
|
3559 |
) |
|
3560 |
#(#InputFieldSpec |
|
3561 |
#name: 'choiceValueField' |
|
3562 |
#layout: #(#LayoutFrame 110 0 177 0 -5 1.0 199 0) |
|
3563 |
#activeHelpKey: #basicsChoiceValue |
|
3564 |
#enableChannel: #choiceValueEnabled |
|
3565 |
#tabable: true |
|
3566 |
#model: #choiceValue |
|
3567 |
#group: #inputGroup |
|
1642 | 3568 |
#type: #smalltalkObjectOrNil |
1606 | 3569 |
#immediateAccept: false |
3570 |
#acceptOnLeave: false |
|
3571 |
#acceptOnReturn: true |
|
3572 |
#acceptOnTab: true |
|
3573 |
#acceptOnLostFocus: false |
|
3574 |
#acceptChannel: #acceptChannel |
|
3575 |
#modifiedChannel: #modifiedChannel |
|
3576 |
#acceptOnPointerLeave: false |
|
3577 |
) |
|
3578 |
#(#CheckBoxSpec |
|
3579 |
#label: 'Translate Label' |
|
3580 |
#name: 'translateLabelCheckBox' |
|
1634 | 3581 |
#layout: #(#AlignmentOrigin 7 0 213 0 0 0) |
1606 | 3582 |
#activeHelpKey: #basicsTranslateLabel |
3583 |
#tabable: true |
|
3584 |
#model: #translateLabel |
|
3585 |
) |
|
3586 |
#(#CheckBoxSpec |
|
3587 |
#label: 'Is Button' |
|
3588 |
#name: 'isButtonCheckBox' |
|
1634 | 3589 |
#layout: #(#AlignmentOrigin 7 0 238 0 0 0) |
1606 | 3590 |
#activeHelpKey: #basicsIsButton |
3591 |
#tabable: true |
|
3592 |
#model: #isButton |
|
3593 |
) |
|
3594 |
#(#CheckBoxSpec |
|
3595 |
#label: 'Hide Menu after Activation' |
|
3596 |
#name: 'hideMenuOnActivated' |
|
1634 | 3597 |
#layout: #(#AlignmentOrigin 7 0 263 0 0 0) |
1606 | 3598 |
#activeHelpKey: #hideMenuOnActivated |
3599 |
#tabable: true |
|
3600 |
#model: #hideMenuOnActivated |
|
3601 |
) |
|
3602 |
#(#CheckBoxSpec |
|
3603 |
#label: 'BusyCursor while Active' |
|
3604 |
#name: 'showBusyCursorWhilePerforming' |
|
1634 | 3605 |
#layout: #(#AlignmentOrigin 7 0 288 0 0 0) |
1606 | 3606 |
#activeHelpKey: #showBusyCursorWhilePerforming |
3607 |
#tabable: true |
|
3608 |
#model: #showBusyCursorWhilePerforming |
|
3609 |
#translateLabel: true |
|
3610 |
) |
|
3611 |
#(#CheckBoxSpec |
|
3612 |
#label: 'Trigger On Down' |
|
3613 |
#name: 'triggerOnDown' |
|
1634 | 3614 |
#layout: #(#AlignmentOrigin 25 0.5 238 0 0 0) |
1606 | 3615 |
#activeHelpKey: #triggerOnDown |
1623 | 3616 |
#enableChannel: #hasNoDelayedMenuValue |
1606 | 3617 |
#tabable: true |
3618 |
#model: #triggerOnDown |
|
3619 |
#translateLabel: true |
|
3620 |
) |
|
1634 | 3621 |
#(#CheckBoxSpec |
3622 |
#label: 'Send To Originating Widget' |
|
3623 |
#name: 'sendToOriginator' |
|
3624 |
#layout: #(#AlignmentOrigin 7 0 313 0 0 0) |
|
1636 | 3625 |
#activeHelpKey: #sendToOriginator |
3626 |
#enableChannel: #hasItemValue |
|
1634 | 3627 |
#tabable: true |
3628 |
#model: #sendToOriginator |
|
3629 |
#translateLabel: true |
|
3630 |
) |
|
1606 | 3631 |
) |
3632 |
||
3633 |
) |
|
3634 |
) |
|
199 | 3635 |
! ! |
3636 |
||
1631 | 3637 |
!MenuEditor::ActionItem methodsFor:'accessing'! |
1606 | 3638 |
|
3639 |
menuItem |
|
3640 |
|item| |
|
3641 |
||
3642 |
item := super menuItem. |
|
3643 |
self hasDelayedMenu ifTrue:[ |
|
3644 |
children first setDelayedAttributesTo:item. |
|
3645 |
||
3646 |
menuItem value ifNil:[ |
|
3647 |
menuItem value:#unspecified |
|
199 | 3648 |
] |
3649 |
]. |
|
1606 | 3650 |
^ item |
199 | 3651 |
! |
3652 |
||
213 | 3653 |
menuItem:anItem |
1606 | 3654 |
|submenu item| |
3655 |
||
3656 |
super menuItem:anItem. |
|
3657 |
submenu := anItem submenu. |
|
3658 |
||
3659 |
submenu notNil ifTrue:[ |
|
1633 | 3660 |
item := MenuEditor::RegularMenuItem new |
1606 | 3661 |
] ifFalse:[ |
1631 | 3662 |
anItem submenuChannel isNil ifTrue:[ |
3663 |
^ self |
|
3664 |
]. |
|
3665 |
item := MenuEditor::LinkedMenuItem new |
|
1606 | 3666 |
]. |
3667 |
item getDelayedAttributesFrom:anItem. |
|
3668 |
self add:item. |
|
199 | 3669 |
! |
3670 |
||
1606 | 3671 |
slices |
3672 |
^ #( |
|
3673 |
(Basics basicsEditSpec ) |
|
3674 |
(Details detailsEditSpec) |
|
3675 |
(Image image ) |
|
3676 |
(Help help) |
|
3677 |
) |
|
199 | 3678 |
! ! |
3679 |
||
1631 | 3680 |
!MenuEditor::ActionItem methodsFor:'adding & removing'! |
1606 | 3681 |
|
3682 |
add:anItem |
|
3683 |
"add an item; test whether the item is a delayed menu and |
|
3684 |
not already a delayed menu exists. |
|
3685 |
" |
|
3686 |
(anItem isKindOfMenu and:[self canAddDelayedMenu]) ifFalse:[ |
|
3687 |
^ nil |
|
853 | 3688 |
]. |
1606 | 3689 |
"/ reset values not setable if a delayed menu is configured |
3690 |
menuItem triggerOnDown:false. |
|
1623 | 3691 |
anItem argument:(menuItem argument). |
1606 | 3692 |
|
3693 |
isExpanded := false. |
|
3694 |
anItem parent:self. |
|
3695 |
children := Array with:anItem. |
|
3696 |
self expand. |
|
3697 |
^ anItem |
|
199 | 3698 |
! ! |
3699 |
||
1631 | 3700 |
!MenuEditor::ActionItem methodsFor:'aspects'! |
1606 | 3701 |
|
3702 |
aspectAt:aKey put:aValue |
|
3703 |
"pass the argument to the delayed menu if existant |
|
3704 |
" |
|
3705 |
aKey == #argument ifTrue:[ |
|
3706 |
self hasDelayedMenu ifTrue:[ |
|
3707 |
children first argument:aValue |
|
3708 |
]. |
|
3709 |
menuItem argument:aValue. |
|
3710 |
^ self |
|
3711 |
]. |
|
1623 | 3712 |
aKey == #triggerOnDown ifTrue:[ |
3713 |
self hasDelayedMenu ifTrue:[ |
|
3714 |
menuItem triggerOnDown:false |
|
3715 |
] ifFalse:[ |
|
3716 |
menuItem triggerOnDown:aValue |
|
3717 |
]. |
|
3718 |
^ self. |
|
3719 |
]. |
|
1606 | 3720 |
super aspectAt:aKey put:aValue. |
3721 |
! |
|
3722 |
||
3723 |
toAspects:aspects |
|
3724 |
"write values to aspects |
|
3725 |
" |
|
1623 | 3726 |
|hasDelayedMenu| |
3727 |
||
1606 | 3728 |
super toAspects:aspects. |
3729 |
||
1623 | 3730 |
hasDelayedMenu := self hasDelayedMenu. |
3731 |
(aspects at:#hasNoDelayedMenuValue) value:(hasDelayedMenu not). |
|
3732 |
||
3733 |
hasDelayedMenu ifTrue:[ |
|
3734 |
(aspects at:#triggerOnDown) value:false |
|
3735 |
]. |
|
356 | 3736 |
! ! |
3737 |
||
1631 | 3738 |
!MenuEditor::ActionItem methodsFor:'displaying'! |
1606 | 3739 |
|
3740 |
icon |
|
3741 |
^ self class iconItem |
|
3742 |
! ! |
|
3743 |
||
1631 | 3744 |
!MenuEditor::ActionItem methodsFor:'initialization'! |
199 | 3745 |
|
3746 |
initialize |
|
3747 |
super initialize. |
|
1606 | 3748 |
isExpanded := true. |
3749 |
! ! |
|
3750 |
||
1631 | 3751 |
!MenuEditor::ActionItem methodsFor:'queries'! |
1606 | 3752 |
|
3753 |
canCollapse |
|
3754 |
^ false |
|
3755 |
! |
|
3756 |
||
3757 |
hasDelayedMenu |
|
3758 |
"returns true if a delayed menu exists |
|
3759 |
" |
|
3760 |
^ children size ~~ 0 |
|
3761 |
! |
|
3762 |
||
3763 |
hasIndicator |
|
3764 |
^ false |
|
3765 |
! |
|
3766 |
||
3767 |
isAction |
|
3768 |
^ true |
|
3769 |
! ! |
|
3770 |
||
1631 | 3771 |
!MenuEditor::ActionItem methodsFor:'queries - operation'! |
1606 | 3772 |
|
3773 |
canAddDelayedMenu |
|
1623 | 3774 |
"returns true if a delayed menu can be added |
1606 | 3775 |
" |
1623 | 3776 |
^ self hasDelayedMenu not |
1606 | 3777 |
! ! |
3778 |
||
1631 | 3779 |
!MenuEditor::LinkedMenuItem class methodsFor:'defaults'! |
1606 | 3780 |
|
3781 |
defaultLabel |
|
3782 |
^ 'Linked Menu' |
|
199 | 3783 |
! ! |
3784 |
||
1631 | 3785 |
!MenuEditor::LinkedMenuItem class methodsFor:'interface - specs'! |
1606 | 3786 |
|
3787 |
basicsEditSpec |
|
3788 |
"This resource specification was automatically generated |
|
3789 |
by the UIPainter of ST/X." |
|
3790 |
||
3791 |
"Do not manually edit this!! If it is corrupted, |
|
3792 |
the UIPainter may not be able to read the specification." |
|
3793 |
||
3794 |
" |
|
3795 |
UIPainter new openOnClass:MenuEditor::ItemLinkedMenu andSelector:#basicsEditSpec |
|
3796 |
" |
|
3797 |
||
3798 |
<resource: #canvas> |
|
3799 |
||
3800 |
^ |
|
3801 |
#(#FullSpec |
|
3802 |
#name: #basicsEditSpec |
|
3803 |
#window: |
|
3804 |
#(#WindowSpec |
|
3805 |
#label: 'basicsEditSpec' |
|
3806 |
#name: 'basicsEditSpec' |
|
3807 |
#min: #(#Point 10 10) |
|
3808 |
#max: #(#Point 1160 870) |
|
1607 | 3809 |
#bounds: #(#Rectangle 93 330 433 670) |
1606 | 3810 |
) |
3811 |
#component: |
|
3812 |
#(#SpecCollection |
|
3813 |
#collection: #( |
|
3814 |
#(#LabelSpec |
|
3815 |
#label: 'Name Key:' |
|
3816 |
#name: 'nameKeyLabel' |
|
3817 |
#layout: #(#AlignmentOrigin 107 0 25 0 1 0.5) |
|
3818 |
#activeHelpKey: #basicsKey |
|
3819 |
#visibilityChannel: #notDelayedMenu |
|
3820 |
#resizeForLabel: true |
|
3821 |
#adjust: #right |
|
3822 |
) |
|
3823 |
#(#InputFieldSpec |
|
3824 |
#name: 'nameKeyField' |
|
3825 |
#layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
|
3826 |
#activeHelpKey: #basicsKey |
|
3827 |
#visibilityChannel: #notDelayedMenu |
|
3828 |
#tabable: true |
|
3829 |
#model: #nameKey |
|
3830 |
#group: #inputGroup |
|
3831 |
#type: #symbolOrNil |
|
3832 |
#immediateAccept: false |
|
3833 |
#acceptOnLeave: false |
|
3834 |
#acceptOnReturn: true |
|
3835 |
#acceptOnTab: true |
|
3836 |
#acceptOnLostFocus: false |
|
3837 |
#acceptChannel: #acceptChannel |
|
3838 |
#modifiedChannel: #modifiedChannel |
|
3839 |
#acceptOnPointerLeave: false |
|
3840 |
) |
|
3841 |
#(#LabelSpec |
|
3842 |
#label: 'Label:' |
|
3843 |
#name: 'labelLabel' |
|
3844 |
#layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
|
3845 |
#activeHelpKey: #basicsLabel |
|
3846 |
#visibilityChannel: #notDelayedMenu |
|
3847 |
#resizeForLabel: true |
|
3848 |
#adjust: #right |
|
3849 |
) |
|
3850 |
#(#InputFieldSpec |
|
3851 |
#name: 'labelField' |
|
3852 |
#layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
|
3853 |
#activeHelpKey: #basicsLabel |
|
3854 |
#visibilityChannel: #notDelayedMenu |
|
3855 |
#tabable: true |
|
3856 |
#model: #rawLabel |
|
3857 |
#group: #inputGroup |
|
3858 |
#immediateAccept: false |
|
3859 |
#acceptOnReturn: true |
|
3860 |
#acceptOnTab: true |
|
3861 |
#acceptOnLostFocus: false |
|
3862 |
#acceptChannel: #acceptChannel |
|
3863 |
#modifiedChannel: #modifiedChannel |
|
3864 |
#acceptOnPointerLeave: false |
|
3865 |
) |
|
3866 |
#(#LabelSpec |
|
3867 |
#label: 'Menu:' |
|
3868 |
#name: 'menuLabel' |
|
3869 |
#layout: #(#AlignmentOrigin 107 0 90 0 1 0.5) |
|
3870 |
#activeHelpKey: #basicsLabel |
|
3871 |
#resizeForLabel: true |
|
3872 |
#adjust: #right |
|
3873 |
) |
|
3874 |
#(#InputFieldSpec |
|
3875 |
#name: 'menuField' |
|
3876 |
#layout: #(#LayoutFrame 110 0 79 0 -5 1.0 101 0) |
|
3877 |
#activeHelpKey: #basicsMenu |
|
3878 |
#tabable: true |
|
3879 |
#model: #submenuChannel |
|
3880 |
#group: #inputGroup |
|
3881 |
#type: #symbolOrNil |
|
3882 |
#immediateAccept: false |
|
3883 |
#acceptOnReturn: true |
|
3884 |
#acceptOnTab: true |
|
3885 |
#acceptOnLostFocus: false |
|
3886 |
#acceptChannel: #acceptChannel |
|
3887 |
#modifiedChannel: #modifiedChannel |
|
3888 |
#acceptOnPointerLeave: false |
|
3889 |
) |
|
3890 |
#(#LabelSpec |
|
3891 |
#label: 'Argument:' |
|
3892 |
#name: 'argumentLabel' |
|
3893 |
#layout: #(#AlignmentOrigin 107 0 115 0 1 0.5) |
|
3894 |
#activeHelpKey: #basicsLabel |
|
3895 |
#resizeForLabel: true |
|
3896 |
#adjust: #right |
|
3897 |
) |
|
3898 |
#(#InputFieldSpec |
|
3899 |
#name: 'argumentField' |
|
3900 |
#layout: #(#LayoutFrame 110 0 104 0 -5 1.0 126 0) |
|
3901 |
#activeHelpKey: #basicsMenuArgument |
|
1607 | 3902 |
#enableChannel: #notDelayedMenu |
1606 | 3903 |
#tabable: true |
3904 |
#model: #argument |
|
3905 |
#group: #inputGroup |
|
3906 |
#type: #smalltalkObject |
|
3907 |
#immediateAccept: false |
|
3908 |
#acceptOnReturn: true |
|
3909 |
#acceptOnTab: true |
|
3910 |
#acceptOnLostFocus: false |
|
3911 |
#acceptChannel: #acceptChannel |
|
3912 |
#modifiedChannel: #modifiedChannel |
|
3913 |
#acceptOnPointerLeave: false |
|
3914 |
) |
|
3915 |
#(#CheckBoxSpec |
|
3916 |
#label: 'Translate Label' |
|
3917 |
#name: 'translateLabelCheckBox' |
|
3918 |
#layout: #(#Point 20 213) |
|
3919 |
#activeHelpKey: #basicsTranslateLabel |
|
3920 |
#visibilityChannel: #notDelayedMenu |
|
3921 |
#tabable: true |
|
3922 |
#model: #translateLabel |
|
3923 |
) |
|
3924 |
#(#CheckBoxSpec |
|
3925 |
#label: 'Is Button' |
|
3926 |
#name: 'isButtonCheckBox' |
|
3927 |
#layout: #(#Point 20 238) |
|
3928 |
#activeHelpKey: #basicsIsButton |
|
3929 |
#visibilityChannel: #notDelayedMenu |
|
3930 |
#tabable: true |
|
3931 |
#model: #isButton |
|
3932 |
) |
|
3933 |
#(#CheckBoxSpec |
|
1636 | 3934 |
#label: 'Horizontal Layout' |
1606 | 3935 |
#name: 'horizontalLayout' |
3936 |
#layout: #(#Point 20 263) |
|
3937 |
#activeHelpKey: #horizontalLayout |
|
3938 |
#tabable: true |
|
3939 |
#model: #horizontalLayout |
|
3940 |
) |
|
3941 |
#(#CheckBoxSpec |
|
1636 | 3942 |
#label: 'Do not Destroy Linked Menu' |
1606 | 3943 |
#name: 'keepLinkedMenu' |
3944 |
#layout: #(#Point 20 288) |
|
3945 |
#activeHelpKey: #keepLinkedMenu |
|
3946 |
#tabable: true |
|
3947 |
#model: #keepLinkedMenu |
|
3948 |
#translateLabel: true |
|
3949 |
) |
|
3950 |
) |
|
3951 |
||
3952 |
) |
|
3953 |
) |
|
3954 |
! ! |
|
3955 |
||
1631 | 3956 |
!MenuEditor::LinkedMenuItem methodsFor:'accessing'! |
1606 | 3957 |
|
3958 |
argument:aValue |
|
3959 |
menuItem argument:aValue. |
|
3960 |
! |
|
3961 |
||
3962 |
menuItem |
|
3963 |
"returns self as a MenuItem |
|
3964 |
" |
|
3965 |
|item| |
|
3966 |
||
3967 |
item := super menuItem. |
|
3968 |
item submenuChannel:(self submenuChannel). |
|
3969 |
^ item |
|
3970 |
! |
|
3971 |
||
3972 |
slices |
|
3973 |
self isDelayedMenu ifTrue:[ |
|
3974 |
^ #( |
|
3975 |
(Basics basicsEditSpec ) |
|
3976 |
) |
|
1389 | 3977 |
]. |
3978 |
||
1606 | 3979 |
^ #( |
3980 |
(Basics basicsEditSpec ) |
|
3981 |
(Details detailsEditSpec) |
|
3982 |
(Image image ) |
|
3983 |
(Help help) |
|
3984 |
) |
|
3985 |
! |
|
3986 |
||
3987 |
submenuChannel |
|
3988 |
^ menuItem submenuChannel ? #unspecified |
|
3989 |
! |
|
3990 |
||
3991 |
submenuChannel:aValue |
|
3992 |
menuItem submenuChannel:aValue. |
|
3993 |
! ! |
|
3994 |
||
1631 | 3995 |
!MenuEditor::LinkedMenuItem methodsFor:'aspects'! |
1606 | 3996 |
|
3997 |
aspectAt:aKey put:aValue |
|
3998 |
"set a specific aspect named aKey to the aValue |
|
3999 |
" |
|
4000 |
aKey == #submenuChannel ifTrue:[ ^ self submenuChannel:aValue ]. |
|
4001 |
super aspectAt:aKey put:aValue. |
|
4002 |
! |
|
4003 |
||
1653
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4004 |
getDelayedAttributesFrom:anItem |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4005 |
|
1606 | 4006 |
menuItem rawLabel:'Delayed'. |
4007 |
||
1653
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4008 |
menuItem submenuChannel:(self validateValue:(anItem submenuChannel)). |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4009 |
menuItem horizontalLayout:(self validateValue:(anItem horizontalLayout)). |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4010 |
menuItem horizontalLayout:(self validateValue:(anItem keepLinkedMenu)). |
1389 | 4011 |
! |
4012 |
||
1606 | 4013 |
setDelayedAttributesTo:aMenuItem |
4014 |
aMenuItem submenuChannel:(self submenuChannel). |
|
4015 |
aMenuItem horizontalLayout:(menuItem horizontalLayout). |
|
4016 |
aMenuItem keepLinkedMenu:(menuItem keepLinkedMenu). |
|
4017 |
! ! |
|
4018 |
||
1631 | 4019 |
!MenuEditor::LinkedMenuItem methodsFor:'displaying'! |
1606 | 4020 |
|
4021 |
displayLabel |
|
4022 |
"returns the label dependent on is delayed or not |
|
4023 |
" |
|
4024 |
self isDelayedMenu ifTrue:[ ^ self submenuChannel ]. |
|
4025 |
^ menuItem rawLabel |
|
199 | 4026 |
! |
4027 |
||
1606 | 4028 |
icon |
4029 |
self isDelayedMenu ifTrue:[ ^ self class iconDelayedLinkedMenu ]. |
|
4030 |
^ self class iconLinkedMenu |
|
4031 |
! ! |
|
4032 |
||
1631 | 4033 |
!MenuEditor::LinkedMenuItem methodsFor:'queries'! |
1606 | 4034 |
|
4035 |
isKindOfMenu |
|
4036 |
^ true |
|
4037 |
! ! |
|
4038 |
||
1633 | 4039 |
!MenuEditor::RegularMenuItem class methodsFor:'defaults'! |
1606 | 4040 |
|
4041 |
defaultDelayedLabel |
|
4042 |
^ 'delayed' |
|
199 | 4043 |
! |
4044 |
||
1606 | 4045 |
defaultLabel |
4046 |
^ 'Menu' |
|
4047 |
! ! |
|
4048 |
||
1633 | 4049 |
!MenuEditor::RegularMenuItem class methodsFor:'instance creation'! |
1606 | 4050 |
|
4051 |
menu:aMenu labeled:aString |
|
4052 |
|item| |
|
4053 |
||
4054 |
item := self new. |
|
4055 |
item menu:aMenu labeled:aString. |
|
1631 | 4056 |
^ item |
4057 |
! |
|
4058 |
||
4059 |
menu:aMenu labeled:aString translateLabel:translateLabel |
|
4060 |
|item| |
|
4061 |
||
4062 |
item := self new. |
|
4063 |
item menu:aMenu labeled:aString. |
|
4064 |
item translateLabel:translateLabel. |
|
4065 |
^ item |
|
1606 | 4066 |
! ! |
4067 |
||
1633 | 4068 |
!MenuEditor::RegularMenuItem class methodsFor:'interface - specs'! |
1606 | 4069 |
|
4070 |
basicsEditSpec |
|
4071 |
"This resource specification was automatically generated |
|
4072 |
by the UIPainter of ST/X." |
|
4073 |
||
4074 |
"Do not manually edit this!! If it is corrupted, |
|
4075 |
the UIPainter may not be able to read the specification." |
|
4076 |
||
4077 |
" |
|
4078 |
UIPainter new openOnClass:MenuEditor::ItemMenu andSelector:#basicsEditSpec |
|
4079 |
" |
|
4080 |
||
4081 |
<resource: #canvas> |
|
4082 |
||
4083 |
^ |
|
4084 |
#(#FullSpec |
|
4085 |
#name: #basicsEditSpec |
|
4086 |
#window: |
|
4087 |
#(#WindowSpec |
|
4088 |
#label: 'basicsEditSpec' |
|
4089 |
#name: 'basicsEditSpec' |
|
4090 |
#min: #(#Point 10 10) |
|
4091 |
#max: #(#Point 1160 870) |
|
4092 |
#bounds: #(#Rectangle 810 135 1150 475) |
|
4093 |
) |
|
4094 |
#component: |
|
4095 |
#(#SpecCollection |
|
4096 |
#collection: #( |
|
4097 |
#(#LabelSpec |
|
4098 |
#label: 'Name Key:' |
|
4099 |
#name: 'nameKeyLabel' |
|
4100 |
#layout: #(#AlignmentOrigin 107 0 25 0 1 0.5) |
|
4101 |
#activeHelpKey: #basicsKey |
|
4102 |
#visibilityChannel: #notDelayedMenu |
|
4103 |
#resizeForLabel: true |
|
4104 |
#adjust: #right |
|
4105 |
) |
|
4106 |
#(#InputFieldSpec |
|
4107 |
#name: 'nameKeyField' |
|
4108 |
#layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
|
4109 |
#activeHelpKey: #basicsKey |
|
4110 |
#visibilityChannel: #notDelayedMenu |
|
4111 |
#tabable: true |
|
4112 |
#model: #nameKey |
|
4113 |
#group: #inputGroup |
|
4114 |
#type: #symbolOrNil |
|
4115 |
#immediateAccept: false |
|
4116 |
#acceptOnLeave: false |
|
4117 |
#acceptOnReturn: true |
|
4118 |
#acceptOnTab: true |
|
4119 |
#acceptOnLostFocus: false |
|
4120 |
#acceptChannel: #acceptChannel |
|
4121 |
#modifiedChannel: #modifiedChannel |
|
4122 |
#acceptOnPointerLeave: false |
|
4123 |
) |
|
4124 |
#(#LabelSpec |
|
4125 |
#label: 'Label:' |
|
4126 |
#name: 'labelLabel' |
|
4127 |
#layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
|
4128 |
#activeHelpKey: #basicsLabel |
|
4129 |
#visibilityChannel: #notDelayedMenu |
|
4130 |
#resizeForLabel: true |
|
4131 |
#adjust: #right |
|
4132 |
) |
|
4133 |
#(#InputFieldSpec |
|
4134 |
#name: 'labelField' |
|
4135 |
#layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
|
4136 |
#activeHelpKey: #basicsLabel |
|
4137 |
#visibilityChannel: #notDelayedMenu |
|
4138 |
#tabable: true |
|
4139 |
#model: #rawLabel |
|
4140 |
#group: #inputGroup |
|
4141 |
#immediateAccept: false |
|
4142 |
#acceptOnReturn: true |
|
4143 |
#acceptOnTab: true |
|
4144 |
#acceptOnLostFocus: false |
|
4145 |
#acceptChannel: #acceptChannel |
|
4146 |
#modifiedChannel: #modifiedChannel |
|
4147 |
#acceptOnPointerLeave: false |
|
4148 |
) |
|
4149 |
#(#CheckBoxSpec |
|
4150 |
#label: 'Translate Label' |
|
4151 |
#name: 'translateLabelCheckBox' |
|
4152 |
#layout: #(#Point 20 213) |
|
4153 |
#activeHelpKey: #basicsTranslateLabel |
|
4154 |
#visibilityChannel: #notDelayedMenu |
|
4155 |
#tabable: true |
|
4156 |
#model: #translateLabel |
|
4157 |
) |
|
4158 |
#(#CheckBoxSpec |
|
4159 |
#label: 'Is Button' |
|
4160 |
#name: 'isButtonCheckBox' |
|
4161 |
#layout: #(#Point 20 238) |
|
4162 |
#activeHelpKey: #basicsIsButton |
|
4163 |
#visibilityChannel: #notDelayedMenu |
|
4164 |
#tabable: true |
|
4165 |
#model: #isButton |
|
4166 |
) |
|
4167 |
#(#CheckBoxSpec |
|
1636 | 4168 |
#label: 'Horizontal Layout' |
1606 | 4169 |
#name: 'horizontalLayout' |
4170 |
#layout: #(#Point 20 263) |
|
4171 |
#activeHelpKey: #horizontalLayout |
|
4172 |
#tabable: true |
|
4173 |
#model: #horizontalLayout |
|
4174 |
) |
|
4175 |
) |
|
4176 |
||
4177 |
) |
|
4178 |
) |
|
4179 |
! ! |
|
4180 |
||
1633 | 4181 |
!MenuEditor::RegularMenuItem methodsFor:'accessing'! |
1606 | 4182 |
|
4183 |
argument:aValue |
|
4184 |
"/ ignorred. |
|
218 | 4185 |
! |
4186 |
||
1606 | 4187 |
menu:aMenu labeled:aString |
4188 |
|expanded item menu| |
|
4189 |
||
4190 |
self criticalDo:[ |
|
1653
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4191 |
self isRootItem ifTrue:[ expanded := true ] |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4192 |
ifFalse:[ expanded := isExpanded ]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4193 |
|
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4194 |
self removeAll. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4195 |
self rawLabel:aString. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4196 |
|
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4197 |
menu := aMenu value. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4198 |
|
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4199 |
(menu isNil or:[menu isString]) ifTrue:[ |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4200 |
menu := nil |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4201 |
] ifFalse:[ |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4202 |
aMenu isCollection ifTrue:[ menu := Menu new fromLiteralArrayEncoding:aMenu ] |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4203 |
ifFalse:[ menu := aMenu ]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4204 |
|
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4205 |
menu numberOfItems == 0 ifTrue:[ |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4206 |
menu := nil |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4207 |
]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4208 |
]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4209 |
menu ifNotNil:[ |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4210 |
isExpanded := false. "/ discard change notifications |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4211 |
children := OrderedCollection new. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4212 |
|
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4213 |
menu itemsDo:[:el| |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4214 |
item := self class menuItem:el. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4215 |
item parent:self. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4216 |
children add:item. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4217 |
]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4218 |
expanded ifTrue:[ self expand ]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4219 |
]. |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4220 |
isExpanded := expanded. |
1606 | 4221 |
]. |
4222 |
self changed |
|
199 | 4223 |
! |
4224 |
||
1606 | 4225 |
menuItem |
4226 |
"returns self as a MenuItem |
|
4227 |
" |
|
4228 |
|item| |
|
4229 |
||
4230 |
item := super menuItem. |
|
4231 |
item submenu:(self submenu). |
|
4232 |
^ item |
|
199 | 4233 |
! |
4234 |
||
1606 | 4235 |
menuItem:anItem |
4236 |
||
4237 |
super menuItem:anItem. |
|
4238 |
self menu:(anItem submenu) labeled:nil. |
|
4239 |
! |
|
4240 |
||
4241 |
slices |
|
4242 |
self isDelayedMenu ifTrue:[ |
|
4243 |
^ #( |
|
4244 |
(Basics basicsEditSpec ) |
|
4245 |
) |
|
4246 |
]. |
|
4247 |
||
4248 |
^ #( |
|
4249 |
(Basics basicsEditSpec ) |
|
4250 |
(Details detailsEditSpec) |
|
4251 |
(Image image ) |
|
4252 |
(Help help) |
|
4253 |
) |
|
4254 |
! |
|
4255 |
||
4256 |
submenu |
|
4257 |
|menu| |
|
4258 |
||
4259 |
menu := Menu new. |
|
4260 |
||
4261 |
children size ~~ 0 ifTrue:[ |
|
4262 |
children do:[:el| menu addItem:(el menuItem) ]. |
|
4263 |
]. |
|
4264 |
^ menu |
|
4265 |
! ! |
|
4266 |
||
1633 | 4267 |
!MenuEditor::RegularMenuItem methodsFor:'aspects'! |
1606 | 4268 |
|
4269 |
getDelayedAttributesFrom:aMenuItem |
|
4270 |
||
1653
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4271 |
|menu| |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4272 |
|
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4273 |
menu := self validateValue:(aMenuItem submenu value). |
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4274 |
|
1798c7bcb787
test whether attributes from MenuItem are not a block or model
ca
parents:
1645
diff
changeset
|
4275 |
self menu:menu labeled:nil. |
1606 | 4276 |
menuItem horizontalLayout:(aMenuItem horizontalLayout). |
4277 |
! |
|
4278 |
||
4279 |
setDelayedAttributesTo:aMenuItem |
|
4280 |
aMenuItem submenu:(self submenu). |
|
4281 |
aMenuItem horizontalLayout:(menuItem horizontalLayout). |
|
4282 |
! ! |
|
4283 |
||
1633 | 4284 |
!MenuEditor::RegularMenuItem methodsFor:'displaying'! |
1606 | 4285 |
|
4286 |
displayLabel |
|
4287 |
"returns the label dependent on is delayed or not |
|
4288 |
" |
|
4289 |
self isDelayedMenu ifTrue:[ ^ self class defaultDelayedLabel ]. |
|
4290 |
^ menuItem rawLabel |
|
4291 |
! |
|
4292 |
||
4293 |
icon |
|
4294 |
self isDelayedMenu ifTrue:[ ^ self class iconDelayedMenu ]. |
|
4295 |
^ self class iconMenu |
|
4296 |
! ! |
|
4297 |
||
1633 | 4298 |
!MenuEditor::RegularMenuItem methodsFor:'queries'! |
1606 | 4299 |
|
4300 |
canAddChildren |
|
4301 |
"children can be added |
|
4302 |
" |
|
4303 |
^ true |
|
4304 |
! |
|
4305 |
||
4306 |
canExpand |
|
4307 |
"returns true if the item is expandable |
|
4308 |
" |
|
4309 |
^ isExpanded == false |
|
4310 |
! |
|
4311 |
||
4312 |
hasIndicator |
|
4313 |
^ true |
|
968
f52b5744063b
added standard-submenu generators (in item menu)
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
4314 |
! |
f52b5744063b
added standard-submenu generators (in item menu)
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
4315 |
|
1606 | 4316 |
isKindOfMenu |
4317 |
^ true |
|
4318 |
! ! |
|
4319 |
||
4320 |
!MenuEditor::ResourceEditor class methodsFor:'interface specs'! |
|
4321 |
||
4322 |
windowSpec |
|
4323 |
"This resource specification was automatically generated |
|
4324 |
by the UIPainter of ST/X." |
|
4325 |
||
4326 |
"Do not manually edit this!! If it is corrupted, |
|
4327 |
the UIPainter may not be able to read the specification." |
|
4328 |
||
4329 |
" |
|
4330 |
UIPainter new openOnClass:MenuEditor::ResourceEditor andSelector:#windowSpec |
|
4331 |
MenuEditor::ResourceEditor new openInterface:#windowSpec |
|
4332 |
MenuEditor::ResourceEditor open |
|
4333 |
" |
|
4334 |
||
4335 |
<resource: #canvas> |
|
4336 |
||
4337 |
^ |
|
4338 |
#(#FullSpec |
|
4339 |
#name: #windowSpec |
|
4340 |
#window: |
|
4341 |
#(#WindowSpec |
|
4342 |
#label: 'Image Item' |
|
4343 |
#name: 'Image Item' |
|
4344 |
#min: #(#Point 10 10) |
|
4345 |
#max: #(#Point 1280 1024) |
|
4346 |
#bounds: #(#Rectangle 333 290 621 585) |
|
4347 |
) |
|
4348 |
#component: |
|
4349 |
#(#SpecCollection |
|
4350 |
#collection: #( |
|
4351 |
#(#LabelSpec |
|
4352 |
#label: 'Retriever:' |
|
4353 |
#name: 'retrieverLabel' |
|
4354 |
#layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
|
4355 |
#activeHelpKey: #imageRetriever |
|
4356 |
#resizeForLabel: true |
|
4357 |
#adjust: #right |
|
4358 |
) |
|
4359 |
#(#ComboBoxSpec |
|
4360 |
#name: 'retrieverHolder' |
|
4361 |
#layout: #(#LayoutFrame 110 0 15 0 -20 1.0 37 0) |
|
4362 |
#activeHelpKey: #imageRetriever |
|
4363 |
#tabable: true |
|
4364 |
#model: #retrieverHolder |
|
4365 |
#type: #symbolOrNil |
|
4366 |
#immediateAccept: true |
|
4367 |
#acceptOnReturn: false |
|
4368 |
#acceptOnTab: false |
|
4369 |
#acceptOnPointerLeave: false |
|
4370 |
#comboList: #retrieverList |
|
4371 |
#isFilenameBox: false |
|
4372 |
) |
|
4373 |
#(#LabelSpec |
|
4374 |
#label: 'Selector:' |
|
4375 |
#name: 'iconLabel' |
|
4376 |
#layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
|
4377 |
#activeHelpKey: #imageSelector |
|
4378 |
#resizeForLabel: true |
|
4379 |
#adjust: #right |
|
4380 |
) |
|
4381 |
#(#InputFieldSpec |
|
4382 |
#name: 'selectorHolder' |
|
4383 |
#layout: #(#LayoutFrame 110 0 40 0 -42 1.0 62 0) |
|
4384 |
#activeHelpKey: #imageSelector |
|
4385 |
#tabable: true |
|
4386 |
#model: #selectorHolder |
|
4387 |
#group: #inputGroup |
|
4388 |
#type: #symbolOrNil |
|
4389 |
#immediateAccept: true |
|
4390 |
#acceptOnReturn: false |
|
4391 |
#acceptOnTab: false |
|
4392 |
#modifiedChannel: #modifiedChannel |
|
4393 |
#acceptOnPointerLeave: false |
|
4394 |
) |
|
4395 |
#(#ActionButtonSpec |
|
4396 |
#label: '...' |
|
4397 |
#name: 'browseButton' |
|
4398 |
#layout: #(#LayoutFrame -40 1 40 0 -20 1 62 0) |
|
4399 |
#activeHelpKey: #browseResource |
|
4400 |
#tabable: true |
|
4401 |
#model: #doBrowseForImageResource |
|
4402 |
) |
|
4403 |
#(#HierarchicalListViewSpec |
|
4404 |
#name: 'imageList' |
|
4405 |
#layout: #(#LayoutFrame 20 0.0 67 0 -20 1.0 -30 1.0) |
|
4406 |
#activeHelpKey: #imageImageList |
|
4407 |
#model: #imageHolder |
|
4408 |
#menu: #menuEditImage |
|
4409 |
#hasHorizontalScrollBar: true |
|
4410 |
#hasVerticalScrollBar: true |
|
4411 |
#miniScrollerHorizontal: true |
|
4412 |
#listModel: #imageList |
|
4413 |
#useIndex: false |
|
4414 |
#highlightMode: #label |
|
4415 |
#postBuildCallback: #postBuildImageViewer: |
|
4416 |
) |
|
4417 |
#(#ViewSpec |
|
4418 |
#name: 'Box1' |
|
4419 |
#layout: #(#LayoutFrame 20 0.0 -30 1.0 -20 1.0 0 1.0) |
|
4420 |
#level: 0 |
|
4421 |
#component: |
|
4422 |
#(#SpecCollection |
|
4423 |
#collection: #( |
|
4424 |
#(#CheckBoxSpec |
|
4425 |
#label: 'Image & Label' |
|
4426 |
#name: 'iconAndLabelCheckBox' |
|
4427 |
#layout: #(#AlignmentOrigin 0 0 0 0.5 0 0.5) |
|
4428 |
#activeHelpKey: #imageImageAndLabel |
|
4429 |
#tabable: true |
|
4430 |
#model: #iconAndLabelHolder |
|
4431 |
) |
|
4432 |
#(#ActionButtonSpec |
|
4433 |
#label: 'Image Editor' |
|
4434 |
#name: 'imageEditorButton' |
|
4435 |
#layout: #(#AlignmentOrigin 0 1.0 0 0.5 1 0.5) |
|
4436 |
#activeHelpKey: #imageImageEditor |
|
4437 |
#tabable: true |
|
4438 |
#model: #doEditImage |
|
4439 |
) |
|
4440 |
) |
|
4441 |
||
4442 |
) |
|
4443 |
) |
|
4444 |
) |
|
4445 |
||
4446 |
) |
|
4447 |
) |
|
4448 |
! ! |
|
4449 |
||
4450 |
!MenuEditor::ResourceEditor methodsFor:'accessing'! |
|
4451 |
||
4452 |
resourceRetriever |
|
4453 |
|rcv sel cls| |
|
4454 |
||
4455 |
sel := selectorHolder value. |
|
4456 |
sel size == 0 ifTrue:[ ^ nil ]. |
|
4457 |
cls := self retrieverClass. |
|
4458 |
cls ifNotNil:[ cls := cls name asSymbol ]. |
|
4459 |
||
4460 |
rcv := ResourceRetriever new. |
|
4461 |
rcv className:cls. |
|
4462 |
rcv selector:sel. |
|
4463 |
||
4464 |
iconAndLabelHolder value ifTrue:[ rcv labelText:'' ]. |
|
1641
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4465 |
^ rcv |
1606 | 4466 |
! |
4467 |
||
4468 |
resourceRetriever:aResourceRetriever |
|
4469 |
|cls sel isOn| |
|
4470 |
||
4471 |
aResourceRetriever notNil ifTrue:[ |
|
4472 |
cls := aResourceRetriever className. |
|
4473 |
cls ifNotNil:[ |
|
4474 |
cls isBehavior ifTrue:[cls := cls name asSymbol]. |
|
4475 |
]. |
|
4476 |
sel := aResourceRetriever selector. |
|
4477 |
isOn := aResourceRetriever labelText notNil. |
|
4478 |
] ifFalse:[ |
|
4479 |
cls := sel := nil. |
|
4480 |
isOn := false. |
|
1586 | 4481 |
]. |
1606 | 4482 |
|
4483 |
retrieverHolder value:cls. |
|
4484 |
selectorHolder value:sel. |
|
4485 |
iconAndLabelHolder value:isOn. |
|
4486 |
! |
|
4487 |
||
4488 |
retrieverClass |
|
4489 |
|cls| |
|
4490 |
||
4491 |
cls := retrieverHolder value. |
|
4492 |
||
4493 |
cls size ~~ 0 ifTrue:[ |
|
4494 |
cls := Smalltalk at:cls ifAbsent:nil. |
|
4495 |
||
4496 |
(cls notNil and:[cls isBehavior]) ifTrue:[ |
|
4497 |
^ cls |
|
4498 |
]. |
|
4499 |
]. |
|
4500 |
^ nil |
|
4501 |
! ! |
|
4502 |
||
4503 |
!MenuEditor::ResourceEditor methodsFor:'actions'! |
|
4504 |
||
4505 |
doBrowseForImageResource |
|
4506 |
"opens a browser on image-resource methods" |
|
4507 |
||
4508 |
|msg| |
|
4509 |
||
4510 |
msg := ResourceSelectionBrowser |
|
4511 |
request:'Use Image From Class' |
|
4512 |
onSuperclass:nil |
|
4513 |
andClass:(self retrieverClass) |
|
4514 |
andSelector:(selectorHolder value) |
|
4515 |
withResourceTypes:#(image fileImage programImage). |
|
4516 |
||
4517 |
msg ifNil:[ ^ self ]. |
|
4518 |
msg := msg asCollectionOfWords. |
|
4519 |
msg size == 2 ifFalse:[ ^ self ]. |
|
4520 |
||
4521 |
retrieverHolder value:(msg first asSymbol). |
|
4522 |
selectorHolder value:(msg last asSymbol). |
|
4523 |
! |
|
4524 |
||
4525 |
doEditImage |
|
1641
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4526 |
|sel cls item| |
1606 | 4527 |
|
4528 |
item := imageHolder value. |
|
1641
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4529 |
item notNil ifTrue:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4530 |
item doEdit |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4531 |
] ifFalse:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4532 |
(sel := selectorHolder value) isNil ifTrue:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4533 |
Dialog warn:'No selector is defined.'. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4534 |
] ifFalse:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4535 |
(cls := retrieverHolder value) isNil ifTrue:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4536 |
Dialog warn:'No resource retriever is defined.'. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4537 |
] ifFalse:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4538 |
cls := Smalltalk classNamed:cls. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4539 |
cls isNil ifTrue:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4540 |
Dialog warn:'No such resource retriever class.'. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4541 |
] ifFalse:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4542 |
ImageEditor openOnClass:cls andSelector:sel |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4543 |
] |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4544 |
] |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4545 |
] |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4546 |
]. |
1606 | 4547 |
! ! |
4548 |
||
4549 |
!MenuEditor::ResourceEditor methodsFor:'aspects'! |
|
4550 |
||
4551 |
iconAndLabelHolder |
|
4552 |
^ iconAndLabelHolder |
|
4553 |
! |
|
4554 |
||
4555 |
imageHolder |
|
4556 |
^ imageHolder. |
|
603 | 4557 |
! |
4558 |
||
1606 | 4559 |
imageList |
4560 |
^ imageList. |
|
4561 |
! |
|
4562 |
||
4563 |
modifiedChannel |
|
4564 |
^ builder booleanValueAspectFor: #modifiedChannel |
|
4565 |
! |
|
4566 |
||
4567 |
modifiedChannel:aChannel |
|
4568 |
builder aspectAt:#modifiedChannel put:aChannel. |
|
4569 |
! |
|
4570 |
||
4571 |
retrieverHolder |
|
4572 |
^ retrieverHolder |
|
4573 |
! |
|
4574 |
||
4575 |
retrieverList |
|
4576 |
|list| |
|
4577 |
||
4578 |
list := builder bindingAt:#retrieverList. |
|
4579 |
||
4580 |
list ifNil:[ |
|
4581 |
list := MenuEditor imageRetrieverClasses asList. |
|
4582 |
builder aspectAt:#retrieverList put:list. |
|
4583 |
]. |
|
4584 |
^ list |
|
199 | 4585 |
! |
4586 |
||
1606 | 4587 |
selectorHolder |
4588 |
^ selectorHolder. |
|
4589 |
! ! |
|
4590 |
||
4591 |
!MenuEditor::ResourceEditor methodsFor:'change & update'! |
|
4592 |
||
4593 |
retrieverChanged |
|
4594 |
"called if the retriever changed |
|
4595 |
" |
|
4596 |
|retriever list name| |
|
4597 |
||
4598 |
retriever := self retrieverClass. |
|
4599 |
imageHolder setValue:nil. |
|
4600 |
||
4601 |
imageList root fromClass:retriever. |
|
1641
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4602 |
self updateImageHolder. |
1606 | 4603 |
|
4604 |
(retriever notNil and:[imageList size ~~ 0]) ifTrue:[ |
|
4605 |
list := self retrieverList. |
|
4606 |
name := retriever name. |
|
4607 |
||
4608 |
(list includes:name) ifFalse:[ |
|
4609 |
list add:(name asSymbol). |
|
4610 |
] |
|
4611 |
]. |
|
398 | 4612 |
! |
4613 |
||
1606 | 4614 |
selectorChanged |
1641
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4615 |
self updateImageHolder. |
968
f52b5744063b
added standard-submenu generators (in item menu)
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
4616 |
! |
f52b5744063b
added standard-submenu generators (in item menu)
Claus Gittinger <cg@exept.de>
parents:
959
diff
changeset
|
4617 |
|
1606 | 4618 |
update:what with:aPara from:aModel |
4619 |
"Invoked when an object that I depend upon sends a change notification." |
|
4620 |
||
4621 |
|item| |
|
4622 |
||
4623 |
self modifiedChannel value:true. |
|
4624 |
||
4625 |
aModel == retrieverHolder ifTrue:[ ^ self retrieverChanged ]. |
|
4626 |
aModel == selectorHolder ifTrue:[ ^ self selectorChanged ]. |
|
4627 |
||
4628 |
aModel == imageHolder ifTrue:[ |
|
1641
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4629 |
item := imageHolder value. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4630 |
item ifNotNil:[ selectorHolder value:(item label) ]. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4631 |
^ self |
1606 | 4632 |
]. |
4633 |
super update:what with:aPara from:aModel |
|
1641
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4634 |
! |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4635 |
|
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4636 |
updateImageHolder |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4637 |
|item selector line| |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4638 |
|
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4639 |
imageList isEmpty ifTrue:[^ self]. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4640 |
|
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4641 |
selector := selectorHolder value. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4642 |
selector size == 0 ifTrue:[ imageHolder value:nil. ^ self ]. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4643 |
|
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4644 |
item := nil. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4645 |
selector := selector asSymbol. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4646 |
|
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4647 |
imageList do:[:anItem| |sel| |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4648 |
sel := anItem selector. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4649 |
selector == sel ifTrue:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4650 |
imageHolder value:anItem. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4651 |
^ self |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4652 |
]. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4653 |
item ifNil:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4654 |
(sel startsWith:selector) ifTrue:[ item := anItem ] |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4655 |
] |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4656 |
]. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4657 |
imageHolder value:nil. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4658 |
|
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4659 |
item ifNotNil:[ |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4660 |
line := imageList identityIndexOf:item. |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4661 |
imageViewer scrollToLine:line |
7e63a11f3333
allow editing even if there is no image yet
Claus Gittinger <cg@exept.de>
parents:
1636
diff
changeset
|
4662 |
]. |
1606 | 4663 |
! ! |
4664 |
||
4665 |
!MenuEditor::ResourceEditor methodsFor:'initialization'! |
|
4666 |
||
4667 |
initialize |
|
4668 |
super initialize. |
|
4669 |
||
4670 |
iconAndLabelHolder := true asValue. |
|
4671 |
iconAndLabelHolder addDependent:self. |
|
4672 |
||
4673 |
imageHolder := nil asValue. |
|
4674 |
||
4675 |
selectorHolder := nil asValue. |
|
4676 |
selectorHolder addDependent:self. |
|
4677 |
||
4678 |
imageList := HierarchicalList new. |
|
4679 |
imageList application:self. |
|
4680 |
imageList root:(MenuEditor::ResourceEditorItem new). |
|
4681 |
imageList showRoot:false. |
|
4682 |
||
4683 |
imageHolder := nil asValue. |
|
4684 |
imageHolder addDependent:self. |
|
4685 |
||
4686 |
retrieverHolder := nil asValue. |
|
4687 |
retrieverHolder addDependent:self. |
|
4688 |
! |
|
4689 |
||
4690 |
postBuildImageViewer:aWidget |
|
4691 |
imageViewer := aWidget. |
|
4692 |
! ! |
|
4693 |
||
4694 |
!MenuEditor::ResourceEditorItem class methodsFor:'instance creation'! |
|
4695 |
||
4696 |
fromClass:aClass selector:aSelector |
|
4697 |
|item| |
|
4698 |
||
4699 |
item := self new. |
|
4700 |
item fromClass:aClass selector:aSelector. |
|
4701 |
^ item |
|
4702 |
! ! |
|
4703 |
||
4704 |
!MenuEditor::ResourceEditorItem methodsFor:'accessing'! |
|
4705 |
||
4706 |
icon |
|
4707 |
^ icon |
|
4708 |
! |
|
4709 |
||
4710 |
label |
|
4711 |
^ selector |
|
557 | 4712 |
! |
4713 |
||
1606 | 4714 |
selector |
4715 |
^ selector |
|
4716 |
! ! |
|
4717 |
||
4718 |
!MenuEditor::ResourceEditorItem methodsFor:'instance creation'! |
|
4719 |
||
4720 |
fromClass:aClass |
|
4721 |
|r item| |
|
4722 |
||
4723 |
(aClass notNil and:[aClass isBehavior]) ifFalse:[ |
|
4724 |
^ self collapse. |
|
4725 |
]. |
|
4726 |
aClass == selector ifTrue:[ |
|
4727 |
^ self expand |
|
4728 |
]. |
|
4729 |
self collapse. |
|
4730 |
||
4731 |
selector := aClass. |
|
4732 |
children := SortedCollection sortBlock:[:a :b| a label < b label ]. |
|
4733 |
||
4734 |
self application withWaitCursorDo:[ |
|
4735 |
aClass withAllSuperclassesDo:[:aClass| |
|
4736 |
aClass class selectorsAndMethodsDo:[:sel :m| |
|
4737 |
((r := m resourceType) == #image or:[r == #programImage]) ifTrue:[ |
|
4738 |
item := self class fromClass:aClass selector:sel. |
|
4739 |
item parent:self. |
|
4740 |
children add:item |
|
4741 |
] |
|
4742 |
] |
|
4743 |
]. |
|
4744 |
self expand |
|
4745 |
]. |
|
4746 |
! |
|
4747 |
||
4748 |
fromClass:aClass selector:aSelector |
|
4749 |
|w h magnify| |
|
4750 |
||
4751 |
selector := aSelector asSymbol. |
|
4752 |
icon := aClass perform:selector. |
|
4753 |
||
4754 |
w := icon width. |
|
4755 |
h := icon height. |
|
4756 |
||
4757 |
w > 32 ifTrue:[ |
|
4758 |
magnify := 32 / w. |
|
4759 |
h > 32 ifTrue:[ magnify := (32 / h) max:magnify ]. |
|
4760 |
] ifFalse:[ |
|
4761 |
h > 32 ifFalse:[^ self]. |
|
4762 |
magnify := 32 / h. |
|
4763 |
]. |
|
4764 |
icon := icon magnifiedBy: magnify. |
|
4765 |
! |
|
4766 |
||
4767 |
initialize |
|
4768 |
super initialize. |
|
4769 |
children := #(). |
|
4770 |
! ! |
|
4771 |
||
4772 |
!MenuEditor::ResourceEditorItem methodsFor:'user operations'! |
|
4773 |
||
4774 |
doEdit |
|
4775 |
"open image browser on self |
|
4776 |
" |
|
4777 |
|parent| |
|
4778 |
||
4779 |
parent := self parent. |
|
4780 |
||
4781 |
parent ifNotNil:[ |
|
4782 |
ImageEditor openOnClass:(parent selector) andSelector:selector |
|
4783 |
]. |
|
199 | 4784 |
! ! |
4785 |
||
1631 | 4786 |
!MenuEditor::RootItem class methodsFor:'defaults'! |
4787 |
||
4788 |
defaultLabel |
|
4789 |
^ MenuEditor resourceType |
|
4790 |
! ! |
|
4791 |
||
4792 |
!MenuEditor::RootItem class methodsFor:'interface - editor'! |
|
4793 |
||
4794 |
addBindingsTo:aspects for:aMenuEditor |
|
4795 |
"add additional bindings to the aspects |
|
4796 |
" |
|
4797 |
! ! |
|
4798 |
||
4799 |
!MenuEditor::RootItem class methodsFor:'interface - specs'! |
|
4800 |
||
4801 |
basicsEditSpec |
|
4802 |
"This resource specification was automatically generated |
|
4803 |
by the UIPainter of ST/X." |
|
4804 |
||
4805 |
"Do not manually edit this!! If it is corrupted, |
|
4806 |
the UIPainter may not be able to read the specification." |
|
4807 |
||
4808 |
" |
|
4809 |
UIPainter new openOnClass:MenuEditor::ItemRoot andSelector:#basicsEditSpec |
|
4810 |
" |
|
4811 |
||
4812 |
<resource: #canvas> |
|
4813 |
||
4814 |
^ |
|
4815 |
#(#FullSpec |
|
4816 |
#name: #basicsEditSpec |
|
4817 |
#window: |
|
4818 |
#(#WindowSpec |
|
4819 |
#label: 'basicsEditSpec' |
|
4820 |
#name: 'basicsEditSpec' |
|
4821 |
#min: #(#Point 10 10) |
|
4822 |
#max: #(#Point 1280 1024) |
|
4823 |
#bounds: #(#Rectangle 644 547 904 593) |
|
4824 |
) |
|
4825 |
#component: |
|
4826 |
#(#SpecCollection |
|
4827 |
#collection: #( |
|
4828 |
#(#LabelSpec |
|
4829 |
#label: 'Selector:' |
|
4830 |
#name: 'selectorLabel' |
|
4831 |
#layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
|
4832 |
#activeHelpKey: #basicsSelector |
|
4833 |
#resizeForLabel: true |
|
4834 |
#adjust: #right |
|
4835 |
) |
|
4836 |
#(#InputFieldSpec |
|
4837 |
#name: 'selectorField' |
|
4838 |
#layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
|
4839 |
#activeHelpKey: #basicsSelector |
|
4840 |
#tabable: true |
|
4841 |
#model: #rawLabel |
|
4842 |
#group: #inputGroup |
|
4843 |
#type: #string |
|
4844 |
#immediateAccept: false |
|
4845 |
#acceptOnReturn: true |
|
4846 |
#acceptOnTab: true |
|
4847 |
#acceptChannel: #acceptChannel |
|
4848 |
#modifiedChannel: #modifiedChannel |
|
4849 |
#acceptOnPointerLeave: false |
|
4850 |
) |
|
4851 |
) |
|
4852 |
||
4853 |
) |
|
4854 |
) |
|
4855 |
! ! |
|
4856 |
||
4857 |
!MenuEditor::RootItem methodsFor:'accessing'! |
|
4858 |
||
4859 |
menuItem:aMenuItem |
|
4860 |
"rebuild self from a MenuItem |
|
4861 |
" |
|
4862 |
|submenu selector| |
|
4863 |
||
4864 |
aMenuItem notNil ifTrue:[ |
|
4865 |
submenu := aMenuItem submenu. |
|
4866 |
selector := aMenuItem rawLabel. |
|
4867 |
] ifFalse:[ |
|
4868 |
selector := submenu := nil. |
|
4869 |
]. |
|
4870 |
self menu:submenu labeled:selector. |
|
4871 |
! |
|
4872 |
||
4873 |
rawLabel:aValue |
|
4874 |
"set the label assigned to the item |
|
4875 |
" |
|
4876 |
|value| |
|
4877 |
||
4878 |
aValue isString ifTrue:[ |
|
4879 |
value := aValue withoutSeparators. |
|
4880 |
||
4881 |
(value notEmpty and:[value first isLetter]) ifTrue:[ |
|
4882 |
menuItem rawLabel:(value asSymbol) |
|
4883 |
]. |
|
4884 |
]. |
|
4885 |
! |
|
4886 |
||
4887 |
slices |
|
4888 |
^ #( |
|
4889 |
(Basics basicsEditSpec) |
|
4890 |
) |
|
4891 |
! ! |
|
4892 |
||
4893 |
!MenuEditor::RootItem methodsFor:'adding & removing'! |
|
4894 |
||
4895 |
remove |
|
4896 |
"cannot remove the root item; delete all my children |
|
4897 |
" |
|
4898 |
self removeAll. |
|
4899 |
! ! |
|
4900 |
||
4901 |
!MenuEditor::RootItem methodsFor:'aspects'! |
|
4902 |
||
4903 |
aspectAt:aKey put:aValue |
|
4904 |
"discard all other than the rawLabel |
|
4905 |
" |
|
4906 |
aKey == #rawLabel ifTrue:[ self rawLabel:aValue ]. |
|
4907 |
! ! |
|
4908 |
||
4909 |
!MenuEditor::RootItem methodsFor:'displaying'! |
|
4910 |
||
4911 |
heightOn:aGC |
|
4912 |
height ifNil:[ height := aGC font heightOn:aGC device ]. |
|
4913 |
^ height |
|
4914 |
! ! |
|
4915 |
||
4916 |
!MenuEditor::RootItem methodsFor:'initialization'! |
|
4917 |
||
4918 |
initialize |
|
4919 |
super initialize. |
|
4920 |
isExpanded := true. |
|
4921 |
! ! |
|
4922 |
||
4923 |
!MenuEditor::RootItem methodsFor:'queries'! |
|
4924 |
||
4925 |
canCollapse |
|
4926 |
^ false |
|
4927 |
! |
|
4928 |
||
4929 |
hasIndicator |
|
4930 |
^ false |
|
4931 |
! |
|
4932 |
||
4933 |
isDelayedMenu |
|
4934 |
^ false |
|
4935 |
! |
|
4936 |
||
4937 |
isRootItem |
|
4938 |
^ true |
|
4939 |
! ! |
|
4940 |
||
4941 |
!MenuEditor::RootItem methodsFor:'queries - editor'! |
|
4942 |
||
4943 |
actionSelectors |
|
4944 |
"returns my action selectors |
|
4945 |
" |
|
4946 |
^ #() |
|
4947 |
! |
|
4948 |
||
4949 |
aspectSelectors |
|
4950 |
"returns my aspect selectors |
|
4951 |
" |
|
4952 |
^ #() |
|
4953 |
! ! |
|
4954 |
||
4955 |
!MenuEditor::RootItem methodsFor:'queries - operation'! |
|
4956 |
||
4957 |
canMoveInAbove |
|
4958 |
^ false |
|
4959 |
! |
|
4960 |
||
4961 |
canMoveInNext |
|
4962 |
^ false |
|
4963 |
! |
|
4964 |
||
4965 |
canMoveOut |
|
4966 |
^ false |
|
4967 |
! |
|
4968 |
||
4969 |
canMoveUpOrDown |
|
4970 |
^ false |
|
4971 |
! ! |
|
4972 |
||
4973 |
!MenuEditor::SeparatorItem class methodsFor:'interface - editor'! |
|
4974 |
||
4975 |
addBindingsTo:aspects for:aMenuEditor |
|
4976 |
"add additional bindings to the aspects |
|
4977 |
" |
|
4978 |
|holder| |
|
4979 |
||
4980 |
aspects at:#seperatorList ifAbsentPut:[ |
|
4981 |
self separatorSlices collect:[:el| el last ] |
|
4982 |
]. |
|
4983 |
||
4984 |
aspects at:#seperatorSelection ifAbsentPut:[ |
|
4985 |
holder := 0 asValue. |
|
4986 |
holder addDependent:aMenuEditor. |
|
4987 |
holder |
|
4988 |
]. |
|
4989 |
! |
|
4990 |
||
4991 |
defaultLabel |
|
4992 |
^ '-' |
|
4993 |
! |
|
4994 |
||
4995 |
separatorSlices |
|
4996 |
"get the list of menu spec values of the corresponding separator types |
|
4997 |
" |
|
4998 |
^ #( |
|
4999 |
( #blank '' 'blank' ) |
|
5000 |
( #single '-' 'single line') |
|
5001 |
( #double '=' 'double line') |
|
5002 |
) |
|
5003 |
! ! |
|
5004 |
||
5005 |
!MenuEditor::SeparatorItem class methodsFor:'interface - specs'! |
|
5006 |
||
5007 |
basicsEditSpec |
|
5008 |
"This resource specification was automatically generated |
|
5009 |
by the UIPainter of ST/X." |
|
5010 |
||
5011 |
"Do not manually edit this!! If it is corrupted, |
|
5012 |
the UIPainter may not be able to read the specification." |
|
5013 |
||
5014 |
" |
|
5015 |
UIPainter new openOnClass:MenuEditor::ItemSeparator andSelector:#basicsEditSpec |
|
5016 |
" |
|
5017 |
||
5018 |
<resource: #canvas> |
|
5019 |
||
5020 |
^ |
|
5021 |
#(#FullSpec |
|
1636 | 5022 |
#name: #basicsEditSpec |
5023 |
#window: |
|
1631 | 5024 |
#(#WindowSpec |
1636 | 5025 |
#label: 'basicsEditSpec' |
5026 |
#name: 'basicsEditSpec' |
|
5027 |
#min: #(#Point 10 10) |
|
5028 |
#max: #(#Point 1160 870) |
|
5029 |
#bounds: #(#Rectangle 160 398 420 643) |
|
5030 |
) |
|
5031 |
#component: |
|
1631 | 5032 |
#(#SpecCollection |
1636 | 5033 |
#collection: #( |
5034 |
#(#LabelSpec |
|
5035 |
#label: 'Separator:' |
|
5036 |
#name: 'separatorLabel' |
|
5037 |
#layout: #(#AlignmentOrigin 107 0 26 0 1 0.5) |
|
5038 |
#resizeForLabel: true |
|
5039 |
#adjust: #right |
|
5040 |
) |
|
5041 |
#(#ComboListSpec |
|
5042 |
#name: 'seperatorList' |
|
5043 |
#layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0) |
|
5044 |
#activeHelpKey: #basicsSeparatorType |
|
5045 |
#tabable: true |
|
5046 |
#model: #seperatorSelection |
|
5047 |
#comboList: #seperatorList |
|
5048 |
#useIndex: true |
|
5049 |
) |
|
5050 |
#(#LabelSpec |
|
5051 |
#label: 'Visibility:' |
|
5052 |
#name: 'visibilityLabel' |
|
5053 |
#layout: #(#AlignmentOrigin 107 0 51 0 1 0.5) |
|
5054 |
#resizeForLabel: true |
|
5055 |
#adjust: #right |
|
5056 |
) |
|
5057 |
#(#InputFieldSpec |
|
5058 |
#name: 'visibilityInputField' |
|
5059 |
#layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0) |
|
5060 |
#activeHelpKey: #detailsVisibility |
|
5061 |
#tabable: true |
|
5062 |
#model: #isVisible |
|
5063 |
#group: #inputGroup |
|
5064 |
#type: #symbolOrBooleanOrNil |
|
5065 |
#immediateAccept: false |
|
5066 |
#acceptOnReturn: true |
|
5067 |
#acceptOnTab: true |
|
5068 |
#acceptChannel: #acceptChannel |
|
5069 |
#modifiedChannel: #modifiedChannel |
|
5070 |
#acceptOnPointerLeave: false |
|
5071 |
) |
|
5072 |
#(#LabelSpec |
|
5073 |
#label: 'Start Group:' |
|
5074 |
#name: 'startGroupLabel' |
|
5075 |
#layout: #(#AlignmentOrigin 107 0 88 0 1 0.5) |
|
5076 |
#resizeForLabel: true |
|
5077 |
#adjust: #right |
|
5078 |
) |
|
5079 |
#(#PopUpListSpec |
|
5080 |
#label: 'left' |
|
5081 |
#name: 'startGroupPopUp' |
|
5082 |
#layout: #(#LayoutFrame 110 0 77 0 -5 1.0 99 0) |
|
5083 |
#activeHelpKey: #detailsStartGroup |
|
5084 |
#tabable: true |
|
5085 |
#model: #startGroup |
|
5086 |
#menu: |
|
5087 |
#(#left |
|
5088 |
#right |
|
5089 |
) |
|
5090 |
) |
|
5091 |
) |
|
1631 | 5092 |
|
1636 | 5093 |
) |
1631 | 5094 |
) |
5095 |
! ! |
|
5096 |
||
5097 |
!MenuEditor::SeparatorItem methodsFor:'accessing'! |
|
5098 |
||
5099 |
icon |
|
5100 |
^ self class iconSeparator |
|
5101 |
! |
|
5102 |
||
5103 |
rawLabel:aValue |
|
5104 |
|value| |
|
5105 |
||
5106 |
aValue isString ifTrue:[ |
|
5107 |
value := aValue withoutSeparators. |
|
5108 |
||
5109 |
(self class separatorTypeOf:value) ifNotNil:[ |
|
5110 |
menuItem rawLabel:value |
|
5111 |
] |
|
5112 |
]. |
|
5113 |
! |
|
5114 |
||
5115 |
separatorType |
|
5116 |
^ self class separatorTypeOf:(menuItem rawLabel). |
|
5117 |
! |
|
5118 |
||
5119 |
slices |
|
5120 |
^ #( |
|
5121 |
(Basics basicsEditSpec) |
|
5122 |
) |
|
5123 |
! ! |
|
5124 |
||
5125 |
!MenuEditor::SeparatorItem methodsFor:'aspects'! |
|
5126 |
||
5127 |
fromAspects:aspects |
|
5128 |
"put my values into the values of aspects |
|
5129 |
" |
|
5130 |
|index slice| |
|
5131 |
||
5132 |
index := (aspects at:#seperatorSelection) value ? 0. |
|
5133 |
slice := self class separatorSlices at:index ifAbsent:nil. |
|
5134 |
||
5135 |
slice ifNotNil:[ slice := slice at:2 ]. |
|
5136 |
||
5137 |
(aspects at:#rawLabel) value:slice. |
|
5138 |
^ super fromAspects:aspects. |
|
5139 |
! |
|
5140 |
||
5141 |
toAspects:aspects |
|
5142 |
"put my values into the values of aspects |
|
5143 |
" |
|
5144 |
|index type| |
|
5145 |
||
5146 |
type := self separatorType. |
|
5147 |
index := self class separatorSlices findFirst:[:el| el first == type ]. |
|
5148 |
||
5149 |
(aspects at:#seperatorSelection) value:index. |
|
5150 |
^ super toAspects:aspects. |
|
5151 |
! ! |
|
5152 |
||
5153 |
!MenuEditor::SeparatorItem methodsFor:'displaying'! |
|
5154 |
||
5155 |
displayOn:aGC x:x y:y h:h |
|
5156 |
"draw the receiver in the graphicsContext, aGC. |
|
5157 |
" |
|
5158 |
|x1 y0 type| |
|
5159 |
||
5160 |
type := self separatorType. |
|
5161 |
type == #blank ifTrue:[ ^ self ]. |
|
5162 |
||
5163 |
x1 := x + (self widthOn:aGC). |
|
5164 |
y0 := y + (h // 2) - 1. |
|
5165 |
||
5166 |
type == #double ifTrue:[ |
|
5167 |
y0 := y0 + 1. |
|
5168 |
aGC displayLineFromX:x y:y0 toX:x1 y:y0. |
|
5169 |
y0 := y0 - 2 |
|
5170 |
]. |
|
5171 |
aGC displayLineFromX:x y:y0 toX:x1 y:y0 |
|
5172 |
! |
|
5173 |
||
5174 |
widthOn:aGC |
|
5175 |
width ifNil:[ width := 60 ]. |
|
5176 |
^ width |
|
5177 |
! ! |
|
5178 |
||
199 | 5179 |
!MenuEditor class methodsFor:'documentation'! |
5180 |
||
5181 |
version |
|
5182 |
^ '$Header$' |
|
5183 |
! ! |
|
1606 | 5184 |
|
1462
02fe22d76582
change layout of image viewer, support of adding new image retriever
ca
parents:
1454
diff
changeset
|
5185 |
MenuEditor initialize! |