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