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