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