69 |
69 |
70 ! ! |
70 ! ! |
71 |
71 |
72 !UIPainter class methodsFor:'instance creation'! |
72 !UIPainter class methodsFor:'instance creation'! |
73 |
73 |
74 listHolder:aListHolder |
|
75 |application| |
|
76 |
|
77 application := self new. |
|
78 application objectList:aListHolder. |
|
79 ^ application open |
|
80 ! |
|
81 |
|
82 openOnClass:aClass andSelector:aSelector |
74 openOnClass:aClass andSelector:aSelector |
|
75 "open up an interface builder, fetching a spec from aClass |
|
76 via some selector |
|
77 " |
83 ^ self new openOnClass:aClass andSelector:aSelector |
78 ^ self new openOnClass:aClass andSelector:aSelector |
84 |
|
85 "Created: 1.7.1997 / 19:16:59 / cg" |
|
86 ! |
79 ! |
87 |
80 |
88 painter:aBuilderView |
81 painter:aBuilderView |
|
82 "set the painter |
|
83 " |
89 |application| |
84 |application| |
90 |
85 |
91 application := self new. |
86 application := self new. |
92 application painter:aBuilderView. |
87 application painter:aBuilderView. |
93 ^ application open |
88 ^ application open |
94 ! ! |
89 ! ! |
95 |
90 |
96 !UIPainter class methodsFor:'ST-80 queries'! |
91 !UIPainter class methodsFor:'ST-80 queries'! |
97 |
92 |
98 preferenceFor:aSymbol |
93 preferenceFor:aSymbol |
|
94 "ST-80 compatible; always returns false |
|
95 " |
99 ^ false |
96 ^ false |
100 |
97 |
101 |
98 |
102 ! ! |
99 ! ! |
103 |
100 |
108 These are used by the activeHelp tool. |
105 These are used by the activeHelp tool. |
109 " |
106 " |
110 ^ super helpSpec addPairsFrom:#( |
107 ^ super helpSpec addPairsFrom:#( |
111 |
108 |
112 #alignSelectionCenterVer |
109 #alignSelectionCenterVer |
113 'align selection vertical' |
110 'align selected widgets vertical' |
114 |
111 |
115 #alignSelectionLeft |
112 #alignSelectionLeft |
116 'align selected components to the left edge of the |
113 'align selected widgets to the left edge of the dominant widget ( underlined )' |
117 dominant component ( underlined )' |
|
118 |
114 |
119 #alignSelectionRight |
115 #alignSelectionRight |
120 'align selected components to the right edge of the |
116 'align selected widgets to the right edge of the dominant widget ( underlined )' |
121 dominant component ( underlined )' |
|
122 |
117 |
123 #alignSelectionLeftAndRight |
118 #alignSelectionLeftAndRight |
124 'align selected components to the right and left edge |
119 'align selected widgets to the right and left edge of the dominant widget ( underlined )' |
125 of the dominant component ( underlined )' |
|
126 |
120 |
127 #alignSelectionTop |
121 #alignSelectionTop |
128 'align selected components to the top edge of the |
122 'align selected widgets to the top edge of the dominant widget ( underlined )' |
129 dominant component ( underlined )' |
|
130 |
123 |
131 #alignSelectionBottom |
124 #alignSelectionBottom |
132 'align selected components to the bottom edge of the |
125 'align selected widgets to the bottom edge of the dominant widget ( underlined )' |
133 dominant component ( underlined )' |
|
134 |
126 |
135 #alignSelectionTopAndBottom |
127 #alignSelectionTopAndBottom |
136 'align selected components to the top and bottom edge |
128 'align selected widgets to the top and bottom edge of the dominant widget ( underlined )' |
137 of the dominant component ( underlined )' |
|
138 |
129 |
139 #alignSelectionCenterVer |
130 #alignSelectionCenterVer |
140 'align selected components horizontal to the center of |
131 'align selected widgets horizontal to the center of the dominant widget ( underlined )' |
141 the dominant component ( underlined )' |
|
142 |
132 |
143 #alignSelectionCenterHor |
133 #alignSelectionCenterHor |
144 'align selected components vertical to the center of |
134 'align selected widgets vertical to the center of the dominant widget ( underlined )' |
145 the dominant component ( underlined )' |
|
146 |
135 |
147 #spreadSelectionVer |
136 #spreadSelectionVer |
148 'vertical spacing between selected components is made the same' |
137 'vertical spacing between selected widgets is made the same' |
149 |
138 |
150 #spreadSelectionHor |
139 #spreadSelectionHor |
151 'horizontal spacing between selected components is made the same' |
140 'horizontal spacing between selected widgets is made the same' |
152 |
141 |
153 #centerSelectionHor |
142 #centerSelectionHor |
154 'center components horizontal in contained view' |
143 'center widgets horizontal to their top widget' |
155 |
144 |
156 #centerSelectionVer |
145 #centerSelectionVer |
157 'center vertical horizontal in contained view' |
146 'center vertical horizontal in contained view' |
158 |
147 |
159 #setToDefaultExtent |
148 #setToDefaultExtent |
160 'set selected components to their default extent' |
149 'set selected widgets to their default extent' |
161 |
150 |
162 #setToDefaultWidth |
151 #setToDefaultWidth |
163 'set selected components to their default width' |
152 'set selected widgets to their default width' |
164 |
153 |
165 #setToDefaultHeight |
154 #setToDefaultHeight |
166 'set selected components to their default height' |
155 'set selected widgets to their default height' |
167 |
156 |
168 #copyExtent |
157 #copyExtent |
169 'copy extent of the selected component' |
158 'copy extent of the selected widget' |
170 |
159 |
171 #pasteExtent |
160 #pasteExtent |
172 'change extent of all selected components to the |
161 'change extent of all selected widgets to the last copied extent' |
173 last copied extent' |
|
174 |
162 |
175 #pasteWidth |
163 #pasteWidth |
176 'change width of all selected components to the |
164 'change width of all selected widgets to the last copied extent width' |
177 last copied extent width' |
|
178 |
165 |
179 #pasteHeight |
166 #pasteHeight |
180 'change height of all selected components to the |
167 'change height of all selected widgets to the last copied extent height' |
181 last copied extent height' |
|
182 |
168 |
183 #copyLayout |
169 #copyLayout |
184 'copy layout of the selected component' |
170 'copy layout of the selected widget' |
185 |
171 |
186 #pasteLayout |
172 #pasteLayout |
187 'change layout of all selected components to the |
173 'change layout of all selected widgets to the last copied layout' |
188 last copied layout' |
|
189 |
174 |
190 #pasteBuffer |
175 #pasteBuffer |
191 'paste components at current mouse position' |
176 'paste widgets at current mouse position' |
192 |
177 |
193 #pasteWithLayout |
178 #pasteWithLayout |
194 'paste components without changing their layouts' |
179 'paste widgets without changing their layouts' |
|
180 |
|
181 #accept |
|
182 'write back changes' |
|
183 |
|
184 #cancel |
|
185 'reread specification and layout' |
|
186 |
|
187 #galleryShown |
|
188 'show or hide gallery view' |
|
189 |
|
190 #painterShown |
|
191 'show or hide painter view' |
|
192 |
|
193 #moveSelectionLeft |
|
194 'move selected widgets left while pressing the button' |
|
195 |
|
196 #moveSelectionRight |
|
197 'move selected widgets right while pressing the button' |
|
198 |
|
199 #moveSelectionDown |
|
200 'move selected widgets down while pressing the button' |
|
201 |
|
202 #moveSelectionUp |
|
203 'move selected widgets up while pressing the button' |
|
204 |
|
205 #menuChangeHierarchy |
|
206 'change hierarchy of the selected widget' |
|
207 |
|
208 #menuAlignment |
|
209 'provides a set of alignment operation on the current selected widgets' |
|
210 |
|
211 |
195 |
212 |
196 ) |
213 ) |
197 |
214 |
198 |
215 |
199 |
216 |
201 ! ! |
218 ! ! |
202 |
219 |
203 !UIPainter class methodsFor:'icons'! |
220 !UIPainter class methodsFor:'icons'! |
204 |
221 |
205 iconAlignB |
222 iconAlignB |
|
223 "returns image assigned to align bottom |
|
224 " |
206 ^ Image fromFile:'b_alignB.xbm' |
225 ^ Image fromFile:'b_alignB.xbm' |
207 |
226 |
208 ! |
227 ! |
209 |
228 |
210 iconAlignCenterH |
229 iconAlignCenterH |
|
230 "returns image assigned to center horizontal |
|
231 " |
211 ^ Image fromFile:'b_alignCH.xbm' |
232 ^ Image fromFile:'b_alignCH.xbm' |
212 |
233 |
213 ! |
234 ! |
214 |
235 |
215 iconAlignCenterV |
236 iconAlignCenterV |
|
237 "returns image assigned to center vertical |
|
238 " |
216 ^ Image fromFile:'b_alignCV.xbm' |
239 ^ Image fromFile:'b_alignCV.xbm' |
217 |
240 |
218 ! |
241 ! |
219 |
242 |
220 iconAlignL |
243 iconAlignL |
|
244 "returns image assigned to align left |
|
245 " |
221 ^ Image fromFile:'b_alignL.xbm' |
246 ^ Image fromFile:'b_alignL.xbm' |
222 ! |
247 ! |
223 |
248 |
224 iconAlignLR |
249 iconAlignLR |
|
250 "returns image assigned to align left and right |
|
251 " |
225 ^ Image fromFile:'b_alignLR.xbm' |
252 ^ Image fromFile:'b_alignLR.xbm' |
226 |
253 |
227 ! |
254 ! |
228 |
255 |
229 iconAlignR |
256 iconAlignR |
|
257 "returns image assigned to align right |
|
258 " |
230 ^ Image fromFile:'b_alignR.xbm' |
259 ^ Image fromFile:'b_alignR.xbm' |
231 |
260 |
232 ! |
261 ! |
233 |
262 |
234 iconAlignT |
263 iconAlignT |
|
264 "returns image assigned to align top |
|
265 " |
235 ^ Image fromFile:'b_alignT.xbm' |
266 ^ Image fromFile:'b_alignT.xbm' |
236 |
267 |
237 ! |
268 ! |
238 |
269 |
239 iconAlignTB |
270 iconAlignTB |
|
271 "returns image assigned to align top and bottom |
|
272 " |
240 ^ Image fromFile:'b_alignTB.xbm' |
273 ^ Image fromFile:'b_alignTB.xbm' |
241 |
274 |
242 ! |
275 ! |
243 |
276 |
244 iconStepDown |
277 iconStepDown |
|
278 "returns image assigned to step down (change hierarchy). |
|
279 " |
245 IconStepDown isNil ifTrue:[ |
280 IconStepDown isNil ifTrue:[ |
246 IconStepDown := ((Image fromFile:'stepOver.xpm') rotated:90) flipHorizontal |
281 IconStepDown := ((Image fromFile:'stepOver.xpm') rotated:90) flipHorizontal |
247 ]. |
282 ]. |
248 ^ IconStepDown |
283 ^ IconStepDown |
249 |
284 |
478 #'adjust:' #left |
523 #'adjust:' #left |
479 ) |
524 ) |
480 #(#ToggleSpec |
525 #(#ToggleSpec |
481 #'name:' 'galleryLabel' |
526 #'name:' 'galleryLabel' |
482 #'layout:' #(#LayoutFrame -162 1.0 1 0 -82 1.0 23 0) |
527 #'layout:' #(#LayoutFrame -162 1.0 1 0 -82 1.0 23 0) |
|
528 #'activeHelpKey:' #galleryShown |
483 #'label:' 'Gallery' |
529 #'label:' 'Gallery' |
484 #'model:' #galleryShown |
530 #'model:' #galleryShown |
485 #'isTriggerOnDown:' true |
531 #'isTriggerOnDown:' true |
486 #'showLamp:' true |
532 #'showLamp:' true |
487 #'lampColor:' #(#Color 100.0 100.0 0.0) |
533 #'lampColor:' #(#Color 100.0 100.0 0.0) |
488 ) |
534 ) |
489 #(#ToggleSpec |
535 #(#ToggleSpec |
490 #'name:' 'painterLabel' |
536 #'name:' 'painterLabel' |
491 #'layout:' #(#LayoutFrame -81 1.0 1 0 -1 1.0 23 0) |
537 #'layout:' #(#LayoutFrame -81 1.0 1 0 -1 1.0 23 0) |
|
538 #'activeHelpKey:' #painterShown |
492 #'label:' 'Painter' |
539 #'label:' 'Painter' |
493 #'model:' #painterShown |
540 #'model:' #painterShown |
494 #'isTriggerOnDown:' true |
541 #'isTriggerOnDown:' true |
495 #'showLamp:' true |
542 #'showLamp:' true |
496 #'lampColor:' #(#Color 100.0 100.0 0.0) |
543 #'lampColor:' #(#Color 100.0 100.0 0.0) |
512 #'component:' |
559 #'component:' |
513 #(#SpecCollection |
560 #(#SpecCollection |
514 #'collection:' |
561 #'collection:' |
515 #( |
562 #( |
516 #(#MenuPanelSpec |
563 #(#MenuPanelSpec |
517 #'name:' 'menuMove' |
564 #'name:' 'menuChangeHierarchy' |
518 #'menu:' #menuMove |
565 #'activeHelpKey:' #menuChangeHierarchy |
|
566 #'enableChannel:' #hasOneSelectionOtherThanCanvas |
|
567 #'menu:' #menuChangeHierarchy |
519 #'showSeparatingLines:' true |
568 #'showSeparatingLines:' true |
520 #'extent:' #(#Point 123 32) |
569 #'extent:' #(#Point 123 32) |
521 ) |
570 ) |
522 #(#MenuPanelSpec |
571 #(#MenuPanelSpec |
523 #'name:' 'menuAlignment' |
572 #'name:' 'menuAlignment' |
|
573 #'activeHelpKey:' #menuAlignment |
|
574 #'enableChannel:' #canMoveOrAlignSelection |
524 #'tabable:' true |
575 #'tabable:' true |
525 #'menu:' #menuAlignment |
576 #'menu:' #menuAlignment |
526 #'showSeparatingLines:' true |
577 #'showSeparatingLines:' true |
527 #'extent:' #(#Point 233 32) |
578 #'extent:' #(#Point 233 32) |
528 ) |
579 ) |
532 #(#SpecCollection |
583 #(#SpecCollection |
533 #'collection:' |
584 #'collection:' |
534 #( |
585 #( |
535 #(#ArrowButtonSpec |
586 #(#ArrowButtonSpec |
536 #'name:' 'moveLeft' |
587 #'name:' 'moveLeft' |
|
588 #'activeHelpKey:' #moveSelectionLeft |
537 #'tabable:' true |
589 #'tabable:' true |
538 #'model:' #moveSelectionLeft |
590 #'model:' #moveSelectionLeft |
539 #'isTriggerOnDown:' true |
591 #'isTriggerOnDown:' true |
540 #'enableChannel:' #hasValidSelection |
592 #'enableChannel:' #canMoveOrAlignSelection |
541 #'direction:' #left |
593 #'direction:' #left |
542 #'extent:' #(#Point 25 24) |
594 #'extent:' #(#Point 22 24) |
543 ) |
595 ) |
544 #(#ArrowButtonSpec |
596 #(#ArrowButtonSpec |
545 #'name:' 'moveRight' |
597 #'name:' 'moveRight' |
|
598 #'activeHelpKey:' #moveSelectionRight |
546 #'model:' #moveSelectionRight |
599 #'model:' #moveSelectionRight |
547 #'isTriggerOnDown:' true |
600 #'isTriggerOnDown:' true |
548 #'enableChannel:' #hasValidSelection |
601 #'enableChannel:' #canMoveOrAlignSelection |
549 #'direction:' #right |
602 #'direction:' #right |
550 #'extent:' #(#Point 26 24) |
603 #'extent:' #(#Point 22 24) |
551 ) |
604 ) |
552 #(#ArrowButtonSpec |
605 #(#ArrowButtonSpec |
553 #'name:' 'moveDown' |
606 #'name:' 'moveDown' |
|
607 #'activeHelpKey:' #moveSelectionDown |
554 #'model:' #moveSelectionDown |
608 #'model:' #moveSelectionDown |
555 #'isTriggerOnDown:' true |
609 #'isTriggerOnDown:' true |
556 #'enableChannel:' #hasValidSelection |
610 #'enableChannel:' #canMoveOrAlignSelection |
557 #'direction:' #down |
611 #'direction:' #down |
558 #'extent:' #(#Point 26 24) |
612 #'extent:' #(#Point 22 24) |
559 ) |
613 ) |
560 #(#ArrowButtonSpec |
614 #(#ArrowButtonSpec |
561 #'name:' 'moveUp' |
615 #'name:' 'moveUp' |
|
616 #'activeHelpKey:' #moveSelectionUp |
562 #'model:' #moveSelectionUp |
617 #'model:' #moveSelectionUp |
563 #'isTriggerOnDown:' true |
618 #'isTriggerOnDown:' true |
564 #'enableChannel:' #hasValidSelection |
619 #'enableChannel:' #canMoveOrAlignSelection |
565 #'direction:' #up |
620 #'direction:' #up |
566 #'extent:' #(#Point 22 24) |
621 #'extent:' #(#Point 22 24) |
567 ) |
622 ) |
568 ) |
623 ) |
569 ) |
624 ) |
607 |
662 |
608 #( |
663 #( |
609 #(#MenuItem |
664 #(#MenuItem |
610 #'label:' 'align left' |
665 #'label:' 'align left' |
611 #'value:' #alignSelectionLeft |
666 #'value:' #alignSelectionLeft |
612 #'enabled:' #hasValidSelection |
|
613 #'activeHelpKey:' #alignSelectionLeft |
|
614 #'labelImage:' |
667 #'labelImage:' |
615 #(#ResourceRetriever |
668 #(#ResourceRetriever |
616 nil #iconAlignL |
669 nil #iconAlignL |
617 ) |
670 ) |
618 ) |
671 ) |
619 #(#MenuItem |
672 #(#MenuItem |
620 #'label:' 'align right' |
673 #'label:' 'align right' |
621 #'value:' #alignSelectionRight |
674 #'value:' #alignSelectionRight |
622 #'enabled:' #hasValidSelection |
|
623 #'activeHelpKey:' #alignSelectionRight |
675 #'activeHelpKey:' #alignSelectionRight |
624 #'labelImage:' |
676 #'labelImage:' |
625 #(#ResourceRetriever |
677 #(#ResourceRetriever |
626 nil #iconAlignR |
678 nil #iconAlignR |
627 ) |
679 ) |
628 ) |
680 ) |
629 #(#MenuItem |
681 #(#MenuItem |
630 #'label:' 'align left & right' |
682 #'label:' 'align left & right' |
631 #'value:' #alignSelectionLeftAndRight |
683 #'value:' #alignSelectionLeftAndRight |
632 #'enabled:' #hasValidSelection |
|
633 #'activeHelpKey:' #alignSelectionLeftAndRight |
684 #'activeHelpKey:' #alignSelectionLeftAndRight |
634 #'labelImage:' |
685 #'labelImage:' |
635 #(#ResourceRetriever |
686 #(#ResourceRetriever |
636 nil #iconAlignLR |
687 nil #iconAlignLR |
637 ) |
688 ) |
638 ) |
689 ) |
639 #(#MenuItem |
690 #(#MenuItem |
640 #'label:' 'align top' |
691 #'label:' 'align top' |
641 #'value:' #alignSelectionTop |
692 #'value:' #alignSelectionTop |
642 #'enabled:' #hasValidSelection |
|
643 #'activeHelpKey:' #alignSelectionTop |
693 #'activeHelpKey:' #alignSelectionTop |
644 #'labelImage:' |
694 #'labelImage:' |
645 #(#ResourceRetriever |
695 #(#ResourceRetriever |
646 nil #iconAlignT |
696 nil #iconAlignT |
647 ) |
697 ) |
648 ) |
698 ) |
649 #(#MenuItem |
699 #(#MenuItem |
650 #'label:' 'align bottom' |
700 #'label:' 'align bottom' |
651 #'value:' #alignSelectionBottom |
701 #'value:' #alignSelectionBottom |
652 #'enabled:' #hasValidSelection |
|
653 #'activeHelpKey:' #alignSelectionBottom |
702 #'activeHelpKey:' #alignSelectionBottom |
654 #'labelImage:' |
703 #'labelImage:' |
655 #(#ResourceRetriever |
704 #(#ResourceRetriever |
656 nil #iconAlignB |
705 nil #iconAlignB |
657 ) |
706 ) |
658 ) |
707 ) |
659 #(#MenuItem |
708 #(#MenuItem |
660 #'label:' 'align top & bottom' |
709 #'label:' 'align top & bottom' |
661 #'value:' #alignSelectionTopAndBottom |
710 #'value:' #alignSelectionTopAndBottom |
662 #'enabled:' #hasValidSelection |
|
663 #'activeHelpKey:' #alignSelectionTopAndBottom |
711 #'activeHelpKey:' #alignSelectionTopAndBottom |
664 #'labelImage:' |
712 #'labelImage:' |
665 #(#ResourceRetriever |
713 #(#ResourceRetriever |
666 nil #iconAlignTB |
714 nil #iconAlignTB |
667 ) |
715 ) |
668 ) |
716 ) |
669 #(#MenuItem |
717 #(#MenuItem |
670 #'label:' 'align centered horizontal' |
718 #'label:' 'align centered horizontal' |
671 #'value:' #alignSelectionCenterHor |
719 #'value:' #alignSelectionCenterHor |
672 #'enabled:' #hasValidSelection |
|
673 #'activeHelpKey:' #alignSelectionCenterHor |
720 #'activeHelpKey:' #alignSelectionCenterHor |
674 #'labelImage:' |
721 #'labelImage:' |
675 #(#ResourceRetriever |
722 #(#ResourceRetriever |
676 nil #iconAlignCenterH |
723 nil #iconAlignCenterH |
677 ) |
724 ) |
678 ) |
725 ) |
679 #(#MenuItem |
726 #(#MenuItem |
680 #'label:' 'align centered vertical' |
727 #'label:' 'align centered vertical' |
681 #'value:' #alignSelectionCenterVer |
728 #'value:' #alignSelectionCenterVer |
682 #'enabled:' #hasValidSelection |
|
683 #'activeHelpKey:' #alignSelectionCenterVer |
729 #'activeHelpKey:' #alignSelectionCenterVer |
684 #'labelImage:' |
730 #'labelImage:' |
685 #(#ResourceRetriever |
731 #(#ResourceRetriever |
686 nil #iconAlignCenterV |
732 nil #iconAlignCenterV |
687 ) |
733 ) |
747 #'label:' '-' |
796 #'label:' '-' |
748 ) |
797 ) |
749 #(#MenuItem |
798 #(#MenuItem |
750 #'label:' 'undo' |
799 #'label:' 'undo' |
751 #'nameKey:' #undo |
800 #'nameKey:' #undo |
|
801 #'enabled:' #hasUndoHistory |
752 #'value:' #undoLast |
802 #'value:' #undoLast |
753 ) |
803 ) |
754 #(#MenuItem |
804 #(#MenuItem |
755 #'label:' '-' |
805 #'label:' '-' |
756 ) |
806 ) |
757 #(#MenuItem |
807 #(#MenuItem |
758 #'label:' 'dimension' |
808 #'label:' 'dimension' |
759 #'value:' #dimension |
809 #'value:' #dimension |
|
810 #'enabled:' #hasSelection |
760 #'submenu:' |
811 #'submenu:' |
761 #(#Menu |
812 #(#Menu |
762 |
813 |
763 #( |
814 #( |
764 #(#MenuItem |
815 #(#MenuItem |
765 #'label:' 'default extent' |
816 #'label:' 'default extent' |
766 #'value:' #setToDefaultExtent |
817 #'value:' #setToDefaultExtent |
|
818 #'enabled:' #canMoveOrAlignSelection |
767 #'activeHelpKey:' #setToDefaultExtent |
819 #'activeHelpKey:' #setToDefaultExtent |
768 ) |
820 ) |
769 #(#MenuItem |
821 #(#MenuItem |
770 #'label:' 'default width' |
822 #'label:' 'default width' |
771 #'value:' #setToDefaultWidth |
823 #'value:' #setToDefaultWidth |
|
824 #'enabled:' #canMoveOrAlignSelection |
772 #'activeHelpKey:' #setToDefaultWidth |
825 #'activeHelpKey:' #setToDefaultWidth |
773 ) |
826 ) |
774 #(#MenuItem |
827 #(#MenuItem |
775 #'label:' 'default height' |
828 #'label:' 'default height' |
776 #'value:' #setToDefaultHeight |
829 #'value:' #setToDefaultHeight |
|
830 #'enabled:' #canMoveOrAlignSelection |
777 #'activeHelpKey:' #setToDefaultHeight |
831 #'activeHelpKey:' #setToDefaultHeight |
778 ) |
832 ) |
779 #(#MenuItem |
833 #(#MenuItem |
780 #'label:' 'copy extent' |
834 #'label:' 'copy extent' |
781 #'value:' #copyExtent |
835 #'value:' #copyExtent |
|
836 #'enabled:' #hasSingleSelection |
782 #'activeHelpKey:' #copyExtent |
837 #'activeHelpKey:' #copyExtent |
783 ) |
838 ) |
784 #(#MenuItem |
839 #(#MenuItem |
785 #'label:' 'paste extent' |
840 #'label:' 'paste extent' |
786 #'value:' #pasteExtent |
841 #'value:' #pasteExtent |
|
842 #'enabled:' #canMoveOrAlignSelection |
787 #'activeHelpKey:' #pasteExtent |
843 #'activeHelpKey:' #pasteExtent |
788 ) |
844 ) |
789 #(#MenuItem |
845 #(#MenuItem |
790 #'label:' 'paste width' |
846 #'label:' 'paste width' |
791 #'value:' #pasteWidth |
847 #'value:' #pasteWidth |
|
848 #'enabled:' #canMoveOrAlignSelection |
792 #'activeHelpKey:' #pasteWidth |
849 #'activeHelpKey:' #pasteWidth |
793 ) |
850 ) |
794 #(#MenuItem |
851 #(#MenuItem |
795 #'label:' 'paste height' |
852 #'label:' 'paste height' |
796 #'value:' #pasteHeight |
853 #'value:' #pasteHeight |
|
854 #'enabled:' #canMoveOrAlignSelection |
797 #'activeHelpKey:' #pasteHeight |
855 #'activeHelpKey:' #pasteHeight |
798 ) |
856 ) |
799 #(#MenuItem |
857 #(#MenuItem |
800 #'label:' 'copy layout' |
858 #'label:' 'copy layout' |
801 #'value:' #copyLayout |
859 #'value:' #copyLayout |
|
860 #'enabled:' #hasSingleSelection |
802 #'activeHelpKey:' #copyLayout |
861 #'activeHelpKey:' #copyLayout |
803 ) |
862 ) |
804 #(#MenuItem |
863 #(#MenuItem |
805 #'label:' 'paste layout' |
864 #'label:' 'paste layout' |
806 #'value:' #pasteLayout |
865 #'value:' #pasteLayout |
|
866 #'enabled:' #canMoveOrAlignSelection |
807 #'activeHelpKey:' #pasteLayout |
867 #'activeHelpKey:' #pasteLayout |
808 ) |
868 ) |
809 ) |
869 ) |
810 #(3 1 3) |
870 #(3 1 3) |
811 nil |
871 nil |
812 ) |
872 ) |
813 ) |
873 ) |
814 #(#MenuItem |
874 #(#MenuItem |
815 #'label:' 'align' |
875 #'label:' 'align' |
816 #'value:' #align |
876 #'value:' #align |
|
877 #'enabled:' #canMoveOrAlignSelection |
817 #'submenu:' |
878 #'submenu:' |
818 #(#Menu |
879 #(#Menu |
819 |
880 |
820 #( |
881 #( |
821 #(#MenuItem |
882 #(#MenuItem |
949 |
1010 |
950 #( |
1011 #( |
951 #(#MenuItem |
1012 #(#MenuItem |
952 #'label:' 'stepUp' |
1013 #'label:' 'stepUp' |
953 #'value:' #doStepUp |
1014 #'value:' #doStepUp |
954 #'enabled:' #hasSingleSelection |
|
955 #'labelImage:' |
1015 #'labelImage:' |
956 #(#ResourceRetriever |
1016 #(#ResourceRetriever |
957 #UIPainter #iconStepUp |
1017 #UIPainter #iconStepUp |
958 ) |
1018 ) |
959 ) |
1019 ) |
960 #(#MenuItem |
1020 #(#MenuItem |
961 #'label:' 'stepDown' |
1021 #'label:' 'stepDown' |
962 #'value:' #doStepDown |
1022 #'value:' #doStepDown |
963 #'enabled:' #hasSingleSelection |
|
964 #'labelImage:' |
1023 #'labelImage:' |
965 #(#ResourceRetriever |
1024 #(#ResourceRetriever |
966 #UIPainter #iconStepDown |
1025 #UIPainter #iconStepDown |
967 ) |
1026 ) |
|
1027 ) |
|
1028 #(#MenuItem |
|
1029 #'label:' '-' |
968 ) |
1030 ) |
969 #(#MenuItem |
1031 #(#MenuItem |
970 #'label:' 'stepIn' |
1032 #'label:' 'stepIn' |
971 #'value:' #doStepIn |
1033 #'value:' #doStepIn |
972 #'enabled:' #canStepIn |
1034 #'enabled:' #canMoveSelectionIntoContainer |
973 #'labelImage:' |
1035 #'labelImage:' |
974 #(#ResourceRetriever |
1036 #(#ResourceRetriever |
975 #UIPainter #iconStepIn |
1037 #UIPainter #iconStepIn |
976 ) |
1038 ) |
977 ) |
1039 ) |
978 #(#MenuItem |
1040 #(#MenuItem |
979 #'label:' 'stepOut' |
1041 #'label:' 'stepOut' |
980 #'value:' #doStepOut |
1042 #'value:' #doStepOut |
981 #'enabled:' #canStepOut |
1043 #'enabled:' #canMoveSelectionOutOfContainer |
982 #'labelImage:' |
1044 #'labelImage:' |
983 #(#ResourceRetriever |
1045 #(#ResourceRetriever |
984 #UIPainter #iconStepOut |
1046 #UIPainter #iconStepOut |
985 ) |
1047 ) |
986 ) |
1048 ) |
987 ) |
1049 ) nil |
988 #( 2 ) |
|
989 nil |
1050 nil |
990 ) |
1051 ) |
991 ! |
1052 ! |
992 |
1053 |
993 menuPullDown |
1054 menuPullDown |
1172 ) nil |
1233 ) nil |
1173 nil |
1234 nil |
1174 ) |
1235 ) |
1175 ! ! |
1236 ! ! |
1176 |
1237 |
1177 !UIPainter methodsFor:'accessing menu'! |
|
1178 |
|
1179 menuCanvas |
|
1180 ^ [ treeView canvas showMiddleButtonMenu ] |
|
1181 ! |
|
1182 |
|
1183 menuMove |
|
1184 "this window spec was automatically generated by the ST/X MenuEditor" |
|
1185 |
|
1186 ^ self class menuMove |
|
1187 |
|
1188 |
|
1189 ! |
|
1190 |
|
1191 menuPullDown |
|
1192 "this window spec was automatically generated by the ST/X MenuEditor" |
|
1193 |
|
1194 ^ self class menuPullDown |
|
1195 |
|
1196 |
|
1197 ! ! |
|
1198 |
|
1199 !UIPainter methodsFor:'actions'! |
1238 !UIPainter methodsFor:'actions'! |
1200 |
1239 |
1201 accept |
1240 accept |
|
1241 "accept changes done to the specification. The component assigned to the |
|
1242 specification will change immediately dependant on the attributes derived |
|
1243 from the specification. |
|
1244 " |
1202 |layout| |
1245 |layout| |
1203 |
1246 |
1204 self isLayoutToolSelected ifTrue:[ |
1247 self isLayoutToolSelected ifTrue:[ |
1205 (layout := layoutTool layout) notNil ifTrue:[ |
1248 (layout := layoutTool layout) notNil ifTrue:[ |
1206 layoutTool layoutType == #Extent ifTrue:[ |
1249 layoutTool layoutType == #Extent ifTrue:[ |
1207 self painter setExtent:layout |
1250 layoutTool layoutView == self painter topView ifTrue:[ |
|
1251 layoutTool layoutView extent:layout |
|
1252 ] ifFalse:[ |
|
1253 self painter setExtent:layout |
|
1254 ] |
1208 ] ifFalse:[ |
1255 ] ifFalse:[ |
1209 self painter setLayout:layout |
1256 self painter setLayout:layout |
1210 ] |
1257 ] |
1211 ] |
1258 ] |
1212 ] ifFalse:[ |
1259 ] ifFalse:[ |
1218 self modifiedChannel value:false. |
1265 self modifiedChannel value:false. |
1219 |
1266 |
1220 ! |
1267 ! |
1221 |
1268 |
1222 cancel |
1269 cancel |
1223 "cancel all changes and read back attributes from current view |
1270 "cancel all changes done to the specification; reread attributes from the |
|
1271 assigned component |
1224 " |
1272 " |
1225 self isModified ifTrue:[ |
1273 self isModified ifTrue:[ |
1226 specTool specification:(self painter specForSelection). |
1274 specTool specification:(self painter specForSelection). |
1227 layoutTool layoutView:(layoutTool layoutView). |
1275 self setViewInLayoutTool:(layoutTool layoutView). |
1228 self modifiedChannel value:false. |
1276 self modifiedChannel value:false. |
1229 ] |
1277 ] |
|
1278 ! |
|
1279 |
|
1280 moveSelectionDown |
|
1281 "move selected components down |
|
1282 " |
|
1283 self painter moveSelectionDown |
|
1284 ! |
|
1285 |
|
1286 moveSelectionLeft |
|
1287 "move selected components left |
|
1288 " |
|
1289 self painter moveSelectionLeft |
|
1290 |
|
1291 ! |
|
1292 |
|
1293 moveSelectionRight |
|
1294 "move selected components right |
|
1295 " |
|
1296 self painter moveSelectionRight |
|
1297 |
|
1298 ! |
|
1299 |
|
1300 moveSelectionUp |
|
1301 "move selected components up |
|
1302 " |
|
1303 self painter moveSelectionUp |
|
1304 |
1230 ! |
1305 ! |
1231 |
1306 |
1232 openEditMenu |
1307 openEditMenu |
1233 |cls aspect editor| |
1308 |cls aspect editor| |
1234 |
1309 |
1312 |
1387 |
1313 ! ! |
1388 ! ! |
1314 |
1389 |
1315 !UIPainter methodsFor:'aspects'! |
1390 !UIPainter methodsFor:'aspects'! |
1316 |
1391 |
1317 canStepIn |
1392 canMoveOrAlignSelection |
1318 ^ builder booleanValueAspectFor:#canStepIn |
1393 "returns a boolean value holder which is true in case that any selection exists |
1319 |
1394 and all widgets in the selection can change its layout through to a move or |
1320 "Modified: 28.7.1997 / 12:52:16 / cg" |
1395 align operation |
1321 ! |
1396 " |
1322 |
1397 ^ builder booleanValueAspectFor:#canMoveOrAlignSelection |
1323 canStepOut |
1398 ! |
1324 ^ builder booleanValueAspectFor:#canStepOut |
1399 |
1325 |
1400 canMoveSelectionIntoContainer |
1326 "Modified: 28.7.1997 / 12:52:18 / cg" |
1401 "returns a boolean value holder which is true in case that one component is selected |
|
1402 and can change its container widget to the next element in the list which will have |
|
1403 the same container. |
|
1404 " |
|
1405 ^ builder booleanValueAspectFor:#canMoveSelectionIntoContainer |
|
1406 ! |
|
1407 |
|
1408 canMoveSelectionOutOfContainer |
|
1409 "returns a boolean value holder which is true in case that one component is selected |
|
1410 which is contained within another component |
|
1411 " |
|
1412 ^ builder booleanValueAspectFor:#canMoveSelectionOutOfContainer |
1327 ! |
1413 ! |
1328 |
1414 |
1329 enableChannel |
1415 enableChannel |
1330 "true if modifications are allowed otherwise running test |
1416 "true if modifications are allowed otherwise running test |
1331 " |
1417 " |
1332 ^ self painter enableChannel |
1418 ^ self painter enableChannel |
1333 ! |
1419 ! |
1334 |
1420 |
1335 galleryShown |
1421 galleryShown |
|
1422 "returns a boolean value holder which is set to true if the gallery is shown |
|
1423 " |
1336 |holder| |
1424 |holder| |
1337 |
1425 |
1338 (holder := builder bindingAt:#galleryShown) isNil ifTrue:[ |
1426 (holder := builder bindingAt:#galleryShown) isNil ifTrue:[ |
1339 builder aspectAt:#galleryShown put:(holder := true asValue). |
1427 builder aspectAt:#galleryShown put:(holder := true asValue). |
1340 holder addDependent:self |
1428 holder addDependent:self |
1341 ]. |
1429 ]. |
1342 ^ holder |
1430 ^ holder |
1343 |
1431 |
1344 ! |
1432 ! |
1345 |
1433 |
1346 hasSingleSelection |
1434 hasOneSelectionOtherThanCanvas |
1347 ^ builder booleanValueAspectFor:#hasSingleSelection |
1435 "returns a value holder which is true in case that one component is selected |
1348 |
1436 other than the canvas. |
1349 "Modified: 28.7.1997 / 12:52:20 / cg" |
1437 " |
1350 ! |
1438 ^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas |
1351 |
|
1352 hasValidSelection |
|
1353 ^ builder booleanValueAspectFor:#hasValidSelection |
|
1354 |
|
1355 "Modified: 28.7.1997 / 12:52:22 / cg" |
|
1356 ! |
1439 ! |
1357 |
1440 |
1358 modifiedChannel |
1441 modifiedChannel |
|
1442 "returns a boolean value holder which is set to true if something is modified |
|
1443 and not accepted |
|
1444 " |
1359 ^ builder booleanValueAspectFor:#modifiedChannel |
1445 ^ builder booleanValueAspectFor:#modifiedChannel |
1360 |
|
1361 "Modified: 28.7.1997 / 12:52:24 / cg" |
|
1362 ! |
1446 ! |
1363 |
1447 |
1364 noteBookView |
1448 noteBookView |
1365 "automatically generated by UIPainter ..." |
1449 "returns the notebook view; initialize components within the notebook |
1366 |
1450 " |
1367 |noteBook channel n1 n2| |
1451 |noteBook channel n1 n2| |
1368 |
1452 |
1369 (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
1453 (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[ |
1370 noteBook := View new. |
1454 noteBook := View new. |
1371 layoutTool := UILayoutTool new. |
1455 layoutTool := UILayoutTool new. |
1423 ^ holder |
1486 ^ holder |
1424 |
1487 |
1425 ! |
1488 ! |
1426 |
1489 |
1427 tabList |
1490 tabList |
1428 "automatically generated by UIPainter ..." |
1491 "returns a value holder which keeps a list of labels assigned to the tabs |
1429 |
1492 " |
1430 |holder| |
1493 |holder| |
1431 |
1494 |
1432 (holder := builder bindingAt:#tabList) isNil ifTrue:[ |
1495 (holder := builder bindingAt:#tabList) isNil ifTrue:[ |
1433 builder aspectAt:#tabList put:(holder := ValueHolder new). |
1496 builder aspectAt:#tabList put:(holder := ValueHolder new). |
1434 holder value:#( 'Properties' ). |
1497 holder value:#( 'Properties' ). |
1435 ]. |
1498 ]. |
1436 ^ holder |
1499 ^ holder |
1437 ! |
1500 ! |
1438 |
1501 |
1439 tabModel |
1502 tabModel |
1440 "automatically generated by UIPainter ..." |
1503 "returns a value holder which keeps the current name of the tab selected |
1441 |
1504 " |
1442 |holder| |
1505 |holder| |
1443 |
1506 |
1444 (holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
1507 (holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
1445 holder := AspectAdaptor new subject:self; forAspect:#tabSelection. |
1508 holder := AspectAdaptor new subject:self; forAspect:#tabSelection. |
1446 builder aspectAt:#tabModel put:holder. |
1509 builder aspectAt:#tabModel put:holder. |
1447 ]. |
1510 ]. |
1448 ^ holder |
1511 ^ holder |
1449 ! |
1512 ! |
1450 |
1513 |
1451 treeView |
1514 treeView |
|
1515 "returns the selection tree view which holds all widget identifiers |
|
1516 " |
1452 ^ treeView |
1517 ^ treeView |
1453 ! ! |
1518 ! ! |
1454 |
1519 |
1455 !UIPainter methodsFor:'binding access'! |
1520 !UIPainter methodsFor:'binding access'! |
1456 |
1521 |
1461 ! ! |
1526 ! ! |
1462 |
1527 |
1463 !UIPainter methodsFor:'change & update'! |
1528 !UIPainter methodsFor:'change & update'! |
1464 |
1529 |
1465 layoutChanged |
1530 layoutChanged |
|
1531 "called by the painter/canvas whenever the layout of the current selected |
|
1532 widget changed |
|
1533 " |
1466 self isModified ifFalse:[ |
1534 self isModified ifFalse:[ |
1467 layoutTool update. |
1535 layoutTool update. |
1468 self modifiedChannel value:false |
1536 self modifiedChannel value:false |
1469 ] |
1537 ] |
1470 ! |
1538 ! |
1471 |
1539 |
1472 propertyChanged |
1540 propertyChanged |
1473 "property changed |
1541 "called by the painter/canvas whenever the property of the current selected |
|
1542 widget changed |
1474 " |
1543 " |
1475 |p| |
1544 |p| |
1476 |
1545 |
1477 (p := treeView propertySelected) notNil ifTrue:[ |
1546 (p := treeView propertySelected) notNil ifTrue:[ |
1478 specTool specification:(p spec copy). |
1547 specTool specification:(p spec copy). |
1479 layoutTool layoutView:(p view). |
1548 self setViewInLayoutTool:(p view). |
1480 self modifiedChannel value:false |
1549 self modifiedChannel value:false |
1481 ] ifFalse:[ |
1550 ] ifFalse:[ |
1482 layoutTool layoutView notNil ifTrue:[ |
1551 layoutTool layoutView notNil ifTrue:[ |
1483 self modifiedChannel value:false. |
1552 self modifiedChannel value:false. |
1484 self treeSelection |
1553 self treeSelection |
1485 ] |
1554 ] |
1486 ] |
1555 ] |
1487 ! |
1556 ! |
1488 |
1557 |
1489 update:something with:aParameter from:someObject |
1558 update:something with:aParameter from:someObject |
1490 |
1559 "catch change notifications |
|
1560 " |
1491 someObject == treeView model ifTrue:[ |
1561 someObject == treeView model ifTrue:[ |
1492 something == #selection ifTrue:[self treeSelection]. |
1562 something == #selection ifTrue:[self treeSelection]. |
1493 ^ self |
1563 ^ self |
1494 ]. |
1564 ]. |
1495 |
1565 |
1514 ! ! |
1584 ! ! |
1515 |
1585 |
1516 !UIPainter methodsFor:'event handling'! |
1586 !UIPainter methodsFor:'event handling'! |
1517 |
1587 |
1518 doesNotUnderstand:aMessage |
1588 doesNotUnderstand:aMessage |
1519 |painter| |
1589 |
1520 |
1590 |painter| |
1521 painter := self painter. |
1591 |
1522 |
1592 painter := self painter. |
1523 (painter respondsTo:(aMessage selector)) ifTrue:[ |
1593 |
|
1594 (painter respondsTo:(aMessage selector)) ifTrue:[ |
1524 ^ aMessage sendTo:painter |
1595 ^ aMessage sendTo:painter |
1525 ]. |
1596 ]. |
1526 super doesNotUnderstand:aMessage |
1597 super doesNotUnderstand:aMessage |
|
1598 |
|
1599 ! ! |
|
1600 |
|
1601 !UIPainter methodsFor:'menu accessing'! |
|
1602 |
|
1603 menuAlignment |
|
1604 "returns the pull down menu which keeps the alignment operations |
|
1605 " |
|
1606 ^ self class menuAlignment |
|
1607 |
|
1608 ! |
|
1609 |
|
1610 menuCanvas |
|
1611 "returns the middle button menu used by the painter and the tree view |
|
1612 " |
|
1613 ^ [ treeView canvas showMiddleButtonMenu ] |
|
1614 ! |
|
1615 |
|
1616 menuChangeHierarchy |
|
1617 "returns the hierarchy pull down menu |
|
1618 " |
|
1619 ^ self class menuChangeHierarchy |
|
1620 |
|
1621 |
|
1622 ! |
|
1623 |
|
1624 menuPullDown |
|
1625 "returns the main pull down menu |
|
1626 " |
|
1627 ^ self class menuPullDown |
|
1628 |
1527 |
1629 |
1528 ! ! |
1630 ! ! |
1529 |
1631 |
1530 !UIPainter methodsFor:'private'! |
1632 !UIPainter methodsFor:'private'! |
1531 |
1633 |
1532 hideUIView:aView |
1634 hideUIView:aView |
|
1635 "hide the view which is an application or top view |
|
1636 " |
1533 aView beIndependent. |
1637 aView beIndependent. |
1534 aView unmap. |
1638 aView unmap. |
1535 ! |
1639 ! |
1536 |
1640 |
1537 painter |
1641 painter |
|
1642 "returns the painter/canvas view |
|
1643 " |
1538 ^ treeView canvas |
1644 ^ treeView canvas |
1539 ! |
1645 ! |
1540 |
1646 |
1541 raiseUIView:aView |
1647 raiseUIView:aView |
|
1648 "raise the view which is an application or top view |
|
1649 " |
1542 aView map. |
1650 aView map. |
1543 aView bePartner. |
1651 aView bePartner. |
1544 ! |
1652 ! |
1545 |
1653 |
1546 setClass:cls selector:selector |
1654 setClass:cls selector:selector |
|
1655 "set the application class and the selector under which the |
|
1656 window specification should be stored |
|
1657 " |
1547 |clsName superClassName| |
1658 |clsName superClassName| |
1548 |
1659 |
1549 clsName := cls name. |
1660 clsName := cls name. |
1550 superClassName := cls superclass name. |
1661 superClassName := cls superclass name. |
1551 |
1662 |
1561 specClass := clsName. |
1672 specClass := clsName. |
1562 specSelector := (selector ? ''). |
1673 specSelector := (selector ? ''). |
1563 specSuperclass := superClassName. |
1674 specSuperclass := superClassName. |
1564 |
1675 |
1565 "Modified: 24.6.1997 / 19:07:01 / cg" |
1676 "Modified: 24.6.1997 / 19:07:01 / cg" |
|
1677 ! |
|
1678 |
|
1679 setViewInLayoutTool:aView |
|
1680 "set view for layout tool |
|
1681 " |
|
1682 self painter topView ~~ aView ifTrue:[ |
|
1683 layoutTool layoutView:aView type:nil |
|
1684 ] ifFalse:[ |
|
1685 layoutTool layoutView:aView type:#Extent |
|
1686 ]. |
|
1687 |
|
1688 |
1566 ! ! |
1689 ! ! |
1567 |
1690 |
1568 !UIPainter methodsFor:'queries'! |
1691 !UIPainter methodsFor:'queries'! |
1569 |
1692 |
1570 hasSpecClass |
1693 hasSpecClass |
1571 |
1694 "checks whether an application class is defined |
|
1695 " |
1572 specClass notNil ifTrue:[ |
1696 specClass notNil ifTrue:[ |
1573 ^ (specClass isBehavior or:[(Smalltalk at:specClass asSymbol) notNil]) |
1697 ^ (specClass isBehavior or:[(Smalltalk at:specClass asSymbol) notNil]) |
1574 ]. |
1698 ]. |
1575 ^ false |
1699 ^ false |
1576 ! |
1700 ! |
1577 |
1701 |
1578 hasSpecClassAndSelector |
1702 hasSpecClassAndSelector |
1579 |
1703 "checks whether an application class and a selector under which |
|
1704 the window specification is stored is defined. |
|
1705 " |
1580 specSelector size > 1 ifTrue:[ |
1706 specSelector size > 1 ifTrue:[ |
1581 ^ self hasSpecClass |
1707 ^ self hasSpecClass |
1582 ]. |
1708 ]. |
1583 ^ false |
1709 ^ false |
1584 ! |
1710 ! |
1585 |
1711 |
1586 isHelpToolSelected |
1712 isHelpToolSelected |
|
1713 "returns true if current selected tab in the noteBook is assigned |
|
1714 to the 'Help' tool |
|
1715 " |
1587 ^ tabSelection = 'Help' |
1716 ^ tabSelection = 'Help' |
1588 ! |
1717 ! |
1589 |
1718 |
1590 isLayoutToolSelected |
1719 isLayoutToolSelected |
|
1720 "returns true if current selected tab in the noteBook is assigned |
|
1721 to the 'Layout' tool |
|
1722 " |
1591 ^ tabSelection = layoutTool class label |
1723 ^ tabSelection = layoutTool class label |
1592 ! |
1724 ! |
1593 |
1725 |
1594 isModified |
1726 isModified |
1595 "returns true if current spec. is modified |
1727 "returns true if current specification or layout is modified |
1596 " |
1728 " |
1597 ^ self modifiedChannel value |
1729 ^ self modifiedChannel value |
1598 ! |
1730 ! |
1599 |
1731 |
1600 isPainterEnabled |
1732 isPainterEnabled |
|
1733 "returns true if not running in test mode |
|
1734 " |
1601 ^ self painter enabled |
1735 ^ self painter enabled |
1602 ! ! |
1736 ! ! |
1603 |
1737 |
1604 !UIPainter methodsFor:'selection'! |
1738 !UIPainter methodsFor:'selection'! |
1605 |
1739 |
1606 canvasSelected |
|
1607 |spec| |
|
1608 |
|
1609 self hasValidSelection value:false. |
|
1610 self canStepIn value:false. |
|
1611 self canStepOut value:false. |
|
1612 self hasSingleSelection value:false. |
|
1613 |
|
1614 spec := treeView canvasSpec. |
|
1615 (builder componentAt:#noteBook) setSelection:nil. |
|
1616 self setupSlicesFrom:spec hasLayout:false. |
|
1617 tabSelection := nil. |
|
1618 |
|
1619 layoutTool layoutView:nil. |
|
1620 specTool specification:spec. |
|
1621 self modifiedChannel value:false. |
|
1622 self tabSelection:(self tabList value first). |
|
1623 specTool selection:tabSelection. |
|
1624 (self noteBookView subViews at:2) raise. |
|
1625 (builder componentAt:#noteBook) setSelection:1. |
|
1626 self modifiedChannel value:false. |
|
1627 |
|
1628 ! |
|
1629 |
|
1630 setupSlicesFrom:aSpec hasLayout:hasLayout |
|
1631 |
|
1632 |slices list| |
|
1633 |
|
1634 slices := aSpec class slices. |
|
1635 list := slices collect:[:aSlice| aSlice first asString]. |
|
1636 |
|
1637 hasLayout ifTrue:[ |
|
1638 list add:(layoutTool class label) |
|
1639 ]. |
|
1640 self tabList value:list. |
|
1641 ! |
|
1642 |
|
1643 tabSelection |
1740 tabSelection |
1644 "returns current name of section |
1741 "returns name of current selected tab in the notebook. |
1645 " |
1742 " |
1646 ^ tabSelection |
1743 ^ tabSelection |
1647 ! |
1744 ! |
1648 |
1745 |
1649 tabSelection:something |
1746 tabSelection:something |
1650 "section changed |
1747 "the tab selection of the notebook changed |
1651 " |
1748 " |
1652 |raiseViewIdx| |
1749 |raiseViewIdx| |
1653 |
1750 |
1654 (something isNil or:[tabSelection = something]) ifTrue:[ |
1751 (something isNil or:[tabSelection = something]) ifTrue:[ |
1655 ^ self |
1752 ^ self |
1672 (self noteBookView subViews at:raiseViewIdx) raise. |
1769 (self noteBookView subViews at:raiseViewIdx) raise. |
1673 self cancel. |
1770 self cancel. |
1674 ! |
1771 ! |
1675 |
1772 |
1676 treeSelection |
1773 treeSelection |
1677 "called whenever tree-selection changed |
1774 "called whenever the selection of the treeview changed |
1678 " |
1775 " |
1679 |oldSelection view slices list spec props size nameOfSpec| |
1776 |view list spec property tabComponent| |
1680 |
1777 |
1681 self isModified ifTrue:[ |
1778 self isModified ifTrue:[ |
1682 (self confirm:'accept change made in ' , tabSelection printString , ' section ?') ifTrue:[ |
1779 (self confirm:'accept change made in ' , tabSelection printString , ' section ?') ifTrue:[ |
1683 self accept |
1780 self accept |
1684 ] |
1781 ] |
1685 ]. |
1782 ]. |
|
1783 self canMoveOrAlignSelection value:(treeView canMoveOrAlignSelection). |
|
1784 self canMoveSelectionIntoContainer value:(treeView canMoveSelectionIntoContainer). |
|
1785 self canMoveSelectionOutOfContainer value:(treeView canMoveSelectionOutOfContainer). |
|
1786 self hasOneSelectionOtherThanCanvas value:(treeView hasOneSelectionOtherThanCanvas). |
|
1787 |
1686 treeView isCanvasSelected ifTrue:[ |
1788 treeView isCanvasSelected ifTrue:[ |
1687 ^ self canvasSelected |
1789 spec := treeView canvasSpec. |
1688 ]. |
1790 view := self painter topView. |
1689 |
1791 ] ifFalse:[ |
1690 props := treeView propertySelected. |
1792 (property := treeView propertySelected) notNil ifTrue:[ |
1691 oldSelection := tabSelection. |
1793 view := property view. |
1692 tabSelection := nil. |
1794 spec := property spec copy. |
1693 |
1795 ] |
1694 self hasValidSelection value:(treeView hasValidSelection). |
1796 ]. |
1695 self canStepIn value:(treeView canStepIn). |
1797 tabComponent := builder componentAt:#noteBook. |
1696 self canStepOut value:(treeView canStepOut). |
1798 self setViewInLayoutTool:view. |
1697 |
1799 specTool specification:spec. |
1698 props isNil ifFalse:[ |
1800 |
1699 self hasSingleSelection value:true. |
1801 spec notNil ifTrue:[ |
1700 view := props view. |
1802 list := spec class slices collect:[:aSlice| aSlice first asString]. |
1701 spec := props spec copy. |
1803 view notNil ifTrue:[list add:(layoutTool class label)]. |
1702 |
1804 self tabList value:list. |
1703 layoutTool layoutView == view ifFalse:[ |
1805 self showHelp:(spec class name) for:nil. |
1704 self setupSlicesFrom:spec hasLayout:true. |
1806 tabComponent enabled:true. |
|
1807 |
|
1808 (tabSelection := tabComponent selection) isNil ifTrue:[ |
|
1809 tabComponent setSelection:(tabSelection := list first) |
1705 ]. |
1810 ]. |
1706 list := self tabList value. |
|
1707 |
|
1708 (list findFirst:[:n| n = oldSelection ]) ~~ 0 ifTrue:[ |
|
1709 tabSelection := oldSelection |
|
1710 ] ifFalse:[ |
|
1711 tabSelection := list first |
|
1712 ]. |
|
1713 nameOfSpec := spec class name. |
|
1714 ] ifTrue:[ |
|
1715 self hasSingleSelection value:false. |
|
1716 nameOfSpec := '' |
|
1717 ]. |
|
1718 |
|
1719 self showHelp:nameOfSpec for:nil. |
|
1720 |
|
1721 layoutTool layoutView:view. |
|
1722 specTool specification:spec. |
|
1723 |
|
1724 tabSelection notNil ifTrue:[ |
|
1725 self isLayoutToolSelected ifTrue:[ |
1811 self isLayoutToolSelected ifTrue:[ |
1726 (self noteBookView subViews at:1) raise |
1812 (self noteBookView subViews at:1) raise |
1727 ] ifFalse:[ |
1813 ] ifFalse:[ |
1728 specTool selection:tabSelection. |
1814 specTool selection:tabSelection. |
1729 (self noteBookView subViews at:2) raise |
1815 (self noteBookView subViews at:2) raise |
1730 ] |
1816 ] |
1731 ]. |
1817 ] ifFalse:[ |
1732 |
1818 tabComponent enabled:false. |
1733 (builder componentAt:#noteBook) setSelection:tabSelection. |
1819 self showHelp:'' for:nil. |
|
1820 ]. |
1734 self modifiedChannel value:false. |
1821 self modifiedChannel value:false. |
1735 |
1822 |
1736 ! ! |
1823 ! ! |
1737 |
1824 |
1738 !UIPainter methodsFor:'startup / release'! |
1825 !UIPainter methodsFor:'startup / release'! |
1839 selectionPanel allButOpenInterface:#windowSpec. |
1925 selectionPanel allButOpenInterface:#windowSpec. |
1840 selectionPanel window openInGroup:(topView windowGroup). |
1926 selectionPanel window openInGroup:(topView windowGroup). |
1841 selectionPanel window bePartner. |
1927 selectionPanel window bePartner. |
1842 selectionPanel openWindow. |
1928 selectionPanel openWindow. |
1843 selectionPanel masterApplication:self. |
1929 selectionPanel masterApplication:self. |
|
1930 |
|
1931 topView iconLabel:'Builder'. |
|
1932 topView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100). |
|
1933 |
|
1934 painterView iconLabel:'Builder'. |
|
1935 painterView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100). |
|
1936 |
|
1937 selectionPanel window iconLabel:'Builder'. |
|
1938 selectionPanel window icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100). |
1844 |
1939 |
1845 "Modified: 1.8.1997 / 14:22:10 / cg" |
1940 "Modified: 1.8.1997 / 14:22:10 / cg" |
1846 ! |
1941 ! |
1847 |
1942 |
1848 openNewWindowCanvas |
1943 openNewWindowCanvas |
2665 " |
2795 " |
2666 super initialize. |
2796 super initialize. |
2667 self multipleSelectOk:true. |
2797 self multipleSelectOk:true. |
2668 self model:(SelectionInTree new). |
2798 self model:(SelectionInTree new). |
2669 cvsEventsDisabled := false. |
2799 cvsEventsDisabled := false. |
2670 |
2800 imageMasterChild := (self class imageMasterChild) onDevice:device. |
|
2801 imageMasterParent := (self class imageMasterParent) onDevice:device. |
|
2802 imageEmptyParent := (self class imageEmptyParent) onDevice:device. |
2671 |
2803 |
2672 ! ! |
2804 ! ! |
2673 |
2805 |
2674 !UIPainter::TreeView methodsFor:'private'! |
2806 !UIPainter::TreeView methodsFor:'private'! |
2675 |
|
2676 allItemsDo:aOneArgBlock |
|
2677 "evaluate the argument a block on each item other than the canvas |
|
2678 " |
|
2679 model root allChildrenDo:aOneArgBlock |
|
2680 |
|
2681 |
|
2682 ! |
|
2683 |
2807 |
2684 figureFor:aNode |
2808 figureFor:aNode |
2685 "returns image for an item; testing whether item is the first |
2809 "returns image for an item; testing whether item is the first |
2686 entry into the selection |
2810 entry into the selection |
2687 " |
2811 " |
2688 |master| |
2812 |master subComp| |
|
2813 |
|
2814 subComp := (aNode parent isNil or:[aNode contents spec class supportsSubComponents]). |
2689 |
2815 |
2690 selection size == 0 ifFalse:[ |
2816 selection size == 0 ifFalse:[ |
2691 master := listOfNodes at:(selection first). |
2817 master := listOfNodes at:(selection first). |
2692 |
2818 |
2693 aNode == master ifTrue:[ |
2819 aNode == master ifTrue:[ |
2694 lastDrawnMaster := master. |
2820 lastDrawnMaster := master. |
2695 aNode children size == 0 ifTrue:[ |
2821 subComp ifFalse:[^ imageMasterChild] |
2696 imageMasterChild isNil ifTrue:[ |
2822 ifTrue:[^ imageMasterParent]. |
2697 imageMasterChild := (self class imageMasterChild) onDevice:device. |
|
2698 ]. |
|
2699 ^ imageMasterChild |
|
2700 ]. |
|
2701 imageMasterParent isNil ifTrue:[ |
|
2702 imageMasterParent := (self class imageMasterParent) onDevice:device. |
|
2703 ]. |
|
2704 ^ imageMasterParent |
|
2705 ] |
2823 ] |
2706 ]. |
2824 ]. |
2707 ^ super figureFor:aNode |
2825 subComp ifFalse:[ |
2708 |
2826 ^ imageItem |
2709 |
2827 ]. |
2710 ! |
2828 aNode hasChildren ifTrue:[ |
2711 |
2829 aNode isExpandable ifTrue:[ ^ imageClosed ] |
2712 itemOfView:aView |
2830 ifFalse:[ ^ imageOpened ] |
2713 "returns item assigned to view or nil |
2831 ]. |
2714 " |
2832 ^ imageEmptyParent |
2715 aView notNil ifTrue:[ |
|
2716 self allItemsDo:[:anItem| |
|
2717 (anItem contents view == aView) ifTrue:[^ anItem] |
|
2718 ] |
|
2719 ]. |
|
2720 ^ nil |
|
2721 |
|
2722 |
2833 |
2723 ! |
2834 ! |
2724 |
2835 |
2725 selectionChangedFrom:oldSelection |
2836 selectionChangedFrom:oldSelection |
2726 "selection has changed. update master selection and raise notification |
2837 "selection has changed. update master selection and raise notification |
2727 to canvas in case of enabled cvs events |
2838 to canvas in case of enabled cvs events |
2728 " |
2839 " |
2729 |sel| |
2840 |sel size| |
2730 |
2841 |
2731 super selectionChangedFrom:oldSelection. |
2842 super selectionChangedFrom:oldSelection. |
|
2843 size := selection size. |
2732 |
2844 |
2733 cvsEventsDisabled ifFalse:[ |
2845 cvsEventsDisabled ifFalse:[ |
2734 selection notNil ifTrue:[ |
2846 (size ~~ 0 and:[size ~~ 1 or:[selection first ~~ 1]]) ifTrue:[ |
2735 sel := selection collect:[:i| (listOfNodes at:i) contents view]. |
2847 sel := OrderedCollection new. |
2736 ] ifFalse:[ |
2848 |
2737 sel := #() |
2849 selection do:[:i| |
|
2850 i ~~ 1 ifTrue:[sel add:(listOfNodes at:i) contents view] |
|
2851 ] |
2738 ]. |
2852 ]. |
2739 self canvas updateSelectionFromModel:sel. |
2853 self canvas updateSelectionFromModel:sel |
2740 ]. |
2854 ]. |
2741 |
2855 |
2742 selection size ~~ 0 ifTrue:[ |
2856 size ~~ 0 ifTrue:[ |
2743 sel := selection first. |
2857 sel := selection first. |
2744 |
2858 |
2745 (listOfNodes at:sel) == lastDrawnMaster ifFalse:[ |
2859 (listOfNodes at:sel) == lastDrawnMaster ifFalse:[ |
2746 self redrawLine:sel |
2860 self redrawLine:sel |
2747 ] |
2861 ] |
2748 ] |
2862 ] |
2749 |
|
2750 |
|
2751 ! ! |
2863 ! ! |
2752 |
2864 |
2753 !UIPainter::TreeView methodsFor:'queries'! |
2865 !UIPainter::TreeView methodsFor:'queries'! |
2754 |
2866 |
2755 canStepIn |
2867 canMoveOrAlignSelection |
2756 "returns true if can step in |
2868 "returns true if any selection exists and all widgets in the selection |
|
2869 can change their layout through to a move or align operation. |
|
2870 " |
|
2871 |canvas| |
|
2872 |
|
2873 selection size == 0 ifTrue:[ |
|
2874 ^ false |
|
2875 ]. |
|
2876 canvas := self canvas. |
|
2877 |
|
2878 selection do:[:i| |
|
2879 i == 1 ifTrue:[^ false]. |
|
2880 |
|
2881 (canvas canChangeLayoutOfView:((listOfNodes at:i) contents view)) ifFalse:[ |
|
2882 ^ false |
|
2883 ] |
|
2884 ]. |
|
2885 ^ true |
|
2886 ! |
|
2887 |
|
2888 canMoveSelectionIntoContainer |
|
2889 "returns true in case that one component is selected and can change its container |
|
2890 widget to the next element in the list which will have the same container. |
2757 " |
2891 " |
2758 |item prnt| |
2892 |item prnt| |
2759 |
2893 |
2760 ( (item := self selectedNode) isNil |
2894 ( (item := self selectedNode) isNil |
2761 or:[(prnt := item parent) isNil |
2895 or:[(prnt := item parent) isNil |
2777 ^ false |
2914 ^ false |
2778 ]. |
2915 ]. |
2779 ^ true |
2916 ^ true |
2780 ! |
2917 ! |
2781 |
2918 |
2782 hasValidSelection |
2919 hasOneSelectionOtherThanCanvas |
2783 "returns true if any selection exists other than root |
2920 "returns true in case that one selection exists other than the canvas |
2784 " |
2921 " |
2785 |size| |
2922 ^ (selection size == 1 and:[selection first ~~ 1]) |
2786 |
|
2787 (size := selection size) > 1 ifFalse:[ |
|
2788 (size == 0 or:[self isInSelection:1]) ifTrue:[ |
|
2789 ^ false |
|
2790 ] |
|
2791 ]. |
|
2792 ^ true |
|
2793 ! |
2923 ! |
2794 |
2924 |
2795 isCanvasSelected |
2925 isCanvasSelected |
2796 "returns true in case of a single selection and the |
2926 "returns true in case of a single selection and the |
2797 selection is the canvas (index 1) |
2927 selection is the canvas (index 1) |
2798 " |
2928 " |
2799 ^ (selection size == 1 and:[self isInSelection:1]) |
2929 ^ (selection size == 1 and:[self isInSelection:1]) |
|
2930 ! ! |
|
2931 |
|
2932 !UIPainter::TreeView methodsFor:'seraching'! |
|
2933 |
|
2934 detectItemRespondsToView:aView |
|
2935 "detect the item responding to the view. The item of the view or the first |
|
2936 subview providing the item is returned. If no property is detected nil is |
|
2937 returned |
|
2938 " |
|
2939 |view item| |
|
2940 |
|
2941 (view := aView) notNil ifTrue:[ |
|
2942 [(item := self itemOfView:view) isNil] whileTrue:[ |
|
2943 (view := view superView) isNil ifTrue:[^ listOfNodes at:1] |
|
2944 ]. |
|
2945 ]. |
|
2946 ^ item |
|
2947 |
2800 ! ! |
2948 ! ! |
2801 |
2949 |
2802 !UIPainter::TreeView methodsFor:'user interactions'! |
2950 !UIPainter::TreeView methodsFor:'user interactions'! |
2803 |
2951 |
2804 doStepIn |
2952 doStepIn |
2835 ! |
2983 ! |
2836 |
2984 |
2837 doStepOver:anIndex |
2985 doStepOver:anIndex |
2838 "move child 'anOffset' forward or backward in list of children |
2986 "move child 'anOffset' forward or backward in list of children |
2839 " |
2987 " |
2840 |item idx size prnt spVw view| |
2988 |item idx size prnt spVw view canvas| |
2841 |
2989 |
2842 ( (item := self selectedNode) isNil |
2990 ( (item := self selectedNode) isNil |
2843 or:[(prnt := item parent) isNil |
2991 or:[(prnt := item parent) isNil |
2844 or:[(size := prnt children size) < 2]] |
2992 or:[(size := prnt children size) < 2 |
2845 ) ifFalse:[ |
2993 or:[(idx := prnt indexOfChild:item) == 0]]] |
2846 idx := prnt indexOfChild:item. |
2994 ) ifTrue:[ |
2847 |
2995 ^ self |
2848 model removeDependent:self. |
2996 ]. |
2849 model removeSelection. |
2997 model removeDependent:self. |
2850 selection := nil. |
2998 model removeSelection. |
2851 model addDependent:self. |
2999 selection := nil. |
2852 idx := idx + anIndex. |
3000 model addDependent:self. |
2853 |
3001 idx := idx + anIndex. |
2854 idx < 1 ifTrue:[idx := size] |
3002 |
2855 ifFalse:[idx > size ifTrue:[idx := 1]]. |
3003 idx < 1 ifTrue:[idx := size] |
2856 |
3004 ifFalse:[idx > size ifTrue:[idx := 1]]. |
2857 model add:item beforeIndex:idx below:prnt. |
3005 |
2858 idx := prnt indexOfChild:item. |
3006 model add:item beforeIndex:idx below:prnt. |
2859 view := item contents view. |
3007 idx := prnt indexOfChild:item. |
2860 spVw := view superView. |
3008 view := item contents view. |
2861 |
3009 spVw := prnt contents view. |
2862 "/ input view might by contained in sequence |
3010 canvas := self canvas. |
2863 ((size := self canvas findInputViewIn:spVw) ~~ 0 and:[idx >= size]) ifTrue:[ |
3011 |
2864 idx := idx + 1 |
3012 canvas hideSelection. |
2865 ]. |
3013 |
2866 spVw changeSequenceOrderFor:view to:idx. |
3014 "/ input view might by contained in sequence |
2867 |
3015 ((size := canvas findInputViewIn:spVw) ~~ 0 and:[idx >= size]) ifTrue:[ |
2868 spVw specClass isLayoutContainer ifFalse:[ |
3016 idx := idx + 1 |
2869 spVw subViews do:[:v| v raise ]. |
3017 ]. |
2870 self canvas inputView raise |
3018 spVw changeSequenceOrderFor:view to:idx. |
2871 ]. |
3019 |
2872 self selectNode:item. |
3020 spVw specClass isLayoutContainer ifFalse:[ |
2873 ] |
3021 spVw subViews do:[:v| v raise ]. |
|
3022 canvas inputView raise |
|
3023 ]. |
|
3024 canvas showSelection. |
|
3025 self selectNode:item. |
2874 ! ! |
3026 ! ! |
2875 |
3027 |
2876 !UIPainter class methodsFor:'documentation'! |
3028 !UIPainter class methodsFor:'documentation'! |
2877 |
3029 |
2878 version |
3030 version |