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