author | tz |
Sun, 19 Apr 1998 00:56:50 +0200 | |
changeset 784 | 9ae2b94658e5 |
parent 776 | 1df0525eeec9 |
child 796 | 05b2883a23b0 |
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' |
742 | 16 |
classVariableNames:'HandCursor RedefineAspectMethods' |
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 |
||
698 | 59 |
!UIPainterView class methodsFor:'code generation mode'! |
60 |
||
742 | 61 |
redefineAspectMethods |
698 | 62 |
"redefine methods yes or no. If a method is defined in super class |
63 |
should the message be reinstalled ? |
|
64 |
" |
|
742 | 65 |
^ RedefineAspectMethods ? false |
698 | 66 |
|
67 |
! |
|
68 |
||
742 | 69 |
redefineAspectMethods:aBoolean |
698 | 70 |
"redefine methods yes or no. If a method is defined in super class |
71 |
should the message be reinstalled ? |
|
72 |
" |
|
742 | 73 |
RedefineAspectMethods := aBoolean |
698 | 74 |
|
75 |
||
76 |
! ! |
|
77 |
||
60 | 78 |
!UIPainterView class methodsFor:'defaults'! |
79 |
||
80 |
defaultMenuMessage |
|
81 |
"This message is the default yo be sent to the menuHolder to get a menu |
|
82 |
" |
|
121 | 83 |
^ #showMiddleButtonMenu |
60 | 84 |
|
85 |
||
86 |
! ! |
|
87 |
||
88 |
!UIPainterView methodsFor:'accessing'! |
|
89 |
||
90 |
application |
|
91 |
^ nil |
|
92 |
||
93 |
"Modified: 6.9.1995 / 00:46:44 / claus" |
|
94 |
! |
|
95 |
||
78 | 96 |
applicationName |
97 |
^ self className |
|
98 |
! |
|
99 |
||
100 |
applicationName:aName |
|
101 |
self className:aName |
|
102 |
! |
|
103 |
||
60 | 104 |
className |
105 |
^ className |
|
106 |
! |
|
107 |
||
78 | 108 |
className:aName |
109 |
className := aName |
|
60 | 110 |
! |
111 |
||
112 |
className:aClassName superclassName:aSuperclassName selector:aSelector |
|
78 | 113 |
className := aClassName. |
60 | 114 |
superclassName := aSuperclassName. |
78 | 115 |
methodName := aSelector. |
60 | 116 |
|
117 |
! |
|
118 |
||
223 | 119 |
findInputViewIn:aSuperView |
120 |
"returns index of input view into superview or nil |
|
121 |
" |
|
122 |
aSuperView == self ifTrue:[ |
|
123 |
^ self subViews findFirst:[:v| v == inputView ] |
|
124 |
]. |
|
125 |
^ 0 |
|
126 |
! |
|
127 |
||
128 |
inputView |
|
129 |
^ inputView |
|
111 | 130 |
! |
131 |
||
60 | 132 |
methodName |
133 |
^ methodName |
|
134 |
! |
|
135 |
||
78 | 136 |
methodName:aName |
137 |
methodName := aName |
|
60 | 138 |
! |
139 |
||
140 |
selectNames:aStringOrCollection |
|
141 |
|prop coll s| |
|
142 |
||
143 |
(aStringOrCollection isNil or:[aStringOrCollection isEmpty]) ifTrue:[ |
|
131 | 144 |
^ self select:nil |
60 | 145 |
]. |
146 |
||
147 |
(s := aStringOrCollection) isString ifFalse:[ |
|
148 |
s size == 1 ifTrue:[ |
|
149 |
s := s first |
|
150 |
] ifFalse:[ |
|
151 |
coll := OrderedCollection new. |
|
152 |
||
153 |
s do:[:aName| |
|
154 |
(prop := self propertyOfName:aName) notNil ifTrue:[ |
|
155 |
coll add:(prop view) |
|
156 |
] |
|
157 |
]. |
|
158 |
coll size == 1 ifTrue:[ ^ self select:(coll at:1) ]. |
|
131 | 159 |
coll size == 0 ifTrue:[ ^ self select:nil ]. |
60 | 160 |
|
161 |
^ self select:coll. |
|
162 |
] |
|
163 |
]. |
|
164 |
||
165 |
prop := self propertyOfName:s. |
|
131 | 166 |
prop isNil ifTrue:[^ self select:nil] |
60 | 167 |
ifFalse:[^ self select:(prop view)] |
168 |
||
169 |
! ! |
|
170 |
||
111 | 171 |
!UIPainterView methodsFor:'change & update'! |
172 |
||
223 | 173 |
layoutChanged |
754 | 174 |
|
238 | 175 |
treeView layoutChanged |
111 | 176 |
! ! |
177 |
||
60 | 178 |
!UIPainterView methodsFor:'copy & cut & paste'! |
179 |
||
180 |
copySelection |
|
181 |
"copy the selection into the cut&paste-buffer |
|
182 |
" |
|
698 | 183 |
|specs coll sel| |
184 |
||
185 |
sel := treeView selection. |
|
71 | 186 |
|
128 | 187 |
coll := self minSetOfSuperViews:(self selection). |
60 | 188 |
|
71 | 189 |
coll notNil ifTrue:[ |
776 | 190 |
"/ self select:nil. |
78 | 191 |
specs := coll collect:[:aView| self fullSpecFor:aView ]. |
698 | 192 |
self setSelection:specs. |
776 | 193 |
"/ treeView selection: sel |
60 | 194 |
]. |
78 | 195 |
|
196 |
||
60 | 197 |
! |
198 |
||
723 | 199 |
deleteSelection |
698 | 200 |
"cut the selection into the cut&paste-buffer |
62 | 201 |
and open a transaction |
60 | 202 |
" |
134 | 203 |
|specs coll| |
71 | 204 |
|
128 | 205 |
coll := self minSetOfSuperViews:(self selection). |
60 | 206 |
|
78 | 207 |
coll notNil ifTrue:[ |
238 | 208 |
treeView cvsEventsDisabledDo:[ |
131 | 209 |
self select:nil. |
111 | 210 |
specs := coll collect:[:aView| self fullSpecFor:aView ]. |
60 | 211 |
|
134 | 212 |
self withinTransaction:#cut objects:coll do:[ |
213 |
coll reverseDo:[:aView| |
|
214 |
self createUndoRemove:aView. |
|
215 |
self remove:aView |
|
111 | 216 |
] |
217 |
]. |
|
218 |
self setSelection:specs. |
|
698 | 219 |
treeView selection: (Array with: 1) |
220 |
] |
|
221 |
] |
|
222 |
! |
|
223 |
||
723 | 224 |
deleteTotalSelection |
698 | 225 |
"delete the selection; copy the selection into the cut&paste-buffer |
226 |
and open a transaction |
|
227 |
" |
|
228 |
|specs coll| |
|
229 |
||
230 |
coll := self minSetOfSuperViews:(self selection). |
|
231 |
||
232 |
coll notNil ifTrue:[ |
|
233 |
treeView cvsEventsDisabledDo:[ |
|
234 |
self select:nil. |
|
235 |
specs := coll collect:[:aView| self fullSpecFor:aView ]. |
|
236 |
||
237 |
self withinTransaction:#cut objects:coll do:[ |
|
238 |
coll reverseDo:[:aView| |
|
239 |
self remove:aView |
|
240 |
] |
|
241 |
]. |
|
242 |
treeView selection: (Array with: 1) |
|
111 | 243 |
] |
60 | 244 |
] |
245 |
! |
|
246 |
||
247 |
pasteBuffer |
|
62 | 248 |
"add the objects in the paste-buffer to the object view |
60 | 249 |
" |
223 | 250 |
|sel| |
251 |
||
252 |
sel := self pasteSpecifications:(self getSelection) keepLayout:false. |
|
253 |
||
254 |
sel notNil ifTrue:[ |
|
255 |
self select:sel. |
|
256 |
]. |
|
89 | 257 |
|
258 |
! |
|
259 |
||
392 | 260 |
pasteFromClipBoard:aString |
261 |
^ self |
|
262 |
||
263 |
||
264 |
! |
|
265 |
||
89 | 266 |
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout |
223 | 267 |
"add the specs to the object view; returns list of pasted components |
89 | 268 |
" |
278 | 269 |
|
270 |
^ self |
|
271 |
pasteSpecifications:aSpecificationOrList |
|
272 |
keepLayout:keepLayout |
|
273 |
at:nil |
|
274 |
||
275 |
"Modified: 11.8.1997 / 01:00:35 / cg" |
|
276 |
! |
|
277 |
||
278 |
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil |
|
279 |
"add the specs to the object view; returns list of pasted components |
|
280 |
" |
|
312 | 281 |
|paste frame pasteOrigin pasteOffset builder newSel bounds| |
60 | 282 |
|
89 | 283 |
(self canPaste:aSpecificationOrList) ifFalse:[ |
223 | 284 |
^ nil |
89 | 285 |
]. |
223 | 286 |
|
776 | 287 |
aSpecificationOrList isCollection ifTrue:[ |
288 |
paste := aSpecificationOrList |
|
289 |
] ifFalse:[ |
|
290 |
paste := Array with:aSpecificationOrList |
|
291 |
]. |
|
292 |
(frame := self singleSelection) isNil ifTrue:[ |
|
293 |
frame := self |
|
294 |
]. |
|
295 |
self selection:nil. |
|
296 |
||
297 |
newSel := OrderedCollection new. |
|
298 |
builder := UIBuilder new isEditing:true. |
|
299 |
||
300 |
className notNil ifTrue:[ |
|
301 |
builder applicationClass:(self resolveName:className) |
|
302 |
]. |
|
303 |
||
304 |
keepLayout ifFalse:[ |
|
305 |
pasteOffset := 0@0. |
|
306 |
||
307 |
aPointOrNil isNil ifTrue:[ |
|
308 |
pasteOrigin := self sensor mousePoint. |
|
309 |
pasteOrigin := device translatePoint:pasteOrigin |
|
310 |
from:device rootView id |
|
311 |
to:frame id. |
|
165 | 312 |
] ifFalse:[ |
776 | 313 |
pasteOrigin := device translatePoint:aPointOrNil |
314 |
from:self id |
|
315 |
to:frame id. |
|
316 |
] |
|
317 |
]. |
|
318 |
keepLayout ifFalse:[ |
|
319 |
bounds := Rectangle origin:0@0 extent:(frame bounds extent) |
|
320 |
]. |
|
60 | 321 |
|
776 | 322 |
paste do:[:aSpec| |
323 |
|view| |
|
395 | 324 |
|
776 | 325 |
view := self addSpec:aSpec builder:builder in:frame. |
89 | 326 |
|
165 | 327 |
keepLayout ifFalse:[ |
776 | 328 |
(bounds containsPoint:pasteOrigin) ifFalse:[ |
329 |
self moveObject:view to:pasteOffset. |
|
330 |
] ifTrue:[ |
|
331 |
self moveObject:view to:pasteOrigin + pasteOffset. |
|
332 |
]. |
|
333 |
pasteOffset := pasteOffset + 4 |
|
312 | 334 |
]. |
776 | 335 |
view realize. |
336 |
newSel add:view. |
|
337 |
]. |
|
60 | 338 |
|
776 | 339 |
self withinTransaction:#paste objects:newSel do:[ |
340 |
undoHistory addUndoSelector:#undoCreate: |
|
341 |
withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier]) |
|
342 |
]. |
|
60 | 343 |
|
776 | 344 |
self realizeAllSubViews. |
345 |
newSel do:[:v| v raise]. |
|
346 |
inputView raise. |
|
347 |
self elementChangedSize:frame. |
|
134 | 348 |
|
776 | 349 |
newSel size == 1 ifTrue:[newSel := newSel at:1]. |
223 | 350 |
^ newSel |
89 | 351 |
! |
352 |
||
353 |
pasteWithLayout |
|
354 |
"add the objects in the paste-buffer to the object view; don't change the |
|
355 |
layout |
|
356 |
" |
|
223 | 357 |
|sel| |
358 |
||
359 |
sel := self pasteSpecifications:(self getSelection) keepLayout:true. |
|
89 | 360 |
|
223 | 361 |
sel notNil ifTrue:[ |
362 |
self select:sel. |
|
363 |
]. |
|
60 | 364 |
! ! |
365 |
||
366 |
!UIPainterView methodsFor:'drag & drop'! |
|
367 |
||
288 | 368 |
canDrop:something |
369 |
"returns true if something can be droped |
|
698 | 370 |
" |
288 | 371 |
(something size == 1 and:[self enabled and:[self numberOfSelections <= 1]]) ifTrue:[ |
372 |
^ something first theObject isKindOf:UISpecification |
|
223 | 373 |
]. |
374 |
^ false |
|
375 |
! |
|
376 |
||
285 | 377 |
canPaste |
378 |
"returns true if something to be past exists and can be paste into |
|
379 |
the selection if exists |
|
380 |
" |
|
381 |
^ self canPaste:(self getSelection) |
|
382 |
! |
|
383 |
||
223 | 384 |
canPaste:something |
385 |
"returns true if something could be paste |
|
386 |
" |
|
387 |
|el size| |
|
388 |
||
389 |
((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[ |
|
390 |
^ false |
|
391 |
]. |
|
392 |
something isCollection ifTrue:[something notEmpty ifTrue:[el := something first]] |
|
393 |
ifFalse:[el := something]. |
|
394 |
||
395 |
(el isKindOf:UISpecification) ifFalse:[ |
|
396 |
^ false |
|
397 |
]. |
|
398 |
||
399 |
size == 1 ifTrue:[ |
|
400 |
^ self canPasteInto:(self singleSelection) |
|
401 |
]. |
|
402 |
^ true |
|
403 |
! |
|
404 |
||
405 |
canPasteInto:aView |
|
406 |
"can paste into a view |
|
407 |
" |
|
285 | 408 |
|prop| |
60 | 409 |
|
223 | 410 |
aView notNil ifTrue:[ |
285 | 411 |
(prop := self propertyRespondsToView:aView) notNil ifTrue:[ |
412 |
^ prop spec class supportsSubComponents |
|
413 |
]. |
|
414 |
^ aView specClass supportsSubComponents. |
|
89 | 415 |
]. |
416 |
^ false |
|
96
73725336b4fe
dont paste into scrollable selectionInListViews ...
Claus Gittinger <cg@exept.de>
parents:
89
diff
changeset
|
417 |
|
60 | 418 |
! |
419 |
||
420 |
drop:anObjectOrCollection at:aPoint |
|
278 | 421 |
|spec newSel oldSel dragOffset| |
422 |
||
288 | 423 |
self selection notNil ifTrue:[ |
424 |
oldSel := self singleSelection. |
|
425 |
||
426 |
(self canPasteInto:oldSel) ifFalse:[ |
|
427 |
oldSel := nil. |
|
428 |
self setSelection:nil withRedraw:true |
|
429 |
] |
|
231 | 430 |
]. |
89 | 431 |
spec := (anObjectOrCollection at:1) theObject. |
278 | 432 |
dragOffset := DragAndDropManager dragOffsetQuerySignal raise. |
433 |
newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset. |
|
60 | 434 |
|
223 | 435 |
oldSel isNil ifTrue:[self select:newSel] |
436 |
ifFalse:[self select:oldSel] |
|
60 | 437 |
! ! |
438 |
||
361 | 439 |
!UIPainterView methodsFor:'event handling'! |
440 |
||
441 |
keyPress:key x:x y:y view:aView |
|
376 | 442 |
"a delegated keyEvent from aView" |
443 |
||
361 | 444 |
self keyPress:key x:x y:y |
445 |
||
376 | 446 |
"Modified: / 31.10.1997 / 20:27:22 / cg" |
361 | 447 |
! |
448 |
||
449 |
keyRelease:key x:x y:y view:aView |
|
376 | 450 |
"a delegated keyEvent from aView" |
451 |
||
361 | 452 |
self keyRelease:key x:x y:y |
453 |
||
376 | 454 |
"Modified: / 31.10.1997 / 20:27:32 / cg" |
754 | 455 |
! |
456 |
||
457 |
sizeChanged:how |
|
458 |
||
459 |
super sizeChanged:how. |
|
460 |
||
461 |
self layoutChanged |
|
361 | 462 |
! ! |
463 |
||
78 | 464 |
!UIPainterView methodsFor:'generating output'! |
465 |
||
352 | 466 |
aspectMethods |
467 |
"extract a list of aspect methods - for browsing" |
|
468 |
||
469 |
|cls methods skip selector protoSpec| |
|
470 |
||
471 |
className isNil ifTrue:[ |
|
472 |
self warn:'set the class first'. |
|
473 |
^ #() |
|
474 |
]. |
|
475 |
||
476 |
cls := self resolveName:className. |
|
477 |
methods := IdentitySet new. |
|
478 |
||
479 |
treeView propertiesDo:[:aProp| |
|
480 |
|selector| |
|
481 |
||
482 |
(selector := aProp model) notNil ifTrue:[ |
|
483 |
selector isArray ifFalse:[ |
|
484 |
selector := selector asSymbol. |
|
485 |
(cls implements:selector) ifTrue:[ |
|
486 |
skip := false. |
|
487 |
(cls isSubclassOf:SimpleDialog) ifTrue:[ |
|
488 |
skip := SimpleDialog implements:selector asSymbol |
|
489 |
]. |
|
490 |
skip ifFalse:[ |
|
491 |
methods add:(cls compiledMethodAt:selector) |
|
492 |
]. |
|
493 |
]. |
|
494 |
]. |
|
495 |
]. |
|
496 |
||
497 |
(selector := aProp menu) notNil ifTrue:[ |
|
498 |
selector isArray ifFalse:[ |
|
499 |
selector := selector asSymbol. |
|
500 |
(cls implements:selector) ifTrue:[ |
|
501 |
methods add:(cls compiledMethodAt:selector) |
|
502 |
] |
|
503 |
]. |
|
504 |
]. |
|
505 |
||
506 |
(aProp spec aspectSelectors) do:[:aSel | |
|
507 |
|selector| |
|
508 |
||
509 |
aSel isArray ifFalse:[ |
|
510 |
selector := aSel asSymbol. |
|
511 |
(cls implements:selector) ifTrue:[ |
|
512 |
methods add:(cls compiledMethodAt:selector) |
|
513 |
] |
|
514 |
]. |
|
515 |
]. |
|
516 |
aProp spec actionSelectors do:[:aSel| |
|
517 |
|selector| |
|
518 |
||
519 |
aSel isArray ifFalse:[ |
|
520 |
selector := aSel asSymbol. |
|
521 |
(cls implements:selector) ifTrue:[ |
|
522 |
methods add:(cls compiledMethodAt:selector) |
|
523 |
] |
|
524 |
]. |
|
525 |
]. |
|
526 |
aProp spec valueSelectors do:[:aSel| |
|
527 |
|selector| |
|
528 |
||
529 |
aSel isArray ifFalse:[ |
|
530 |
selector := aSel asSymbol. |
|
531 |
(cls implements:selector) ifTrue:[ |
|
532 |
methods add:(cls compiledMethodAt:selector) |
|
533 |
] |
|
534 |
]. |
|
535 |
] |
|
536 |
]. |
|
537 |
||
538 |
protoSpec := treeView canvasSpec. |
|
539 |
||
540 |
(selector := protoSpec menu) notNil ifTrue:[ |
|
541 |
selector isArray ifFalse:[ |
|
542 |
selector := selector asSymbol. |
|
543 |
(cls implements:selector) ifTrue:[ |
|
544 |
methods add:(cls compiledMethodAt:selector) |
|
545 |
] |
|
546 |
]. |
|
547 |
]. |
|
548 |
||
549 |
^ methods |
|
550 |
||
551 |
"Created: / 25.10.1997 / 18:58:25 / cg" |
|
552 |
"Modified: / 26.10.1997 / 15:06:18 / cg" |
|
553 |
! |
|
554 |
||
60 | 555 |
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass |
568 | 556 |
|selector args showIt code alreadyInSuperclass numArgs method| |
288 | 557 |
|
558 |
selector := aspect asSymbol. |
|
141 | 559 |
|
288 | 560 |
alreadyInSuperclass := targetClass superclass canUnderstand:selector. |
561 |
||
568 | 562 |
numArgs := selector numArgs. |
563 |
method := aspect. |
|
564 |
||
565 |
numArgs == 1 ifTrue:[ |
|
566 |
args := 'anArgument'. |
|
567 |
showIt := ''' , anArgument printString , '' ...''.\'. |
|
568 |
] ifFalse:[ |
|
288 | 569 |
args := ''. |
149 | 570 |
showIt := ' ...''.\'. |
568 | 571 |
|
572 |
numArgs ~~ 0 ifTrue:[ |
|
573 |
method := ''. |
|
574 |
||
575 |
selector keywords keysAndValuesDo:[:i :key| |
|
576 |
method := method, key, 'arg', i printString, ' ' |
|
577 |
] |
|
578 |
] |
|
149 | 579 |
]. |
141 | 580 |
|
288 | 581 |
code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' , |
568 | 582 |
method , args , '\' , |
352 | 583 |
' "automatically generated by UIPainter ..."\\' , |
584 |
' "*** the code below performs no action"\' , |
|
585 |
' "*** (except for some feedback on the Transcript)"\' , |
|
586 |
' "*** Please change as required and accept in the browser."\' , |
|
288 | 587 |
'\' . |
588 |
||
589 |
alreadyInSuperclass ifTrue:[ |
|
590 |
code := code , |
|
591 |
' "action for ' , aspect , ' is already provided in a superclass."\' , |
|
592 |
' "It may be redefined here ..."\\'. |
|
593 |
] ifFalse:[ |
|
594 |
code := code , |
|
595 |
' "action to be added ..."\\'. |
|
596 |
]. |
|
597 |
||
598 |
code := code , |
|
599 |
' Transcript showCR:self class name, '': '. |
|
600 |
alreadyInSuperclass ifTrue:[ |
|
601 |
code := code , 'inherited '. |
|
602 |
]. |
|
603 |
code := code , 'action for ' , aspect , showIt. |
|
604 |
||
605 |
alreadyInSuperclass ifTrue:[ |
|
606 |
code := code , |
|
607 |
' super ' , aspect , args , '.\'. |
|
608 |
]. |
|
609 |
||
610 |
code := code , |
|
611 |
'!! !!\\'. |
|
612 |
^ code withCRs |
|
613 |
||
352 | 614 |
"Modified: / 25.10.1997 / 19:18:50 / cg" |
60 | 615 |
! |
616 |
||
617 |
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass |
|
655
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
618 |
|modelClass modelValue modelGen code| |
134 | 619 |
|
149 | 620 |
modelClass := protoSpec defaultModelClassFor:aspect. |
352 | 621 |
modelValue := protoSpec defaultModelValueFor:aspect. |
622 |
||
623 |
modelValue isNil ifTrue:[ |
|
624 |
modelGen := modelClass name , ' new' |
|
625 |
] ifFalse:[ |
|
626 |
modelGen := modelValue storeString , ' asValue' |
|
627 |
]. |
|
134 | 628 |
|
655
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
629 |
code := '!!' , targetClass name , ' methodsFor:''aspects''!!\\' , |
60 | 630 |
aspect , '\' , |
352 | 631 |
' "automatically generated by UIPainter ..."\\' , |
632 |
' "*** the code below creates a default model when invoked."\' , |
|
633 |
' "*** (which may not be the one you wanted)"\' , |
|
655
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
634 |
' "*** Please change as required and accept in the browser."\'. |
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
635 |
|
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
636 |
code := (code , |
60 | 637 |
'\' , |
638 |
' |holder|\' , |
|
639 |
'\' , |
|
640 |
' (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' , |
|
352 | 641 |
' builder aspectAt:#' , aspect , ' put:(holder := ' , ' ' , modelGen , ').\' , |
60 | 642 |
' ].\' , |
643 |
' ^ holder\' , |
|
655
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
644 |
'!! !!\\') withCRs. |
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
645 |
^ code |
352 | 646 |
|
647 |
"Modified: / 26.10.1997 / 19:01:15 / cg" |
|
60 | 648 |
! |
649 |
||
650 |
generateAspectMethods |
|
352 | 651 |
"generate aspect, action & menu methods |
652 |
- but do not overwrite existing ones. |
|
653 |
Return a string ready to compile into the application class." |
|
654 |
||
655 |
|cls code skip menuSelector protoSpec thisCode| |
|
60 | 656 |
|
78 | 657 |
code := ''. |
658 |
||
60 | 659 |
className isNil ifTrue:[ |
698 | 660 |
self warn:'Set first the class!!'. |
78 | 661 |
^ code |
60 | 662 |
]. |
698 | 663 |
|
664 |
(cls := self resolveName:className) isNil ifTrue:[ |
|
665 |
self warn:'Class ', className asString, ' does not exist!!'. |
|
666 |
^ code |
|
667 |
]. |
|
60 | 668 |
|
316 | 669 |
treeView propertiesDo:[:aProp| |
352 | 670 |
|modelSelector menuSelector| |
671 |
||
134 | 672 |
protoSpec := aProp spec. |
175 | 673 |
|
78 | 674 |
(modelSelector := aProp model) notNil ifTrue:[ |
698 | 675 |
self generateCodeFrom:(Array with:modelSelector) in:cls |
676 |
do:[:aSel| |
|
352 | 677 |
skip := false. |
698 | 678 |
|
352 | 679 |
(cls isSubclassOf:SimpleDialog) ifTrue:[ |
698 | 680 |
skip := SimpleDialog implements:aSel asSymbol |
158
6e7f892308ae
do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
681 |
]. |
698 | 682 |
|
352 | 683 |
skip ifFalse:[ |
684 |
"/ kludge .. |
|
501 | 685 |
(protoSpec isKindOf:ActionButtonSpec) ifTrue:[ |
698 | 686 |
thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls). |
352 | 687 |
] ifFalse:[ |
698 | 688 |
thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls). |
352 | 689 |
]. |
698 | 690 |
code := code, thisCode |
691 |
] |
|
692 |
] |
|
62 | 693 |
]. |
694 |
||
698 | 695 |
self generateCodeFrom:(aProp spec aspectSelectors) in:cls |
696 |
do:[:aSel| |
|
352 | 697 |
thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls). |
698 |
code := code , thisCode |
|
698 | 699 |
]. |
700 |
||
701 |
self generateCodeFrom:(aProp spec actionSelectors) in:cls |
|
702 |
do:[:aSel| |
|
352 | 703 |
thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls). |
704 |
code := code , thisCode |
|
698 | 705 |
]. |
706 |
||
707 |
self generateCodeFrom:(aProp spec valueSelectors) in:cls |
|
708 |
do:[:aSel| |
|
709 |
"/ uppercase: - assume its a globals name. |
|
710 |
aSel first isUppercase ifFalse:[ |
|
376 | 711 |
thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls). |
712 |
code := code , thisCode |
|
713 |
] |
|
698 | 714 |
]. |
316 | 715 |
]. |
716 |
||
352 | 717 |
^ code |
698 | 718 |
|
719 |
! |
|
720 |
||
721 |
generateCodeFrom:aListOfSelectors in:aClass do:aBlock |
|
722 |
||
744 | 723 |
self class redefineAspectMethods ifTrue:[ |
698 | 724 |
aListOfSelectors do:[:aSelector| |
725 |
(aSelector isArray or:[aClass implements:aSelector]) ifFalse:[ |
|
726 |
aBlock value:aSelector |
|
727 |
] |
|
728 |
] |
|
729 |
] ifFalse:[ |
|
730 |
aListOfSelectors do:[:aSelector| |
|
731 |
(aSelector isArray or:[aClass canUnderstand:aSelector]) ifFalse:[ |
|
732 |
aBlock value:aSelector |
|
733 |
] |
|
734 |
] |
|
735 |
] |
|
736 |
||
737 |
||
376 | 738 |
! |
739 |
||
740 |
generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass |
|
741 |
^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' , |
|
742 |
selectorSpec , '\' , |
|
743 |
' "automatically generated by UIPainter ..."\\' , |
|
744 |
' "*** the code here does nothing. It is invoked when"\' , |
|
745 |
' "*** ' , commentWhen , '"\' , |
|
746 |
' "*** Please change as required and accept in the browser."\' , |
|
747 |
'\' , |
|
748 |
' "specific code to be added below ..."\' , |
|
749 |
' "' , (noteOrNil ? '') , '"\' , |
|
750 |
'\' , |
|
751 |
(defaultCode ? '^ self.') , |
|
752 |
'!! !!\\') withCRs |
|
753 |
||
754 |
"Modified: / 25.10.1997 / 19:22:17 / cg" |
|
755 |
"Created: / 31.10.1997 / 17:31:53 / cg" |
|
756 |
! |
|
757 |
||
758 |
generateHookMethods |
|
759 |
"generate hook methods |
|
760 |
- but do not overwrite existing ones. |
|
761 |
Return a string ready to compile into the application class." |
|
762 |
||
763 |
|cls code skip menuSelector protoSpec thisCode| |
|
764 |
||
765 |
code := ''. |
|
766 |
||
767 |
className isNil ifTrue:[ |
|
768 |
self warn:'set the class first'. |
|
769 |
^ code |
|
770 |
]. |
|
771 |
cls := self resolveName:className. |
|
772 |
||
773 |
code := code , (self generateHookMethodsInClass:cls). |
|
774 |
||
775 |
^ code |
|
776 |
||
777 |
"Created: / 31.10.1997 / 17:21:29 / cg" |
|
778 |
"Modified: / 31.10.1997 / 17:38:11 / cg" |
|
779 |
! |
|
780 |
||
781 |
generateHookMethodsInClass:targetClass |
|
782 |
|code| |
|
783 |
||
784 |
code := ''. |
|
785 |
||
786 |
(targetClass implements:#postBuildWith:) ifFalse:[ |
|
787 |
code := code |
|
788 |
, (self |
|
789 |
generateHookMethodFor:'postBuildWith:aBuilder' |
|
790 |
comment:'the widgets have been built, but before the view is opened' |
|
708 | 791 |
note:'or after the super send' |
792 |
defaultCode:' super postBuildWith:aBuilder' |
|
376 | 793 |
inClass:targetClass) |
794 |
]. |
|
795 |
(targetClass implements:#postOpenWith:) ifFalse:[ |
|
796 |
code := code |
|
797 |
, (self |
|
798 |
generateHookMethodFor:'postOpenWith:aBuilder' |
|
799 |
comment:'the topView has been opened, but before events are dispatched for it' |
|
708 | 800 |
note:'or after the super send' |
801 |
defaultCode:' super postOpenWith:aBuilder' |
|
376 | 802 |
inClass:targetClass) |
803 |
]. |
|
804 |
(targetClass implements:#closeRequest) ifFalse:[ |
|
805 |
code := code |
|
806 |
, (self |
|
807 |
generateHookMethodFor:'closeRequest' |
|
808 |
comment:'the topView has been asked to close' |
|
809 |
note:'return without the ''super closeRequest'' to stay open' |
|
708 | 810 |
defaultCode:' ^super closeRequest' |
376 | 811 |
inClass:targetClass) |
812 |
]. |
|
813 |
^ code |
|
814 |
||
815 |
"Modified: / 31.10.1997 / 17:30:34 / cg" |
|
816 |
"Created: / 31.10.1997 / 17:32:49 / cg" |
|
316 | 817 |
! |
818 |
||
188
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
819 |
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
820 |
^ ('!!' , targetClass name , ' methodsFor:''values''!!\\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
821 |
aspect , '\' , |
352 | 822 |
' "automatically generated by UIPainter ..."\\' , |
823 |
' "*** the code below returns a default value when invoked."\' , |
|
824 |
' "*** (which may not be the one you wanted)"\' , |
|
825 |
' "*** Please change as required and accept in the browser."\' , |
|
188
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
826 |
'\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
827 |
' "value to be added below ..."\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
828 |
' Transcript showCR:self class name , '': no value yet for ' , aspect , ' ...''.\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
829 |
'\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
830 |
'^ nil.' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
831 |
'!! !!\\') withCRs |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
832 |
|
352 | 833 |
"Modified: / 25.10.1997 / 19:22:17 / cg" |
188
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
834 |
! |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
835 |
|
78 | 836 |
generateWindowSpecMethodSource |
457 | 837 |
|spec str code category cls mthd specCode| |
60 | 838 |
|
310 | 839 |
spec := OrderedCollection new. |
60 | 840 |
|
78 | 841 |
self subViews do:[:aView| |
842 |
aView ~~ inputView ifTrue:[ |
|
310 | 843 |
spec add:(self fullSpecFor:aView) |
60 | 844 |
] |
845 |
]. |
|
310 | 846 |
spec := treeView generateFullSpecForComponents:spec. |
847 |
str := WriteStream on:String new. |
|
848 |
UISpecification prettyPrintSpecArray:spec on:str indent:5. |
|
464 | 849 |
specCode := str contents. |
457 | 850 |
|
851 |
(specCode includes:$!!) ifTrue:[ |
|
852 |
"/ oops - must be chunk format ... |
|
853 |
str := WriteStream on:String new. |
|
854 |
str nextPutAllAsChunk:specCode. |
|
855 |
specCode := str contents. |
|
856 |
]. |
|
60 | 857 |
|
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
858 |
"/ 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
|
859 |
|
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
860 |
category := 'interface specs'. |
330 | 861 |
cls := self resolveName:className. |
862 |
||
863 |
cls notNil ifTrue:[ |
|
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
864 |
(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
|
865 |
category := mthd category. |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
866 |
] |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
867 |
]. |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
868 |
|
238 | 869 |
code := '!!' |
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
870 |
, className , ' class methodsFor:' , category storeString |
238 | 871 |
, '!!' , '\\' |
60 | 872 |
|
873 |
, methodName , '\' |
|
742 | 874 |
, ((ResourceSpecEditor codeGenerationCommentForClass: UIPainter) replChar:$!! withString:'!!!!') |
875 |
, '\\ "\' |
|
655
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
876 |
, (' UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\') |
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
877 |
, (' ' , className , ' new openInterface:#' , methodName , '\') |
742 | 878 |
,(methodName = 'windowSpec' |
879 |
ifTrue:[' ' , className , ' open\'] ifFalse: ['']) |
|
60 | 880 |
, ' "\'. |
881 |
||
882 |
code := code |
|
883 |
, '\' |
|
884 |
, ' <resource: #canvas>\\' |
|
885 |
, ' ^\' |
|
457 | 886 |
, ' ', specCode |
60 | 887 |
, '\' |
238 | 888 |
, '!! !!' |
60 | 889 |
, '\\'. |
890 |
||
891 |
^ code withCRs |
|
892 |
||
893 |
"Modified: 5.9.1995 / 21:01:35 / claus" |
|
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
894 |
"Modified: 24.6.1997 / 19:12:44 / cg" |
60 | 895 |
! ! |
896 |
||
754 | 897 |
!UIPainterView methodsFor:'grid manipulation'! |
898 |
||
899 |
newGrid |
|
900 |
"define a new grid - this is a private helper which has to be |
|
901 |
called after any change in the grid. It (re)creates the gridPixmap, |
|
902 |
clears the view and redraws all visible objects." |
|
903 |
||
904 |
|defaultViewBackground| |
|
905 |
||
906 |
gridPixmap := nil. |
|
907 |
defaultViewBackground := self class defaultViewBackgroundColor. |
|
908 |
||
909 |
shown ifTrue:[ |
|
910 |
self viewBackground: (defaultViewBackground isColor |
|
911 |
ifTrue: [defaultViewBackground] |
|
912 |
ifFalse:[Black]). |
|
913 |
self clear. |
|
914 |
]. |
|
915 |
||
916 |
gridShown ifTrue:[ |
|
917 |
self defineGrid. |
|
918 |
gridPixmap colorMap: (defaultViewBackground isColor |
|
919 |
ifTrue: [Array with:defaultViewBackground with:Color darkGray] |
|
920 |
ifFalse:[Array with:White with:Black]). |
|
921 |
self viewBackground:gridPixmap. |
|
922 |
]. |
|
923 |
||
924 |
self invalidate |
|
925 |
||
926 |
! ! |
|
927 |
||
60 | 928 |
!UIPainterView methodsFor:'initialization'! |
929 |
||
770 | 930 |
create |
931 |
"colors on device |
|
932 |
" |
|
933 |
super create. |
|
934 |
||
935 |
handleColor := handleColor on:device. |
|
936 |
handleMasterColor := handleMasterColor on:device. |
|
937 |
! |
|
938 |
||
60 | 939 |
initialize |
62 | 940 |
"setup attributes |
941 |
" |
|
60 | 942 |
super initialize. |
770 | 943 |
superclassName := 'ApplicationModel'. |
944 |
className := 'NewApplication'. |
|
945 |
methodName := 'windowSpec'. |
|
946 |
categoryName := 'Applications'. |
|
947 |
HandCursor := Cursor leftHand. |
|
948 |
handleColor := Color black. |
|
949 |
handleMasterColor := Color red. |
|
60 | 950 |
|
712 | 951 |
self backgroundColor: self class defaultViewBackgroundColor. |
60 | 952 |
! |
953 |
||
954 |
setupFromSpec:specOrSpecArray |
|
784 | 955 |
|
78 | 956 |
|spec builder| |
60 | 957 |
|
784 | 958 |
Cursor wait showWhile: [ |
959 |
self removeAll. |
|
960 |
spec := UISpecification from:specOrSpecArray. |
|
961 |
builder := UIBuilder new isEditing:true. |
|
962 |
"set applicationClass, in order that subspecifications may be resolved" |
|
963 |
className notNil ifTrue:[ |
|
964 |
builder applicationClass:(self resolveName:className). |
|
965 |
]. |
|
966 |
spec window setupView:self topView for:builder. |
|
967 |
self addSpec:(spec component) builder:builder in:self. |
|
968 |
self realizeAllSubViews. |
|
969 |
inputView raise. |
|
970 |
treeView setAttributesFromWindowSpec:(spec window) |
|
971 |
] |
|
972 |
||
223 | 973 |
! |
974 |
||
975 |
treeView:aTreeView |
|
361 | 976 |
treeView := aTreeView. |
977 |
||
978 |
treeView delegate:( |
|
376 | 979 |
"/ |
980 |
"/ I want to handle everything typed |
|
981 |
"/ in the treeView, except for Return and Cursor-keys |
|
982 |
"/ |
|
983 |
KeyboardForwarder |
|
984 |
toView:self |
|
985 |
condition:nil |
|
986 |
filter:[:k | (k isSymbol |
|
987 |
and:[k ~~ #Return |
|
988 |
and:[(k startsWith:#Cursor) not]]) |
|
989 |
] |
|
361 | 990 |
) |
991 |
||
376 | 992 |
"Modified: / 31.10.1997 / 20:22:09 / cg" |
60 | 993 |
! ! |
994 |
||
995 |
!UIPainterView methodsFor:'menus'! |
|
996 |
||
121 | 997 |
showMiddleButtonMenu |
998 |
"show the middle button menu; this returns nil |
|
62 | 999 |
" |
223 | 1000 |
self enabled ifTrue:[ |
754 | 1001 |
(MenuPanel fromSpec:(UIPainter menuEdit) receiver:self superView application) startUp |
111 | 1002 |
]. |
121 | 1003 |
^ nil |
60 | 1004 |
|
62 | 1005 |
|
1006 |
||
60 | 1007 |
! ! |
1008 |
||
754 | 1009 |
!UIPainterView methodsFor:'private handles'! |
1010 |
||
1011 |
showSelected:aComponent |
|
1012 |
"show object selected |
|
1013 |
" |
|
1014 |
|wasClipped| |
|
1015 |
||
1016 |
selectionHiddenLevel == 0 ifTrue:[ |
|
1017 |
(treeView selection size > 1 and: |
|
1018 |
[(treeView model list at: treeView selection first) contents view == aComponent]) |
|
770 | 1019 |
ifTrue: [self paint: handleMasterColor] |
1020 |
ifFalse:[self paint: handleColor]. |
|
754 | 1021 |
|
1022 |
(wasClipped := clipChildren) ifTrue:[ |
|
1023 |
self clippedByChildren:(clipChildren := false). |
|
1024 |
]. |
|
1025 |
||
1026 |
self handlesOf:aComponent do:[:rectangle :what| |
|
1027 |
what == #view ifTrue:[self displayRectangle:rectangle] |
|
1028 |
ifFalse:[self fillRectangle:rectangle] |
|
1029 |
]. |
|
1030 |
||
1031 |
wasClipped ifTrue:[ |
|
1032 |
self clippedByChildren:(clipChildren := true). |
|
1033 |
] |
|
1034 |
] |
|
1035 |
||
1036 |
||
1037 |
! ! |
|
1038 |
||
335 | 1039 |
!UIPainterView methodsFor:'queries'! |
1040 |
||
1041 |
resolveName:aName |
|
1042 |
|appl| |
|
1043 |
||
1044 |
appl := self application. |
|
1045 |
||
1046 |
appl notNil ifTrue:[ |
|
1047 |
^ appl resolveName:aName |
|
1048 |
]. |
|
1049 |
^ Smalltalk resolveName:aName inClass:self class |
|
1050 |
! ! |
|
1051 |
||
60 | 1052 |
!UIPainterView methodsFor:'removing components'! |
1053 |
||
78 | 1054 |
remove:anObject |
1055 |
"remove anObject from the contents do redraw |
|
60 | 1056 |
" |
134 | 1057 |
anObject notNil ifTrue:[ |
238 | 1058 |
treeView removeView:anObject. |
134 | 1059 |
] |
60 | 1060 |
! |
1061 |
||
1062 |
removeAll |
|
62 | 1063 |
"remove all objects and properties |
1064 |
" |
|
776 | 1065 |
self select:nil. |
1066 |
treeView removeAll. |
|
1067 |
self removeUndoHistory. |
|
60 | 1068 |
! ! |
1069 |
||
1070 |
!UIPainterView methodsFor:'searching'! |
|
1071 |
||
285 | 1072 |
findContainerOfView:aView |
1073 |
"returns the super view assigned to a view |
|
89 | 1074 |
" |
285 | 1075 |
|p| |
89 | 1076 |
|
285 | 1077 |
(p := self propertyOfParentForView:aView) isNil ifTrue:[ |
89 | 1078 |
^ self |
1079 |
]. |
|
285 | 1080 |
^ p view |
89 | 1081 |
! |
1082 |
||
60 | 1083 |
findObjectAt:aPoint |
1084 |
"find the origin/corner of the currentWidget |
|
1085 |
" |
|
285 | 1086 |
|view prop| |
60 | 1087 |
|
1088 |
view := super findObjectAt:aPoint. |
|
285 | 1089 |
prop := self propertyRespondsToView:view. |
60 | 1090 |
|
285 | 1091 |
prop notNil ifTrue:[^ prop view]. |
1092 |
^ nil |
|
60 | 1093 |
! |
1094 |
||
1095 |
findViewWithId:aViewId |
|
62 | 1096 |
"finds view assigned to identifier and returns the view or nil |
60 | 1097 |
" |
1098 |
|prop| |
|
1099 |
||
1100 |
prop := self propertyOfIdentifier:aViewId. |
|
1101 |
||
1102 |
prop notNil ifTrue:[^ prop view] |
|
1103 |
ifFalse:[^ nil] |
|
78 | 1104 |
! |
1105 |
||
1106 |
propertyOfIdentifier:anId |
|
1107 |
"returns property assigned to unique identifier |
|
1108 |
" |
|
1109 |
anId notNil ifTrue:[ |
|
238 | 1110 |
^ treeView propertyDetect:[:p| p identifier == anId ] |
78 | 1111 |
]. |
1112 |
^ nil |
|
1113 |
! |
|
1114 |
||
1115 |
propertyOfName:aString |
|
1116 |
"returns property assigned to name |
|
1117 |
" |
|
111 | 1118 |
|name| |
1119 |
||
1120 |
aString isNil ifFalse:[ |
|
1121 |
name := aString string withoutSeparators. |
|
238 | 1122 |
^ treeView propertyDetect:[:p| p name = name ]. |
78 | 1123 |
]. |
1124 |
^ nil |
|
1125 |
! |
|
1126 |
||
285 | 1127 |
propertyOfParentForView:aSubView |
1128 |
"returns the property of the parent or nil |
|
1129 |
" |
|
1130 |
|item| |
|
1131 |
||
1132 |
(item := treeView detectItemRespondsToView:aSubView) notNil ifTrue:[ |
|
1133 |
(item := item parent) notNil ifTrue:[^ item contents] |
|
1134 |
]. |
|
1135 |
^ nil |
|
1136 |
! |
|
1137 |
||
78 | 1138 |
propertyOfView:aView |
1139 |
"returns property assigned to view |
|
1140 |
" |
|
1141 |
(aView isNil or:[aView == self]) ifFalse:[ |
|
238 | 1142 |
^ treeView propertyDetect:[:p| p view == aView ] |
78 | 1143 |
]. |
1144 |
^ nil |
|
1145 |
! |
|
1146 |
||
285 | 1147 |
propertyRespondsToView:aView |
1148 |
"detect the property responding to the argument a view. The property of the view or |
|
1149 |
the first subview providing the properties is returned. If no property is detected |
|
1150 |
nil is returned. |
|
1151 |
" |
|
1152 |
|item| |
|
1153 |
||
1154 |
item := treeView detectItemRespondsToView:aView. |
|
1155 |
||
1156 |
(item notNil and:[item parent notNil]) ifTrue:[ |
|
1157 |
^ item contents |
|
1158 |
]. |
|
1159 |
^ nil |
|
1160 |
! |
|
1161 |
||
111 | 1162 |
uniqueNameFor:aSpecOrString |
78 | 1163 |
"generate and return an unique name for a class |
1164 |
" |
|
1165 |
|next name size| |
|
1166 |
||
712 | 1167 |
aSpecOrString isString ifFalse:[name := aSpecOrString userFriendlyName] |
111 | 1168 |
ifTrue:[name := aSpecOrString]. |
78 | 1169 |
|
111 | 1170 |
size := name size + 1. |
1171 |
next := 0. |
|
78 | 1172 |
|
238 | 1173 |
treeView propertiesDo:[:p| |
111 | 1174 |
|n| |
78 | 1175 |
n := p name. |
1176 |
||
1177 |
(n size >= size and:[n startsWith:name]) ifTrue:[ |
|
1178 |
next := next max:(p extractNumberStartingAt:size) |
|
1179 |
] |
|
1180 |
]. |
|
1181 |
next := next + 1. |
|
1182 |
name := name, next printString. |
|
1183 |
^ name |
|
1184 |
||
1185 |
||
1186 |
||
662 | 1187 |
|
78 | 1188 |
! |
1189 |
||
1190 |
uniqueNameOf:aView |
|
111 | 1191 |
|prop| |
78 | 1192 |
|
111 | 1193 |
(prop := self propertyOfView:aView) notNil ifTrue:[ |
1194 |
prop name isNil ifTrue:[ |
|
1195 |
prop name:(self uniqueNameFor:(prop spec)). |
|
1196 |
]. |
|
1197 |
^ prop name |
|
78 | 1198 |
]. |
111 | 1199 |
^ 'self' |
78 | 1200 |
|
60 | 1201 |
! ! |
1202 |
||
223 | 1203 |
!UIPainterView methodsFor:'selection basics'! |
1204 |
||
1205 |
addToSelection:anObject |
|
1206 |
"add an object to the selection |
|
1207 |
" |
|
1208 |
(self enabled and:[(self isSelected:anObject) not]) ifTrue:[ |
|
1209 |
selection isCollection ifFalse:[ |
|
1210 |
selection isNil ifTrue:[ |
|
1211 |
selection := anObject |
|
1212 |
] ifFalse:[ |
|
1213 |
selection := OrderedCollection with:selection with:anObject |
|
1214 |
] |
|
1215 |
] ifTrue:[ |
|
1216 |
selection add:anObject |
|
1217 |
]. |
|
1218 |
self showSelected:anObject. |
|
238 | 1219 |
treeView cvsSelectionAdd:anObject. |
223 | 1220 |
] |
1221 |
||
1222 |
||
1223 |
! |
|
1224 |
||
1225 |
removeFromSelection:anObject |
|
1226 |
"remove an object from the selection |
|
1227 |
" |
|
1228 |
(self isSelected:anObject) ifTrue:[ |
|
1229 |
self showUnselected:anObject. |
|
1230 |
||
1231 |
selection size > 1 ifTrue:[ |
|
1232 |
selection remove:anObject ifAbsent:nil. |
|
1233 |
self showSelection. |
|
1234 |
] ifFalse:[ |
|
1235 |
selection := nil |
|
1236 |
]. |
|
238 | 1237 |
treeView cvsSelectionRemove:anObject. |
223 | 1238 |
] |
1239 |
||
1240 |
! |
|
1241 |
||
1242 |
select:something |
|
1243 |
"change selection to something |
|
1244 |
" |
|
760 | 1245 |
(self enabled and:[something ~= self selection]) ifTrue:[ |
1246 |
something isNil |
|
1247 |
ifTrue: [treeView selection: (Array with: 1)] |
|
1248 |
ifFalse:[treeView cvsSelection:something]. |
|
1249 |
self setSelection:something withRedraw:true |
|
223 | 1250 |
] |
1251 |
||
1252 |
! |
|
1253 |
||
285 | 1254 |
updateSelectionFromModel:aSelOrNil |
223 | 1255 |
"update selection from a new selection |
1256 |
" |
|
768 | 1257 |
|aSet| |
1258 |
||
223 | 1259 |
selectionHiddenLevel == 0 ifTrue:[ |
285 | 1260 |
aSelOrNil size ~~ 0 ifTrue:[ |
768 | 1261 |
self selectionDo:[:el| |
1262 |
(aSelOrNil includes:el) ifFalse:[ |
|
1263 |
aSet isNil ifTrue:[ |
|
1264 |
aSet := IdentitySet new |
|
1265 |
]. |
|
1266 |
self showUnselected:el addAffectedViewsTo:aSet. |
|
1267 |
] |
|
1268 |
]. |
|
1269 |
self handleAffectedViews:aSet. |
|
285 | 1270 |
] ifFalse:[ |
768 | 1271 |
self hideSelection. |
285 | 1272 |
] |
223 | 1273 |
]. |
285 | 1274 |
self setSelection:aSelOrNil withRedraw:false. |
223 | 1275 |
self showSelection |
1276 |
||
1277 |
! ! |
|
1278 |
||
78 | 1279 |
!UIPainterView methodsFor:'specification'! |
1280 |
||
1281 |
addSpec:aSpecification builder:aBuilder in:aFrame |
|
1282 |
"build view and subviews from aSpecification into a frame. The top view |
|
1283 |
is returned. The contained components of a spec are set to nil |
|
1284 |
" |
|
330 | 1285 |
|cls| |
212 | 1286 |
|
330 | 1287 |
cls := self resolveName:className. |
1288 |
||
1289 |
cls notNil ifTrue:[ |
|
1290 |
aBuilder applicationClass:cls. |
|
212 | 1291 |
]. |
78 | 1292 |
|
111 | 1293 |
aBuilder componentCreationHook:[:aView :aSpec :aBdr||sv p s n| |
78 | 1294 |
p := ViewProperty new. |
1295 |
s := aSpec copy. |
|
1296 |
p spec:s. |
|
1297 |
p view:aView. |
|
1298 |
||
1299 |
s class supportsSubComponents ifTrue:[ |
|
1300 |
s component:nil |
|
1301 |
]. |
|
1302 |
||
111 | 1303 |
n := s name. |
1304 |
||
1305 |
(n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[ |
|
1306 |
s name:(self uniqueNameFor:s) |
|
78 | 1307 |
]. |
238 | 1308 |
treeView addProperty:p. |
78 | 1309 |
]. |
1310 |
||
1311 |
^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame. |
|
60 | 1312 |
|
212 | 1313 |
"Modified: 4.7.1997 / 23:48:55 / cg" |
78 | 1314 |
! |
1315 |
||
1316 |
fullSpecFor:anObject |
|
1317 |
"generate a full spec for an object |
|
62 | 1318 |
" |
78 | 1319 |
|mySpec subSpecs| |
1320 |
||
1321 |
mySpec := self specFor:anObject. |
|
1322 |
||
1323 |
(mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[ |
|
1324 |
(anObject subViews notNil) ifTrue:[ |
|
1325 |
anObject subViews do:[:aSubView||spec| |
|
1326 |
spec := self fullSpecFor:aSubView. |
|
1327 |
spec notNil ifTrue:[ |
|
1328 |
subSpecs isNil ifTrue:[ |
|
1329 |
subSpecs := OrderedCollection new |
|
1330 |
]. |
|
1331 |
subSpecs add:spec. |
|
1332 |
]. |
|
1333 |
]. |
|
1334 |
subSpecs notNil ifTrue:[ |
|
1335 |
mySpec component:(SpecCollection new collection:subSpecs) |
|
1336 |
] |
|
1337 |
] |
|
1338 |
]. |
|
1339 |
^ mySpec |
|
1340 |
||
60 | 1341 |
|
1342 |
||
1343 |
||
1344 |
||
1345 |
||
1346 |
! |
|
1347 |
||
285 | 1348 |
rebuildView:aView fromSpec:aSpec withBuilder:aBuilder |
1349 |
|v| |
|
1350 |
||
1351 |
aSpec needsRebuildForAttributes ifTrue:[ |
|
1352 |
v := aSpec buildViewWithLayoutFor:aBuilder in:(self findContainerOfView:aView). |
|
1353 |
v realize. |
|
1354 |
aView destroy. |
|
1355 |
device sync. |
|
1356 |
device flush. |
|
1357 |
aView becomeSameAs:v. |
|
1358 |
inputView raise. |
|
1359 |
] ifFalse:[ |
|
1360 |
aSpec setAttributesIn:aView with:aBuilder. |
|
1361 |
self elementChangedSize:aView. |
|
1362 |
]. |
|
1363 |
||
1364 |
! |
|
1365 |
||
78 | 1366 |
specFor:anObject |
1367 |
"returns spec assigned to an object |
|
62 | 1368 |
" |
78 | 1369 |
|prop spec| |
60 | 1370 |
|
78 | 1371 |
(prop := self propertyOfView:anObject) notNil ifTrue:[ |
1372 |
spec := prop spec copy. |
|
1373 |
spec layoutFromView:anObject |
|
60 | 1374 |
]. |
78 | 1375 |
^ spec |
1376 |
||
1377 |
||
1378 |
||
60 | 1379 |
! |
1380 |
||
146 | 1381 |
specForSelection |
1382 |
"returns spec assigned to current single selection or nil |
|
1383 |
" |
|
1384 |
^ self specFor:(self singleSelection) |
|
1385 |
||
1386 |
||
1387 |
! |
|
1388 |
||
78 | 1389 |
updateFromSpec:aSpec |
1390 |
"update current selected view from specification |
|
62 | 1391 |
" |
327
0040d47658c6
check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1392 |
|props name builder| |
78 | 1393 |
|
281 | 1394 |
aSpec class == WindowSpec ifTrue:[ |
698 | 1395 |
^ treeView canvasSpec:aSpec |
281 | 1396 |
]. |
1397 |
||
78 | 1398 |
self singleSelection notNil ifTrue:[ |
1399 |
self withSelectionHiddenDo:[ |
|
1400 |
self transaction:#specification selectionDo:[:aView| |
|
395 | 1401 |
builder := UIBuilder new isEditing:true. |
212 | 1402 |
className notNil ifTrue:[ |
330 | 1403 |
builder applicationClass:(self resolveName:className). |
212 | 1404 |
]. |
78 | 1405 |
props := self propertyOfView:aView. |
82 | 1406 |
name := (aSpec name) withoutSeparators. |
78 | 1407 |
|
82 | 1408 |
name = props name ifFalse:[ |
1409 |
(self propertyOfName:name) notNil ifTrue:[ |
|
1410 |
name := props name |
|
78 | 1411 |
] |
1412 |
]. |
|
82 | 1413 |
aSpec name:name. |
134 | 1414 |
self createUndoSpecModify:props. |
285 | 1415 |
self rebuildView:aView fromSpec:aSpec withBuilder:builder. |
78 | 1416 |
props spec:(aSpec copy). |
238 | 1417 |
treeView propertyChanged:props. |
78 | 1418 |
] |
111 | 1419 |
] |
82 | 1420 |
] |
212 | 1421 |
|
1422 |
"Modified: 4.7.1997 / 23:49:44 / cg" |
|
60 | 1423 |
! ! |
1424 |
||
285 | 1425 |
!UIPainterView methodsFor:'testing'! |
1426 |
||
1427 |
canChangeLayoutOfView:aView |
|
1428 |
"returns true if the view can change its layout which is dependant on |
|
1429 |
its parent view. |
|
1430 |
" |
|
1431 |
|item prnt| |
|
1432 |
||
1433 |
( (item := treeView itemOfView:aView) isNil |
|
1434 |
or:[(prnt := item parent) isNil] |
|
1435 |
) ifTrue:[ |
|
1436 |
^ false |
|
1437 |
]. |
|
1438 |
^ (prnt parent isNil or:[prnt contents spec class isLayoutContainer not]) |
|
1439 |
! |
|
1440 |
||
1441 |
canKeepLayoutInSelection |
|
1442 |
"returns true if layout can be kept during a paste operation |
|
1443 |
" |
|
1444 |
|prop| |
|
1445 |
||
1446 |
prop := self propertyOfView:(self singleSelection). |
|
1447 |
^ (prop isNil or:[prop spec class isLayoutContainer not]) |
|
1448 |
! |
|
1449 |
||
1450 |
canMove:something |
|
1451 |
"checks whether something is not nil and if all widgets derived from |
|
1452 |
something can change their layout ( move, align, ... operation ). |
|
1453 |
" |
|
1454 |
something notNil ifTrue:[ |
|
1455 |
self forEach:something do:[:aView| |
|
1456 |
(self canChangeLayoutOfView:aView) ifFalse:[^ false] |
|
1457 |
]. |
|
1458 |
^ true |
|
1459 |
]. |
|
1460 |
^ false |
|
1461 |
! |
|
1462 |
||
1463 |
canMoveOrAlignSelection |
|
1464 |
"returns true if a selection exists and all elements in the selection |
|
1465 |
can be moved or aligned |
|
1466 |
" |
|
1467 |
^ self canMove:(self selection) |
|
1468 |
||
1469 |
! ! |
|
1470 |
||
60 | 1471 |
!UIPainterView methodsFor:'transaction'! |
1472 |
||
1473 |
transaction:aType objects:something do:aOneArgBlock |
|
1474 |
"opens a transaction and evaluates a block within the transaction; the |
|
1475 |
argument to the block is a view from derived from something |
|
1476 |
" |
|
134 | 1477 |
self withinTransaction:aType objects:something do:[ |
1478 |
self forEach:something do:aOneArgBlock |
|
60 | 1479 |
] |
1480 |
! |
|
1481 |
||
134 | 1482 |
withinTransaction:aType objects:objects do:aNoneArgBlock |
1483 |
"evaluate a block with no arguments within a transaction |
|
60 | 1484 |
" |
134 | 1485 |
|text size prop| |
1486 |
||
1487 |
objects isNil ifTrue:[ ^ self ]. |
|
1488 |
||
1489 |
size := objects size. |
|
60 | 1490 |
|
134 | 1491 |
objects isCollection ifTrue:[ |
1492 |
size == 0 ifTrue:[ ^ self ]. |
|
1493 |
size == 1 ifTrue:[ prop := self propertyOfView:(objects first) ] |
|
1494 |
] ifFalse:[ |
|
1495 |
prop := self propertyOfView:objects |
|
1496 |
]. |
|
60 | 1497 |
|
134 | 1498 |
prop notNil ifTrue:[ |
1499 |
text := prop name |
|
1500 |
] ifFalse:[ |
|
1501 |
text := size printString, ' elements' |
|
60 | 1502 |
]. |
134 | 1503 |
|
1504 |
undoHistory withinTransaction:aType text:text do:[ |
|
1505 |
aNoneArgBlock value |
|
1506 |
] |
|
60 | 1507 |
! ! |
1508 |
||
1509 |
!UIPainterView methodsFor:'undo actions'! |
|
1510 |
||
134 | 1511 |
createUndoLayout:aView |
1512 |
"create undo action before changing a views layout |
|
60 | 1513 |
" |
134 | 1514 |
|lyt args prop| |
60 | 1515 |
|
1516 |
undoHistory isTransactionOpen ifTrue:[ |
|
1517 |
prop := self propertyOfView:aView. |
|
134 | 1518 |
|
60 | 1519 |
prop notNil ifTrue:[ |
134 | 1520 |
args := Array new:3. |
1521 |
args at:1 put:(prop identifier). |
|
1522 |
||
1523 |
(lyt := aView geometryLayout) notNil ifTrue:[ |
|
1524 |
args at:2 put:#geometryLayout: |
|
1525 |
] ifFalse:[ |
|
146 | 1526 |
lyt := aView extent. |
134 | 1527 |
args at:2 put:#extent: |
1528 |
]. |
|
1529 |
args at:3 put:(lyt copy). |
|
1530 |
undoHistory addUndoSelector:#undoLayout: withArgs:args. |
|
60 | 1531 |
] |
1532 |
] |
|
1533 |
! |
|
1534 |
||
134 | 1535 |
createUndoRemove:aView |
1536 |
"create undo method before deleting views |
|
60 | 1537 |
" |
285 | 1538 |
|prop pid| |
134 | 1539 |
|
1540 |
(prop := self propertyOfView:aView) notNil ifTrue:[ |
|
285 | 1541 |
(pid := self propertyOfParentForView:aView) notNil ifTrue:[ |
1542 |
pid := pid identifier |
|
1543 |
]. |
|
60 | 1544 |
|
134 | 1545 |
undoHistory addUndoSelector:#undoRemove: |
285 | 1546 |
withArgs:(Array with:(self fullSpecFor:aView) |
1547 |
with:(prop identifier) |
|
1548 |
with:pid) |
|
134 | 1549 |
] |
1550 |
! |
|
60 | 1551 |
|
134 | 1552 |
createUndoSpecModify:aProp |
1553 |
"undo method when changing the specification for an object |
|
1554 |
" |
|
1555 |
aProp notNil ifTrue:[ |
|
1556 |
undoHistory addUndoSelector:#undoSpecModify: |
|
1557 |
withArgs:(Array with:(aProp spec) with:(aProp identifier)) |
|
1558 |
] |
|
1559 |
! |
|
60 | 1560 |
|
134 | 1561 |
undoCreate:something |
1562 |
"undo method for creating or pasting an object |
|
1563 |
" |
|
1564 |
self forEach:something do:[:anId|self remove:(self findViewWithId:anId)]. |
|
1565 |
! |
|
60 | 1566 |
|
134 | 1567 |
undoLayout:args |
1568 |
"undo method to set the old layout; see 'createUndoLayout:' |
|
1569 |
" |
|
1570 |
|view| |
|
1571 |
||
1572 |
(view := self findViewWithId:(args at:1)) notNil ifTrue:[ |
|
146 | 1573 |
view perform:(args at:2) with:(args at:3). |
223 | 1574 |
self layoutChanged. |
60 | 1575 |
] |
1576 |
! |
|
1577 |
||
134 | 1578 |
undoRemove:args |
1579 |
"undo method when removing an object; see 'createUndoRemove:' |
|
1580 |
" |
|
1581 |
|frame prop view| |
|
1582 |
||
1583 |
(args at:3) notNil ifTrue:[ |
|
1584 |
frame := self findViewWithId:(args at:3). |
|
1585 |
]. |
|
1586 |
frame isNil ifTrue:[ |
|
1587 |
frame := self |
|
1588 |
]. |
|
395 | 1589 |
view := self addSpec:(args at:1) builder:(UIBuilder new isEditing:true) in:frame. |
134 | 1590 |
view realize. |
1591 |
inputView raise. |
|
1592 |
||
1593 |
prop := self propertyOfView:view. |
|
1594 |
prop identifier:(args at:2). |
|
1595 |
||
1596 |
! |
|
1597 |
||
1598 |
undoSpecModify:args |
|
1599 |
"undo method when changing a spec; see 'createUndoSpecModify:' |
|
60 | 1600 |
" |
327
0040d47658c6
check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1601 |
|builder view spec props| |
60 | 1602 |
|
134 | 1603 |
props := self propertyOfIdentifier:(args at:2). |
60 | 1604 |
|
134 | 1605 |
props notNil ifTrue:[ |
1606 |
view := props view. |
|
1607 |
spec := args at:1. |
|
395 | 1608 |
builder := UIBuilder new isEditing:true. |
1609 |
||
212 | 1610 |
className notNil ifTrue:[ |
330 | 1611 |
builder applicationClass:(self resolveName:className). |
212 | 1612 |
]. |
134 | 1613 |
props spec:spec. |
285 | 1614 |
self rebuildView:view fromSpec:spec withBuilder:builder. |
238 | 1615 |
treeView propertyChanged:props. |
211 | 1616 |
] |
1617 |
! ! |
|
1618 |
||
1619 |
!UIPainterView::ViewProperty class methodsFor:'instance creation'! |
|
1620 |
||
1621 |
new |
|
1622 |
Identifier notNil ifTrue:[Identifier := Identifier + 1] |
|
1623 |
ifFalse:[Identifier := 1]. |
|
1624 |
||
1625 |
^ self basicNew initialize |
|
1626 |
! ! |
|
1627 |
||
1628 |
!UIPainterView::ViewProperty methodsFor:'accessing'! |
|
1629 |
||
1630 |
identifier |
|
1631 |
"return the unique identifier assigned to property |
|
1632 |
" |
|
1633 |
^ identifier |
|
1634 |
! |
|
1635 |
||
1636 |
identifier:anIdentifier |
|
1637 |
"set the unique identifier assigned to property; called after an restore of |
|
1638 |
a deleted instance |
|
1639 |
" |
|
1640 |
identifier := anIdentifier |
|
1641 |
! |
|
1642 |
||
1643 |
spec |
|
1644 |
"return the value of the instance variable 'spec' (automatically generated)" |
|
1645 |
||
1646 |
^ spec! |
|
1647 |
||
1648 |
spec:something |
|
1649 |
"set the value of the instance variable 'spec' (automatically generated)" |
|
1650 |
||
1651 |
spec := something.! |
|
1652 |
||
1653 |
view |
|
1654 |
"return the value of the instance variable 'view' (automatically generated)" |
|
1655 |
||
1656 |
^ view! |
|
1657 |
||
1658 |
view:something |
|
1659 |
"set the value of the instance variable 'view' (automatically generated)" |
|
1660 |
||
1661 |
view := something.! ! |
|
1662 |
||
1663 |
!UIPainterView::ViewProperty methodsFor:'initialization'! |
|
1664 |
||
1665 |
initialize |
|
1666 |
super initialize. |
|
1667 |
identifier := Identifier |
|
1668 |
! ! |
|
1669 |
||
1670 |
!UIPainterView::ViewProperty methodsFor:'misc'! |
|
1671 |
||
1672 |
extractNumberStartingAt:anIndex |
|
1673 |
"return the number from the name starting at anIndex or 0. |
|
1674 |
" |
|
1675 |
|val| |
|
1676 |
||
1677 |
val := 0. |
|
1678 |
||
1679 |
self name from:anIndex do:[:c| |
|
1680 |
c isDigit ifTrue:[val := val * 10 + c digitValue] |
|
1681 |
ifFalse:[^ 0] |
|
1682 |
]. |
|
1683 |
^ val |
|
1684 |
||
1685 |
! ! |
|
1686 |
||
1687 |
!UIPainterView::ViewProperty methodsFor:'spec messages'! |
|
1688 |
||
1689 |
doesNotUnderstand:aMessage |
|
1690 |
spec notNil ifTrue:[ |
|
1691 |
(spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec] |
|
1692 |
]. |
|
1693 |
^ nil |
|
1694 |
! |
|
1695 |
||
1696 |
layout |
|
1697 |
spec layout |
|
1698 |
! |
|
1699 |
||
1700 |
layout:aLayout |
|
1701 |
spec layout:aLayout |
|
1702 |
! |
|
1703 |
||
1704 |
name |
|
1705 |
^ spec name |
|
1706 |
! |
|
1707 |
||
1708 |
name:aName |
|
1709 |
spec name:aName |
|
1710 |
! ! |
|
1711 |
||
60 | 1712 |
!UIPainterView class methodsFor:'documentation'! |
1713 |
||
1714 |
version |
|
1715 |
^ '$Header$' |
|
1716 |
! ! |