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