72 #(#InputFieldSpec |
78 #(#InputFieldSpec |
73 #'name:' 'editField1' |
79 #'name:' 'editField1' |
74 #'type:' #numberOrNil |
80 #'type:' #numberOrNil |
75 #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0) |
81 #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0) |
76 #'model:' #leftFraction |
82 #'model:' #leftFraction |
77 #acceptOnLostFocus: true |
83 #'immediateAccept:' false |
|
84 #'acceptOnReturn:' true |
|
85 #'acceptOnTab:' true |
78 #tabable: true |
86 #tabable: true |
79 ) |
87 ) |
80 #(#InputFieldSpec |
88 #(#InputFieldSpec |
81 #'name:' 'editField2' |
89 #'name:' 'editField2' |
82 #'type:' #numberOrNil |
90 #'type:' #numberOrNil |
83 #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0) |
91 #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0) |
84 #'model:' #topFraction |
92 #'model:' #topFraction |
85 #acceptOnLostFocus: true |
93 #'immediateAccept:' false |
|
94 #'acceptOnReturn:' true |
|
95 #'acceptOnTab:' true |
86 #tabable: true |
96 #tabable: true |
87 ) |
97 ) |
88 #(#InputFieldSpec |
98 #(#InputFieldSpec |
89 #'name:' 'editField5' |
99 #'name:' 'editField5' |
90 #'type:' #numberOrNil |
100 #'type:' #numberOrNil |
91 #'layout:' #(#LayoutFrame 57 0 96 0 114 0 114 0) |
101 #'layout:' #(#LayoutFrame 57 0 96 0 114 0 114 0) |
92 #'model:' #leftAlignmentFraction |
102 #'model:' #leftAlignmentFraction |
93 #acceptOnLostFocus: true |
103 #'immediateAccept:' false |
|
104 #'acceptOnReturn:' true |
|
105 #'acceptOnTab:' true |
94 #tabable: true |
106 #tabable: true |
95 ) |
107 ) |
96 #(#InputFieldSpec |
108 #(#InputFieldSpec |
97 #'name:' 'editField6' |
109 #'name:' 'editField6' |
98 #'type:' #numberOrNil |
110 #'type:' #numberOrNil |
99 #'layout:' #(#LayoutFrame 56 0 122 0 113 0 140 0) |
111 #'layout:' #(#LayoutFrame 56 0 122 0 113 0 140 0) |
100 #'model:' #topAlignmentFraction |
112 #'model:' #topAlignmentFraction |
101 #acceptOnLostFocus: true |
113 #'immediateAccept:' false |
|
114 #'acceptOnReturn:' true |
|
115 #'acceptOnTab:' true |
102 #tabable: true |
116 #tabable: true |
103 ) |
117 ) |
104 #(#InputFieldSpec |
118 #(#InputFieldSpec |
105 #'name:' 'editField3' |
119 #'name:' 'editField3' |
106 #'type:' #numberOrNil |
120 #'type:' #numberOrNil |
107 #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0) |
121 #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0) |
108 #'model:' #leftOffset |
122 #'model:' #leftOffset |
109 #acceptOnLostFocus: true |
123 #'immediateAccept:' false |
|
124 #'acceptOnReturn:' true |
|
125 #'acceptOnTab:' true |
110 #tabable: true |
126 #tabable: true |
111 ) |
127 ) |
112 #(#InputFieldSpec |
128 #(#InputFieldSpec |
113 #'name:' 'editField4' |
129 #'name:' 'editField4' |
114 #'type:' #numberOrNil |
130 #'type:' #numberOrNil |
115 #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0) |
131 #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0) |
116 #'model:' #topOffset |
132 #'model:' #topOffset |
117 #acceptOnLostFocus: true |
133 #'immediateAccept:' false |
|
134 #'acceptOnReturn:' true |
|
135 #'acceptOnTab:' true |
118 #tabable: true |
136 #tabable: true |
119 ) |
137 ) |
120 #(#ActionButtonSpec |
138 #(#ActionButtonSpec |
121 #'name:' 'button1' |
139 #'name:' 'button1' |
122 #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0) |
140 #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0) |
234 #'name:' 'relative E1' |
252 #'name:' 'relative E1' |
235 #'layout:' #(#LayoutFrame 65 0 39 0 113 0 57 0) |
253 #'layout:' #(#LayoutFrame 65 0 39 0 113 0 57 0) |
236 #'model:' #leftFraction |
254 #'model:' #leftFraction |
237 #'type:' #numberOrNil |
255 #'type:' #numberOrNil |
238 #'immediateAccept:' false |
256 #'immediateAccept:' false |
239 #'acceptOnLeave:' true |
257 #'acceptOnReturn:' true |
240 #'acceptOnReturn:' true |
258 #'acceptOnTab:' true |
241 #'acceptOnTab:' true |
|
242 #'acceptOnLostFocus:' true |
|
243 ) |
259 ) |
244 #(#InputFieldSpec |
260 #(#InputFieldSpec |
245 #'name:' 'relative E2' |
261 #'name:' 'relative E2' |
246 #'layout:' #(#LayoutFrame 65 0 67 0 113 0 85 0) |
262 #'layout:' #(#LayoutFrame 65 0 67 0 113 0 85 0) |
247 #'model:' #topFraction |
263 #'model:' #topFraction |
248 #'type:' #numberOrNil |
264 #'type:' #numberOrNil |
249 #'immediateAccept:' false |
265 #'immediateAccept:' false |
250 #'acceptOnLeave:' true |
266 #'acceptOnReturn:' true |
251 #'acceptOnReturn:' true |
267 #'acceptOnTab:' true |
252 #'acceptOnTab:' true |
|
253 #'acceptOnLostFocus:' true |
|
254 ) |
268 ) |
255 #(#InputFieldSpec |
269 #(#InputFieldSpec |
256 #'name:' 'relative E3' |
270 #'name:' 'relative E3' |
257 #'layout:' #(#LayoutFrame 65 0 95 0 113 0 113 0) |
271 #'layout:' #(#LayoutFrame 65 0 95 0 113 0 113 0) |
258 #'model:' #rightFraction |
272 #'model:' #rightFraction |
259 #'type:' #numberOrNil |
273 #'type:' #numberOrNil |
260 #'immediateAccept:' false |
274 #'immediateAccept:' false |
261 #'acceptOnLeave:' true |
275 #'acceptOnReturn:' true |
262 #'acceptOnReturn:' true |
276 #'acceptOnTab:' true |
263 #'acceptOnTab:' true |
|
264 #'acceptOnLostFocus:' true |
|
265 ) |
277 ) |
266 #(#InputFieldSpec |
278 #(#InputFieldSpec |
267 #'name:' 'relative E4' |
279 #'name:' 'relative E4' |
268 #'layout:' #(#LayoutFrame 65 0 123 0 113 0 141 0) |
280 #'layout:' #(#LayoutFrame 65 0 123 0 113 0 141 0) |
269 #'model:' #bottomFraction |
281 #'model:' #bottomFraction |
270 #'type:' #numberOrNil |
282 #'type:' #numberOrNil |
271 #'immediateAccept:' false |
283 #'immediateAccept:' false |
272 #'acceptOnLeave:' true |
284 #'acceptOnReturn:' true |
273 #'acceptOnReturn:' true |
285 #'acceptOnTab:' true |
274 #'acceptOnTab:' true |
|
275 #'acceptOnLostFocus:' true |
|
276 ) |
286 ) |
277 #(#InputFieldSpec |
287 #(#InputFieldSpec |
278 #'name:' 'offset E1' |
288 #'name:' 'offset E1' |
279 #'layout:' #(#LayoutFrame 159 0 39 0 210 0 57 0) |
289 #'layout:' #(#LayoutFrame 159 0 39 0 210 0 57 0) |
280 #'model:' #leftOffset |
290 #'model:' #leftOffset |
281 #'type:' #numberOrNil |
291 #'type:' #numberOrNil |
282 #'immediateAccept:' false |
292 #'immediateAccept:' false |
283 #'acceptOnLeave:' true |
293 #'acceptOnReturn:' true |
284 #'acceptOnReturn:' true |
294 #'acceptOnTab:' true |
285 #'acceptOnTab:' true |
|
286 #'acceptOnLostFocus:' true |
|
287 ) |
295 ) |
288 #(#InputFieldSpec |
296 #(#InputFieldSpec |
289 #'name:' 'offset E2' |
297 #'name:' 'offset E2' |
290 #'layout:' #(#LayoutFrame 159 0 67 0 210 0 85 0) |
298 #'layout:' #(#LayoutFrame 159 0 67 0 210 0 85 0) |
291 #'model:' #topOffset |
299 #'model:' #topOffset |
292 #'type:' #numberOrNil |
300 #'type:' #numberOrNil |
293 #'immediateAccept:' false |
301 #'immediateAccept:' false |
294 #'acceptOnLeave:' true |
302 #'acceptOnReturn:' true |
295 #'acceptOnReturn:' true |
303 #'acceptOnTab:' true |
296 #'acceptOnTab:' true |
|
297 #'acceptOnLostFocus:' true |
|
298 ) |
304 ) |
299 #(#InputFieldSpec |
305 #(#InputFieldSpec |
300 #'name:' 'offset E3' |
306 #'name:' 'offset E3' |
301 #'layout:' #(#LayoutFrame 159 0 95 0 210 0 113 0) |
307 #'layout:' #(#LayoutFrame 159 0 95 0 210 0 113 0) |
302 #'model:' #rightOffset |
308 #'model:' #rightOffset |
303 #'type:' #numberOrNil |
309 #'type:' #numberOrNil |
304 #'immediateAccept:' false |
310 #'immediateAccept:' false |
305 #'acceptOnLeave:' true |
311 #'acceptOnReturn:' true |
306 #'acceptOnReturn:' true |
312 #'acceptOnTab:' true |
307 #'acceptOnTab:' true |
|
308 #'acceptOnLostFocus:' true |
|
309 ) |
313 ) |
310 #(#InputFieldSpec |
314 #(#InputFieldSpec |
311 #'name:' 'offset E4' |
315 #'name:' 'offset E4' |
312 #'layout:' #(#LayoutFrame 159 0 123 0 210 0 141 0) |
316 #'layout:' #(#LayoutFrame 159 0 123 0 210 0 141 0) |
313 #'model:' #bottomOffset |
317 #'model:' #bottomOffset |
314 #'type:' #numberOrNil |
318 #'type:' #numberOrNil |
315 #'immediateAccept:' false |
319 #'immediateAccept:' false |
316 #'acceptOnLeave:' true |
320 #'acceptOnReturn:' true |
317 #'acceptOnReturn:' true |
321 #'acceptOnTab:' true |
318 #'acceptOnTab:' true |
|
319 #'acceptOnLostFocus:' true |
|
320 ) |
322 ) |
321 #(#ActionButtonSpec |
323 #(#ActionButtonSpec |
322 #'name:' 'relative B1' |
324 #'name:' 'relative B1' |
323 #'layout:' #(#LayoutFrame 117 0 39 0 136 0 57 0) |
325 #'layout:' #(#LayoutFrame 117 0 39 0 136 0 57 0) |
324 #'label:' ' ' |
326 #'label:' ' ' |
447 #(#InputFieldSpec |
450 #(#InputFieldSpec |
448 #'name:' 'editField1' |
451 #'name:' 'editField1' |
449 #'type:' #numberOrNil |
452 #'type:' #numberOrNil |
450 #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0) |
453 #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0) |
451 #'model:' #leftFraction |
454 #'model:' #leftFraction |
452 #acceptOnLostFocus: true |
455 #'immediateAccept:' false |
|
456 #'acceptOnReturn:' true |
|
457 #'acceptOnTab:' true |
453 #tabable: true |
458 #tabable: true |
454 ) |
459 ) |
455 #(#InputFieldSpec |
460 #(#InputFieldSpec |
456 #'name:' 'editField2' |
461 #'name:' 'editField2' |
457 #'type:' #numberOrNil |
462 #'type:' #numberOrNil |
458 #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0) |
463 #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0) |
459 #'model:' #topFraction |
464 #'model:' #topFraction |
460 #acceptOnLostFocus: true |
465 #'immediateAccept:' false |
|
466 #'acceptOnReturn:' true |
|
467 #'acceptOnTab:' true |
461 #tabable: true |
468 #tabable: true |
462 ) |
469 ) |
463 #(#InputFieldSpec |
470 #(#InputFieldSpec |
464 #'name:' 'editField3' |
471 #'name:' 'editField3' |
465 #'type:' #numberOrNil |
472 #'type:' #numberOrNil |
466 #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0) |
473 #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0) |
467 #'model:' #leftOffset |
474 #'model:' #leftOffset |
468 #acceptOnLostFocus: true |
475 #'immediateAccept:' false |
|
476 #'acceptOnReturn:' true |
|
477 #'acceptOnTab:' true |
469 #tabable: true |
478 #tabable: true |
470 ) |
479 ) |
471 #(#InputFieldSpec |
480 #(#InputFieldSpec |
472 #'name:' 'editField4' |
481 #'name:' 'editField4' |
473 #'type:' #numberOrNil |
482 #'type:' #numberOrNil |
474 #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0) |
483 #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0) |
475 #'model:' #topOffset |
484 #'model:' #topOffset |
476 #acceptOnLostFocus: true |
485 #'immediateAccept:' false |
|
486 #'acceptOnReturn:' true |
|
487 #'acceptOnTab:' true |
477 #tabable: true |
488 #tabable: true |
478 ) |
489 ) |
479 #(#ActionButtonSpec |
490 #(#ActionButtonSpec |
480 #'name:' 'button1' |
491 #'name:' 'button1' |
481 #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0) |
492 #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0) |
530 |
541 |
531 ! ! |
542 ! ! |
532 |
543 |
533 !UIPropertyView methodsFor:'accessing'! |
544 !UIPropertyView methodsFor:'accessing'! |
534 |
545 |
535 modified |
546 update:something |
536 "returns state of modification flag |
547 |slices list view prevSpecClass| |
537 " |
548 |
538 ^ modified |
549 (something == #selection or:[something == #tree]) ifFalse:[ |
539 ! |
550 (something == #layout and:[modified not and:[self isLayoutSpec]]) ifTrue:[ |
|
551 self layoutRead. |
|
552 ]. |
|
553 ^ self |
|
554 ]. |
|
555 |
|
556 view := builderView singleSelection. |
|
557 |
|
558 propertyAspects := nil. |
|
559 currentView := view. |
|
560 self modified:false. |
|
561 |
|
562 |
|
563 currentView isNil ifTrue:[ |
|
564 "/ the workView itself. |
|
565 |
|
566 propertyList selectionIndex:nil. |
|
567 currentSpecChannel := nil. |
|
568 |
|
569 propertyList list:#(). |
|
570 propertySpecs := nil. |
|
571 |
|
572 "/ must setup for a WindowSpec (to allow entry of min- maxSize etc). |
|
573 "/ propertyList list:#('Basics' 'Detail'). |
|
574 ^ self |
|
575 ]. |
|
576 |
|
577 prevSpecClass := specBeingEdited class. |
|
578 |
|
579 specBeingEdited := (builderView generateSpecFor:currentView) first. |
|
580 |
|
581 (specBeingEdited class ~~ prevSpecClass |
|
582 or:[currentSpecChannel isNil]) ifTrue:[ |
|
583 propertyList selectionIndex:nil. |
|
584 propertyAspects := IdentityDictionary new. |
|
585 propertySpecs := OrderedCollection new. |
|
586 slices := currentView specClass slices. |
|
587 |
|
588 list := slices collect:[:slice| |
|
589 propertySpecs add:(slice last). |
|
590 slice first asString |
|
591 ]. |
|
592 |
|
593 list := list, (Array with:(self class titleOfLayoutMenu)). |
|
594 |
|
595 currentSpecChannel := specBeingEdited asValue. |
|
596 specBeingEdited class addBindingsTo:propertyAspects |
|
597 for:specBeingEdited |
|
598 channel:currentSpecChannel. |
|
599 propertyAspects do:[:anAspect | anAspect addDependent:self ]. |
|
600 propertyList list:list. |
|
601 propertyList selection:userSelectedProperty. |
|
602 ] ifFalse:[ |
|
603 currentSpecChannel value:specBeingEdited |
|
604 ] |
|
605 |
|
606 |
|
607 ! ! |
|
608 |
|
609 !UIPropertyView methodsFor:'change & update'! |
540 |
610 |
541 modified:aState |
611 modified:aState |
542 "change state of modification flag |
612 "change state of modification flag |
543 " |
613 " |
544 aState ~~ modified ifTrue:[ |
614 aState ~~ modified ifTrue:[ |
550 (builder componentAt:#applyButton) disable. |
620 (builder componentAt:#applyButton) disable. |
551 ]. |
621 ]. |
552 ] |
622 ] |
553 ! |
623 ! |
554 |
624 |
555 setupView:aView |
625 propertySelectionChanged |
556 |
626 "called when the property selection changed |
557 |slices list| |
627 " |
558 |
628 |spec index sel| |
559 currentView == aView ifTrue:[ |
629 |
560 ^ self |
630 sel := propertyList selection. |
561 ]. |
631 |
562 |
632 (currentView isNil or:[sel isNil]) ifTrue:[ |
563 aspects := nil. |
633 "/ must setup for a WindowSpec for workView (to allow entry of min- maxSize etc). |
564 currentView := aView. |
634 "/ currentView isNil ifTrue:[ |
565 |
635 "/ currentView := receiver |
566 propertyList selectionIndex:nil. |
636 "/ ]. |
567 |
637 ^ self showSpec:nil |
568 currentView isNil ifTrue:[ |
638 ]. |
569 propertyList list:#(). |
639 index := propertyList selectionIndex. |
570 propertySpecs := nil. |
640 userSelectedProperty := sel. |
571 aspects := nil. |
641 |
572 self modified:false. |
642 index > propertySpecs size ifTrue:[ "/ one of my specifications |
573 ^ self |
643 (sel == self class titleOfLayoutMenu) ifTrue:[ |
574 ]. |
644 spec := self specificationLayout |
575 |
645 ] |
576 aspects := IdentityDictionary new. |
646 ] ifFalse:[ |
|
647 spec := currentView specClass perform:(propertySpecs at:index). |
|
648 ]. |
|
649 self showSpec:spec. |
|
650 ! |
|
651 |
|
652 update:something with:aParameter from:changedObject |
|
653 self modified:true |
|
654 ! ! |
|
655 |
|
656 !UIPropertyView methodsFor:'initialization'! |
|
657 |
|
658 in:aTopView receiver:aBuilderView |
|
659 |menu y cancelButton applyButton panel| |
|
660 |
|
661 super initialize. |
|
662 self initializeStaticAspects. |
|
663 |
|
664 builderView := aBuilderView. |
|
665 |
|
666 menu := PopUpList label:'properties' in:aTopView. |
|
667 menu defaultLabel:'properties'. |
|
668 propertyFrame := View in:aTopView. |
|
669 panel := HorizontalPanelView in:aTopView. |
|
670 |
|
671 cancelButton := Button abortButtonIn:panel. |
|
672 applyButton := Button okButtonIn:panel. |
|
673 |
|
674 propertyList := SelectionInList new. |
|
675 propertyList list:#( ). |
|
676 propertyList selectionIndexHolder onChangeSend:#propertySelectionChanged |
|
677 to:self. |
|
678 menu model:propertyList. |
|
679 |
|
680 y := menu preferredExtent y. |
|
681 menu origin:0.0@0.0 corner:1.0@y. |
|
682 propertyFrame origin:0.0@y corner:1.0@1.0. |
|
683 panel origin:0.0@1.0 corner:1.0@1.0. |
|
684 |
|
685 y := panel preferredExtent y. |
|
686 propertyFrame bottomInset:y. |
|
687 panel topInset:(y negated). |
|
688 |
|
689 builder componentAt:#cancelButton put:cancelButton. |
|
690 builder componentAt:#applyButton put:applyButton. |
|
691 |
|
692 cancelButton action:[ self cancel ]. |
|
693 applyButton action:[ self apply ]. |
|
694 |
|
695 modified := true. |
|
696 self modified:false. |
|
697 ! |
|
698 |
|
699 initializeStaticAspects |
|
700 |
|
701 staticAspects := IdentityDictionary new. |
577 |
702 |
578 #( bottomFraction bottomOffset |
703 #( bottomFraction bottomOffset |
579 leftFraction leftOffset |
704 leftFraction leftOffset |
580 topFraction topOffset |
705 topFraction topOffset |
581 rightFraction rightOffset |
706 rightFraction rightOffset |
582 leftAlignmentFraction topAlignmentFraction |
707 leftAlignmentFraction topAlignmentFraction |
583 ) |
708 ) |
584 do:[:aChannel| |
709 do:[:aChannel| |
585 aspects at:aChannel put:(ValueHolder new) |
710 staticAspects at:aChannel put:(ValueHolder new). |
586 ]. |
711 ]. |
587 |
712 |
588 specBeingEdited := (receiver generateSpecFor:currentView) first. |
713 staticAspects do:[:anAspect | anAspect addDependent:self ]. |
589 |
714 |
590 propertySpecs := OrderedCollection new. |
715 ! ! |
591 slices := currentView specClass slices. |
716 |
592 |
717 !UIPropertyView methodsFor:'private'! |
593 list := slices collect:[:slice| |
718 |
594 propertySpecs add:(slice last). |
719 aspectFor:aKey |
595 slice first asString |
720 |aspect| |
596 ]. |
721 |
597 |
722 propertyAspects notNil ifTrue:[ |
598 list := list, #( 'Dimension' ). |
723 aspect := propertyAspects at:aKey ifAbsent:nil. |
599 |
724 aspect notNil ifTrue:[ |
600 specBeingEdited class addBindingsTo:aspects |
725 ^ aspect |
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 ] |
726 ] |
652 ] ifFalse:[ |
727 ]. |
653 spec := currentView specClass perform:(propertySpecs at:index). |
728 |
654 ]. |
729 ^ staticAspects at:aKey ifAbsent:[super aspectFor:aKey] |
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 ! |
730 ! |
713 |
731 |
714 showSpec:aSpec |
732 showSpec:aSpec |
715 "switch specification |
733 "switch specification |
716 " |
734 " |
721 builder buildFromSpec:aSpec in:propertyFrame. |
739 builder buildFromSpec:aSpec in:propertyFrame. |
722 propertyFrame realizeAllSubViews |
740 propertyFrame realizeAllSubViews |
723 ] |
741 ] |
724 ]. |
742 ]. |
725 currentSpec := aSpec. |
743 currentSpec := aSpec. |
|
744 self modified:false. |
|
745 ! ! |
|
746 |
|
747 !UIPropertyView methodsFor:'private actions'! |
|
748 |
|
749 apply |
|
750 modified ifTrue:[ |
|
751 self modified:false. |
|
752 |
|
753 self isLayoutSpec ifFalse:[ |
|
754 builderView updateFromSpec:specBeingEdited |
|
755 ] ifTrue:[ |
|
756 self layoutWrite |
|
757 ] |
|
758 ] |
|
759 |
|
760 ! |
|
761 |
|
762 cancel |
|
763 |view| |
|
764 |
|
765 modified ifTrue:[ |
|
766 self modified:false. |
|
767 |
|
768 self isLayoutSpec ifFalse:[ |
|
769 currentView := nil. |
|
770 self update:#selection |
|
771 ] ifTrue:[ |
|
772 self layoutRead |
|
773 ] |
|
774 ] |
|
775 |
726 |
776 |
727 ! ! |
777 ! ! |
728 |
778 |
729 !UIPropertyView methodsFor:'private layout'! |
779 !UIPropertyView methodsFor:'private layout'! |
730 |
780 |
731 fetchLayout |
781 layoutRead |
732 |layout extent| |
782 |layout extent| |
733 |
783 |
734 layout := currentView geometryLayout. |
784 layout := currentView geometryLayout. |
735 layout isNil ifTrue:[^ self]. |
785 layout isNil ifTrue:[^ self]. |
|
786 modified := true. "supress event notifications" |
736 |
787 |
737 layout isLayout ifFalse:[ |
788 layout isLayout ifFalse:[ |
738 layout isRectangle ifTrue:[ |
789 (layout isRectangle or:[layout isPoint]) ifTrue:[ |
739 (aspects at:#leftOffset) value:(layout left). |
790 (staticAspects at:#leftOffset) value:(layout left). |
740 (aspects at:#rightOffset) value:(layout right). |
791 (staticAspects at:#rightOffset) value:(layout right). |
741 (aspects at:#topOffset) value:(layout top). |
792 |
742 (aspects at:#bottomOffset) value:(layout bottom). |
793 layout isRectangle ifTrue:[ |
|
794 (staticAspects at:#topOffset) value:(layout top). |
|
795 (staticAspects at:#bottomOffset) value:(layout bottom). |
|
796 ]. |
|
797 modified := false. |
743 ^ self |
798 ^ self |
744 ]. |
799 ] |
745 layout isPoint ifTrue:[ |
800 ]. |
746 (aspects at:#leftOffset) value:(layout left). |
801 |
747 (aspects at:#rightOffset) value:(layout right). |
802 (staticAspects at:#leftOffset) value:(layout leftOffset). |
748 ^ self |
803 (staticAspects at:#leftFraction) value:(layout leftFraction). |
749 ]. |
804 (staticAspects at:#topOffset) value:(layout topOffset). |
750 ]. |
805 (staticAspects at:#topFraction) value:(layout topFraction). |
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 |
806 |
757 layout isLayoutFrame ifTrue:[ |
807 layout isLayoutFrame ifTrue:[ |
758 (aspects at:#rightOffset) value:(layout rightOffset). |
808 (staticAspects at:#rightOffset) value:(layout rightOffset). |
759 (aspects at:#bottomOffset) value:(layout bottomOffset). |
809 (staticAspects at:#bottomOffset) value:(layout bottomOffset). |
760 |
810 |
761 (aspects at:#rightFraction) value:(layout rightFraction). |
811 (staticAspects at:#rightFraction) value:(layout rightFraction). |
762 (aspects at:#bottomFraction) value:(layout bottomFraction). |
812 (staticAspects at:#bottomFraction) value:(layout bottomFraction). |
763 |
813 |
764 (aspects at:#leftAlignmentFraction) value:0. |
814 (staticAspects at:#leftAlignmentFraction) value:0. |
765 (aspects at:#topAlignmentFraction) value:0. |
815 (staticAspects at:#topAlignmentFraction) value:0. |
766 ] ifFalse:[ |
816 ] ifFalse:[ |
767 extent := currentView extent. |
817 extent := currentView extent. |
768 |
818 |
769 (aspects at:#rightOffset) value:(layout leftOffset + extent x). |
819 (staticAspects at:#rightOffset) value:(layout leftOffset + extent x). |
770 (aspects at:#bottomOffset) value:(layout topOffset + extent y). |
820 (staticAspects at:#bottomOffset) value:(layout topOffset + extent y). |
771 |
821 |
772 (aspects at:#rightFraction) value:0. |
822 (staticAspects at:#rightFraction) value:0. |
773 (aspects at:#bottomFraction) value:0. |
823 (staticAspects at:#bottomFraction) value:0. |
774 |
824 |
775 layout isAlignmentOrigin ifTrue:[ |
825 layout isAlignmentOrigin ifTrue:[ |
776 (aspects at:#leftAlignmentFraction) value:(layout leftAlignmentFraction). |
826 (staticAspects at:#leftAlignmentFraction) value:(layout leftAlignmentFraction). |
777 (aspects at:#topAlignmentFraction) value:(layout topAlignmentFraction). |
827 (staticAspects at:#topAlignmentFraction) value:(layout topAlignmentFraction). |
778 ] ifFalse:[ |
828 ] ifFalse:[ |
779 (aspects at:#leftAlignmentFraction) value:0. |
829 (staticAspects at:#leftAlignmentFraction) value:0. |
780 (aspects at:#topAlignmentFraction) value:0. |
830 (staticAspects at:#topAlignmentFraction) value:0. |
781 ] |
831 ] |
782 ]. |
832 ]. |
783 ! |
833 modified := false. |
784 |
834 |
785 setAlignmentOrigin |
835 ! |
786 self showSpec:(self class specificationAlignmentOrigin). |
836 |
787 |
837 layoutWrite |
788 ! |
838 |layout| |
789 |
839 |
790 setLayoutFrame |
840 currentView isNil ifTrue:[ |
791 self showSpec:(self class specificationLayoutFrame). |
841 ^ self |
792 ! |
842 ]. |
793 |
843 |
794 setLayoutOrigin |
844 (currentSpec == self class specificationLayoutFrame) ifTrue:[ |
795 self showSpec:(self class specificationLayoutOrigin). |
845 layout := LayoutFrame new. |
796 |
846 |
|
847 layout leftOffset:((staticAspects at:#leftOffset) value) ? 0. |
|
848 layout rightOffset:((staticAspects at:#rightOffset) value) ? 0. |
|
849 layout topOffset:((staticAspects at:#topOffset) value) ? 0. |
|
850 layout bottomOffset:((staticAspects at:#bottomOffset) value) ? 0. |
|
851 layout leftFraction:((staticAspects at:#leftFraction) value) ? 0. |
|
852 layout rightFraction:((staticAspects at:#rightFraction) value) ? 0. |
|
853 layout topFraction:((staticAspects at:#topFraction) value) ? 0. |
|
854 layout bottomFraction:((staticAspects at:#bottomFraction) value) ? 0. |
|
855 |
|
856 builderView setDimension:layout |
|
857 ]. |
|
858 |
|
859 (currentSpec == self class specificationAlignmentOrigin) ifTrue:[ |
|
860 layout := AlignmentOrigin new. |
|
861 |
|
862 layout leftOffset:((staticAspects at:#leftOffset) value) ? 0. |
|
863 layout topOffset:((staticAspects at:#topOffset) value) ? 0. |
|
864 layout leftFraction:((staticAspects at:#leftFraction) value) ? 0. |
|
865 layout topFraction:((staticAspects at:#topFraction) value) ? 0. |
|
866 |
|
867 layout leftAlignmentFraction:((staticAspects at:#leftAlignmentFraction) value) ? 0. |
|
868 layout topAlignmentFraction:((staticAspects at:#topAlignmentFraction) value) ? 0. |
|
869 |
|
870 ^ builderView setDimension:layout. |
|
871 ]. |
|
872 |
|
873 (currentSpec == self class specificationLayoutOrigin) ifTrue:[ |
|
874 layout := LayoutOrigin new. |
|
875 |
|
876 layout leftOffset:((staticAspects at:#leftOffset) value) ? 0. |
|
877 layout topOffset:((staticAspects at:#topOffset) value) ? 0. |
|
878 layout leftFraction:((staticAspects at:#leftFraction) value) ? 0. |
|
879 layout topFraction:((staticAspects at:#topFraction) value) ? 0. |
|
880 |
|
881 builderView setDimension:layout. |
|
882 ]. |
|
883 |
|
884 ! |
|
885 |
|
886 showAlignmentOrigin |
|
887 self switchLayoutSpec:(self class specificationAlignmentOrigin) |
|
888 ! |
|
889 |
|
890 showLayoutFrame |
|
891 self switchLayoutSpec:(self class specificationLayoutFrame) |
|
892 ! |
|
893 |
|
894 showLayoutOrigin |
|
895 self switchLayoutSpec:(self class specificationLayoutOrigin) |
797 ! |
896 ! |
798 |
897 |
799 specificationLayout |
898 specificationLayout |
800 "called from propertyChanged; returns specification assigned to |
899 "called from propertyChanged; returns specification assigned to |
801 current view |
900 current view |