author | ca |
Thu, 03 Jul 1997 10:35:38 +0200 | |
changeset 201 | b10f071028cb |
parent 197 | 646d24a7ad36 |
child 206 | 1c3fb15ffd62 |
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 |
166 | 15 |
instanceVariableNames:'activeHelpTool layoutTool specTool objectList selectionPanel |
16 |
tabSelection specClass specSelector specSuperclass aspects' |
|
60 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-UIPainter' |
|
20 |
! |
|
21 |
||
22 |
!UIPainter class methodsFor:'documentation'! |
|
23 |
||
156 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
||
37 |
! |
|
38 |
||
60 | 39 |
documentation |
40 |
" |
|
127 | 41 |
GUI-Builder: |
42 |
this class allows the user to build its own applications providing a graphical |
|
43 |
user interface to buildin components and to define the behavior of the components |
|
44 |
during runtime. The resulting specifications can be installed as methods on |
|
45 |
classes, typically subclasses of an ApplicationModel. These specifications |
|
46 |
are used by the UIBuilder to generate the application window and its component |
|
47 |
structues when open the application. |
|
60 | 48 |
|
49 |
[start with:] |
|
50 |
UIPainter open |
|
127 | 51 |
|
156 | 52 |
[author:] |
183 | 53 |
Claus Gittinger |
156 | 54 |
Claus Atzkern |
55 |
||
127 | 56 |
[see also:] |
57 |
UIBuilder |
|
58 |
ApplicationModel |
|
59 |
UISpecification |
|
60 | 60 |
" |
109 | 61 |
|
62 |
! ! |
|
63 |
||
64 |
!UIPainter class methodsFor:'instance creation'! |
|
65 |
||
66 |
listHolder:aListHolder |
|
67 |
|application| |
|
68 |
||
69 |
application := self new. |
|
70 |
application objectList:aListHolder. |
|
71 |
^ application open |
|
72 |
! |
|
73 |
||
195
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
74 |
openOnClass:aClass andSelector:aSelector |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
75 |
^ self new openOnClass:aClass andSelector:aSelector |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
76 |
|
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
77 |
"Created: 1.7.1997 / 19:16:59 / cg" |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
78 |
! |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
79 |
|
109 | 80 |
painter:aBuilderView |
81 |
|application| |
|
82 |
||
83 |
application := self new. |
|
84 |
application painter:aBuilderView. |
|
85 |
^ application open |
|
60 | 86 |
! ! |
87 |
||
87 | 88 |
!UIPainter class methodsFor:'ST-80 queries'! |
89 |
||
90 |
preferenceFor:aSymbol |
|
91 |
^ false |
|
109 | 92 |
|
93 |
||
94 |
! ! |
|
95 |
||
193 | 96 |
!UIPainter class methodsFor:'help specs'! |
97 |
||
98 |
helpSpec |
|
99 |
"return a dictionary filled with helpKey -> helptext associations. |
|
100 |
These are used by the activeHelp tool. |
|
101 |
" |
|
102 |
^ super helpSpec addPairsFrom:#( |
|
103 |
||
104 |
#alignSelectionCenterVer |
|
105 |
'align selection vertical' |
|
106 |
||
107 |
#alignSelectionLeft |
|
108 |
'align selected components to the left edge of the |
|
109 |
dominant component ( underlined )' |
|
110 |
||
111 |
#alignSelectionRight |
|
112 |
'align selected components to the right edge of the |
|
113 |
dominant component ( underlined )' |
|
114 |
||
115 |
#alignSelectionLeftAndRight |
|
116 |
'align selected components to the right and left edge |
|
117 |
of the dominant component ( underlined )' |
|
118 |
||
119 |
#alignSelectionTop |
|
120 |
'align selected components to the top edge of the |
|
121 |
dominant component ( underlined )' |
|
122 |
||
123 |
#alignSelectionBottom |
|
124 |
'align selected components to the bottom edge of the |
|
125 |
dominant component ( underlined )' |
|
126 |
||
127 |
#alignSelectionTopAndBottom |
|
128 |
'align selected components to the top and bottom edge |
|
129 |
of the dominant component ( underlined )' |
|
130 |
||
131 |
#alignSelectionCenterVer |
|
132 |
'align selected components horizontal to the center of |
|
133 |
the dominant component ( underlined )' |
|
134 |
||
135 |
#alignSelectionCenterHor |
|
136 |
'align selected components vertical to the center of |
|
137 |
the dominant component ( underlined )' |
|
138 |
||
194 | 139 |
#spreadSelectionVer |
140 |
'vertical spacing between selected components is made the same' |
|
141 |
||
142 |
#spreadSelectionHor |
|
143 |
'horizontal spacing between selected components is made the same' |
|
144 |
||
145 |
#centerSelectionHor |
|
146 |
'center components horizontal in contained view' |
|
147 |
||
148 |
#centerSelectionVer |
|
149 |
'center vertical horizontal in contained view' |
|
150 |
||
151 |
#setToDefaultExtent |
|
152 |
'set selected components to their default extent' |
|
153 |
||
154 |
#setToDefaultWidth |
|
155 |
'set selected components to their default width' |
|
156 |
||
157 |
#setToDefaultHeight |
|
158 |
'set selected components to their default height' |
|
159 |
||
160 |
#copyExtent |
|
161 |
'copy extent of the selected component' |
|
162 |
||
163 |
#pasteExtent |
|
164 |
'change extent of all selected components to the |
|
165 |
last copied extent' |
|
166 |
||
167 |
#pasteWidth |
|
168 |
'change width of all selected components to the |
|
169 |
last copied extent width' |
|
170 |
||
171 |
#pasteHeight |
|
172 |
'change height of all selected components to the |
|
173 |
last copied extent height' |
|
174 |
||
175 |
#copyLayout |
|
176 |
'copy layout of the selected component' |
|
177 |
||
178 |
#pasteLayout |
|
179 |
'change layout of all selected components to the |
|
180 |
last copied layout' |
|
181 |
||
182 |
#pasteBuffer |
|
183 |
'paste components at current mouse position' |
|
184 |
||
185 |
#pasteWithLayout |
|
186 |
'paste components without changing their layouts' |
|
187 |
||
193 | 188 |
) |
189 |
||
190 |
||
191 |
||
192 |
||
193 |
! ! |
|
194 |
||
118 | 195 |
!UIPainter class methodsFor:'icons'! |
196 |
||
197 |
iconAlignB |
|
198 |
^ Image fromFile:'b_alignB.xbm' |
|
199 |
||
200 |
! |
|
201 |
||
202 |
iconAlignCenterH |
|
203 |
^ Image fromFile:'b_alignCH.xbm' |
|
204 |
||
205 |
! |
|
206 |
||
207 |
iconAlignCenterV |
|
208 |
^ Image fromFile:'b_alignCV.xbm' |
|
209 |
||
210 |
! |
|
211 |
||
212 |
iconAlignL |
|
213 |
^ Image fromFile:'b_alignL.xbm' |
|
214 |
! |
|
215 |
||
216 |
iconAlignLR |
|
217 |
^ Image fromFile:'b_alignLR.xbm' |
|
218 |
||
219 |
! |
|
220 |
||
221 |
iconAlignR |
|
222 |
^ Image fromFile:'b_alignR.xbm' |
|
223 |
||
224 |
! |
|
225 |
||
226 |
iconAlignT |
|
227 |
^ Image fromFile:'b_alignT.xbm' |
|
228 |
||
229 |
! |
|
230 |
||
231 |
iconAlignTB |
|
232 |
^ Image fromFile:'b_alignTB.xbm' |
|
233 |
||
234 |
! ! |
|
235 |
||
60 | 236 |
!UIPainter class methodsFor:'interface specs'! |
237 |
||
118 | 238 |
menuAlignment |
239 |
^ #(#Menu #( |
|
240 |
#(#MenuItem |
|
241 |
#'label:' 'align left' |
|
242 |
#'value:' #alignSelectionLeft |
|
130 | 243 |
#'labelImage:' #( ResourceRetriever nil iconAlignL ) |
193 | 244 |
#'activeHelpKey:' #alignSelectionLeft |
118 | 245 |
) |
246 |
#(#MenuItem |
|
247 |
#'label:' 'align right' |
|
248 |
#'value:' #alignSelectionRight |
|
130 | 249 |
#'labelImage:' #( ResourceRetriever nil iconAlignR ) |
193 | 250 |
#'activeHelpKey:' #alignSelectionRight |
118 | 251 |
) |
252 |
#(#MenuItem |
|
253 |
#'label:' 'align left & right' |
|
254 |
#'value:' #alignSelectionLeftAndRight |
|
130 | 255 |
#'labelImage:' #( ResourceRetriever nil iconAlignLR ) |
193 | 256 |
#'activeHelpKey:' #alignSelectionLeftAndRight |
118 | 257 |
) |
258 |
#(#MenuItem |
|
259 |
#'label:' 'align top' |
|
260 |
#'value:' #alignSelectionTop |
|
130 | 261 |
#'labelImage:' #( ResourceRetriever nil iconAlignT ) |
193 | 262 |
#'activeHelpKey:' #alignSelectionTop |
118 | 263 |
) |
264 |
#(#MenuItem |
|
265 |
#'label:' 'align bottom' |
|
266 |
#'value:' #alignSelectionBottom |
|
130 | 267 |
#'labelImage:' #( ResourceRetriever nil iconAlignB ) |
193 | 268 |
#'activeHelpKey:' #alignSelectionBottom |
118 | 269 |
) |
270 |
#(#MenuItem |
|
271 |
#'label:' 'align top & bottom' |
|
272 |
#'value:' #alignSelectionTopAndBottom |
|
130 | 273 |
#'labelImage:' #( ResourceRetriever nil iconAlignTB ) |
193 | 274 |
#'activeHelpKey:' #alignSelectionTopAndBottom |
118 | 275 |
) |
276 |
#(#MenuItem |
|
277 |
#'label:' 'align centered horizontal' |
|
278 |
#'value:' #alignSelectionCenterHor |
|
130 | 279 |
#'labelImage:' #( ResourceRetriever nil iconAlignCenterH ) |
193 | 280 |
#'activeHelpKey:' #alignSelectionCenterHor |
118 | 281 |
) |
282 |
#(#MenuItem |
|
283 |
#'label:' 'align centered vertical' |
|
284 |
#'value:' #alignSelectionCenterVer |
|
130 | 285 |
#'labelImage:' #( ResourceRetriever nil iconAlignCenterV ) |
193 | 286 |
#'activeHelpKey:' #alignSelectionCenterVer |
118 | 287 |
) |
288 |
) |
|
171 | 289 |
#( 3 3 ) |
118 | 290 |
nil |
291 |
) |
|
292 |
||
293 |
! |
|
294 |
||
295 |
menuPullDown |
|
109 | 296 |
^ #(#Menu #( |
297 |
#(#MenuItem |
|
298 |
#'label:' 'file' |
|
114 | 299 |
#'value:' #file |
109 | 300 |
#'submenu:' |
301 |
#(#Menu #( |
|
302 |
#(#MenuItem |
|
303 |
#'label:' 'new' |
|
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
304 |
#'value:' #doNew |
109 | 305 |
) |
306 |
#(#MenuItem |
|
307 |
#'label:' 'from class ...' |
|
114 | 308 |
#'value:' #doFromClass |
109 | 309 |
) |
310 |
#(#MenuItem |
|
311 |
#'label:' 'pick a view ' |
|
114 | 312 |
#'value:' #doPickAView |
109 | 313 |
) |
314 |
#(#MenuItem |
|
315 |
#'label:' 'raise' |
|
114 | 316 |
#'value:' #doRaise |
109 | 317 |
) |
318 |
#(#MenuItem |
|
187 | 319 |
#'label:' '=' |
320 |
) |
|
321 |
#(#MenuItem |
|
109 | 322 |
#'label:' 'quit' |
114 | 323 |
#'value:' #closeRequest |
109 | 324 |
) |
325 |
) |
|
187 | 326 |
#( 3 ) |
109 | 327 |
nil |
328 |
) |
|
329 |
) |
|
330 |
#(#MenuItem |
|
331 |
#'label:' 'misc' |
|
114 | 332 |
#'value:' #misc |
109 | 333 |
#'submenu:' |
334 |
#(#Menu #( |
|
335 |
#(#MenuItem |
|
336 |
#'label:' 'grid' |
|
114 | 337 |
#'value:' #grid |
109 | 338 |
#'submenu:' |
339 |
#(#Menu #( |
|
340 |
#(#MenuItem |
|
137 | 341 |
#'label:' 'show' |
342 |
#'indication:' #gridShown: |
|
109 | 343 |
) |
344 |
#(#MenuItem |
|
137 | 345 |
#'label:' 'align' |
346 |
#'indication:' #gridAlign: |
|
109 | 347 |
) |
348 |
) |
|
349 |
nil |
|
350 |
nil |
|
351 |
) |
|
352 |
) |
|
353 |
#(#MenuItem |
|
354 |
#'label:' 'undo' |
|
114 | 355 |
#'value:' #undo |
109 | 356 |
#'submenu:' |
357 |
#(#Menu #( |
|
358 |
#(#MenuItem |
|
359 |
#'label:' 'last' |
|
114 | 360 |
#'value:' #undoLast |
109 | 361 |
) |
362 |
#(#MenuItem |
|
363 |
#'label:' 'menu' |
|
114 | 364 |
#'value:' #openUndoMenu |
109 | 365 |
) |
366 |
#(#MenuItem |
|
367 |
#'label:' 'delete' |
|
114 | 368 |
#'value:' #removeUndoHistory |
109 | 369 |
) |
370 |
) |
|
371 |
#(2) |
|
372 |
nil |
|
373 |
) |
|
374 |
) |
|
375 |
) |
|
376 |
nil |
|
377 |
nil |
|
378 |
) |
|
379 |
) |
|
380 |
#(#MenuItem |
|
381 |
#'label:' 'code' |
|
114 | 382 |
#'value:' #code |
109 | 383 |
#'submenu:' |
384 |
#(#Menu #( |
|
385 |
#(#MenuItem |
|
155
575239b7ad0b
confirm pick/new/fromClass if unsaved & modified
Claus Gittinger <cg@exept.de>
parents:
152
diff
changeset
|
386 |
#'label:' 'class && method ...' |
114 | 387 |
#'value:' #defineClassAndSelector |
109 | 388 |
) |
389 |
#(#MenuItem |
|
187 | 390 |
#'label:' '=' |
391 |
) |
|
392 |
#(#MenuItem |
|
393 |
#'label:' 'install window spec.' |
|
114 | 394 |
#'value:' #doInstallSpec |
109 | 395 |
) |
396 |
#(#MenuItem |
|
187 | 397 |
#'label:' 'install help spec.' |
152 | 398 |
#'value:' #doInstallHelp |
399 |
) |
|
400 |
#(#MenuItem |
|
109 | 401 |
#'label:' 'install aspects' |
114 | 402 |
#'value:' #doInstallAspects |
109 | 403 |
) |
404 |
#(#MenuItem |
|
187 | 405 |
#'label:' '=' |
406 |
) |
|
407 |
#(#MenuItem |
|
408 |
#'label:' 'show window spec.' |
|
114 | 409 |
#'value:' #doWindowSpec |
109 | 410 |
) |
187 | 411 |
#(#MenuItem |
412 |
#'label:' '=' |
|
413 |
) |
|
414 |
#(#MenuItem |
|
149 | 415 |
#'label:' 'browse application' |
416 |
#'value:' #doBrowseAppClass |
|
187 | 417 |
) |
418 |
#(#MenuItem |
|
419 |
#'label:' 'start application' |
|
420 |
#'value:' #doStartApplication |
|
421 |
) |
|
109 | 422 |
) |
187 | 423 |
#( 4 ) |
109 | 424 |
nil |
425 |
) |
|
426 |
) |
|
427 |
#(#MenuItem |
|
428 |
#'label:' 'test' |
|
118 | 429 |
#'nameKey:' #test |
114 | 430 |
#'value:' #test |
109 | 431 |
#'submenu:' |
432 |
#(#Menu #( |
|
433 |
#(#MenuItem |
|
137 | 434 |
#'label:' 'test mode' |
435 |
#'indication:' #testMode: |
|
109 | 436 |
) |
437 |
) |
|
438 |
nil |
|
439 |
nil |
|
440 |
) |
|
441 |
) |
|
442 |
) |
|
443 |
nil |
|
444 |
nil |
|
445 |
) |
|
446 |
! |
|
447 |
||
60 | 448 |
nameAndSelectorSpec |
449 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
450 |
||
451 |
"do not manually edit this - the painter/builder may not be able to |
|
452 |
handle the specification if its corrupted." |
|
453 |
||
454 |
" |
|
455 |
UIPainter new openOnClass:UIPainter andSelector:#nameAndSelectorSpec |
|
456 |
UIPainter new openInterface:#nameAndSelectorSpec |
|
457 |
" |
|
458 |
||
459 |
<resource: #canvas> |
|
460 |
||
461 |
^ |
|
142 | 462 |
|
60 | 463 |
#(#FullSpec |
464 |
#'window:' |
|
465 |
#(#WindowSpec |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
466 |
#'name:' 'uIPainterView' |
60 | 467 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
176 | 468 |
#'label:' 'Painter' |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
469 |
#'bounds:' #(#Rectangle 0 0 391 170) |
60 | 470 |
) |
471 |
#'component:' |
|
472 |
#(#SpecCollection |
|
473 |
#'collection:' |
|
474 |
#( |
|
475 |
#(#LabelSpec |
|
176 | 476 |
#'name:' 'classLabel' |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
477 |
#'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5) |
60 | 478 |
#'label:' 'class:' |
479 |
#'adjust:' #right |
|
176 | 480 |
#'resizeForLabel:' true |
60 | 481 |
) |
482 |
#(#LabelSpec |
|
176 | 483 |
#'name:' 'superClassLabel' |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
484 |
#'layout:' #(#AlignmentOrigin 45 0.11 77 0 1 0.5) |
60 | 485 |
#'label:' 'superclass:' |
486 |
#'adjust:' #right |
|
176 | 487 |
#'resizeForLabel:' true |
60 | 488 |
) |
489 |
#(#LabelSpec |
|
176 | 490 |
#'name:' 'selectorLabel' |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
491 |
#'layout:' #(#AlignmentOrigin 45 0.11 105 0 1 0.5) |
60 | 492 |
#'label:' 'selector:' |
493 |
#'adjust:' #right |
|
176 | 494 |
#'resizeForLabel:' true |
60 | 495 |
) |
496 |
#(#InputFieldSpec |
|
497 |
#'name:' 'methodNameField' |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
498 |
#'layout:' #(#LayoutFrame 47 0.11 95 0 -5 1.0 117 0) |
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
499 |
#'tabable:' true |
60 | 500 |
#'model:' #methodNameChannel |
501 |
) |
|
502 |
#(#LabelSpec |
|
503 |
#'name:' 'boxLabel' |
|
176 | 504 |
#'layout:' #(#Point 5 10) |
92 | 505 |
#'label:' 'class & selector for code:' |
506 |
#'adjust:' #left |
|
176 | 507 |
#'resizeForLabel:' true |
508 |
) |
|
509 |
#(#InputFieldSpec |
|
510 |
#'name:' 'classNameField' |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
511 |
#'layout:' #(#LayoutFrame 47 0.11 39 0 -5 1.0 61 0) |
176 | 512 |
#'tabable:' true |
513 |
#'model:' #classNameChannel |
|
60 | 514 |
) |
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
515 |
#(#ComboBoxSpec |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
516 |
#'name:' 'comboBox1' |
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
517 |
#'layout:' #(#LayoutFrame 47 0.11 67 0 -5 1.0 89 0) |
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
518 |
#'tabable:' true |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
519 |
#'model:' #superclassNameChannel |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
520 |
#'comboList:' #superclassNameDefaults |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
521 |
) |
176 | 522 |
#(#HorizontalPanelViewSpec |
523 |
#'name:' 'commitPanel' |
|
524 |
#'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0) |
|
525 |
#'component:' |
|
526 |
#(#SpecCollection |
|
527 |
#'collection:' |
|
528 |
#( |
|
529 |
#(#ActionButtonSpec |
|
530 |
#'name:' 'button1' |
|
531 |
#'label:' 'cancel' |
|
532 |
#'tabable:' true |
|
533 |
#'model:' #cancel |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
534 |
#'extent:' #(#Point 191 24) |
176 | 535 |
) |
536 |
#(#ActionButtonSpec |
|
537 |
#'name:' 'button2' |
|
538 |
#'label:' 'ok' |
|
539 |
#'tabable:' true |
|
540 |
#'isDefault:' true |
|
541 |
#'model:' #accept |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
542 |
#'extent:' #(#Point 191 24) |
176 | 543 |
) |
544 |
) |
|
545 |
) |
|
546 |
#'horizontalLayout:' #fitSpace |
|
547 |
#'verticalLayout:' #fit |
|
548 |
#'horizontalSpace:' 3 |
|
549 |
#'verticalSpace:' 3 |
|
550 |
) |
|
60 | 551 |
) |
552 |
) |
|
553 |
) |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
554 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
555 |
"Modified: 24.6.1997 / 18:50:14 / cg" |
109 | 556 |
! |
557 |
||
558 |
windowSpec |
|
559 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
560 |
||
561 |
"do not manually edit this - the painter/builder may not be able to |
|
562 |
handle the specification if its corrupted." |
|
563 |
||
564 |
" |
|
565 |
UIPainter new openOnClass:UIPainter andSelector:#windowSpec |
|
566 |
UIPainter new openInterface:#windowSpec |
|
567 |
" |
|
568 |
"UIPainter open" |
|
569 |
||
570 |
<resource: #canvas> |
|
571 |
||
572 |
^ |
|
573 |
||
574 |
#(#FullSpec |
|
171 | 575 |
#'flags:' 0 |
109 | 576 |
#'window:' |
577 |
#(#WindowSpec |
|
578 |
#'name:' 'uIPainterView' |
|
579 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
171 | 580 |
#'flags:' 0 |
109 | 581 |
#'label:' 'Tree-View' |
171 | 582 |
#'bounds:' #(#Rectangle 0 0 524 456) |
109 | 583 |
) |
584 |
#'component:' |
|
585 |
#(#SpecCollection |
|
586 |
#'collection:' |
|
587 |
#( |
|
588 |
#(#MenuPanelSpec |
|
137 | 589 |
#'name:' 'menuPullDown' |
171 | 590 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 25 0) |
591 |
#'flags:' 0 |
|
144 | 592 |
#'tabable:' true |
118 | 593 |
#'menu:' #menuPullDown |
109 | 594 |
) |
137 | 595 |
#(#MenuPanelSpec |
596 |
#'name:' 'menuAlignment' |
|
597 |
#'layout:' #(#LayoutFrame 0 0.0 29 0 233 0 54 0) |
|
171 | 598 |
#'flags:' 0 |
144 | 599 |
#'tabable:' true |
137 | 600 |
#'menu:' #menuAlignment |
601 |
#'showSeparatingLines:' true |
|
602 |
) |
|
603 |
#(#PanelViewSpec |
|
604 |
#'name:' 'panelViewButtons' |
|
149 | 605 |
#'layout:' #(#LayoutFrame -125 1.0 25 0.0 0 1.0 57 0.0) |
171 | 606 |
#'flags:' 0 |
137 | 607 |
#'component:' |
608 |
#(#SpecCollection |
|
609 |
#'collection:' |
|
610 |
#( |
|
611 |
#(#ActionButtonSpec |
|
612 |
#'name:' 'moveLeft' |
|
171 | 613 |
#'flags:' 0 |
137 | 614 |
#'label:' '' |
615 |
#'translateLabel:' true |
|
616 |
#'labelChannel:' #'LABELb_moveLeft.xbm' |
|
144 | 617 |
#'tabable:' true |
137 | 618 |
#'defaultable:' true |
619 |
#'model:' #moveSelectionLeft |
|
620 |
#'isTriggerOnDown:' true |
|
621 |
#'enableChannel:' #enableChannel |
|
622 |
#'extent:' #(#Point 26 24) |
|
623 |
) |
|
624 |
#(#ActionButtonSpec |
|
625 |
#'name:' 'moveRight' |
|
171 | 626 |
#'flags:' 0 |
137 | 627 |
#'label:' '' |
628 |
#'translateLabel:' true |
|
629 |
#'labelChannel:' #'LABELb_moveRight.xbm' |
|
144 | 630 |
#'tabable:' true |
137 | 631 |
#'defaultable:' true |
632 |
#'model:' #moveSelectionRight |
|
633 |
#'isTriggerOnDown:' true |
|
634 |
#'enableChannel:' #enableChannel |
|
635 |
#'extent:' #(#Point 26 24) |
|
636 |
) |
|
637 |
#(#ActionButtonSpec |
|
638 |
#'name:' 'moveUp' |
|
171 | 639 |
#'flags:' 0 |
137 | 640 |
#'label:' '' |
641 |
#'translateLabel:' true |
|
642 |
#'labelChannel:' #'LABELb_moveUp.xbm' |
|
144 | 643 |
#'tabable:' true |
137 | 644 |
#'defaultable:' true |
645 |
#'model:' #moveSelectionUp |
|
646 |
#'isTriggerOnDown:' true |
|
647 |
#'enableChannel:' #enableChannel |
|
648 |
#'extent:' #(#Point 26 24) |
|
649 |
) |
|
650 |
#(#ActionButtonSpec |
|
651 |
#'name:' 'moveDown' |
|
171 | 652 |
#'flags:' 0 |
137 | 653 |
#'label:' '' |
654 |
#'translateLabel:' true |
|
655 |
#'labelChannel:' #'LABELb_moveDown.xbm' |
|
144 | 656 |
#'tabable:' true |
137 | 657 |
#'defaultable:' true |
658 |
#'model:' #moveSelectionDown |
|
659 |
#'isTriggerOnDown:' true |
|
660 |
#'enableChannel:' #enableChannel |
|
661 |
#'extent:' #(#Point 26 24) |
|
662 |
) |
|
663 |
) |
|
664 |
) |
|
665 |
#'level:' 1 |
|
666 |
#'horizontalLayout:' #fitSpace |
|
667 |
#'verticalLayout:' #fitSpace |
|
668 |
#'horizontalSpace:' 4 |
|
669 |
#'verticalSpace:' 4 |
|
670 |
) |
|
671 |
#(#SequenceViewSpec |
|
672 |
#'name:' 'objectTree' |
|
149 | 673 |
#'layout:' #(#LayoutFrame 0 0.0 59 0.0 0 0.35 -25 1.0) |
171 | 674 |
#'flags:' 0 |
137 | 675 |
#'enableChannel:' #enableChannel |
144 | 676 |
#'tabable:' true |
137 | 677 |
#'menu:' #objectListMenu |
678 |
#'model:' #objectList |
|
679 |
#'hasHorizontalScrollBar:' true |
|
680 |
#'hasVerticalScrollBar:' true |
|
681 |
#'miniScrollerHorizontal:' true |
|
682 |
#'isMultiSelect:' true |
|
683 |
#'doubleClickSelector:' #doubleClick |
|
684 |
#'useIndex:' true |
|
685 |
) |
|
686 |
#(#NoteBookViewSpec |
|
687 |
#'name:' 'noteBook' |
|
149 | 688 |
#'layout:' #(#LayoutFrame 0 0.35 59 0.0 0 1.0 -55 1.0) |
171 | 689 |
#'flags:' 0 |
137 | 690 |
#'enableChannel:' #enableChannel |
144 | 691 |
#'tabable:' true |
137 | 692 |
#'menu:' #tabList |
693 |
#'style:' |
|
694 |
#(#FontDescription |
|
144 | 695 |
#helvetica #medium |
137 | 696 |
#roman #'10' |
697 |
) |
|
698 |
#'model:' #tabModel |
|
699 |
#'tabWidget:' #Window |
|
700 |
#'canvas:' #noteBookView |
|
701 |
) |
|
702 |
#(#HorizontalPanelViewSpec |
|
703 |
#'name:' 'modifyPanel' |
|
149 | 704 |
#'layout:' #(#LayoutFrame 0 0.35 -55 1.0 0 1.0 -25 1.0) |
171 | 705 |
#'flags:' 0 |
137 | 706 |
#'component:' |
707 |
#(#SpecCollection |
|
708 |
#'collection:' |
|
709 |
#( |
|
710 |
#(#ActionButtonSpec |
|
711 |
#'name:' 'cancelButton' |
|
171 | 712 |
#'flags:' 0 |
137 | 713 |
#'label:' 'cancel' |
144 | 714 |
#'tabable:' true |
137 | 715 |
#'model:' #cancel |
716 |
#'enableChannel:' #modifiedChannel |
|
171 | 717 |
#'extent:' #(#Point 166 24) |
137 | 718 |
) |
719 |
#(#ActionButtonSpec |
|
720 |
#'name:' 'acceptButton' |
|
171 | 721 |
#'flags:' 0 |
137 | 722 |
#'label:' 'ok' |
144 | 723 |
#'tabable:' true |
137 | 724 |
#'model:' #accept |
725 |
#'enableChannel:' #modifiedChannel |
|
171 | 726 |
#'extent:' #(#Point 166 24) |
137 | 727 |
) |
728 |
) |
|
729 |
) |
|
730 |
#'level:' 0 |
|
731 |
#'horizontalLayout:' #fitSpace |
|
732 |
#'verticalLayout:' #fitSpace |
|
733 |
#'horizontalSpace:' 3 |
|
734 |
#'verticalSpace:' 3 |
|
735 |
) |
|
149 | 736 |
#(#LabelSpec |
737 |
#'name:' 'helpInfo' |
|
738 |
#'layout:' #(#LayoutFrame 2 0.0 -25 1.0 -2 1.0 -2 1.0) |
|
171 | 739 |
#'flags:' 0 |
149 | 740 |
#'label:' '' |
741 |
#'level:' -1 |
|
742 |
#'adjust:' #left |
|
743 |
) |
|
173 | 744 |
#(#ToggleSpec |
745 |
#'name:' 'galleryLabel' |
|
746 |
#'layout:' #(#LayoutFrame -162 1.0 1 0 -82 1.0 23 0) |
|
171 | 747 |
#'flags:' 0 |
748 |
#'label:' 'Gallery' |
|
173 | 749 |
#'model:' #galleryShown |
750 |
#'isTriggerOnDown:' true |
|
751 |
#'showLamp:' true |
|
752 |
#'lampColor:' #(#Color 100.0 100.0 0.0) |
|
171 | 753 |
) |
173 | 754 |
#(#ToggleSpec |
755 |
#'name:' 'painterLabel' |
|
756 |
#'layout:' #(#LayoutFrame -81 1.0 1 0 -1 1.0 23 0) |
|
171 | 757 |
#'flags:' 0 |
758 |
#'label:' 'Painter' |
|
173 | 759 |
#'model:' #painterShown |
760 |
#'isTriggerOnDown:' true |
|
761 |
#'showLamp:' true |
|
762 |
#'lampColor:' #(#Color 100.0 100.0 0.0) |
|
171 | 763 |
) |
109 | 764 |
) |
765 |
) |
|
766 |
) |
|
60 | 767 |
! ! |
768 |
||
109 | 769 |
!UIPainter methodsFor:'actions'! |
60 | 770 |
|
109 | 771 |
accept |
772 |
|layout| |
|
60 | 773 |
|
166 | 774 |
objectList removeDependent:self. |
775 |
||
776 |
self isLayoutToolSelected ifTrue:[ |
|
144 | 777 |
(layout := layoutTool layout) notNil ifTrue:[ |
778 |
layoutTool layoutType == #Extent ifTrue:[ |
|
779 |
self painter setExtent:layout |
|
780 |
] ifFalse:[ |
|
149 | 781 |
self painter setLayout:layout |
109 | 782 |
] |
144 | 783 |
] |
784 |
] ifFalse:[ |
|
166 | 785 |
self isHelpToolSelected ifTrue:[ |
149 | 786 |
activeHelpTool accept |
787 |
]. |
|
171 | 788 |
self painter updateFromSpec:(specTool specification). |
144 | 789 |
]. |
166 | 790 |
self modifiedChannel value:false. |
791 |
objectList addDependent:self. |
|
109 | 792 |
|
793 |
! |
|
794 |
||
795 |
cancel |
|
796 |
"cancel all changes and read back attributes from current view |
|
797 |
" |
|
166 | 798 |
self modifiedChannel value ifTrue:[ |
171 | 799 |
specTool specification:(self painter specForSelection). |
166 | 800 |
layoutTool layoutView:(layoutTool layoutView). |
801 |
self modifiedChannel value:false. |
|
802 |
] |
|
137 | 803 |
! |
804 |
||
805 |
doubleClick |
|
806 |
objectList selectGroup |
|
60 | 807 |
! ! |
808 |
||
149 | 809 |
!UIPainter methodsFor:'active help'! |
810 |
||
197 | 811 |
activeHelpTool |
812 |
"setup help tool |
|
171 | 813 |
" |
149 | 814 |
activeHelpTool isNil ifTrue:[ |
152 | 815 |
activeHelpTool := UIHelpTool new. |
197 | 816 |
activeHelpTool helpSpecFrom:specClass. |
149 | 817 |
]. |
818 |
^ activeHelpTool |
|
819 |
! |
|
820 |
||
821 |
showHelp:aHelpText for:view |
|
822 |
"hook to allow an application to display active help |
|
823 |
texts in its own info area. |
|
824 |
This method may be redefined in a concrete application. |
|
825 |
If it returns false, the ActiveHelp manager will popup a |
|
826 |
bubble with the help text." |
|
827 |
||
828 |
|l| |
|
829 |
||
830 |
(l := self builder componentAt:#helpInfo) notNil ifTrue:[ |
|
152 | 831 |
aHelpText replaceAll:(Character cr) by:(Character space). |
149 | 832 |
l label:aHelpText. |
152 | 833 |
^ true. |
149 | 834 |
]. |
835 |
^ false |
|
836 |
||
837 |
||
838 |
! ! |
|
839 |
||
60 | 840 |
!UIPainter methodsFor:'aspects'! |
841 |
||
118 | 842 |
enableChannel |
843 |
"true if modifications are allowed otherwise running test |
|
844 |
" |
|
845 |
^ self painter enableChannel |
|
109 | 846 |
! |
847 |
||
173 | 848 |
galleryShown |
849 |
|holder| |
|
850 |
||
851 |
(holder := builder bindingAt:#galleryShown) isNil ifTrue:[ |
|
852 |
builder aspectAt:#galleryShown put:(holder := true asValue). |
|
853 |
holder addDependent:self |
|
854 |
]. |
|
855 |
^ holder |
|
856 |
||
857 |
! |
|
858 |
||
118 | 859 |
menuAlignment |
860 |
|menu channel| |
|
861 |
||
862 |
channel := self enableChannel. |
|
863 |
||
864 |
menu := Menu new. |
|
865 |
menu fromLiteralArrayEncoding:(self class menuAlignment). |
|
866 |
menu receiver:self. |
|
867 |
menu menuItems do:[:anItem| anItem enabled:channel]. |
|
868 |
^ menu |
|
869 |
! |
|
870 |
||
871 |
menuPullDown |
|
872 |
|menu channel| |
|
873 |
||
874 |
channel := self enableChannel. |
|
875 |
||
876 |
menu := Menu new. |
|
877 |
menu fromLiteralArrayEncoding:(self class menuPullDown). |
|
878 |
menu receiver:self. |
|
879 |
||
880 |
menu menuItems do:[:anItem| |
|
881 |
anItem nameKey ~~ #test ifTrue:[anItem enabled:channel] |
|
133 | 882 |
ifFalse:[anItem value:channel]. |
118 | 883 |
]. |
884 |
^ menu |
|
109 | 885 |
! |
886 |
||
887 |
modifiedChannel |
|
888 |
||
889 |
|holder| |
|
890 |
||
891 |
(holder := builder bindingAt:#modifiedChannel) isNil ifTrue:[ |
|
892 |
builder aspectAt:#modifiedChannel put:(holder := false asValue). |
|
893 |
]. |
|
894 |
^ holder |
|
895 |
! |
|
896 |
||
897 |
noteBookView |
|
898 |
"automatically generated by UIPainter ..." |
|
899 |
||
166 | 900 |
|noteBook channel n1 n2| |
109 | 901 |
|
902 |
(noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
|
166 | 903 |
noteBook := View new. |
904 |
layoutTool := UILayoutTool new. |
|
905 |
specTool := UISpecificationTool new. |
|
144 | 906 |
channel := self modifiedChannel. |
166 | 907 |
|
152 | 908 |
layoutTool masterApplication:self. |
166 | 909 |
specTool masterApplication:self. |
910 |
||
911 |
n1 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
|
912 |
n2 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook. |
|
913 |
||
914 |
n1 client:layoutTool. |
|
915 |
specTool builder:(n2 client:specTool). |
|
916 |
||
917 |
layoutTool masterApplication:self. |
|
918 |
specTool masterApplication:self. |
|
109 | 919 |
layoutTool modifiedHolder:channel. |
166 | 920 |
specTool modifiedHolder:channel. |
109 | 921 |
builder aspectAt:#noteBookView put:noteBook. |
922 |
]. |
|
923 |
^ noteBook |
|
924 |
! |
|
925 |
||
926 |
objectList |
|
927 |
^ objectList |
|
928 |
! |
|
929 |
||
930 |
objectListMenu |
|
931 |
"returns a block which returns the menu |
|
114 | 932 |
!!hack!! |
109 | 933 |
" |
121 | 934 |
^ [ self painter showMiddleButtonMenu ]. |
109 | 935 |
|
936 |
||
937 |
||
938 |
! |
|
939 |
||
173 | 940 |
painterShown |
941 |
|holder| |
|
942 |
||
943 |
(holder := builder bindingAt:#painterShown) isNil ifTrue:[ |
|
944 |
builder aspectAt:#painterShown put:(holder := true asValue). |
|
945 |
holder addDependent:self |
|
946 |
]. |
|
947 |
^ holder |
|
948 |
||
949 |
! |
|
950 |
||
109 | 951 |
tabList |
952 |
"automatically generated by UIPainter ..." |
|
953 |
||
954 |
|holder| |
|
955 |
||
956 |
(holder := builder bindingAt:#tabList) isNil ifTrue:[ |
|
957 |
builder aspectAt:#tabList put:(holder := ValueHolder new). |
|
144 | 958 |
holder value:#( 'Properties' ). |
109 | 959 |
]. |
960 |
^ holder |
|
961 |
! |
|
962 |
||
963 |
tabModel |
|
964 |
"automatically generated by UIPainter ..." |
|
965 |
||
966 |
|holder| |
|
967 |
||
968 |
(holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
|
969 |
holder := AspectAdaptor new subject:self; forAspect:#tabSelection. |
|
970 |
builder aspectAt:#tabModel put:holder. |
|
971 |
]. |
|
972 |
^ holder |
|
60 | 973 |
! ! |
974 |
||
109 | 975 |
!UIPainter methodsFor:'binding access'! |
976 |
||
977 |
aspectFor:aKey |
|
978 |
"check wether aspect is assigned to a label icon |
|
979 |
" |
|
980 |
(aKey startsWith:'LABEL') ifFalse:[ |
|
981 |
^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ] |
|
982 |
]. |
|
983 |
^ Image fromFile:(aKey copyFrom:(('LABEL' size) + 1)) |
|
984 |
! ! |
|
985 |
||
986 |
!UIPainter methodsFor:'change & update'! |
|
987 |
||
988 |
update:something with:aParameter from:someObject |
|
989 |
||
990 |
(someObject == objectList and:[something ~~ #list]) ifTrue:[ |
|
991 |
something ~~ #layout ifTrue:[ |
|
992 |
self objectListChanged |
|
993 |
] ifFalse:[ |
|
166 | 994 |
self modifiedChannel value ifTrue:[ |
995 |
^ self |
|
996 |
]. |
|
997 |
layoutTool update |
|
998 |
]. |
|
173 | 999 |
^ self modifiedChannel value:false |
1000 |
]. |
|
1001 |
||
1002 |
self galleryShown == someObject ifTrue:[ |
|
1003 |
(self galleryShown value) ifTrue:[ |
|
1004 |
self raiseUIView:(selectionPanel window) |
|
1005 |
] ifFalse:[ |
|
1006 |
self hideUIView:(selectionPanel window) |
|
1007 |
]. |
|
1008 |
^ self |
|
1009 |
]. |
|
1010 |
||
1011 |
self painterShown == someObject ifTrue:[ |
|
1012 |
(self painterShown value) ifTrue:[ |
|
1013 |
self raiseUIView:(self painter topView) |
|
1014 |
] ifFalse:[ |
|
1015 |
self hideUIView:(self painter topView) |
|
1016 |
]. |
|
1017 |
^ self |
|
1018 |
]. |
|
1019 |
||
109 | 1020 |
! ! |
1021 |
||
1022 |
!UIPainter methodsFor:'event handling'! |
|
1023 |
||
1024 |
doesNotUnderstand:aMessage |
|
1025 |
|painter| |
|
1026 |
||
1027 |
painter := self painter. |
|
1028 |
||
1029 |
(painter respondsTo:(aMessage selector)) ifTrue:[ |
|
1030 |
^ aMessage sendTo:painter |
|
1031 |
]. |
|
149 | 1032 |
super doesNotUnderstand:aMessage |
109 | 1033 |
|
1034 |
! |
|
1035 |
||
1036 |
objectListChanged |
|
1037 |
"something changed in the painter view |
|
1038 |
" |
|
171 | 1039 |
|oldSelection view slices list spec props size nameOfSpec| |
109 | 1040 |
|
1041 |
props := objectList selectedProperty. |
|
166 | 1042 |
oldSelection := tabSelection. |
109 | 1043 |
tabSelection := nil. |
1044 |
||
1045 |
props isNil ifFalse:[ |
|
144 | 1046 |
view := props view. |
1047 |
spec := props spec copy. |
|
142 | 1048 |
|
166 | 1049 |
layoutTool layoutView == view ifFalse:[ |
144 | 1050 |
slices := spec class slices. |
1051 |
size := slices size + 1. |
|
1052 |
list := Array new:size. |
|
1053 |
slices keysAndValuesDo:[:i :s|list at:i put:(s first asString)]. |
|
166 | 1054 |
list at:size put:(layoutTool class label). |
144 | 1055 |
(self tabList) value:list. |
1056 |
] ifTrue:[ |
|
1057 |
list := self tabList value |
|
142 | 1058 |
]. |
166 | 1059 |
(list findFirst:[:n| n = oldSelection ]) ~~ 0 ifTrue:[ |
1060 |
tabSelection := oldSelection |
|
1061 |
] ifFalse:[ |
|
1062 |
tabSelection := list first |
|
171 | 1063 |
]. |
1064 |
nameOfSpec := spec class name. |
|
1065 |
] ifTrue:[ |
|
1066 |
nameOfSpec := '' |
|
109 | 1067 |
]. |
171 | 1068 |
|
1069 |
self showHelp:nameOfSpec for:nil. |
|
1070 |
||
166 | 1071 |
layoutTool layoutView:view. |
171 | 1072 |
specTool specification:spec. |
60 | 1073 |
|
166 | 1074 |
tabSelection notNil ifTrue:[ |
1075 |
self isLayoutToolSelected ifTrue:[ |
|
1076 |
(self noteBookView subViews at:1) raise |
|
1077 |
] ifFalse:[ |
|
1078 |
specTool selection:tabSelection. |
|
1079 |
(self noteBookView subViews at:2) raise |
|
1080 |
] |
|
60 | 1081 |
]. |
1082 |
||
168 | 1083 |
(builder componentAt:#noteBook) setSelection:tabSelection. |
166 | 1084 |
self modifiedChannel value:false. |
60 | 1085 |
! ! |
1086 |
||
109 | 1087 |
!UIPainter methodsFor:'private'! |
1088 |
||
173 | 1089 |
hideUIView:aView |
1090 |
aView beIndependent. |
|
1091 |
aView unmap. |
|
1092 |
! |
|
1093 |
||
109 | 1094 |
painter |
1095 |
^ objectList painter |
|
173 | 1096 |
! |
1097 |
||
1098 |
raiseUIView:aView |
|
1099 |
aView map. |
|
1100 |
aView bePartner. |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1101 |
! |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1102 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1103 |
setClass:cls selector:selector |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1104 |
|clsName superClassName| |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1105 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1106 |
clsName := cls name. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1107 |
superClassName := cls superclass name. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1108 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1109 |
(self aspectFor:#classNameChannel) value:clsName. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1110 |
(self aspectFor:#methodNameChannel) value:(selector ? ''). |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1111 |
(self aspectFor:#superclassNameChannel) value:superClassName. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1112 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1113 |
self painter |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1114 |
className:clsName |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1115 |
superclassName:superClassName |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1116 |
selector:(selector ? ''). |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1117 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1118 |
specClass := clsName. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1119 |
specSelector := (selector ? ''). |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1120 |
specSuperclass := superClassName. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1121 |
|
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1122 |
"Modified: 24.6.1997 / 19:07:01 / cg" |
109 | 1123 |
! ! |
1124 |
||
166 | 1125 |
!UIPainter methodsFor:'queries'! |
1126 |
||
1127 |
isHelpToolSelected |
|
1128 |
^ tabSelection = 'Help' |
|
1129 |
! |
|
1130 |
||
1131 |
isLayoutToolSelected |
|
1132 |
^ tabSelection = layoutTool class label |
|
1133 |
! ! |
|
1134 |
||
109 | 1135 |
!UIPainter methodsFor:'selection'! |
1136 |
||
1137 |
tabSelection |
|
1138 |
^ tabSelection |
|
1139 |
! |
|
1140 |
||
1141 |
tabSelection:something |
|
166 | 1142 |
|raiseViewIdx| |
121 | 1143 |
|
166 | 1144 |
something notNil ifTrue:[ |
1145 |
raiseViewIdx := 1. |
|
1146 |
tabSelection := something. |
|
109 | 1147 |
|
166 | 1148 |
self isLayoutToolSelected ifFalse:[ |
1149 |
specTool selection:tabSelection. |
|
1150 |
raiseViewIdx := 2 |
|
121 | 1151 |
]. |
166 | 1152 |
(self noteBookView subViews at:raiseViewIdx) raise. |
1153 |
self cancel. |
|
109 | 1154 |
] |
60 | 1155 |
! ! |
1156 |
||
109 | 1157 |
!UIPainter methodsFor:'startup / release'! |
1158 |
||
1159 |
closeRequest |
|
1160 |
"close all windows open by builder |
|
1161 |
" |
|
133 | 1162 |
|anyUnsavedChanges| |
1163 |
||
1164 |
objectList painter isModified ifTrue:[ |
|
1165 |
(self confirm:'quit without saving ?') ifFalse:[ |
|
1166 |
^ self |
|
1167 |
] |
|
1168 |
]. |
|
1169 |
||
109 | 1170 |
objectList removeDependent:self. |
1171 |
objectList painter release. |
|
60 | 1172 |
|
109 | 1173 |
selectionPanel notNil ifTrue:[ |
183 | 1174 |
selectionPanel masterApplication:nil. |
109 | 1175 |
selectionPanel closeRequest |
1176 |
]. |
|
149 | 1177 |
selectionPanel := nil. |
1178 |
layoutTool := nil. |
|
1179 |
objectList := nil. |
|
1180 |
activeHelpTool := nil. |
|
1181 |
||
109 | 1182 |
super closeRequest. |
1183 |
||
1184 |
! |
|
1185 |
||
1186 |
closeRequestFor:aTopView |
|
1187 |
"handle a close request for a specific view |
|
1188 |
" |
|
173 | 1189 |
|topView| |
60 | 1190 |
|
109 | 1191 |
topView := self window. |
60 | 1192 |
|
109 | 1193 |
topView == aTopView ifTrue:[ |
1194 |
super closeRequestFor:aTopView |
|
1195 |
] ifFalse:[ |
|
173 | 1196 |
aTopView = selectionPanel window ifTrue:[ |
1197 |
self galleryShown value:false |
|
1198 |
] ifFalse:[ |
|
1199 |
self painterShown value:false |
|
1200 |
]. |
|
133 | 1201 |
topView raise. |
109 | 1202 |
]. |
60 | 1203 |
! |
1204 |
||
109 | 1205 |
openInterface |
1206 |
"open interfaces |
|
1207 |
" |
|
136 | 1208 |
|painterView painter cls topView| |
60 | 1209 |
|
1210 |
aspects := IdentityDictionary new. |
|
1211 |
||
1212 |
aspects at:#classNameChannel put:( |
|
1213 |
(specClass notNil ifTrue:[specClass] |
|
1214 |
ifFalse:['NewApplication']) asValue |
|
1215 |
). |
|
1216 |
specSuperclass isNil ifTrue:[ |
|
1217 |
specClass notNil ifTrue:[ |
|
1218 |
(cls := Smalltalk at:specClass asSymbol) notNil ifTrue:[ |
|
1219 |
specSuperclass := cls superclass name. |
|
1220 |
] |
|
1221 |
] |
|
1222 |
]. |
|
1223 |
aspects at:#superclassNameChannel put:( |
|
1224 |
(specSuperclass notNil ifTrue:[specSuperclass] |
|
1225 |
ifFalse:['ApplicationModel']) asValue |
|
1226 |
). |
|
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1227 |
aspects at:#superclassNameDefaults put:#('ApplicationModel' 'SimpleDialog') asValue. |
60 | 1228 |
aspects at:#methodNameChannel put:( |
161 | 1229 |
(specSelector notNil ifTrue:[specSelector asValue] |
60 | 1230 |
ifFalse:[#windowSpec]) asValue |
1231 |
). |
|
136 | 1232 |
|
1233 |
painterView := StandardSystemView new. |
|
1234 |
painterView label:'unnamed canvas'. |
|
1235 |
painterView extent:300@300. |
|
1236 |
||
1237 |
painter := UIPainterView in:painterView. |
|
109 | 1238 |
painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. |
136 | 1239 |
|
109 | 1240 |
objectList := painter listHolder. |
1241 |
objectList addDependent:self. |
|
136 | 1242 |
|
109 | 1243 |
super openInterface. |
60 | 1244 |
|
136 | 1245 |
topView := self window. |
1246 |
topView bePartner. |
|
1247 |
topView label:'Interface Builder'. |
|
1248 |
topView icon:(Image fromFile:'bitmaps/Builder.xbm' resolution:100). |
|
1249 |
||
1250 |
painterView openInGroup:(topView windowGroup). |
|
1251 |
painterView bePartner. |
|
1252 |
painterView application:self. |
|
1253 |
painterView open. |
|
1254 |
||
1255 |
painterView application:self. |
|
183 | 1256 |
selectionPanel := UISelectionPanel new. |
136 | 1257 |
selectionPanel allButOpenInterface:#windowSpec. |
1258 |
selectionPanel window openInGroup:(topView windowGroup). |
|
1259 |
selectionPanel window bePartner. |
|
1260 |
selectionPanel openWindow. |
|
183 | 1261 |
selectionPanel masterApplication:self. |
60 | 1262 |
! |
1263 |
||
1264 |
openNewWindowCanvas |
|
109 | 1265 |
"open new |
1266 |
" |
|
60 | 1267 |
self open. |
1268 |
||
1269 |
||
1270 |
! |
|
1271 |
||
109 | 1272 |
openOnClass:aClass |
1273 |
"open up an interface builder |
|
1274 |
" |
|
1275 |
self openOnClass:aClass andSelector:#windowSpec |
|
1276 |
! |
|
1277 |
||
60 | 1278 |
openOnClass:aClass andSelector:aSelector |
1279 |
"open up an interface builder, fetching a spec from someClass |
|
109 | 1280 |
via some selector |
1281 |
" |
|
1282 |
|painter| |
|
60 | 1283 |
|
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1284 |
aClass isNil ifTrue:[ |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1285 |
self warn:'nil class given (class was probably renamed ?)'. |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1286 |
]. |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1287 |
|
109 | 1288 |
self openInterface. |
60 | 1289 |
|
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1290 |
aClass notNil ifTrue:[ |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1291 |
painter := self painter. |
60 | 1292 |
|
177
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1293 |
self setClass:aClass selector:aSelector. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1294 |
"/ specClass := aClass name. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1295 |
"/ specSuperclass := aClass superclass name. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1296 |
"/ specSelector := aSelector. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1297 |
"/ |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1298 |
"/ (aspects at:#classNameChannel) value:specClass. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1299 |
"/ (aspects at:#superclassNameChannel) value:specSuperclass. |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1300 |
"/ (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
|
1301 |
"/ |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1302 |
"/ painter |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1303 |
"/ className:aClass name |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1304 |
"/ superclassName:aClass superclass name |
eefd69a52f5b
fixed setup of class/selector when picking/fetching via
Claus Gittinger <cg@exept.de>
parents:
176
diff
changeset
|
1305 |
"/ selector:aSelector. |
60 | 1306 |
|
195
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
1307 |
(aClass respondsTo:aSelector) ifTrue:[ |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
1308 |
painter setupFromSpec:(aClass perform:aSelector). |
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
1309 |
] |
157
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1310 |
] |
ce974dce3dd4
enhanced class & method dialog
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1311 |
|
195
350f95af5d9d
check before sending selector to class
Claus Gittinger <cg@exept.de>
parents:
194
diff
changeset
|
1312 |
"Modified: 1.7.1997 / 19:18:54 / cg" |
60 | 1313 |
! ! |
1314 |
||
109 | 1315 |
!UIPainter methodsFor:'user interaction - dialog'! |
60 | 1316 |
|
1317 |
checkClassAndSelector |
|
1318 |
"check for class & superclass" |
|
1319 |
||
1320 |
|superclass cls| |
|
1321 |
||
1322 |
specClass isNil ifTrue:[^ false]. |
|
1323 |
||
1324 |
specClass isBehavior ifFalse:[ |
|
1325 |
cls := Smalltalk at:specClass asSymbol |
|
1326 |
] ifTrue:[ |
|
1327 |
cls := specClass |
|
1328 |
]. |
|
1329 |
cls isNil ifTrue:[ |
|
1330 |
(superclass := Smalltalk at:specSuperclass asSymbol) isNil ifTrue:[ |
|
1331 |
self warn:'no class named ' , specSuperclass , ' exists.'. |
|
1332 |
^ false. |
|
1333 |
]. |
|
1334 |
(self confirm:'create ' , specClass , ' ?') ifTrue:[ |
|
1335 |
superclass subclass:(specClass asSymbol) |
|
1336 |
instanceVariableNames:'' |
|
1337 |
classVariableNames:'' |
|
1338 |
poolDictionaries:'' |
|
1339 |
category:'New-Applications'. |
|
1340 |
^ true. |
|
1341 |
]. |
|
1342 |
^ false. |
|
1343 |
]. |
|
1344 |
cls isBehavior ifFalse:[ |
|
1345 |
self warn:'a global named ' , specClass , ' exists, but is no class.'. |
|
1346 |
^ false. |
|
1347 |
]. |
|
1348 |
||
1349 |
specSuperclass isBehavior ifFalse:[ |
|
179 | 1350 |
specSuperclass isEmpty ifFalse:[ |
1351 |
superclass := Smalltalk at:specSuperclass asSymbol |
|
1352 |
] ifTrue:[ |
|
1353 |
specSuperclass := nil. |
|
1354 |
] |
|
60 | 1355 |
] ifTrue:[ |
1356 |
superclass := specSuperclass |
|
1357 |
]. |
|
179 | 1358 |
|
60 | 1359 |
specSuperclass notNil ifTrue:[ |
1360 |
superclass isNil ifTrue:[ |
|
1361 |
self warn:'no class named ' , specSuperclass , ' exists.'. |
|
1362 |
^ false. |
|
1363 |
]. |
|
1364 |
||
1365 |
(cls isSubclassOf:superclass) ifFalse:[ |
|
1366 |
self warn:'a global named ' , specClass , ' exists, but is not a subclass of ' , superclass name , '.'. |
|
1367 |
^ false. |
|
1368 |
] |
|
1369 |
]. |
|
179 | 1370 |
|
1371 |
superclass isNil ifTrue:[ |
|
1372 |
cls notNil ifTrue:[ |
|
1373 |
specSuperclass := cls superclass name |
|
1374 |
] |
|
1375 |
]. |
|
1376 |
||
60 | 1377 |
^ true |
109 | 1378 |
|
179 | 1379 |
"Modified: 25.6.1997 / 13:37:11 / cg" |
60 | 1380 |
! |
1381 |
||
1382 |
defineClassAndSelector |
|
1383 |
"launch a dialog to define class, superclass and method" |
|
1384 |
||
176 | 1385 |
|again tmp| |
60 | 1386 |
|
1387 |
[ |
|
1388 |
again := false. |
|
160 | 1389 |
|
176 | 1390 |
(tmp := specClass) isNil ifTrue:[tmp := 'NewApplication']. |
1391 |
aspects at:#classNameChannel put:tmp asValue. |
|
1392 |
||
1393 |
(tmp := specSelector) isNil ifTrue:[tmp := 'windowSpec']. |
|
1394 |
aspects at:#methodNameChannel put:tmp asValue. |
|
1395 |
||
1396 |
(tmp := specSuperclass) isNil ifTrue:[tmp := 'ApplicationModel']. |
|
1397 |
aspects at:#superclassNameChannel put:tmp asValue. |
|
160 | 1398 |
|
60 | 1399 |
(self openDialogInterface:#nameAndSelectorSpec) ifTrue:[ |
1400 |
||
1401 |
specClass := (self aspectFor:#classNameChannel) value. |
|
1402 |
specSelector := (self aspectFor:#methodNameChannel) value. |
|
161 | 1403 |
specSelector notNil ifTrue:[specSelector := specSelector asSymbol]. |
60
7542ab7fbbfe
*** empty log message ***
Claus Gittin |