author | ca |
Sun, 20 Jul 1997 12:24:32 +0200 | |
changeset 224 | c1d7bffe73f1 |
parent 222 | dd2688307d90 |
child 229 | cabe3bd6fd74 |
permissions | -rw-r--r-- |
156 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
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 |
||
60 | 14 |
ApplicationModel subclass:#UIPainter |
222 | 15 |
instanceVariableNames:'activeHelpTool layoutTool specTool treeView selectionPanel |
166 | 16 |
tabSelection specClass specSelector specSuperclass aspects' |
222 | 17 |
classVariableNames:'IconStepUp IconStepOut IconStepIn IconStepDown' |
60 | 18 |
poolDictionaries:'' |
19 |
category:'Interface-UIPainter' |
|
20 |
! |
|
21 |
||
222 | 22 |
SelectionInTreeView subclass:#TreeView |
23 |
instanceVariableNames:'lastDrawnMaster cvsEventsDisabled imageMasterParent |
|
24 |
imageMasterChild' |
|
25 |
classVariableNames:'ImageMasterParent ImageMasterChild' |
|
26 |
poolDictionaries:'' |
|
27 |
privateIn:UIPainter |
|
28 |
! |
|
29 |
||
60 | 30 |
!UIPainter class methodsFor:'documentation'! |
31 |
||
156 | 32 |
copyright |
33 |
" |
|
34 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
35 |
All Rights Reserved |
|
36 |
||
37 |
This software is furnished under a license and may be used |
|
38 |
only in accordance with the terms of that license and with the |
|
39 |
inclusion of the above copyright notice. This software may not |
|
40 |
be provided or otherwise made available to, or used by, any |
|
41 |
other person. No title to or ownership of the software is |
|
42 |
hereby transferred. |
|
43 |
" |
|
44 |
||
45 |
! |
|
46 |
||
60 | 47 |
documentation |
48 |
" |
|
127 | 49 |
GUI-Builder: |
50 |
this class allows the user to build its own applications providing a graphical |
|
51 |
user interface to buildin components and to define the behavior of the components |
|
52 |
during runtime. The resulting specifications can be installed as methods on |
|
53 |
classes, typically subclasses of an ApplicationModel. These specifications |
|
54 |
are used by the UIBuilder to generate the application window and its component |
|
55 |
structues when open the application. |
|
60 | 56 |
|
57 |
[start with:] |
|
58 |
UIPainter open |
|
127 | 59 |
|
156 | 60 |
[author:] |
183 | 61 |
Claus Gittinger |
156 | 62 |
Claus Atzkern |
63 |
||
127 | 64 |
[see also:] |
65 |
UIBuilder |
|
66 |
ApplicationModel |
|
67 |
UISpecification |
|
60 | 68 |
" |
109 | 69 |
|
70 |
! ! |
|
71 |
||
72 |
!UIPainter class methodsFor:'instance creation'! |
|
73 |
||
74 |
listHolder:aListHolder |
|
75 |
|application| |
|
76 |
||
77 |
application := self new. |
|
78 |
application objectList:aListHolder. |
|
79 |
^ application open |
|
80 |
! |
|
81 |
||
195
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
82 |
openOnClass:aClass andSelector:aSelector |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
83 |
^ self new openOnClass:aClass andSelector:aSelector |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
84 |
|
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
85 |
"Created: 1.7.1997 / 19:16:59 / cg" |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
86 |
! |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
87 |
|
109 | 88 |
painter:aBuilderView |
89 |
|application| |
|
90 |
||
91 |
application := self new. |
|
92 |
application painter:aBuilderView. |
|
93 |
^ application open |
|
60 | 94 |
! ! |
95 |
||
87 | 96 |
!UIPainter class methodsFor:'ST-80 queries'! |
97 |
||
98 |
preferenceFor:aSymbol |
|
99 |
^ false |
|
109 | 100 |
|
101 |
||
102 |
! ! |
|
103 |
||
193 | 104 |
!UIPainter class methodsFor:'help specs'! |
105 |
||
106 |
helpSpec |
|
107 |
"return a dictionary filled with helpKey -> helptext associations. |
|
108 |
These are used by the activeHelp tool. |
|
109 |
" |
|
110 |
^ super helpSpec addPairsFrom:#( |
|
111 |
||
112 |
#alignSelectionCenterVer |
|
113 |
'align selection vertical' |
|
114 |
||
115 |
#alignSelectionLeft |
|
116 |
'align selected components to the left edge of the |
|
117 |
dominant component ( underlined )' |
|
118 |
||
119 |
#alignSelectionRight |
|
120 |
'align selected components to the right edge of the |
|
121 |
dominant component ( underlined )' |
|
122 |
||
123 |
#alignSelectionLeftAndRight |
|
124 |
'align selected components to the right and left edge |
|
125 |
of the dominant component ( underlined )' |
|
126 |
||
127 |
#alignSelectionTop |
|
128 |
'align selected components to the top edge of the |
|
129 |
dominant component ( underlined )' |
|
130 |
||
131 |
#alignSelectionBottom |
|
132 |
'align selected components to the bottom edge of the |
|
133 |
dominant component ( underlined )' |
|
134 |
||
135 |
#alignSelectionTopAndBottom |
|
136 |
'align selected components to the top and bottom edge |
|
137 |
of the dominant component ( underlined )' |
|
138 |
||
139 |
#alignSelectionCenterVer |
|
140 |
'align selected components horizontal to the center of |
|
141 |
the dominant component ( underlined )' |
|
142 |
||
143 |
#alignSelectionCenterHor |
|
144 |
'align selected components vertical to the center of |
|
145 |
the dominant component ( underlined )' |
|
146 |
||
194 | 147 |
#spreadSelectionVer |
148 |
'vertical spacing between selected components is made the same' |
|
149 |
||
150 |
#spreadSelectionHor |
|
151 |
'horizontal spacing between selected components is made the same' |
|
152 |
||
153 |
#centerSelectionHor |
|
154 |
'center components horizontal in contained view' |
|
155 |
||
156 |
#centerSelectionVer |
|
157 |
'center vertical horizontal in contained view' |
|
158 |
||
159 |
#setToDefaultExtent |
|
160 |
'set selected components to their default extent' |
|
161 |
||
162 |
#setToDefaultWidth |
|
163 |
'set selected components to their default width' |
|
164 |
||
165 |
#setToDefaultHeight |
|
166 |
'set selected components to their default height' |
|
167 |
||
168 |
#copyExtent |
|
169 |
'copy extent of the selected component' |
|
170 |
||
171 |
#pasteExtent |
|
172 |
'change extent of all selected components to the |
|
173 |
last copied extent' |
|
174 |
||
175 |
#pasteWidth |
|
176 |
'change width of all selected components to the |
|
177 |
last copied extent width' |
|
178 |
||
179 |
#pasteHeight |
|
180 |
'change height of all selected components to the |
|
181 |
last copied extent height' |
|
182 |
||
183 |
#copyLayout |
|
184 |
'copy layout of the selected component' |
|
185 |
||
186 |
#pasteLayout |
|
187 |
'change layout of all selected components to the |
|
188 |
last copied layout' |
|
189 |
||
190 |
#pasteBuffer |
|
191 |
'paste components at current mouse position' |
|
192 |
||
193 |
#pasteWithLayout |
|
194 |
'paste components without changing their layouts' |
|
195 |
||
193 | 196 |
) |
197 |
||
198 |
||
199 |
||
200 |
||
201 |
! ! |
|
202 |
||
118 | 203 |
!UIPainter class methodsFor:'icons'! |
204 |
||
205 |
iconAlignB |
|
206 |
^ Image fromFile:'b_alignB.xbm' |
|
207 |
||
208 |
! |
|
209 |
||
210 |
iconAlignCenterH |
|
211 |
^ Image fromFile:'b_alignCH.xbm' |
|
212 |
||
213 |
! |
|
214 |
||
215 |
iconAlignCenterV |
|
216 |
^ Image fromFile:'b_alignCV.xbm' |
|
217 |
||
218 |
! |
|
219 |
||
220 |
iconAlignL |
|
221 |
^ Image fromFile:'b_alignL.xbm' |
|
222 |
! |
|
223 |
||
224 |
iconAlignLR |
|
225 |
^ Image fromFile:'b_alignLR.xbm' |
|
226 |
||
227 |
! |
|
228 |
||
229 |
iconAlignR |
|
230 |
^ Image fromFile:'b_alignR.xbm' |
|
231 |
||
232 |
! |
|
233 |
||
234 |
iconAlignT |
|
235 |
^ Image fromFile:'b_alignT.xbm' |
|
236 |
||
237 |
! |
|
238 |
||
239 |
iconAlignTB |
|
240 |
^ Image fromFile:'b_alignTB.xbm' |
|
241 |
||
222 | 242 |
! |
243 |
||
244 |
iconStepDown |
|
245 |
IconStepDown isNil ifTrue:[ |
|
246 |
IconStepDown := self iconStepUp flipHorizontal |
|
247 |
]. |
|
248 |
^ IconStepDown |
|
249 |
||
250 |
! |
|
251 |
||
252 |
iconStepIn |
|
253 |
IconStepIn isNil ifTrue:[ |
|
254 |
IconStepIn := ((Image fromFile:'stepIn.xpm') rotated:90) flipHorizontal |
|
255 |
]. |
|
256 |
^ IconStepIn |
|
257 |
||
258 |
! |
|
259 |
||
260 |
iconStepOut |
|
261 |
IconStepOut isNil ifTrue:[ |
|
262 |
IconStepOut := ((Image fromFile:'stepOut.xpm') rotated:90) flipHorizontal |
|
263 |
]. |
|
264 |
^ IconStepOut |
|
265 |
! |
|
266 |
||
267 |
iconStepUp |
|
268 |
IconStepUp isNil ifTrue:[ |
|
269 |
IconStepUp := ((Image fromFile:'stepOver.xpm') rotated:90) flipHorizontal flipVertical |
|
270 |
]. |
|
271 |
^ IconStepUp |
|
272 |
||
118 | 273 |
! ! |
274 |
||
60 | 275 |
!UIPainter class methodsFor:'interface specs'! |
276 |
||
222 | 277 |
nameAndSelectorSpec |
278 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
279 |
||
280 |
"do not manually edit this - the painter/builder may not be able to |
|
281 |
handle the specification if its corrupted." |
|
282 |
||
283 |
" |
|
284 |
UIPainter new openOnClass:UIPainter andSelector:#nameAndSelectorSpec |
|
285 |
UIPainter new openInterface:#nameAndSelectorSpec |
|
286 |
" |
|
287 |
||
288 |
<resource: #canvas> |
|
289 |
||
290 |
^ |
|
291 |
||
292 |
#(#FullSpec |
|
293 |
#'window:' |
|
294 |
#(#WindowSpec |
|
295 |
#'name:' 'uIPainterView' |
|
296 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
297 |
#'label:' 'Painter' |
|
298 |
#'bounds:' #(#Rectangle 0 0 391 170) |
|
299 |
) |
|
300 |
#'component:' |
|
301 |
#(#SpecCollection |
|
302 |
#'collection:' |
|
303 |
#( |
|
304 |
#(#LabelSpec |
|
305 |
#'name:' 'classLabel' |
|
306 |
#'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5) |
|
307 |
#'label:' 'class:' |
|
308 |
#'adjust:' #right |
|
309 |
#'resizeForLabel:' true |
|
310 |
) |
|
311 |
#(#LabelSpec |
|
312 |
#'name:' 'superClassLabel' |
|
313 |
#'layout:' #(#AlignmentOrigin 45 0.11 77 0 1 0.5) |
|
314 |
#'label:' 'superclass:' |
|
315 |
#'adjust:' #right |
|
316 |
#'resizeForLabel:' true |
|
317 |
) |
|
318 |
#(#LabelSpec |
|
319 |
#'name:' 'selectorLabel' |
|
320 |
#'layout:' #(#AlignmentOrigin 45 0.11 105 0 1 0.5) |
|
321 |
#'label:' 'selector:' |
|
322 |
#'adjust:' #right |
|
323 |
#'resizeForLabel:' true |
|
324 |
) |
|
325 |
#(#InputFieldSpec |
|
326 |
#'name:' 'methodNameField' |
|
327 |
#'layout:' #(#LayoutFrame 47 0.11 95 0 -5 1.0 117 0) |
|
328 |
#'tabable:' true |
|
329 |
#'model:' #methodNameChannel |
|
330 |
) |
|
331 |
#(#LabelSpec |
|
332 |
#'name:' 'boxLabel' |
|
333 |
#'layout:' #(#Point 5 10) |
|
334 |
#'label:' 'class & selector for code:' |
|
335 |
#'adjust:' #left |
|
336 |
#'resizeForLabel:' true |
|
337 |
) |
|
338 |
#(#InputFieldSpec |
|
339 |
#'name:' 'classNameField' |
|
340 |
#'layout:' #(#LayoutFrame 47 0.11 39 0 -5 1.0 61 0) |
|
341 |
#'tabable:' true |
|
342 |
#'model:' #classNameChannel |
|
343 |
) |
|
344 |
#(#ComboBoxSpec |
|
345 |
#'name:' 'comboBox1' |
|
346 |
#'layout:' #(#LayoutFrame 47 0.11 67 0 -5 1.0 89 0) |
|
347 |
#'tabable:' true |
|
348 |
#'model:' #superclassNameChannel |
|
349 |
#'comboList:' #superclassNameDefaults |
|
350 |
) |
|
351 |
#(#HorizontalPanelViewSpec |
|
352 |
#'name:' 'commitPanel' |
|
353 |
#'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0) |
|
354 |
#'component:' |
|
355 |
#(#SpecCollection |
|
356 |
#'collection:' |
|
357 |
#( |
|
358 |
#(#ActionButtonSpec |
|
359 |
#'name:' 'button1' |
|
360 |
#'label:' 'cancel' |
|
361 |
#'tabable:' true |
|
362 |
#'model:' #cancel |
|
363 |
#'extent:' #(#Point 191 24) |
|
364 |
) |
|
365 |
#(#ActionButtonSpec |
|
366 |
#'name:' 'button2' |
|
367 |
#'label:' 'ok' |
|
368 |
#'tabable:' true |
|
369 |
#'isDefault:' true |
|
370 |
#'model:' #accept |
|
371 |
#'extent:' #(#Point 191 24) |
|
372 |
) |
|
373 |
) |
|
374 |
) |
|
375 |
#'horizontalLayout:' #fitSpace |
|
376 |
#'verticalLayout:' #fit |
|
377 |
#'horizontalSpace:' 3 |
|
378 |
#'verticalSpace:' 3 |
|
379 |
) |
|
380 |
) |
|
381 |
) |
|
382 |
) |
|
383 |
||
384 |
"Modified: 24.6.1997 / 18:50:14 / cg" |
|
385 |
! |
|
386 |
||
387 |
windowSpec |
|
388 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
389 |
||
390 |
"do not manually edit this - the painter/builder may not be able to |
|
391 |
handle the specification if its corrupted." |
|
392 |
||
393 |
" |
|
394 |
UIPainter new openOnClass:UIPainter andSelector:#windowSpec |
|
395 |
UIPainter new openInterface:#windowSpec |
|
396 |
" |
|
397 |
"UIPainter open" |
|
398 |
||
399 |
<resource: #canvas> |
|
400 |
||
401 |
^ |
|
402 |
||
403 |
#(#FullSpec |
|
404 |
#'window:' |
|
405 |
#(#WindowSpec |
|
406 |
#'name:' 'uIPainterView' |
|
407 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
408 |
#'label:' 'Tree-View' |
|
409 |
#'bounds:' #(#Rectangle 0 0 561 450) |
|
410 |
) |
|
411 |
#'component:' |
|
412 |
#(#SpecCollection |
|
413 |
#'collection:' |
|
414 |
#( |
|
415 |
#(#MenuPanelSpec |
|
416 |
#'name:' 'menuPullDown' |
|
417 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 25 0) |
|
418 |
#'tabable:' true |
|
419 |
#'menu:' #menuPullDown |
|
420 |
) |
|
421 |
#(#NoteBookViewSpec |
|
422 |
#'name:' 'noteBook' |
|
423 |
#'layout:' #(#LayoutFrame 0 0.4 59 0.0 0 1.0 -55 1.0) |
|
424 |
#'enableChannel:' #enableChannel |
|
425 |
#'tabable:' true |
|
426 |
#'menu:' #tabList |
|
427 |
#'style:' |
|
428 |
#(#FontDescription |
|
429 |
#helvetica #medium |
|
430 |
#roman #'10' |
|
431 |
) |
|
432 |
#'model:' #tabModel |
|
433 |
#'tabWidget:' #Window |
|
434 |
#'canvas:' #noteBookView |
|
435 |
) |
|
436 |
#(#HorizontalPanelViewSpec |
|
437 |
#'name:' 'modifyPanel' |
|
438 |
#'layout:' #(#LayoutFrame 0 0.4 -55 1.0 0 1.0 -25 1.0) |
|
439 |
#'component:' |
|
440 |
#(#SpecCollection |
|
441 |
#'collection:' |
|
442 |
#( |
|
443 |
#(#ActionButtonSpec |
|
444 |
#'name:' 'cancelButton' |
|
445 |
#'label:' 'cancel' |
|
446 |
#'tabable:' true |
|
447 |
#'model:' #cancel |
|
448 |
#'enableChannel:' #modifiedChannel |
|
449 |
#'extent:' #(#Point 164 24) |
|
450 |
) |
|
451 |
#(#ActionButtonSpec |
|
452 |
#'name:' 'acceptButton' |
|
453 |
#'label:' 'ok' |
|
454 |
#'tabable:' true |
|
455 |
#'model:' #accept |
|
456 |
#'enableChannel:' #modifiedChannel |
|
457 |
#'extent:' #(#Point 164 24) |
|
458 |
) |
|
459 |
) |
|
460 |
) |
|
461 |
#'level:' 0 |
|
462 |
#'horizontalLayout:' #fitSpace |
|
463 |
#'verticalLayout:' #fitSpace |
|
464 |
#'horizontalSpace:' 3 |
|
465 |
#'verticalSpace:' 3 |
|
466 |
) |
|
467 |
#(#LabelSpec |
|
468 |
#'name:' 'helpInfo' |
|
469 |
#'layout:' #(#LayoutFrame 2 0.0 -25 1.0 -2 1.0 -2 1.0) |
|
470 |
#'level:' -1 |
|
471 |
#'adjust:' #left |
|
472 |
) |
|
473 |
#(#ToggleSpec |
|
474 |
#'name:' 'galleryLabel' |
|
475 |
#'layout:' #(#LayoutFrame -162 1.0 1 0 -82 1.0 23 0) |
|
476 |
#'label:' 'Gallery' |
|
477 |
#'model:' #galleryShown |
|
478 |
#'isTriggerOnDown:' true |
|
479 |
#'showLamp:' true |
|
480 |
#'lampColor:' #(#Color 100.0 100.0 0.0) |
|
481 |
) |
|
482 |
#(#ToggleSpec |
|
483 |
#'name:' 'painterLabel' |
|
484 |
#'layout:' #(#LayoutFrame -81 1.0 1 0 -1 1.0 23 0) |
|
485 |
#'label:' 'Painter' |
|
486 |
#'model:' #painterShown |
|
487 |
#'isTriggerOnDown:' true |
|
488 |
#'showLamp:' true |
|
489 |
#'lampColor:' #(#Color 100.0 100.0 0.0) |
|
490 |
) |
|
491 |
#(#ArbitraryComponentSpec |
|
492 |
#'name:' 'treeView' |
|
493 |
#'layout:' #(#LayoutFrame 0 0.0 59 0 0 0.4 -25 1.0) |
|
494 |
#'menu:' #menuCanvas |
|
495 |
#'hasHorizontalScrollBar:' true |
|
496 |
#'hasVerticalScrollBar:' true |
|
497 |
#'miniScrollerHorizontal:' true |
|
498 |
#'miniScrollerVertical:' true |
|
499 |
#'component:' #treeView |
|
500 |
#'hasBorder:' false |
|
501 |
) |
|
502 |
#(#HorizontalPanelViewSpec |
|
503 |
#'name:' 'menuContainer' |
|
504 |
#'layout:' #(#LayoutFrame 0 0.0 26 0 0 1.0 58 0) |
|
505 |
#'component:' |
|
506 |
#(#SpecCollection |
|
507 |
#'collection:' |
|
508 |
#( |
|
509 |
#(#MenuPanelSpec |
|
510 |
#'name:' 'menuMove' |
|
511 |
#'menu:' #menuMove |
|
512 |
#'showSeparatingLines:' true |
|
513 |
#'extent:' #(#Point 123 32) |
|
514 |
) |
|
515 |
#(#MenuPanelSpec |
|
516 |
#'name:' 'menuAlignment' |
|
517 |
#'tabable:' true |
|
518 |
#'menu:' #menuAlignment |
|
519 |
#'showSeparatingLines:' true |
|
520 |
#'extent:' #(#Point 233 32) |
|
521 |
) |
|
522 |
#(#HorizontalPanelViewSpec |
|
523 |
#'name:' 'panelViewButtons' |
|
524 |
#'component:' |
|
525 |
#(#SpecCollection |
|
526 |
#'collection:' |
|
527 |
#( |
|
528 |
#(#ArrowButtonSpec |
|
529 |
#'name:' 'moveLeft' |
|
530 |
#'tabable:' true |
|
531 |
#'model:' #moveSelectionLeft |
|
532 |
#'isTriggerOnDown:' true |
|
533 |
#'enableChannel:' #hasValidSelection |
|
534 |
#'direction:' #left |
|
535 |
#'extent:' #(#Point 25 24) |
|
536 |
) |
|
537 |
#(#ArrowButtonSpec |
|
538 |
#'name:' 'moveRight' |
|
539 |
#'model:' #moveSelectionRight |
|
540 |
#'isTriggerOnDown:' true |
|
541 |
#'enableChannel:' #hasValidSelection |
|
542 |
#'direction:' #right |
|
543 |
#'extent:' #(#Point 26 24) |
|
544 |
) |
|
545 |
#(#ArrowButtonSpec |
|
546 |
#'name:' 'moveDown' |
|
547 |
#'model:' #moveSelectionDown |
|
548 |
#'isTriggerOnDown:' true |
|
549 |
#'enableChannel:' #hasValidSelection |
|
550 |
#'direction:' #down |
|
551 |
#'extent:' #(#Point 26 24) |
|
552 |
) |
|
553 |
#(#ArrowButtonSpec |
|
554 |
#'name:' 'moveUp' |
|
555 |
#'model:' #moveSelectionUp |
|
556 |
#'isTriggerOnDown:' true |
|
557 |
#'enableChannel:' #hasValidSelection |
|
558 |
#'direction:' #up |
|
559 |
#'extent:' #(#Point 22 24) |
|
560 |
) |
|
561 |
) |
|
562 |
) |
|
563 |
#'level:' 1 |
|
564 |
#'horizontalLayout:' #spreadSpace |
|
565 |
#'verticalLayout:' #fitSpace |
|
566 |
#'horizontalSpace:' 4 |
|
567 |
#'verticalSpace:' 4 |
|
568 |
#'extent:' #(#Point 125 32) |
|
569 |
) |
|
570 |
) |
|
571 |
) |
|
572 |
#'horizontalLayout:' #spread |
|
573 |
#'verticalLayout:' #fit |
|
574 |
#'horizontalSpace:' 3 |
|
575 |
#'verticalSpace:' 3 |
|
576 |
) |
|
577 |
) |
|
578 |
) |
|
579 |
) |
|
580 |
! ! |
|
581 |
||
582 |
!UIPainter class methodsFor:'menu specs'! |
|
583 |
||
118 | 584 |
menuAlignment |
217 | 585 |
"this window spec was automatically generated by the ST/X MenuEditor" |
586 |
||
587 |
"do not manually edit this - the builder may not be able to |
|
588 |
handle the specification if its corrupted." |
|
589 |
||
590 |
" |
|
591 |
MenuEditor new openOnClass:UIPainter andSelector:#menuAlignment |
|
592 |
(Menu new fromLiteralArrayEncoding:(UIPainter menuAlignment)) startUp |
|
593 |
" |
|
594 |
||
595 |
<resource: #menu> |
|
596 |
||
597 |
^ |
|
598 |
||
599 |
#(#Menu |
|
600 |
||
601 |
#( |
|
602 |
#(#MenuItem |
|
603 |
#'label:' 'align left' |
|
604 |
#'value:' #alignSelectionLeft |
|
222 | 605 |
#'enabled:' #hasValidSelection |
217 | 606 |
#'activeHelpKey:' #alignSelectionLeft |
607 |
#'labelImage:' |
|
608 |
#(#ResourceRetriever |
|
609 |
nil #iconAlignL |
|
610 |
) |
|
611 |
) |
|
612 |
#(#MenuItem |
|
613 |
#'label:' 'align right' |
|
614 |
#'value:' #alignSelectionRight |
|
222 | 615 |
#'enabled:' #hasValidSelection |
217 | 616 |
#'activeHelpKey:' #alignSelectionRight |
617 |
#'labelImage:' |
|
618 |
#(#ResourceRetriever |
|
619 |
nil #iconAlignR |
|
620 |
) |
|
621 |
) |
|
622 |
#(#MenuItem |
|
623 |
#'label:' 'align left & right' |
|
624 |
#'value:' #alignSelectionLeftAndRight |
|
222 | 625 |
#'enabled:' #hasValidSelection |
217 | 626 |
#'activeHelpKey:' #alignSelectionLeftAndRight |
627 |
#'labelImage:' |
|
628 |
#(#ResourceRetriever |
|
629 |
nil #iconAlignLR |
|
118 | 630 |
) |
217 | 631 |
) |
632 |
#(#MenuItem |
|
633 |
#'label:' 'align top' |
|
634 |
#'value:' #alignSelectionTop |
|
222 | 635 |
#'enabled:' #hasValidSelection |
217 | 636 |
#'activeHelpKey:' #alignSelectionTop |
637 |
#'labelImage:' |
|
638 |
#(#ResourceRetriever |
|
639 |
nil #iconAlignT |
|
640 |
) |
|
641 |
) |
|
642 |
#(#MenuItem |
|
643 |
#'label:' 'align bottom' |
|
644 |
#'value:' #alignSelectionBottom |
|
222 | 645 |
#'enabled:' #hasValidSelection |
217 | 646 |
#'activeHelpKey:' #alignSelectionBottom |
647 |
#'labelImage:' |
|
648 |
#(#ResourceRetriever |
|
649 |
nil #iconAlignB |
|
650 |
) |
|
651 |
) |
|
652 |
#(#MenuItem |
|
653 |
#'label:' 'align top & bottom' |
|
654 |
#'value:' #alignSelectionTopAndBottom |
|
222 | 655 |
#'enabled:' #hasValidSelection |
217 | 656 |
#'activeHelpKey:' #alignSelectionTopAndBottom |
657 |
#'labelImage:' |
|
658 |
#(#ResourceRetriever |
|
659 |
nil #iconAlignTB |
|
660 |
) |
|
661 |
) |
|
662 |
#(#MenuItem |
|
663 |
#'label:' 'align centered horizontal' |
|
664 |
#'value:' #alignSelectionCenterHor |
|
222 | 665 |
#'enabled:' #hasValidSelection |
217 | 666 |
#'activeHelpKey:' #alignSelectionCenterHor |
667 |
#'labelImage:' |
|
668 |
#(#ResourceRetriever |
|
669 |
nil #iconAlignCenterH |
|
670 |
) |
|
671 |
) |
|
672 |
#(#MenuItem |
|
673 |
#'label:' 'align centered vertical' |
|
674 |
#'value:' #alignSelectionCenterVer |
|
222 | 675 |
#'enabled:' #hasValidSelection |
217 | 676 |
#'activeHelpKey:' #alignSelectionCenterVer |
677 |
#'labelImage:' |
|
678 |
#(#ResourceRetriever |
|
679 |
nil #iconAlignCenterV |
|
680 |
) |
|
681 |
) |
|
682 |
) |
|
683 |
#( 3 3 ) |
|
684 |
nil |
|
685 |
) |
|
118 | 686 |
! |
687 |
||
222 | 688 |
menuCanvas |
689 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
690 |
||
691 |
"do not manually edit this - the builder may not be able to |
|
692 |
handle the specification if its corrupted." |
|
693 |
||
694 |
" |
|
695 |
MenuEditor new openOnClass:UIPainter andSelector:#menuCanvas |
|
696 |
(Menu new fromLiteralArrayEncoding:(UIPainter menuCanvas)) startUp |
|
697 |
" |
|
698 |
||
699 |
<resource: #menu> |
|
700 |
||
701 |
^ |
|
702 |
||
703 |
#(#Menu |
|
704 |
||
705 |
#( |
|
706 |
#(#MenuItem |
|
707 |
#'label:' 'copy' |
|
708 |
#'value:' #copySelection |
|
709 |
#'shortcutKeyCharacter:' #Copy |
|
710 |
) |
|
711 |
#(#MenuItem |
|
712 |
#'label:' 'cut' |
|
713 |
#'value:' #deleteSelection |
|
714 |
#'shortcutKeyCharacter:' #Cut |
|
715 |
) |
|
716 |
#(#MenuItem |
|
717 |
#'label:' 'paste' |
|
718 |
#'nameKey:' #paste |
|
719 |
#'value:' #paste |
|
720 |
#'submenu:' |
|
721 |
#(#Menu |
|
722 |
||
723 |
#( |
|
724 |
#(#MenuItem |
|
725 |
#'label:' 'paste' |
|
726 |
#'value:' #pasteBuffer |
|
727 |
#'activeHelpKey:' #pasteBuffer |
|
728 |
#'shortcutKeyCharacter:' #Paste |
|
729 |
) |
|
730 |
#(#MenuItem |
|
731 |
#'label:' 'keep layout' |
|
732 |
#'value:' #pasteWithLayout |
|
733 |
#'activeHelpKey:' #pasteWithLayout |
|
734 |
) |
|
735 |
) nil |
|
736 |
nil |
|
737 |
) |
|
738 |
) |
|
739 |
#(#MenuItem |
|
740 |
#'label:' '-' |
|
741 |
) |
|
742 |
#(#MenuItem |
|
743 |
#'label:' 'undo' |
|
744 |
#'nameKey:' #undo |
|
745 |
#'value:' #undoLast |
|
746 |
) |
|
747 |
#(#MenuItem |
|
748 |
#'label:' '-' |
|
749 |
) |
|
750 |
#(#MenuItem |
|
751 |
#'label:' 'dimension' |
|
752 |
#'value:' #dimension |
|
753 |
#'submenu:' |
|
754 |
#(#Menu |
|
755 |
||
756 |
#( |
|
757 |
#(#MenuItem |
|
758 |
#'label:' 'default extent' |
|
759 |
#'value:' #setToDefaultExtent |
|
760 |
#'activeHelpKey:' #setToDefaultExtent |
|
761 |
) |
|
762 |
#(#MenuItem |
|
763 |
#'label:' 'default width' |
|
764 |
#'value:' #setToDefaultWidth |
|
765 |
#'activeHelpKey:' #setToDefaultWidth |
|
766 |
) |
|
767 |
#(#MenuItem |
|
768 |
#'label:' 'default height' |
|
769 |
#'value:' #setToDefaultHeight |
|
770 |
#'activeHelpKey:' #setToDefaultHeight |
|
771 |
) |
|
772 |
#(#MenuItem |
|
773 |
#'label:' 'copy extent' |
|
774 |
#'value:' #copyExtent |
|
775 |
#'activeHelpKey:' #copyExtent |
|
776 |
) |
|
777 |
#(#MenuItem |
|
778 |
#'label:' 'paste extent' |
|
779 |
#'value:' #pasteExtent |
|
780 |
#'activeHelpKey:' #pasteExtent |
|
781 |
) |
|
782 |
#(#MenuItem |
|
783 |
#'label:' 'paste width' |
|
784 |
#'value:' #pasteWidth |
|
785 |
#'activeHelpKey:' #pasteWidth |
|
786 |
) |
|
787 |
#(#MenuItem |
|
788 |
#'label:' 'paste height' |
|
789 |
#'value:' #pasteHeight |
|
790 |
#'activeHelpKey:' #pasteHeight |
|
791 |
) |
|
792 |
#(#MenuItem |
|
793 |
#'label:' 'copy layout' |
|
794 |
#'value:' #copyLayout |
|
795 |
#'activeHelpKey:' #copyLayout |
|
796 |
) |
|
797 |
#(#MenuItem |
|
798 |
#'label:' 'paste layout' |
|
799 |
#'value:' #pasteLayout |
|
800 |
#'activeHelpKey:' #pasteLayout |
|
801 |
) |
|
802 |
) |
|
803 |
#(3 1 3) |
|
804 |
nil |
|
805 |
) |
|
806 |
) |
|
807 |
#(#MenuItem |
|
808 |
#'label:' 'align' |
|
809 |
#'value:' #align |
|
810 |
#'submenu:' |
|
811 |
#(#Menu |
|
812 |
||
813 |
#( |
|
814 |
#(#MenuItem |
|
815 |
#'label:' 'align left' |
|
816 |
#'value:' #alignSelectionLeft |
|
817 |
#'activeHelpKey:' #alignSelectionLeft |
|
818 |
#'labelImage:' |
|
819 |
#(#ResourceRetriever |
|
820 |
#UIPainter #iconAlignL |
|
821 |
'align left' |
|
822 |
) |
|
823 |
) |
|
824 |
#(#MenuItem |
|
825 |
#'label:' 'align right' |
|
826 |
#'value:' #alignSelectionRight |
|
827 |
#'activeHelpKey:' #alignSelectionRight |
|
828 |
#'labelImage:' |
|
829 |
#(#ResourceRetriever |
|
830 |
#UIPainter #iconAlignR |
|
831 |
'align right' |
|
832 |
) |
|
833 |
) |
|
834 |
#(#MenuItem |
|
835 |
#'label:' 'align left & right' |
|
836 |
#'value:' #alignSelectionLeftAndRight |
|
837 |
#'activeHelpKey:' #alignSelectionLeftAndRight |
|
838 |
#'labelImage:' |
|
839 |
#(#ResourceRetriever |
|
840 |
#UIPainter #iconAlignLR |
|
841 |
'align left & right' |
|
842 |
) |
|
843 |
) |
|
844 |
#(#MenuItem |
|
845 |
#'label:' 'align top' |
|
846 |
#'value:' #alignSelectionTop |
|
847 |
#'activeHelpKey:' #alignSelectionTop |
|
848 |
#'labelImage:' |
|
849 |
#(#ResourceRetriever |
|
850 |
#UIPainter #iconAlignT |
|
851 |
'align top' |
|
852 |
) |
|
853 |
) |
|
854 |
#(#MenuItem |
|
855 |
#'label:' 'align bottom' |
|
856 |
#'value:' #alignSelectionBottom |
|
857 |
#'activeHelpKey:' #alignSelectionBottom |
|
858 |
#'labelImage:' |
|
859 |
#(#ResourceRetriever |
|
860 |
#UIPainter #iconAlignB |
|
861 |
'align bottom' |
|
862 |
) |
|
863 |
) |
|
864 |
#(#MenuItem |
|
865 |
#'label:' 'align top & bottom' |
|
866 |
#'value:' #alignSelectionTopAndBottom |
|
867 |
#'activeHelpKey:' #alignSelectionTopAndBottom |
|
868 |
#'labelImage:' |
|
869 |
#(#ResourceRetriever |
|
870 |
#UIPainter #iconAlignTB |
|
871 |
'align top & bottom' |
|
872 |
) |
|
873 |
) |
|
874 |
#(#MenuItem |
|
875 |
#'label:' 'align centered horizontal' |
|
876 |
#'value:' #alignSelectionCenterHor |
|
877 |
#'activeHelpKey:' #alignSelectionCenterHor |
|
878 |
#'labelImage:' |
|
879 |
#(#ResourceRetriever |
|
880 |
#UIPainter #iconAlignCenterH |
|
881 |
'align centered horizontal' |
|
882 |
) |
|
883 |
) |
|
884 |
#(#MenuItem |
|
885 |
#'label:' 'align centered vertical' |
|
886 |
#'value:' #alignSelectionCenterVer |
|
887 |
#'activeHelpKey:' #alignSelectionCenterVer |
|
888 |
#'labelImage:' |
|
889 |
#(#ResourceRetriever |
|
890 |
#UIPainter #iconAlignCenterV |
|
891 |
'align centered vertical' |
|
892 |
) |
|
893 |
) |
|
894 |
#(#MenuItem |
|
895 |
#'label:' 'spread horizontal' |
|
896 |
#'value:' #spreadSelectionHor |
|
897 |
#'activeHelpKey:' #spreadSelectionHor |
|
898 |
) |
|
899 |
#(#MenuItem |
|
900 |
#'label:' 'spread vertical' |
|
901 |
#'value:' #spreadSelectionVer |
|
902 |
#'activeHelpKey:' #spreadSelectionVer |
|
903 |
) |
|
904 |
#(#MenuItem |
|
905 |
#'label:' 'center horizontal in frame' |
|
906 |
#'value:' #centerSelectionHor |
|
907 |
#'activeHelpKey:' #centerSelectionHor |
|
908 |
) |
|
909 |
#(#MenuItem |
|
910 |
#'label:' 'center vertical in frame' |
|
911 |
#'value:' #centerSelectionVer |
|
912 |
#'activeHelpKey:' #centerSelectionVer |
|
913 |
) |
|
914 |
) |
|
915 |
#(8 2) |
|
916 |
nil |
|
917 |
) |
|
918 |
) |
|
919 |
) nil |
|
920 |
nil |
|
921 |
) |
|
922 |
||
923 |
||
924 |
! |
|
925 |
||
926 |
menuMove |
|
927 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
928 |
||
929 |
"do not manually edit this - the builder may not be able to |
|
930 |
handle the specification if its corrupted." |
|
931 |
||
932 |
" |
|
933 |
MenuEditor new openOnClass:UIPainter andSelector:#menuMove |
|
934 |
(Menu new fromLiteralArrayEncoding:(UIPainter menuMove)) startUp |
|
935 |
" |
|
936 |
||
937 |
<resource: #menu> |
|
938 |
||
939 |
^ |
|
940 |
||
941 |
#(#Menu |
|
942 |
||
943 |
#( |
|
944 |
#(#MenuItem |
|
945 |
#'label:' 'stepUp' |
|
946 |
#'value:' #doStepUp |
|
947 |
#'enabled:' #hasSingleSelection |
|
948 |
#'labelImage:' |
|
949 |
#(#ResourceRetriever |
|
950 |
#UIPainter #iconStepUp |
|
951 |
) |
|
952 |
) |
|
953 |
#(#MenuItem |
|
954 |
#'label:' 'stepDown' |
|
955 |
#'value:' #doStepDown |
|
956 |
#'enabled:' #hasSingleSelection |
|
957 |
#'labelImage:' |
|
958 |
#(#ResourceRetriever |
|
959 |
#UIPainter #iconStepDown |
|
960 |
) |
|
961 |
) |
|
962 |
#(#MenuItem |
|
963 |
#'label:' '' |
|
964 |
) |
|
965 |
#(#MenuItem |
|
966 |
#'label:' 'stepIn' |
|
967 |
#'value:' #doStepIn |
|
968 |
#'enabled:' #canStepIn |
|
969 |
#'labelImage:' |
|
970 |
#(#ResourceRetriever |
|
971 |
#UIPainter #iconStepIn |
|
972 |
) |
|
973 |
) |
|
974 |
#(#MenuItem |
|
975 |
#'label:' 'stepOut' |
|
976 |
#'value:' #doStepOut |
|
977 |
#'enabled:' #canStepOut |
|
978 |
#'labelImage:' |
|
979 |
#(#ResourceRetriever |
|
980 |
#UIPainter #iconStepOut |
|
981 |
) |
|
982 |
) |
|
983 |
) nil |
|
984 |
nil |
|
985 |
) |
|
986 |
! |
|
987 |
||
118 | 988 |
menuPullDown |
217 | 989 |
"this window spec was automatically generated by the ST/X MenuEditor" |
990 |
||
991 |
"do not manually edit this - the builder may not be able to |
|
992 |
handle the specification if its corrupted." |
|
993 |
||
994 |
" |
|
995 |
MenuEditor new openOnClass:UIPainter andSelector:#menuPullDown |
|
996 |
(Menu new fromLiteralArrayEncoding:(UIPainter menuPullDown)) startUp |
|
997 |
" |
|
998 |
||
999 |
<resource: #menu> |
|
1000 |
||
1001 |
^ |
|
1002 |
||
1003 |
#(#Menu |
|
1004 |
||
1005 |
#( |
|
1006 |
#(#MenuItem |
|
109 | 1007 |
#'label:' 'file' |
114 | 1008 |
#'value:' #file |
217 | 1009 |
#'enabled:' #enableChannel |
1010 |
#'submenu:' |
|
1011 |
#(#Menu |
|
1012 |
||
1013 |
#( |
|
1014 |
#(#MenuItem |
|
1015 |
#'label:' 'new' |
|
1016 |
#'value:' #doNew |
|
1017 |
) |
|
1018 |
#(#MenuItem |
|
1019 |
#'label:' 'from class ...' |
|
1020 |
#'value:' #doFromClass |
|
1021 |
) |
|
1022 |
#(#MenuItem |
|
1023 |
#'label:' 'pick a view ' |
|
1024 |
#'value:' #doPickAView |
|
1025 |
) |
|
1026 |
#(#MenuItem |
|
1027 |
#'label:' '-' |
|
1028 |
) |
|
1029 |
#(#MenuItem |
|
1030 |
#'label:' 'quit' |
|
1031 |
#'value:' #closeRequest |
|
1032 |
) |
|
1033 |
) nil |
|
1034 |
nil |
|
1035 |
) |
|
1036 |
) |
|
1037 |
#(#MenuItem |
|
109 | 1038 |
#'label:' 'misc' |
114 | 1039 |
#'value:' #misc |
217 | 1040 |
#'enabled:' #enableChannel |
1041 |
#'submenu:' |
|
1042 |
#(#Menu |
|
1043 |
||
1044 |
#( |
|
1045 |
#(#MenuItem |
|
1046 |
#'label:' 'grid' |
|
1047 |
#'value:' #grid |
|
1048 |
#'submenu:' |
|
1049 |
#(#Menu |
|
1050 |
||
1051 |
#( |
|
1052 |
#(#MenuItem |
|
1053 |
#'label:' 'show' |
|
1054 |
#'indication:' #'gridShown:' |
|
1055 |
) |
|
1056 |
#(#MenuItem |
|
1057 |
#'label:' 'align' |
|
1058 |
#'indication:' #'gridAlign:' |
|
109 | 1059 |
) |
217 | 1060 |
) nil |
1061 |
nil |
|
1062 |
) |
|
1063 |
) |
|
1064 |
#(#MenuItem |
|
1065 |
#'label:' 'undo' |
|
1066 |
#'value:' #undo |
|
1067 |
#'submenu:' |
|
1068 |
#(#Menu |
|
1069 |
||
1070 |
#( |
|
1071 |
#(#MenuItem |
|
1072 |
#'label:' 'last' |
|
1073 |
#'value:' #undoLast |
|
1074 |
) |
|
1075 |
#(#MenuItem |
|
1076 |
#'label:' 'menu' |
|
1077 |
#'value:' #openUndoMenu |
|
1078 |
) |
|
1079 |
#(#MenuItem |
|
1080 |
#'label:' '-' |
|
1081 |
) |
|
1082 |
#(#MenuItem |
|
1083 |
#'label:' 'delete' |
|
1084 |
#'value:' #removeUndoHistory |
|
1085 |
) |
|
1086 |
) nil |
|
1087 |
nil |
|
1088 |
) |
|
1089 |
) |
|
1090 |
) nil |
|
1091 |
nil |
|
1092 |
) |
|
1093 |
) |
|
1094 |
#(#MenuItem |
|
109 | 1095 |
#'label:' 'code' |
114 | 1096 |
#'value:' #code |
217 | 1097 |
#'enabled:' #enableChannel |
1098 |
#'submenu:' |
|
1099 |
#(#Menu |
|
1100 |
||
1101 |
#( |
|
1102 |
#(#MenuItem |
|
1103 |
#'label:' 'class && method ...' |
|
1104 |
#'value:' #defineClassAndSelector |
|
1105 |
) |
|
1106 |
#(#MenuItem |
|
1107 |
#'label:' '=' |
|
1108 |
) |
|
1109 |
#(#MenuItem |
|
1110 |
#'label:' 'install window spec.' |
|
1111 |
#'value:' #doInstallSpec |
|
1112 |
#'enabled:' #hasSpecClassAndSelector |
|
1113 |
) |
|
1114 |
#(#MenuItem |
|
1115 |
#'label:' 'install help spec.' |
|
1116 |
#'value:' #doInstallHelp |
|
1117 |
#'enabled:' #hasSpecClass |
|
1118 |
) |
|
1119 |
#(#MenuItem |
|
1120 |
#'label:' '-' |
|
1121 |
) |
|
1122 |
#(#MenuItem |
|
1123 |
#'label:' 'install aspects' |
|
1124 |
#'value:' #doInstallAspects |
|
1125 |
#'enabled:' #hasSpecClass |
|
1126 |
) |
|
1127 |
#(#MenuItem |
|
1128 |
#'label:' '=' |
|
1129 |
) |
|
1130 |
#(#MenuItem |
|
1131 |
#'label:' 'show window spec.' |
|
1132 |
#'value:' #doWindowSpec |
|
1133 |
) |
|
1134 |
#(#MenuItem |
|
1135 |
#'label:' '=' |
|
1136 |
) |
|
1137 |
#(#MenuItem |
|
1138 |
#'label:' 'browse application' |
|
1139 |
#'value:' #doBrowseAppClass |
|
1140 |
#'enabled:' #hasSpecClass |
|
1141 |
) |
|
1142 |
#(#MenuItem |
|
1143 |
#'label:' 'start application' |
|
1144 |
#'value:' #doStartApplication |
|
1145 |
#'enabled:' #hasSpecClass |
|
1146 |
) |
|
1147 |
) nil |
|
1148 |
nil |
|
1149 |
) |
|
1150 |
) |
|
1151 |
#(#MenuItem |
|
109 | 1152 |
#'label:' 'test' |
118 | 1153 |
#'nameKey:' #test |
114 | 1154 |
#'value:' #test |
217 | 1155 |
#'submenu:' |
1156 |
#(#Menu |
|
1157 |
||
1158 |
#( |
|
1159 |
#(#MenuItem |
|
1160 |
#'label:' 'test mode' |
|
1161 |
#'indication:' #'testMode:' |
|
1162 |
) |
|
1163 |
) nil |
|
1164 |
nil |
|
1165 |
) |
|
1166 |
) |
|
1167 |
) nil |
|
1168 |
nil |
|
109 | 1169 |
) |
222 | 1170 |
! ! |
1171 |
||
1172 |
!UIPainter methodsFor:'accessing menu'! |
|
1173 |
||
1174 |
menuCanvas |
|
1175 |
^ [ treeView canvas showMiddleButtonMenu ] |
|
109 | 1176 |
! |
1177 |
||
222 | 1178 |
menuMove |
1179 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
1180 |
||
1181 |
^ self class menuMove |
|
1182 |
||
1183 |
||
1184 |
! |
|
1185 |
||
1186 |
menuPullDown |
|
1187 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
1188 |
||
1189 |
^ self class menuPullDown |
|
1190 |
||
1191 |
||
60 | 1192 |
! ! |
1193 |
||
109 | 1194 |
!UIPainter methodsFor:'actions'! |
60 | 1195 |
|
109 | 1196 |
accept |
1197 |
|layout| |
|
60 | 1198 |
|
166 | 1199 |
self isLayoutToolSelected ifTrue:[ |
144 | 1200 |
(layout := layoutTool layout) notNil ifTrue:[ |
1201 |
layoutTool layoutType == #Extent ifTrue:[ |
|
1202 |
self painter setExtent:layout |
|
1203 |
] ifFalse:[ |
|
149 | 1204 |
self painter setLayout:layout |
109 | 1205 |
] |
144 | 1206 |
] |
1207 |
] ifFalse:[ |
|
166 | 1208 |
self isHelpToolSelected ifTrue:[ |
149 | 1209 |
activeHelpTool accept |
1210 |
]. |
|
171 | 1211 |
self painter updateFromSpec:(specTool specification). |
144 | 1212 |
]. |
166 | 1213 |
self modifiedChannel value:false. |
109 | 1214 |
|
1215 |
! |
|
1216 |
||
1217 |
cancel |
|
1218 |
"cancel all changes and read back attributes from current view |
|
1219 |
" |
|
166 | 1220 |
self modifiedChannel value ifTrue:[ |
171 | 1221 |
specTool specification:(self painter specForSelection). |
166 | 1222 |
layoutTool layoutView:(layoutTool layoutView). |
1223 |
self modifiedChannel value:false. |
|
1224 |
] |
|
137 | 1225 |
! |
1226 |
||
217 | 1227 |
openEditMenu |
1228 |
|cls aspect editor| |
|
1229 |
||
1230 |
specClass isNil ifTrue:[ |
|
1231 |
^ self information:'no class yet'. |
|
1232 |
]. |
|
1233 |
(cls := specClass) isBehavior ifFalse:[ |
|
1234 |
cls := Smalltalk at:specClass asSymbol. |
|
1235 |
cls isNil ifTrue:[ |
|
1236 |
^ self information:'no class yet' |
|
1237 |
] |
|
1238 |
]. |
|
1239 |
||
1240 |
cls notNil ifTrue:[ |
|
1241 |
(aspect := specTool specification menu) notNil ifTrue:[ |
|
1242 |
aspect := aspect asSymbol |
|
1243 |
]. |
|
1244 |
editor := MenuEditor new. |
|
1245 |
editor masterApplication:self. |
|
1246 |
editor activeHelpTool:(self activeHelpTool). |
|
1247 |
editor openModalOnClass:cls andSelector:aspect |
|
1248 |
] |
|
1249 |
||
1250 |
||
60 | 1251 |
! ! |
1252 |
||
149 | 1253 |
!UIPainter methodsFor:'active help'! |
1254 |
||
197 | 1255 |
activeHelpTool |
1256 |
"setup help tool |
|
171 | 1257 |
" |
149 | 1258 |
activeHelpTool isNil ifTrue:[ |
152 | 1259 |
activeHelpTool := UIHelpTool new. |
197 | 1260 |
activeHelpTool helpSpecFrom:specClass. |
217 | 1261 |
activeHelpTool masterApplication:self. |
149 | 1262 |
]. |
1263 |
^ activeHelpTool |
|
1264 |
! |
|
1265 |
||
1266 |
showHelp:aHelpText for:view |
|
1267 |
"hook to allow an application to display active help |
|
1268 |
texts in its own info area. |
|
1269 |
This method may be redefined in a concrete application. |
|
1270 |
If it returns false, the ActiveHelp manager will popup a |
|
1271 |
bubble with the help text." |
|
1272 |
||
1273 |
|l| |
|
1274 |
||
1275 |
(l := self builder componentAt:#helpInfo) notNil ifTrue:[ |
|
152 | 1276 |
aHelpText replaceAll:(Character cr) by:(Character space). |
149 | 1277 |
l label:aHelpText. |
152 | 1278 |
^ true. |
149 | 1279 |
]. |
1280 |
^ false |
|
1281 |
||
1282 |
||
1283 |
! ! |
|
1284 |
||
60 | 1285 |
!UIPainter methodsFor:'aspects'! |
1286 |
||
222 | 1287 |
canStepIn |
1288 |
|holder| |
|
1289 |
||
1290 |
(holder := builder bindingAt:#canStepIn) isNil ifTrue:[ |
|
1291 |
builder aspectAt:#canStepIn put:(holder := false asValue). |
|
1292 |
]. |
|
1293 |
^ holder |
|
1294 |
||
1295 |
! |
|
1296 |
||
1297 |
canStepOut |
|
1298 |
|holder| |
|
1299 |
||
1300 |
(holder := builder bindingAt:#canStepOut) isNil ifTrue:[ |
|
1301 |
builder aspectAt:#canStepOut put:(holder := false asValue). |
|
1302 |
]. |
|
1303 |
^ holder |
|
1304 |
||
1305 |
! |
|
1306 |
||
118 | 1307 |
enableChannel |
1308 |
"true if modifications are allowed otherwise running test |
|
1309 |
" |
|
1310 |
^ self painter enableChannel |
|
109 | 1311 |
! |
1312 |
||
173 | 1313 |
galleryShown |
1314 |
|holder| |
|
1315 |
||
1316 |
(holder := builder bindingAt:#galleryShown) isNil ifTrue:[ |
|
1317 |
builder aspectAt:#galleryShown put:(holder := true asValue). |
|
1318 |
holder addDependent:self |
|
1319 |
]. |
|
1320 |
^ holder |
|
1321 |
||
1322 |
! |
|
1323 |
||
222 | 1324 |
hasSingleSelection |
1325 |
|holder| |
|
1326 |
||
1327 |
(holder := builder bindingAt:#hasSingleSelection) isNil ifTrue:[ |
|
1328 |
builder aspectAt:#hasSingleSelection put:(holder := false asValue). |
|
1329 |
]. |
|
1330 |
^ holder |
|
1331 |
||
1332 |
! |
|
1333 |
||
1334 |
hasValidSelection |
|
1335 |
|holder| |
|
1336 |
||
1337 |
(holder := builder bindingAt:#hasValidSelection) isNil ifTrue:[ |
|
1338 |
builder aspectAt:#hasValidSelection put:(holder := false asValue). |
|
1339 |
]. |
|
1340 |
^ holder |
|
1341 |
||
1342 |
! |
|
1343 |
||
109 | 1344 |
modifiedChannel |
1345 |
||
1346 |
|holder| |
|
1347 |
||
1348 |
(holder := builder bindingAt:#modifiedChannel) isNil ifTrue:[ |
|
1349 |
builder aspectAt:#modifiedChannel put:(holder := false asValue). |
|
1350 |
]. |
|
1351 |
^ holder |
|
1352 |
! |
|
1353 |
||
1354 |
noteBookView |
|
1355 |
"automatically generated by UIPainter ..." |
|
1356 |
||
166 | 1357 |
|noteBook channel n1 n2| |
109 | 1358 |
|
1359 |
(noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
|
166 | 1360 |
noteBook := View new. |
1361 |
layoutTool := UILayoutTool new. |
|
1362 |
specTool := UISpecificationTool new. |
|
144 | 1363 |
channel := self modifiedChannel. |
166 | 1364 |
|
152 | 1365 |
layoutTool masterApplication:self. |
166 | 1366 |
specTool masterApplication:self. |
1367 |
||
1368 |
n1 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
|
1369 |
n2 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
|
1370 |
||
1371 |
n1 client:layoutTool. |
|
1372 |
specTool builder:(n2 client:specTool). |
|
1373 |
||
1374 |
layoutTool masterApplication:self. |
|
1375 |
specTool masterApplication:self. |
|
109 | 1376 |
layoutTool modifiedHolder:channel. |
166 | 1377 |
specTool modifiedHolder:channel. |
109 | 1378 |
builder aspectAt:#noteBookView put:noteBook. |
1379 |
]. |
|
1380 |
^ noteBook |
|
1381 |
! |
|
1382 |
||
1383 |
objectList |
|
222 | 1384 |
^ nil |
1385 |
" |
|
1386 |
|holder| |
|
1387 |
||
1388 |
(holder := builder bindingAt:#objectList) isNil ifTrue:[ |
|
1389 |
builder aspectAt:#objectList put:(holder := SelectionInList). |
|
1390 |
]. |
|
1391 |
^ holder |
|
1392 |
||
1393 |
" |
|
109 | 1394 |
! |
1395 |
||
1396 |
objectListMenu |
|
1397 |
"returns a block which returns the menu |
|
114 | 1398 |
!!hack!! |
109 | 1399 |
" |
121 | 1400 |
^ [ self painter showMiddleButtonMenu ]. |
109 | 1401 |
|
1402 |
||
1403 |
||
1404 |
! |
|
1405 |
||
173 | 1406 |
painterShown |
1407 |
|holder| |
|
1408 |
||
1409 |
(holder := builder bindingAt:#painterShown) isNil ifTrue:[ |
|
1410 |
builder aspectAt:#painterShown put:(holder := true asValue). |
|
1411 |
holder addDependent:self |
|
1412 |
]. |
|
1413 |
^ holder |
|
1414 |
||
1415 |
! |
|
1416 |
||
109 | 1417 |
tabList |
1418 |
"automatically generated by UIPainter ..." |
|
1419 |
||
1420 |
|holder| |
|
1421 |
||
1422 |
(holder := builder bindingAt:#tabList) isNil ifTrue:[ |
|
1423 |
builder aspectAt:#tabList put:(holder := ValueHolder new). |
|
144 | 1424 |
holder value:#( 'Properties' ). |
109 | 1425 |
]. |
1426 |
^ holder |
|
1427 |
! |
|
1428 |
||
1429 |
tabModel |
|
1430 |
"automatically generated by UIPainter ..." |
|
1431 |
||
1432 |
|holder| |
|
1433 |
||
1434 |
(holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
|
1435 |
holder := AspectAdaptor new subject:self; forAspect:#tabSelection. |
|
1436 |
builder aspectAt:#tabModel put:holder. |
|
1437 |
]. |
|
1438 |
^ holder |
|
222 | 1439 |
! |
1440 |
||
1441 |
treeView |
|
1442 |
^ treeView |
|
60 | 1443 |
! ! |
1444 |
||
109 | 1445 |
!UIPainter methodsFor:'binding access'! |
1446 |
||
1447 |
aspectFor:aKey |
|
222 | 1448 |
"aspect for a key |
109 | 1449 |
" |
222 | 1450 |
^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ] |
109 | 1451 |
! ! |
1452 |
||
1453 |
!UIPainter methodsFor:'change & update'! |
|
1454 |
||
222 | 1455 |
layoutChanged |
1456 |
self modifiedChannel value ifFalse:[ |
|
1457 |
layoutTool update. |
|
1458 |
self modifiedChannel value:false |
|
1459 |
] |
|
1460 |
! |
|
1461 |
||
1462 |
treeViewChanged |
|
1463 |
"property or selection in the treeView changed |
|
1464 |
" |
|
1465 |
|oldSelection view slices list spec props size nameOfSpec| |
|
1466 |
||
1467 |
props := treeView propertySelected. |
|
1468 |
oldSelection := tabSelection. |
|
1469 |
tabSelection := nil. |
|
1470 |
||
1471 |
self hasValidSelection value:(treeView hasValidSelection). |
|
1472 |
self canStepIn value:(treeView canStepIn). |
|
1473 |
self canStepOut value:(treeView canStepOut). |
|
1474 |
||
1475 |
props isNil ifFalse:[ |
|
1476 |
self hasSingleSelection value:true. |
|
1477 |
view := props view. |
|
1478 |
spec := props spec copy. |
|
1479 |
||
1480 |
layoutTool layoutView == view ifFalse:[ |
|
1481 |
slices := spec class slices. |
|
1482 |
size := slices size + 1. |
|
1483 |
list := Array new:size. |
|
1484 |
slices keysAndValuesDo:[:i :s|list at:i put:(s first asString)]. |
|
1485 |
list at:size put:(layoutTool class label). |
|
1486 |
(self tabList) value:list. |
|
1487 |
] ifTrue:[ |
|
1488 |
list := self tabList value |
|
1489 |
]. |
|
1490 |
(list findFirst:[:n| n = oldSelection ]) ~~ 0 ifTrue:[ |
|
1491 |
tabSelection := oldSelection |
|
109 | 1492 |
] ifFalse:[ |
222 | 1493 |
tabSelection := list first |
166 | 1494 |
]. |
222 | 1495 |
nameOfSpec := spec class name. |
1496 |
] ifTrue:[ |
|
1497 |
self hasSingleSelection value:false. |
|
1498 |
nameOfSpec := '' |
|
1499 |
]. |
|
1500 |
||
1501 |
self showHelp:nameOfSpec for:nil. |
|
1502 |
||
1503 |
layoutTool layoutView:view. |
|
1504 |
specTool specification:spec. |
|
1505 |
||
1506 |
tabSelection notNil ifTrue:[ |
|
1507 |
self isLayoutToolSelected ifTrue:[ |
|
1508 |
(self noteBookView subViews at:1) raise |
|
1509 |
] ifFalse:[ |
|
1510 |
specTool selection:tabSelection. |
|
1511 |
(self noteBookView subViews at:2) raise |
|
1512 |
] |
|
1513 |
]. |
|
1514 |
||
1515 |
(builder componentAt:#noteBook) setSelection:tabSelection. |
|
1516 |
self modifiedChannel value:false. |
|
1517 |
! |
|
1518 |
||
1519 |
update:something with:aParameter from:someObject |
|
1520 |
||
1521 |
someObject == treeView model ifTrue:[ |
|
1522 |
something == #selection ifTrue:[self treeViewChanged]. |
|
1523 |
^ self |
|
173 | 1524 |
]. |
1525 |
||
1526 |
self galleryShown == someObject ifTrue:[ |
|
1527 |
(self galleryShown value) ifTrue:[ |
|
1528 |
self raiseUIView:(selectionPanel window) |
|
1529 |
] ifFalse:[ |
|
1530 |
self hideUIView:(selectionPanel window) |
|
1531 |
]. |
|
1532 |
^ self |
|
1533 |
]. |
|
1534 |
||
1535 |
self painterShown == someObject ifTrue:[ |
|
1536 |
(self painterShown value) ifTrue:[ |
|
1537 |
self raiseUIView:(self painter topView) |
|
1538 |
] ifFalse:[ |
|
1539 |
self hideUIView:(self painter topView) |
|
1540 |
]. |
|
1541 |
^ self |
|
1542 |
]. |
|
1543 |
||
109 | 1544 |
! ! |
1545 |
||
1546 |
!UIPainter methodsFor:'event handling'! |
|
1547 |
||
1548 |
doesNotUnderstand:aMessage |
|
1549 |
|painter| |
|
1550 |
||
1551 |
painter := self painter. |
|
1552 |
||
1553 |
(painter respondsTo:(aMessage selector)) ifTrue:[ |
|
1554 |
^ aMessage sendTo:painter |
|
1555 |
]. |
|
149 | 1556 |
super doesNotUnderstand:aMessage |
109 | 1557 |
|
60 | 1558 |
! ! |
1559 |
||
109 | 1560 |
!UIPainter methodsFor:'private'! |
1561 |
||
173 | 1562 |
hideUIView:aView |
1563 |
aView beIndependent. |
|
1564 |
aView unmap. |
|
1565 |
! |
|
1566 |
||
109 | 1567 |
painter |
222 | 1568 |
^ treeView canvas |
173 | 1569 |
! |
1570 |
||
1571 |
raiseUIView:aView |
|
1572 |
aView map. |
|
1573 |
aView bePartner. |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1574 |
! |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1575 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1576 |
setClass:cls selector:selector |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1577 |
|clsName superClassName| |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1578 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1579 |
clsName := cls name. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1580 |
superClassName := cls superclass name. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1581 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1582 |
(self aspectFor:#classNameChannel) value:clsName. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1583 |
(self aspectFor:#methodNameChannel) value:(selector ? ''). |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1584 |
(self aspectFor:#superclassNameChannel) value:superClassName. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1585 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1586 |
self painter |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1587 |
className:clsName |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1588 |
superclassName:superClassName |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1589 |
selector:(selector ? ''). |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1590 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1591 |
specClass := clsName. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1592 |
specSelector := (selector ? ''). |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1593 |
specSuperclass := superClassName. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1594 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1595 |
"Modified: 24.6.1997 / 19:07:01 / cg" |
109 | 1596 |
! ! |
1597 |
||
166 | 1598 |
!UIPainter methodsFor:'queries'! |
1599 |
||
217 | 1600 |
hasSpecClass |
1601 |
||
1602 |
specClass notNil ifTrue:[ |
|
1603 |
^ (specClass isBehavior or:[(Smalltalk at:specClass asSymbol) notNil]) |
|
1604 |
]. |
|
1605 |
^ false |
|
1606 |
! |
|
1607 |
||
1608 |
hasSpecClassAndSelector |
|
1609 |
||
1610 |
specSelector size > 1 ifTrue:[ |
|
1611 |
^ self hasSpecClass |
|
1612 |
]. |
|
1613 |
^ false |
|
1614 |
! |
|
1615 |
||
166 | 1616 |
isHelpToolSelected |
1617 |
^ tabSelection = 'Help' |
|
1618 |
! |
|
1619 |
||
1620 |
isLayoutToolSelected |
|
1621 |
^ tabSelection = layoutTool class label |
|
217 | 1622 |
! |
1623 |
||
1624 |
isPainterEnabled |
|
1625 |
^ self painter enabled |
|
166 | 1626 |
! ! |
1627 |
||
109 | 1628 |
!UIPainter methodsFor:'selection'! |
1629 |
||
1630 |
tabSelection |
|
1631 |
^ tabSelection |
|
1632 |
! |
|
1633 |
||
1634 |
tabSelection:something |
|
166 | 1635 |
|raiseViewIdx| |
121 | 1636 |
|
166 | 1637 |
something notNil ifTrue:[ |
1638 |
raiseViewIdx := 1. |
|
1639 |
tabSelection := something. |
|
109 | 1640 |
|
166 | 1641 |
self isLayoutToolSelected ifFalse:[ |
1642 |
specTool selection:tabSelection. |
|
1643 |
raiseViewIdx := 2 |
|
121 | 1644 |
]. |
166 | 1645 |
(self noteBookView subViews at:raiseViewIdx) raise. |
1646 |
self cancel. |
|
109 | 1647 |
] |
60 | 1648 |
! ! |
1649 |
||
109 | 1650 |
!UIPainter methodsFor:'startup / release'! |
1651 |
||
1652 |
closeRequest |
|
1653 |
"close all windows open by builder |
|
1654 |
" |
|
133 | 1655 |
|anyUnsavedChanges| |
1656 |
||
222 | 1657 |
self painter isModified ifTrue:[ |
133 | 1658 |
(self confirm:'quit without saving ?') ifFalse:[ |
1659 |
^ self |
|
1660 |
] |
|
1661 |
]. |
|
1662 |
||
222 | 1663 |
treeView model removeDependent:self. |
1664 |
self painter release. |
|
60 | 1665 |
|
109 | 1666 |
selectionPanel notNil ifTrue:[ |
183 | 1667 |
selectionPanel masterApplication:nil. |
109 | 1668 |
selectionPanel closeRequest |
1669 |
]. |
|
149 | 1670 |
selectionPanel := nil. |
1671 |
layoutTool := nil. |
|
222 | 1672 |
treeView := nil. |
149 | 1673 |
activeHelpTool := nil. |
1674 |
||
109 | 1675 |
super closeRequest. |
1676 |
||
1677 |
! |
|
1678 |
||
1679 |
closeRequestFor:aTopView |
|
1680 |
"handle a close request for a specific view |
|
1681 |
" |
|
173 | 1682 |
|topView| |
60 | 1683 |
|
109 | 1684 |
topView := self window. |
60 | 1685 |
|
109 | 1686 |
topView == aTopView ifTrue:[ |
1687 |
super closeRequestFor:aTopView |
|
1688 |
] ifFalse:[ |
|
173 | 1689 |
aTopView = selectionPanel window ifTrue:[ |
1690 |
self galleryShown value:false |
|
1691 |
] ifFalse:[ |
|
1692 |
self painterShown value:false |
|
1693 |
]. |
|
133 | 1694 |
topView raise. |
109 | 1695 |
]. |
60 | 1696 |
! |
1697 |
||
109 | 1698 |
openInterface |
1699 |
"open interfaces |
|
1700 |
" |
|
136 | 1701 |
|painterView painter cls topView| |
60 | 1702 |
|
1703 |
aspects := IdentityDictionary new. |
|
1704 |
||
1705 |
aspects at:#classNameChannel put:( |
|
1706 |
(specClass notNil ifTrue:[specClass] |
|
1707 |
ifFalse:['NewApplication']) asValue |
|
1708 |
). |
|
1709 |
specSuperclass isNil ifTrue:[ |
|
1710 |
specClass notNil ifTrue:[ |
|
1711 |
(cls := Smalltalk at:specClass asSymbol) notNil ifTrue:[ |
|
1712 |
specSuperclass := cls superclass name. |
|
1713 |
] |
|
1714 |
] |
|
1715 |
]. |
|
1716 |
aspects at:#superclassNameChannel put:( |
|
1717 |
(specSuperclass notNil ifTrue:[specSuperclass] |
|
1718 |
ifFalse:['ApplicationModel']) asValue |
|
1719 |
). |
|
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1720 |
aspects at:#superclassNameDefaults put:#('ApplicationModel' 'SimpleDialog') asValue. |
60 | 1721 |
aspects at:#methodNameChannel put:( |
161 | 1722 |
(specSelector notNil ifTrue:[specSelector asValue] |
60 | 1723 |
ifFalse:[#windowSpec]) asValue |
1724 |
). |
|
136 | 1725 |
|
222 | 1726 |
treeView := TreeView new. |
136 | 1727 |
painterView := StandardSystemView new. |
1728 |
painterView label:'unnamed canvas'. |
|
1729 |
painterView extent:300@300. |
|
1730 |
||
1731 |
painter := UIPainterView in:painterView. |
|
109 | 1732 |
painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. |
136 | 1733 |
|
222 | 1734 |
treeView := treeView canvas:painter. |
1735 |
painter treeView:treeView. |
|
1736 |
treeView model addDependent:self. |
|
136 | 1737 |
|
109 | 1738 |
super openInterface. |
60 | 1739 |
|
136 | 1740 |
topView := self window. |
1741 |
topView bePartner. |
|
1742 |
topView label:'Interface Builder'. |
|
1743 |
topView icon:(Image fromFile:'bitmaps/Builder.xbm' resolution:100). |
|
1744 |
||
1745 |
painterView openInGroup:(topView windowGroup). |
|
1746 |
painterView bePartner. |
|
1747 |
painterView application:self. |
|
1748 |
painterView open. |
|
1749 |
||
1750 |
painterView application:self. |
|
183 | 1751 |
selectionPanel := UISelectionPanel new. |
136 | 1752 |
selectionPanel allButOpenInterface:#windowSpec. |
1753 |
selectionPanel window openInGroup:(topView windowGroup). |
|
1754 |
selectionPanel window bePartner. |
|
1755 |
selectionPanel openWindow. |
|
183 | 1756 |
selectionPanel masterApplication:self. |
60 | 1757 |
! |
1758 |
||
1759 |
openNewWindowCanvas |
|
109 | 1760 |
"open new |
1761 |
" |
|
60 | 1762 |
self open. |
1763 |
||
1764 |
||
1765 |
! |
|
1766 |
||
109 | 1767 |
openOnClass:aClass |
1768 |
"open up an interface builder |
|
1769 |
" |
|
1770 |
self openOnClass:aClass andSelector:#windowSpec |
|
1771 |
! |
|
1772 |
||
60 | 1773 |
openOnClass:aClass andSelector:aSelector |
1774 |
"open up an interface builder, fetching a spec from someClass |
|
109 | 1775 |
via some selector |
1776 |
" |
|
1777 |
|painter| |
|
60 | 1778 |
|
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1779 |
aClass isNil ifTrue:[ |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1780 |
self warn:'nil class given (class was probably renamed ?)'. |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1781 |
]. |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1782 |
|
109 | 1783 |
self openInterface. |
60 | 1784 |
|
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1785 |
aClass notNil ifTrue:[ |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1786 |
painter := self painter. |
60 | 1787 |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1788 |
self setClass:aClass selector:aSelector. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1789 |
"/ specClass := aClass name. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1790 |
"/ specSuperclass := aClass superclass name. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1791 |
"/ specSelector := aSelector. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1792 |
"/ |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1793 |
"/ (aspects at:#classNameChannel) value:specClass. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1794 |
"/ (aspects at:#superclassNameChannel) value:specSuperclass. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1795 |
"/ (aspects at:#methodNameChannel) value:specSelector asSymbol. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1796 |
"/ |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1797 |
"/ painter |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1798 |
"/ className:aClass name |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1799 |
"/ superclassName:aClass superclass name |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1800 |
"/ selector:aSelector. |
60 | 1801 |
|
195
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
1802 |
(aClass respondsTo:aSelector) ifTrue:[ |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
1803 |
painter setupFromSpec:(aClass perform:aSelector). |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
1804 |
] |
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1805 |
] |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1806 |
|
195
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
1807 |
"Modified: 1.7.1997 / 19:18:54 / cg" |
60 | 1808 |
! ! |
1809 |
||
109 | 1810 |
!UIPainter methodsFor:'user interaction - dialog'! |
60 | 1811 |
|
1812 |
checkClassAndSelector |
|
1813 |
"check for class & superclass" |
|
1814 |
||
1815 |
|superclass cls| |
|
1816 |
||
1817 |
specClass isNil ifTrue:[^ false]. |
|
1818 |
||
1819 |
specClass isBehavior ifFalse:[ |
|
1820 |
cls := Smalltalk at:specClass asSymbol |
|
1821 |
] ifTrue:[ |
|
1822 |
cls := specClass |
|
1823 |
]. |
|
1824 |
cls isNil ifTrue:[ |
|
1825 |
(superclass := Smalltalk at:specSuperclass asSymbol) isNil ifTrue:[ |
|
1826 |
self warn:'no class named ' , specSuperclass , ' exists.'. |
|
1827 |
^ false. |
|
1828 |
]. |
|
1829 |
(self confirm:'create ' , specClass , ' ?') ifTrue:[ |
|
1830 |
superclass subclass:(specClass asSymbol) |
|
1831 |
instanceVariableNames:'' |
|
1832 |
classVariableNames:'' |
|
1833 |
poolDictionaries:'' |
|
1834 |
category:'New-Applications'. |
|
1835 |
^ true. |
|
1836 |
]. |
|
1837 |
^ false. |
|
1838 |
]. |
|
1839 |
cls isBehavior ifFalse:[ |
|
1840 |
self warn:'a global named ' , specClass , ' exists, but is no class.'. |
|
1841 |
^ false. |
|
1842 |
]. |
|
1843 |
||
1844 |
specSuperclass isBehavior ifFalse:[ |
|
179 | 1845 |
specSuperclass isEmpty ifFalse:[ |
1846 |
superclass := Smalltalk at:specSuperclass asSymbol |
|
1847 |
] ifTrue:[ |
|
1848 |
specSuperclass := nil. |
|
1849 |
] |
|
60 | 1850 |
] ifTrue:[ |
1851 |
superclass := specSuperclass |
|
1852 |
]. |
|
179 | 1853 |
|
60 | 1854 |
specSuperclass notNil ifTrue:[ |
1855 |
superclass isNil ifTrue:[ |
|
1856 |
self warn:'no class named ' , specSuperclass , ' exists.'. |
|
1857 |
^ false. |
|
1858 |
]. |
|
1859 |
||
1860 |
(cls isSubclassOf:superclass) ifFalse:[ |
|
206 | 1861 |
self information:('a global named ' , specClass , ' exists,\' , |
1862 |
'but is not a subclass of ' , superclass name , '.\\' , |
|
1863 |
'Check and try again if that is not what you want.') withCRs. |
|
60 | 1864 |
] |
1865 |
]. |
|
179 | 1866 |
|
1867 |
superclass isNil ifTrue:[ |
|
1868 |
cls notNil ifTrue:[ |
|
1869 |
specSuperclass := cls superclass name |
|
1870 |
] |
|
1871 |
]. |
|
1872 |
||
60 | 1873 |
^ true |
109 | 1874 |
|
179 | 1875 |
"Modified: 25.6.1997 / 13:37:11 / cg" |
60 | 1876 |
! |
1877 |
||
1878 |
defineClassAndSelector |
|
1879 |
"launch a dialog to define class, superclass and method" |
|
1880 |
||
176 | 1881 |
|again tmp| |
60 | 1882 |
|
1883 |
[ |
|
1884 |
again := false. |
|
160 | 1885 |
|
176 | 1886 |
(tmp := specClass) isNil ifTrue:[tmp := 'NewApplication']. |
1887 |
aspects at:#classNameChannel put:tmp asValue. |
|
1888 |
||
1889 |
(tmp := specSelector) isNil ifTrue:[tmp := 'windowSpec']. |
|
1890 |
aspects at:#methodNameChannel put:tmp asValue. |
|
1891 |
||
1892 |
(tmp := specSuperclass) isNil ifTrue:[tmp := 'ApplicationModel']. |
|
1893 |
aspects at:#superclassNameChannel put:tmp asValue. |
|
160 | 1894 |
|
60 | 1895 |
(self openDialogInterface:#nameAndSelectorSpec) ifTrue:[ |
1896 |
||
1897 |
specClass := (self aspectFor:#classNameChannel) value. |
|
1898 |
specSelector := (self aspectFor:#methodNameChannel) value. |
|
161 | 1899 |
specSelector notNil ifTrue:[specSelector := specSelector asSymbol]. |
60 | 1900 |
specSuperclass := (self aspectFor:#superclassNameChannel) value. |
1901 |
||
109 | 1902 |
(again := self checkClassAndSelector not) ifFalse:[ |
1903 |
self painter className:specClass |
|
1904 |
superclassName:specSuperclass |
|
1905 |
selector:specSelector. |
|
1906 |
] |
|
60 | 1907 |
] |
109 | 1908 |
|
60 | 1909 |
] doWhile:[again] |
1910 |
||
161 | 1911 |
"Modified: 17.6.1997 / 14:42:02 / cg" |
60 | 1912 |
! ! |
1913 |
||
222 | 1914 |
!UIPainter methodsFor:'user interaction - move'! |
1915 |
||
1916 |
doStepDown |
|
1917 |
treeView doStepOver:1 |
|
1918 |
! |
|
1919 |
||
1920 |
doStepIn |
|
1921 |
treeView doStepIn |
|
1922 |
! |
|
1923 |
||
1924 |
doStepOut |
|
1925 |
treeView doStepOut |
|
1926 |
! |
|
1927 |
||
1928 |
doStepUp |
|
1929 |
treeView doStepOver:-1 |
|
1930 |
! ! |
|
1931 |
||
109 | 1932 |
!UIPainter methodsFor:'user interaction - pullDown'! |
60 | 1933 |
|
149 | 1934 |
doBrowseAppClass |
1935 |
"open a browser on the class" |
|
1936 |
||
1937 |
|cls| |
|
1938 |
||
1939 |
specClass isNil ifTrue:[ |
|
1940 |
^ self information:'no class yet'. |
|
1941 |
]. |
|
1942 |
||
1943 |
specClass isBehavior ifFalse:[ |
|
1944 |
cls := Smalltalk at:specClass asSymbol |
|
1945 |
] ifTrue:[ |
|
1946 |
cls := specClass |
|
1947 |
]. |
|
1948 |
||
1949 |
cls isNil ifTrue:[ |
|
1950 |
^ self information:'no class yet'. |
|
1951 |
]. |
|
1952 |
||
1953 |
SystemBrowser openInClass:cls |
|
1954 |
||
1955 |
||
1956 |
! |
|
1957 |
||
60 | 1958 |
doFromClass |
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1959 |
|className methodName cls sel accepted failed spec s painter| |
109 | 1960 |
|
222 | 1961 |
self painter isModified ifTrue:[ |
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1962 |
(self confirm:'edit another interface without saving your modifications ?') ifFalse:[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1963 |
^ self |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1964 |
] |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1965 |
]. |
60 | 1966 |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1967 |
className := (specClass ? '') asValue. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1968 |
methodName := (specSelector ? '') asValue. |
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1969 |
painter := self painter. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1970 |
|
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1971 |
(s := painter className) notNil ifTrue:[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1972 |
className value:s |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1973 |
]. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1974 |
(s := painter methodName) notNil ifTrue:[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1975 |
methodName value:s |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1976 |
]. |
60 | 1977 |
|
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1978 |
failed := false. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1979 |
[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1980 |
accepted := |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1981 |
(DialogBox new |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1982 |
addTextLabel:'Classes name:'; |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1983 |
addInputFieldOn:className; |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1984 |
addVerticalSpace; |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1985 |
addTextLabel:'methods name:'; |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1986 |
addInputFieldOn:methodName; |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1987 |
addAbortButton; |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1988 |
addOkButton; |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1989 |
open |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1990 |
) accepted. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1991 |
|
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1992 |
accepted ifTrue:[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1993 |
cls := Smalltalk classNamed:className value. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1994 |
cls isNil ifTrue:[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1995 |
failed := true. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1996 |
self warn:'no such class'. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1997 |
] ifFalse:[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1998 |
sel := methodName value asSymbol. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
1999 |
(cls respondsTo:sel ) ifFalse:[ |
60 | 2000 |
failed := true. |
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2001 |
self warn:'no such method' |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2002 |
] ifTrue:[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2003 |
spec := cls perform:sel. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2004 |
spec isArray ifFalse:[ |
60 | 2005 |
failed := true. |
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2006 |
self warn:'not a windowSpec method' |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2007 |
]. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2008 |
"/ ok, got it |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2009 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2010 |
self setClass:cls selector:sel. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2011 |
|
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2012 |
painter setupFromSpec:spec. |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2013 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2014 |
^ self |
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2015 |
] |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2016 |
] |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2017 |
] |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2018 |
] doWhile:[accepted and:[failed]]. |
60 | 2019 |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2020 |
"Modified: 24.6.1997 / 18:59:29 / cg" |
60 | 2021 |
! |
2022 |
||
2023 |
doInstallAspects |
|
2024 |
|code| |
|
2025 |
||
217 | 2026 |
self hasSpecClassAndSelector ifFalse:[ |
60 | 2027 |
self defineClassAndSelector |
2028 |
]. |
|
2029 |
||
2030 |
self checkClassAndSelector ifFalse:[ |
|
2031 |
^ self |
|
2032 |
]. |
|
2033 |
||
109 | 2034 |
self painter className:specClass |
2035 |
superclassName:specSuperclass |
|
2036 |
selector:specSelector. |
|
60 | 2037 |
|
109 | 2038 |
code := self painter generateAspectMethods. |
60 | 2039 |
(ReadStream on:code) fileIn. |
2040 |
||
2041 |
! |
|
2042 |
||
152 | 2043 |
doInstallHelp |
197 | 2044 |
"install help text |
171 | 2045 |
" |
197 | 2046 |
activeHelpTool notNil ifTrue:[ |
2047 |
activeHelpTool installHelpSpecInto:specClass |
|
2048 |
] ifFalse:[ |
|
2049 |
self information:'no help text defined' |
|
2050 |
] |
|
152 | 2051 |
! |
2052 |
||
60 | 2053 |
doInstallSpec |
176 | 2054 |
|code painter| |
60 | 2055 |
|
217 | 2056 |
self hasSpecClassAndSelector ifFalse:[ |
60 | 2057 |
self defineClassAndSelector |
2058 |
]. |
|
2059 |
||
2060 |
self checkClassAndSelector ifFalse:[ |
|
2061 |
^ self |
|
2062 |
]. |
|
176 | 2063 |
painter := self painter. |
60 | 2064 |
|
176 | 2065 |
painter className:specClass |
2066 |
superclassName:specSuperclass |
|
2067 |
selector:specSelector. |
|
60 | 2068 |
|
176 | 2069 |
code := painter generateWindowSpecMethodSource withCRs. |
2070 |
painter resetModification. |
|
60 | 2071 |
(ReadStream on:code) fileIn. |
2072 |
||
2073 |
! |
|
2074 |
||
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2075 |
doNew |
222 | 2076 |
self painter isModified ifTrue:[ |
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2077 |
(self confirm:'new interface without saving your modifications ?') ifFalse:[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2078 |
^ self |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2079 |
] |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2080 |
]. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2081 |
|
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2082 |
self removeAll |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2083 |
|
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2084 |
"Modified: 17.6.1997 / 12:33:31 / cg" |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2085 |
! |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2086 |
|
60 | 2087 |
doPickAView |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2088 |
|painter view cls spec| |
60 | 2089 |
|
222 | 2090 |
self painter isModified ifTrue:[ |
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2091 |
(self confirm:'pick another interface without saving your modifications ?') ifFalse:[ |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2092 |
^ self |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2093 |
] |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2094 |
]. |
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
2095 |
|
171 | 2096 |
(view := Screen current viewFromUser) notNil ifTrue:[ |
174 | 2097 |
view == Screen current rootView ifFalse:[ |
2098 |
painter := self painter. |
|
2099 |
spec := UISpecification fromView:view topView. |
|
60 | 2100 |
|
174 | 2101 |
"/ ok, got it |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2102 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2103 |
view application notNil ifTrue:[ |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2104 |
cls := view application class |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2105 |
] ifFalse:[ |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2106 |
cls := view class |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2107 |
]. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2108 |
self setClass:cls selector:nil. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2109 |
|
174 | 2110 |
painter setupFromSpec:spec. |
2111 |
] |
|
109 | 2112 |
] |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2113 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
2114 |
"Modified: 24.6.1997 / 19:02:57 / cg" |
60 | 2115 |
! |
2116 |
||
149 | 2117 |
doStartApplication |
2118 |
|cls| |
|
2119 |
||
217 | 2120 |
(specClass isNil or:[specSelector size < 2]) ifTrue:[ |
149 | 2121 |
^ self information:'no class or selector defined'. |
2122 |
]. |
|
2123 |
||
2124 |
specClass isBehavior ifFalse:[ |
|
2125 |
cls := Smalltalk at:specClass asSymbol |
|
2126 |
] ifTrue:[ |
|
2127 |
cls := specClass |
|
2128 |
]. |
|
2129 |
||
2130 |
cls isNil ifTrue:[ |
|
2131 |
^ self information:'class not existant'. |
|
2132 |
]. |
|
2133 |
||
2134 |
(cls respondsTo:specSelector) ifFalse:[ |
|
161 | 2135 |
self halt. |
2136 |
^ self information:('no method for: #' |
|
2137 |
, specSelector , ' in ' , cls name , |
|
2138 |
'\\(did you install the spec ?)') withCRs. |
|
149 | 2139 |
]. |
2140 |
cls new openInterface:specSelector |
|
161 | 2141 |
|
2142 |
"Modified: 17.6.1997 / 14:40:21 / cg" |
|
149 | 2143 |
! |
2144 |
||
60 | 2145 |
doWindowSpec |
68 | 2146 |
|code code2 v| |
60 | 2147 |
|
109 | 2148 |
code := self painter generateWindowSpecMethodSource. |
68 | 2149 |
|
60 | 2150 |
v := CodeView open. |
2151 |
v contents:code. |
|
2152 |
v label:'windowSpec'. |
|
2153 |
||
81 | 2154 |
! ! |
2155 |
||
222 | 2156 |
!UIPainter::TreeView class methodsFor:'constants'! |
2157 |
||
2158 |
imageMasterChild |
|
2159 |
||
2160 |
ImageMasterChild isNil ifTrue:[ |
|
2161 |
ImageMasterChild := Image fromFile:('xpmBitmaps/document_images/tiny_file_lock.xpm'). |
|
2162 |
]. |
|
2163 |
^ ImageMasterChild |
|
2164 |
||
2165 |
" |
|
2166 |
ImageMasterChild := nil |
|
2167 |
" |
|
2168 |
||
2169 |
||
2170 |
! |
|
2171 |
||
2172 |
imageMasterParent |
|
2173 |
||
2174 |
ImageMasterParent isNil ifTrue:[ |
|
2175 |
ImageMasterParent := Image fromFile:('xpmBitmaps/document_images/tiny_yellow_dir_locked.xpm'). |
|
2176 |
]. |
|
2177 |
^ ImageMasterParent |
|
2178 |
||
2179 |
" |
|
2180 |
ImageMasterParent := nil |
|
2181 |
" |
|
2182 |
||
2183 |
||
2184 |
! ! |
|
2185 |
||
2186 |
!UIPainter::TreeView class methodsFor:'documentation'! |
|
2187 |
||
2188 |
documentation |
|
2189 |
" |
|
2190 |
selection in tree view; only used by the UIPainter |
|
2191 |
||
2192 |
[see also:] |
|
2193 |
SelectionInTreeView |
|
2194 |
SelectionInTree |
|
2195 |
TreeItem |
|
2196 |
UIPainter |
|
2197 |
||
2198 |
[author:] |
|
2199 |
Claus Atzkern |
|
2200 |
" |
|
2201 |
||
2202 |
||
2203 |
! ! |
|
2204 |
||
2205 |
!UIPainter::TreeView methodsFor:'accessing'! |
|
2206 |
||
2207 |
canvas |
|
2208 |
"returns the canvas( UIPainter ) |
|
2209 |
" |
|
2210 |
^ model root contents view |
|
2211 |
||
2212 |
||
2213 |
! |
|
2214 |
||
2215 |
canvas:aCanvas |
|
2216 |
"install canvas( UIPainter ) |
|
2217 |
" |
|
2218 |
|props| |
|
2219 |
||
2220 |
props := UIPainterView::ViewProperty new. |
|
2221 |
props view:aCanvas. |
|
2222 |
model root:(TreeItem name:'Canvas' contents:props). |
|
2223 |
model root expand. |
|
2224 |
self enableChannel:(aCanvas enableChannel). |
|
2225 |
||
2226 |
! ! |
|
2227 |
||
2228 |
!UIPainter::TreeView methodsFor:'accessing property'! |
|
2229 |
||
2230 |
propertiesDo:aOneArgBlock |
|
2231 |
"evaluate the argument a block on each property |
|
2232 |
" |
|
2233 |
self allItemsDo:[:anItem| aOneArgBlock value:(anItem contents)] |
|
2234 |
||
2235 |
||
2236 |
! |
|
2237 |
||
2238 |
propertyDetect:aOneArgBlock |
|
2239 |
"evaluate the block on each property |
|
2240 |
" |
|
2241 |
self allItemsDo:[:anItem| |
|
2242 |
(aOneArgBlock value:(anItem contents)) ifTrue:[^ anItem contents] |
|
2243 |
]. |
|
2244 |
^ nil |
|
2245 |
||
2246 |
! |
|
2247 |
||
2248 |
propertySelected |
|
2249 |
"returns current selected property or nil in case of multi selection |
|
2250 |
or empty selection |
|
2251 |
" |
|
2252 |
|idx| |
|
2253 |
||
2254 |
selection size == 1 ifTrue:[ |
|
2255 |
(idx := selection first) ~~ 1 ifTrue:[ "canvas: not yet supported" |
|
2256 |
^ (listOfNodes at:idx) contents |
|
2257 |
] |
|
2258 |
]. |
|
2259 |
^ nil |
|
2260 |
||
2261 |
! ! |
|
2262 |
||
2263 |
!UIPainter::TreeView methodsFor:'adding & removing'! |
|
2264 |
||
2265 |
addProperty:aProperty |
|
2266 |
"add a new item |
|
2267 |
" |
|
2268 |
|prnt child canvas view| |
|
2269 |
||
2270 |
child := TreeItem name:(aProperty name) contents:aProperty. |
|
2271 |
view := aProperty view. |
|
2272 |
canvas := self canvas. |
|
2273 |
||
2274 |
[ ((view := view superView) notNil and:[(prnt := self itemOfView:view) isNil]) |
|
2275 |
] whileTrue. |
|
2276 |
||
2277 |
prnt isNil ifTrue:[ |
|
2278 |
prnt := model root |
|
2279 |
]. |
|
2280 |
model add:child below:prnt. |
|
2281 |
||
2282 |
||
2283 |
! |
|
2284 |
||
2285 |
removeAll |
|
2286 |
"remove all items other than canvas |
|
2287 |
" |
|
2288 |
lastDrawnMaster := nil. |
|
2289 |
||
2290 |
self canvas subViews copy do:[:aView| |
|
2291 |
(aView isKindOf:InputView) ifFalse:[aView destroy] |
|
2292 |
]. |
|
2293 |
model root children:(OrderedCollection new). |
|
2294 |
model recomputeList. |
|
2295 |
self selection:nil. |
|
2296 |
||
2297 |
||
2298 |
! |
|
2299 |
||
2300 |
removeView:aView |
|
2301 |
"remove a view |
|
2302 |
" |
|
2303 |
|item spv| |
|
2304 |
||
2305 |
item := self itemOfView:aView. |
|
2306 |
||
2307 |
item notNil ifTrue:[ |
|
2308 |
spv := aView superView. |
|
2309 |
aView destroy. |
|
2310 |
spv sizeChanged:nil. |
|
2311 |
model remove:item |
|
2312 |
] |
|
2313 |
||
2314 |
||
2315 |
! ! |
|
2316 |
||
2317 |
!UIPainter::TreeView methodsFor:'canvas selection'! |
|
2318 |
||
2319 |
cvsSelection:aSelection |
|
2320 |
"canvas changed its selection |
|
2321 |
" |
|
2322 |
|sel list rcLt| |
|
2323 |
||
2324 |
list := OrderedCollection new. |
|
2325 |
||
2326 |
aSelection isNil ifFalse:[ |
|
2327 |
aSelection isCollection ifTrue:[ |
|
2328 |
aSelection notNil ifTrue:[sel := aSelection] |
|
2329 |
] ifFalse:[ |
|
2330 |
sel := Array with:aSelection |
|
2331 |
] |
|
2332 |
]. |
|
2333 |
||
2334 |
sel notNil ifTrue:[ |
|
2335 |
rcLt := false. |
|
2336 |
||
2337 |
sel do:[:aView||item| |
|
2338 |
(item := self itemOfView:aView) notNil ifTrue:[ |
|
2339 |
list add:item. |
|
2340 |
||
2341 |
[(item := item parent) notNil] whileTrue:[ |
|
2342 |
item hidden ifTrue:[ |
|
2343 |
rcLt := true. |
|
2344 |
item expand. |
|
2345 |
] |
|
2346 |
] |
|
2347 |
] |
|
2348 |
]. |
|
2349 |
rcLt ifTrue:[model recomputeList]. |
|
2350 |
sel := list collect:[:anItem| listOfNodes findFirst:[:el| el == anItem]] |
|
2351 |
] ifFalse:[ |
|
2352 |
sel := list |
|
2353 |
]. |
|
2354 |
self cvsEventsDisabledDo:[ self selection:sel ]. |
|
2355 |
||
2356 |
||
2357 |
||
2358 |
||
2359 |
! |
|
2360 |
||
2361 |
cvsSelectionAdd:aView |
|
2362 |
"canvas adds a view to current selection |
|
2363 |
" |
|
2364 |
|parent item rcLt oldSel| |
|
2365 |
||
2366 |
item := self itemOfView:aView. |
|
2367 |
||
2368 |
item notNil ifTrue:[ |
|
2369 |
parent := item. |
|
2370 |
||
2371 |
[ (parent := parent parent) notNil ] whileTrue:[ |
|
2372 |
parent hidden ifTrue:[ |
|
2373 |
rcLt := true. |
|
2374 |
parent expand. |
|
2375 |
] |
|
2376 |
]. |
|
2377 |
rcLt == true ifTrue:[model recomputeList]. |
|
2378 |
||
2379 |
oldSel := selection copy. |
|
2380 |
self addToSelection:(listOfNodes findFirst:[:el| el == item]). |
|
2381 |
self selectionChangedFrom:oldSel |
|
2382 |
]. |
|
2383 |
||
2384 |
||
2385 |
||
2386 |
! |
|
2387 |
||
2388 |
cvsSelectionRemove:aView |
|
2389 |
"canvas removes a view from current selection |
|
2390 |
" |
|
2391 |
|parent item rcLt oldSel| |
|
2392 |
||
2393 |
item := self itemOfView:aView. |
|
2394 |
||
2395 |
item notNil ifTrue:[ |
|
2396 |
parent := item. |
|
2397 |
||
2398 |
[ (parent := parent parent) notNil ] whileTrue:[ |
|
2399 |
parent hidden ifTrue:[ |
|
2400 |
rcLt := true. |
|
2401 |
parent expand. |
|
2402 |
] |
|
2403 |
]. |
|
2404 |
rcLt == true ifTrue:[model recomputeList]. |
|
2405 |
||
2406 |
oldSel := selection copy. |
|
2407 |
self removeFromSelection:(listOfNodes findFirst:[:el| el == item]). |
|
2408 |
self selectionChangedFrom:oldSel |
|
2409 |
]. |
|
2410 |
||
2411 |
||
2412 |
||
2413 |
! ! |
|
2414 |
||
2415 |
!UIPainter::TreeView methodsFor:'change & update'! |
|
2416 |
||
2417 |
layoutChanged |
|
2418 |
"layout of any component changed; in case of single selection, the |
|
2419 |
application will be informed to update its layout |
|
2420 |
" |
|
2421 |
selection size == 1 ifTrue:[ |
|
2422 |
self application layoutChanged |
|
2423 |
] |
|
2424 |
||
2425 |
||
2426 |
! |
|
2427 |
||
2428 |
propertyChanged:aProperty |
|
2429 |
"property of view derived from argument a property changed |
|
2430 |
" |
|
2431 |
|item idx end| |
|
2432 |
||
2433 |
item := self itemOfView:(aProperty view). |
|
2434 |
||
2435 |
item notNil ifTrue:[ |
|
2436 |
item contents:aProperty. |
|
2437 |
||
2438 |
item name = aProperty name ifFalse:[ |
|
2439 |
idx := self firstLineShown. |
|
2440 |
||
2441 |
(end := self lastLineShown) > listOfNodes size ifTrue:[ |
|
2442 |
end := listOfNodes size |
|
2443 |
]. |
|
2444 |
item name:aProperty name. |
|
2445 |
||
2446 |
[idx <= end] whileTrue:[ |
|
2447 |
(listOfNodes at:idx) == item ifTrue:[ |
|
2448 |
self redrawLine:idx. "/ is visible; redraw line |
|
2449 |
end := 0 |
|
2450 |
] ifFalse:[ |
|
2451 |
idx := idx + 1 |
|
2452 |
] |
|
2453 |
] |
|
2454 |
]. |
|
2455 |
||
2456 |
self selectedNode == item ifTrue:[ "/ inform application |
|
2457 |
self application treeViewChanged |
|
2458 |
] |
|
2459 |
]. |
|
2460 |
||
2461 |
||
2462 |
! ! |
|
2463 |
||
2464 |
!UIPainter::TreeView methodsFor:'drag & drop'! |
|
2465 |
||
2466 |
canDrop:anObjectOrCollection |
|
2467 |
"can drop ? delegate to canvas |
|
2468 |
" |
|
2469 |
^ self canvas canDrop:anObjectOrCollection |
|
2470 |
! |
|
2471 |
||
2472 |
drop:anObjectOrCollection at:aPoint |
|
2473 |
"drop objects ? delegate to canvas |
|
2474 |
" |
|
2475 |
self canvas drop:anObjectOrCollection at:aPoint |
|
2476 |
! ! |
|
2477 |
||
2478 |
!UIPainter::TreeView methodsFor:'event processing'! |
|
2479 |
||
2480 |
cvsEventsDisabledDo:aBlock |
|
2481 |
"evaluate the block without raising selection changed notifications |
|
2482 |
to canvas |
|
2483 |
" |
|
2484 |
|restoreCvsEvents| |
|
2485 |
||
2486 |
restoreCvsEvents := cvsEventsDisabled. |
|
2487 |
cvsEventsDisabled := true. |
|
2488 |
aBlock value. |
|
2489 |
cvsEventsDisabled := restoreCvsEvents. |
|
2490 |
||
2491 |
||
2492 |
! |
|
2493 |
||
2494 |
cvsSetupListDo:aBlock |
|
2495 |
"evaluate block without handling notifications from model; after evaluation |
|
2496 |
the new list will be recomputed |
|
2497 |
" |
|
2498 |
model removeDependent:self. |
|
2499 |
||
2500 |
self cvsEventsDisabledDo:[ |
|
2501 |
self selection:nil. |
|
2502 |
aBlock value |
|
2503 |
]. |
|
2504 |
model addDependent:self. |
|
2505 |
model recomputeList. |
|
2506 |
||
2507 |
! |
|
2508 |
||
2509 |
doubleClicked |
|
2510 |
"disable collapse of canvas item |
|
2511 |
" |
|
2512 |
self selectedNode == model root ifFalse:[ |
|
2513 |
super doubleClicked |
|
2514 |
] |
|
2515 |
||
2516 |
||
2517 |
! ! |
|
2518 |
||
2519 |
!UIPainter::TreeView methodsFor:'initialization'! |
|
2520 |
||
2521 |
initialize |
|
2522 |
"initialization; set multiple select and model |
|
2523 |
" |
|
2524 |
super initialize. |
|
2525 |
self multipleSelectOk:true. |
|
2526 |
self model:(SelectionInTree new). |
|
2527 |
cvsEventsDisabled := false. |
|
2528 |
||
2529 |
||
2530 |
! ! |
|
2531 |
||
2532 |
!UIPainter::TreeView methodsFor:'private'! |
|
2533 |
||
2534 |
allItemsDo:aOneArgBlock |
|
2535 |
"evaluate the argument a block on each item other than the canvas |
|
2536 |
" |
|
2537 |
model root allChildrenDo:aOneArgBlock |
|
2538 |
||
2539 |
||
2540 |
! |
|
2541 |
||
2542 |
figureFor:aNode |
|
2543 |
"returns image for an item; testing whether item is the first |
|
2544 |
entry into the selection |
|
2545 |
" |
|
2546 |
|master| |
|
2547 |
||
2548 |
selection size == 0 ifFalse:[ |
|
2549 |
master := listOfNodes at:(selection first). |
|
2550 |
||
2551 |
aNode == master ifTrue:[ |
|
2552 |
lastDrawnMaster := master. |
|
2553 |
aNode children size == 0 ifTrue:[ |
|
2554 |
imageMasterChild isNil ifTrue:[ |
|
2555 |
imageMasterChild := (self class imageMasterChild) onDevice:device. |
|
2556 |
]. |
|
2557 |
^ imageMasterChild |
|
2558 |
]. |
|
2559 |
imageMasterParent isNil ifTrue:[ |
|
2560 |
imageMasterParent := (self class imageMasterParent) onDevice:device. |
|
2561 |
]. |
|
2562 |
^ imageMasterParent |
|
2563 |
] |
|
2564 |
]. |
|
2565 |
^ super figureFor:aNode |
|
2566 |
||
2567 |
||
2568 |
! |
|
2569 |
||
2570 |
itemOfView:aView |
|
2571 |
"returns item assigned to view or nil |
|
2572 |
" |
|
2573 |
aView notNil ifTrue:[ |
|
2574 |
self allItemsDo:[:anItem| |
|
2575 |
(anItem contents view == aView) ifTrue:[^ anItem] |
|
2576 |
] |
|
2577 |
]. |
|
2578 |
^ nil |
|
2579 |
||
2580 |
||
2581 |
! |
|
2582 |
||
2583 |
selectNode:aNode |
|
2584 |
"change selection to a node |
|
2585 |
" |
|
2586 |
self selection:(listOfNodes findFirst:[:el| el == aNode]) |
|
2587 |
||
2588 |
||
2589 |
! |
|
2590 |
||
2591 |
selectionChangedFrom:oldSelection |
|
2592 |
"selection has changed. update master selection and raise notification |
|
2593 |
to canvas in case of enabled cvs events |
|
2594 |
" |
|
2595 |
|sel| |
|
2596 |
||
2597 |
super selectionChangedFrom:oldSelection. |
|
2598 |
||
2599 |
cvsEventsDisabled ifFalse:[ |
|
2600 |
selection notNil ifTrue:[ |
|
2601 |
sel := selection collect:[:i| (listOfNodes at:i) contents view]. |
|
2602 |
] ifFalse:[ |
|
2603 |
sel := #() |
|
2604 |
]. |
|
2605 |
self canvas updateSelectionFromModel:sel. |
|
2606 |
]. |
|
2607 |
||
2608 |
selection size ~~ 0 ifTrue:[ |
|
2609 |
sel := selection first. |
|
2610 |
||
2611 |
(listOfNodes at:sel) == lastDrawnMaster ifFalse:[ |
|
2612 |
self redrawLine:sel |
|
2613 |
] |
|
2614 |
] |
|
2615 |
||
2616 |
||
2617 |
! ! |
|
2618 |
||
2619 |
!UIPainter::TreeView methodsFor:'queries'! |
|
2620 |
||
2621 |
canStepIn |
|
2622 |
"returns true if can step in |
|
2623 |
" |
|
2624 |
|item prnt| |
|
2625 |
||
2626 |
( (item := self selectedNode) isNil |
|
2627 |
or:[(prnt := item parent) isNil |
|
2628 |
or:[(prnt := prnt childAt:((prnt indexOfChild:item) + 1)) isNil |
|
2629 |
or:[prnt contents spec class supportsSubComponents not]]] |
|
2630 |
) ifTrue:[ |
|
2631 |
^ false |
|
2632 |
]. |
|
2633 |
^ true |
|
2634 |
! |
|
2635 |
||
2636 |
canStepOut |
|
2637 |
|item prnt| |
|
2638 |
||
2639 |
( (item := self selectedNode) isNil |
|
2640 |
or:[(prnt := item parent) isNil |
|
2641 |
or:[prnt parent isNil]] |
|
2642 |
) ifTrue:[ |
|
2643 |
^ false |
|
2644 |
]. |
|
2645 |
^ true |
|
2646 |
! |
|
2647 |
||
2648 |
hasValidSelection |
|
2649 |
"returns true if any selection exists other than root |
|
2650 |
" |
|
2651 |
|size| |
|
2652 |
||
2653 |
(size := selection size) > 1 ifFalse:[ |
|
2654 |
(size == 0 or:[self isInSelection:1]) ifTrue:[ |
|
2655 |
^ false |
|
2656 |
] |
|
2657 |
]. |
|
2658 |
^ true |
|
2659 |
! ! |
|
2660 |
||
2661 |
!UIPainter::TreeView methodsFor:'user interactions'! |
|
2662 |
||
2663 |
doStepIn |
|
2664 |
|item prnt canvas| |
|
2665 |
||
2666 |
( (item := self selectedNode) isNil |
|
2667 |
or:[(prnt := item parent) isNil |
|
2668 |
or:[(prnt := prnt childAt:((prnt indexOfChild:item) + 1)) isNil |
|
2669 |
or:[prnt contents spec class supportsSubComponents not]]] |
|
2670 |
) ifFalse:[ |
|
2671 |
canvas := self canvas. |
|
2672 |
canvas deleteSelection. |
|
2673 |
canvas setSelection:(prnt contents view) withRedraw:false. |
|
2674 |
canvas pasteWithLayout. |
|
2675 |
] |
|
2676 |
! |
|
2677 |
||
2678 |
doStepOut |
|
2679 |
|item next prnt prop spVw index canvas to| |
|
2680 |
||
2681 |
( (item := self selectedNode) isNil |
|
2682 |
or:[(prnt := item parent) isNil |
|
2683 |
or:[(next := prnt parent) isNil]] |
|
2684 |
) ifTrue:[ |
|
2685 |
^ self |
|
2686 |
]. |
|
2687 |
model removeDependent:self. |
|
2688 |
||
2689 |
canvas := self canvas. |
|
2690 |
canvas deleteSelection. |
|
2691 |
canvas setSelection:(next contents view) withRedraw:false. |
|
2692 |
canvas pasteWithLayout. |
|
2693 |
||
2694 |
! |
|
2695 |
||
2696 |
doStepOver:anIndex |
|
2697 |
"move child 'anOffset' forward or backward in list of children |
|
2698 |
" |
|
2699 |
|item idx size prnt spVw view| |
|
2700 |
||
2701 |
( (item := self selectedNode) isNil |
|
2702 |
or:[(prnt := item parent) isNil |
|
2703 |
or:[(size := prnt children size) < 2]] |
|
2704 |
) ifFalse:[ |
|
2705 |
idx := prnt indexOfChild:item. |
|
2706 |
||
2707 |
model removeDependent:self. |
|
2708 |
model removeSelection. |
|
2709 |
selection := nil. |
|
2710 |
model addDependent:self. |
|
2711 |
idx := idx + anIndex. |
|
2712 |
||
2713 |
idx < 1 ifTrue:[idx := size] |
|
2714 |
ifFalse:[idx > size ifTrue:[idx := 1]]. |
|
2715 |
||
2716 |
model add:item beforeIndex:idx below:prnt. |
|
2717 |
idx := prnt indexOfChild:item. |
|
2718 |
view := item contents view. |
|
2719 |
spVw := view superView. |
|
2720 |
||
2721 |
"/ input view might by contained in sequence |
|
2722 |
((size := self canvas findInputViewIn:spVw) ~~ 0 and:[idx >= size]) ifTrue:[ |
|
2723 |
idx := idx + 1 |
|
2724 |
]. |
|
2725 |
spVw changeSequenceOrderFor:view to:idx. |
|
2726 |
||
2727 |
spVw specClass isLayoutContainer ifFalse:[ |
|
2728 |
spVw subViews do:[:v| v raise ]. |
|
2729 |
self canvas inputView raise |
|
2730 |
]. |
|
2731 |
self selectNode:item. |
|
2732 |
] |
|
2733 |
! ! |
|
2734 |
||
60 | 2735 |
!UIPainter class methodsFor:'documentation'! |
2736 |
||
2737 |
version |
|
2738 |
^ '$Header$' |
|
2739 |
! ! |