author | Claus Gittinger <cg@exept.de> |
Mon, 28 Jul 1997 13:14:17 +0200 | |
changeset 258 | c6f8c3e2f463 |
parent 257 | 02d6daa8d878 |
child 263 | 25f080e1217f |
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 |
||
258 | 1406 |
^ builder nilValueAspectFor:#tabList |
1407 |
||
1408 |
"Modified: 28.7.1997 / 13:11:17 / cg" |
|
199 | 1409 |
! |
1410 |
||
1411 |
tabModel |
|
1412 |
"automatically generated by UIPainter ..." |
|
1413 |
||
1414 |
|holder| |
|
1415 |
||
1416 |
(holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
|
1417 |
holder := AspectAdaptor new subject:self; forAspect:#tabSelection. |
|
1418 |
builder aspectAt:#tabModel put:holder. |
|
1419 |
]. |
|
1420 |
^ holder |
|
1421 |
||
1422 |
! ! |
|
1423 |
||
1424 |
!MenuEditor methodsFor:'change & update'! |
|
1425 |
||
1426 |
update:something with:aParameter from:changedObject |
|
1427 |
"one of my models changed its value |
|
1428 |
" |
|
1429 |
self modifiedChannel value:true |
|
218 | 1430 |
! |
1431 |
||
1432 |
updateEnabledChannels |
|
1433 |
"update enabled channels |
|
1434 |
" |
|
220 | 1435 |
|node parent next painter state| |
1436 |
||
1437 |
painter := self painter. |
|
1438 |
node := painter selectedNode. |
|
1439 |
state := false. |
|
1440 |
||
1441 |
node notNil ifTrue:[ |
|
1442 |
self hasAnySingleSelection value:true. |
|
1443 |
||
1444 |
(parent := node parent) notNil ifTrue:[ |
|
1445 |
next := parent childAt:((parent indexOfChild:node) + 1). |
|
1446 |
self enabledStepIn value:(next notNil and:[next hasChildren]). |
|
1447 |
self enabledStepOver value:(parent children size > 1). |
|
1448 |
self enabledStepOut value:(parent parent notNil). |
|
1449 |
self hasValidSingleSelection value:true. |
|
1450 |
self hasValidSelection value:true. |
|
1451 |
^ self |
|
1452 |
] |
|
218 | 1453 |
] ifFalse:[ |
220 | 1454 |
self hasAnySingleSelection value:false. |
1455 |
||
1456 |
painter numberOfSelections ~~ 0 ifTrue:[ |
|
1457 |
state := (painter isInSelection:1) not |
|
1458 |
] |
|
1459 |
]. |
|
1460 |
self enabledStepOver value:false. |
|
1461 |
self enabledStepIn value:false. |
|
1462 |
self enabledStepOut value:false. |
|
1463 |
self hasValidSingleSelection value:false. |
|
1464 |
self hasValidSelection value:state. |
|
1465 |
! ! |
|
1466 |
||
1467 |
!MenuEditor methodsFor:'event handling'! |
|
1468 |
||
1469 |
doesNotUnderstand:aMessage |
|
1470 |
|painter| |
|
1471 |
||
1472 |
painter := self painter. |
|
1473 |
||
1474 |
(painter respondsTo:(aMessage selector)) ifTrue:[ |
|
1475 |
^ aMessage sendTo:painter |
|
1476 |
]. |
|
1477 |
super doesNotUnderstand:aMessage |
|
1478 |
||
1479 |
||
199 | 1480 |
! ! |
1481 |
||
1482 |
!MenuEditor methodsFor:'queries'! |
|
1483 |
||
1484 |
isHelpToolSelected |
|
1485 |
"returns true if current selection is help tool |
|
1486 |
" |
|
1487 |
(slices notNil and:[tabSelection notNil]) ifTrue:[ |
|
1488 |
^ (slices at:tabSelection) last == #help |
|
1489 |
]. |
|
1490 |
^ false |
|
1491 |
! ! |
|
1492 |
||
1493 |
!MenuEditor methodsFor:'selection'! |
|
1494 |
||
1495 |
menuChanged |
|
1496 |
|node item slc sel| |
|
1497 |
||
1498 |
(node := self painter selectedNode) notNil ifTrue:[ |
|
1499 |
aspects do:[:anAspect| anAspect value:nil ]. |
|
1500 |
item := node contents. |
|
1501 |
item toAspects:aspects. |
|
1502 |
||
218 | 1503 |
item isSeparator ifFalse:[ |
199 | 1504 |
node parent isNil ifFalse:[ |
218 | 1505 |
node hasChildren ifTrue:[ |
1506 |
slc := #slicesMenu |
|
1507 |
] ifFalse:[ |
|
1508 |
item submenuChannel isNil ifTrue:[slc := #slicesItem] |
|
1509 |
ifFalse:[slc := #slicesLink] |
|
1510 |
]. |
|
199 | 1511 |
] ifTrue:[ |
1512 |
slc := #slicesRootMenu |
|
1513 |
] |
|
1514 |
] ifTrue:[ |
|
218 | 1515 |
slc := #slicesSeparatorMenu |
199 | 1516 |
]. |
1517 |
slc := self class perform:slc. |
|
1518 |
]. |
|
1519 |
self modifiedChannel value:false. |
|
1520 |
||
1521 |
slc ~= slices ifTrue:[ |
|
1522 |
(slices := slc) notNil ifTrue:[ |
|
1523 |
tabSelection notNil ifTrue:[sel := tabSelection min:(slices size)] |
|
1524 |
ifFalse:[sel := 1]. |
|
1525 |
||
1526 |
self tabList value:(slices collect:[:s| s first]). |
|
1527 |
self tabModel setValue:nil. |
|
1528 |
self tabModel value:sel. |
|
1529 |
] ifFalse:[ |
|
1530 |
self tabList value:nil. |
|
1531 |
self tabSelection:nil. |
|
1532 |
] |
|
1533 |
]. |
|
218 | 1534 |
self updateEnabledChannels |
199 | 1535 |
! |
1536 |
||
1537 |
tabSelection |
|
1538 |
^ tabSelection |
|
1539 |
! |
|
1540 |
||
1541 |
tabSelection:aSelection |
|
1542 |
|tool sel| |
|
1543 |
||
1544 |
tabSelection == aSelection ifTrue:[ |
|
1545 |
^ self |
|
1546 |
]. |
|
1547 |
||
1548 |
(tabSelection := aSelection) isNil ifTrue:[ |
|
1549 |
^ self tabCanvas client:nil |
|
1550 |
]. |
|
1551 |
self isHelpToolSelected ifTrue:[ |
|
218 | 1552 |
self tabCanvas client:(tool := self activeHelpTool). |
199 | 1553 |
tool model:(self aspectFor:#activeHelpKey) |
1554 |
] ifFalse:[ |
|
1555 |
sel := (slices at:tabSelection) last. |
|
1556 |
self tabCanvas client:self spec:(self class perform:sel) builder:builder |
|
1557 |
] |
|
1558 |
! ! |
|
1559 |
||
1560 |
!MenuEditor methodsFor:'startup / release'! |
|
1561 |
||
1562 |
buildFrom:aClass andSelector:aSelector |
|
249 | 1563 |
|oldClass newClass| |
199 | 1564 |
|
1565 |
oldClass := self specClass. |
|
1566 |
self specClass:aClass. |
|
1567 |
newClass := self specClass. |
|
1568 |
||
218 | 1569 |
(self isOwnerOfHelpTool and:[oldClass ~= newClass]) ifTrue:[ |
1570 |
self activeHelpTool helpSpecFrom:newClass |
|
199 | 1571 |
]. |
1572 |
self painter buildFrom:newClass andSelector:aSelector. |
|
1573 |
! |
|
1574 |
||
1575 |
initialize |
|
1576 |
"initialize channels |
|
1577 |
" |
|
218 | 1578 |
|holder| |
1579 |
||
199 | 1580 |
super initialize. |
1581 |
aspects := IdentityDictionary new. |
|
1582 |
||
1583 |
#( |
|
1584 |
label |
|
1585 |
accessCharaterPos |
|
218 | 1586 |
submenuChannel |
199 | 1587 |
activeHelpKey |
1588 |
enabled |
|
1589 |
value |
|
1590 |
nameKey |
|
1591 |
indication |
|
1592 |
shortcutKey |
|
1593 |
retriever |
|
1594 |
iconAndLabel |
|
1595 |
icon |
|
1596 |
||
218 | 1597 |
) do:[:aKey| |
1598 |
aspects at:aKey put:(holder := ValueHolder new). |
|
199 | 1599 |
holder addDependent:self. |
1600 |
]. |
|
1601 |
||
218 | 1602 |
aspects at:#seperatorSelection put:(holder := SelectionInList new). |
1603 |
holder list:(Item separatorList). |
|
1604 |
holder addDependent:self. |
|
199 | 1605 |
|
1606 |
||
1607 |
! |
|
1608 |
||
213 | 1609 |
openModalOnClass:aClass andSelector:aSelector |
1610 |
specClass := Association key:aClass value:aSelector. |
|
1611 |
super openInterfaceModal. |
|
1612 |
||
1613 |
! |
|
1614 |
||
199 | 1615 |
openOnClass:aClass andSelector:aSelector |
213 | 1616 |
specClass := Association key:aClass value:aSelector. |
199 | 1617 |
super openInterface. |
1618 |
self buildFrom:aClass andSelector:aSelector. |
|
213 | 1619 |
|
209 | 1620 |
! |
1621 |
||
1622 |
postBuildWith:builder |
|
213 | 1623 |
|cls sel| |
1624 |
||
1625 |
specClass isAssociation ifTrue:[ |
|
1626 |
cls := specClass key. |
|
1627 |
sel := specClass value. |
|
228 | 1628 |
|
1629 |
specClass := nil. |
|
1630 |
||
1631 |
(sel isKindOf:Menu) ifTrue:[ |
|
1632 |
self buildFrom:cls andSelector:nil. |
|
1633 |
^ self painter buildFromMenu:sel. |
|
1634 |
] |
|
1635 |
||
213 | 1636 |
]. |
1637 |
self buildFrom:cls andSelector:sel. |
|
199 | 1638 |
! ! |
1639 |
||
1640 |
!MenuEditor methodsFor:'user interactions'! |
|
1641 |
||
1642 |
doBrowseAppClass |
|
1643 |
"open a browser on the class" |
|
1644 |
||
1645 |
|cls| |
|
1646 |
||
1647 |
(cls := self specClass) isNil ifTrue:[ |
|
1648 |
^ self information:'no class yet'. |
|
1649 |
]. |
|
1650 |
||
1651 |
cls isBehavior ifFalse:[ |
|
1652 |
(cls := Smalltalk at:cls asSymbol) isNil ifTrue:[ |
|
1653 |
^ self information:'no valid class defined'. |
|
1654 |
] |
|
1655 |
]. |
|
224 | 1656 |
SystemBrowser openInClass:cls class selector:(self painter selectorName) |
199 | 1657 |
|
1658 |
! |
|
1659 |
||
1660 |
doDefineClass |
|
1661 |
||
1662 |
aspects at:#classNameChannel put:(self specClass asValue). |
|
1663 |
||
1664 |
(self openDialogInterface:#classDefineSpec) ifTrue:[ |
|
1665 |
self specClass:((aspects at:#classNameChannel) value) |
|
1666 |
]. |
|
1667 |
||
1668 |
! |
|
1669 |
||
1670 |
doFromClass |
|
1671 |
||
1672 |
aspects at:#classNameChannel put:(self specClass asValue). |
|
1673 |
aspects at:#methodNameChannel put:(self painter selectorName asValue). |
|
1674 |
||
1675 |
(self openDialogInterface:#classAndMethodSpec) ifTrue:[ |
|
1676 |
self buildFrom:(aspects at:#classNameChannel) value |
|
1677 |
andSelector:(aspects at:#methodNameChannel) value |
|
1678 |
]. |
|
1679 |
! |
|
1680 |
||
1681 |
doInstallHelp |
|
1682 |
"install help text |
|
1683 |
" |
|
218 | 1684 |
self activeHelpTool installHelpSpecInto:(self specClass) |
199 | 1685 |
! |
1686 |
||
1687 |
doInstallSpec |
|
1688 |
|cls selector painter menu spec mthd category code| |
|
1689 |
||
1690 |
(cls := self specClass) isNil ifTrue:[ |
|
1691 |
^ self information:'no class yet'. |
|
1692 |
]. |
|
1693 |
||
1694 |
cls isBehavior ifFalse:[ |
|
1695 |
(cls := Smalltalk at:cls asSymbol) isNil ifTrue:[ |
|
1696 |
^ self information:'no valid class defined'. |
|
1697 |
] |
|
1698 |
]. |
|
1699 |
painter := self painter. |
|
1700 |
selector := painter selectorName. |
|
1701 |
menu := painter asMenu. |
|
1702 |
||
1703 |
menu isNil ifTrue:[ |
|
1704 |
^ self information:'no menu defined' |
|
1705 |
]. |
|
1706 |
menu := menu literalArrayEncoding. |
|
1707 |
spec := WriteStream on:String new. |
|
1708 |
UISpecification prettyPrintSpecArray:menu on:spec indent:5. |
|
1709 |
spec := spec contents. |
|
1710 |
||
1711 |
"/ if that method already exists, do not overwrite the category |
|
1712 |
||
1713 |
category := 'interface specs'. |
|
1714 |
(mthd := cls class compiledMethodAt:selector) notNil ifTrue:[ |
|
1715 |
category := mthd category. |
|
1716 |
]. |
|
1717 |
||
1718 |
code := Character excla asString |
|
1719 |
, cls name , ' class methodsFor:' , category storeString |
|
1720 |
, Character excla asString , '\\' |
|
1721 |
||
1722 |
, selector , '\' |
|
1723 |
, ' "this window spec was automatically generated by the ST/X MenuEditor"\\' |
|
1724 |
, ' "do not manually edit this - the builder may not be able to\' |
|
1725 |
, ' handle the specification if its corrupted."\\' |
|
1726 |
, ' "\' |
|
1727 |
, ' MenuEditor new openOnClass:' , cls name , ' andSelector:#' , selector , '\' |
|
1728 |
, ' (Menu new fromLiteralArrayEncoding:(' , cls name , ' ' , selector , ')) startUp\' |
|
1729 |
, ' "\'. |
|
1730 |
||
1731 |
code := code |
|
1732 |
, '\' |
|
1733 |
, ' <resource: #menu>\\' |
|
1734 |
, ' ^\' |
|
1735 |
, ' ', spec |
|
1736 |
, '\' |
|
1737 |
, Character excla asString |
|
1738 |
, ' ' |
|
1739 |
, Character excla asString |
|
1740 |
, '\\'. |
|
1741 |
||
1742 |
code := code withCRs. |
|
1743 |
(ReadStream on:code) fileIn. |
|
1744 |
||
218 | 1745 |
(cls compiledMethodAt:selector) isNil ifTrue:[ |
1746 |
category := 'accessing menu'. |
|
1747 |
code := Character excla asString |
|
1748 |
, cls name , ' methodsFor:' , category storeString |
|
1749 |
, Character excla asString , '\\' |
|
1750 |
||
1751 |
, selector , '\' |
|
1752 |
, ' "this window spec was automatically generated by the ST/X MenuEditor"\\' |
|
1753 |
, ' ^ self class ', selector, '\\' |
|
1754 |
, '\' |
|
1755 |
, Character excla asString |
|
1756 |
, ' ' |
|
1757 |
, Character excla asString |
|
1758 |
, '\\'. |
|
1759 |
||
1760 |
code := code withCRs. |
|
1761 |
(ReadStream on:code) fileIn. |
|
1762 |
]. |
|
1763 |
||
1764 |
||
199 | 1765 |
! |
1766 |
||
1767 |
doNew |
|
1768 |
self buildFrom:nil andSelector:(self painter selectorName) |
|
1769 |
! |
|
1770 |
||
1771 |
doPickAMenu |
|
1772 |
||
228 | 1773 |
|view| |
199 | 1774 |
|
218 | 1775 |
view := Screen current viewFromUser. |
199 | 1776 |
|
218 | 1777 |
(view isNil or:[view == Screen current rootView]) ifTrue:[ |
199 | 1778 |
^ self |
1779 |
]. |
|
228 | 1780 |
view specClass == MenuPanelSpec ifTrue:[ |
218 | 1781 |
^ self painter buildFromMenu:(view asMenu) |
1782 |
]. |
|
228 | 1783 |
^ nil |
218 | 1784 |
! |
199 | 1785 |
|
218 | 1786 |
doStepDown |
1787 |
"move selected child after next child |
|
1788 |
" |
|
1789 |
self painter doStepOver:1 |
|
1790 |
! |
|
1791 |
||
1792 |
doStepIn |
|
1793 |
self painter doStepIn |
|
199 | 1794 |
|
218 | 1795 |
! |
199 | 1796 |
|
218 | 1797 |
doStepOut |
1798 |
self painter doStepOut |
|
1799 |
! |
|
1800 |
||
1801 |
doStepUp |
|
1802 |
"move selected child after next child |
|
1803 |
" |
|
1804 |
self painter doStepOver:-1 |
|
199 | 1805 |
! ! |
1806 |
||
1807 |
!MenuEditor methodsFor:'values'! |
|
1808 |
||
1809 |
painter |
|
1810 |
"automatically generated by UIPainter ..." |
|
1811 |
||
1812 |
|painter| |
|
1813 |
||
1814 |
(painter := builder bindingAt:#painter) isNil ifTrue:[ |
|
1815 |
painter := Painter new. |
|
1816 |
painter action:[:dummy| self menuChanged ]. |
|
1817 |
builder aspectAt:#painter put:painter. |
|
1818 |
]. |
|
1819 |
^ painter |
|
1820 |
! ! |
|
1821 |
||
218 | 1822 |
!MenuEditor::Item class methodsFor:'constants'! |
1823 |
||
1824 |
separatorList |
|
1825 |
^ #( 'blank' 'single line' 'double line' ) |
|
1826 |
! |
|
1827 |
||
1828 |
separatorSlices |
|
1829 |
^ #( |
|
1830 |
( #blank '' ) |
|
1831 |
( #single '-' ) |
|
1832 |
( #double '=' ) |
|
1833 |
) |
|
1834 |
! ! |
|
1835 |
||
199 | 1836 |
!MenuEditor::Item class methodsFor:'documentation'! |
1837 |
||
1838 |
documentation |
|
1839 |
" |
|
213 | 1840 |
implements the contents assigned to a TreeItem. An instance |
199 | 1841 |
is associated with one item and keeps all its information |
1842 |
||
1843 |
[see also:] |
|
213 | 1844 |
TreeItem |
199 | 1845 |
MenuEditor |
1846 |
||
1847 |
[author:] |
|
1848 |
Claus Atzkern |
|
1849 |
" |
|
1850 |
||
1851 |
||
1852 |
! ! |
|
1853 |
||
1854 |
!MenuEditor::Item methodsFor:'accessing'! |
|
1855 |
||
1856 |
label |
|
1857 |
"return the value of the instance variable 'label' (automatically generated)" |
|
1858 |
||
1859 |
^ label! |
|
1860 |
||
1861 |
label:something |
|
1862 |
"set the value of the instance variable 'label' (automatically generated)" |
|
1863 |
||
218 | 1864 |
label := something ? '-'. |
1865 |
! |
|
1866 |
||
1867 |
separatorType |
|
1868 |
"returns separator type assigned to item or nil |
|
1869 |
" |
|
1870 |
|c| |
|
1871 |
||
1872 |
label size > 1 ifFalse:[ |
|
1873 |
label size == 0 ifTrue:[ |
|
1874 |
^ #blank |
|
1875 |
]. |
|
1876 |
c := label first. |
|
1877 |
c == $- ifTrue:[^ #single]. |
|
1878 |
c == $= ifTrue:[^ #double]. |
|
1879 |
]. |
|
1880 |
^ nil |
|
1881 |
||
1882 |
! |
|
1883 |
||
1884 |
submenuChannel |
|
1885 |
"return the value of the instance variable 'submenuChannel' (automatically generated)" |
|
1886 |
||
1887 |
^ submenuChannel |
|
1888 |
! |
|
1889 |
||
1890 |
submenuChannel:aChannel |
|
1891 |
"return the value of the instance variable 'submenuChannel' (automatically generated)" |
|
1892 |
||
1893 |
submenuChannel := aChannel |
|
1894 |
! ! |
|
199 | 1895 |
|
1896 |
!MenuEditor::Item methodsFor:'conversion'! |
|
1897 |
||
1898 |
asMenuItem |
|
1899 |
"converts self to a menu item |
|
1900 |
" |
|
1901 |
|item rcv| |
|
1902 |
||
218 | 1903 |
item := MenuItem labeled:label. |
199 | 1904 |
|
218 | 1905 |
self isSeparator ifFalse:[ |
199 | 1906 |
item activeHelpKey:activeHelpKey. |
1907 |
item enabled:enabled. |
|
1908 |
item accessCharacterPosition:accessCharaterPos. |
|
218 | 1909 |
item submenuChannel:submenuChannel. |
199 | 1910 |
item nameKey:nameKey. |
1911 |
item shortcutKeyCharacter:shortcutKey. |
|
1912 |
item value:value. |
|
1913 |
item indication:indication. |
|
1914 |
||
1915 |
icon notNil ifTrue:[ |
|
1916 |
rcv := ResourceRetriever new. |
|
1917 |
rcv className:retriever. |
|
1918 |
rcv selector:icon. |
|
1919 |
iconAndLabel == true ifTrue:[ |
|
1920 |
rcv labelText:label |
|
1921 |
]. |
|
1922 |
item labelImage:rcv |
|
1923 |
] |
|
1924 |
]. |
|
1925 |
^ item. |
|
1926 |
! |
|
1927 |
||
1928 |
buildFromAspects:aspects |
|
249 | 1929 |
|name| |
199 | 1930 |
|
218 | 1931 |
self isSeparator ifFalse:[ |
199 | 1932 |
name := label. |
1933 |
label := (aspects at:#label) value. |
|
1934 |
||
218 | 1935 |
(label isNil or:[self isSeparator]) ifTrue:[ |
199 | 1936 |
(aspects at:#label) value:(label := name) |
1937 |
]. |
|
1938 |
||
1939 |
activeHelpKey := (aspects at:#activeHelpKey) value. |
|
1940 |
enabled := (aspects at:#enabled) value. |
|
1941 |
value := (aspects at:#value) value. |
|
1942 |
nameKey := (aspects at:#nameKey) value. |
|
1943 |
indication := (aspects at:#indication) value. |
|
1944 |
shortcutKey := (aspects at:#shortcutKey) value. |
|
1945 |
accessCharaterPos := (aspects at:#accessCharaterPos) value. |
|
218 | 1946 |
submenuChannel := (aspects at:#submenuChannel) value. |
199 | 1947 |
retriever := (aspects at:#retriever) value. |
1948 |
icon := (aspects at:#icon) value. |
|
1949 |
iconAndLabel := (aspects at:#iconAndLabel) value. |
|
1950 |
] ifTrue:[ |
|
218 | 1951 |
name := (aspects at:#seperatorSelection) selectionIndex. |
1952 |
label := (self class separatorSlices at:name) last. |
|
199 | 1953 |
] |
1954 |
! |
|
1955 |
||
1956 |
buildFromMenuItem:anItem |
|
1957 |
|rtv| |
|
1958 |
||
218 | 1959 |
self label:(anItem label). |
1960 |
activeHelpKey := anItem activeHelpKey. |
|
199 | 1961 |
|
1962 |
(enabled := anItem enabled) isSymbol ifFalse:[ |
|
1963 |
enabled := nil |
|
1964 |
]. |
|
1965 |
||
1966 |
(value := anItem value) isSymbol ifFalse:[ |
|
1967 |
value := nil. |
|
1968 |
]. |
|
1969 |
||
1970 |
(indication := anItem indication) isSymbol ifFalse:[ |
|
1971 |
indication := nil |
|
1972 |
]. |
|
1973 |
||
1974 |
nameKey := anItem nameKey. |
|
1975 |
shortcutKey := anItem shortcutKeyCharacter. |
|
1976 |
accessCharaterPos := anItem accessCharacterPosition. |
|
218 | 1977 |
submenuChannel := anItem submenuChannel. |
199 | 1978 |
|
1979 |
( ((rtv := anItem adornment) notNil) |
|
1980 |
and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever] |
|
1981 |
) ifTrue:[ |
|
1982 |
retriever := rtv className. |
|
1983 |
icon := rtv selector. |
|
1984 |
||
1985 |
(iconAndLabel := rtv labelText notNil) ifTrue:[ |
|
1986 |
label := rtv labelText. |
|
1987 |
] |
|
1988 |
] |
|
1989 |
! |
|
1990 |
||
1991 |
toAspects:aspects |
|
249 | 1992 |
|type| |
199 | 1993 |
|
218 | 1994 |
(type := self separatorType) notNil ifTrue:[ |
1995 |
type := self class separatorSlices findFirst:[:el| el first == type ]. |
|
1996 |
(aspects at:#seperatorSelection) selectionIndex:type. |
|
199 | 1997 |
] ifFalse:[ |
1998 |
(aspects at:#label) value:label. |
|
1999 |
(aspects at:#activeHelpKey) value:activeHelpKey. |
|
2000 |
(aspects at:#enabled) value:enabled. |
|
2001 |
(aspects at:#value) value:value. |
|
2002 |
(aspects at:#nameKey) value:nameKey. |
|
2003 |
(aspects at:#indication) value:indication. |
|
2004 |
(aspects at:#shortcutKey) value:shortcutKey. |
|
2005 |
(aspects at:#accessCharaterPos) value:accessCharaterPos. |
|
218 | 2006 |
(aspects at:#submenuChannel) value:submenuChannel. |
199 | 2007 |
(aspects at:#retriever) value:retriever. |
2008 |
(aspects at:#icon) value:icon. |
|
2009 |
(aspects at:#iconAndLabel) value:iconAndLabel. |
|
2010 |
] |
|
2011 |
! ! |
|
2012 |
||
2013 |
!MenuEditor::Item methodsFor:'queries'! |
|
2014 |
||
218 | 2015 |
isSeparator |
2016 |
"returns true if item is a seperator |
|
2017 |
" |
|
2018 |
^ self separatorType notNil |
|
199 | 2019 |
! ! |
2020 |
||
220 | 2021 |
!MenuEditor::Painter class methodsFor:'constants'! |
2022 |
||
243 | 2023 |
imageClosed |
2024 |
^ self imageMenu |
|
2025 |
||
2026 |
"Created: 28.7.1997 / 10:31:37 / cg" |
|
2027 |
! |
|
2028 |
||
2029 |
imageItem |
|
2030 |
ImageItem isNil ifTrue:[ |
|
2031 |
ImageItem := Image fromFile:('ui_menuitem.xpm'). |
|
2032 |
]. |
|
2033 |
^ ImageItem |
|
2034 |
||
2035 |
" |
|
2036 |
ImageItem := nil |
|
2037 |
" |
|
2038 |
||
2039 |
"Created: 28.7.1997 / 09:51:00 / cg" |
|
2040 |
"Modified: 28.7.1997 / 09:51:14 / cg" |
|
2041 |
! |
|
2042 |
||
2043 |
imageMenu |
|
2044 |
ImageMenu isNil ifTrue:[ |
|
2045 |
ImageMenu := Image fromFile:('ui_submenu.xpm'). |
|
2046 |
]. |
|
2047 |
^ ImageMenu |
|
2048 |
||
2049 |
" |
|
2050 |
ImageMenu := nil |
|
2051 |
" |
|
2052 |
||
2053 |
"Created: 28.7.1997 / 10:01:21 / cg" |
|
2054 |
"Modified: 28.7.1997 / 10:29:14 / cg" |
|
2055 |
! |
|
2056 |
||
220 | 2057 |
imageMenuLink |
2058 |
ImageMenuLink isNil ifTrue:[ |
|
243 | 2059 |
"/ ImageMenuLink := Image fromFile:('xpmBitmaps/document_images/tiny_yellow_dir_link.xpm'). |
2060 |
ImageMenuLink := Image fromFile:('ui_submenulink.xpm'). |
|
220 | 2061 |
]. |
243 | 2062 |
^ ImageMenuLink |
2063 |
||
2064 |
" |
|
2065 |
ImageMenuLink := nil |
|
2066 |
" |
|
2067 |
||
2068 |
"Modified: 28.7.1997 / 10:29:18 / cg" |
|
2069 |
! |
|
2070 |
||
2071 |
imageMenuOpen |
|
2072 |
ImageMenuOpen isNil ifTrue:[ |
|
2073 |
ImageMenuOpen := Image fromFile:('ui_submenu_open.xpm'). |
|
2074 |
]. |
|
2075 |
^ ImageMenuOpen |
|
2076 |
||
2077 |
" |
|
2078 |
ImageMenuOpen := nil |
|
2079 |
" |
|
2080 |
||
2081 |
"Created: 28.7.1997 / 10:21:31 / cg" |
|
2082 |
"Modified: 28.7.1997 / 10:29:20 / cg" |
|
2083 |
! |
|
2084 |
||
2085 |
imageOpened |
|
2086 |
^ self imageMenuOpen |
|
2087 |
||
2088 |
"Created: 28.7.1997 / 10:31:46 / cg" |
|
220 | 2089 |
! |
2090 |
||
2091 |
imageSeparator |
|
2092 |
ImageSeparator isNil ifTrue:[ |
|
243 | 2093 |
"/ ImageSeparator := Image fromFile:('xpmBitmaps/document_images/tiny_file_exec.xpm'). |
2094 |
ImageSeparator := Image fromFile:('ui_menusep.xpm'). |
|
220 | 2095 |
]. |
243 | 2096 |
^ ImageSeparator |
2097 |
||
2098 |
" |
|
2099 |
ImageSeparator := nil |
|
2100 |
" |
|
2101 |
||
2102 |
"Modified: 28.7.1997 / 09:42:07 / cg" |
|
220 | 2103 |
! ! |
2104 |
||
199 | 2105 |
!MenuEditor::Painter class methodsFor:'defaults'! |
2106 |
||
2107 |
defaultMenuMessage |
|
2108 |
"This message is the default yo be sent to the menuHolder to get a menu |
|
2109 |
" |
|
2110 |
^ #menu |
|
2111 |
||
2112 |
||
2113 |
! ! |
|
2114 |
||
2115 |
!MenuEditor::Painter class methodsFor:'documentation'! |
|
2116 |
||
2117 |
documentation |
|
2118 |
" |
|
2119 |
menu selection list |
|
2120 |
||
2121 |
[see also:] |
|
2122 |
SelectionInTreeView |
|
213 | 2123 |
SelectionInTree |
2124 |
TreeItem |
|
199 | 2125 |
|
2126 |
[author:] |
|
2127 |
Claus Atzkern |
|
2128 |
" |
|
2129 |
||
2130 |
||
2131 |
! ! |
|
2132 |
||
2133 |
!MenuEditor::Painter methodsFor:'accessing'! |
|
2134 |
||
2135 |
root |
|
2136 |
^ listOfNodes first |
|
2137 |
! |
|
2138 |
||
2139 |
selectorName |
|
2140 |
^ (listOfNodes first contents label) asSymbol |
|
2141 |
! ! |
|
2142 |
||
2143 |
!MenuEditor::Painter methodsFor:'building'! |
|
2144 |
||
2145 |
buildFrom:aClass andSelector:aSelector |
|
2146 |
|spec cls menu node| |
|
2147 |
||
2148 |
(aClass notNil and:[aSelector notNil]) ifTrue:[ |
|
2149 |
aClass isBehavior ifFalse:[cls := Smalltalk at:aClass asSymbol] |
|
2150 |
ifTrue:[cls := aClass]. |
|
2151 |
||
2152 |
(cls respondsTo:aSelector) ifTrue:[ |
|
2153 |
spec := cls perform:aSelector |
|
2154 |
] |
|
2155 |
]. |
|
2156 |
spec isNil ifFalse:[ |
|
2157 |
menu := Menu new fromLiteralArrayEncoding:spec. |
|
213 | 2158 |
node := self nodeLabel:(aSelector asString). |
199 | 2159 |
self subMenu:menu parent:node. |
2160 |
] ifTrue:[ |
|
2161 |
aSelector notNil ifTrue:[cls := aSelector asString] |
|
2162 |
ifFalse:[cls := 'menu']. |
|
2163 |
||
213 | 2164 |
node := self nodeLabel:cls. |
199 | 2165 |
]. |
2166 |
||
2167 |
node hasChildren ifFalse:[ |
|
213 | 2168 |
node add:(self nodeLabel:'undefined') |
199 | 2169 |
]. |
213 | 2170 |
node expand. |
199 | 2171 |
model root:node. |
2172 |
||
2173 |
! |
|
2174 |
||
2175 |
buildFromMenu:aMenu |
|
2176 |
||
249 | 2177 |
|node| |
199 | 2178 |
|
213 | 2179 |
node := self nodeLabel:'menu'. |
199 | 2180 |
self subMenu:aMenu parent:node. |
2181 |
||
2182 |
node hasChildren ifFalse:[ |
|
213 | 2183 |
node add:(self nodeLabel:'undefined') |
199 | 2184 |
]. |
213 | 2185 |
node expand. |
199 | 2186 |
model root:node. |
2187 |
||
2188 |
! |
|
2189 |
||
213 | 2190 |
menuItem:anItem |
199 | 2191 |
|
249 | 2192 |
|node| |
199 | 2193 |
|
213 | 2194 |
node := self nodeLabel:(anItem label). |
199 | 2195 |
node contents buildFromMenuItem:anItem. |
2196 |
node name:(node contents label). |
|
2197 |
self subMenu:(anItem submenu) parent:node. |
|
2198 |
^ node. |
|
2199 |
||
2200 |
||
2201 |
! |
|
2202 |
||
2203 |
subMenu:aMenu parent:aParent |
|
213 | 2204 |
|idx grp| |
199 | 2205 |
|
2206 |
aMenu isNil ifFalse:[ |
|
2207 |
grp := aMenu groupSizes. |
|
213 | 2208 |
aMenu itemsDo:[:i| aParent add:(self menuItem:i)]. |
199 | 2209 |
|
2210 |
grp notNil ifTrue:[ |
|
213 | 2211 |
idx := 0. |
199 | 2212 |
|
2213 |
grp do:[:i| |
|
213 | 2214 |
idx := idx + i + 1. |
2215 |
aParent add:(self nodeLabel:nil) beforeIndex:idx. |
|
199 | 2216 |
] |
2217 |
] |
|
2218 |
] |
|
2219 |
! ! |
|
2220 |
||
2221 |
!MenuEditor::Painter methodsFor:'conversion'! |
|
2222 |
||
2223 |
asMenu |
|
2224 |
|menu root| |
|
2225 |
||
2226 |
root := self root. |
|
2227 |
||
2228 |
root hasChildren ifTrue:[ |
|
2229 |
menu := Menu new. |
|
2230 |
root children do:[:aChild| menu addItem:(self asMenuItem:aChild)]. |
|
2231 |
]. |
|
2232 |
^ menu |
|
2233 |
! |
|
2234 |
||
2235 |
asMenuItem:aNode |
|
2236 |
||
2237 |
|menu item| |
|
2238 |
||
2239 |
item := aNode contents asMenuItem. |
|
2240 |
||
2241 |
aNode hasChildren ifTrue:[ |
|
2242 |
menu := Menu new. |
|
2243 |
aNode children do:[:aChild| menu addItem:(self asMenuItem:aChild)]. |
|
2244 |
item submenu:menu |
|
2245 |
]. |
|
2246 |
^ item |
|
2247 |
||
2248 |
! ! |
|
2249 |
||
2250 |
!MenuEditor::Painter methodsFor:'drawing basics'! |
|
2251 |
||
2252 |
drawLabelIndex:anIndex atX:x y:yCenter |
|
2253 |
"draw text label assigned to a node at x y( center) |
|
2254 |
" |
|
258 | 2255 |
|y x2 type item| |
199 | 2256 |
|
2257 |
item := (listOfNodes at:anIndex) contents. |
|
218 | 2258 |
type := item separatorType. |
199 | 2259 |
|
218 | 2260 |
type isNil ifTrue:[ |
2261 |
super drawLabelIndex:anIndex atX:x y:yCenter |
|
2262 |
] ifFalse:[ |
|
2263 |
type == #blank ifFalse:[ |
|
258 | 2264 |
x2 := x + 80. |
2265 |
||
2266 |
self displayLineFromX:x y:yCenter toX:x2 y:yCenter. |
|
218 | 2267 |
|
2268 |
type == #double ifTrue:[ |
|
258 | 2269 |
y := yCenter + 2. |
2270 |
self displayLineFromX:x y:y toX:x2 y:y. |
|
218 | 2271 |
] |
2272 |
] |
|
2273 |
] |
|
258 | 2274 |
|
2275 |
"Modified: 28.7.1997 / 13:13:41 / cg" |
|
218 | 2276 |
! |
2277 |
||
2278 |
figureFor:aNode |
|
2279 |
"access figure for a node |
|
2280 |
" |
|
220 | 2281 |
|item| |
2282 |
||
2283 |
aNode hasChildren ifFalse:[ |
|
2284 |
item := aNode contents. |
|
2285 |
||
2286 |
item submenuChannel notNil ifTrue:[ |
|
2287 |
imageMenuLink isNil ifTrue:[ |
|
2288 |
imageMenuLink := (self class imageMenuLink) onDevice:device. |
|
2289 |
]. |
|
243 | 2290 |
^ imageMenuLink |
220 | 2291 |
]. |
2292 |
||
2293 |
item isSeparator ifTrue:[ |
|
2294 |
imageSeparator isNil ifTrue:[ |
|
2295 |
imageSeparator := (self class imageSeparator) onDevice:device. |
|
2296 |
]. |
|
243 | 2297 |
^ imageSeparator |
2298 |
]. |
|
2299 |
imageItem isNil ifTrue:[ |
|
2300 |
imageItem := (self class imageItem) onDevice:device. |
|
2301 |
]. |
|
2302 |
^ imageItem |
|
199 | 2303 |
]. |
243 | 2304 |
|
2305 |
aNode isExpandable ifTrue:[ |
|
2306 |
imageClosed isNil ifTrue:[ |
|
2307 |
imageClosed := (self class imageMenu) onDevice:device. |
|
2308 |
]. |
|
2309 |
^ imageClosed |
|
2310 |
]. |
|
2311 |
imageOpened isNil ifTrue:[ |
|
2312 |
imageOpened := (self class imageMenuOpen) onDevice:device. |
|
2313 |
]. |
|
2314 |
^ imageOpened |
|
2315 |
||
2316 |
"Modified: 28.7.1997 / 10:27:52 / cg" |
|
199 | 2317 |
! ! |
2318 |
||
2319 |
!MenuEditor::Painter methodsFor:'initialization'! |
|
2320 |
||
2321 |
initialize |
|
2322 |
super initialize. |
|
243 | 2323 |
imageOpened := nil. |
2324 |
imageClosed := nil. |
|
213 | 2325 |
self multipleSelectOk:true. |
2326 |
self model:(SelectionInTree new). |
|
243 | 2327 |
|
2328 |
"Modified: 28.7.1997 / 10:28:48 / cg" |
|
199 | 2329 |
! ! |
2330 |
||
2331 |
!MenuEditor::Painter methodsFor:'menus'! |
|
2332 |
||
2333 |
doCopy |
|
213 | 2334 |
self hasSelection ifTrue:[ |
2335 |
CopyBuffer := OrderedCollection new. |
|
2336 |
self selectionDo:[:i| CopyBuffer add:((listOfNodes at:i) copy)] |
|
2337 |
] |
|
199 | 2338 |
! |
2339 |
||
2340 |
doCreateItem |
|
213 | 2341 |
self addElement:(self nodeLabel:'undefined') |
199 | 2342 |
! |
2343 |
||
218 | 2344 |
doCreateLink |
2345 |
|node item| |
|
2346 |
||
2347 |
node := self nodeLabel:'undefined'. |
|
2348 |
item := node contents. |
|
2349 |
item submenuChannel:#menuDefaultLink. |
|
2350 |
self addElement:node |
|
2351 |
||
2352 |
||
2353 |
||
2354 |
! |
|
2355 |
||
199 | 2356 |
doCreateMenu |
2357 |
|node| |
|
2358 |
||
213 | 2359 |
node := self nodeLabel:'undefined'. |
2360 |
node add:(self nodeLabel:'undefined'). |
|
2361 |
self addElement:node |
|
199 | 2362 |
|
2363 |
! |
|
2364 |
||
2365 |
doCreateSep |
|
213 | 2366 |
self addElement:(self nodeLabel:nil) |
199 | 2367 |
|
2368 |
! |
|
2369 |
||
2370 |
doCut |
|
2371 |
self doCopy. |
|
213 | 2372 |
model removeSelection. |
199 | 2373 |
self selection:nil. |
2374 |
||
2375 |
||
2376 |
! |
|
2377 |
||
2378 |
doPaste |
|
213 | 2379 |
|
2380 |
(CopyBuffer notNil and:[self selectedNode notNil]) ifTrue:[ |
|
2381 |
self addElement:(CopyBuffer collect:[:el| el copy]) |
|
220 | 2382 |
]. |
199 | 2383 |
! |
2384 |
||
218 | 2385 |
doStepIn |
2386 |
|idx node cprt nprt| |
|
2387 |
||
2388 |
( (node := self selectedNode) isNil |
|
2389 |
or:[(cprt := node parent) isNil] |
|
2390 |
) ifTrue:[ |
|
2391 |
^ self |
|
2392 |
]. |
|
2393 |
||
2394 |
idx := cprt indexOfChild:node. |
|
2395 |
||
2396 |
idx == cprt children size ifTrue:[ |
|
2397 |
^ self |
|
2398 |
]. |
|
2399 |
nprt := cprt childAt:(idx + 1). |
|
2400 |
||
2401 |
(nprt notNil and:[nprt hasChildren]) ifFalse:[ |
|
2402 |
^ self |
|
2403 |
]. |
|
2404 |
||
2405 |
model removeDependent:self. |
|
2406 |
model removeSelection. |
|
2407 |
selection := nil. |
|
2408 |
model expand:nprt. |
|
2409 |
model addDependent:self. |
|
2410 |
||
2411 |
model add:node beforeIndex:1 below:nprt. |
|
2412 |
self selectNode:node. |
|
2413 |
! |
|
2414 |
||
2415 |
doStepOut |
|
2416 |
|node cprt nprt| |
|
2417 |
||
2418 |
( (node := self selectedNode) isNil |
|
2419 |
or:[(cprt := node parent) isNil |
|
2420 |
or:[(nprt := cprt parent) isNil]] |
|
2421 |
) ifFalse:[ |
|
2422 |
model removeDependent:self. |
|
2423 |
model removeSelection. |
|
2424 |
selection := nil. |
|
2425 |
model addDependent:self. |
|
2426 |
||
2427 |
model add:node afterIndex:(nprt indexOfChild:cprt) below:nprt. |
|
2428 |
self selectNode:node. |
|
2429 |
] |
|
2430 |
! |
|
2431 |
||
2432 |
doStepOver:anOffset |
|
2433 |
"move child 'anOffset' forward or backward in list of children |
|
2434 |
" |
|
2435 |
|idx node size parent| |
|
2436 |
||
2437 |
( (node := self selectedNode) notNil |
|
2438 |
and:[(parent := node parent) notNil |
|
2439 |
and:[(size := parent children size) > 1]] |
|
2440 |
) ifTrue:[ |
|
2441 |
idx := parent indexOfChild:node. |
|
2442 |
||
2443 |
model removeDependent:self. |
|
2444 |
model removeSelection. |
|
2445 |
selection := nil. |
|
2446 |
model addDependent:self. |
|
2447 |
||
2448 |
(idx := idx + anOffset) < 1 ifTrue:[ |
|
2449 |
idx := size |
|
2450 |
] ifFalse:[ |
|
2451 |
idx > size ifTrue:[idx := 1] |
|
2452 |
]. |
|
2453 |
model add:node beforeIndex:idx below:parent. |
|
2454 |
self selectNode:node. |
|
2455 |
] |
|
199 | 2456 |
! ! |
2457 |
||
2458 |
!MenuEditor::Painter methodsFor:'private'! |
|
2459 |
||
213 | 2460 |
addElement:something |
2461 |
"add something after selection |
|
2462 |
" |
|
249 | 2463 |
|node| |
199 | 2464 |
|
213 | 2465 |
(node := self selectedNode) notNil ifTrue:[ |
2466 |
node parent notNil ifTrue:[ |
|
2467 |
node isCollapsable ifTrue:[ |
|
2468 |
model add:something beforeIndex:1 below:node |
|
2469 |
] ifFalse:[ |
|
2470 |
model add:something after:node |
|
2471 |
] |
|
2472 |
] ifFalse:[ |
|
2473 |
model add:something beforeIndex:1 below:(self root) |
|
2474 |
] |
|
199 | 2475 |
] |
2476 |
! |
|
2477 |
||
213 | 2478 |
nodeLabel:aLabel |
2479 |
^ TreeItem name:aLabel contents:(MenuEditor::Item new label:aLabel). |
|
199 | 2480 |
! ! |
2481 |
||
2482 |
!MenuEditor::Painter methodsFor:'selection'! |
|
2483 |
||
2484 |
selectedNodeChanged |
|
213 | 2485 |
|node name index| |
199 | 2486 |
|
213 | 2487 |
(index := self selectedIndex) ~~ 0 ifTrue:[ |
2488 |
node := listOfNodes at:index. |
|
2489 |
name := node contents label. |
|
2490 |
list at:index put:name. |
|
2491 |
node name:name. |
|
2492 |
self redrawLine:index. |
|
2493 |
] |
|
199 | 2494 |
! ! |
2495 |
||
2496 |
!MenuEditor class methodsFor:'documentation'! |
|
2497 |
||
2498 |
version |
|
2499 |
^ '$Header$' |
|
2500 |
! ! |