author | ca |
Thu, 07 May 1998 14:42:54 +0200 | |
changeset 817 | d350f49ae748 |
parent 796 | 05b2883a23b0 |
child 858 | 6b2e9e31cf06 |
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 .. |
|
796
05b2883a23b0
fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents:
784
diff
changeset
|
685 |
"/ (protoSpec isKindOf:ActionButtonSpec) |
05b2883a23b0
fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents:
784
diff
changeset
|
686 |
(protoSpec defaultModelIsCallBackMethodSelector:aSel) |
05b2883a23b0
fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents:
784
diff
changeset
|
687 |
ifTrue:[ |
698 | 688 |
thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls). |
352 | 689 |
] ifFalse:[ |
698 | 690 |
thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls). |
352 | 691 |
]. |
698 | 692 |
code := code, thisCode |
693 |
] |
|
694 |
] |
|
62 | 695 |
]. |
696 |
||
698 | 697 |
self generateCodeFrom:(aProp spec aspectSelectors) in:cls |
698 |
do:[:aSel| |
|
352 | 699 |
thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls). |
700 |
code := code , thisCode |
|
698 | 701 |
]. |
702 |
||
703 |
self generateCodeFrom:(aProp spec actionSelectors) in:cls |
|
704 |
do:[:aSel| |
|
352 | 705 |
thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls). |
706 |
code := code , thisCode |
|
698 | 707 |
]. |
708 |
||
709 |
self generateCodeFrom:(aProp spec valueSelectors) in:cls |
|
710 |
do:[:aSel| |
|
711 |
"/ uppercase: - assume its a globals name. |
|
712 |
aSel first isUppercase ifFalse:[ |
|
376 | 713 |
thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls). |
714 |
code := code , thisCode |
|
715 |
] |
|
698 | 716 |
]. |
316 | 717 |
]. |
718 |
||
352 | 719 |
^ code |
698 | 720 |
|
796
05b2883a23b0
fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents:
784
diff
changeset
|
721 |
"Modified: / 21.4.1998 / 20:23:48 / cg" |
698 | 722 |
! |
723 |
||
724 |
generateCodeFrom:aListOfSelectors in:aClass do:aBlock |
|
725 |
||
744 | 726 |
self class redefineAspectMethods ifTrue:[ |
698 | 727 |
aListOfSelectors do:[:aSelector| |
728 |
(aSelector isArray or:[aClass implements:aSelector]) ifFalse:[ |
|
729 |
aBlock value:aSelector |
|
730 |
] |
|
731 |
] |
|
732 |
] ifFalse:[ |
|
733 |
aListOfSelectors do:[:aSelector| |
|
734 |
(aSelector isArray or:[aClass canUnderstand:aSelector]) ifFalse:[ |
|
735 |
aBlock value:aSelector |
|
736 |
] |
|
737 |
] |
|
738 |
] |
|
739 |
||
740 |
||
376 | 741 |
! |
742 |
||
743 |
generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass |
|
744 |
^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' , |
|
745 |
selectorSpec , '\' , |
|
746 |
' "automatically generated by UIPainter ..."\\' , |
|
747 |
' "*** the code here does nothing. It is invoked when"\' , |
|
748 |
' "*** ' , commentWhen , '"\' , |
|
749 |
' "*** Please change as required and accept in the browser."\' , |
|
750 |
'\' , |
|
751 |
' "specific code to be added below ..."\' , |
|
752 |
' "' , (noteOrNil ? '') , '"\' , |
|
753 |
'\' , |
|
754 |
(defaultCode ? '^ self.') , |
|
755 |
'!! !!\\') withCRs |
|
756 |
||
757 |
"Modified: / 25.10.1997 / 19:22:17 / cg" |
|
758 |
"Created: / 31.10.1997 / 17:31:53 / cg" |
|
759 |
! |
|
760 |
||
761 |
generateHookMethods |
|
762 |
"generate hook methods |
|
763 |
- but do not overwrite existing ones. |
|
764 |
Return a string ready to compile into the application class." |
|
765 |
||
766 |
|cls code skip menuSelector protoSpec thisCode| |
|
767 |
||
768 |
code := ''. |
|
769 |
||
770 |
className isNil ifTrue:[ |
|
771 |
self warn:'set the class first'. |
|
772 |
^ code |
|
773 |
]. |
|
774 |
cls := self resolveName:className. |
|
775 |
||
776 |
code := code , (self generateHookMethodsInClass:cls). |
|
777 |
||
778 |
^ code |
|
779 |
||
780 |
"Created: / 31.10.1997 / 17:21:29 / cg" |
|
781 |
"Modified: / 31.10.1997 / 17:38:11 / cg" |
|
782 |
! |
|
783 |
||
784 |
generateHookMethodsInClass:targetClass |
|
785 |
|code| |
|
786 |
||
787 |
code := ''. |
|
788 |
||
789 |
(targetClass implements:#postBuildWith:) ifFalse:[ |
|
790 |
code := code |
|
791 |
, (self |
|
792 |
generateHookMethodFor:'postBuildWith:aBuilder' |
|
793 |
comment:'the widgets have been built, but before the view is opened' |
|
708 | 794 |
note:'or after the super send' |
795 |
defaultCode:' super postBuildWith:aBuilder' |
|
376 | 796 |
inClass:targetClass) |
797 |
]. |
|
798 |
(targetClass implements:#postOpenWith:) ifFalse:[ |
|
799 |
code := code |
|
800 |
, (self |
|
801 |
generateHookMethodFor:'postOpenWith:aBuilder' |
|
802 |
comment:'the topView has been opened, but before events are dispatched for it' |
|
708 | 803 |
note:'or after the super send' |
804 |
defaultCode:' super postOpenWith:aBuilder' |
|
376 | 805 |
inClass:targetClass) |
806 |
]. |
|
807 |
(targetClass implements:#closeRequest) ifFalse:[ |
|
808 |
code := code |
|
809 |
, (self |
|
810 |
generateHookMethodFor:'closeRequest' |
|
811 |
comment:'the topView has been asked to close' |
|
812 |
note:'return without the ''super closeRequest'' to stay open' |
|
708 | 813 |
defaultCode:' ^super closeRequest' |
376 | 814 |
inClass:targetClass) |
815 |
]. |
|
816 |
^ code |
|
817 |
||
818 |
"Modified: / 31.10.1997 / 17:30:34 / cg" |
|
819 |
"Created: / 31.10.1997 / 17:32:49 / cg" |
|
316 | 820 |
! |
821 |
||
188
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
822 |
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
823 |
^ ('!!' , targetClass name , ' methodsFor:''values''!!\\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
824 |
aspect , '\' , |
352 | 825 |
' "automatically generated by UIPainter ..."\\' , |
826 |
' "*** the code below returns a default value when invoked."\' , |
|
827 |
' "*** (which may not be the one you wanted)"\' , |
|
828 |
' "*** Please change as required and accept in the browser."\' , |
|
188
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 |
' "value to be added below ..."\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
831 |
' Transcript showCR:self class name , '': no value yet for ' , aspect , ' ...''.\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
832 |
'\' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
833 |
'^ nil.' , |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
834 |
'!! !!\\') withCRs |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
835 |
|
352 | 836 |
"Modified: / 25.10.1997 / 19:22:17 / cg" |
188
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
837 |
! |
8091a35bccf1
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents:
180
diff
changeset
|
838 |
|
78 | 839 |
generateWindowSpecMethodSource |
457 | 840 |
|spec str code category cls mthd specCode| |
60 | 841 |
|
310 | 842 |
spec := OrderedCollection new. |
60 | 843 |
|
78 | 844 |
self subViews do:[:aView| |
845 |
aView ~~ inputView ifTrue:[ |
|
310 | 846 |
spec add:(self fullSpecFor:aView) |
60 | 847 |
] |
848 |
]. |
|
310 | 849 |
spec := treeView generateFullSpecForComponents:spec. |
850 |
str := WriteStream on:String new. |
|
851 |
UISpecification prettyPrintSpecArray:spec on:str indent:5. |
|
464 | 852 |
specCode := str contents. |
457 | 853 |
|
854 |
(specCode includes:$!!) ifTrue:[ |
|
855 |
"/ oops - must be chunk format ... |
|
856 |
str := WriteStream on:String new. |
|
857 |
str nextPutAllAsChunk:specCode. |
|
858 |
specCode := str contents. |
|
859 |
]. |
|
60 | 860 |
|
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
861 |
"/ 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
|
862 |
|
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
863 |
category := 'interface specs'. |
330 | 864 |
cls := self resolveName:className. |
865 |
||
866 |
cls notNil ifTrue:[ |
|
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
867 |
(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
|
868 |
category := mthd category. |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
869 |
] |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
870 |
]. |
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
871 |
|
238 | 872 |
code := '!!' |
178
fb8451053c96
keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents:
175
diff
changeset
|
873 |
, className , ' class methodsFor:' , category storeString |
238 | 874 |
, '!!' , '\\' |
60 | 875 |
|
876 |
, methodName , '\' |
|
742 | 877 |
, ((ResourceSpecEditor codeGenerationCommentForClass: UIPainter) replChar:$!! withString:'!!!!') |
878 |
, '\\ "\' |
|
655
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
879 |
, (' UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\') |
093cba68e10a
simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents:
588
diff
changeset
|
880 |
, (' ' , className , ' new openInterface:#' , methodName , '\') |
742 | 881 |
,(methodName = 'windowSpec' |
882 |
ifTrue:[' ' , className , ' open\'] ifFalse: ['']) |
|
60 | 883 |
, ' "\'. |
884 |
||
885 |
code := code |
|
886 |
, '\' |
|
887 |
, ' <resource: #canvas>\\' |
|
888 |
, ' ^\' |
|
457 | 889 |
, ' ', specCode |
60 | 890 |
, '\' |
238 | 891 |
, '!! !!' |
60 | 892 |
, '\\'. |
893 |
||
894 |
^ code withCRs |
|
895 |
||
896 |
"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
|
897 |
"Modified: 24.6.1997 / 19:12:44 / cg" |
60 | 898 |
! ! |
899 |
||
754 | 900 |
!UIPainterView methodsFor:'grid manipulation'! |
901 |
||
902 |
newGrid |
|
903 |
"define a new grid - this is a private helper which has to be |
|
904 |
called after any change in the grid. It (re)creates the gridPixmap, |
|
905 |
clears the view and redraws all visible objects." |
|
906 |
||
907 |
|defaultViewBackground| |
|
908 |
||
909 |
gridPixmap := nil. |
|
910 |
defaultViewBackground := self class defaultViewBackgroundColor. |
|
911 |
||
912 |
shown ifTrue:[ |
|
913 |
self viewBackground: (defaultViewBackground isColor |
|
914 |
ifTrue: [defaultViewBackground] |
|
915 |
ifFalse:[Black]). |
|
916 |
self clear. |
|
917 |
]. |
|
918 |
||
919 |
gridShown ifTrue:[ |
|
920 |
self defineGrid. |
|
921 |
gridPixmap colorMap: (defaultViewBackground isColor |
|
922 |
ifTrue: [Array with:defaultViewBackground with:Color darkGray] |
|
923 |
ifFalse:[Array with:White with:Black]). |
|
924 |
self viewBackground:gridPixmap. |
|
925 |
]. |
|
926 |
||
927 |
self invalidate |
|
928 |
||
929 |
! ! |
|
930 |
||
60 | 931 |
!UIPainterView methodsFor:'initialization'! |
932 |
||
770 | 933 |
create |
934 |
"colors on device |
|
935 |
" |
|
936 |
super create. |
|
937 |
||
938 |
handleColor := handleColor on:device. |
|
939 |
handleMasterColor := handleMasterColor on:device. |
|
940 |
! |
|
941 |
||
60 | 942 |
initialize |
62 | 943 |
"setup attributes |
944 |
" |
|
60 | 945 |
super initialize. |
770 | 946 |
superclassName := 'ApplicationModel'. |
947 |
className := 'NewApplication'. |
|
948 |
methodName := 'windowSpec'. |
|
949 |
categoryName := 'Applications'. |
|
950 |
HandCursor := Cursor leftHand. |
|
951 |
handleColor := Color black. |
|
952 |
handleMasterColor := Color red. |
|
60 | 953 |
|
712 | 954 |
self backgroundColor: self class defaultViewBackgroundColor. |
60 | 955 |
! |
956 |
||
957 |
setupFromSpec:specOrSpecArray |
|
784 | 958 |
|
78 | 959 |
|spec builder| |
60 | 960 |
|
784 | 961 |
Cursor wait showWhile: [ |
962 |
self removeAll. |
|
963 |
spec := UISpecification from:specOrSpecArray. |
|
964 |
builder := UIBuilder new isEditing:true. |
|
965 |
"set applicationClass, in order that subspecifications may be resolved" |
|
966 |
className notNil ifTrue:[ |
|
967 |
builder applicationClass:(self resolveName:className). |
|
968 |
]. |
|
969 |
spec window setupView:self topView for:builder. |
|
970 |
self addSpec:(spec component) builder:builder in:self. |
|
971 |
self realizeAllSubViews. |
|
972 |
inputView raise. |
|
973 |
treeView setAttributesFromWindowSpec:(spec window) |
|
974 |
] |
|
975 |
||
223 | 976 |
! |
977 |
||
978 |
treeView:aTreeView |
|
361 | 979 |
treeView := aTreeView. |
980 |
||
981 |
treeView delegate:( |
|
376 | 982 |
"/ |
983 |
"/ I want to handle everything typed |
|
984 |
"/ in the treeView, except for Return and Cursor-keys |
|
985 |
"/ |
|
986 |
KeyboardForwarder |
|
987 |
toView:self |
|
988 |
condition:nil |
|
989 |
filter:[:k | (k isSymbol |
|
990 |
and:[k ~~ #Return |
|
991 |
and:[(k startsWith:#Cursor) not]]) |
|
992 |
] |
|
361 | 993 |
) |
994 |
||
376 | 995 |
"Modified: / 31.10.1997 / 20:22:09 / cg" |
60 | 996 |
! ! |
997 |
||
998 |
!UIPainterView methodsFor:'menus'! |
|
999 |
||
121 | 1000 |
showMiddleButtonMenu |
1001 |
"show the middle button menu; this returns nil |
|
62 | 1002 |
" |
223 | 1003 |
self enabled ifTrue:[ |
754 | 1004 |
(MenuPanel fromSpec:(UIPainter menuEdit) receiver:self superView application) startUp |
111 | 1005 |
]. |
121 | 1006 |
^ nil |
60 | 1007 |
|
62 | 1008 |
|
1009 |
||
60 | 1010 |
! ! |
1011 |
||
754 | 1012 |
!UIPainterView methodsFor:'private handles'! |
1013 |
||
1014 |
showSelected:aComponent |
|
1015 |
"show object selected |
|
1016 |
" |
|
1017 |
|wasClipped| |
|
1018 |
||
1019 |
selectionHiddenLevel == 0 ifTrue:[ |
|
1020 |
(treeView selection size > 1 and: |
|
1021 |
[(treeView model list at: treeView selection first) contents view == aComponent]) |
|
770 | 1022 |
ifTrue: [self paint: handleMasterColor] |
1023 |
ifFalse:[self paint: handleColor]. |
|
754 | 1024 |
|
1025 |
(wasClipped := clipChildren) ifTrue:[ |
|
1026 |
self clippedByChildren:(clipChildren := false). |
|
1027 |
]. |
|
1028 |
||
1029 |
self handlesOf:aComponent do:[:rectangle :what| |
|
1030 |
what == #view ifTrue:[self displayRectangle:rectangle] |
|
1031 |
ifFalse:[self fillRectangle:rectangle] |
|
1032 |
]. |
|
1033 |
||
1034 |
wasClipped ifTrue:[ |
|
1035 |
self clippedByChildren:(clipChildren := true). |
|
1036 |
] |
|
1037 |
] |
|
1038 |
||
1039 |
||
1040 |
! ! |
|
1041 |
||
335 | 1042 |
!UIPainterView methodsFor:'queries'! |
1043 |
||
1044 |
resolveName:aName |
|
1045 |
|appl| |
|
1046 |
||
1047 |
appl := self application. |
|
1048 |
||
1049 |
appl notNil ifTrue:[ |
|
1050 |
^ appl resolveName:aName |
|
1051 |
]. |
|
1052 |
^ Smalltalk resolveName:aName inClass:self class |
|
1053 |
! ! |
|
1054 |
||
60 | 1055 |
!UIPainterView methodsFor:'removing components'! |
1056 |
||
78 | 1057 |
remove:anObject |
1058 |
"remove anObject from the contents do redraw |
|
60 | 1059 |
" |
134 | 1060 |
anObject notNil ifTrue:[ |
238 | 1061 |
treeView removeView:anObject. |
134 | 1062 |
] |
60 | 1063 |
! |
1064 |
||
1065 |
removeAll |
|
62 | 1066 |
"remove all objects and properties |
1067 |
" |
|
776 | 1068 |
self select:nil. |
1069 |
treeView removeAll. |
|
1070 |
self removeUndoHistory. |
|
60 | 1071 |
! ! |
1072 |
||
1073 |
!UIPainterView methodsFor:'searching'! |
|
1074 |
||
285 | 1075 |
findContainerOfView:aView |
1076 |
"returns the super view assigned to a view |
|
89 | 1077 |
" |
285 | 1078 |
|p| |
89 | 1079 |
|
285 | 1080 |
(p := self propertyOfParentForView:aView) isNil ifTrue:[ |
89 | 1081 |
^ self |
1082 |
]. |
|
285 | 1083 |
^ p view |
89 | 1084 |
! |
1085 |
||
60 | 1086 |
findObjectAt:aPoint |
1087 |
"find the origin/corner of the currentWidget |
|
1088 |
" |
|
285 | 1089 |
|view prop| |
60 | 1090 |
|
1091 |
view := super findObjectAt:aPoint. |
|
285 | 1092 |
prop := self propertyRespondsToView:view. |
60 | 1093 |
|
285 | 1094 |
prop notNil ifTrue:[^ prop view]. |
1095 |
^ nil |
|
60 | 1096 |
! |
1097 |
||
1098 |
findViewWithId:aViewId |
|
62 | 1099 |
"finds view assigned to identifier and returns the view or nil |
60 | 1100 |
" |
1101 |
|prop| |
|
1102 |
||
1103 |
prop := self propertyOfIdentifier:aViewId. |
|
1104 |
||
1105 |
prop notNil ifTrue:[^ prop view] |
|
1106 |
ifFalse:[^ nil] |
|
78 | 1107 |
! |
1108 |
||
1109 |
propertyOfIdentifier:anId |
|
1110 |
"returns property assigned to unique identifier |
|
1111 |
" |
|
1112 |
anId notNil ifTrue:[ |
|
238 | 1113 |
^ treeView propertyDetect:[:p| p identifier == anId ] |
78 | 1114 |
]. |
1115 |
^ nil |
|
1116 |
! |
|
1117 |
||
1118 |
propertyOfName:aString |
|
1119 |
"returns property assigned to name |
|
1120 |
" |
|
111 | 1121 |
|name| |
1122 |
||
1123 |
aString isNil ifFalse:[ |
|
1124 |
name := aString string withoutSeparators. |
|
238 | 1125 |
^ treeView propertyDetect:[:p| p name = name ]. |
78 | 1126 |
]. |
1127 |
^ nil |
|
1128 |
! |
|
1129 |
||
285 | 1130 |
propertyOfParentForView:aSubView |
1131 |
"returns the property of the parent or nil |
|
1132 |
" |
|
1133 |
|item| |
|
1134 |
||
1135 |
(item := treeView detectItemRespondsToView:aSubView) notNil ifTrue:[ |
|
1136 |
(item := item parent) notNil ifTrue:[^ item contents] |
|
1137 |
]. |
|
1138 |
^ nil |
|
1139 |
! |
|
1140 |
||
78 | 1141 |
propertyOfView:aView |
1142 |
"returns property assigned to view |
|
1143 |
" |
|
1144 |
(aView isNil or:[aView == self]) ifFalse:[ |
|
238 | 1145 |
^ treeView propertyDetect:[:p| p view == aView ] |
78 | 1146 |
]. |
1147 |
^ nil |
|
1148 |
! |
|
1149 |
||
285 | 1150 |
propertyRespondsToView:aView |
1151 |
"detect the property responding to the argument a view. The property of the view or |
|
1152 |
the first subview providing the properties is returned. If no property is detected |
|
1153 |
nil is returned. |
|
1154 |
" |
|
1155 |
|item| |
|
1156 |
||
1157 |
item := treeView detectItemRespondsToView:aView. |
|
1158 |
||
1159 |
(item notNil and:[item parent notNil]) ifTrue:[ |
|
1160 |
^ item contents |
|
1161 |
]. |
|
1162 |
^ nil |
|
1163 |
! |
|
1164 |
||
111 | 1165 |
uniqueNameFor:aSpecOrString |
78 | 1166 |
"generate and return an unique name for a class |
1167 |
" |
|
1168 |
|next name size| |
|
1169 |
||
712 | 1170 |
aSpecOrString isString ifFalse:[name := aSpecOrString userFriendlyName] |
111 | 1171 |
ifTrue:[name := aSpecOrString]. |
78 | 1172 |
|
111 | 1173 |
size := name size + 1. |
1174 |
next := 0. |
|
78 | 1175 |
|
238 | 1176 |
treeView propertiesDo:[:p| |
111 | 1177 |
|n| |
78 | 1178 |
n := p name. |
1179 |
||
1180 |
(n size >= size and:[n startsWith:name]) ifTrue:[ |
|
1181 |
next := next max:(p extractNumberStartingAt:size) |
|
1182 |
] |
|
1183 |
]. |
|
1184 |
next := next + 1. |
|
1185 |
name := name, next printString. |
|
1186 |
^ name |
|
1187 |
||
1188 |
||
1189 |
||
662 | 1190 |
|
78 | 1191 |
! |
1192 |
||
1193 |
uniqueNameOf:aView |
|
111 | 1194 |
|prop| |
78 | 1195 |
|
111 | 1196 |
(prop := self propertyOfView:aView) notNil ifTrue:[ |
1197 |
prop name isNil ifTrue:[ |
|
1198 |
prop name:(self uniqueNameFor:(prop spec)). |
|
1199 |
]. |
|
1200 |
^ prop name |
|
78 | 1201 |
]. |
111 | 1202 |
^ 'self' |
78 | 1203 |
|
60 | 1204 |
! ! |
1205 |
||
223 | 1206 |
!UIPainterView methodsFor:'selection basics'! |
1207 |
||
1208 |
addToSelection:anObject |
|
1209 |
"add an object to the selection |
|
1210 |
" |
|
1211 |
(self enabled and:[(self isSelected:anObject) not]) ifTrue:[ |
|
1212 |
selection isCollection ifFalse:[ |
|
1213 |
selection isNil ifTrue:[ |
|
1214 |
selection := anObject |
|
1215 |
] ifFalse:[ |
|
1216 |
selection := OrderedCollection with:selection with:anObject |
|
1217 |
] |
|
1218 |
] ifTrue:[ |
|
1219 |
selection add:anObject |
|
1220 |
]. |
|
1221 |
self showSelected:anObject. |
|
238 | 1222 |
treeView cvsSelectionAdd:anObject. |
223 | 1223 |
] |
1224 |
||
1225 |
||
1226 |
! |
|
1227 |
||
1228 |
removeFromSelection:anObject |
|
1229 |
"remove an object from the selection |
|
1230 |
" |
|
1231 |
(self isSelected:anObject) ifTrue:[ |
|
1232 |
self showUnselected:anObject. |
|
1233 |
||
1234 |
selection size > 1 ifTrue:[ |
|
1235 |
selection remove:anObject ifAbsent:nil. |
|
1236 |
self showSelection. |
|
1237 |
] ifFalse:[ |
|
1238 |
selection := nil |
|
1239 |
]. |
|
238 | 1240 |
treeView cvsSelectionRemove:anObject. |
223 | 1241 |
] |
1242 |
||
1243 |
! |
|
1244 |
||
1245 |
select:something |
|
1246 |
"change selection to something |
|
1247 |
" |
|
760 | 1248 |
(self enabled and:[something ~= self selection]) ifTrue:[ |
1249 |
something isNil |
|
1250 |
ifTrue: [treeView selection: (Array with: 1)] |
|
1251 |
ifFalse:[treeView cvsSelection:something]. |
|
1252 |
self setSelection:something withRedraw:true |
|
223 | 1253 |
] |
1254 |
||
1255 |
! |
|
1256 |
||
285 | 1257 |
updateSelectionFromModel:aSelOrNil |
223 | 1258 |
"update selection from a new selection |
1259 |
" |
|
768 | 1260 |
|aSet| |
1261 |
||
223 | 1262 |
selectionHiddenLevel == 0 ifTrue:[ |
285 | 1263 |
aSelOrNil size ~~ 0 ifTrue:[ |
768 | 1264 |
self selectionDo:[:el| |
1265 |
(aSelOrNil includes:el) ifFalse:[ |
|
1266 |
aSet isNil ifTrue:[ |
|
1267 |
aSet := IdentitySet new |
|
1268 |
]. |
|
1269 |
self showUnselected:el addAffectedViewsTo:aSet. |
|
1270 |
] |
|
1271 |
]. |
|
1272 |
self handleAffectedViews:aSet. |
|
285 | 1273 |
] ifFalse:[ |
768 | 1274 |
self hideSelection. |
285 | 1275 |
] |
223 | 1276 |
]. |
285 | 1277 |
self setSelection:aSelOrNil withRedraw:false. |
223 | 1278 |
self showSelection |
1279 |
||
1280 |
! ! |
|
1281 |
||
78 | 1282 |
!UIPainterView methodsFor:'specification'! |
1283 |
||
1284 |
addSpec:aSpecification builder:aBuilder in:aFrame |
|
1285 |
"build view and subviews from aSpecification into a frame. The top view |
|
1286 |
is returned. The contained components of a spec are set to nil |
|
1287 |
" |
|
330 | 1288 |
|cls| |
212 | 1289 |
|
330 | 1290 |
cls := self resolveName:className. |
1291 |
||
1292 |
cls notNil ifTrue:[ |
|
1293 |
aBuilder applicationClass:cls. |
|
212 | 1294 |
]. |
78 | 1295 |
|
111 | 1296 |
aBuilder componentCreationHook:[:aView :aSpec :aBdr||sv p s n| |
78 | 1297 |
p := ViewProperty new. |
1298 |
s := aSpec copy. |
|
1299 |
p spec:s. |
|
1300 |
p view:aView. |
|
1301 |
||
1302 |
s class supportsSubComponents ifTrue:[ |
|
1303 |
s component:nil |
|
1304 |
]. |
|
1305 |
||
111 | 1306 |
n := s name. |
1307 |
||
1308 |
(n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[ |
|
1309 |
s name:(self uniqueNameFor:s) |
|
78 | 1310 |
]. |
238 | 1311 |
treeView addProperty:p. |
78 | 1312 |
]. |
1313 |
||
1314 |
^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame. |
|
60 | 1315 |
|
212 | 1316 |
"Modified: 4.7.1997 / 23:48:55 / cg" |
78 | 1317 |
! |
1318 |
||
1319 |
fullSpecFor:anObject |
|
1320 |
"generate a full spec for an object |
|
62 | 1321 |
" |
78 | 1322 |
|mySpec subSpecs| |
1323 |
||
1324 |
mySpec := self specFor:anObject. |
|
1325 |
||
1326 |
(mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[ |
|
1327 |
(anObject subViews notNil) ifTrue:[ |
|
1328 |
anObject subViews do:[:aSubView||spec| |
|
1329 |
spec := self fullSpecFor:aSubView. |
|
1330 |
spec notNil ifTrue:[ |
|
1331 |
subSpecs isNil ifTrue:[ |
|
1332 |
subSpecs := OrderedCollection new |
|
1333 |
]. |
|
1334 |
subSpecs add:spec. |
|
1335 |
]. |
|
1336 |
]. |
|
1337 |
subSpecs notNil ifTrue:[ |
|
1338 |
mySpec component:(SpecCollection new collection:subSpecs) |
|
1339 |
] |
|
1340 |
] |
|
1341 |
]. |
|
1342 |
^ mySpec |
|
1343 |
||
60 | 1344 |
|
1345 |
||
1346 |
||
1347 |
||
1348 |
||
1349 |
! |
|
1350 |
||
285 | 1351 |
rebuildView:aView fromSpec:aSpec withBuilder:aBuilder |
1352 |
|v| |
|
1353 |
||
1354 |
aSpec needsRebuildForAttributes ifTrue:[ |
|
1355 |
v := aSpec buildViewWithLayoutFor:aBuilder in:(self findContainerOfView:aView). |
|
1356 |
v realize. |
|
1357 |
aView destroy. |
|
1358 |
device sync. |
|
1359 |
device flush. |
|
1360 |
aView becomeSameAs:v. |
|
1361 |
inputView raise. |
|
1362 |
] ifFalse:[ |
|
1363 |
aSpec setAttributesIn:aView with:aBuilder. |
|
1364 |
self elementChangedSize:aView. |
|
1365 |
]. |
|
1366 |
||
1367 |
! |
|
1368 |
||
78 | 1369 |
specFor:anObject |
1370 |
"returns spec assigned to an object |
|
62 | 1371 |
" |
78 | 1372 |
|prop spec| |
60 | 1373 |
|
78 | 1374 |
(prop := self propertyOfView:anObject) notNil ifTrue:[ |
1375 |
spec := prop spec copy. |
|
1376 |
spec layoutFromView:anObject |
|
60 | 1377 |
]. |
78 | 1378 |
^ spec |
1379 |
||
1380 |
||
1381 |
||
60 | 1382 |
! |
1383 |
||
146 | 1384 |
specForSelection |
1385 |
"returns spec assigned to current single selection or nil |
|
1386 |
" |
|
1387 |
^ self specFor:(self singleSelection) |
|
1388 |
||
1389 |
||
1390 |
! |
|
1391 |
||
78 | 1392 |
updateFromSpec:aSpec |
1393 |
"update current selected view from specification |
|
62 | 1394 |
" |
327
0040d47658c6
check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1395 |
|props name builder| |
78 | 1396 |
|
281 | 1397 |
aSpec class == WindowSpec ifTrue:[ |
698 | 1398 |
^ treeView canvasSpec:aSpec |
281 | 1399 |
]. |
1400 |
||
78 | 1401 |
self singleSelection notNil ifTrue:[ |
1402 |
self withSelectionHiddenDo:[ |
|
1403 |
self transaction:#specification selectionDo:[:aView| |
|
395 | 1404 |
builder := UIBuilder new isEditing:true. |
212 | 1405 |
className notNil ifTrue:[ |
330 | 1406 |
builder applicationClass:(self resolveName:className). |
212 | 1407 |
]. |
78 | 1408 |
props := self propertyOfView:aView. |
82 | 1409 |
name := (aSpec name) withoutSeparators. |
78 | 1410 |
|
82 | 1411 |
name = props name ifFalse:[ |
1412 |
(self propertyOfName:name) notNil ifTrue:[ |
|
1413 |
name := props name |
|
78 | 1414 |
] |
1415 |
]. |
|
82 | 1416 |
aSpec name:name. |
134 | 1417 |
self createUndoSpecModify:props. |
285 | 1418 |
self rebuildView:aView fromSpec:aSpec withBuilder:builder. |
78 | 1419 |
props spec:(aSpec copy). |
238 | 1420 |
treeView propertyChanged:props. |
78 | 1421 |
] |
111 | 1422 |
] |
82 | 1423 |
] |
212 | 1424 |
|
1425 |
"Modified: 4.7.1997 / 23:49:44 / cg" |
|
60 | 1426 |
! ! |
1427 |
||
285 | 1428 |
!UIPainterView methodsFor:'testing'! |
1429 |
||
1430 |
canChangeLayoutOfView:aView |
|
1431 |
"returns true if the view can change its layout which is dependant on |
|
1432 |
its parent view. |
|
1433 |
" |
|
1434 |
|item prnt| |
|
1435 |
||
1436 |
( (item := treeView itemOfView:aView) isNil |
|
1437 |
or:[(prnt := item parent) isNil] |
|
1438 |
) ifTrue:[ |
|
1439 |
^ false |
|
1440 |
]. |
|
1441 |
^ (prnt parent isNil or:[prnt contents spec class isLayoutContainer not]) |
|
1442 |
! |
|
1443 |
||
1444 |
canKeepLayoutInSelection |
|
1445 |
"returns true if layout can be kept during a paste operation |
|
1446 |
" |
|
1447 |
|prop| |
|
1448 |
||
1449 |
prop := self propertyOfView:(self singleSelection). |
|
1450 |
^ (prop isNil or:[prop spec class isLayoutContainer not]) |
|
1451 |
! |
|
1452 |
||
1453 |
canMove:something |
|
1454 |
"checks whether something is not nil and if all widgets derived from |
|
1455 |
something can change their layout ( move, align, ... operation ). |
|
1456 |
" |
|
1457 |
something notNil ifTrue:[ |
|
1458 |
self forEach:something do:[:aView| |
|
1459 |
(self canChangeLayoutOfView:aView) ifFalse:[^ false] |
|
1460 |
]. |
|
1461 |
^ true |
|
1462 |
]. |
|
1463 |
^ false |
|
1464 |
! |
|
1465 |
||
1466 |
canMoveOrAlignSelection |
|
1467 |
"returns true if a selection exists and all elements in the selection |
|
1468 |
can be moved or aligned |
|
1469 |
" |
|
1470 |
^ self canMove:(self selection) |
|
1471 |
||
1472 |
! ! |
|
1473 |
||
60 | 1474 |
!UIPainterView methodsFor:'transaction'! |
1475 |
||
1476 |
transaction:aType objects:something do:aOneArgBlock |
|
1477 |
"opens a transaction and evaluates a block within the transaction; the |
|
1478 |
argument to the block is a view from derived from something |
|
1479 |
" |
|
134 | 1480 |
self withinTransaction:aType objects:something do:[ |
1481 |
self forEach:something do:aOneArgBlock |
|
60 | 1482 |
] |
1483 |
! |
|
1484 |
||
134 | 1485 |
withinTransaction:aType objects:objects do:aNoneArgBlock |
1486 |
"evaluate a block with no arguments within a transaction |
|
60 | 1487 |
" |
134 | 1488 |
|text size prop| |
1489 |
||
1490 |
objects isNil ifTrue:[ ^ self ]. |
|
1491 |
||
1492 |
size := objects size. |
|
60 | 1493 |
|
134 | 1494 |
objects isCollection ifTrue:[ |
1495 |
size == 0 ifTrue:[ ^ self ]. |
|
1496 |
size == 1 ifTrue:[ prop := self propertyOfView:(objects first) ] |
|
1497 |
] ifFalse:[ |
|
1498 |
prop := self propertyOfView:objects |
|
1499 |
]. |
|
60 | 1500 |
|
134 | 1501 |
prop notNil ifTrue:[ |
1502 |
text := prop name |
|
1503 |
] ifFalse:[ |
|
1504 |
text := size printString, ' elements' |
|
60 | 1505 |
]. |
134 | 1506 |
|
1507 |
undoHistory withinTransaction:aType text:text do:[ |
|
1508 |
aNoneArgBlock value |
|
1509 |
] |
|
60 | 1510 |
! ! |
1511 |
||
1512 |
!UIPainterView methodsFor:'undo actions'! |
|
1513 |
||
134 | 1514 |
createUndoLayout:aView |
1515 |
"create undo action before changing a views layout |
|
60 | 1516 |
" |
134 | 1517 |
|lyt args prop| |
60 | 1518 |
|
1519 |
undoHistory isTransactionOpen ifTrue:[ |
|
1520 |
prop := self propertyOfView:aView. |
|
134 | 1521 |
|
60 | 1522 |
prop notNil ifTrue:[ |
134 | 1523 |
args := Array new:3. |
1524 |
args at:1 put:(prop identifier). |
|
1525 |
||
1526 |
(lyt := aView geometryLayout) notNil ifTrue:[ |
|
1527 |
args at:2 put:#geometryLayout: |
|
1528 |
] ifFalse:[ |
|
146 | 1529 |
lyt := aView extent. |
134 | 1530 |
args at:2 put:#extent: |
1531 |
]. |
|
1532 |
args at:3 put:(lyt copy). |
|
1533 |
undoHistory addUndoSelector:#undoLayout: withArgs:args. |
|
60 | 1534 |
] |
1535 |
] |
|
1536 |
! |
|
1537 |
||
134 | 1538 |
createUndoRemove:aView |
1539 |
"create undo method before deleting views |
|
60 | 1540 |
" |
285 | 1541 |
|prop pid| |
134 | 1542 |
|
1543 |
(prop := self propertyOfView:aView) notNil ifTrue:[ |
|
285 | 1544 |
(pid := self propertyOfParentForView:aView) notNil ifTrue:[ |
1545 |
pid := pid identifier |
|
1546 |
]. |
|
60 | 1547 |
|
134 | 1548 |
undoHistory addUndoSelector:#undoRemove: |
285 | 1549 |
withArgs:(Array with:(self fullSpecFor:aView) |
1550 |
with:(prop identifier) |
|
1551 |
with:pid) |
|
134 | 1552 |
] |
1553 |
! |
|
60 | 1554 |
|
134 | 1555 |
createUndoSpecModify:aProp |
1556 |
"undo method when changing the specification for an object |
|
1557 |
" |
|
1558 |
aProp notNil ifTrue:[ |
|
1559 |
undoHistory addUndoSelector:#undoSpecModify: |
|
1560 |
withArgs:(Array with:(aProp spec) with:(aProp identifier)) |
|
1561 |
] |
|
1562 |
! |
|
60 | 1563 |
|
134 | 1564 |
undoCreate:something |
1565 |
"undo method for creating or pasting an object |
|
1566 |
" |
|
1567 |
self forEach:something do:[:anId|self remove:(self findViewWithId:anId)]. |
|
1568 |
! |
|
60 | 1569 |
|
134 | 1570 |
undoLayout:args |
1571 |
"undo method to set the old layout; see 'createUndoLayout:' |
|
1572 |
" |
|
1573 |
|view| |
|
1574 |
||
1575 |
(view := self findViewWithId:(args at:1)) notNil ifTrue:[ |
|
146 | 1576 |
view perform:(args at:2) with:(args at:3). |
223 | 1577 |
self layoutChanged. |
60 | 1578 |
] |
1579 |
! |
|
1580 |
||
134 | 1581 |
undoRemove:args |
1582 |
"undo method when removing an object; see 'createUndoRemove:' |
|
1583 |
" |
|
1584 |
|frame prop view| |
|
1585 |
||
1586 |
(args at:3) notNil ifTrue:[ |
|
1587 |
frame := self findViewWithId:(args at:3). |
|
1588 |
]. |
|
1589 |
frame isNil ifTrue:[ |
|
1590 |
frame := self |
|
1591 |
]. |
|
395 | 1592 |
view := self addSpec:(args at:1) builder:(UIBuilder new isEditing:true) in:frame. |
134 | 1593 |
view realize. |
1594 |
inputView raise. |
|
1595 |
||
1596 |
prop := self propertyOfView:view. |
|
1597 |
prop identifier:(args at:2). |
|
1598 |
||
1599 |
! |
|
1600 |
||
1601 |
undoSpecModify:args |
|
1602 |
"undo method when changing a spec; see 'createUndoSpecModify:' |
|
60 | 1603 |
" |
327
0040d47658c6
check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1604 |
|builder view spec props| |
60 | 1605 |
|
134 | 1606 |
props := self propertyOfIdentifier:(args at:2). |
60 | 1607 |
|
134 | 1608 |
props notNil ifTrue:[ |
1609 |
view := props view. |
|
1610 |
spec := args at:1. |
|
395 | 1611 |
builder := UIBuilder new isEditing:true. |
1612 |
||
212 | 1613 |
className notNil ifTrue:[ |
330 | 1614 |
builder applicationClass:(self resolveName:className). |
212 | 1615 |
]. |
134 | 1616 |
props spec:spec. |
285 | 1617 |
self rebuildView:view fromSpec:spec withBuilder:builder. |
238 | 1618 |
treeView propertyChanged:props. |
211 | 1619 |
] |
1620 |
! ! |
|
1621 |
||
1622 |
!UIPainterView::ViewProperty class methodsFor:'instance creation'! |
|
1623 |
||
1624 |
new |
|
1625 |
Identifier notNil ifTrue:[Identifier := Identifier + 1] |
|
1626 |
ifFalse:[Identifier := 1]. |
|
1627 |
||
1628 |
^ self basicNew initialize |
|
1629 |
! ! |
|
1630 |
||
1631 |
!UIPainterView::ViewProperty methodsFor:'accessing'! |
|
1632 |
||
1633 |
identifier |
|
1634 |
"return the unique identifier assigned to property |
|
1635 |
" |
|
1636 |
^ identifier |
|
1637 |
! |
|
1638 |
||
1639 |
identifier:anIdentifier |
|
1640 |
"set the unique identifier assigned to property; called after an restore of |
|
1641 |
a deleted instance |
|
1642 |
" |
|
1643 |
identifier := anIdentifier |
|
1644 |
! |
|
1645 |
||
1646 |
spec |
|
1647 |
"return the value of the instance variable 'spec' (automatically generated)" |
|
1648 |
||
1649 |
^ spec! |
|
1650 |
||
1651 |
spec:something |
|
1652 |
"set the value of the instance variable 'spec' (automatically generated)" |
|
1653 |
||
1654 |
spec := something.! |
|
1655 |
||
1656 |
view |
|
1657 |
"return the value of the instance variable 'view' (automatically generated)" |
|
1658 |
||
1659 |
^ view! |
|
1660 |
||
1661 |
view:something |
|
1662 |
"set the value of the instance variable 'view' (automatically generated)" |
|
1663 |
||
1664 |
view := something.! ! |
|
1665 |
||
1666 |
!UIPainterView::ViewProperty methodsFor:'initialization'! |
|
1667 |
||
1668 |
initialize |
|
1669 |
super initialize. |
|
1670 |
identifier := Identifier |
|
1671 |
! ! |
|
1672 |
||
1673 |
!UIPainterView::ViewProperty methodsFor:'misc'! |
|
1674 |
||
1675 |
extractNumberStartingAt:anIndex |
|
1676 |
"return the number from the name starting at anIndex or 0. |
|
1677 |
" |
|
1678 |
|val| |
|
1679 |
||
1680 |
val := 0. |
|
1681 |
||
1682 |
self name from:anIndex do:[:c| |
|
1683 |
c isDigit ifTrue:[val := val * 10 + c digitValue] |
|
1684 |
ifFalse:[^ 0] |
|
1685 |
]. |
|
1686 |
^ val |
|
1687 |
||
1688 |
! ! |
|
1689 |
||
1690 |
!UIPainterView::ViewProperty methodsFor:'spec messages'! |
|
1691 |
||
1692 |
doesNotUnderstand:aMessage |
|
1693 |
spec notNil ifTrue:[ |
|
1694 |
(spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec] |
|
1695 |
]. |
|
1696 |
^ nil |
|
1697 |
! |
|
1698 |
||
1699 |
layout |
|
1700 |
spec layout |
|
1701 |
! |
|
1702 |
||
1703 |
layout:aLayout |
|
1704 |
spec layout:aLayout |
|
1705 |
! |
|
1706 |
||
1707 |
name |
|
1708 |
^ spec name |
|
1709 |
! |
|
1710 |
||
1711 |
name:aName |
|
1712 |
spec name:aName |
|
1713 |
! ! |
|
1714 |
||
60 | 1715 |
!UIPainterView class methodsFor:'documentation'! |
1716 |
||
1717 |
version |
|
1718 |
^ '$Header$' |
|
1719 |
! ! |