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