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