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