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