author | Claus Gittinger <cg@exept.de> |
Sun, 13 Feb 2000 14:00:07 +0100 | |
changeset 1351 | 811686e8acab |
parent 1347 | c4046d0b638e |
child 1358 | c0116e25a2ac |
permissions | -rw-r--r-- |
60 | 1 |
" |
156 | 2 |
COPYRIGHT (c) 1995 by Claus Gittinger / eXept Software AG |
3 |
All Rights Reserved |
|
60 | 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 |
|
742 | 7 |
inclusion of the above copyright notice. This software may not |
60 | 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 |
UIObjectView subclass:#UIPainterView |
|
278 | 14 |
instanceVariableNames:'treeView listHolder superclassName className methodName |
770 | 15 |
categoryName handleColor handleMasterColor' |
925
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
16 |
classVariableNames:'HandCursor RedefineAspectMethods AspectsAsInstances' |
60 | 17 |
poolDictionaries:'' |
18 |
category:'Interface-UIPainter' |
|
19 |
! |
|
20 |
||
211 | 21 |
Object subclass:#ViewProperty |
22 |
instanceVariableNames:'view spec identifier' |
|
23 |
classVariableNames:'Identifier' |
|
24 |
poolDictionaries:'' |
|
25 |
privateIn:UIPainterView |
|
26 |
! |
|
27 |
||
60 | 28 |
!UIPainterView class methodsFor:'documentation'! |
29 |
||
30 |
copyright |
|
31 |
" |
|
156 | 32 |
COPYRIGHT (c) 1995 by Claus Gittinger / eXept Software AG |
33 |
All Rights Reserved |
|
60 | 34 |
|
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
742 | 37 |
inclusion of the above copyright notice. This software may not |
60 | 38 |
be provided or otherwise made available to, or used by, any |
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
43 |
||
44 |
documentation |
|
45 |
" |
|
128 | 46 |
buildIn view used by the UIPainter; from this view, the layout of the |
47 |
new application derives from. |
|
48 |
||
49 |
[see also:] |
|
50 |
UIBuilder |
|
51 |
UIObjectView |
|
156 | 52 |
|
53 |
[author:] |
|
54 |
Claus Gittinger |
|
55 |
Claus Atzkern |
|
60 | 56 |
" |
57 |
! ! |
|
58 |
||
1225 | 59 |
!UIPainterView class methodsFor:'initialization'! |
60 |
||
61 |
initialize |
|
62 |
||
63 |
AspectsAsInstances := false. |
|
64 |
RedefineAspectMethods := false. |
|
65 |
||
66 |
"Created: / 22.9.1999 / 12:32:31 / stefan" |
|
67 |
! ! |
|
68 |
||
698 | 69 |
!UIPainterView class methodsFor:'code generation mode'! |
70 |
||
925
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
71 |
generateAspectsAsInstanceVariables |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
72 |
"if on, aspects are held as instance variables; |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
73 |
if off (the default), they are kept in the bindings dictionary. |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
74 |
" |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
75 |
^ AspectsAsInstances |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
76 |
|
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
77 |
"Created: / 29.7.1998 / 11:21:38 / cg" |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
78 |
"Modified: / 29.7.1998 / 11:22:01 / cg" |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
79 |
! |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
80 |
|
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
81 |
generateAspectsAsInstanceVariables:aBoolean |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
82 |
"if on, aspects are held as instance variables; |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
83 |
if off (the default), they are kept in the bindings dictionary. |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
84 |
" |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
85 |
AspectsAsInstances := aBoolean |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
86 |
|
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
87 |
"Created: / 29.7.1998 / 11:21:26 / cg" |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
88 |
"Modified: / 29.7.1998 / 11:22:11 / cg" |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
89 |
! |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
90 |
|
742 | 91 |
redefineAspectMethods |
698 | 92 |
"redefine methods yes or no. If a method is defined in super class |
93 |
should the message be reinstalled ? |
|
94 |
" |
|
1225 | 95 |
^ RedefineAspectMethods |
698 | 96 |
|
1225 | 97 |
"Modified: / 22.9.1999 / 12:33:03 / stefan" |
698 | 98 |
! |
99 |
||
742 | 100 |
redefineAspectMethods:aBoolean |
698 | 101 |
"redefine methods yes or no. If a method is defined in super class |
102 |
should the message be reinstalled ? |
|
103 |
" |
|
742 | 104 |
RedefineAspectMethods := aBoolean |
698 | 105 |
|
106 |
||
107 |
! ! |
|
108 |
||
60 | 109 |
!UIPainterView class methodsFor:'defaults'! |
110 |
||
111 |
defaultMenuMessage |
|
112 |
"This message is the default yo be sent to the menuHolder to get a menu |
|
113 |
" |
|
121 | 114 |
^ #showMiddleButtonMenu |
60 | 115 |
|
116 |
||
117 |
! ! |
|
118 |
||
119 |
!UIPainterView methodsFor:'accessing'! |
|
120 |
||
121 |
application |
|
122 |
^ nil |
|
123 |
||
124 |
"Modified: 6.9.1995 / 00:46:44 / claus" |
|
125 |
! |
|
126 |
||
78 | 127 |
applicationName |
128 |
^ self className |
|
129 |
! |
|
130 |
||
131 |
applicationName:aName |
|
132 |
self className:aName |
|
133 |
! |
|
134 |
||
60 | 135 |
className |
136 |
^ className |
|
137 |
! |
|
138 |
||
78 | 139 |
className:aName |
140 |
className := aName |
|
60 | 141 |
! |
142 |
||
143 |
className:aClassName superclassName:aSuperclassName selector:aSelector |
|
78 | 144 |
className := aClassName. |
60 | 145 |
superclassName := aSuperclassName. |
78 | 146 |
methodName := aSelector. |
60 | 147 |
|
148 |
! |
|
149 |
||
223 | 150 |
findInputViewIn:aSuperView |
151 |
"returns index of input view into superview or nil |
|
152 |
" |
|
153 |
aSuperView == self ifTrue:[ |
|
154 |
^ self subViews findFirst:[:v| v == inputView ] |
|
155 |
]. |
|
156 |
^ 0 |
|
157 |
! |
|
158 |
||
159 |
inputView |
|
160 |
^ inputView |
|
111 | 161 |
! |
162 |
||
60 | 163 |
methodName |
164 |
^ methodName |
|
165 |
! |
|
166 |
||
78 | 167 |
methodName:aName |
168 |
methodName := aName |
|
60 | 169 |
! |
170 |
||
171 |
selectNames:aStringOrCollection |
|
1031 | 172 |
|prop coll s n newSel| |
173 |
||
174 |
(aStringOrCollection size == 0) ifTrue:[ |
|
175 |
newSel := nil. |
|
176 |
] ifFalse:[ |
|
177 |
(s := aStringOrCollection) isString ifFalse:[ |
|
178 |
s size == 1 ifTrue:[ |
|
179 |
s := s first |
|
180 |
] ifFalse:[ |
|
181 |
coll := OrderedCollection new. |
|
60 | 182 |
|
1031 | 183 |
s do:[:aName| |
184 |
(prop := self propertyOfName:aName) notNil ifTrue:[ |
|
185 |
coll add:(prop view) |
|
186 |
] |
|
187 |
]. |
|
188 |
(n := coll size) == 1 ifTrue:[ |
|
189 |
newSel := coll at:1 |
|
190 |
] ifFalse:[ |
|
191 |
n == 0 ifTrue:[ |
|
192 |
newSel := nil |
|
193 |
] ifFalse:[ |
|
194 |
newSel := coll |
|
195 |
] |
|
196 |
]. |
|
197 |
^ self select:newSel. |
|
198 |
] |
|
199 |
]. |
|
200 |
||
201 |
prop := self propertyOfName:s. |
|
202 |
prop isNil ifTrue:[ |
|
203 |
newSel := nil |
|
204 |
] ifFalse:[ |
|
205 |
newSel := prop view |
|
206 |
]. |
|
60 | 207 |
]. |
208 |
||
1031 | 209 |
^ self select:newSel |
60 | 210 |
! ! |
211 |
||
111 | 212 |
!UIPainterView methodsFor:'change & update'! |
213 |
||
223 | 214 |
layoutChanged |
754 | 215 |
|
238 | 216 |
treeView layoutChanged |
111 | 217 |
! ! |
218 |
||
60 | 219 |
!UIPainterView methodsFor:'copy & cut & paste'! |
220 |
||
221 |
copySelection |
|
222 |
"copy the selection into the cut&paste-buffer |
|
223 |
" |
|
698 | 224 |
|specs coll sel| |
225 |
||
226 |
sel := treeView selection. |
|
71 | 227 |
|
128 | 228 |
coll := self minSetOfSuperViews:(self selection). |
60 | 229 |
|
71 | 230 |
coll notNil ifTrue:[ |
776 | 231 |
"/ self select:nil. |
78 | 232 |
specs := coll collect:[:aView| self fullSpecFor:aView ]. |
698 | 233 |
self setSelection:specs. |
776 | 234 |
"/ treeView selection: sel |
60 | 235 |
]. |
78 | 236 |
|
237 |
||
60 | 238 |
! |
239 |
||
723 | 240 |
deleteSelection |
887
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
241 |
"delete the selection buffered |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
242 |
" |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
243 |
self deleteSelectionBuffered: true |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
244 |
! |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
245 |
|
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
246 |
deleteSelectionBuffered: buffered |
698 | 247 |
"cut the selection into the cut&paste-buffer |
62 | 248 |
and open a transaction |
60 | 249 |
" |
887
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
250 |
|specs coll oldSelectedNode newSelectedNode newSelection| |
71 | 251 |
|
128 | 252 |
coll := self minSetOfSuperViews:(self selection). |
60 | 253 |
|
78 | 254 |
coll notNil ifTrue:[ |
238 | 255 |
treeView cvsEventsDisabledDo:[ |
886
3c67610b9631
after deleting a widget do select the neighbour then the parent
tz
parents:
858
diff
changeset
|
256 |
|
1015
a5d37f30faa8
multiple selection/first node=root/delete - error fixed
tz
parents:
1013
diff
changeset
|
257 |
((oldSelectedNode := (treeView model selectedNodes at: 1 ifAbsent: nil)) notNil and: |
a5d37f30faa8
multiple selection/first node=root/delete - error fixed
tz
parents:
1013
diff
changeset
|
258 |
[oldSelectedNode parent notNil]) ifTrue: [ |
887
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
259 |
oldSelectedNode parent children size <= 1 ifTrue: [ |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
260 |
newSelectedNode := oldSelectedNode parent |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
261 |
] |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
262 |
ifFalse: [ |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
263 |
newSelectedNode := oldSelectedNode parent children |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
264 |
at: (oldSelectedNode parent indexOfChild: oldSelectedNode) - 1 |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
265 |
ifAbsent: [oldSelectedNode parent children at: 2] |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
266 |
]. |
886
3c67610b9631
after deleting a widget do select the neighbour then the parent
tz
parents:
858
diff
changeset
|
267 |
]. |
887
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
268 |
self hideSelection. |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
269 |
selection := nil. |
111 | 270 |
specs := coll collect:[:aView| self fullSpecFor:aView ]. |
60 | 271 |
|
134 | 272 |
self withinTransaction:#cut objects:coll do:[ |
273 |
coll reverseDo:[:aView| |
|
274 |
self createUndoRemove:aView. |
|
887
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
275 |
self remove:aView. |
111 | 276 |
] |
277 |
]. |
|
887
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
278 |
buffered ifTrue: [self setSelection: specs]. |
886
3c67610b9631
after deleting a widget do select the neighbour then the parent
tz
parents:
858
diff
changeset
|
279 |
treeView selection: nil. |
887
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
280 |
(newSelection := (treeView model indexOf:newSelectedNode)) > 0 ifFalse: [ |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
281 |
newSelection := 1 |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
282 |
]. |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
283 |
treeView selection: (Array with: newSelection). |
886
3c67610b9631
after deleting a widget do select the neighbour then the parent
tz
parents:
858
diff
changeset
|
284 |
self setSelection:treeView selectedNode contents view withRedraw: true. |
698 | 285 |
] |
286 |
] |
|
287 |
! |
|
288 |
||
723 | 289 |
deleteTotalSelection |
887
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
290 |
"delete the selection |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
291 |
" |
79a6e12e1d0f
after deleting a widget do select the neighbour then the parent (step 2)
tz
parents:
886
diff
changeset
|
292 |
self deleteSelectionBuffered: false |
60 | 293 |
! |
294 |
||
295 |
pasteBuffer |
|
62 | 296 |
"add the objects in the paste-buffer to the object view |
60 | 297 |
" |
223 | 298 |
|sel| |
299 |
||
300 |
sel := self pasteSpecifications:(self getSelection) keepLayout:false. |
|
301 |
||
302 |
sel notNil ifTrue:[ |
|
303 |
self select:sel. |
|
304 |
]. |
|
89 | 305 |
|
306 |
! |
|
307 |
||
392 | 308 |
pasteFromClipBoard:aString |
309 |
^ self |
|
310 |
||
311 |
||
312 |
! |
|
313 |
||
1338
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
314 |
pasteKeepingPosition |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
315 |
"add the objects in the paste-buffer to the object view; |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
316 |
translate the layout as appropriate, to position the component |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
317 |
at the same absolute position (relative to topView) as before |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
318 |
" |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
319 |
|sel| |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
320 |
|
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
321 |
sel := self |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
322 |
pasteSpecifications:(self getSelection) |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
323 |
keepLayout:true |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
324 |
keepPosition:true |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
325 |
at:nil. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
326 |
|
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
327 |
sel notNil ifTrue:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
328 |
self select:sel. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
329 |
]. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
330 |
! |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
331 |
|
89 | 332 |
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout |
223 | 333 |
"add the specs to the object view; returns list of pasted components |
89 | 334 |
" |
278 | 335 |
|
336 |
^ self |
|
337 |
pasteSpecifications:aSpecificationOrList |
|
338 |
keepLayout:keepLayout |
|
339 |
at:nil |
|
340 |
||
341 |
"Modified: 11.8.1997 / 01:00:35 / cg" |
|
342 |
! |
|
343 |
||
344 |
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil |
|
345 |
"add the specs to the object view; returns list of pasted components |
|
346 |
" |
|
1338
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
347 |
self |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
348 |
pasteSpecifications:aSpecificationOrList |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
349 |
keepLayout:keepLayout |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
350 |
keepPosition:false |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
351 |
at:aPointOrNil |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
352 |
|
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
353 |
! |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
354 |
|
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
355 |
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout keepPosition:keepPosition at:aPointOrNil |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
356 |
"add the specs to the object view; returns list of pasted components |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
357 |
" |
312 | 358 |
|paste frame pasteOrigin pasteOffset builder newSel bounds| |
60 | 359 |
|
89 | 360 |
(self canPaste:aSpecificationOrList) ifFalse:[ |
223 | 361 |
^ nil |
89 | 362 |
]. |
223 | 363 |
|
776 | 364 |
aSpecificationOrList isCollection ifTrue:[ |
365 |
paste := aSpecificationOrList |
|
366 |
] ifFalse:[ |
|
367 |
paste := Array with:aSpecificationOrList |
|
368 |
]. |
|
369 |
(frame := self singleSelection) isNil ifTrue:[ |
|
370 |
frame := self |
|
371 |
]. |
|
1338
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
372 |
|
776 | 373 |
self selection:nil. |
374 |
||
375 |
newSel := OrderedCollection new. |
|
376 |
builder := UIBuilder new isEditing:true. |
|
377 |
||
378 |
className notNil ifTrue:[ |
|
379 |
builder applicationClass:(self resolveName:className) |
|
380 |
]. |
|
381 |
||
1338
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
382 |
(keepLayout not or:[keepPosition]) ifTrue:[ |
776 | 383 |
pasteOffset := 0@0. |
384 |
||
1338
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
385 |
keepPosition ifTrue:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
386 |
pasteOrigin := device translatePoint:0@0 |
776 | 387 |
from:self id |
388 |
to:frame id. |
|
1338
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
389 |
] ifFalse:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
390 |
aPointOrNil isNil ifTrue:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
391 |
pasteOrigin := self sensor mousePoint. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
392 |
pasteOrigin := device translatePoint:pasteOrigin |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
393 |
from:device rootView id |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
394 |
to:frame id. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
395 |
] ifFalse:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
396 |
pasteOrigin := device translatePoint:aPointOrNil |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
397 |
from:self id |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
398 |
to:frame id. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
399 |
] |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
400 |
]. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
401 |
|
776 | 402 |
bounds := Rectangle origin:0@0 extent:(frame bounds extent) |
403 |
]. |
|
60 | 404 |
|
776 | 405 |
paste do:[:aSpec| |
1338
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
406 |
|view newOrigin| |
395 | 407 |
|
776 | 408 |
view := self addSpec:aSpec builder:builder in:frame. |
89 | 409 |
|
1338
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
410 |
keepPosition ifTrue:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
411 |
self moveObject:view to:(view origin + pasteOrigin). |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
412 |
] ifFalse:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
413 |
keepLayout ifFalse:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
414 |
(bounds containsPoint:pasteOrigin) ifFalse:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
415 |
newOrigin := pasteOffset. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
416 |
] ifTrue:[ |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
417 |
newOrigin := pasteOrigin + pasteOffset. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
418 |
]. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
419 |
self moveObject:view to:newOrigin. |
3c1a528c50db
added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
420 |
pasteOffset := pasteOffset + 4 |
776 | 421 |
]. |
312 | 422 |
]. |
776 | 423 |
view realize. |
424 |
newSel add:view. |
|
425 |
]. |
|
60 | 426 |
|
776 | 427 |
self withinTransaction:#paste objects:newSel do:[ |
428 |
undoHistory addUndoSelector:#undoCreate: |
|
429 |
withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier]) |
|
430 |
]. |
|
60 | 431 |
|
776 | 432 |
self realizeAllSubViews. |
433 |
newSel do:[:v| v raise]. |
|
434 |
inputView raise. |
|
435 |
self elementChangedSize:frame. |
|
134 | 436 |
|
776 | 437 |
newSel size == 1 ifTrue:[newSel := newSel at:1]. |
223 | 438 |
^ newSel |
89 | 439 |
! |
440 |
||
441 |
pasteWithLayout |
|
442 |
"add the objects in the paste-buffer to the object view; don't change the |
|
443 |
layout |
|
444 |
" |
|
223 | 445 |
|sel| |
446 |
||
447 |
sel := self pasteSpecifications:(self getSelection) keepLayout:true. |
|
89 | 448 |
|
223 | 449 |
sel notNil ifTrue:[ |
450 |
self select:sel. |
|
451 |
]. |
|
60 | 452 |
! ! |
453 |
||
454 |
!UIPainterView methodsFor:'drag & drop'! |
|
455 |
||
288 | 456 |
canDrop:something |
457 |
"returns true if something can be droped |
|
698 | 458 |
" |
288 | 459 |
(something size == 1 and:[self enabled and:[self numberOfSelections <= 1]]) ifTrue:[ |
460 |
^ something first theObject isKindOf:UISpecification |
|
223 | 461 |
]. |
462 |
^ false |
|
463 |
! |
|
464 |
||
285 | 465 |
canPaste |
466 |
"returns true if something to be past exists and can be paste into |
|
467 |
the selection if exists |
|
468 |
" |
|
469 |
^ self canPaste:(self getSelection) |
|
470 |
! |
|
471 |
||
223 | 472 |
canPaste:something |
473 |
"returns true if something could be paste |
|
474 |
" |
|
475 |
|el size| |
|
476 |
||
477 |
((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[ |
|
478 |
^ false |
|
479 |
]. |
|
480 |
something isCollection ifTrue:[something notEmpty ifTrue:[el := something first]] |
|
481 |
ifFalse:[el := something]. |
|
482 |
||
483 |
(el isKindOf:UISpecification) ifFalse:[ |
|
484 |
^ false |
|
485 |
]. |
|
486 |
||
487 |
size == 1 ifTrue:[ |
|
488 |
^ self canPasteInto:(self singleSelection) |
|
489 |
]. |
|
490 |
^ true |
|
491 |
! |
|
492 |
||
493 |
canPasteInto:aView |
|
494 |
"can paste into a view |
|
495 |
" |
|
285 | 496 |
|prop| |
60 | 497 |
|
223 | 498 |
aView notNil ifTrue:[ |
285 | 499 |
(prop := self propertyRespondsToView:aView) notNil ifTrue:[ |
500 |
^ prop spec class supportsSubComponents |
|
501 |
]. |
|
502 |
^ aView specClass supportsSubComponents. |
|
89 | 503 |
]. |
504 |
^ false |
|
96
73725336b4fe
dont paste into scrollable selectionInListViews ...
Claus Gittinger <cg@exept.de>
parents:
89
diff
changeset
|
505 |
|
60 | 506 |
! |
507 |
||
508 |
drop:anObjectOrCollection at:aPoint |
|
278 | 509 |
|spec newSel oldSel dragOffset| |
510 |
||
288 | 511 |
self selection notNil ifTrue:[ |
512 |
oldSel := self singleSelection. |
|
513 |
||
514 |
(self canPasteInto:oldSel) ifFalse:[ |
|
515 |
oldSel := nil. |
|
516 |
self setSelection:nil withRedraw:true |
|
517 |
] |
|
231 | 518 |
]. |
89 | 519 |
spec := (anObjectOrCollection at:1) theObject. |
1060
0332a41de5c5
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
1058
diff
changeset
|
520 |
dragOffset := DragAndDropManager dragOffsetQuerySignal query. |
278 | 521 |
newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset. |
60 | 522 |
|
223 | 523 |
oldSel isNil ifTrue:[self select:newSel] |
524 |
ifFalse:[self select:oldSel] |
|
1060
0332a41de5c5
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
1058
diff
changeset
|
525 |
|
0332a41de5c5
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
1058
diff
changeset
|
526 |
"Modified: / 18.3.1999 / 18:29:43 / stefan" |
60 | 527 |
! ! |
528 |
||
361 | 529 |
!UIPainterView methodsFor:'event handling'! |
530 |
||
531 |
keyPress:key x:x y:y view:aView |
|
376 | 532 |
"a delegated keyEvent from aView" |
533 |
||
361 | 534 |
self keyPress:key x:x y:y |
535 |
||
376 | 536 |
"Modified: / 31.10.1997 / 20:27:22 / cg" |
361 | 537 |
! |
538 |
||
539 |
keyRelease:key x:x y:y view:aView |
|
376 | 540 |
"a delegated keyEvent from aView" |
541 |
||
361 | 542 |
self keyRelease:key x:x y:y |
543 |
||
376 | 544 |
"Modified: / 31.10.1997 / 20:27:32 / cg" |
754 | 545 |
! |
546 |
||
547 |
sizeChanged:how |
|
548 |
||
549 |
super sizeChanged:how. |
|
550 |
||
551 |
self layoutChanged |
|
361 | 552 |
! ! |
553 |
||
78 | 554 |
!UIPainterView methodsFor:'generating output'! |
555 |
||
352 | 556 |
aspectMethods |
557 |
"extract a list of aspect methods - for browsing" |
|
558 |
||
559 |
|cls methods skip selector protoSpec| |
|
560 |
||
561 |
className isNil ifTrue:[ |
|
562 |
self warn:'set the class first'. |
|
563 |
^ #() |
|
564 |
]. |
|
565 |
||
566 |
cls := self resolveName:className. |
|
567 |
methods := IdentitySet new. |
|
568 |
||
569 |
treeView propertiesDo:[:aProp| |
|
570 |
|selector| |
|
571 |
||
572 |
(selector := aProp model) notNil ifTrue:[ |
|
573 |
selector isArray ifFalse:[ |
|
574 |
selector := selector asSymbol. |
|
575 |
(cls implements:selector) ifTrue:[ |
|
576 |
skip := false. |
|
577 |
(cls isSubclassOf:SimpleDialog) ifTrue:[ |
|
578 |
skip := SimpleDialog implements:selector asSymbol |
|
579 |
]. |
|
580 |
skip ifFalse:[ |
|
581 |
methods add:(cls compiledMethodAt:selector) |
|
582 |
]. |
|
583 |
]. |
|
584 |
]. |
|
585 |
]. |
|
586 |
||
587 |
(selector := aProp menu) notNil ifTrue:[ |
|
588 |
selector isArray ifFalse:[ |
|
589 |
selector := selector asSymbol. |
|
590 |
(cls implements:selector) ifTrue:[ |
|
591 |
methods add:(cls compiledMethodAt:selector) |
|
592 |
] |
|
593 |
]. |
|
594 |
]. |
|
595 |
||
596 |
(aProp spec aspectSelectors) do:[:aSel | |
|
597 |
|selector| |
|
598 |
||
599 |
aSel isArray ifFalse:[ |
|
600 |
selector := aSel asSymbol. |
|
601 |
(cls implements:selector) ifTrue:[ |
|
602 |
methods add:(cls compiledMethodAt:selector) |
|
603 |
] |
|
604 |
]. |
|
605 |
]. |
|
606 |
aProp spec actionSelectors do:[:aSel| |
|
607 |
|selector| |
|
608 |
||
609 |
aSel isArray ifFalse:[ |
|
610 |
selector := aSel asSymbol. |
|
611 |
(cls implements:selector) ifTrue:[ |
|
612 |
methods add:(cls compiledMethodAt:selector) |
|
613 |
] |
|
614 |
]. |
|
615 |
]. |
|
616 |
aProp spec valueSelectors do:[:aSel| |
|
617 |
|selector| |
|
618 |
||
619 |
aSel isArray ifFalse:[ |
|
620 |
selector := aSel asSymbol. |
|
621 |
(cls implements:selector) ifTrue:[ |
|
622 |
methods add:(cls compiledMethodAt:selector) |
|
623 |
] |
|
624 |
]. |
|
625 |
] |
|
626 |
]. |
|
627 |
||
628 |
protoSpec := treeView canvasSpec. |
|
629 |
||
630 |
(selector := protoSpec menu) notNil ifTrue:[ |
|
631 |
selector isArray ifFalse:[ |
|
632 |
selector := selector asSymbol. |
|
633 |
(cls implements:selector) ifTrue:[ |
|
634 |
methods add:(cls compiledMethodAt:selector) |
|
635 |
] |
|
636 |
]. |
|
637 |
]. |
|
638 |
||
639 |
^ methods |
|
640 |
||
641 |
"Created: / 25.10.1997 / 18:58:25 / cg" |
|
642 |
"Modified: / 26.10.1997 / 15:06:18 / cg" |
|
643 |
! |
|
644 |
||
60 | 645 |
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass |
568 | 646 |
|selector args showIt code alreadyInSuperclass numArgs method| |
288 | 647 |
|
648 |
selector := aspect asSymbol. |
|
141 | 649 |
|
288 | 650 |
alreadyInSuperclass := targetClass superclass canUnderstand:selector. |
651 |
||
568 | 652 |
numArgs := selector numArgs. |
653 |
method := aspect. |
|
654 |
||
655 |
numArgs == 1 ifTrue:[ |
|
656 |
args := 'anArgument'. |
|
657 |
showIt := ''' , anArgument printString , '' ...''.\'. |
|
658 |
] ifFalse:[ |
|
288 | 659 |
args := ''. |
149 | 660 |
showIt := ' ...''.\'. |
568 | 661 |
|
662 |
numArgs ~~ 0 ifTrue:[ |
|
663 |
method := ''. |
|
664 |
||
665 |
selector keywords keysAndValuesDo:[:i :key| |
|
666 |
method := method, key, 'arg', i printString, ' ' |
|
667 |
] |
|
668 |
] |
|
149 | 669 |
]. |
141 | 670 |
|
288 | 671 |
code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' , |
568 | 672 |
method , args , '\' , |
352 | 673 |
' "automatically generated by UIPainter ..."\\' , |
674 |
' "*** the code below performs no action"\' , |
|
675 |
' "*** (except for some feedback on the Transcript)"\' , |
|
676 |
' "*** Please change as required and accept in the browser."\' , |
|
288 | 677 |
'\' . |
678 |
||
679 |
alreadyInSuperclass ifTrue:[ |
|
680 |
code := code , |
|
681 |
' "action for ' , aspect , ' is already provided in a superclass."\' , |
|
682 |
' "It may be redefined here ..."\\'. |
|
683 |
] ifFalse:[ |
|
684 |
code := code , |
|
685 |
' "action to be added ..."\\'. |
|
686 |
]. |
|
687 |
||
688 |
code := code , |
|
689 |
' Transcript showCR:self class name, '': '. |
|
690 |
alreadyInSuperclass ifTrue:[ |
|
691 |
code := code , 'inherited '. |
|
692 |
]. |
|
693 |
code := code , 'action for ' , aspect , showIt. |
|
694 |
||
695 |
alreadyInSuperclass ifTrue:[ |
|
696 |
code := code , |
|
697 |
' super ' , aspect , args , '.\'. |
|
698 |
]. |
|
699 |
||
700 |
code := code , |
|
701 |
'!! !!\\'. |
|
702 |
^ code withCRs |
|
703 |
||
352 | 704 |
"Modified: / 25.10.1997 / 19:18:50 / cg" |
60 | 705 |
! |
706 |
||
707 |
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass |
|
1257
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
708 |
|modelClass modelValueString modelValue modelGen code| |
134 | 709 |
|
149 | 710 |
modelClass := protoSpec defaultModelClassFor:aspect. |
1257
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
711 |
modelValueString := protoSpec defaultModelValueStringFor:aspect. |
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
712 |
modelValueString notNil ifTrue:[ |
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
713 |
modelGen := modelValueString |
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
714 |
] ifFalse:[ |
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
715 |
modelValue := protoSpec defaultModelValueFor:aspect. |
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
716 |
modelValue isNil ifTrue:[ |
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
717 |
modelGen := modelClass name , ' new' |
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
718 |
] ifFalse:[ |
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
719 |
modelGen := modelValue storeString , ' asValue' |
acb8c0a58ef3
dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
720 |
]. |
352 | 721 |
|
722 |
]. |
|
134 | 723 |
|
655
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
724 |
code := '!!' , targetClass name , ' methodsFor:''aspects''!!\\' , |
60 | 725 |
aspect , '\' , |
352 | 726 |
' "automatically generated by UIPainter ..."\\' , |
727 |
' "*** the code below creates a default model when invoked."\' , |
|
728 |
' "*** (which may not be the one you wanted)"\' , |
|
1225 | 729 |
' "*** Please change as required and accept it in the browser."\'. |
655
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
730 |
|
925
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
731 |
AspectsAsInstances ifTrue:[ |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
732 |
code := (code , '\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
733 |
' ' , aspect , ' isNil ifTrue:[\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
734 |
' ' , aspect , ' := ' , ' ' , modelGen , '.\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
735 |
' ].\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
736 |
' ^ ' , aspect ,'.\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
737 |
'!! !!\\') |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
738 |
] ifFalse:[ |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
739 |
code := (code , '\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
740 |
' |holder|\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
741 |
'\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
742 |
' (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' , |
1225 | 743 |
' holder := ', modelGen, '.\', |
744 |
' builder aspectAt:#' , aspect , ' put:holder.\', |
|
925
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
745 |
' ].\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
746 |
' ^ holder.\' , |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
747 |
'!! !!\\') |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
748 |
]. |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
749 |
^ code withCRs |
352 | 750 |
|
925
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
751 |
"Modified: / 29.7.1998 / 11:29:16 / cg" |
1225 | 752 |
"Modified: / 22.9.1999 / 12:33:47 / stefan" |
60 | 753 |
! |
754 |
||
755 |
generateAspectMethods |
|
352 | 756 |
"generate aspect, action & menu methods |
757 |
- but do not overwrite existing ones. |
|
758 |
Return a string ready to compile into the application class." |
|
759 |
||
1069 | 760 |
|cls code skip protoSpec thisCode |
925
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
761 |
definedMethodSelectors iVars t| |
858
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
762 |
|
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
763 |
definedMethodSelectors := IdentitySet new. |
60 | 764 |
|
78 | 765 |
code := ''. |
766 |
||
60 | 767 |
className isNil ifTrue:[ |
698 | 768 |
self warn:'Set first the class!!'. |
78 | 769 |
^ code |
60 | 770 |
]. |
698 | 771 |
|
772 |
(cls := self resolveName:className) isNil ifTrue:[ |
|
773 |
self warn:'Class ', className asString, ' does not exist!!'. |
|
774 |
^ code |
|
775 |
]. |
|
60 | 776 |
|
316 | 777 |
treeView propertiesDo:[:aProp| |
1069 | 778 |
|modelSelector| |
352 | 779 |
|
134 | 780 |
protoSpec := aProp spec. |
175 | 781 |
|
78 | 782 |
(modelSelector := aProp model) notNil ifTrue:[ |
698 | 783 |
self generateCodeFrom:(Array with:modelSelector) in:cls |
784 |
do:[:aSel| |
|
858
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
785 |
|sym| |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
786 |
|
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
787 |
sym := aSel asSymbol. |
352 | 788 |
skip := false. |
698 | 789 |
|
352 | 790 |
(cls isSubclassOf:SimpleDialog) ifTrue:[ |
858
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
791 |
skip := SimpleDialog implements:sym |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
792 |
]. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
793 |
(definedMethodSelectors includes:sym) ifTrue:[ |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
794 |
skip := true. |
158
6e7f892308ae
do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
795 |
]. |
698 | 796 |
|
352 | 797 |
skip ifFalse:[ |
798 |
"/ kludge .. |
|
796
05b2883a23b0
fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents:
784
diff
changeset
|
799 |
"/ (protoSpec isKindOf:ActionButtonSpec) |
05b2883a23b0
fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents:
784
diff
changeset
|
800 |
(protoSpec defaultModelIsCallBackMethodSelector:aSel) |
05b2883a23b0
fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents:
784
diff
changeset
|
801 |
ifTrue:[ |
698 | 802 |
thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls). |
352 | 803 |
] ifFalse:[ |
698 | 804 |
thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls). |
352 | 805 |
]. |
858
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
806 |
code := code, thisCode. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
807 |
definedMethodSelectors add:sym. |
1030
0b9fbaecbe88
output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents:
1029
diff
changeset
|
808 |
] ifTrue:[ |
0b9fbaecbe88
output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents:
1029
diff
changeset
|
809 |
Transcript showCR:'no code generated for aspect: ' , sym , ' (method already exists)' |
698 | 810 |
] |
811 |
] |
|
62 | 812 |
]. |
813 |
||
698 | 814 |
self generateCodeFrom:(aProp spec aspectSelectors) in:cls |
815 |
do:[:aSel| |
|
858
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
816 |
|sym| |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
817 |
|
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
818 |
sym := aSel asSymbol. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
819 |
(definedMethodSelectors includes:sym) ifFalse:[ |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
820 |
thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls). |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
821 |
code := code , thisCode. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
822 |
definedMethodSelectors add:sym. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
823 |
] |
698 | 824 |
]. |
825 |
||
826 |
self generateCodeFrom:(aProp spec actionSelectors) in:cls |
|
827 |
do:[:aSel| |
|
858
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
828 |
|sym| |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
829 |
|
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
830 |
sym := aSel asSymbol. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
831 |
(definedMethodSelectors includes:sym) ifFalse:[ |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
832 |
thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls). |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
833 |
code := code , thisCode. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
834 |
definedMethodSelectors add:sym. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
835 |
] |
698 | 836 |
]. |
837 |
||
838 |
self generateCodeFrom:(aProp spec valueSelectors) in:cls |
|
839 |
do:[:aSel| |
|
858
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
840 |
|sym| |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
841 |
|
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
842 |
sym := aSel asSymbol. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
843 |
(definedMethodSelectors includes:sym) ifFalse:[ |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
844 |
"/ uppercase: - assume its a globals name. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
845 |
aSel first isUppercase ifFalse:[ |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
846 |
thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls). |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
847 |
code := code , thisCode. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
848 |
definedMethodSelectors add:sym. |
6b2e9e31cf06
do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents:
796
diff
changeset
|
849 |
] |
376 | 850 |
] |
698 | 851 |
]. |
316 | 852 |
]. |
853 |
||
925
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
854 |
AspectsAsInstances ifTrue:[ |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
855 |
iVars := cls instVarNames asOrderedCollection. |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
856 |
definedMethodSelectors do:[:ivar | |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
857 |
(iVars includes:ivar) ifFalse:[ |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
858 |
iVars add:ivar |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
859 |
] |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
860 |
]. |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
861 |
iVars := iVars asArray. |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
862 |
t := cls shallowCopy. |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
863 |
t setInstanceVariableString:iVars asStringCollection asString. |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
864 |
code := (t definition) , '!!\' withCRs , code. |
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
865 |
]. |
352 | 866 |
^ code |
698 | 867 |
|
925
e6ddd46581c3
added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
868 |
"Modified: / 29.7.1998 / 12:21:19 / cg" |
698 | 869 |
! |
870 |
||
871 |
generateCodeFrom:aListOfSelectors in:aClass do:aBlock |
|
872 |
||
744 | 873 |
self class redefineAspectMethods ifTrue:[ |
698 | 874 |
aListOfSelectors do:[:aSelector| |
875 |
(aSelector isArray or:[aClass implements:aSelector]) ifFalse:[ |
|
876 |
aBlock value:aSelector |
|
1030
0b9fbaecbe88
output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents:
1029
diff
changeset
|
877 |
] ifTrue:[ |
0b9fbaecbe88
output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents:
1029
diff
changeset
|
878 |
Transcript showCR:'#' , aSelector , ' skipped - already implemented in the class' |
698 | 879 |
] |
880 |
] |
|
881 |
] ifFalse:[ |
|
882 |
aListOfSelectors do:[:aSelector| |
|
1092
60e029255679
oops - failed to generate code for constant-list-holders.
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
883 |
aSelector isArray ifFalse:[ |
60e029255679
oops - failed to generate code for constant-list-holders.
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
884 |
(aClass canUnderstand:aSelector) ifFalse:[ |
60e029255679
oops - failed to generate code for constant-list-holders.
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
885 |
aBlock value:aSelector |
60e029255679
oops - failed to generate code for constant-list-holders.
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
886 |
] ifTrue:[ |
60e029255679
oops - failed to generate code for constant-list-holders.
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
887 |
Transcript showCR:'#' , aSelector , ' skipped - already implemented in the class (or superclass)' |
60e029255679
oops - failed to generate code for constant-list-holders.
Claus Gittinger <cg@exept.de>
parents:
1084
diff
changeset
|
888 |
] |
698 | 889 |
] |
890 |
] |
|
891 |
] |
|
892 |
||
893 |
||
376 | 894 |
! |
895 |
||
896 |
generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass |
|
897 |
^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' , |
|
898 |
selectorSpec , '\' , |
|
899 |
' "automatically generated by UIPainter ..."\\' , |
|
900 |
' "*** the code here does nothing. It is invoked when"\' , |
|
901 |
' "*** ' , commentWhen , '"\' , |
|
902 |
' "*** Please change as required and accept in the browser."\' , |
|
903 |
'\' , |
|
904 |
' "specific code to be added below ..."\' , |
|
905 |
' "' , (noteOrNil ? '') , '"\' , |
|
906 |
'\' , |
|
907 |
(defaultCode ? '^ self.') , |
|
908 |
'!! !!\\') withCRs |
|
909 |
||
910 |
"Modified: / 25.10.1997 / 19:22:17 / cg" |
|
911 |
"Created: / 31.10.1997 / 17:31:53 / cg" |
|
912 |
! |
|
913 |
||
914 |
generateHookMethods |
|
915 |
"generate hook methods |
|
916 |
- but do not overwrite existing ones. |
|
917 |
Return a string ready to compile into the application class." |
|
918 |
||
1069 | 919 |
|cls code| |
376 | 920 |
|
921 |
code := ''. |
|
922 |
||
923 |
className isNil ifTrue:[ |
|
924 |
self warn:'set the class first'. |
|
925 |
^ code |
|
926 |
]. |
|
927 |
cls := self resolveName:className. |
|
928 |
||
929 |
code := code , (self generateHookMethodsInClass:cls). |
|
930 |
||
931 |
^ code |
|
932 |
||
933 |
"Created: / 31.10.1997 / 17:21:29 / cg" |
|
934 |
"Modified: / 31.10.1997 / 17:38:11 / cg" |
|
935 |
! |
|
936 |
||
937 |
generateHookMethodsInClass:targetClass |
|
938 |
|code| |
|
939 |
||
940 |
code := ''. |
|
941 |
||
942 |
(targetClass implements:#postBuildWith:) ifFalse:[ |
|
943 |
code := code |
|
944 |
, (self |
|
945 |
generateHookMethodFor:'postBuildWith:aBuilder' |
|
946 |
comment:'the widgets have been built, but before the view is opened' |
|
708 | 947 |
note:'or after the super send' |
948 |
defaultCode:' super postBuildWith:aBuilder' |
|
376 | 949 |
inClass:targetClass) |
950 |
]. |
|
951 |
(targetClass implements:#postOpenWith:) ifFalse:[ |
|
952 |
code := code |
|
953 |
, (self |
|
954 |
generateHookMethodFor:'postOpenWith:aBuilder' |
|
955 |
comment:'the topView has been opened, but before events are dispatched for it' |
|
708 | 956 |
note:'or after the super send' |
957 |
defaultCode:' super postOpenWith:aBuilder' |
|
376 | 958 |
inClass:targetClass) |
959 |
]. |
|
960 |
(targetClass implements:#closeRequest) ifFalse:[ |
|
961 |
code := code |
|
962 |
, (self |
|
963 |
generateHookMethodFor:'closeRequest' |
|
964 |
comment:'the topView has been asked to close' |
|
965 |
note:'return without the ''super closeRequest'' to stay open' |
|
708 | 966 |
defaultCode:' ^super closeRequest' |
376 | 967 |
inClass:targetClass) |
968 |
]. |
|
969 |
^ code |
|
970 |
||
971 |
"Modified: / 31.10.1997 / 17:30:34 / cg" |
|
972 |
"Created: / 31.10.1997 / 17:32:49 / cg" |
|
316 | 973 |
! |
974 |
||
965
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
975 |
generateMenuMethodFor:menuSel inClass:targetClass |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
976 |
|selector args showIt code alreadyInSuperclass numArgs method| |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
977 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
978 |
selector := menuSel asSymbol. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
979 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
980 |
alreadyInSuperclass := targetClass superclass canUnderstand:selector. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
981 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
982 |
code := '!!' , targetClass name , ' methodsFor:''menu actions''!!\\'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
983 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
984 |
selector = 'openAboutThisApplication' ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
985 |
code := code , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
986 |
'openAboutThisApplication\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
987 |
' "opens an about box for this application."\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
988 |
' "automatically generated by UIPainter ..."\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
989 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
990 |
' |rev box myClass clsRev image msg|\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
991 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
992 |
' rev := ''''.\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
993 |
' myClass := self class.\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
994 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
995 |
' (clsRev := myClass revision) notNil ifTrue:[\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
996 |
' rev := '' (rev: '', clsRev printString, '')''].\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
997 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
998 |
' msg := Character cr asString , myClass name asBoldText, rev.\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
999 |
' msg := (msg , ''\\*** add more info here ***\\'') withCRs.\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1000 |
' box := AboutBox title:msg.\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1001 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1002 |
' "/ *** add a #defaultIcon method in the class\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1003 |
' "/ *** and uncomment the following line:\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1004 |
' "/ image := self class defaultIcon.\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1005 |
' image notNil ifTrue:[\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1006 |
' box image:image\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1007 |
' ].\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1008 |
' box label:(resources string:''About %1'' with:myClass name).\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1009 |
' box autoHideAfter:10 with:[].\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1010 |
' box showAtPointer.\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1011 |
'!! !!\\'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1012 |
^ code withCRs |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1013 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1014 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1015 |
selector = 'menuOpen' ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1016 |
code := code , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1017 |
'menuOpen\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1018 |
' "automatically generated by UIPainter ..."\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1019 |
' "*** the code below opens a dialog for file selection"\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1020 |
' "*** and invokes the #doOpen: method with the selected file."\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1021 |
' "*** Please change as required and accept in the browser."\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1022 |
' |file|\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1023 |
' file :=\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1024 |
' (FileSelectionBrowser\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1025 |
' request: ''Open''\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1026 |
' fileName: ''''\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1027 |
' "/ inDirectory: lastOpenDirectory\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1028 |
' withFileFilters: #(''*'')).\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1029 |
' file notNil ifTrue:[\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1030 |
' "/ lastOpenDirectory := file asFilename directory.\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1031 |
' self doOpen:file\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1032 |
' ]\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1033 |
'!! !!\'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1034 |
^ code withCRs |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1035 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1036 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1037 |
numArgs := selector numArgs. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1038 |
method := selector. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1039 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1040 |
numArgs == 1 ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1041 |
args := 'anArgument'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1042 |
showIt := ''' , anArgument printString , '' ...''.\'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1043 |
] ifFalse:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1044 |
args := ''. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1045 |
showIt := ' ...''.\'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1046 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1047 |
numArgs ~~ 0 ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1048 |
method := ''. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1049 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1050 |
selector keywords keysAndValuesDo:[:i :key| |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1051 |
method := method, key, 'arg', i printString, ' ' |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1052 |
] |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1053 |
] |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1054 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1055 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1056 |
code := code , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1057 |
method , args , '\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1058 |
' "automatically generated by UIPainter ..."\\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1059 |
' "*** the code below performs no action"\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1060 |
' "*** (except for some feedback on the Transcript)"\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1061 |
' "*** Please change as required and accept in the browser."\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1062 |
'\' . |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1063 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1064 |
alreadyInSuperclass ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1065 |
code := code , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1066 |
' "action for ' , selector , ' is already provided in a superclass."\' , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1067 |
' "It may be redefined here ..."\\'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1068 |
] ifFalse:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1069 |
code := code , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1070 |
' "action to be added ..."\\'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1071 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1072 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1073 |
code := code , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1074 |
' Transcript showCR:self class name, '': '. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1075 |
alreadyInSuperclass ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1076 |
code := code , 'inherited '. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1077 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1078 |
code := code , 'menu action for ' , selector , showIt. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1079 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1080 |
alreadyInSuperclass ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1081 |
code := code , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1082 |
' super ' , selector , args , '.\'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1083 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1084 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1085 |
code := code , |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1086 |
'!! !!\\'. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1087 |
^ code withCRs |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1088 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1089 |
"Created: / 23.8.1998 / 16:46:51 / cg" |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1090 |
"Modified: / 23.8.1998 / 18:13:05 / cg" |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1091 |
! |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1092 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1093 |
generateMenuMethods |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1094 |
"generate menu methods |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1095 |
- but do not overwrite existing ones. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1096 |
Return a string ready to compile into the application class." |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1097 |
|
1069 | 1098 |
|cls code menuSelector thisCode |
1099 |
definedMethodSelectors |
|
965
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1100 |
specArray fullSpec winSpec menuSpec |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1101 |
| |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1102 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1103 |
className isNil ifTrue:[ |
1069 | 1104 |
self warn:'Define the class first !!'. |
1105 |
^ nil |
|
965
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1106 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1107 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1108 |
(cls := self resolveName:className) isNil ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1109 |
self warn:'Class ', className asString, ' does not exist!!'. |
1069 | 1110 |
^ nil |
965
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1111 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1112 |
|
1058 | 1113 |
specArray := treeView generateFullSpecForComponents:#() named:nil. |
965
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1114 |
fullSpec := specArray decodeAsLiteralArray. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1115 |
winSpec := fullSpec window. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1116 |
menuSelector := winSpec menu. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1117 |
|
1069 | 1118 |
(menuSelector notNil |
1119 |
and:[ (cls respondsTo:menuSelector) ]) ifFalse:[ |
|
965
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1120 |
self warn:'No menu defined (yet)'. |
1069 | 1121 |
^ nil. |
965
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1122 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1123 |
menuSpec := cls perform:menuSelector. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1124 |
menuSpec := menuSpec decodeAsLiteralArray. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1125 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1126 |
definedMethodSelectors := IdentitySet new. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1127 |
code := ''. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1128 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1129 |
menuSpec allItemsDo:[:item | |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1130 |
|sel| |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1131 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1132 |
(sel := item value) notNil ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1133 |
(definedMethodSelectors includes:sel) ifFalse:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1134 |
self generateCodeFrom:(Array with:sel) in:cls do:[:aSel| |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1135 |
thisCode := (self generateMenuMethodFor:aSel inClass:cls). |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1136 |
code := code, thisCode. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1137 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1138 |
definedMethodSelectors add:sel. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1139 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1140 |
] |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1141 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1142 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1143 |
(definedMethodSelectors includes:#menuOpen) ifTrue:[ |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1144 |
self generateCodeFrom:(Array with:#doOpen:) in:cls do:[:aSel| |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1145 |
thisCode := (self generateMenuMethodFor:aSel inClass:cls). |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1146 |
code := code, thisCode. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1147 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1148 |
]. |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1149 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1150 |
^ code |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1151 |
|
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1152 |
"Created: / 23.8.1998 / 16:12:09 / cg" |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1153 |
"Modified: / 23.8.1998 / 18:12:23 / cg" |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1154 |
! |
4f786b46a569
added menu-action code generation
Claus Gittinger <cg@exept.de>
parents:
925
diff
changeset
|
1155 |
|
188
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1156 |
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1157 |
^ ('!!' , targetClass name , ' methodsFor:''values''!!\\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1158 |
aspect , '\' , |
352 | 1159 |
' "automatically generated by UIPainter ..."\\' , |
1160 |
' "*** the code below returns a default value when invoked."\' , |
|
1161 |
' "*** (which may not be the one you wanted)"\' , |
|
1162 |
' "*** Please change as required and accept in the browser."\' , |
|
188
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1163 |
'\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1164 |
' "value to be added below ..."\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1165 |
' Transcript showCR:self class name , '': no value yet for ' , aspect , ' ...''.\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1166 |
'\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1167 |
'^ nil.' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1168 |
'!! !!\\') withCRs |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1169 |
|
352 | 1170 |
"Modified: / 25.10.1997 / 19:22:17 / cg" |
188
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1171 |
! |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
1172 |
|
78 | 1173 |
generateWindowSpecMethodSource |
457 | 1174 |
|spec str code category cls mthd specCode| |
60 | 1175 |
|
310 | 1176 |
spec := OrderedCollection new. |
60 | 1177 |
|
78 | 1178 |
self subViews do:[:aView| |
1191 | 1179 |
|vSpec| |
1180 |
||
78 | 1181 |
aView ~~ inputView ifTrue:[ |
1191 | 1182 |
"/ care for wrapped views ... |
1183 |
vSpec := self fullSpecFor:aView. |
|
1184 |
vSpec isNil ifTrue:[ |
|
1185 |
aView subViews size == 1 ifTrue:[ |
|
1186 |
vSpec := self fullSpecFor:(aView subViews first). |
|
1187 |
] |
|
1188 |
]. |
|
1189 |
vSpec isNil ifTrue:[ |
|
1190 |
self warn:'Oops - could not create spec for some view' |
|
1191 |
]. |
|
1192 |
spec add:vSpec |
|
60 | 1193 |
] |
1194 |
]. |
|
1058 | 1195 |
|
1196 |
spec := treeView generateFullSpecForComponents:spec named:methodName. |
|
310 | 1197 |
str := WriteStream on:String new. |
1198 |
UISpecification prettyPrintSpecArray:spec on:str indent:5. |
|
464 | 1199 |
specCode := str contents. |
457 | 1200 |
|
1201 |
(specCode includes:$!!) ifTrue:[ |
|
1202 |
"/ oops - must be chunk format ... |
|
1203 |
str := WriteStream on:String new. |
|
1204 |
str nextPutAllAsChunk:specCode. |
|
1205 |
specCode := str contents. |
|
1206 |
]. |
|
60 | 1207 |
|
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
1208 |
"/ if that method already exists, do not overwrite the category |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
1209 |
|
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
1210 |
category := 'interface specs'. |
330 | 1211 |
cls := self resolveName:className. |
1212 |
||
1213 |
cls notNil ifTrue:[ |
|
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
1214 |
(mthd := cls class compiledMethodAt:methodName asSymbol) notNil ifTrue:[ |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
1215 |
category := mthd category. |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
1216 |
] |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
1217 |
]. |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
1218 |
|
238 | 1219 |
code := '!!' |
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
1220 |
, className , ' class methodsFor:' , category storeString |
238 | 1221 |
, '!!' , '\\' |
60 | 1222 |
|
1223 |
, methodName , '\' |
|
742 | 1224 |
, ((ResourceSpecEditor codeGenerationCommentForClass: UIPainter) replChar:$!! withString:'!!!!') |
1225 |
, '\\ "\' |
|
1013 | 1226 |
, (' UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\'). |
1227 |
||
1050
355a8ff451b6
care for as-yet-unspecified class in show-spec menu item.
Claus Gittinger <cg@exept.de>
parents:
1039
diff
changeset
|
1228 |
(cls notNil and:[cls isSubclassOf:ApplicationModel]) ifTrue:[ |
1013 | 1229 |
code := code |
1230 |
, (' ' , className , ' new openInterface:#' , methodName , '\'). |
|
1231 |
]. |
|
1232 |
||
1233 |
code := code |
|
742 | 1234 |
,(methodName = 'windowSpec' |
1235 |
ifTrue:[' ' , className , ' open\'] ifFalse: ['']) |
|
60 | 1236 |
, ' "\'. |
1237 |
||
1238 |
code := code |
|
1239 |
, '\' |
|
1240 |
, ' <resource: #canvas>\\' |
|
1084 | 1241 |
, ' ^ ' , specCode |
60 | 1242 |
, '\' |
238 | 1243 |
, '!! !!' |
60 | 1244 |
, '\\'. |
1245 |
||
1246 |
^ code withCRs |
|
1247 |
||
1013 | 1248 |
"Modified: / 5.9.1995 / 21:01:35 / claus" |
1249 |
"Modified: / 15.10.1998 / 11:29:53 / cg" |
|
60 | 1250 |
! ! |
1251 |
||
754 | 1252 |
!UIPainterView methodsFor:'grid manipulation'! |
1253 |
||
1254 |
newGrid |
|
1255 |
"define a new grid - this is a private helper which has to be |
|
1256 |
called after any change in the grid. It (re)creates the gridPixmap, |
|
1257 |
clears the view and redraws all visible objects." |
|
1258 |
||
1259 |
|defaultViewBackground| |
|
1260 |
||
1261 |
gridPixmap := nil. |
|
1262 |
defaultViewBackground := self class defaultViewBackgroundColor. |
|
1263 |
||
1264 |
shown ifTrue:[ |
|
1265 |
self viewBackground: (defaultViewBackground isColor |
|
1266 |
ifTrue: [defaultViewBackground] |
|
1267 |
ifFalse:[Black]). |
|
1268 |
self clear. |
|
1269 |
]. |
|
1270 |
||
1271 |
gridShown ifTrue:[ |
|
1272 |
self defineGrid. |
|
1273 |
gridPixmap colorMap: (defaultViewBackground isColor |
|
1274 |
ifTrue: [Array with:defaultViewBackground with:Color darkGray] |
|
1275 |
ifFalse:[Array with:White with:Black]). |
|
1276 |
self viewBackground:gridPixmap. |
|
1277 |
]. |
|
1278 |
||
1279 |
self invalidate |
|
1280 |
||
1281 |
! ! |
|
1282 |
||
60 | 1283 |
!UIPainterView methodsFor:'initialization'! |
1284 |
||
770 | 1285 |
create |
1286 |
"colors on device |
|
1287 |
" |
|
1288 |
super create. |
|
1289 |
||
1201 | 1290 |
handleColor := handleColor onDevice:device. |
1291 |
handleMasterColor := handleMasterColor onDevice:device. |
|
770 | 1292 |
! |
1293 |
||
60 | 1294 |
initialize |
62 | 1295 |
"setup attributes |
1296 |
" |
|
60 | 1297 |
super initialize. |
770 | 1298 |
superclassName := 'ApplicationModel'. |
1299 |
className := 'NewApplication'. |
|
1300 |
methodName := 'windowSpec'. |
|
1301 |
categoryName := 'Applications'. |
|
1302 |
HandCursor := Cursor leftHand. |
|
1303 |
handleColor := Color black. |
|
1304 |
handleMasterColor := Color red. |
|
60 | 1305 |
|
712 | 1306 |
self backgroundColor: self class defaultViewBackgroundColor. |
60 | 1307 |
! |
1308 |
||
1309 |
setupFromSpec:specOrSpecArray |
|
784 | 1310 |
|
78 | 1311 |
|spec builder| |
60 | 1312 |
|
784 | 1313 |
Cursor wait showWhile: [ |
1314 |
self removeAll. |
|
1029 | 1315 |
specOrSpecArray notNil ifTrue:[ |
1316 |
spec := UISpecification from:specOrSpecArray. |
|
1317 |
]. |
|
784 | 1318 |
builder := UIBuilder new isEditing:true. |
1319 |
"set applicationClass, in order that subspecifications may be resolved" |
|
1320 |
className notNil ifTrue:[ |
|
1321 |
builder applicationClass:(self resolveName:className). |
|
1322 |
]. |
|
1029 | 1323 |
spec notNil ifTrue:[ |
1324 |
spec window setupView:self topView for:builder. |
|
1325 |
self addSpec:(spec component) builder:builder in:self. |
|
1326 |
]. |
|
784 | 1327 |
self realizeAllSubViews. |
1328 |
inputView raise. |
|
1029 | 1329 |
spec notNil ifTrue:[ |
1330 |
treeView setAttributesFromWindowSpec:(spec window) |
|
1331 |
] |
|
784 | 1332 |
] |
1333 |
||
223 | 1334 |
! |
1335 |
||
1336 |
treeView:aTreeView |
|
361 | 1337 |
treeView := aTreeView. |
1338 |
||
1339 |
treeView delegate:( |
|
376 | 1340 |
"/ |
1341 |
"/ I want to handle everything typed |
|
1342 |
"/ in the treeView, except for Return and Cursor-keys |
|
1343 |
"/ |
|
1344 |
KeyboardForwarder |
|
1345 |
toView:self |
|
1346 |
condition:nil |
|
1347 |
filter:[:k | (k isSymbol |
|
1348 |
and:[k ~~ #Return |
|
1308 | 1349 |
and:[k ~~ #Tab |
1350 |
and:[(k startsWith:#Cursor) not]]]) |
|
376 | 1351 |
] |
361 | 1352 |
) |
1353 |
||
376 | 1354 |
"Modified: / 31.10.1997 / 20:22:09 / cg" |
60 | 1355 |
! ! |
1356 |
||
1357 |
!UIPainterView methodsFor:'menus'! |
|
1358 |
||
121 | 1359 |
showMiddleButtonMenu |
1360 |
"show the middle button menu; this returns nil |
|
62 | 1361 |
" |
223 | 1362 |
self enabled ifTrue:[ |
754 | 1363 |
(MenuPanel fromSpec:(UIPainter menuEdit) receiver:self superView application) startUp |
111 | 1364 |
]. |
121 | 1365 |
^ nil |
60 | 1366 |
|
62 | 1367 |
|
1368 |
||
60 | 1369 |
! ! |
1370 |
||
754 | 1371 |
!UIPainterView methodsFor:'private handles'! |
1372 |
||
1373 |
showSelected:aComponent |
|
1374 |
"show object selected |
|
1375 |
" |
|
1039 | 1376 |
|wasClipped sel hColor| |
754 | 1377 |
|
1378 |
selectionHiddenLevel == 0 ifTrue:[ |
|
995 | 1379 |
sel := treeView selection. |
1380 |
(sel size > 1 and: |
|
1381 |
[(treeView model list at: sel first) contents view == aComponent]) |
|
1039 | 1382 |
ifTrue: [hColor := handleMasterColor] |
1383 |
ifFalse:[hColor := handleColor]. |
|
1384 |
||
1385 |
self paint:hColor. |
|
754 | 1386 |
|
1387 |
(wasClipped := clipChildren) ifTrue:[ |
|
1388 |
self clippedByChildren:(clipChildren := false). |
|
1389 |
]. |
|
1390 |
||
1391 |
self handlesOf:aComponent do:[:rectangle :what| |
|
1392 |
what == #view ifTrue:[self displayRectangle:rectangle] |
|
1393 |
ifFalse:[self fillRectangle:rectangle] |
|
1394 |
]. |
|
1395 |
||
1396 |
wasClipped ifTrue:[ |
|
1397 |
self clippedByChildren:(clipChildren := true). |
|
1398 |
] |
|
1399 |
] |
|
1400 |
||
1401 |
||
1402 |
! ! |
|
1403 |
||
335 | 1404 |
!UIPainterView methodsFor:'queries'! |
1405 |
||
1406 |
resolveName:aName |
|
1407 |
|appl| |
|
1408 |
||
1409 |
appl := self application. |
|
1410 |
||
1411 |
appl notNil ifTrue:[ |
|
1412 |
^ appl resolveName:aName |
|
1413 |
]. |
|
1414 |
^ Smalltalk resolveName:aName inClass:self class |
|
1415 |
! ! |
|
1416 |
||
60 | 1417 |
!UIPainterView methodsFor:'removing components'! |
1418 |
||
78 | 1419 |
remove:anObject |
1420 |
"remove anObject from the contents do redraw |
|
60 | 1421 |
" |
134 | 1422 |
anObject notNil ifTrue:[ |
238 | 1423 |
treeView removeView:anObject. |
134 | 1424 |
] |
60 | 1425 |
! |
1426 |
||
1427 |
removeAll |
|
62 | 1428 |
"remove all objects and properties |
1429 |
" |
|
776 | 1430 |
self select:nil. |
1431 |
treeView removeAll. |
|
1432 |
self removeUndoHistory. |
|
60 | 1433 |
! ! |
1434 |
||
1435 |
!UIPainterView methodsFor:'searching'! |
|
1436 |
||
285 | 1437 |
findContainerOfView:aView |
1438 |
"returns the super view assigned to a view |
|
89 | 1439 |
" |
285 | 1440 |
|p| |
89 | 1441 |
|
285 | 1442 |
(p := self propertyOfParentForView:aView) isNil ifTrue:[ |
89 | 1443 |
^ self |
1444 |
]. |
|
285 | 1445 |
^ p view |
89 | 1446 |
! |
1447 |
||
60 | 1448 |
findObjectAt:aPoint |
1449 |
"find the origin/corner of the currentWidget |
|
1450 |
" |
|
285 | 1451 |
|view prop| |
60 | 1452 |
|
1453 |
view := super findObjectAt:aPoint. |
|
285 | 1454 |
prop := self propertyRespondsToView:view. |
60 | 1455 |
|
285 | 1456 |
prop notNil ifTrue:[^ prop view]. |
1457 |
^ nil |
|
60 | 1458 |
! |
1459 |
||
1460 |
findViewWithId:aViewId |
|
62 | 1461 |
"finds view assigned to identifier and returns the view or nil |
60 | 1462 |
" |
1463 |
|prop| |
|
1464 |
||
1465 |
prop := self propertyOfIdentifier:aViewId. |
|
1466 |
||
1467 |
prop notNil ifTrue:[^ prop view] |
|
1468 |
ifFalse:[^ nil] |
|
78 | 1469 |
! |
1470 |
||
1471 |
propertyOfIdentifier:anId |
|
1472 |
"returns property assigned to unique identifier |
|
1473 |
" |
|
1474 |
anId notNil ifTrue:[ |
|
238 | 1475 |
^ treeView propertyDetect:[:p| p identifier == anId ] |
78 | 1476 |
]. |
1477 |
^ nil |
|
1478 |
! |
|
1479 |
||
1480 |
propertyOfName:aString |
|
1481 |
"returns property assigned to name |
|
1482 |
" |
|
111 | 1483 |
|name| |
1484 |
||
1485 |
aString isNil ifFalse:[ |
|
1486 |
name := aString string withoutSeparators. |
|
238 | 1487 |
^ treeView propertyDetect:[:p| p name = name ]. |
78 | 1488 |
]. |
1489 |
^ nil |
|
1490 |
! |
|
1491 |
||
285 | 1492 |
propertyOfParentForView:aSubView |
1493 |
"returns the property of the parent or nil |
|
1494 |
" |
|
1495 |
|item| |
|
1496 |
||
1497 |
(item := treeView detectItemRespondsToView:aSubView) notNil ifTrue:[ |
|
1498 |
(item := item parent) notNil ifTrue:[^ item contents] |
|
1499 |
]. |
|
1500 |
^ nil |
|
1501 |
! |
|
1502 |
||
78 | 1503 |
propertyOfView:aView |
1504 |
"returns property assigned to view |
|
1505 |
" |
|
1506 |
(aView isNil or:[aView == self]) ifFalse:[ |
|
238 | 1507 |
^ treeView propertyDetect:[:p| p view == aView ] |
78 | 1508 |
]. |
1509 |
^ nil |
|
1510 |
! |
|
1511 |
||
285 | 1512 |
propertyRespondsToView:aView |
1513 |
"detect the property responding to the argument a view. The property of the view or |
|
1514 |
the first subview providing the properties is returned. If no property is detected |
|
1515 |
nil is returned. |
|
1516 |
" |
|
1517 |
|item| |
|
1518 |
||
1519 |
item := treeView detectItemRespondsToView:aView. |
|
1520 |
||
1521 |
(item notNil and:[item parent notNil]) ifTrue:[ |
|
1522 |
^ item contents |
|
1523 |
]. |
|
1524 |
^ nil |
|
1525 |
! |
|
1526 |
||
111 | 1527 |
uniqueNameFor:aSpecOrString |
78 | 1528 |
"generate and return an unique name for a class |
1529 |
" |
|
1530 |
|next name size| |
|
1531 |
||
712 | 1532 |
aSpecOrString isString ifFalse:[name := aSpecOrString userFriendlyName] |
111 | 1533 |
ifTrue:[name := aSpecOrString]. |
78 | 1534 |
|
111 | 1535 |
size := name size + 1. |
1536 |
next := 0. |
|
78 | 1537 |
|
238 | 1538 |
treeView propertiesDo:[:p| |
111 | 1539 |
|n| |
78 | 1540 |
n := p name. |
1541 |
||
1542 |
(n size >= size and:[n startsWith:name]) ifTrue:[ |
|
1543 |
next := next max:(p extractNumberStartingAt:size) |
|
1544 |
] |
|
1545 |
]. |
|
1546 |
next := next + 1. |
|
1547 |
name := name, next printString. |
|
1548 |
^ name |
|
1549 |
||
1550 |
||
1551 |
||
662 | 1552 |
|
78 | 1553 |
! |
1554 |
||
1555 |
uniqueNameOf:aView |
|
111 | 1556 |
|prop| |
78 | 1557 |
|
111 | 1558 |
(prop := self propertyOfView:aView) notNil ifTrue:[ |
1559 |
prop name isNil ifTrue:[ |
|
1560 |
prop name:(self uniqueNameFor:(prop spec)). |
|
1561 |
]. |
|
1562 |
^ prop name |
|
78 | 1563 |
]. |
111 | 1564 |
^ 'self' |
78 | 1565 |
|
60 | 1566 |
! ! |
1567 |
||
223 | 1568 |
!UIPainterView methodsFor:'selection basics'! |
1569 |
||
1570 |
addToSelection:anObject |
|
1571 |
"add an object to the selection |
|
1572 |
" |
|
1573 |
(self enabled and:[(self isSelected:anObject) not]) ifTrue:[ |
|
1574 |
selection isCollection ifFalse:[ |
|
1575 |
selection isNil ifTrue:[ |
|
1576 |
selection := anObject |
|
1577 |
] ifFalse:[ |
|
1578 |
selection := OrderedCollection with:selection with:anObject |
|
1579 |
] |
|
1580 |
] ifTrue:[ |
|
1347
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1581 |
"/ to enforce the change-message (value is identical to oldValue) |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1582 |
selection isList ifTrue:[ |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1583 |
selection add:anObject |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1584 |
] ifFalse:[ |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1585 |
selection := selection asOrderedCollection. |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1586 |
selection := selection copyWith:anObject |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1587 |
] |
223 | 1588 |
]. |
1589 |
self showSelected:anObject. |
|
238 | 1590 |
treeView cvsSelectionAdd:anObject. |
223 | 1591 |
] |
1592 |
||
1347
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1593 |
"Modified: / 11.2.2000 / 01:39:05 / cg" |
223 | 1594 |
! |
1595 |
||
1596 |
removeFromSelection:anObject |
|
1597 |
"remove an object from the selection |
|
1598 |
" |
|
1599 |
(self isSelected:anObject) ifTrue:[ |
|
1600 |
self showUnselected:anObject. |
|
1601 |
||
1602 |
selection size > 1 ifTrue:[ |
|
1347
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1603 |
selection isList ifTrue:[ |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1604 |
selection remove:anObject ifAbsent:nil |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1605 |
] ifFalse:[ |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1606 |
"/ to enforce the change-message (value is identical to oldValue) |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1607 |
selection := selection asOrderedCollection. |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1608 |
selection := selection copyWithout:anObject |
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1609 |
]. |
223 | 1610 |
self showSelection. |
1611 |
] ifFalse:[ |
|
1612 |
selection := nil |
|
1613 |
]. |
|
238 | 1614 |
treeView cvsSelectionRemove:anObject. |
223 | 1615 |
] |
1616 |
||
1347
c4046d0b638e
care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents:
1338
diff
changeset
|
1617 |
"Modified: / 11.2.2000 / 01:41:11 / cg" |
223 | 1618 |
! |
1619 |
||
1620 |
select:something |
|
1621 |
"change selection to something |
|
886
3c67610b9631
after deleting a widget do select the neighbour then the parent
tz
parents:
858
diff
changeset
|
1622 |
" |
760 | 1623 |
(self enabled and:[something ~= self selection]) ifTrue:[ |
1624 |
something isNil |
|
1625 |
ifTrue: [treeView selection: (Array with: 1)] |
|
1626 |
ifFalse:[treeView cvsSelection:something]. |
|
886
3c67610b9631
after deleting a widget do select the neighbour then the parent
tz
parents:
858
diff
changeset
|
1627 |
self setSelection:something withRedraw:true |
223 | 1628 |
] |
1629 |
||
1630 |
! |
|
1631 |
||
285 | 1632 |
updateSelectionFromModel:aSelOrNil |
223 | 1633 |
"update selection from a new selection |
1634 |
" |
|
768 | 1635 |
|aSet| |
1636 |
||
223 | 1637 |
selectionHiddenLevel == 0 ifTrue:[ |
285 | 1638 |
aSelOrNil size ~~ 0 ifTrue:[ |
768 | 1639 |
self selectionDo:[:el| |
1640 |
(aSelOrNil includes:el) ifFalse:[ |
|
1641 |
aSet isNil ifTrue:[ |
|
1642 |
aSet := IdentitySet new |
|
1643 |
]. |
|
1644 |
self showUnselected:el addAffectedViewsTo:aSet. |
|
1645 |
] |
|
1646 |
]. |
|
1647 |
self handleAffectedViews:aSet. |
|
285 | 1648 |
] ifFalse:[ |
768 | 1649 |
self hideSelection. |
285 | 1650 |
] |
223 | 1651 |
]. |
285 | 1652 |
self setSelection:aSelOrNil withRedraw:false. |
223 | 1653 |
self showSelection |
1654 |
||
1655 |
! ! |
|
1656 |
||
78 | 1657 |
!UIPainterView methodsFor:'specification'! |
1658 |
||
1659 |
addSpec:aSpecification builder:aBuilder in:aFrame |
|
1660 |
"build view and subviews from aSpecification into a frame. The top view |
|
1661 |
is returned. The contained components of a spec are set to nil |
|
1662 |
" |
|
330 | 1663 |
|cls| |
212 | 1664 |
|
330 | 1665 |
cls := self resolveName:className. |
1666 |
||
1667 |
cls notNil ifTrue:[ |
|
1668 |
aBuilder applicationClass:cls. |
|
212 | 1669 |
]. |
78 | 1670 |
|
111 | 1671 |
aBuilder componentCreationHook:[:aView :aSpec :aBdr||sv p s n| |
78 | 1672 |
p := ViewProperty new. |
1673 |
s := aSpec copy. |
|
1674 |
p spec:s. |
|
1675 |
p view:aView. |
|
1676 |
||
1677 |
s class supportsSubComponents ifTrue:[ |
|
1678 |
s component:nil |
|
1679 |
]. |
|
1680 |
||
111 | 1681 |
n := s name. |
1682 |
||
1683 |
(n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[ |
|
1684 |
s name:(self uniqueNameFor:s) |
|
78 | 1685 |
]. |
238 | 1686 |
treeView addProperty:p. |
78 | 1687 |
]. |
1688 |
||
1689 |
^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame. |
|
60 | 1690 |
|
212 | 1691 |
"Modified: 4.7.1997 / 23:48:55 / cg" |
78 | 1692 |
! |
1693 |
||
1694 |
fullSpecFor:anObject |
|
1695 |
"generate a full spec for an object |
|
62 | 1696 |
" |
78 | 1697 |
|mySpec subSpecs| |
1698 |
||
1699 |
mySpec := self specFor:anObject. |
|
1700 |
||
1701 |
(mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[ |
|
1702 |
(anObject subViews notNil) ifTrue:[ |
|
1703 |
anObject subViews do:[:aSubView||spec| |
|
1704 |
spec := self fullSpecFor:aSubView. |
|
1705 |
spec notNil ifTrue:[ |
|
1706 |
subSpecs isNil ifTrue:[ |
|
1707 |
subSpecs := OrderedCollection new |
|
1708 |
]. |
|
1709 |
subSpecs add:spec. |
|
1710 |
]. |
|
1711 |
]. |
|
1712 |
subSpecs notNil ifTrue:[ |
|
1713 |
mySpec component:(SpecCollection new collection:subSpecs) |
|
1714 |
] |
|
1715 |
] |
|
1716 |
]. |
|
1717 |
^ mySpec |
|
1718 |
||
60 | 1719 |
|
1720 |
||
1721 |
||
1722 |
||
1723 |
||
1724 |
! |
|
1725 |
||
1173 | 1726 |
rebuildView:aView fromSpec:aSpec withBuilder:aBuilderOrNil |
1727 |
|v builder| |
|
1728 |
||
1729 |
(builder := aBuilderOrNil) isNil ifTrue:[ |
|
1730 |
"/ create a dummy builder |
|
1731 |
builder := UIBuilder new isEditing:true. |
|
1732 |
className notNil ifTrue:[ |
|
1733 |
builder applicationClass:(self resolveName:className). |
|
1734 |
]. |
|
1735 |
]. |
|
285 | 1736 |
|
1252
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1737 |
aSpec class isLayoutContainer ifTrue:[ |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1738 |
"/ TODO: |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1739 |
"/ go through subviews and let them resize to their default/preferred |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1740 |
"/ needed if we change a containers layout from fit to non-fit. |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1741 |
|
1258 | 1742 |
(aView subViews ? #()) do:[:aSubView | |
1252
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1743 |
|fix spec prop| |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1744 |
|
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1745 |
(prop := self propertyOfView:aSubView) notNil ifTrue:[ |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1746 |
spec := prop spec. |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1747 |
|
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1748 |
spec useDefaultExtent ifTrue:[ |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1749 |
fix := aSubView sizeFixed:false. |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1750 |
aSubView extent:aSubView preferredExtent. |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1751 |
aSubView sizeFixed:fix |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1752 |
] |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1753 |
] |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1754 |
]. |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1755 |
]. |
f886528c2b35
when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents:
1230
diff
changeset
|
1756 |
|
285 | 1757 |
aSpec needsRebuildForAttributes ifTrue:[ |
1173 | 1758 |
"/ needs a full rebuild (in case view class depends upon spec-attribute) |
1759 |
v := aSpec buildViewWithLayoutFor:builder in:(self findContainerOfView:aView). |
|
285 | 1760 |
v realize. |
1761 |
aView destroy. |
|
1762 |
device sync. |
|
1763 |
device flush. |
|
1764 |
aView becomeSameAs:v. |
|
1765 |
inputView raise. |
|
1766 |
] ifFalse:[ |
|
1173 | 1767 |
aSpec setAttributesIn:aView with:builder. |
285 | 1768 |
self elementChangedSize:aView. |
1769 |
]. |
|
1770 |
||
1771 |
! |
|
1772 |
||
78 | 1773 |
specFor:anObject |
1774 |
"returns spec assigned to an object |
|
62 | 1775 |
" |
78 | 1776 |
|prop spec| |
60 | 1777 |
|
78 | 1778 |
(prop := self propertyOfView:anObject) notNil ifTrue:[ |
1779 |
spec := prop spec copy. |
|
1780 |
spec layoutFromView:anObject |
|
60 | 1781 |
]. |
78 | 1782 |
^ spec |
1783 |
||
1784 |
||
1785 |
||
60 | 1786 |
! |
1787 |
||
146 | 1788 |
specForSelection |
1789 |
"returns spec assigned to current single selection or nil |
|
1790 |
" |
|
1791 |
^ self specFor:(self singleSelection) |
|
1792 |
||
1793 |
||
1794 |
! |
|
1795 |
||
78 | 1796 |
updateFromSpec:aSpec |
1797 |
"update current selected view from specification |
|
62 | 1798 |
" |
1173 | 1799 |
|props name| |
78 | 1800 |
|
281 | 1801 |
aSpec class == WindowSpec ifTrue:[ |
698 | 1802 |
^ treeView canvasSpec:aSpec |
281 | 1803 |
]. |
1804 |
||
78 | 1805 |
self singleSelection notNil ifTrue:[ |
1806 |
self withSelectionHiddenDo:[ |
|
1807 |
self transaction:#specification selectionDo:[:aView| |
|
1808 |
props := self propertyOfView:aView. |
|
82 | 1809 |
name := (aSpec name) withoutSeparators. |
78 | 1810 |
|
82 | 1811 |
name = props name ifFalse:[ |
1812 |
(self propertyOfName:name) notNil ifTrue:[ |
|
1813 |
name := props name |
|
78 | 1814 |
] |
1815 |
]. |
|
82 | 1816 |
aSpec name:name. |
134 | 1817 |
self createUndoSpecModify:props. |
1173 | 1818 |
self rebuildView:aView fromSpec:aSpec withBuilder:nil. |
78 | 1819 |
props spec:(aSpec copy). |
238 | 1820 |
treeView propertyChanged:props. |
78 | 1821 |
] |
111 | 1822 |
] |
82 | 1823 |
] |
212 | 1824 |
|
1825 |
"Modified: 4.7.1997 / 23:49:44 / cg" |
|
60 | 1826 |
! ! |
1827 |
||
285 | 1828 |
!UIPainterView methodsFor:'testing'! |
1829 |
||
1830 |
canChangeLayoutOfView:aView |
|
1831 |
"returns true if the view can change its layout which is dependant on |
|
1832 |
its parent view. |
|
1833 |
" |
|
1834 |
|item prnt| |
|
1835 |
||
1836 |
( (item := treeView itemOfView:aView) isNil |
|
1837 |
or:[(prnt := item parent) isNil] |
|
1838 |
) ifTrue:[ |
|
1839 |
^ false |
|
1840 |
]. |
|
1841 |
^ (prnt parent isNil or:[prnt contents spec class isLayoutContainer not]) |
|
1842 |
! |
|
1843 |
||
1230
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1844 |
canExchangeSelectionLayouts |
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1845 |
"returns true if the selection size is exactly 2 |
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1846 |
and all elements in the selection can be moved or aligned |
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1847 |
" |
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1848 |
selection size == 2 ifFalse:[ |
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1849 |
^ false |
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1850 |
]. |
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1851 |
^ self canMoveOrAlignSelection |
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1852 |
|
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1853 |
! |
23e5d0c133e8
added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
1854 |
|
285 | 1855 |
canKeepLayoutInSelection |
1856 |
"returns true if layout can be kept during a paste operation |
|
1857 |
" |
|
1858 |
|prop| |
|
1859 |
||
1860 |
prop := self propertyOfView:(self singleSelection). |
|
1861 |
^ (prop isNil or:[prop spec class isLayoutContainer not]) |
|
1862 |
! |
|
1863 |
||
1864 |
canMove:something |
|
1865 |
"checks whether something is not nil and if all widgets derived from |
|
1866 |
something can change their layout ( move, align, ... operation ). |
|
1867 |
" |
|
1868 |
something notNil ifTrue:[ |
|
1869 |
self forEach:something do:[:aView| |
|
1870 |
(self canChangeLayoutOfView:aView) ifFalse:[^ false] |
|
1871 |
]. |
|
1872 |
^ true |
|
1873 |
]. |
|
1874 |
^ false |
|
1875 |
! |
|
1876 |
||
1877 |
canMoveOrAlignSelection |
|
1878 |
"returns true if a selection exists and all elements in the selection |
|
1879 |
can be moved or aligned |
|
1880 |
" |
|
1881 |
^ self canMove:(self selection) |
|
1882 |
||
1883 |
! ! |
|
1884 |
||
60 | 1885 |
!UIPainterView methodsFor:'transaction'! |
1886 |
||
1887 |
transaction:aType objects:something do:aOneArgBlock |
|
1888 |
"opens a transaction and evaluates a block within the transaction; the |
|
1889 |
argument to the block is a view from derived from something |
|
1890 |
" |
|
134 | 1891 |
self withinTransaction:aType objects:something do:[ |
1892 |
self forEach:something do:aOneArgBlock |
|
60 | 1893 |
] |
1894 |
! |
|
1895 |
||
134 | 1896 |
withinTransaction:aType objects:objects do:aNoneArgBlock |
1897 |
"evaluate a block with no arguments within a transaction |
|
60 | 1898 |
" |
134 | 1899 |
|text size prop| |
1900 |
||
1901 |
objects isNil ifTrue:[ ^ self ]. |
|
1902 |
||
1903 |
size := objects size. |
|
60 | 1904 |
|
134 | 1905 |
objects isCollection ifTrue:[ |
1906 |
size == 0 ifTrue:[ ^ self ]. |
|
1907 |
size == 1 ifTrue:[ prop := self propertyOfView:(objects first) ] |
|
1908 |
] ifFalse:[ |
|
1909 |
prop := self propertyOfView:objects |
|
1910 |
]. |
|
60 | 1911 |
|
134 | 1912 |
prop notNil ifTrue:[ |
1913 |
text := prop name |
|
1914 |
] ifFalse:[ |
|
1915 |
text := size printString, ' elements' |
|
60 | 1916 |
]. |
134 | 1917 |
|
1918 |
undoHistory withinTransaction:aType text:text do:[ |
|
1919 |
aNoneArgBlock value |
|
1920 |
] |
|
60 | 1921 |
! ! |
1922 |
||
1923 |
!UIPainterView methodsFor:'undo actions'! |
|
1924 |
||
134 | 1925 |
createUndoLayout:aView |
1926 |
"create undo action before changing a views layout |
|
60 | 1927 |
" |
134 | 1928 |
|lyt args prop| |
60 | 1929 |
|
1930 |
undoHistory isTransactionOpen ifTrue:[ |
|
1931 |
prop := self propertyOfView:aView. |
|
134 | 1932 |
|
60 | 1933 |
prop notNil ifTrue:[ |
134 | 1934 |
args := Array new:3. |
1935 |
args at:1 put:(prop identifier). |
|
1936 |
||
1937 |
(lyt := aView geometryLayout) notNil ifTrue:[ |
|
1938 |
args at:2 put:#geometryLayout: |
|
1939 |
] ifFalse:[ |
|
146 | 1940 |
lyt := aView extent. |
134 | 1941 |
args at:2 put:#extent: |
1942 |
]. |
|
1943 |
args at:3 put:(lyt copy). |
|
1944 |
undoHistory addUndoSelector:#undoLayout: withArgs:args. |
|
60 | 1945 |
] |
1946 |
] |
|
1947 |
! |
|
1948 |
||
134 | 1949 |
createUndoRemove:aView |
1950 |
"create undo method before deleting views |
|
60 | 1951 |
" |
285 | 1952 |
|prop pid| |
134 | 1953 |
|
1954 |
(prop := self propertyOfView:aView) notNil ifTrue:[ |
|
285 | 1955 |
(pid := self propertyOfParentForView:aView) notNil ifTrue:[ |
1956 |
pid := pid identifier |
|
1957 |
]. |
|
60 | 1958 |
|
134 | 1959 |
undoHistory addUndoSelector:#undoRemove: |
285 | 1960 |
withArgs:(Array with:(self fullSpecFor:aView) |
1961 |
with:(prop identifier) |
|
1962 |
with:pid) |
|
134 | 1963 |
] |
1964 |
! |
|
60 | 1965 |
|
134 | 1966 |
createUndoSpecModify:aProp |
1967 |
"undo method when changing the specification for an object |
|
1968 |
" |
|
1969 |
aProp notNil ifTrue:[ |
|
1970 |
undoHistory addUndoSelector:#undoSpecModify: |
|
1971 |
withArgs:(Array with:(aProp spec) with:(aProp identifier)) |
|
1972 |
] |
|
1973 |
! |
|
60 | 1974 |
|
134 | 1975 |
undoCreate:something |
1976 |
"undo method for creating or pasting an object |
|
1977 |
" |
|
1978 |
self forEach:something do:[:anId|self remove:(self findViewWithId:anId)]. |
|
1979 |
! |
|
60 | 1980 |
|
134 | 1981 |
undoLayout:args |
1982 |
"undo method to set the old layout; see 'createUndoLayout:' |
|
1983 |
" |
|
1984 |
|view| |
|
1985 |
||
1986 |
(view := self findViewWithId:(args at:1)) notNil ifTrue:[ |
|
146 | 1987 |
view perform:(args at:2) with:(args at:3). |
223 | 1988 |
self layoutChanged. |
60 | 1989 |
] |
1990 |
! |
|
1991 |
||
134 | 1992 |
undoRemove:args |
1993 |
"undo method when removing an object; see 'createUndoRemove:' |
|
1994 |
" |
|
1995 |
|frame prop view| |
|
1996 |
||
1997 |
(args at:3) notNil ifTrue:[ |
|
1998 |
frame := self findViewWithId:(args at:3). |
|
1999 |
]. |
|
2000 |
frame isNil ifTrue:[ |
|
2001 |
frame := self |
|
2002 |
]. |
|
395 | 2003 |
view := self addSpec:(args at:1) builder:(UIBuilder new isEditing:true) in:frame. |
134 | 2004 |
view realize. |
2005 |
inputView raise. |
|
2006 |
||
2007 |
prop := self propertyOfView:view. |
|
2008 |
prop identifier:(args at:2). |
|
2009 |
||
2010 |
! |
|
2011 |
||
2012 |
undoSpecModify:args |
|
2013 |
"undo method when changing a spec; see 'createUndoSpecModify:' |
|
60 | 2014 |
" |
1173 | 2015 |
|view spec props| |
60 | 2016 |
|
134 | 2017 |
props := self propertyOfIdentifier:(args at:2). |
60 | 2018 |
|
134 | 2019 |
props notNil ifTrue:[ |
2020 |
view := props view. |
|
2021 |
spec := args at:1. |
|
395 | 2022 |
|
134 | 2023 |
props spec:spec. |
1173 | 2024 |
self rebuildView:view fromSpec:spec withBuilder:nil. |
238 | 2025 |
treeView propertyChanged:props. |
211 | 2026 |
] |
2027 |
! ! |
|
2028 |
||
2029 |
!UIPainterView::ViewProperty class methodsFor:'instance creation'! |
|
2030 |
||
2031 |
new |
|
2032 |
Identifier notNil ifTrue:[Identifier := Identifier + 1] |
|
2033 |
ifFalse:[Identifier := 1]. |
|
2034 |
||
2035 |
^ self basicNew initialize |
|
2036 |
! ! |
|
2037 |
||
2038 |
!UIPainterView::ViewProperty methodsFor:'accessing'! |
|
2039 |
||
2040 |
identifier |
|
2041 |
"return the unique identifier assigned to property |
|
2042 |
" |
|
2043 |
^ identifier |
|
2044 |
! |
|
2045 |
||
2046 |
identifier:anIdentifier |
|
2047 |
"set the unique identifier assigned to property; called after an restore of |
|
2048 |
a deleted instance |
|
2049 |
" |
|
2050 |
identifier := anIdentifier |
|
2051 |
! |
|
2052 |
||
2053 |
spec |
|
2054 |
"return the value of the instance variable 'spec' (automatically generated)" |
|
2055 |
||
2056 |
^ spec! |
|
2057 |
||
2058 |
spec:something |
|
2059 |
"set the value of the instance variable 'spec' (automatically generated)" |
|
2060 |
||
2061 |
spec := something.! |
|
2062 |
||
2063 |
view |
|
2064 |
"return the value of the instance variable 'view' (automatically generated)" |
|
2065 |
||
2066 |
^ view! |
|
2067 |
||
2068 |
view:something |
|
2069 |
"set the value of the instance variable 'view' (automatically generated)" |
|
2070 |
||
2071 |
view := something.! ! |
|
2072 |
||
2073 |
!UIPainterView::ViewProperty methodsFor:'initialization'! |
|
2074 |
||
2075 |
initialize |
|
2076 |
super initialize. |
|
2077 |
identifier := Identifier |
|
2078 |
! ! |
|
2079 |
||
2080 |
!UIPainterView::ViewProperty methodsFor:'misc'! |
|
2081 |
||
2082 |
extractNumberStartingAt:anIndex |
|
2083 |
"return the number from the name starting at anIndex or 0. |
|
2084 |
" |
|
2085 |
|val| |
|
2086 |
||
2087 |
val := 0. |
|
2088 |
||
2089 |
self name from:anIndex do:[:c| |
|
2090 |
c isDigit ifTrue:[val := val * 10 + c digitValue] |
|
2091 |
ifFalse:[^ 0] |
|
2092 |
]. |
|
2093 |
^ val |
|
2094 |
||
2095 |
! ! |
|
2096 |
||
2097 |
!UIPainterView::ViewProperty methodsFor:'spec messages'! |
|
2098 |
||
2099 |
doesNotUnderstand:aMessage |
|
2100 |
spec notNil ifTrue:[ |
|
2101 |
(spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec] |
|
2102 |
]. |
|
2103 |
^ nil |
|
2104 |
! |
|
2105 |
||
2106 |
layout |
|
2107 |
spec layout |
|
2108 |
! |
|
2109 |
||
2110 |
layout:aLayout |
|
2111 |
spec layout:aLayout |
|
2112 |
! |
|
2113 |
||
2114 |
name |
|
2115 |
^ spec name |
|
2116 |
! |
|
2117 |
||
2118 |
name:aName |
|
2119 |
spec name:aName |
|
2120 |
! ! |
|
2121 |
||
60 | 2122 |
!UIPainterView class methodsFor:'documentation'! |
2123 |
||
2124 |
version |
|
2125 |
^ '$Header$' |
|
2126 |
! ! |
|
1225 | 2127 |
UIPainterView initialize! |