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