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