|
1 ApplicationModel subclass:#UIPropertyView |
|
2 instanceVariableNames:'receiver modified propertyFrame propertyList propertySpecs |
|
3 currentView currentSpec aspects specBeingEdited |
|
4 userSelectedProperty' |
|
5 classVariableNames:'' |
|
6 poolDictionaries:'' |
|
7 category:'Interface-UIPainter' |
|
8 ! |
|
9 |
|
10 |
|
11 !UIPropertyView class methodsFor:'instance creation'! |
|
12 |
|
13 in:aTopView receiver:aReceiver |
|
14 |application| |
|
15 |
|
16 application := self new. |
|
17 application in:aTopView receiver:aReceiver. |
|
18 ^ application |
|
19 ! ! |
|
20 |
|
21 !UIPropertyView class methodsFor:'specifications'! |
|
22 |
|
23 specificationAlignmentOrigin |
|
24 " |
|
25 UIPainter new openOnClass:self andSelector:#specificationAlignmentOrigin |
|
26 " |
|
27 <resource: #canvas> |
|
28 |
|
29 ^ |
|
30 |
|
31 #(#FullSpec |
|
32 #'window:' |
|
33 #(#WindowSpec |
|
34 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
35 #'label:' 'unnamed' |
|
36 #'bounds:' #(#Rectangle 0 0 248 304) |
|
37 ) |
|
38 #'component:' |
|
39 #(#SpecCollection |
|
40 #'collection:' |
|
41 #( |
|
42 #(#LabelSpec |
|
43 #'name:' 'label1' |
|
44 #'layout:' #(#LayoutFrame 5 0 42 0 48 0 60 0) |
|
45 #'label:' 'left' |
|
46 ) |
|
47 #(#LabelSpec |
|
48 #'name:' 'label2' |
|
49 #'layout:' #(#LayoutFrame 5 0 69 0 48 0 87 0) |
|
50 #'label:' 'top' |
|
51 ) |
|
52 #(#LabelSpec |
|
53 #'name:' 'label3' |
|
54 #'layout:' #(#LayoutFrame 57 0 10 0 103 0 27 0) |
|
55 #'label:' 'relative' |
|
56 ) |
|
57 #(#LabelSpec |
|
58 #'name:' 'label4' |
|
59 #'layout:' #(#LayoutFrame 154 0 11 0 190 0 28 0) |
|
60 #'label:' 'offset' |
|
61 ) |
|
62 #(#LabelSpec |
|
63 #'name:' 'label5' |
|
64 #'layout:' #(#LayoutFrame 5 0 96 0 48 0 114 0) |
|
65 #'label:' 'align H' |
|
66 ) |
|
67 #(#LabelSpec |
|
68 #'name:' 'label6' |
|
69 #'layout:' #(#LayoutFrame 5 0 122 0 48 0 140 0) |
|
70 #'label:' 'align V' |
|
71 ) |
|
72 #(#InputFieldSpec |
|
73 #'name:' 'editField1' |
|
74 #'type:' #numberOrNil |
|
75 #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0) |
|
76 #'model:' #leftFraction |
|
77 #acceptOnLostFocus: true |
|
78 #tabable: true |
|
79 ) |
|
80 #(#InputFieldSpec |
|
81 #'name:' 'editField2' |
|
82 #'type:' #numberOrNil |
|
83 #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0) |
|
84 #'model:' #topFraction |
|
85 #acceptOnLostFocus: true |
|
86 #tabable: true |
|
87 ) |
|
88 #(#InputFieldSpec |
|
89 #'name:' 'editField5' |
|
90 #'type:' #numberOrNil |
|
91 #'layout:' #(#LayoutFrame 57 0 96 0 114 0 114 0) |
|
92 #'model:' #leftAlignmentFraction |
|
93 #acceptOnLostFocus: true |
|
94 #tabable: true |
|
95 ) |
|
96 #(#InputFieldSpec |
|
97 #'name:' 'editField6' |
|
98 #'type:' #numberOrNil |
|
99 #'layout:' #(#LayoutFrame 56 0 122 0 113 0 140 0) |
|
100 #'model:' #topAlignmentFraction |
|
101 #acceptOnLostFocus: true |
|
102 #tabable: true |
|
103 ) |
|
104 #(#InputFieldSpec |
|
105 #'name:' 'editField3' |
|
106 #'type:' #numberOrNil |
|
107 #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0) |
|
108 #'model:' #leftOffset |
|
109 #acceptOnLostFocus: true |
|
110 #tabable: true |
|
111 ) |
|
112 #(#InputFieldSpec |
|
113 #'name:' 'editField4' |
|
114 #'type:' #numberOrNil |
|
115 #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0) |
|
116 #'model:' #topOffset |
|
117 #acceptOnLostFocus: true |
|
118 #tabable: true |
|
119 ) |
|
120 #(#ActionButtonSpec |
|
121 #'name:' 'button1' |
|
122 #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0) |
|
123 #'label:' '' |
|
124 #'model:' #makeRelativeLeft |
|
125 ) |
|
126 #(#ActionButtonSpec |
|
127 #'name:' 'button2' |
|
128 #'layout:' #(#LayoutFrame 119 0 69 0 138 0 87 0) |
|
129 #'label:' '' |
|
130 #'model:' #makeRelativeTop |
|
131 ) |
|
132 #(#ActionButtonSpec |
|
133 #'name:' 'button3' |
|
134 #'layout:' #(#LayoutFrame 216 0 42 0 235 0 60 0) |
|
135 #'label:' '' |
|
136 #'model:' #makeOffsetLeft |
|
137 ) |
|
138 #(#ActionButtonSpec |
|
139 #'name:' 'button4' |
|
140 #'layout:' #(#LayoutFrame 216 0 69 0 235 0 87 0) |
|
141 #'label:' '' |
|
142 #'model:' #makeOffsetTop |
|
143 ) |
|
144 |
|
145 |
|
146 #(#ActionButtonSpec |
|
147 #'name:' 'button' |
|
148 #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0) |
|
149 #'label:' 'frame' |
|
150 #'model:' #setLayoutFrame |
|
151 ) |
|
152 #(#ActionButtonSpec |
|
153 #'name:' 'button' |
|
154 #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0) |
|
155 #'label:' 'origin' |
|
156 #'model:' #setLayoutOrigin |
|
157 ) |
|
158 #(#ActionButtonSpec |
|
159 #'name:' 'button' |
|
160 #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0) |
|
161 #'label:' 'align' |
|
162 #'model:' #setAlignmentOrigin |
|
163 #'initiallyDisabled:' true |
|
164 ) |
|
165 |
|
166 ) |
|
167 ) |
|
168 ) |
|
169 |
|
170 |
|
171 |
|
172 ! |
|
173 |
|
174 specificationLayoutFrame |
|
175 " |
|
176 UIPainter new openOnClass:self andSelector:#specificationLayoutFrame |
|
177 " |
|
178 <resource: #canvas> |
|
179 |
|
180 ^ |
|
181 |
|
182 #(#FullSpec |
|
183 #'window:' |
|
184 #(#WindowSpec |
|
185 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
186 #'label:' 'unnamed' |
|
187 #'bounds:' #(#Rectangle 0 0 300 300) |
|
188 ) |
|
189 #'component:' |
|
190 #(#SpecCollection |
|
191 #'collection:' |
|
192 #( |
|
193 #(#LabelSpec |
|
194 #'name:' 'label left' |
|
195 #'layout:' #(#LayoutFrame 12 0 39 0 53 0 57 0) |
|
196 #'label:' 'left' |
|
197 ) |
|
198 #(#LabelSpec |
|
199 #'name:' 'label top' |
|
200 #'layout:' #(#LayoutFrame 12 0 67 0 53 0 85 0) |
|
201 #'label:' 'top' |
|
202 ) |
|
203 #(#LabelSpec |
|
204 #'name:' 'label right' |
|
205 #'layout:' #(#LayoutFrame 12 0 95 0 53 0 113 0) |
|
206 #'label:' 'right' |
|
207 ) |
|
208 #(#LabelSpec |
|
209 #'name:' 'label bottom' |
|
210 #'layout:' #(#LayoutFrame 12 0 123 0 53 0 141 0) |
|
211 #'label:' 'bottom' |
|
212 ) |
|
213 #(#LabelSpec |
|
214 #'name:' 'label relative' |
|
215 #'layout:' #(#LayoutFrame 65 0 6 0 110 0 24 0) |
|
216 #'label:' 'relative' |
|
217 ) |
|
218 #(#LabelSpec |
|
219 #'name:' 'label offset' |
|
220 #'layout:' #(#LayoutFrame 159 0 6 0 190 0 24 0) |
|
221 #'label:' 'offset' |
|
222 ) |
|
223 #(#LabelSpec |
|
224 #'name:' 'label all relative' |
|
225 #'layout:' #(#LayoutFrame 12 0 157 0 53 0 175 0) |
|
226 #'label:' 'all' |
|
227 ) |
|
228 #(#LabelSpec |
|
229 #'name:' 'label all absolute' |
|
230 #'layout:' #(#LayoutFrame 159 0 157 0 210 0 175 0) |
|
231 #'label:' 'all' |
|
232 ) |
|
233 #(#InputFieldSpec |
|
234 #'name:' 'relative E1' |
|
235 #'layout:' #(#LayoutFrame 65 0 39 0 113 0 57 0) |
|
236 #'model:' #leftFraction |
|
237 #'type:' #numberOrNil |
|
238 #'immediateAccept:' false |
|
239 #'acceptOnLeave:' true |
|
240 #'acceptOnReturn:' true |
|
241 #'acceptOnTab:' true |
|
242 #'acceptOnLostFocus:' true |
|
243 ) |
|
244 #(#InputFieldSpec |
|
245 #'name:' 'relative E2' |
|
246 #'layout:' #(#LayoutFrame 65 0 67 0 113 0 85 0) |
|
247 #'model:' #topFraction |
|
248 #'type:' #numberOrNil |
|
249 #'immediateAccept:' false |
|
250 #'acceptOnLeave:' true |
|
251 #'acceptOnReturn:' true |
|
252 #'acceptOnTab:' true |
|
253 #'acceptOnLostFocus:' true |
|
254 ) |
|
255 #(#InputFieldSpec |
|
256 #'name:' 'relative E3' |
|
257 #'layout:' #(#LayoutFrame 65 0 95 0 113 0 113 0) |
|
258 #'model:' #rightFraction |
|
259 #'type:' #numberOrNil |
|
260 #'immediateAccept:' false |
|
261 #'acceptOnLeave:' true |
|
262 #'acceptOnReturn:' true |
|
263 #'acceptOnTab:' true |
|
264 #'acceptOnLostFocus:' true |
|
265 ) |
|
266 #(#InputFieldSpec |
|
267 #'name:' 'relative E4' |
|
268 #'layout:' #(#LayoutFrame 65 0 123 0 113 0 141 0) |
|
269 #'model:' #bottomFraction |
|
270 #'type:' #numberOrNil |
|
271 #'immediateAccept:' false |
|
272 #'acceptOnLeave:' true |
|
273 #'acceptOnReturn:' true |
|
274 #'acceptOnTab:' true |
|
275 #'acceptOnLostFocus:' true |
|
276 ) |
|
277 #(#InputFieldSpec |
|
278 #'name:' 'offset E1' |
|
279 #'layout:' #(#LayoutFrame 159 0 39 0 210 0 57 0) |
|
280 #'model:' #leftOffset |
|
281 #'type:' #numberOrNil |
|
282 #'immediateAccept:' false |
|
283 #'acceptOnLeave:' true |
|
284 #'acceptOnReturn:' true |
|
285 #'acceptOnTab:' true |
|
286 #'acceptOnLostFocus:' true |
|
287 ) |
|
288 #(#InputFieldSpec |
|
289 #'name:' 'offset E2' |
|
290 #'layout:' #(#LayoutFrame 159 0 67 0 210 0 85 0) |
|
291 #'model:' #topOffset |
|
292 #'type:' #numberOrNil |
|
293 #'immediateAccept:' false |
|
294 #'acceptOnLeave:' true |
|
295 #'acceptOnReturn:' true |
|
296 #'acceptOnTab:' true |
|
297 #'acceptOnLostFocus:' true |
|
298 ) |
|
299 #(#InputFieldSpec |
|
300 #'name:' 'offset E3' |
|
301 #'layout:' #(#LayoutFrame 159 0 95 0 210 0 113 0) |
|
302 #'model:' #rightOffset |
|
303 #'type:' #numberOrNil |
|
304 #'immediateAccept:' false |
|
305 #'acceptOnLeave:' true |
|
306 #'acceptOnReturn:' true |
|
307 #'acceptOnTab:' true |
|
308 #'acceptOnLostFocus:' true |
|
309 ) |
|
310 #(#InputFieldSpec |
|
311 #'name:' 'offset E4' |
|
312 #'layout:' #(#LayoutFrame 159 0 123 0 210 0 141 0) |
|
313 #'model:' #bottomOffset |
|
314 #'type:' #numberOrNil |
|
315 #'immediateAccept:' false |
|
316 #'acceptOnLeave:' true |
|
317 #'acceptOnReturn:' true |
|
318 #'acceptOnTab:' true |
|
319 #'acceptOnLostFocus:' true |
|
320 ) |
|
321 #(#ActionButtonSpec |
|
322 #'name:' 'relative B1' |
|
323 #'layout:' #(#LayoutFrame 117 0 39 0 136 0 57 0) |
|
324 #'label:' ' ' |
|
325 #'model:' #makeRelativeLeft |
|
326 ) |
|
327 #(#ActionButtonSpec |
|
328 #'name:' 'relative B2' |
|
329 #'layout:' #(#LayoutFrame 117 0 67 0 136 0 85 0) |
|
330 #'label:' ' ' |
|
331 #'model:' #makeRelativeTop |
|
332 ) |
|
333 #(#ActionButtonSpec |
|
334 #'name:' 'relative B3' |
|
335 #'layout:' #(#LayoutFrame 117 0 95 0 136 0 113 0) |
|
336 #'label:' ' ' |
|
337 #'model:' #makeRelativeRight |
|
338 ) |
|
339 #(#ActionButtonSpec |
|
340 #'name:' 'relative B4' |
|
341 #'layout:' #(#LayoutFrame 117 0 123 0 136 0 141 0) |
|
342 #'label:' ' ' |
|
343 #'model:' #makeRelativeBottom |
|
344 ) |
|
345 #(#ActionButtonSpec |
|
346 #'name:' 'relative BAll' |
|
347 #'layout:' #(#LayoutFrame 117 0 157 0 136 0 175 0) |
|
348 #'label:' ' ' |
|
349 #'model:' #makeRelativeAll |
|
350 ) |
|
351 #(#ActionButtonSpec |
|
352 #'name:' 'offset B1' |
|
353 #'layout:' #(#LayoutFrame 214 0 39 0 233 0 57 0) |
|
354 #'label:' '' |
|
355 #'model:' #makeOffsetLeft |
|
356 ) |
|
357 #(#ActionButtonSpec |
|
358 #'name:' 'offset B2' |
|
359 #'layout:' #(#LayoutFrame 214 0 67 0 233 0 85 0) |
|
360 #'label:' '' |
|
361 #'model:' #makeOffsetTop |
|
362 ) |
|
363 #(#ActionButtonSpec |
|
364 #'name:' 'offset B3' |
|
365 #'layout:' #(#LayoutFrame 214 0 95 0 233 0 113 0) |
|
366 #'label:' '' |
|
367 #'model:' #makeOffsetRight |
|
368 ) |
|
369 #(#ActionButtonSpec |
|
370 #'name:' 'offset B4' |
|
371 #'layout:' #(#LayoutFrame 214 0 123 0 233 0 141 0) |
|
372 #'label:' '' |
|
373 #'model:' #makeOffsetBottom |
|
374 ) |
|
375 #(#ActionButtonSpec |
|
376 #'name:' 'offset BAll' |
|
377 #'layout:' #(#LayoutFrame 214 0 157 0 233 0 175 0) |
|
378 #'label:' ' ' |
|
379 #'model:' #makeOffsetAll |
|
380 ) |
|
381 #(#ActionButtonSpec |
|
382 #'name:' 'button' |
|
383 #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0) |
|
384 #'label:' 'frame' |
|
385 #'model:' #setLayoutFrame |
|
386 ) |
|
387 #(#ActionButtonSpec |
|
388 #'name:' 'button10' |
|
389 #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0) |
|
390 #'label:' 'origin' |
|
391 #'model:' #setLayoutOrigin |
|
392 ) |
|
393 #(#ActionButtonSpec |
|
394 #'name:' 'button11' |
|
395 #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0) |
|
396 #'label:' 'align' |
|
397 #'model:' #setAlignmentOrigin |
|
398 ) |
|
399 |
|
400 ) |
|
401 ) |
|
402 ) |
|
403 |
|
404 |
|
405 |
|
406 ! |
|
407 |
|
408 specificationLayoutOrigin |
|
409 " |
|
410 UIPainter new openOnClass:self andSelector:#specificationLayoutOrigin |
|
411 " |
|
412 <resource: #canvas> |
|
413 |
|
414 ^ |
|
415 |
|
416 #(#FullSpec |
|
417 #'window:' |
|
418 #(#WindowSpec |
|
419 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
420 #'label:' 'unnamed' |
|
421 #'bounds:' #(#Rectangle 0 0 248 304) |
|
422 ) |
|
423 #'component:' |
|
424 #(#SpecCollection |
|
425 #'collection:' |
|
426 #( |
|
427 #(#LabelSpec |
|
428 #'name:' 'label1' |
|
429 #'layout:' #(#LayoutFrame 16 0 42 0 44 0 60 0) |
|
430 #'label:' 'left' |
|
431 ) |
|
432 #(#LabelSpec |
|
433 #'name:' 'label2' |
|
434 #'layout:' #(#LayoutFrame 16 0 69 0 44 0 87 0) |
|
435 #'label:' 'top' |
|
436 ) |
|
437 #(#LabelSpec |
|
438 #'name:' 'label3' |
|
439 #'layout:' #(#LayoutFrame 57 0 10 0 103 0 27 0) |
|
440 #'label:' 'relative' |
|
441 ) |
|
442 #(#LabelSpec |
|
443 #'name:' 'label4' |
|
444 #'layout:' #(#LayoutFrame 154 0 11 0 190 0 28 0) |
|
445 #'label:' 'offset' |
|
446 ) |
|
447 #(#InputFieldSpec |
|
448 #'name:' 'editField1' |
|
449 #'type:' #numberOrNil |
|
450 #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0) |
|
451 #'model:' #leftFraction |
|
452 #acceptOnLostFocus: true |
|
453 #tabable: true |
|
454 ) |
|
455 #(#InputFieldSpec |
|
456 #'name:' 'editField2' |
|
457 #'type:' #numberOrNil |
|
458 #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0) |
|
459 #'model:' #topFraction |
|
460 #acceptOnLostFocus: true |
|
461 #tabable: true |
|
462 ) |
|
463 #(#InputFieldSpec |
|
464 #'name:' 'editField3' |
|
465 #'type:' #numberOrNil |
|
466 #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0) |
|
467 #'model:' #leftOffset |
|
468 #acceptOnLostFocus: true |
|
469 #tabable: true |
|
470 ) |
|
471 #(#InputFieldSpec |
|
472 #'name:' 'editField4' |
|
473 #'type:' #numberOrNil |
|
474 #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0) |
|
475 #'model:' #topOffset |
|
476 #acceptOnLostFocus: true |
|
477 #tabable: true |
|
478 ) |
|
479 #(#ActionButtonSpec |
|
480 #'name:' 'button1' |
|
481 #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0) |
|
482 #'label:' '' |
|
483 #'model:' #makeRelativeLeft |
|
484 ) |
|
485 #(#ActionButtonSpec |
|
486 #'name:' 'button2' |
|
487 #'layout:' #(#LayoutFrame 119 0 69 0 138 0 87 0) |
|
488 #'label:' '' |
|
489 #'model:' #makeRelativeTop |
|
490 ) |
|
491 #(#ActionButtonSpec |
|
492 #'name:' 'button3' |
|
493 #'layout:' #(#LayoutFrame 216 0 42 0 235 0 60 0) |
|
494 #'label:' '' |
|
495 #'model:' #makeOffsetLeft |
|
496 ) |
|
497 #(#ActionButtonSpec |
|
498 #'name:' 'button4' |
|
499 #'layout:' #(#LayoutFrame 216 0 69 0 235 0 87 0) |
|
500 #'label:' '' |
|
501 #'model:' #makeOffsetTop |
|
502 ) |
|
503 |
|
504 |
|
505 #(#ActionButtonSpec |
|
506 #'name:' 'button' |
|
507 #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0) |
|
508 #'label:' 'frame' |
|
509 #'model:' #setLayoutFrame |
|
510 ) |
|
511 #(#ActionButtonSpec |
|
512 #'name:' 'button' |
|
513 #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0) |
|
514 #'label:' 'origin' |
|
515 #'model:' #setLayoutOrigin |
|
516 #'initiallyDisabled:' true |
|
517 ) |
|
518 #(#ActionButtonSpec |
|
519 #'name:' 'button' |
|
520 #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0) |
|
521 #'label:' 'align' |
|
522 #'model:' #setAlignmentOrigin |
|
523 ) |
|
524 |
|
525 ) |
|
526 ) |
|
527 ) |
|
528 |
|
529 |
|
530 |
|
531 ! ! |
|
532 |
|
533 !UIPropertyView methodsFor:'accessing'! |
|
534 |
|
535 modified |
|
536 "returns state of modification flag |
|
537 " |
|
538 ^ modified |
|
539 ! |
|
540 |
|
541 modified:aState |
|
542 "change state of modification flag |
|
543 " |
|
544 aState ~~ modified ifTrue:[ |
|
545 (modified := aState) ifTrue:[ |
|
546 (builder componentAt:#cancelButton) enable. |
|
547 (builder componentAt:#applyButton) enable. |
|
548 ] ifFalse:[ |
|
549 (builder componentAt:#cancelButton) disable. |
|
550 (builder componentAt:#applyButton) disable. |
|
551 ]. |
|
552 ] |
|
553 ! |
|
554 |
|
555 setupView:aView |
|
556 |
|
557 |slices list| |
|
558 |
|
559 currentView == aView ifTrue:[ |
|
560 ^ self |
|
561 ]. |
|
562 |
|
563 aspects := nil. |
|
564 currentView := aView. |
|
565 |
|
566 propertyList selectionIndex:nil. |
|
567 |
|
568 currentView isNil ifTrue:[ |
|
569 propertyList list:#(). |
|
570 propertySpecs := nil. |
|
571 aspects := nil. |
|
572 self modified:false. |
|
573 ^ self |
|
574 ]. |
|
575 |
|
576 aspects := IdentityDictionary new. |
|
577 |
|
578 #( bottomFraction bottomOffset |
|
579 leftFraction leftOffset |
|
580 topFraction topOffset |
|
581 rightFraction rightOffset |
|
582 leftAlignmentFraction topAlignmentFraction |
|
583 ) |
|
584 do:[:aChannel| |
|
585 aspects at:aChannel put:(ValueHolder new) |
|
586 ]. |
|
587 |
|
588 specBeingEdited := (receiver generateSpecFor:currentView) first. |
|
589 |
|
590 propertySpecs := OrderedCollection new. |
|
591 slices := currentView specClass slices. |
|
592 |
|
593 list := slices collect:[:slice| |
|
594 propertySpecs add:(slice last). |
|
595 slice first asString |
|
596 ]. |
|
597 |
|
598 list := list, #( 'Dimension' ). |
|
599 |
|
600 specBeingEdited class addBindingsTo:aspects |
|
601 for:specBeingEdited |
|
602 channel:nil. |
|
603 |
|
604 aspects do:[:anAspect | anAspect addDependent:self ]. |
|
605 |
|
606 propertyList list:list. |
|
607 propertyList selection:userSelectedProperty. |
|
608 |
|
609 ! ! |
|
610 |
|
611 !UIPropertyView methodsFor:'button actions'! |
|
612 |
|
613 apply |
|
614 self modified ifTrue:[ |
|
615 receiver updateFromSpec:specBeingEdited. |
|
616 self modified:false. |
|
617 ] |
|
618 ! |
|
619 |
|
620 cancel |
|
621 |view| |
|
622 |
|
623 self modified ifTrue:[ |
|
624 self modified:false. |
|
625 |
|
626 (view := currentView) notNil ifTrue:[ |
|
627 currentView := nil. |
|
628 self setupView:view |
|
629 ]. |
|
630 ] |
|
631 ! ! |
|
632 |
|
633 !UIPropertyView methodsFor:'change & update'! |
|
634 |
|
635 propertySelectionChanged |
|
636 "called when the property selection changed |
|
637 " |
|
638 |spec index sel| |
|
639 |
|
640 sel := propertyList selection. |
|
641 |
|
642 (currentView isNil or:[sel isNil]) ifTrue:[ |
|
643 ^ self showSpec:nil |
|
644 ]. |
|
645 index := propertyList selectionIndex. |
|
646 userSelectedProperty := sel. |
|
647 |
|
648 index > propertySpecs size ifTrue:[ "/ one of my specifications |
|
649 sel = 'Dimension' ifTrue:[ |
|
650 spec := self specificationLayout |
|
651 ] |
|
652 ] ifFalse:[ |
|
653 spec := currentView specClass perform:(propertySpecs at:index). |
|
654 ]. |
|
655 self showSpec:spec. |
|
656 self modified:false. |
|
657 |
|
658 ! |
|
659 |
|
660 update:something with:aParameter from:changedObject |
|
661 self modified ifFalse:[ |
|
662 self modified:true |
|
663 ] |
|
664 ! ! |
|
665 |
|
666 !UIPropertyView methodsFor:'initialization'! |
|
667 |
|
668 in:aTopView receiver:aReceiver |
|
669 |menu y cancelButton applyButton panel| |
|
670 |
|
671 super initialize. |
|
672 |
|
673 receiver := aReceiver. |
|
674 |
|
675 menu := PopUpList label:'properties' in:aTopView. |
|
676 menu defaultLabel:'properties'. |
|
677 propertyFrame := View in:aTopView. |
|
678 panel := HorizontalPanelView in:aTopView. |
|
679 |
|
680 cancelButton := Button abortButtonIn:panel. |
|
681 applyButton := Button okButtonIn:panel. |
|
682 |
|
683 propertyList := SelectionInList new. |
|
684 propertyList list:#( ). |
|
685 propertyList selectionIndexHolder onChangeSend:#propertySelectionChanged to:self. |
|
686 menu model:propertyList. |
|
687 |
|
688 y := menu preferredExtent y. |
|
689 menu origin:0.0@0.0 corner:1.0@y. |
|
690 propertyFrame origin:0.0@y corner:1.0@1.0. |
|
691 panel origin:0.0@1.0 corner:1.0@1.0. |
|
692 |
|
693 y := panel preferredExtent y. |
|
694 propertyFrame bottomInset:y. |
|
695 panel topInset:(y negated). |
|
696 |
|
697 builder componentAt:#cancelButton put:cancelButton. |
|
698 builder componentAt:#applyButton put:applyButton. |
|
699 |
|
700 cancelButton action:[ self cancel ]. |
|
701 applyButton action:[ self apply ]. |
|
702 |
|
703 modified := true. |
|
704 self modified:false. |
|
705 ! ! |
|
706 |
|
707 !UIPropertyView methodsFor:'private'! |
|
708 |
|
709 aspectFor:aKey |
|
710 |
|
711 ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]. |
|
712 ! |
|
713 |
|
714 showSpec:aSpec |
|
715 "switch specification |
|
716 " |
|
717 currentSpec ~= aSpec ifTrue:[ |
|
718 propertyFrame destroySubViews. |
|
719 |
|
720 aSpec notNil ifTrue:[ |
|
721 builder buildFromSpec:aSpec in:propertyFrame. |
|
722 propertyFrame realizeAllSubViews |
|
723 ] |
|
724 ]. |
|
725 currentSpec := aSpec. |
|
726 |
|
727 ! ! |
|
728 |
|
729 !UIPropertyView methodsFor:'private layout'! |
|
730 |
|
731 fetchLayout |
|
732 |layout extent| |
|
733 |
|
734 layout := currentView geometryLayout. |
|
735 layout isNil ifTrue:[^ self]. |
|
736 |
|
737 layout isLayout ifFalse:[ |
|
738 layout isRectangle ifTrue:[ |
|
739 (aspects at:#leftOffset) value:(layout left). |
|
740 (aspects at:#rightOffset) value:(layout right). |
|
741 (aspects at:#topOffset) value:(layout top). |
|
742 (aspects at:#bottomOffset) value:(layout bottom). |
|
743 ^ self |
|
744 ]. |
|
745 layout isPoint ifTrue:[ |
|
746 (aspects at:#leftOffset) value:(layout left). |
|
747 (aspects at:#rightOffset) value:(layout right). |
|
748 ^ self |
|
749 ]. |
|
750 ]. |
|
751 |
|
752 (aspects at:#leftOffset) value:(layout leftOffset). |
|
753 (aspects at:#leftFraction) value:(layout leftFraction). |
|
754 (aspects at:#topOffset) value:(layout topOffset). |
|
755 (aspects at:#topFraction) value:(layout topFraction). |
|
756 |
|
757 layout isLayoutFrame ifTrue:[ |
|
758 (aspects at:#rightOffset) value:(layout rightOffset). |
|
759 (aspects at:#bottomOffset) value:(layout bottomOffset). |
|
760 |
|
761 (aspects at:#rightFraction) value:(layout rightFraction). |
|
762 (aspects at:#bottomFraction) value:(layout bottomFraction). |
|
763 |
|
764 (aspects at:#leftAlignmentFraction) value:0. |
|
765 (aspects at:#topAlignmentFraction) value:0. |
|
766 ] ifFalse:[ |
|
767 extent := currentView extent. |
|
768 |
|
769 (aspects at:#rightOffset) value:(layout leftOffset + extent x). |
|
770 (aspects at:#bottomOffset) value:(layout topOffset + extent y). |
|
771 |
|
772 (aspects at:#rightFraction) value:0. |
|
773 (aspects at:#bottomFraction) value:0. |
|
774 |
|
775 layout isAlignmentOrigin ifTrue:[ |
|
776 (aspects at:#leftAlignmentFraction) value:(layout leftAlignmentFraction). |
|
777 (aspects at:#topAlignmentFraction) value:(layout topAlignmentFraction). |
|
778 ] ifFalse:[ |
|
779 (aspects at:#leftAlignmentFraction) value:0. |
|
780 (aspects at:#topAlignmentFraction) value:0. |
|
781 ] |
|
782 ]. |
|
783 ! |
|
784 |
|
785 setAlignmentOrigin |
|
786 self showSpec:(self class specificationAlignmentOrigin). |
|
787 |
|
788 ! |
|
789 |
|
790 setLayoutFrame |
|
791 self showSpec:(self class specificationLayoutFrame). |
|
792 ! |
|
793 |
|
794 setLayoutOrigin |
|
795 self showSpec:(self class specificationLayoutOrigin). |
|
796 |
|
797 ! |
|
798 |
|
799 specificationLayout |
|
800 "called from propertyChanged; returns specification assigned to |
|
801 current view |
|
802 " |
|
803 |layout spec| |
|
804 |
|
805 (currentView superView specClass basicNew isLayoutContainer) ifTrue:[ |
|
806 ^ nil |
|
807 ]. |
|
808 layout := currentView geometryLayout. |
|
809 |
|
810 layout isLayout ifTrue:[ |
|
811 layout isLayoutFrame ifTrue:[ |
|
812 spec := self class specificationLayoutFrame |
|
813 ] ifFalse:[ |
|
814 layout isAlignmentOrigin ifTrue:[ |
|
815 spec := self class specificationAlignmentOrigin |
|
816 ] ifFalse:[ |
|
817 layout isLayoutOrigin ifTrue:[ |
|
818 spec := self class specificationLayoutOrigin |
|
819 ] |
|
820 ] |
|
821 ] |
|
822 ]. |
|
823 |
|
824 spec notNil ifTrue:[ self fetchLayout]. |
|
825 ^ spec |
|
826 ! ! |
|
827 |
|
828 !UIPropertyView methodsFor:'private make layout'! |
|
829 |
|
830 makeLayout:what xOrY:xOrY offset:aBool |
|
831 |layout extent fraction offset fractSymb offsetSymb| |
|
832 |
|
833 currentView isNil ifTrue:[ |
|
834 ^ self |
|
835 ]. |
|
836 layout := currentView geometryLayout. |
|
837 |
|
838 layout isLayout ifFalse:[ |
|
839 ^ self |
|
840 ]. |
|
841 fractSymb := (what, 'Fraction') asSymbol. |
|
842 offsetSymb := (what, 'Offset') asSymbol. |
|
843 |
|
844 ( (layout respondsTo:fractSymb) |
|
845 and:[layout respondsTo:offsetSymb] |
|
846 ) ifTrue:[ |
|
847 |
|
848 fraction := layout perform:fractSymb. |
|
849 offset := layout perform:offsetSymb. |
|
850 extent := (currentView superView computeExtent) perform:xOrY. |
|
851 |
|
852 aBool ifTrue:[ |
|
853 offset := offset + ((fraction * extent) asInteger). |
|
854 (aspects at:offsetSymb) value:offset. |
|
855 (aspects at:fractSymb) value:0. |
|
856 ] ifFalse:[ |
|
857 fraction := (fraction + (offset / extent)) asFloat. |
|
858 |
|
859 (fraction > 1.0) ifTrue:[ fraction := 1.0 ]. |
|
860 (fraction < 0.0) ifTrue:[ fraction := 0.0 ]. |
|
861 |
|
862 (aspects at:offsetSymb) value:0. |
|
863 (aspects at:fractSymb) value:fraction. |
|
864 ] |
|
865 ] |
|
866 |
|
867 |
|
868 ! |
|
869 |
|
870 makeOffsetAll |
|
871 self makeOffsetLeft. |
|
872 self makeOffsetTop. |
|
873 self makeOffsetRight. |
|
874 self makeOffsetBottom. |
|
875 |
|
876 ! |
|
877 |
|
878 makeOffsetBottom |
|
879 self makeLayout:'bottom' xOrY:#y offset:true. |
|
880 |
|
881 ! |
|
882 |
|
883 makeOffsetLeft |
|
884 self makeLayout:'left' xOrY:#x offset:true. |
|
885 |
|
886 ! |
|
887 |
|
888 makeOffsetRight |
|
889 self makeLayout:'right' xOrY:#x offset:true. |
|
890 |
|
891 ! |
|
892 |
|
893 makeOffsetTop |
|
894 self makeLayout:'top' xOrY:#y offset:true. |
|
895 |
|
896 ! |
|
897 |
|
898 makeRelativeAll |
|
899 self makeRelativeLeft. |
|
900 self makeRelativeTop. |
|
901 self makeRelativeRight. |
|
902 self makeRelativeBottom. |
|
903 |
|
904 ! |
|
905 |
|
906 makeRelativeBottom |
|
907 self makeLayout:'bottom' xOrY:#y offset:false. |
|
908 |
|
909 ! |
|
910 |
|
911 makeRelativeLeft |
|
912 self makeLayout:'left' xOrY:#x offset:false. |
|
913 |
|
914 ! |
|
915 |
|
916 makeRelativeRight |
|
917 self makeLayout:'right' xOrY:#x offset:false. |
|
918 |
|
919 ! |
|
920 |
|
921 makeRelativeTop |
|
922 self makeLayout:'top' xOrY:#y offset:false. |
|
923 |
|
924 ! ! |
|
925 |
|
926 !UIPropertyView class methodsFor:'documentation'! |
|
927 |
|
928 version |
|
929 ^ '$Header$' |
|
930 ! ! |