author | ca |
Wed, 29 Oct 1997 08:33:56 +0100 | |
changeset 356 | 269c117830ba |
parent 340 | 1de048872d5e |
child 359 | 6193ef5b6e74 |
permissions | -rw-r--r-- |
199 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
3 |
All Rights Reserved |
|
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 |
|
7 |
inclusion of the above copyright notice. This software may not |
|
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 |
||
13 |
||
14 |
||
15 |
ApplicationModel subclass:#MenuEditor |
|
356 | 16 |
instanceVariableNames:'isModified specClass specCanvas helpCanvas tabSelection aspects |
17 |
slices didInstall' |
|
220 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-UIPainter' |
|
199 | 21 |
! |
22 |
||
23 |
Object subclass:#Item |
|
220 | 24 |
instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey |
290 | 25 |
accessCharaterPos retriever icon iconAndLabel submenuChannel |
26 |
argument' |
|
220 | 27 |
classVariableNames:'' |
28 |
poolDictionaries:'' |
|
29 |
privateIn:MenuEditor |
|
199 | 30 |
! |
31 |
||
32 |
SelectionInTreeView subclass:#Painter |
|
275 | 33 |
instanceVariableNames:'images' |
34 |
classVariableNames:'CopyBuffer Images' |
|
220 | 35 |
poolDictionaries:'' |
36 |
privateIn:MenuEditor |
|
199 | 37 |
! |
38 |
||
39 |
!MenuEditor class methodsFor:'documentation'! |
|
40 |
||
41 |
copyright |
|
42 |
" |
|
43 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
44 |
All Rights Reserved |
|
45 |
||
46 |
This software is furnished under a license and may be used |
|
47 |
only in accordance with the terms of that license and with the |
|
48 |
inclusion of the above copyright notice. This software may not |
|
49 |
be provided or otherwise made available to, or used by, any |
|
50 |
other person. No title to or ownership of the software is |
|
51 |
hereby transferred. |
|
52 |
" |
|
53 |
||
54 |
||
55 |
! |
|
56 |
||
57 |
documentation |
|
58 |
" |
|
59 |
create and modify or inspect popup and pullDown menus of the |
|
60 |
new style( derives from Menu). |
|
61 |
||
62 |
[start with:] |
|
63 |
MenuEditor open |
|
64 |
MenuEditor new openOnClass:MenuEditor andSelector:#menuPullDown |
|
65 |
||
66 |
[see also:] |
|
67 |
UIPainter |
|
68 |
UIHelpTool |
|
69 |
UISpecificationTool |
|
70 |
SelectionInTreeView |
|
71 |
||
72 |
[author:] |
|
73 |
Claus Atzkern |
|
74 |
" |
|
75 |
||
76 |
! ! |
|
77 |
||
318 | 78 |
!MenuEditor class methodsFor:'code generation'! |
79 |
||
80 |
generateCodeFor:aClass menuSelector:aSelector |
|
81 |
||
82 |
|code category| |
|
83 |
||
84 |
category := self sourceCategory. |
|
85 |
||
86 |
code := Character excla asString |
|
87 |
, aClass name , ' methodsFor:' , category storeString |
|
88 |
, Character excla asString , '\\' |
|
89 |
||
90 |
, aSelector , '\' |
|
91 |
, ' "this window spec was automatically generated by the UI Builder"\\' |
|
92 |
, ' ^ self class ', aSelector, '\\' |
|
93 |
, '\' |
|
94 |
, Character excla asString |
|
95 |
, ' ' |
|
96 |
, Character excla asString |
|
97 |
, '\\'. |
|
98 |
^ code |
|
99 |
||
100 |
" |
|
101 |
self generateCodeFor:MenuEditor menuSelector:#menu |
|
102 |
" |
|
103 |
! |
|
104 |
||
105 |
sourceCategory |
|
106 |
"returns the catagory where to instal the menu |
|
107 |
" |
|
108 |
^ 'accessing menu' |
|
109 |
! ! |
|
110 |
||
218 | 111 |
!MenuEditor class methodsFor:'icons'! |
112 |
||
220 | 113 |
iconCreateItem |
114 |
^ Painter imageItem |
|
115 |
||
116 |
! |
|
117 |
||
118 |
iconCreateLink |
|
119 |
^ Painter imageMenuLink |
|
120 |
||
121 |
! |
|
122 |
||
123 |
iconCreateMenu |
|
243 | 124 |
^ Painter imageMenu |
125 |
||
126 |
"Modified: 28.7.1997 / 10:02:21 / cg" |
|
220 | 127 |
! |
128 |
||
129 |
iconCreateSep |
|
130 |
^ Painter imageSeparator |
|
131 |
||
227 | 132 |
! |
133 |
||
134 |
iconUnknown |
|
243 | 135 |
"returns an image used for picked items containing an image |
227 | 136 |
" |
243 | 137 |
^ Image fromFile:'brokenImage.xpm' |
138 |
||
139 |
"Modified: 28.7.1997 / 09:36:26 / cg" |
|
218 | 140 |
! ! |
141 |
||
199 | 142 |
!MenuEditor class methodsFor:'interface specs'! |
143 |
||
144 |
classAndMethodSpec |
|
145 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
146 |
||
147 |
"do not manually edit this - the painter/builder may not be able to |
|
148 |
handle the specification if its corrupted." |
|
149 |
||
150 |
" |
|
151 |
UIPainter new openOnClass:MenuEditor andSelector:#classAndMethodSpec |
|
152 |
MenuEditor new openInterface:#classAndMethodSpec |
|
153 |
" |
|
154 |
||
155 |
<resource: #canvas> |
|
156 |
||
157 |
^ |
|
158 |
||
159 |
#(#FullSpec |
|
160 |
#'window:' |
|
161 |
#(#WindowSpec |
|
287 | 162 |
#'name:' 'ClassAndMethodSpec' |
199 | 163 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
164 |
#'label:' 'Painter' |
|
165 |
#'bounds:' #(#Rectangle 0 0 391 170) |
|
166 |
) |
|
167 |
#'component:' |
|
168 |
#(#SpecCollection |
|
169 |
#'collection:' |
|
170 |
#( |
|
171 |
#(#LabelSpec |
|
172 |
#'name:' 'classLabel' |
|
173 |
#'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5) |
|
174 |
#'label:' 'class:' |
|
175 |
#'adjust:' #right |
|
176 |
#'resizeForLabel:' true |
|
177 |
) |
|
178 |
#(#LabelSpec |
|
179 |
#'name:' 'selectorLabel' |
|
180 |
#'layout:' #(#AlignmentOrigin 45 0.11 74 0 1 0.5) |
|
181 |
#'label:' 'selector:' |
|
182 |
#'adjust:' #right |
|
183 |
#'resizeForLabel:' true |
|
184 |
) |
|
185 |
#(#InputFieldSpec |
|
186 |
#'name:' 'methodNameField' |
|
263 | 187 |
#'layout:' #(#LayoutFrame 47 0.11 64 0 0 1.0 86 0) |
199 | 188 |
#'tabable:' true |
189 |
#'model:' #methodNameChannel |
|
190 |
) |
|
191 |
#(#LabelSpec |
|
192 |
#'name:' 'boxLabel' |
|
193 |
#'layout:' #(#Point 5 10) |
|
194 |
#'label:' 'class & selector for code:' |
|
195 |
#'adjust:' #left |
|
196 |
#'resizeForLabel:' true |
|
197 |
) |
|
198 |
#(#InputFieldSpec |
|
199 |
#'name:' 'classNameField' |
|
263 | 200 |
#'layout:' #(#LayoutFrame 47 0.11 39 0 0 1.0 61 0) |
199 | 201 |
#'tabable:' true |
202 |
#'model:' #classNameChannel |
|
203 |
) |
|
204 |
#(#HorizontalPanelViewSpec |
|
205 |
#'name:' 'commitPanel' |
|
206 |
#'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0) |
|
207 |
#'component:' |
|
208 |
#(#SpecCollection |
|
209 |
#'collection:' |
|
210 |
#( |
|
211 |
#(#ActionButtonSpec |
|
212 |
#'name:' 'button1' |
|
213 |
#'label:' 'cancel' |
|
214 |
#'tabable:' true |
|
215 |
#'model:' #cancel |
|
216 |
#'extent:' #(#Point 191 24) |
|
217 |
) |
|
218 |
#(#ActionButtonSpec |
|
219 |
#'name:' 'button2' |
|
220 |
#'label:' 'ok' |
|
221 |
#'tabable:' true |
|
222 |
#'isDefault:' true |
|
223 |
#'model:' #accept |
|
224 |
#'extent:' #(#Point 191 24) |
|
225 |
) |
|
226 |
) |
|
227 |
) |
|
228 |
#'horizontalLayout:' #fitSpace |
|
229 |
#'verticalLayout:' #fit |
|
230 |
#'horizontalSpace:' 3 |
|
231 |
#'verticalSpace:' 3 |
|
232 |
) |
|
233 |
) |
|
234 |
) |
|
235 |
) |
|
263 | 236 |
|
237 |
"Modified: 28.7.1997 / 15:40:15 / cg" |
|
199 | 238 |
! |
239 |
||
240 |
classDefineSpec |
|
241 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
242 |
||
243 |
"do not manually edit this - the painter/builder may not be able to |
|
244 |
handle the specification if its corrupted." |
|
245 |
||
246 |
" |
|
247 |
UIPainter new openOnClass:MenuEditor andSelector:#classDefineSpec |
|
248 |
MenuEditor new openInterface:#classDefineSpec |
|
249 |
" |
|
250 |
||
251 |
<resource: #canvas> |
|
252 |
||
253 |
^ |
|
254 |
||
255 |
#(#FullSpec |
|
256 |
#'window:' |
|
257 |
#(#WindowSpec |
|
287 | 258 |
#'name:' 'ClassDefineSpec' |
199 | 259 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
260 |
#'label:' 'Painter' |
|
261 |
#'bounds:' #(#Rectangle 0 0 383 128) |
|
262 |
) |
|
263 |
#'component:' |
|
264 |
#(#SpecCollection |
|
265 |
#'collection:' |
|
266 |
#( |
|
267 |
#(#LabelSpec |
|
268 |
#'name:' 'classLabel' |
|
269 |
#'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5) |
|
270 |
#'label:' 'class:' |
|
271 |
#'adjust:' #right |
|
272 |
#'resizeForLabel:' true |
|
273 |
) |
|
274 |
#(#LabelSpec |
|
275 |
#'name:' 'boxLabel' |
|
276 |
#'layout:' #(#Point 5 10) |
|
277 |
#'label:' 'class for code:' |
|
278 |
#'adjust:' #left |
|
279 |
#'resizeForLabel:' true |
|
280 |
) |
|
281 |
#(#InputFieldSpec |
|
282 |
#'name:' 'classNameField' |
|
263 | 283 |
#'layout:' #(#LayoutFrame 47 0.11 39 0 0 1.0 61 0) |
199 | 284 |
#'tabable:' true |
285 |
#'model:' #classNameChannel |
|
286 |
) |
|
287 |
#(#HorizontalPanelViewSpec |
|
288 |
#'name:' 'commitPanel' |
|
289 |
#'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0) |
|
290 |
#'component:' |
|
291 |
#(#SpecCollection |
|
292 |
#'collection:' |
|
293 |
#( |
|
294 |
#(#ActionButtonSpec |
|
295 |
#'name:' 'button1' |
|
296 |
#'label:' 'cancel' |
|
297 |
#'tabable:' true |
|
298 |
#'model:' #cancel |
|
299 |
#'extent:' #(#Point 187 24) |
|
300 |
) |
|
301 |
#(#ActionButtonSpec |
|
302 |
#'name:' 'button2' |
|
303 |
#'label:' 'ok' |
|
304 |
#'tabable:' true |
|
305 |
#'isDefault:' true |
|
306 |
#'model:' #accept |
|
307 |
#'extent:' #(#Point 187 24) |
|
308 |
) |
|
309 |
) |
|
310 |
) |
|
311 |
#'horizontalLayout:' #fitSpace |
|
312 |
#'verticalLayout:' #fit |
|
313 |
#'horizontalSpace:' 3 |
|
314 |
#'verticalSpace:' 3 |
|
315 |
) |
|
316 |
) |
|
317 |
) |
|
318 |
) |
|
263 | 319 |
|
320 |
"Modified: 28.7.1997 / 15:40:39 / cg" |
|
199 | 321 |
! |
322 |
||
220 | 323 |
menuButtons |
324 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
325 |
||
326 |
"do not manually edit this - the builder may not be able to |
|
327 |
handle the specification if its corrupted." |
|
328 |
||
329 |
" |
|
330 |
MenuEditor new openOnClass:MenuEditor andSelector:#menuButtons |
|
331 |
(Menu new fromLiteralArrayEncoding:(MenuEditor menuButtons)) startUp |
|
332 |
" |
|
333 |
||
334 |
<resource: #menu> |
|
335 |
||
336 |
^ |
|
337 |
||
338 |
#(#Menu |
|
339 |
||
340 |
#( |
|
341 |
#(#MenuItem |
|
342 |
#'label:' 'createMenu' |
|
343 |
#'value:' #doCreateMenu |
|
344 |
#'enabled:' #hasAnySingleSelection |
|
345 |
#'labelImage:' |
|
346 |
#(#ResourceRetriever |
|
347 |
#MenuEditor #iconCreateMenu |
|
348 |
) |
|
349 |
) |
|
350 |
#(#MenuItem |
|
351 |
#'label:' 'createLink' |
|
352 |
#'value:' #doCreateLink |
|
353 |
#'enabled:' #hasAnySingleSelection |
|
354 |
#'labelImage:' |
|
355 |
#(#ResourceRetriever |
|
356 |
#MenuEditor #iconCreateLink |
|
357 |
) |
|
358 |
) |
|
359 |
#(#MenuItem |
|
360 |
#'label:' 'createItem' |
|
361 |
#'value:' #doCreateItem |
|
362 |
#'enabled:' #hasAnySingleSelection |
|
363 |
#'labelImage:' |
|
364 |
#(#ResourceRetriever |
|
365 |
#MenuEditor #iconCreateItem |
|
366 |
) |
|
367 |
) |
|
368 |
#(#MenuItem |
|
369 |
#'label:' 'createSeparator' |
|
370 |
#'value:' #doCreateSep |
|
371 |
#'enabled:' #hasAnySingleSelection |
|
372 |
#'labelImage:' |
|
373 |
#(#ResourceRetriever |
|
374 |
#MenuEditor #iconCreateSep |
|
375 |
) |
|
376 |
) |
|
377 |
#(#MenuItem |
|
378 |
#'label:' '' |
|
379 |
) |
|
380 |
#(#MenuItem |
|
381 |
#'label:' 'stepUp' |
|
382 |
#'value:' #doStepUp |
|
383 |
#'enabled:' #enabledStepOver |
|
384 |
#'labelImage:' |
|
385 |
#(#ResourceRetriever |
|
224 | 386 |
#UIPainter #iconStepUp |
220 | 387 |
) |
388 |
) |
|
389 |
#(#MenuItem |
|
390 |
#'label:' 'stepDown' |
|
391 |
#'value:' #doStepDown |
|
392 |
#'enabled:' #enabledStepOver |
|
393 |
#'labelImage:' |
|
394 |
#(#ResourceRetriever |
|
224 | 395 |
#UIPainter #iconStepDown |
220 | 396 |
) |
397 |
) |
|
398 |
#(#MenuItem |
|
399 |
#'label:' 'stepIn' |
|
400 |
#'value:' #doStepIn |
|
401 |
#'enabled:' #enabledStepIn |
|
402 |
#'labelImage:' |
|
403 |
#(#ResourceRetriever |
|
224 | 404 |
#UIPainter #iconStepIn |
220 | 405 |
) |
406 |
) |
|
407 |
#(#MenuItem |
|
408 |
#'label:' 'stepOut' |
|
409 |
#'value:' #doStepOut |
|
410 |
#'enabled:' #enabledStepOut |
|
411 |
#'labelImage:' |
|
412 |
#(#ResourceRetriever |
|
224 | 413 |
#UIPainter #iconStepOut |
220 | 414 |
) |
415 |
) |
|
416 |
) nil |
|
417 |
nil |
|
418 |
) |
|
419 |
! |
|
420 |
||
218 | 421 |
menuDefaultLink |
422 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
423 |
||
424 |
"do not manually edit this - the builder may not be able to |
|
425 |
handle the specification if its corrupted." |
|
426 |
||
427 |
" |
|
428 |
MenuEditor new openOnClass:MenuEditor andSelector:#menuDefaultLink |
|
429 |
(Menu new fromLiteralArrayEncoding:(MenuEditor menuDefaultLink)) startUp |
|
430 |
" |
|
431 |
||
432 |
<resource: #menu> |
|
433 |
||
434 |
^ |
|
435 |
||
436 |
#(#Menu |
|
437 |
||
438 |
#( |
|
439 |
#(#MenuItem |
|
440 |
#'label:' '!! derives from application !!' |
|
441 |
) |
|
442 |
) nil |
|
443 |
nil |
|
444 |
) |
|
445 |
! |
|
446 |
||
220 | 447 |
menuPainter |
448 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
449 |
||
450 |
"do not manually edit this - the builder may not be able to |
|
451 |
handle the specification if its corrupted." |
|
452 |
||
453 |
" |
|
454 |
MenuEditor new openOnClass:MenuEditor andSelector:#menuPainter |
|
455 |
(Menu new fromLiteralArrayEncoding:(MenuEditor menuPainter)) startUp |
|
456 |
" |
|
457 |
||
458 |
<resource: #menu> |
|
459 |
||
460 |
^ |
|
461 |
||
462 |
#(#Menu |
|
463 |
||
464 |
#( |
|
465 |
#(#MenuItem |
|
466 |
#'label:' 'copy' |
|
467 |
#'value:' #doCopy |
|
468 |
#'enabled:' #hasValidSelection |
|
356 | 469 |
#'shortcutKeyCharacter:' #Copy |
220 | 470 |
) |
471 |
#(#MenuItem |
|
472 |
#'label:' 'cut' |
|
473 |
#'value:' #doCut |
|
474 |
#'enabled:' #hasValidSelection |
|
356 | 475 |
#'shortcutKeyCharacter:' #Cut |
220 | 476 |
) |
477 |
#(#MenuItem |
|
478 |
#'label:' 'paste' |
|
479 |
#'value:' #doPaste |
|
480 |
#'enabled:' #hasAnySingleSelection |
|
356 | 481 |
#'shortcutKeyCharacter:' #Paste |
220 | 482 |
) |
483 |
#(#MenuItem |
|
484 |
#'label:' '-' |
|
485 |
) |
|
486 |
#(#MenuItem |
|
487 |
#'label:' 'create' |
|
488 |
#'enabled:' #hasAnySingleSelection |
|
489 |
#'submenu:' |
|
490 |
#(#Menu |
|
491 |
||
492 |
#( |
|
493 |
#(#MenuItem |
|
494 |
#'label:' 'submenu static' |
|
495 |
#'value:' #doCreateMenu |
|
496 |
#'labelImage:' |
|
497 |
#(#ResourceRetriever |
|
498 |
#MenuEditor #iconCreateMenu |
|
499 |
'submenu static' |
|
500 |
) |
|
501 |
) |
|
502 |
#(#MenuItem |
|
503 |
#'label:' 'submenu dynamic' |
|
504 |
#'value:' #doCreateLink |
|
505 |
#'labelImage:' |
|
506 |
#(#ResourceRetriever |
|
507 |
#MenuEditor #iconCreateLink |
|
508 |
'submenu dynamic' |
|
509 |
) |
|
510 |
) |
|
511 |
#(#MenuItem |
|
512 |
#'label:' '-' |
|
513 |
) |
|
514 |
#(#MenuItem |
|
515 |
#'label:' 'item' |
|
516 |
#'value:' #doCreateItem |
|
517 |
#'labelImage:' |
|
518 |
#(#ResourceRetriever |
|
519 |
#MenuEditor #iconCreateItem |
|
520 |
'item' |
|
521 |
) |
|
522 |
) |
|
523 |
#(#MenuItem |
|
524 |
#'label:' 'separator' |
|
525 |
#'value:' #doCreateSep |
|
526 |
#'labelImage:' |
|
527 |
#(#ResourceRetriever |
|
528 |
#MenuEditor #iconCreateSep |
|
529 |
'separator' |
|
530 |
) |
|
531 |
) |
|
532 |
) nil |
|
533 |
nil |
|
534 |
) |
|
535 |
) |
|
536 |
) nil |
|
537 |
nil |
|
538 |
) |
|
539 |
! |
|
540 |
||
199 | 541 |
menuPullDown |
542 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
543 |
||
544 |
"do not manually edit this - the builder may not be able to |
|
545 |
handle the specification if its corrupted." |
|
546 |
||
547 |
" |
|
548 |
MenuEditor new openOnClass:MenuEditor andSelector:#menuPullDown |
|
549 |
(Menu new fromLiteralArrayEncoding:(MenuEditor menuPullDown)) startUp |
|
550 |
" |
|
551 |
||
552 |
<resource: #menu> |
|
553 |
||
554 |
^ |
|
555 |
||
556 |
#(#Menu |
|
557 |
||
558 |
#( |
|
559 |
#(#MenuItem |
|
560 |
#'label:' 'file' |
|
561 |
#'value:' #file |
|
562 |
#'submenu:' |
|
563 |
#(#Menu |
|
564 |
||
565 |
#( |
|
566 |
#(#MenuItem |
|
567 |
#'label:' 'new' |
|
568 |
#'value:' #doNew |
|
569 |
) |
|
570 |
#(#MenuItem |
|
571 |
#'label:' 'from class ...' |
|
572 |
#'value:' #doFromClass |
|
287 | 573 |
#'enabled:' #isStandAlone |
199 | 574 |
) |
575 |
#(#MenuItem |
|
576 |
#'label:' 'pick a menu' |
|
577 |
#'value:' #doPickAMenu |
|
287 | 578 |
#'enabled:' #isStandAlone |
199 | 579 |
) |
580 |
#(#MenuItem |
|
581 |
#'label:' '=' |
|
582 |
) |
|
583 |
#(#MenuItem |
|
584 |
#'label:' 'quit' |
|
585 |
#'value:' #closeRequest |
|
586 |
) |
|
587 |
) nil |
|
588 |
nil |
|
589 |
) |
|
590 |
) |
|
591 |
#(#MenuItem |
|
243 | 592 |
#'label:' 'edit' |
593 |
#'submenu:' |
|
594 |
#(#Menu |
|
595 |
||
596 |
#( |
|
597 |
#(#MenuItem |
|
598 |
#'label:' 'cut' |
|
246 | 599 |
#'value:' #doCut |
243 | 600 |
) |
601 |
#(#MenuItem |
|
602 |
#'label:' '=' |
|
603 |
) |
|
604 |
#(#MenuItem |
|
605 |
#'label:' 'create submenu static' |
|
246 | 606 |
#'value:' #doCreateMenu |
243 | 607 |
) |
608 |
#(#MenuItem |
|
609 |
#'label:' 'create summenu dynamic' |
|
246 | 610 |
#'value:' #doCreateLink |
243 | 611 |
) |
612 |
#(#MenuItem |
|
613 |
#'label:' '-' |
|
614 |
) |
|
615 |
#(#MenuItem |
|
616 |
#'label:' 'create item' |
|
246 | 617 |
#'value:' #doCreateItem |
243 | 618 |
) |
619 |
#(#MenuItem |
|
620 |
#'label:' 'create separator' |
|
246 | 621 |
#'value:' #doCreateSep |
243 | 622 |
) |
623 |
) nil |
|
624 |
nil |
|
625 |
) |
|
626 |
) |
|
627 |
#(#MenuItem |
|
199 | 628 |
#'label:' 'code' |
629 |
#'value:' #code |
|
630 |
#'submenu:' |
|
631 |
#(#Menu |
|
632 |
||
633 |
#( |
|
634 |
#(#MenuItem |
|
635 |
#'label:' 'class' |
|
636 |
#'value:' #doDefineClass |
|
287 | 637 |
#'enabled:' #isStandAlone |
199 | 638 |
) |
639 |
#(#MenuItem |
|
640 |
#'label:' '-' |
|
641 |
) |
|
642 |
#(#MenuItem |
|
266 | 643 |
#'label:' 'install menu spec.' |
199 | 644 |
#'value:' #doInstallSpec |
645 |
) |
|
646 |
#(#MenuItem |
|
647 |
#'label:' 'install help spec.' |
|
648 |
#'value:' #doInstallHelp |
|
287 | 649 |
#'enabled:' #isStandAlone |
199 | 650 |
) |
651 |
#(#MenuItem |
|
652 |
#'label:' '=' |
|
653 |
) |
|
654 |
#(#MenuItem |
|
655 |
#'label:' 'browse application' |
|
656 |
#'value:' #doBrowseAppClass |
|
657 |
) |
|
658 |
) nil |
|
659 |
nil |
|
660 |
) |
|
661 |
) |
|
662 |
#(#MenuItem |
|
663 |
#'label:' 'test' |
|
218 | 664 |
#'submenuChannel:' #submenuTest |
665 |
) |
|
199 | 666 |
) nil |
667 |
nil |
|
668 |
) |
|
243 | 669 |
|
266 | 670 |
"Modified: 28.7.1997 / 18:12:10 / cg" |
199 | 671 |
! |
672 |
||
673 |
windowSpec |
|
674 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
675 |
||
676 |
"do not manually edit this - the painter/builder may not be able to |
|
677 |
handle the specification if its corrupted." |
|
678 |
||
679 |
" |
|
680 |
UIPainter new openOnClass:MenuEditor andSelector:#windowSpec |
|
681 |
MenuEditor new openInterface:#windowSpec |
|
682 |
" |
|
683 |
"MenuEditor open" |
|
684 |
||
685 |
<resource: #canvas> |
|
686 |
||
687 |
^ |
|
688 |
||
689 |
#(#FullSpec |
|
690 |
#'window:' |
|
691 |
#(#WindowSpec |
|
287 | 692 |
#'name:' 'MenuEditor' |
199 | 693 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
694 |
#'label:' 'Menu Builder' |
|
695 |
#'bounds:' #(#Rectangle 0 0 580 384) |
|
696 |
) |
|
697 |
#'component:' |
|
698 |
#(#SpecCollection |
|
699 |
#'collection:' |
|
700 |
#( |
|
701 |
#(#ArbitraryComponentSpec |
|
702 |
#'name:' 'painterView' |
|
220 | 703 |
#'layout:' #(#LayoutFrame 0 0.0 57 0 0 0.5 0 1.0) |
704 |
#'menu:' #menuPainter |
|
199 | 705 |
#'hasHorizontalScrollBar:' true |
706 |
#'hasVerticalScrollBar:' true |
|
220 | 707 |
#'component:' #painter |
199 | 708 |
#'hasBorder:' false |
709 |
) |
|
710 |
#(#NoteBookViewSpec |
|
711 |
#'name:' 'specificationView' |
|
220 | 712 |
#'layout:' #(#LayoutFrame 0 0.5 0 0.0 0 1.0 -25 1.0) |
713 |
#'tabable:' true |
|
199 | 714 |
#'menu:' #tabList |
715 |
#'model:' #tabModel |
|
716 |
#'tabWidget:' #Window |
|
717 |
#'useIndex:' true |
|
287 | 718 |
#'canvas:' #noteBookView |
199 | 719 |
) |
720 |
#(#HorizontalPanelViewSpec |
|
721 |
#'name:' 'confirmationPanel' |
|
722 |
#'layout:' #(#LayoutFrame 0 0.5 -24 1.0 0 1.0 0 1.0) |
|
723 |
#'component:' |
|
724 |
#(#SpecCollection |
|
725 |
#'collection:' |
|
726 |
#( |
|
727 |
#(#ActionButtonSpec |
|
728 |
#'name:' 'cancelButton' |
|
729 |
#'label:' 'cancel' |
|
730 |
#'model:' #cancel |
|
731 |
#'enableChannel:' #modifiedChannel |
|
732 |
#'extent:' #(#Point 140 24) |
|
733 |
) |
|
734 |
#(#ActionButtonSpec |
|
735 |
#'name:' 'acceptButton' |
|
736 |
#'label:' 'ok' |
|
737 |
#'model:' #accept |
|
738 |
#'enableChannel:' #modifiedChannel |
|
739 |
#'extent:' #(#Point 141 24) |
|
740 |
) |
|
741 |
) |
|
742 |
) |
|
743 |
#'horizontalLayout:' #fitSpace |
|
744 |
#'verticalLayout:' #fit |
|
745 |
#'horizontalSpace:' 3 |
|
746 |
#'verticalSpace:' 3 |
|
747 |
) |
|
748 |
#(#MenuPanelSpec |
|
749 |
#'name:' 'pullDownMenu' |
|
220 | 750 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 0.5 24 0) |
751 |
#'tabable:' true |
|
199 | 752 |
#'menu:' #menuPullDown |
753 |
) |
|
220 | 754 |
#(#MenuPanelSpec |
755 |
#'name:' 'menuPanel1' |
|
756 |
#'layout:' #(#LayoutFrame 0 0 28 0 0 0.5 53 0) |
|
757 |
#'menu:' #menuButtons |
|
758 |
#'showSeparatingLines:' true |
|
759 |
) |
|
199 | 760 |
) |
761 |
) |
|
762 |
) |
|
763 |
! ! |
|
764 |
||
765 |
!MenuEditor class methodsFor:'slices'! |
|
766 |
||
767 |
slicesItem |
|
768 |
^#( |
|
769 |
(Basics basicsItemSpec) |
|
770 |
(Details detailsEditSpec) |
|
771 |
(Misc miscEditSpec) |
|
772 |
) |
|
773 |
||
774 |
! |
|
775 |
||
218 | 776 |
slicesLink |
777 |
^#( |
|
778 |
(Basics basicsLinkSpec) |
|
779 |
(Details detailsEditSpec) |
|
780 |
(Misc miscEditSpec) |
|
781 |
) |
|
782 |
||
783 |
! |
|
784 |
||
199 | 785 |
slicesMenu |
786 |
^#( |
|
787 |
(Basics basicsMenuSpec) |
|
788 |
(Details detailsEditSpec) |
|
789 |
(Misc miscEditSpec) |
|
790 |
) |
|
791 |
||
792 |
! |
|
793 |
||
794 |
slicesRootMenu |
|
795 |
^#( |
|
796 |
(Basics basicsRootSpec) |
|
797 |
) |
|
798 |
||
799 |
! |
|
800 |
||
218 | 801 |
slicesSeparatorMenu |
199 | 802 |
^#( |
218 | 803 |
(Basics basicsSeparatorSpec) |
199 | 804 |
) |
805 |
||
806 |
! ! |
|
807 |
||
808 |
!MenuEditor class methodsFor:'specs'! |
|
809 |
||
810 |
basicsItemSpec |
|
811 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
812 |
||
813 |
"do not manually edit this - the painter/builder may not be able to |
|
814 |
handle the specification if its corrupted." |
|
815 |
||
816 |
" |
|
817 |
UIPainter new openOnClass:MenuEditor andSelector:#basicsItemSpec |
|
818 |
MenuEditor new openInterface:#basicsItemSpec |
|
819 |
" |
|
820 |
||
821 |
<resource: #canvas> |
|
822 |
||
823 |
^ |
|
824 |
||
825 |
#(#FullSpec |
|
826 |
#'window:' |
|
827 |
#(#WindowSpec |
|
290 | 828 |
#'name:' 'unnamed canvas' |
829 |
#'layout:' #(#LayoutFrame 199 0 167 0 465 0 485 0) |
|
199 | 830 |
#'label:' 'unnamed canvas' |
290 | 831 |
#'min:' #(#Point 10 10) |
832 |
#'max:' #(#Point 1160 870) |
|
833 |
#'bounds:' #(#Rectangle 199 167 466 486) |
|
199 | 834 |
) |
835 |
#'component:' |
|
836 |
#(#SpecCollection |
|
837 |
#'collection:' |
|
838 |
#( |
|
839 |
#(#LabelSpec |
|
840 |
#'name:' 'nameKeyLabel' |
|
841 |
#'layout:' #(#AlignmentOrigin 87 0 26 0 1 0.5) |
|
842 |
#'label:' 'NameKey:' |
|
263 | 843 |
#'adjust:' #right |
199 | 844 |
#'resizeForLabel:' true |
845 |
) |
|
846 |
#(#InputFieldSpec |
|
847 |
#'name:' 'itemNameKey' |
|
263 | 848 |
#'layout:' #(#LayoutFrame 91 0 15 0 0 1.0 37 0) |
199 | 849 |
#'tabable:' true |
850 |
#'model:' #nameKey |
|
851 |
#'type:' #symbolOrNil |
|
852 |
) |
|
853 |
#(#LabelSpec |
|
854 |
#'name:' 'labelLabel' |
|
855 |
#'layout:' #(#AlignmentOrigin 87 0 53 0 1 0.5) |
|
856 |
#'label:' 'Label' |
|
263 | 857 |
#'adjust:' #right |
199 | 858 |
#'resizeForLabel:' true |
859 |
) |
|
860 |
#(#InputFieldSpec |
|
861 |
#'name:' 'itemLabel' |
|
263 | 862 |
#'layout:' #(#LayoutFrame 91 0 42 0 0 1.0 64 0) |
199 | 863 |
#'tabable:' true |
864 |
#'model:' #label |
|
865 |
) |
|
866 |
#(#LabelSpec |
|
867 |
#'name:' 'valueLabel' |
|
290 | 868 |
#'layout:' #(#AlignmentOrigin 87 0 94 0 1 0.5) |
199 | 869 |
#'label:' 'Value:' |
263 | 870 |
#'adjust:' #right |
199 | 871 |
#'resizeForLabel:' true |
872 |
) |
|
873 |
#(#InputFieldSpec |
|
874 |
#'name:' 'itemValue' |
|
290 | 875 |
#'layout:' #(#LayoutFrame 91 0 83 0 0 1.0 105 0) |
199 | 876 |
#'tabable:' true |
877 |
#'model:' #value |
|
878 |
#'type:' #symbolOrNil |
|
879 |
) |
|
880 |
#(#LabelSpec |
|
881 |
#'name:' 'indicationLabel' |
|
290 | 882 |
#'layout:' #(#AlignmentOrigin 87 0 160 0 1 0.5) |
199 | 883 |
#'label:' 'Indication:' |
263 | 884 |
#'adjust:' #right |
199 | 885 |
#'resizeForLabel:' true |
886 |
) |
|
887 |
#(#InputFieldSpec |
|
888 |
#'name:' 'indicationValue' |
|
290 | 889 |
#'layout:' #(#LayoutFrame 91 0 149 0 0 1.0 171 0) |
199 | 890 |
#'tabable:' true |
891 |
#'model:' #indication |
|
892 |
#'type:' #symbolOrNil |
|
893 |
) |
|
290 | 894 |
#(#LabelSpec |
895 |
#'name:' 'argumentLabel' |
|
896 |
#'layout:' #(#AlignmentOrigin 87 0 120 0 1 0.5) |
|
897 |
#'label:' 'Argument:' |
|
898 |
#'adjust:' #right |
|
899 |
#'resizeForLabel:' true |
|
900 |
) |
|
901 |
#(#InputFieldSpec |
|
902 |
#'name:' 'inputField1' |
|
903 |
#'layout:' #(#LayoutFrame 91 0 109 0 0 1.0 131 0) |
|
904 |
#'tabable:' true |
|
905 |
#'model:' #argument |
|
906 |
#'type:' #string |
|
907 |
) |
|
199 | 908 |
) |
909 |
) |
|
910 |
) |
|
911 |
! |
|
912 |
||
218 | 913 |
basicsLinkSpec |
914 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
915 |
||
916 |
"do not manually edit this - the painter/builder may not be able to |
|
917 |
handle the specification if its corrupted." |
|
918 |
||
919 |
" |
|
920 |
UIPainter new openOnClass:MenuEditor andSelector:#basicsLinkSpec |
|
921 |
MenuEditor new openInterface:#basicsLinkSpec |
|
922 |
" |
|
923 |
||
924 |
<resource: #canvas> |
|
925 |
||
926 |
^ |
|
927 |
||
928 |
#(#FullSpec |
|
929 |
#'window:' |
|
930 |
#(#WindowSpec |
|
287 | 931 |
#'name:' 'BasicsLinkSpec' |
218 | 932 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
933 |
#'label:' 'unnamed canvas' |
|
934 |
#'bounds:' #(#Rectangle 0 0 267 319) |
|
935 |
) |
|
936 |
#'component:' |
|
937 |
#(#SpecCollection |
|
938 |
#'collection:' |
|
939 |
#( |
|
940 |
#(#LabelSpec |
|
941 |
#'name:' 'nameKeyLabel' |
|
942 |
#'layout:' #(#AlignmentOrigin 87 0 26 0 1 0.5) |
|
943 |
#'label:' 'NameKey:' |
|
263 | 944 |
#'adjust:' #right |
218 | 945 |
#'resizeForLabel:' true |
946 |
) |
|
947 |
#(#InputFieldSpec |
|
948 |
#'name:' 'itemNameKey' |
|
263 | 949 |
#'layout:' #(#LayoutFrame 91 0 15 0 0 1.0 37 0) |
218 | 950 |
#'tabable:' true |
951 |
#'model:' #nameKey |
|
952 |
#'type:' #symbolOrNil |
|
953 |
) |
|
954 |
#(#LabelSpec |
|
955 |
#'name:' 'labelLabel' |
|
956 |
#'layout:' #(#AlignmentOrigin 87 0 53 0 1 0.5) |
|
957 |
#'label:' 'Label' |
|
958 |
#'resizeForLabel:' true |
|
959 |
) |
|
960 |
#(#InputFieldSpec |
|
961 |
#'name:' 'itemLabel' |
|
263 | 962 |
#'layout:' #(#LayoutFrame 91 0 42 0 0 1.0 64 0) |
218 | 963 |
#'tabable:' true |
964 |
#'model:' #label |
|
965 |
) |
|
966 |
#(#InputFieldSpec |
|
967 |
#'name:' 'submenuChannel' |
|
263 | 968 |
#'layout:' #(#LayoutFrame 91 0 69 0 0 1.0 91 0) |
218 | 969 |
#'tabable:' true |
970 |
#'model:' #submenuChannel |
|
971 |
#'type:' #symbolOrNil |
|
972 |
) |
|
973 |
#(#LabelSpec |
|
974 |
#'name:' 'menuLabel' |
|
975 |
#'layout:' #(#AlignmentOrigin 87 0 80 0 1 0.5) |
|
976 |
#'label:' 'Menu:' |
|
977 |
#'resizeForLabel:' true |
|
978 |
) |
|
979 |
) |
|
980 |
) |
|
981 |
) |
|
263 | 982 |
|
983 |
"Modified: 28.7.1997 / 15:38:29 / cg" |
|
218 | 984 |
! |
985 |
||
199 | 986 |
basicsMenuSpec |
987 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
988 |
||
989 |
"do not manually edit this - the painter/builder may not be able to |
|
990 |
handle the specification if its corrupted." |
|
991 |
||
992 |
" |
|
993 |
UIPainter new openOnClass:MenuEditor andSelector:#basicsMenuSpec |
|
994 |
MenuEditor new openInterface:#basicsMenuSpec |
|
995 |
" |
|
996 |
||
997 |
<resource: #canvas> |
|
998 |
||
999 |
^ |
|
1000 |
||
1001 |
#(#FullSpec |
|
1002 |
#'window:' |
|
1003 |
#(#WindowSpec |
|
287 | 1004 |
#'name:' 'BasicsMenuSpec' |
199 | 1005 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
1006 |
#'label:' 'unnamed canvas' |
|
1007 |
#'bounds:' #(#Rectangle 0 0 267 319) |
|
1008 |
) |
|
1009 |
#'component:' |
|
1010 |
#(#SpecCollection |
|
1011 |
#'collection:' |
|
1012 |
#( |
|
1013 |
#(#LabelSpec |
|
1014 |
#'name:' 'nameKeyLabel' |
|
1015 |
#'layout:' #(#AlignmentOrigin 87 0 26 0 1 0.5) |
|
1016 |
#'label:' 'NameKey:' |
|
263 | 1017 |
#'adjust:' #right |
199 | 1018 |
#'resizeForLabel:' true |
1019 |
) |
|
1020 |
#(#InputFieldSpec |
|
1021 |
#'name:' 'itemNameKey' |
|
263 | 1022 |
#'layout:' #(#LayoutFrame 91 0 15 0 0 1.0 37 0) |
199 | 1023 |
#'tabable:' true |
1024 |
#'model:' #nameKey |
|
1025 |
#'type:' #symbolOrNil |
|
1026 |
) |
|
1027 |
#(#LabelSpec |
|
1028 |
#'name:' 'labelLabel' |
|
1029 |
#'layout:' #(#AlignmentOrigin 87 0 53 0 1 0.5) |
|
1030 |
#'label:' 'Label' |
|
263 | 1031 |
#'adjust:' #right |
199 | 1032 |
#'resizeForLabel:' true |
1033 |
) |
|
1034 |
#(#InputFieldSpec |
|
1035 |
#'name:' 'itemLabel' |
|
263 | 1036 |
#'layout:' #(#LayoutFrame 91 0 42 0 0 1.0 64 0) |
199 | 1037 |
#'tabable:' true |
1038 |
#'model:' #label |
|
1039 |
) |
|
1040 |
) |
|
1041 |
) |
|
1042 |
) |
|
263 | 1043 |
|
1044 |
"Modified: 28.7.1997 / 15:38:59 / cg" |
|
199 | 1045 |
! |
1046 |
||
1047 |
basicsRootSpec |
|
1048 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
1049 |
||
1050 |
"do not manually edit this - the painter/builder may not be able to |
|
1051 |
handle the specification if its corrupted." |
|
1052 |
||
1053 |
" |
|
1054 |
UIPainter new openOnClass:MenuEditor andSelector:#basicsRootSpec |
|
1055 |
MenuEditor new openInterface:#basicsRootSpec |
|
1056 |
" |
|
1057 |
||
1058 |
<resource: #canvas> |
|
1059 |
||
1060 |
^ |
|
1061 |
||
1062 |
#(#FullSpec |
|
1063 |
#'window:' |
|
1064 |
#(#WindowSpec |
|
287 | 1065 |
#'name:' 'BasicsRootSpec' |
199 | 1066 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
1067 |
#'label:' 'unnamed canvas' |
|
1068 |
#'bounds:' #(#Rectangle 0 0 267 319) |
|
1069 |
) |
|
1070 |
#'component:' |
|
1071 |
#(#SpecCollection |
|
1072 |
#'collection:' |
|
1073 |
#( |
|
1074 |
#(#LabelSpec |
|
1075 |
#'name:' 'selectorLabel' |
|
1076 |
#'layout:' #(#AlignmentOrigin 78 0 53 0 1 0.5) |
|
1077 |
#'label:' 'Selector:' |
|
263 | 1078 |
#'adjust:' #right |
199 | 1079 |
#'resizeForLabel:' true |
1080 |
) |
|
1081 |
#(#InputFieldSpec |
|
1082 |
#'name:' 'selector' |
|
263 | 1083 |
#'layout:' #(#LayoutFrame 82 0 42 0 0 1.0 64 0) |
199 | 1084 |
#'tabable:' true |
1085 |
#'model:' #label |
|
1086 |
) |
|
1087 |
) |
|
1088 |
) |
|
1089 |
) |
|
263 | 1090 |
|
1091 |
"Modified: 28.7.1997 / 15:39:17 / cg" |
|
199 | 1092 |
! |
1093 |
||
218 | 1094 |
basicsSeparatorSpec |
199 | 1095 |
"this window spec was automatically generated by the ST/X UIPainter" |
1096 |
||
1097 |
"do not manually edit this - the painter/builder may not be able to |
|
1098 |
handle the specification if its corrupted." |
|
1099 |
||
1100 |
" |
|
218 | 1101 |
UIPainter new openOnClass:MenuEditor andSelector:#basicsSeparatorSpec |
1102 |
MenuEditor new openInterface:#basicsSeparatorSpec |
|
199 | 1103 |
" |
1104 |
||
1105 |
<resource: #canvas> |
|
1106 |
||
1107 |
^ |
|
1108 |
||
1109 |
#(#FullSpec |
|
1110 |
#'window:' |
|
1111 |
#(#WindowSpec |
|
290 | 1112 |
#'name:' 'unnamed canvas' |
1113 |
#'layout:' #(#LayoutFrame 634 0 529 0 900 0 847 0) |
|
199 | 1114 |
#'label:' 'unnamed canvas' |
290 | 1115 |
#'min:' #(#Point 10 10) |
1116 |
#'max:' #(#Point 1160 870) |
|
1117 |
#'bounds:' #(#Rectangle 634 529 901 848) |
|
199 | 1118 |
) |
1119 |
#'component:' |
|
1120 |
#(#SpecCollection |
|
1121 |
#'collection:' |
|
1122 |
#( |
|
218 | 1123 |
#(#LabelSpec |
1124 |
#'name:' 'separatorLabel' |
|
1125 |
#'layout:' #(#AlignmentOrigin 127 0 22 0 1 0.5) |
|
1126 |
#'label:' 'Separator Type:' |
|
263 | 1127 |
#'adjust:' #right |
218 | 1128 |
#'resizeForLabel:' true |
1129 |
) |
|
1130 |
#(#ComboListSpec |
|
290 | 1131 |
#'name:' 'seperatorList' |
263 | 1132 |
#'layout:' #(#LayoutFrame 132 0 11 0 0 1.0 33 0) |
218 | 1133 |
#'model:' #seperatorSelection |
290 | 1134 |
#'useIndex:' true |
199 | 1135 |
) |
1136 |
) |
|
1137 |
) |
|
1138 |
) |
|
1139 |
! |
|
1140 |
||
1141 |
detailsEditSpec |
|
1142 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
1143 |
||
1144 |
"do not manually edit this - the painter/builder may not be able to |
|
1145 |
handle the specification if its corrupted." |
|
1146 |
||
1147 |
" |
|
1148 |
UIPainter new openOnClass:MenuEditor andSelector:#detailsEditSpec |
|
1149 |
MenuEditor new openInterface:#detailsEditSpec |
|
1150 |
" |
|
1151 |
||
1152 |
<resource: #canvas> |
|
1153 |
||
1154 |
^ |
|
1155 |
||
1156 |
#(#FullSpec |
|
1157 |
#'window:' |
|
1158 |
#(#WindowSpec |
|
287 | 1159 |
#'name:' 'DetailsEditSpec' |
199 | 1160 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
1161 |
#'label:' 'unnamed canvas' |
|
1162 |
#'bounds:' #(#Rectangle 0 0 259 288) |
|
1163 |
) |
|
1164 |
#'component:' |
|
1165 |
#(#SpecCollection |
|
1166 |
#'collection:' |
|
1167 |
#( |
|
1168 |
#(#LabelSpec |
|
1169 |
#'name:' 'enabledLabel' |
|
1170 |
#'layout:' #(#AlignmentOrigin 87 0 59 0 1 0.5) |
|
1171 |
#'label:' 'Enabled:' |
|
263 | 1172 |
#'adjust:' #right |
199 | 1173 |
#'resizeForLabel:' true |
1174 |
) |
|
1175 |
#(#InputFieldSpec |
|
1176 |
#'name:' 'enabled' |
|
263 | 1177 |
#'layout:' #(#LayoutFrame 91 0 48 0 0 1.0 70 0) |
199 | 1178 |
#'tabable:' true |
1179 |
#'model:' #enabled |
|
1180 |
#'type:' #symbolOrNil |
|
1181 |
) |
|
1182 |
#(#LabelSpec |
|
1183 |
#'name:' 'shortcutKeyLabel' |
|
1184 |
#'layout:' #(#AlignmentOrigin 87 0 33 0 1 0.5) |
|
1185 |
#'label:' 'Accelerator:' |
|
263 | 1186 |
#'adjust:' #right |
199 | 1187 |
#'resizeForLabel:' true |
1188 |
) |
|
1189 |
#(#InputFieldSpec |
|
1190 |
#'name:' 'accelerator' |
|
263 | 1191 |
#'layout:' #(#LayoutFrame 91 0 22 0 0 1.0 44 0) |
199 | 1192 |
#'tabable:' true |
1193 |
#'model:' #shortcutKey |
|
1194 |
#'type:' #symbolOrNil |
|
1195 |
) |
|
1196 |
#(#LabelSpec |
|
1197 |
#'name:' 'accessCharPosLabel' |
|
263 | 1198 |
#'layout:' #(#AlignmentOrigin 211 0 127 0 1 0.5) |
199 | 1199 |
#'label:' 'Access Character Position:' |
263 | 1200 |
#'adjust:' #right |
199 | 1201 |
#'resizeForLabel:' true |
1202 |
) |
|
1203 |
#(#InputFieldSpec |
|
1204 |
#'name:' 'accessCharaterPos' |
|
263 | 1205 |
#'layout:' #(#LayoutFrame 215 0 116 0 0 1.0 138 0) |
199 | 1206 |
#'tabable:' true |
1207 |
#'model:' #accessCharaterPos |
|
1208 |
#'type:' #numberOrNil |
|
1209 |
) |
|
1210 |
) |
|
1211 |
) |
|
1212 |
) |
|
263 | 1213 |
|
1214 |
"Modified: 28.7.1997 / 15:43:19 / cg" |
|
199 | 1215 |
! |
1216 |
||
1217 |
miscEditSpec |
|
1218 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
1219 |
||
1220 |
"do not manually edit this - the painter/builder may not be able to |
|
1221 |
handle the specification if its corrupted." |
|
1222 |
||
1223 |
" |
|
1224 |
UIPainter new openOnClass:MenuEditor andSelector:#miscEditSpec |
|
1225 |
MenuEditor new openInterface:#miscEditSpec |
|
1226 |
" |
|
1227 |
||
1228 |
<resource: #canvas> |
|
1229 |
||
1230 |
^ |
|
1231 |
||
1232 |
#(#FullSpec |
|
1233 |
#'window:' |
|
1234 |
#(#WindowSpec |
|
287 | 1235 |
#'name:' 'MiscEditSpec' |
199 | 1236 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
1237 |
#'label:' 'unnamed canvas' |
|
1238 |
#'bounds:' #(#Rectangle 0 0 245 142) |
|
1239 |
) |
|
1240 |
#'component:' |
|
1241 |
#(#SpecCollection |
|
1242 |
#'collection:' |
|
1243 |
#( |
|
1244 |
#(#LabelSpec |
|
1245 |
#'name:' 'retrieverLabel' |
|
1246 |
#'layout:' #(#AlignmentOrigin 77 0 26 0 1 0.5) |
|
1247 |
#'label:' 'Retriever:' |
|
263 | 1248 |
#'adjust:' #right |
199 | 1249 |
#'resizeForLabel:' true |
1250 |
) |
|
1251 |
#(#InputFieldSpec |
|
1252 |
#'name:' 'retriever' |
|
263 | 1253 |
#'layout:' #(#LayoutFrame 81 0 15 0 0 1.0 37 0) |
199 | 1254 |
#'tabable:' true |
1255 |
#'model:' #retriever |
|
1256 |
#'type:' #symbolOrNil |
|
1257 |
) |
|
1258 |
#(#LabelSpec |
|
1259 |
#'name:' 'iconLabel' |
|
1260 |
#'layout:' #(#AlignmentOrigin 77 0 50 0 1 0.5) |
|
1261 |
#'label:' 'Icon:' |
|
263 | 1262 |
#'adjust:' #right |
199 | 1263 |
#'resizeForLabel:' true |
1264 |
) |
|
1265 |
#(#InputFieldSpec |
|
1266 |
#'name:' 'icon' |
|
263 | 1267 |
#'layout:' #(#LayoutFrame 81 0 39 0 0 1.0 61 0) |
199 | 1268 |
#'tabable:' true |
1269 |
#'model:' #icon |
|
1270 |
#'type:' #symbolOrNil |
|
1271 |
) |
|
1272 |
#(#CheckBoxSpec |
|
1273 |
#'name:' 'iconAndLabel' |
|
263 | 1274 |
#'layout:' #(#LayoutOrigin 15 0 85 0) |
199 | 1275 |
#'tabable:' true |
1276 |
#'model:' #iconAndLabel |
|
1277 |
#'label:' 'Icon & Label' |
|
1278 |
) |
|
1279 |
) |
|
1280 |
) |
|
1281 |
) |
|
263 | 1282 |
|
1283 |
"Modified: 28.7.1997 / 15:44:12 / cg" |
|
199 | 1284 |
! ! |
1285 |
||
209 | 1286 |
!MenuEditor class methodsFor:'startup'! |
1287 |
||
213 | 1288 |
openModalOnClass:aClass andSelector:aSelector |
1289 |
^ self new openModalOnClass:aClass andSelector:aSelector |
|
1290 |
||
1291 |
||
1292 |
! |
|
1293 |
||
209 | 1294 |
openOnClass:aClass andSelector:aSelector |
1295 |
^ self new openOnClass:aClass andSelector:aSelector |
|
1296 |
||
1297 |
||
1298 |
! ! |
|
1299 |
||
199 | 1300 |
!MenuEditor methodsFor:'accessing'! |
1301 |
||
218 | 1302 |
menuDefaultLink |
1303 |
^ self class menuDefaultLink |
|
1304 |
! |
|
1305 |
||
270
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1306 |
selectorName |
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1307 |
^ self painter selectorName |
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1308 |
|
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1309 |
"Created: 31.7.1997 / 14:11:28 / cg" |
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1310 |
! |
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1311 |
|
199 | 1312 |
specClass |
1313 |
^ specClass |
|
1314 |
! |
|
1315 |
||
1316 |
specClass:aClass |
|
1317 |
aClass isBehavior ifTrue:[specClass := aClass name] |
|
1318 |
ifFalse:[specClass := aClass]. |
|
218 | 1319 |
! |
1320 |
||
1321 |
submenuTest |
|
1322 |
"returns submenu assigned to item test |
|
1323 |
" |
|
1324 |
|menu| |
|
1325 |
||
1326 |
menu := self painter asMenu. |
|
1327 |
||
1328 |
menu allItemsDo:[:anItem| |
|
1329 |
anItem value:nil. |
|
1330 |
anItem enabled:true. |
|
1331 |
]. |
|
1332 |
^ menu |
|
287 | 1333 |
! |
1334 |
||
1335 |
useHelpDictionary:aDictionary |
|
1336 |
self noteBookView. |
|
1337 |
self helpTool dictionary:aDictionary. |
|
199 | 1338 |
! ! |
1339 |
||
220 | 1340 |
!MenuEditor methodsFor:'accessing menu'! |
1341 |
||
1342 |
menuButtons |
|
1343 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
1344 |
||
1345 |
^ self class menuButtons |
|
1346 |
||
1347 |
||
1348 |
! |
|
1349 |
||
1350 |
menuPainter |
|
1351 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
1352 |
||
1353 |
^ self class menuPainter |
|
1354 |
||
1355 |
||
298 | 1356 |
! |
1357 |
||
1358 |
menuPullDown |
|
1359 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
1360 |
||
1361 |
^ self class menuPullDown |
|
1362 |
||
1363 |
||
220 | 1364 |
! ! |
1365 |
||
199 | 1366 |
!MenuEditor methodsFor:'actions'! |
1367 |
||
1368 |
accept |
|
1369 |
"automatically generated by UIPainter ..." |
|
1370 |
||
255
989494227ffc
use #booleanAspectFor: , a codeSaver
Claus Gittinger <cg@exept.de>
parents:
249
diff
changeset
|
1371 |
|painter node cont| |
989494227ffc
use #booleanAspectFor: , a codeSaver
Claus Gittinger <cg@exept.de>
parents:
249
diff
changeset
|
1372 |
|
989494227ffc
use #booleanAspectFor: , a codeSaver
Claus Gittinger <cg@exept.de>
parents:
249
diff
changeset
|
1373 |
painter := self painter. |
989494227ffc
use #booleanAspectFor: , a codeSaver
Claus Gittinger <cg@exept.de>
parents:
249
diff
changeset
|
1374 |
node := painter selectedNode. |
199 | 1375 |
|
1376 |
node notNil ifTrue:[ |
|
1377 |
self isHelpToolSelected ifTrue:[ |
|
287 | 1378 |
self helpTool accept. |
1379 |
node contents activeHelpKey:(self helpTool helpKey) |
|
1380 |
] ifFalse:[ |
|
1381 |
cont := node contents buildFromAspects:aspects. |
|
1382 |
painter selectedNodeChanged |
|
1383 |
] |
|
199 | 1384 |
]. |
1385 |
self modifiedChannel value:false. |
|
356 | 1386 |
isModified := true. |
199 | 1387 |
! |
1388 |
||
1389 |
cancel |
|
1390 |
|node| |
|
1391 |
||
1392 |
(node := self painter selectedNode) notNil ifTrue:[ |
|
287 | 1393 |
self helpTool helpKey:(self helpKey). |
199 | 1394 |
aspects do:[:anAspect| anAspect value:nil ]. |
1395 |
node contents toAspects:aspects. |
|
1396 |
]. |
|
1397 |
self modifiedChannel value:false. |
|
1398 |
||
1399 |
! ! |
|
1400 |
||
1401 |
!MenuEditor methodsFor:'aspects'! |
|
1402 |
||
1403 |
aspectFor:aKey |
|
1404 |
"returns aspect for a key or nil |
|
1405 |
" |
|
1406 |
^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ] |
|
1407 |
||
1408 |
||
1409 |
! |
|
1410 |
||
218 | 1411 |
enabledStepIn |
257 | 1412 |
^ builder booleanValueAspectFor:#enabledStepIn |
1413 |
||
1414 |
"Modified: 28.7.1997 / 12:51:55 / cg" |
|
218 | 1415 |
! |
1416 |
||
1417 |
enabledStepOut |
|
257 | 1418 |
^ builder booleanValueAspectFor:#enabledStepOut |
1419 |
||
1420 |
"Modified: 28.7.1997 / 12:52:04 / cg" |
|
218 | 1421 |
! |
1422 |
||
1423 |
enabledStepOver |
|
257 | 1424 |
^ builder booleanValueAspectFor:#enabledStepOver |
1425 |
||
1426 |
"Modified: 28.7.1997 / 12:52:07 / cg" |
|
218 | 1427 |
! |
1428 |
||
220 | 1429 |
hasAnySingleSelection |
257 | 1430 |
^ builder booleanValueAspectFor:#hasAnySingleSelection |
1431 |
||
1432 |
"Modified: 28.7.1997 / 12:52:09 / cg" |
|
220 | 1433 |
! |
1434 |
||
1435 |
hasValidSelection |
|
257 | 1436 |
^ builder booleanValueAspectFor:#hasValidSelection |
1437 |
||
1438 |
"Modified: 28.7.1997 / 12:52:11 / cg" |
|
220 | 1439 |
! |
1440 |
||
1441 |
hasValidSingleSelection |
|
257 | 1442 |
^ builder booleanValueAspectFor:#hasValidSingleSelection |
1443 |
||
1444 |
"Modified: 28.7.1997 / 12:52:13 / cg" |
|
220 | 1445 |
! |
1446 |
||
199 | 1447 |
modifiedChannel |
1448 |
"automatically generated by UIPainter ..." |
|
1449 |
||
257 | 1450 |
^ builder booleanValueAspectFor:#modifiedChannel |
1451 |
||
1452 |
"Modified: 28.7.1997 / 12:52:14 / cg" |
|
199 | 1453 |
! |
1454 |
||
287 | 1455 |
noteBookView |
199 | 1456 |
"automatically generated by UIPainter ..." |
1457 |
||
287 | 1458 |
|noteBook helpTool| |
1459 |
||
1460 |
(noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
|
1461 |
noteBook := View new. |
|
1462 |
helpTool := UIHelpTool new. |
|
1463 |
||
1464 |
helpTool masterApplication:self. |
|
1465 |
helpCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
|
1466 |
specCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
|
1467 |
||
1468 |
helpCanvas client:helpTool. |
|
1469 |
helpTool masterApplication:self. |
|
1470 |
helpTool modifiedHolder:(self modifiedChannel). |
|
1471 |
||
1472 |
builder aspectAt:#noteBookView put:noteBook. |
|
199 | 1473 |
]. |
287 | 1474 |
^ noteBook |
199 | 1475 |
! |
1476 |
||
1477 |
tabList |
|
1478 |
"automatically generated by UIPainter ..." |
|
1479 |
||
298 | 1480 |
|holder| |
1481 |
||
1482 |
(holder := builder bindingAt:#tabList) isNil ifTrue:[ |
|
1483 |
builder aspectAt:#tabList put:(holder := #('Properties') asValue). |
|
1484 |
]. |
|
1485 |
^ holder |
|
1486 |
||
1487 |
||
199 | 1488 |
! |
1489 |
||
1490 |
tabModel |
|
1491 |
"automatically generated by UIPainter ..." |
|
1492 |
||
1493 |
|holder| |
|
1494 |
||
1495 |
(holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
|
1496 |
holder := AspectAdaptor new subject:self; forAspect:#tabSelection. |
|
1497 |
builder aspectAt:#tabModel put:holder. |
|
1498 |
]. |
|
1499 |
^ holder |
|
1500 |
||
1501 |
! ! |
|
1502 |
||
1503 |
!MenuEditor methodsFor:'change & update'! |
|
1504 |
||
1505 |
update:something with:aParameter from:changedObject |
|
1506 |
"one of my models changed its value |
|
1507 |
" |
|
356 | 1508 |
self modifiedChannel value:true. |
218 | 1509 |
! |
1510 |
||
1511 |
updateEnabledChannels |
|
1512 |
"update enabled channels |
|
1513 |
" |
|
220 | 1514 |
|node parent next painter state| |
1515 |
||
1516 |
painter := self painter. |
|
1517 |
node := painter selectedNode. |
|
1518 |
state := false. |
|
1519 |
||
1520 |
node notNil ifTrue:[ |
|
1521 |
self hasAnySingleSelection value:true. |
|
1522 |
||
1523 |
(parent := node parent) notNil ifTrue:[ |
|
1524 |
next := parent childAt:((parent indexOfChild:node) + 1). |
|
1525 |
self enabledStepIn value:(next notNil and:[next hasChildren]). |
|
1526 |
self enabledStepOver value:(parent children size > 1). |
|
1527 |
self enabledStepOut value:(parent parent notNil). |
|
1528 |
self hasValidSingleSelection value:true. |
|
1529 |
self hasValidSelection value:true. |
|
1530 |
^ self |
|
1531 |
] |
|
218 | 1532 |
] ifFalse:[ |
220 | 1533 |
self hasAnySingleSelection value:false. |
1534 |
||
1535 |
painter numberOfSelections ~~ 0 ifTrue:[ |
|
1536 |
state := (painter isInSelection:1) not |
|
1537 |
] |
|
1538 |
]. |
|
1539 |
self enabledStepOver value:false. |
|
1540 |
self enabledStepIn value:false. |
|
1541 |
self enabledStepOut value:false. |
|
1542 |
self hasValidSingleSelection value:false. |
|
1543 |
self hasValidSelection value:state. |
|
1544 |
! ! |
|
1545 |
||
1546 |
!MenuEditor methodsFor:'event handling'! |
|
1547 |
||
1548 |
doesNotUnderstand:aMessage |
|
1549 |
|painter| |
|
1550 |
||
1551 |
painter := self painter. |
|
1552 |
||
1553 |
(painter respondsTo:(aMessage selector)) ifTrue:[ |
|
1554 |
^ aMessage sendTo:painter |
|
1555 |
]. |
|
1556 |
super doesNotUnderstand:aMessage |
|
1557 |
||
1558 |
||
199 | 1559 |
! ! |
1560 |
||
287 | 1561 |
!MenuEditor methodsFor:'private'! |
1562 |
||
1563 |
helpKey |
|
1564 |
|node| |
|
1565 |
||
1566 |
(node := self painter selectedNode) notNil ifTrue:[ |
|
1567 |
^ node contents activeHelpKey |
|
1568 |
]. |
|
1569 |
^ nil |
|
1570 |
! |
|
1571 |
||
1572 |
helpTool |
|
1573 |
^ helpCanvas application |
|
1574 |
! ! |
|
1575 |
||
199 | 1576 |
!MenuEditor methodsFor:'queries'! |
1577 |
||
270
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1578 |
didInstall |
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1579 |
"returns true if the menu was installed |
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1580 |
" |
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1581 |
|
356 | 1582 |
^ didInstall |
270
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1583 |
! |
1a68f7479932
provide access to the menus selector;
Claus Gittinger <cg@exept.de>
parents:
266
diff
changeset
|
1584 |
|
199 | 1585 |
isHelpToolSelected |
1586 |
"returns true if current selection is help tool |
|
1587 |
" |
|
290 | 1588 |
(tabSelection ~~ 0 and:[slices notNil]) ifTrue:[ |
287 | 1589 |
^ (slices at:tabSelection) first = UIHelpTool label |
199 | 1590 |
]. |
287 | 1591 |
^ false |
1592 |
! |
|
1593 |
||
1594 |
isStandAlone |
|
1595 |
"returns true in case of owner of the helptool |
|
1596 |
" |
|
1597 |
^ self masterApplication isNil |
|
199 | 1598 |
! ! |
1599 |
||
1600 |
!MenuEditor methodsFor:'selection'! |
|
1601 |
||
1602 |
menuChanged |
|
287 | 1603 |
|node item slc sel old| |
199 | 1604 |
|
1605 |
(node := self painter selectedNode) notNil ifTrue:[ |
|
1606 |
aspects do:[:anAspect| anAspect value:nil ]. |
|
1607 |
item := node contents. |
|
1608 |
item toAspects:aspects. |
|
1609 |
||
218 | 1610 |
item isSeparator ifFalse:[ |
199 | 1611 |
node parent isNil ifFalse:[ |
218 | 1612 |
node hasChildren ifTrue:[ |
1613 |
slc := #slicesMenu |
|
1614 |
] ifFalse:[ |
|
1615 |
item submenuChannel isNil ifTrue:[slc := #slicesItem] |
|
1616 |
ifFalse:[slc := #slicesLink] |
|
1617 |
]. |
|
287 | 1618 |
slc := (self class perform:slc) copyWith:#( 'Help' #dummy ). |
199 | 1619 |
] ifTrue:[ |
287 | 1620 |
slc := self class perform:#slicesRootMenu |
1621 |
]. |
|
199 | 1622 |
] ifTrue:[ |
287 | 1623 |
slc := self class perform:#slicesSeparatorMenu. |
1624 |
] |
|
199 | 1625 |
]. |
287 | 1626 |
self helpTool helpKey:(self helpKey). |
199 | 1627 |
self modifiedChannel value:false. |
1628 |
||
1629 |
slc ~= slices ifTrue:[ |
|
290 | 1630 |
tabSelection ~~ 0 ifTrue:[ |
287 | 1631 |
old := (slices at:tabSelection) first |
1632 |
]. |
|
1633 |
||
199 | 1634 |
(slices := slc) notNil ifTrue:[ |
287 | 1635 |
sel := slices collect:[:s| s first]. |
290 | 1636 |
tabSelection := 0. |
287 | 1637 |
self tabList value:sel. |
1638 |
||
1639 |
(old notNil and:[(sel := sel findFirst:[:n|n = old]) ~~ 0]) ifFalse:[ |
|
1640 |
sel := 1 |
|
1641 |
]. |
|
1642 |
self tabModel value:sel |
|
199 | 1643 |
] ifFalse:[ |
1644 |
self tabList value:nil. |
|
290 | 1645 |
self tabSelection:0. |
199 | 1646 |
] |
1647 |
]. |
|
218 | 1648 |
self updateEnabledChannels |
199 | 1649 |
! |
1650 |
||
1651 |
tabSelection |
|
290 | 1652 |
^ tabSelection ? 0 |
199 | 1653 |
! |
1654 |
||
1655 |
tabSelection:aSelection |
|
326 | 1656 |
|sel| |
199 | 1657 |
|
287 | 1658 |
tabSelection = aSelection ifTrue:[ |
199 | 1659 |
^ self |
1660 |
]. |
|
298 | 1661 |
(aSelection ~~ 0 and:[slices isNil]) ifTrue:[ |
1662 |
^ self |
|
1663 |
]. |
|
290 | 1664 |
(tabSelection := aSelection) == 0 ifTrue:[ |
287 | 1665 |
slices isNil ifTrue:[ |
1666 |
specCanvas client:nil. |
|
1667 |
^ specCanvas raise. |
|
1668 |
]. |
|
1669 |
tabSelection == 1 ifTrue:[^ self]. |
|
1670 |
tabSelection := 1 |
|
199 | 1671 |
]. |
287 | 1672 |
|
199 | 1673 |
self isHelpToolSelected ifTrue:[ |
287 | 1674 |
self helpTool helpKey:(self helpKey). |
1675 |
helpCanvas raise. |
|
199 | 1676 |
] ifFalse:[ |
1677 |
sel := (slices at:tabSelection) last. |
|
287 | 1678 |
specCanvas client:self spec:(self class perform:sel) builder:builder. |
1679 |
specCanvas raise. |
|
199 | 1680 |
] |
298 | 1681 |
|
199 | 1682 |
! ! |
1683 |
||
1684 |
!MenuEditor methodsFor:'startup / release'! |
|
1685 |
||
1686 |
buildFrom:aClass andSelector:aSelector |
|
249 | 1687 |
|oldClass newClass| |
199 | 1688 |
|
1689 |
oldClass := self specClass. |
|
1690 |
self specClass:aClass. |
|
1691 |
newClass := self specClass. |
|
1692 |
||
287 | 1693 |
(self isStandAlone and:[oldClass ~= newClass]) ifTrue:[ |
1694 |
self helpTool helpSpecFrom:newClass |
|
199 | 1695 |
]. |
1696 |
self painter buildFrom:newClass andSelector:aSelector. |
|
1697 |
! |
|
1698 |
||
356 | 1699 |
closeRequest |
1700 |
"close request |
|
1701 |
" |
|
1702 |
isModified ifTrue:[ |
|
1703 |
(self confirm:'quit without without saving your modifications ?') ifFalse:[ |
|
1704 |
^ self |
|
1705 |
] |
|
1706 |
]. |
|
1707 |
super closeRequest. |
|
1708 |
||
1709 |
||
1710 |
||
1711 |
||
1712 |
||
1713 |
! |
|
1714 |
||
199 | 1715 |
initialize |
1716 |
"initialize channels |
|
1717 |
" |
|
218 | 1718 |
|holder| |
1719 |
||
199 | 1720 |
super initialize. |
1721 |
aspects := IdentityDictionary new. |
|
290 | 1722 |
tabSelection := 0. |
199 | 1723 |
|
1724 |
#( |
|
1725 |
label |
|
1726 |
accessCharaterPos |
|
290 | 1727 |
argument |
218 | 1728 |
submenuChannel |
199 | 1729 |
enabled |
1730 |
value |
|
1731 |
nameKey |
|
1732 |
indication |
|
1733 |
shortcutKey |
|
1734 |
retriever |
|
1735 |
iconAndLabel |
|
1736 |
icon |
|
1737 |
||
218 | 1738 |
) do:[:aKey| |
1739 |
aspects at:aKey put:(holder := ValueHolder new). |
|
199 | 1740 |
holder addDependent:self. |
1741 |
]. |
|
1742 |
||
218 | 1743 |
aspects at:#seperatorSelection put:(holder := SelectionInList new). |
1744 |
holder list:(Item separatorList). |
|
1745 |
holder addDependent:self. |
|
199 | 1746 |
|
1747 |
||
1748 |
! |
|
1749 |
||
213 | 1750 |
openModalOnClass:aClass andSelector:aSelector |
1751 |
specClass := Association key:aClass value:aSelector. |
|
1752 |
super openInterfaceModal. |
|
1753 |
||
1754 |
! |
|
1755 |
||
199 | 1756 |
openOnClass:aClass andSelector:aSelector |
213 | 1757 |
specClass := Association key:aClass value:aSelector. |
199 | 1758 |
super openInterface. |
1759 |
self buildFrom:aClass andSelector:aSelector. |
|
213 | 1760 |
|
209 | 1761 |
! |
1762 |
||
1763 |
postBuildWith:builder |
|
213 | 1764 |
|cls sel| |
1765 |
||
356 | 1766 |
didInstall := false. |
1767 |
isModified := false. |
|
1768 |
||
213 | 1769 |
specClass isAssociation ifTrue:[ |
1770 |
cls := specClass key. |
|
1771 |
sel := specClass value. |
|
228 | 1772 |
|
1773 |
specClass := nil. |
|
1774 |
||
1775 |
(sel isKindOf:Menu) ifTrue:[ |
|
1776 |
self buildFrom:cls andSelector:nil. |
|
1777 |
^ self painter buildFromMenu:sel. |
|
1778 |
] |
|
1779 |
||
213 | 1780 |
]. |
1781 |
self buildFrom:cls andSelector:sel. |
|
199 | 1782 |
! ! |
1783 |
||
1784 |
!MenuEditor methodsFor:'user interactions'! |
|
1785 |
||
1786 |
doBrowseAppClass |
|
1787 |
"open a browser on the class" |
|
1788 |
||
1789 |
|cls| |
|
1790 |
||
331 | 1791 |
cls := self resolveName:(self specClass). |
1792 |
||
1793 |
cls notNil ifTrue:[ |
|
1794 |
SystemBrowser openInClass:cls class selector:(self painter selectorName) |
|
1795 |
] ifFalse:[ |
|
1796 |
self information:'no valid class defined'. |
|
1797 |
] |
|
199 | 1798 |
! |
1799 |
||
1800 |
doDefineClass |
|
1801 |
||
1802 |
aspects at:#classNameChannel put:(self specClass asValue). |
|
1803 |
||
1804 |
(self openDialogInterface:#classDefineSpec) ifTrue:[ |
|
1805 |
self specClass:((aspects at:#classNameChannel) value) |
|
1806 |
]. |
|
1807 |
||
1808 |
! |
|
1809 |
||
1810 |
doFromClass |
|
1811 |
||
1812 |
aspects at:#classNameChannel put:(self specClass asValue). |
|
1813 |
aspects at:#methodNameChannel put:(self painter selectorName asValue). |
|
1814 |
||
1815 |
(self openDialogInterface:#classAndMethodSpec) ifTrue:[ |
|
1816 |
self buildFrom:(aspects at:#classNameChannel) value |
|
1817 |
andSelector:(aspects at:#methodNameChannel) value |
|
1818 |
]. |
|
1819 |
! |
|
1820 |
||
1821 |
doInstallHelp |
|
1822 |
"install help text |
|
1823 |
" |
|
287 | 1824 |
self isStandAlone ifTrue:[ |
1825 |
self helpTool installHelpSpecInto:(self specClass) |
|
1826 |
] |
|
199 | 1827 |
! |
1828 |
||
1829 |
doInstallSpec |
|
1830 |
|cls selector painter menu spec mthd category code| |
|
1831 |
||
331 | 1832 |
cls := self resolveName:(self specClass). |
1833 |
||
1834 |
cls isNil ifTrue:[ |
|
1835 |
^ self information:'no valid class defined'. |
|
199 | 1836 |
]. |
1837 |
painter := self painter. |
|
1838 |
selector := painter selectorName. |
|
1839 |
menu := painter asMenu. |
|
1840 |
||
1841 |
menu isNil ifTrue:[ |
|
1842 |
^ self information:'no menu defined' |
|
1843 |
]. |
|
1844 |
menu := menu literalArrayEncoding. |
|
1845 |
spec := WriteStream on:String new. |
|
1846 |
UISpecification prettyPrintSpecArray:menu on:spec indent:5. |
|
1847 |
spec := spec contents. |
|
1848 |
||
1849 |
"/ if that method already exists, do not overwrite the category |
|
1850 |
||
1851 |
category := 'interface specs'. |
|
1852 |
(mthd := cls class compiledMethodAt:selector) notNil ifTrue:[ |
|
1853 |
category := mthd category. |
|
1854 |
]. |
|
1855 |
||
1856 |
code := Character excla asString |
|
1857 |
, cls name , ' class methodsFor:' , category storeString |
|
1858 |
, Character excla asString , '\\' |
|
1859 |
||
1860 |
, selector , '\' |
|
1861 |
, ' "this window spec was automatically generated by the ST/X MenuEditor"\\' |
|
1862 |
, ' "do not manually edit this - the builder may not be able to\' |
|
1863 |
, ' handle the specification if its corrupted."\\' |
|
1864 |
, ' "\' |
|
1865 |
, ' MenuEditor new openOnClass:' , cls name , ' andSelector:#' , selector , '\' |
|
1866 |
, ' (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , selector , ')) startUp\' |
|
1867 |
, ' "\'. |
|
1868 |
||
1869 |
code := code |
|
1870 |
, '\' |
|
1871 |
, ' <resource: #menu>\\' |
|
1872 |
, ' ^\' |
|
1873 |
, ' ', spec |
|
1874 |
, '\' |
|
1875 |
, Character excla asString |
|
1876 |
, ' ' |
|
1877 |
, Character excla asString |
|
1878 |
, '\\'. |
|
1879 |
||
1880 |
code := code withCRs. |
|
1881 |
(ReadStream on:code) fileIn. |
|
1882 |
||
218 | 1883 |
(cls compiledMethodAt:selector) isNil ifTrue:[ |
318 | 1884 |
code := self class generateCodeFor:cls menuSelector:selector. |
218 | 1885 |
code := code withCRs. |
1886 |
(ReadStream on:code) fileIn. |
|
1887 |
]. |
|
356 | 1888 |
didInstall := true. |
1889 |
isModified := false. |
|
218 | 1890 |
|
199 | 1891 |
! |
1892 |
||
1893 |
doNew |
|
1894 |
self buildFrom:nil andSelector:(self painter selectorName) |
|
1895 |
! |
|
1896 |
||
1897 |
doPickAMenu |
|
1898 |
||
228 | 1899 |
|view| |
199 | 1900 |
|
218 | 1901 |
view := Screen current viewFromUser. |
199 | 1902 |
|
218 | 1903 |
(view isNil or:[view == Screen current rootView]) ifTrue:[ |
199 | 1904 |
^ self |
1905 |
]. |
|
228 | 1906 |
view specClass == MenuPanelSpec ifTrue:[ |
218 | 1907 |
^ self painter buildFromMenu:(view asMenu) |
1908 |
]. |
|
228 | 1909 |
^ nil |
218 | 1910 |
! |
199 | 1911 |
|
218 | 1912 |
doStepDown |
1913 |
"move selected child after next child |
|
1914 |
" |
|
298 | 1915 |
self painter selectedNodeChangeSequenceOrder:1 |
218 | 1916 |
! |
1917 |
||
1918 |
doStepIn |
|
298 | 1919 |
self painter selectedNodeBecomeChildOfNext |
199 | 1920 |
|
218 | 1921 |
! |
199 | 1922 |
|
218 | 1923 |
doStepOut |
298 | 1924 |
self painter selectedNodeBecomeSisterOfParent |
218 | 1925 |
! |
1926 |
||
1927 |
doStepUp |
|
1928 |
"move selected child after next child |
|
1929 |
" |
|
298 | 1930 |
self painter selectedNodeChangeSequenceOrder:-1 |
199 | 1931 |
! ! |
1932 |
||
1933 |
!MenuEditor methodsFor:'values'! |
|
1934 |
||
1935 |
painter |
|
1936 |
"automatically generated by UIPainter ..." |
|
1937 |
||
1938 |
|painter| |
|
1939 |
||
1940 |
(painter := builder bindingAt:#painter) isNil ifTrue:[ |
|
1941 |
painter := Painter new. |
|
1942 |
painter action:[:dummy| self menuChanged ]. |
|
1943 |
builder aspectAt:#painter put:painter. |
|
1944 |
]. |
|
1945 |
^ painter |
|
1946 |
! ! |
|
1947 |
||
218 | 1948 |
!MenuEditor::Item class methodsFor:'constants'! |
1949 |
||
1950 |
separatorList |
|
1951 |
^ #( 'blank' 'single line' 'double line' ) |
|
1952 |
! |
|
1953 |
||
1954 |
separatorSlices |
|
1955 |
^ #( |
|
1956 |
( #blank '' ) |
|
1957 |
( #single '-' ) |
|
1958 |
( #double '=' ) |
|
1959 |
) |
|
1960 |
! ! |
|
1961 |
||
199 | 1962 |
!MenuEditor::Item class methodsFor:'documentation'! |
1963 |
||
1964 |
documentation |
|
1965 |
" |
|
213 | 1966 |
implements the contents assigned to a TreeItem. An instance |
199 | 1967 |
is associated with one item and keeps all its information |
1968 |
||
1969 |
[see also:] |
|
213 | 1970 |
TreeItem |
199 | 1971 |
MenuEditor |
1972 |
||
1973 |
[author:] |
|
1974 |
Claus Atzkern |
|
1975 |
" |
|
1976 |
||
1977 |
||
1978 |
! ! |
|
1979 |
||
1980 |
!MenuEditor::Item methodsFor:'accessing'! |
|
1981 |
||
287 | 1982 |
activeHelpKey |
1983 |
^ activeHelpKey |
|
1984 |
! |
|
1985 |
||
1986 |
activeHelpKey:aKey |
|
1987 |
activeHelpKey := aKey |
|
1988 |
! |
|
1989 |
||
199 | 1990 |
label |
1991 |
"return the value of the instance variable 'label' (automatically generated)" |
|
1992 |
||
1993 |
^ label! |
|
1994 |
||
1995 |
label:something |
|
1996 |
"set the value of the instance variable 'label' (automatically generated)" |
|
1997 |
||
218 | 1998 |
label := something ? '-'. |
1999 |
! |
|
2000 |
||
2001 |
separatorType |
|
2002 |
"returns separator type assigned to item or nil |
|
2003 |
" |
|
2004 |
|c| |
|
2005 |
||
2006 |
label size > 1 ifFalse:[ |
|
2007 |
label size == 0 ifTrue:[ |
|
2008 |
^ #blank |
|
2009 |
]. |
|
2010 |
c := label first. |
|
2011 |
c == $- ifTrue:[^ #single]. |
|
2012 |
c == $= ifTrue:[^ #double]. |
|
2013 |
]. |
|
2014 |
^ nil |
|
2015 |
||
2016 |
! |
|
2017 |
||
2018 |
submenuChannel |
|
2019 |
"return the value of the instance variable 'submenuChannel' (automatically generated)" |
|
2020 |
||
2021 |
^ submenuChannel |
|
2022 |
! |
|
2023 |
||
2024 |
submenuChannel:aChannel |
|
2025 |
"return the value of the instance variable 'submenuChannel' (automatically generated)" |
|
2026 |
||
2027 |
submenuChannel := aChannel |
|
2028 |
! ! |
|
199 | 2029 |
|
2030 |
!MenuEditor::Item methodsFor:'conversion'! |
|
2031 |
||
2032 |
asMenuItem |
|
2033 |
"converts self to a menu item |
|
2034 |
" |
|
2035 |
|item rcv| |
|
2036 |
||
218 | 2037 |
item := MenuItem labeled:label. |
199 | 2038 |
|
218 | 2039 |
self isSeparator ifFalse:[ |
199 | 2040 |
item activeHelpKey:activeHelpKey. |
2041 |
item enabled:enabled. |
|
2042 |
item accessCharacterPosition:accessCharaterPos. |
|
290 | 2043 |
item argument:argument. |
218 | 2044 |
item submenuChannel:submenuChannel. |
199 | 2045 |
item nameKey:nameKey. |
2046 |
item shortcutKeyCharacter:shortcutKey. |
|
2047 |
item value:value. |
|
2048 |
item indication:indication. |
|
2049 |
||
2050 |
icon notNil ifTrue:[ |
|
2051 |
rcv := ResourceRetriever new. |
|
2052 |
rcv className:retriever. |
|
2053 |
rcv selector:icon. |
|
2054 |
iconAndLabel == true ifTrue:[ |
|
2055 |
rcv labelText:label |
|
2056 |
]. |
|
2057 |
item labelImage:rcv |
|
2058 |
] |
|
2059 |
]. |
|
2060 |
^ item. |
|
2061 |
! |
|
2062 |
||
2063 |
buildFromAspects:aspects |
|
249 | 2064 |
|name| |
199 | 2065 |
|
218 | 2066 |
self isSeparator ifFalse:[ |
199 | 2067 |
name := label. |
2068 |
label := (aspects at:#label) value. |
|
2069 |
||
218 | 2070 |
(label isNil or:[self isSeparator]) ifTrue:[ |
199 | 2071 |
(aspects at:#label) value:(label := name) |
2072 |
]. |
|
2073 |
||
2074 |
enabled := (aspects at:#enabled) value. |
|
2075 |
value := (aspects at:#value) value. |
|
2076 |
nameKey := (aspects at:#nameKey) value. |
|
2077 |
indication := (aspects at:#indication) value. |
|
2078 |
shortcutKey := (aspects at:#shortcutKey) value. |
|
2079 |
accessCharaterPos := (aspects at:#accessCharaterPos) value. |
|
290 | 2080 |
argument := (aspects at:#argument) value. |
298 | 2081 |
|
2082 |
argument isString ifTrue:[ |
|
2083 |
argument size > 1 ifTrue:[ |
|
2084 |
(argument at:1) == $# ifTrue:[ |
|
2085 |
argument := (argument copyFrom:2) asSymbol |
|
2086 |
] |
|
2087 |
] |
|
2088 |
]. |
|
218 | 2089 |
submenuChannel := (aspects at:#submenuChannel) value. |
199 | 2090 |
retriever := (aspects at:#retriever) value. |
2091 |
icon := (aspects at:#icon) value. |
|
2092 |
iconAndLabel := (aspects at:#iconAndLabel) value. |
|
2093 |
] ifTrue:[ |
|
218 | 2094 |
name := (aspects at:#seperatorSelection) selectionIndex. |
2095 |
label := (self class separatorSlices at:name) last. |
|
199 | 2096 |
] |
2097 |
! |
|
2098 |
||
2099 |
buildFromMenuItem:anItem |
|
2100 |
|rtv| |
|
2101 |
||
218 | 2102 |
self label:(anItem label). |
2103 |
activeHelpKey := anItem activeHelpKey. |
|
199 | 2104 |
|
2105 |
(enabled := anItem enabled) isSymbol ifFalse:[ |
|
2106 |
enabled := nil |
|
2107 |
]. |
|
2108 |
||
2109 |
(value := anItem value) isSymbol ifFalse:[ |
|
2110 |
value := nil. |
|
2111 |
]. |
|
2112 |
||
2113 |
(indication := anItem indication) isSymbol ifFalse:[ |
|
2114 |
indication := nil |
|
2115 |
]. |
|
2116 |
||
2117 |
nameKey := anItem nameKey. |
|
2118 |
shortcutKey := anItem shortcutKeyCharacter. |
|
2119 |
accessCharaterPos := anItem accessCharacterPosition. |
|
290 | 2120 |
argument := anItem argument. |
218 | 2121 |
submenuChannel := anItem submenuChannel. |
199 | 2122 |
|
2123 |
( ((rtv := anItem adornment) notNil) |
|
2124 |
and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever] |
|
2125 |
) ifTrue:[ |
|
2126 |
retriever := rtv className. |
|
2127 |
icon := rtv selector. |
|
2128 |
||
2129 |
(iconAndLabel := rtv labelText notNil) ifTrue:[ |
|
2130 |
label := rtv labelText. |
|
2131 |
] |
|
2132 |
] |
|
2133 |
! |
|
2134 |
||
2135 |
toAspects:aspects |
|
249 | 2136 |
|type| |
199 | 2137 |
|
218 | 2138 |
(type := self separatorType) notNil ifTrue:[ |
2139 |
type := self class separatorSlices findFirst:[:el| el first == type ]. |
|
2140 |
(aspects at:#seperatorSelection) selectionIndex:type. |
|
199 | 2141 |
] ifFalse:[ |
2142 |
(aspects at:#label) value:label. |
|
2143 |
(aspects at:#enabled) value:enabled. |
|
2144 |
(aspects at:#value) value:value. |
|
2145 |
(aspects at:#nameKey) value:nameKey. |
|
2146 |
(aspects at:#indication) value:indication. |
|
2147 |
(aspects at:#shortcutKey) value:shortcutKey. |
|
2148 |
(aspects at:#accessCharaterPos) value:accessCharaterPos. |
|
298 | 2149 |
|
2150 |
argument isSymbol ifTrue:[ |
|
2151 |
(aspects at:#argument) value:'#', argument |
|
2152 |
] ifFalse:[ |
|
2153 |
(aspects at:#argument) value:argument. |
|
2154 |
]. |
|
218 | 2155 |
(aspects at:#submenuChannel) value:submenuChannel. |
199 | 2156 |
(aspects at:#retriever) value:retriever. |
2157 |
(aspects at:#icon) value:icon. |
|
2158 |
(aspects at:#iconAndLabel) value:iconAndLabel. |
|
2159 |
] |
|
2160 |
! ! |
|
2161 |
||
2162 |
!MenuEditor::Item methodsFor:'queries'! |
|
2163 |
||
218 | 2164 |
isSeparator |
2165 |
"returns true if item is a seperator |
|
2166 |
" |
|
2167 |
^ self separatorType notNil |
|
199 | 2168 |
! ! |
2169 |
||
220 | 2170 |
!MenuEditor::Painter class methodsFor:'constants'! |
2171 |
||
243 | 2172 |
imageItem |
275 | 2173 |
^ self images at:#item |
243 | 2174 |
! |
2175 |
||
2176 |
imageMenu |
|
275 | 2177 |
^ self images at:#menuOpen |
243 | 2178 |
! |
2179 |
||
220 | 2180 |
imageMenuLink |
275 | 2181 |
^ self images at:#menuLink |
2182 |
||
220 | 2183 |
! |
2184 |
||
2185 |
imageSeparator |
|
275 | 2186 |
^ self images at:#separator |
2187 |
||
2188 |
! |
|
2189 |
||
2190 |
images |
|
2191 |
"returns an IdentityDictionary containing a list of images and keys used |
|
2192 |
" |
|
326 | 2193 |
|image| |
275 | 2194 |
|
2195 |
Images notNil ifTrue:[ |
|
2196 |
^ Images |
|
220 | 2197 |
]. |
275 | 2198 |
|
2199 |
Images := IdentityDictionary new. |
|
2200 |
||
2201 |
#( |
|
2202 |
(#item 'ui_menuitem.xpm') |
|
2203 |
(#menuClosed 'ui_submenu.xpm') |
|
2204 |
(#menuOpen 'ui_submenu_open.xpm') |
|
2205 |
(#menuLink 'ui_submenulink.xpm') |
|
2206 |
(#separator 'ui_menusep.xpm') |
|
2207 |
||
2208 |
) do:[:el | |
|
2209 |
image := Image fromFile:( el last ). |
|
2210 |
Images at:(el first) put:image. |
|
2211 |
]. |
|
2212 |
||
2213 |
^ Images |
|
2214 |
||
2215 |
||
2216 |
||
220 | 2217 |
! ! |
2218 |
||
199 | 2219 |
!MenuEditor::Painter class methodsFor:'defaults'! |
2220 |
||
2221 |
defaultMenuMessage |
|
2222 |
"This message is the default yo be sent to the menuHolder to get a menu |
|
2223 |
" |
|
2224 |
^ #menu |
|
2225 |
||
2226 |
||
2227 |
! ! |
|
2228 |
||
2229 |
!MenuEditor::Painter class methodsFor:'documentation'! |
|
2230 |
||
2231 |
documentation |
|
2232 |
" |
|
2233 |
menu selection list |
|
2234 |
||
2235 |
[see also:] |
|
2236 |
SelectionInTreeView |
|
213 | 2237 |
SelectionInTree |
2238 |
TreeItem |
|
199 | 2239 |
|
2240 |
[author:] |
|
2241 |
Claus Atzkern |
|
2242 |
" |
|
2243 |
||
2244 |
||
2245 |
! ! |
|
2246 |
||
2247 |
!MenuEditor::Painter methodsFor:'accessing'! |
|
2248 |
||
2249 |
selectorName |
|
2250 |
^ (listOfNodes first contents label) asSymbol |
|
2251 |
! ! |
|
2252 |
||
2253 |
!MenuEditor::Painter methodsFor:'building'! |
|
2254 |
||
2255 |
buildFrom:aClass andSelector:aSelector |
|
2256 |
|spec cls menu node| |
|
2257 |
||
2258 |
(aClass notNil and:[aSelector notNil]) ifTrue:[ |
|
340 | 2259 |
cls := self application resolveName:aClass. |
199 | 2260 |
|
2261 |
(cls respondsTo:aSelector) ifTrue:[ |
|
2262 |
spec := cls perform:aSelector |
|
2263 |
] |
|
2264 |
]. |
|
331 | 2265 |
|
199 | 2266 |
spec isNil ifFalse:[ |
298 | 2267 |
(spec isMemberOf:Menu) ifFalse:[ |
2268 |
menu := Menu new fromLiteralArrayEncoding:spec. |
|
2269 |
] ifTrue:[ |
|
2270 |
menu := spec. |
|
2271 |
]. |
|
213 | 2272 |
node := self nodeLabel:(aSelector asString). |
199 | 2273 |
self subMenu:menu parent:node. |
2274 |
] ifTrue:[ |
|
2275 |
aSelector notNil ifTrue:[cls := aSelector asString] |
|
2276 |
ifFalse:[cls := 'menu']. |
|
2277 |
||
213 | 2278 |
node := self nodeLabel:cls. |
199 | 2279 |
]. |
2280 |
||
2281 |
node hasChildren ifFalse:[ |
|
213 | 2282 |
node add:(self nodeLabel:'undefined') |
199 | 2283 |
]. |
213 | 2284 |
node expand. |
199 | 2285 |
model root:node. |
2286 |
||
2287 |
! |
|
2288 |
||
2289 |
buildFromMenu:aMenu |
|
2290 |
||
249 | 2291 |
|node| |
199 | 2292 |
|
213 | 2293 |
node := self nodeLabel:'menu'. |
199 | 2294 |
self subMenu:aMenu parent:node. |
2295 |
||
2296 |
node hasChildren ifFalse:[ |
|
213 | 2297 |
node add:(self nodeLabel:'undefined') |
199 | 2298 |
]. |
213 | 2299 |
node expand. |
199 | 2300 |
model root:node. |
2301 |
||
2302 |
! |
|
2303 |
||
213 | 2304 |
menuItem:anItem |
199 | 2305 |
|
249 | 2306 |
|node| |
199 | 2307 |
|
213 | 2308 |
node := self nodeLabel:(anItem label). |
199 | 2309 |
node contents buildFromMenuItem:anItem. |
2310 |
node name:(node contents label). |
|
2311 |
self subMenu:(anItem submenu) parent:node. |
|
2312 |
^ node. |
|
2313 |
||
2314 |
||
2315 |
! |
|
2316 |
||
2317 |
subMenu:aMenu parent:aParent |
|
213 | 2318 |
|idx grp| |
199 | 2319 |
|
2320 |
aMenu isNil ifFalse:[ |
|
2321 |
grp := aMenu groupSizes. |
|
213 | 2322 |
aMenu itemsDo:[:i| aParent add:(self menuItem:i)]. |
199 | 2323 |
|
2324 |
grp notNil ifTrue:[ |
|
213 | 2325 |
idx := 0. |
199 | 2326 |
|
2327 |
grp do:[:i| |
|
213 | 2328 |
idx := idx + i + 1. |
2329 |
aParent add:(self nodeLabel:nil) beforeIndex:idx. |
|
199 | 2330 |
] |
2331 |
] |
|
2332 |
] |
|
2333 |
! ! |
|
2334 |
||
2335 |
!MenuEditor::Painter methodsFor:'conversion'! |
|
2336 |
||
2337 |
asMenu |
|
2338 |
|menu root| |
|
2339 |
||
2340 |
root := self root. |
|
2341 |
||
2342 |
root hasChildren ifTrue:[ |
|
2343 |
menu := Menu new. |
|
2344 |
root children do:[:aChild| menu addItem:(self asMenuItem:aChild)]. |
|
2345 |
]. |
|
2346 |
^ menu |
|
2347 |
! |
|
2348 |
||
2349 |
asMenuItem:aNode |
|
2350 |
||
2351 |
|menu item| |
|
2352 |
||
2353 |
item := aNode contents asMenuItem. |
|
2354 |
||
2355 |
aNode hasChildren ifTrue:[ |
|
2356 |
menu := Menu new. |
|
2357 |
aNode children do:[:aChild| menu addItem:(self asMenuItem:aChild)]. |
|
2358 |
item submenu:menu |
|
2359 |
]. |
|
2360 |
^ item |
|
2361 |
||
2362 |
! ! |
|
2363 |
||
2364 |
!MenuEditor::Painter methodsFor:'drawing basics'! |
|
2365 |
||
2366 |
drawLabelIndex:anIndex atX:x y:yCenter |
|
2367 |
"draw text label assigned to a node at x y( center) |
|
2368 |
" |
|
258 | 2369 |
|y x2 type item| |
199 | 2370 |
|
2371 |
item := (listOfNodes at:anIndex) contents. |
|
218 | 2372 |
type := item separatorType. |
199 | 2373 |
|
218 | 2374 |
type isNil ifTrue:[ |
2375 |
super drawLabelIndex:anIndex atX:x y:yCenter |
|
2376 |
] ifFalse:[ |
|
2377 |
type == #blank ifFalse:[ |
|
258 | 2378 |
x2 := x + 80. |
2379 |
||
2380 |
self displayLineFromX:x y:yCenter toX:x2 y:yCenter. |
|
218 | 2381 |
|
2382 |
type == #double ifTrue:[ |
|
258 | 2383 |
y := yCenter + 2. |
2384 |
self displayLineFromX:x y:y toX:x2 y:y. |
|
218 | 2385 |
] |
2386 |
] |
|
2387 |
] |
|
258 | 2388 |
|
2389 |
"Modified: 28.7.1997 / 13:13:41 / cg" |
|
218 | 2390 |
! |
2391 |
||
2392 |
figureFor:aNode |
|
2393 |
"access figure for a node |
|
2394 |
" |
|
220 | 2395 |
|item| |
2396 |
||
2397 |
aNode hasChildren ifFalse:[ |
|
2398 |
item := aNode contents. |
|
2399 |
||
2400 |
item submenuChannel notNil ifTrue:[ |
|
275 | 2401 |
^ images at:#menuLink |
220 | 2402 |
]. |
2403 |
||
2404 |
item isSeparator ifTrue:[ |
|
275 | 2405 |
^ images at:#separator |
243 | 2406 |
]. |
275 | 2407 |
^ images at:#item |
199 | 2408 |
]. |
243 | 2409 |
|
2410 |
aNode isExpandable ifTrue:[ |
|
275 | 2411 |
^ images at:#menuClosed |
243 | 2412 |
]. |
275 | 2413 |
^ images at:#menuOpen |
199 | 2414 |
! ! |
2415 |
||
356 | 2416 |
!MenuEditor::Painter methodsFor:'event handling'! |
2417 |
||
2418 |
keyPress:key x:x y:y |
|
2419 |
"any key pressed |
|
2420 |
" |
|
2421 |
<resource: #keyboard ( #Delete #BackSpace #Cut #Copy #Paste ) > |
|
2422 |
||
2423 |
(key == #Cut or:[key == #Delete or:[key == #BackSpace]]) ifTrue: [ |
|
2424 |
^ self doCut |
|
2425 |
]. |
|
2426 |
||
2427 |
key == #Copy ifTrue:[ ^ self doCopy]. |
|
2428 |
key == #Paste ifTrue:[ ^ self doPaste]. |
|
2429 |
||
2430 |
super keyPress:key x:x y:y. |
|
2431 |
||
2432 |
! ! |
|
2433 |
||
199 | 2434 |
!MenuEditor::Painter methodsFor:'initialization'! |
2435 |
||
275 | 2436 |
fetchImageResources |
2437 |
"initialize heavily used device resources - to avoid rendering |
|
2438 |
images again and again later; returns maximum extent of the images used. |
|
2439 |
" |
|
2440 |
|y x t| |
|
2441 |
||
2442 |
t := super fetchImageResources. |
|
2443 |
y := t y. |
|
2444 |
x := t x. |
|
2445 |
||
2446 |
images do:[:anIcon| |
|
2447 |
(t := anIcon heightOn:self) > y ifTrue:[y := t]. |
|
2448 |
(t := anIcon widthOn:self) > x ifTrue:[x := t]. |
|
2449 |
]. |
|
2450 |
^ x @ y |
|
2451 |
||
2452 |
! |
|
2453 |
||
199 | 2454 |
initialize |
2455 |
super initialize. |
|
275 | 2456 |
|
2457 |
images := IdentityDictionary new. |
|
2458 |
||
2459 |
self class images associationsDo:[:el| |
|
2460 |
images at:(el key) put:(el value onDevice:device) |
|
2461 |
]. |
|
213 | 2462 |
self multipleSelectOk:true. |
199 | 2463 |
! ! |
2464 |
||
2465 |
!MenuEditor::Painter methodsFor:'menus'! |
|
2466 |
||
2467 |
doCopy |
|
213 | 2468 |
self hasSelection ifTrue:[ |
2469 |
CopyBuffer := OrderedCollection new. |
|
2470 |
self selectionDo:[:i| CopyBuffer add:((listOfNodes at:i) copy)] |
|
2471 |
] |
|
199 | 2472 |
! |
2473 |
||
2474 |
doCreateItem |
|
213 | 2475 |
self addElement:(self nodeLabel:'undefined') |
199 | 2476 |
! |
2477 |
||
218 | 2478 |
doCreateLink |
2479 |
|node item| |
|
2480 |
||
2481 |
node := self nodeLabel:'undefined'. |
|
2482 |
item := node contents. |
|
2483 |
item submenuChannel:#menuDefaultLink. |
|
2484 |
self addElement:node |
|
2485 |
||
2486 |
||
2487 |
||
2488 |
! |
|
2489 |
||
199 | 2490 |
doCreateMenu |
2491 |
|node| |
|
2492 |
||
213 | 2493 |
node := self nodeLabel:'undefined'. |
2494 |
node add:(self nodeLabel:'undefined'). |
|
2495 |
self addElement:node |
|
199 | 2496 |
|
2497 |
! |
|
2498 |
||
2499 |
doCreateSep |
|
213 | 2500 |
self addElement:(self nodeLabel:nil) |
199 | 2501 |
|
2502 |
! |
|
2503 |
||
2504 |
doCut |
|
2505 |
self doCopy. |
|
298 | 2506 |
self selectedNodesRemove. |
199 | 2507 |
! |
2508 |
||
2509 |
doPaste |
|
213 | 2510 |
|
2511 |
(CopyBuffer notNil and:[self selectedNode notNil]) ifTrue:[ |
|
2512 |
self addElement:(CopyBuffer collect:[:el| el copy]) |
|
220 | 2513 |
]. |
199 | 2514 |
! ! |
2515 |
||
2516 |
!MenuEditor::Painter methodsFor:'private'! |
|
2517 |
||
213 | 2518 |
addElement:something |
2519 |
"add something after selection |
|
2520 |
" |
|
298 | 2521 |
self selectedNodeAdd:something |
199 | 2522 |
! |
2523 |
||
213 | 2524 |
nodeLabel:aLabel |
2525 |
^ TreeItem name:aLabel contents:(MenuEditor::Item new label:aLabel). |
|
199 | 2526 |
! ! |
2527 |
||
2528 |
!MenuEditor::Painter methodsFor:'selection'! |
|
2529 |
||
2530 |
selectedNodeChanged |
|
213 | 2531 |
|node name index| |
199 | 2532 |
|
213 | 2533 |
(index := self selectedIndex) ~~ 0 ifTrue:[ |
2534 |
node := listOfNodes at:index. |
|
2535 |
name := node contents label. |
|
2536 |
list at:index put:name. |
|
2537 |
node name:name. |
|
2538 |
self redrawLine:index. |
|
2539 |
] |
|
199 | 2540 |
! ! |
2541 |
||
2542 |
!MenuEditor class methodsFor:'documentation'! |
|
2543 |
||
2544 |
version |
|
2545 |
^ '$Header$' |
|
2546 |
! ! |