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