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