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