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