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