648 ! ! |
655 ! ! |
649 |
656 |
650 !UISpecificationTool class methodsFor:'interface specs'! |
657 !UISpecificationTool class methodsFor:'interface specs'! |
651 |
658 |
652 windowSpec |
659 windowSpec |
653 "this window spec was automatically generated by the ST/X UIPainter" |
660 "This resource specification was automatically generated |
654 |
661 by the UIPainter of ST/X." |
655 "do not manually edit this - the painter/builder may not be able to |
662 |
656 handle the specification if its corrupted." |
663 "Do not manually edit this!! If it is corrupted, |
|
664 the UIPainter may not be able to read the specification." |
657 |
665 |
658 " |
666 " |
659 UIPainter new openOnClass:UISpecificationTool andSelector:#windowSpec |
667 UIPainter new openOnClass:UISpecificationTool andSelector:#windowSpec |
660 UISpecificationTool new openInterface:#windowSpec |
668 UISpecificationTool new openInterface:#windowSpec |
661 " |
669 UISpecificationTool open |
662 "UISpecificationTool open" |
670 " |
663 |
671 |
664 <resource: #canvas> |
672 <resource: #canvas> |
665 |
673 |
666 ^ |
674 ^ |
667 |
675 #(#FullSpec |
668 #(#FullSpec |
676 #name: #windowSpec |
669 #'window:' |
677 #window: |
670 #(#WindowSpec |
678 #(#WindowSpec |
671 #'name:' 'uIPainterView' |
679 #label: 'unnamed canvas' |
672 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
680 #name: 'unnamed canvas' |
673 #'label:' 'unnamed canvas' |
681 #bounds: #(#Rectangle 30 217 330 517) |
674 #'bounds:' #(#Rectangle 0 0 300 300) |
682 ) |
675 ) |
683 #component: |
676 #'component:' |
684 #(#SpecCollection |
677 #(#SpecCollection |
685 #collection: #( |
678 #'collection:' |
686 #(#ArbitraryComponentSpec |
679 #( |
687 #name: 'ArbitraryComponent1' |
680 #(#ViewSpec |
688 #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
681 #'name:' 'Frame' |
689 #hasBorder: false |
682 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
690 #component: #buildInViewTop |
683 ) |
691 ) |
684 ) |
692 ) |
685 ) |
693 |
|
694 ) |
686 ) |
695 ) |
687 ! ! |
696 ! ! |
688 |
697 |
689 !UISpecificationTool methodsFor:'accessing'! |
698 !UISpecificationTool methodsFor:'accessing'! |
690 |
699 |
703 ! |
712 ! |
704 |
713 |
705 specification:aSpec |
714 specification:aSpec |
706 "sets current edit specification |
715 "sets current edit specification |
707 " |
716 " |
708 self releaseResources. |
|
709 |
|
710 aSpec isNil ifTrue:[ |
717 aSpec isNil ifTrue:[ |
711 specChannel notNil ifTrue:[ specChannel release ]. |
718 ^ self specificationChanged |
712 aspects notNil ifTrue:[ aspects release ]. |
719 ]. |
713 |
720 "/ same type of spec - simply change the spec; no need to setup everything |
714 specChannel := nil. |
721 |
715 specification := nil. |
722 specification class == aSpec class ifTrue:[ |
716 aspects := nil. |
723 specification := aSpec. |
717 ] ifFalse:[ |
724 ^ specChannel value:specification. |
718 "/ same type of spec - simply change the spec; |
725 ]. |
719 "/ no need to setup everything |
726 self specificationChanged. |
720 |
727 specification := aSpec. |
721 specification class == aSpec class ifTrue:[ |
728 |
722 specification := aSpec. |
729 "/ some tricky specs need the builder during the addBindings phase. |
723 ^ specChannel value:specification. |
730 "/ This is passed down in a special UIBindingsDictionary |
724 ]. |
731 "/ (remain backward compatible) |
725 |
732 |
726 specChannel notNil ifTrue:[ specChannel release ]. |
733 aspects := UISpecification newBindingsDictionary. |
727 aspects notNil ifTrue:[ aspects release ]. |
734 aspects builder:builder. |
728 |
735 aspects at:#modifiedChannel put:modifiedHolder. |
729 specification := aSpec. |
736 aspects at:#acceptChannel put:self acceptChannel. |
730 |
737 |
731 "/ some tricky specs need the builder |
738 specChannel := specification asValue. |
732 "/ during the addBindings phase. |
739 specification class addBindingsTo:aspects for:specification channel:specChannel. |
733 "/ This is passed down in a special UIBindingsDictionary |
740 |
734 "/ (remain backward compatible) |
741 "/ arrange for being notified, if any aspect changes |
735 |
742 aspects do:[:el| el addDependent:self ]. |
736 aspects := UISpecification newBindingsDictionary. |
743 |
737 aspects builder:builder. |
|
738 aspects at:#modifiedChannel put:modifiedHolder. |
|
739 aspects at:#acceptChannel put:self acceptChannel. |
|
740 |
|
741 specChannel := specification asValue. |
|
742 specification class addBindingsTo:aspects for:specification channel:specChannel. |
|
743 |
|
744 "/ arrange for being notified, if any aspect changes |
|
745 aspects do:[:el| el addDependent:self ]. |
|
746 ]. |
|
747 |
|
748 selection notNil ifTrue:[ |
|
749 self clearScrolledView. |
|
750 selection := nil. |
|
751 ]. |
|
752 |
|
753 "Modified: / 16.7.1998 / 19:39:42 / cg" |
|
754 ! ! |
744 ! ! |
755 |
745 |
756 !UISpecificationTool methodsFor:'accessing channels'! |
746 !UISpecificationTool methodsFor:'accessing channels'! |
757 |
747 |
758 modifiedHolder:aValueHolder |
748 modifiedHolder:aValueHolder |
759 "set the value holder set to true in case of modifying attributes |
749 "set the value holder set to true in case of modifying attributes |
760 " |
750 " |
761 |
751 |
762 modifiedHolder notNil ifTrue:[ |
752 modifiedHolder removeDependent:self. |
763 modifiedHolder removeDependent:self. |
|
764 ]. |
|
765 |
753 |
766 (modifiedHolder := aValueHolder) notNil ifTrue:[ |
754 (modifiedHolder := aValueHolder) notNil ifTrue:[ |
767 modifiedHolder addDependent:self. |
755 modifiedHolder addDependent:self. |
768 ]. |
756 ]. |
769 |
757 |
808 ]. |
796 ]. |
809 ^ super aspectFor:aKey |
797 ^ super aspectFor:aKey |
810 |
798 |
811 ! |
799 ! |
812 |
800 |
813 releaseResources |
801 buildInViewTop |
814 "release resources |
802 ^ buildInView superView |
815 " |
803 |
816 |frame appl| |
804 |
817 |
805 ! |
818 builder notNil ifTrue:[ |
806 |
819 frame := self windowFrame. |
807 specificationChanged |
820 appl := builder application. |
808 |
821 builder application:appl. |
809 specChannel notNil ifTrue:[ |
822 builder componentAt:#Frame put:frame. |
810 specChannel release. |
823 ]. |
811 specChannel := nil. |
824 |
812 ]. |
825 "Modified: / 20.6.1998 / 15:45:20 / cg" |
813 aspects notNil ifTrue:[ |
|
814 aspects release. |
|
815 aspects := nil. |
|
816 ]. |
|
817 selection := nil. |
|
818 specification := nil. |
|
819 |
|
820 listOfSpecViews notNil ifTrue:[ |
|
821 buildInView scrolledView:nil. |
|
822 |
|
823 listOfSpecViews do:[:aView| |
|
824 aView notNil ifTrue:[ |
|
825 aView destroy |
|
826 ] |
|
827 ]. |
|
828 listOfSpecViews := nil. |
|
829 ]. |
826 ! |
830 ! |
827 |
831 |
828 specificationFor:aKey |
832 specificationFor:aKey |
829 "this is called if our current specification contains |
833 "this is called if our current specification contains |
830 subspecifications or subcanvases. |
834 subspecifications or subcanvases. |
831 Get the subspecification from the current specification" |
835 Get the subspecification from the current specification" |
832 |
836 |
833 |cls| |
837 specification notNil ifTrue:[ |
834 |
838 ^ specification class perform:aKey ifNotUnderstood:nil |
835 cls := specification class. |
|
836 (cls respondsTo:aKey) ifTrue:[ |
|
837 ^ cls perform:aKey |
|
838 ]. |
839 ]. |
839 ^ nil |
840 ^ nil |
840 |
|
841 "Created: / 4.2.1998 / 23:52:39 / stefan" |
|
842 "Modified: / 4.2.1998 / 23:58:23 / stefan" |
|
843 ! ! |
841 ! ! |
844 |
842 |
845 !UISpecificationTool methodsFor:'change & update'! |
843 !UISpecificationTool methodsFor:'change & update'! |
846 |
844 |
847 update |
845 update |
865 ] |
863 ] |
866 |
864 |
867 "Modified: / 16.7.1998 / 19:25:59 / cg" |
865 "Modified: / 16.7.1998 / 19:25:59 / cg" |
868 ! ! |
866 ! ! |
869 |
867 |
|
868 !UISpecificationTool methodsFor:'initialization'! |
|
869 |
|
870 initialize |
|
871 |view| |
|
872 |
|
873 super initialize. |
|
874 view := ScrollableView for:BuildInView. |
|
875 view verticalScrollable:true. |
|
876 view verticalMini:true. |
|
877 view autoHideScrollBars:true. |
|
878 view level:0. |
|
879 buildInView := view scrolledView. |
|
880 ! ! |
|
881 |
870 !UISpecificationTool methodsFor:'selection'! |
882 !UISpecificationTool methodsFor:'selection'! |
871 |
883 |
872 selection:something |
884 selection:something |
873 "selection changed |
885 "selection changed |
874 " |
886 " |
875 |slices idx spec window| |
887 |slices index spec window| |
876 |
888 |
877 specification notNil ifTrue:[ |
889 specification notNil ifTrue:[ |
878 slices := specification class slices. |
890 slices := specification class slices. |
879 idx:= slices findFirst:[:aSlice| aSlice first = something ]. |
891 index := slices findFirst:[:aSlice| aSlice first = something ]. |
880 |
892 |
881 idx ~~ 0 ifTrue:[ |
893 index ~~ 0 ifTrue:[ |
882 spec := specification class perform:((slices at:idx) last). |
894 spec := specification class perform:((slices at:index) last) |
883 ] |
895 ] |
884 ]. |
896 ]. |
885 |
897 |
886 spec ~= selection ifTrue:[ |
898 spec ~= selection ifTrue:[ |
887 self releaseResources. |
899 (selection := spec) notNil ifTrue:[ |
888 self clearScrolledView. |
900 listOfSpecViews isNil ifTrue:[ |
889 |
901 listOfSpecViews := Array new:(slices size). |
890 window := self scrolledView scrolledView. |
902 ] ifFalse:[ |
891 |
903 window := listOfSpecViews at:index |
892 spec notNil ifTrue:[ |
904 ]. |
893 builder buildFromSpec:spec in:window. |
905 window isNil ifTrue:[ |
894 |
906 builder buildFromSpec:spec in:(window := SimpleView new). |
895 window allViewBackground:(self windowFrame viewBackground). |
907 listOfSpecViews at:index put:window. |
896 window extent:1.0@(window preferredExtent y). |
908 ]. |
897 window realizeAllSubViews. |
909 ]. |
898 self scrolledView sizeChanged:nil. |
910 buildInView scrolledView:window. |
899 ] |
911 ]. |
900 ]. |
912 ! ! |
901 selection := spec. |
913 |
902 ! ! |
914 !UISpecificationTool::BuildInView methodsFor:'accessing'! |
903 |
915 |
904 !UISpecificationTool methodsFor:'spec. window'! |
916 scrolledView:aView |
905 |
917 "set the view to be scrolled" |
906 clearScrolledView |
918 |scr| |
907 |
919 |
908 scrolledView isNil ifFalse:[ |
920 scrolledView == aView ifTrue:[^ self]. |
909 scrolledView scrolledView destroySubViews. |
921 |
910 ] |
922 outerFrame isNil ifTrue:[ |
911 ! |
923 self level:0. |
912 |
924 outerFrame := SimpleView origin:0.0@0.0 corner:1.0@1.0 in:self. |
913 scrolledView |
925 realized ifTrue:[outerFrame realize]. |
914 |frame vscroller| |
926 ]. |
915 |
927 |
916 scrolledView isNil ifTrue:[ |
928 scrolledView notNil ifTrue:[scrolledView unmap]. |
917 frame := self windowFrame. |
929 |
918 vscroller := ScrollableView for:ViewScroller origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:frame. |
930 (scrolledView := aView) isNil ifTrue:[ |
919 vscroller verticalScrollable:true. |
931 ^ self |
920 vscroller verticalMini:true. |
932 ]. |
921 vscroller autoHideScrollBars:true. |
933 |
922 scrolledView := vscroller scrolledView. |
934 scrolledView superView == outerFrame ifFalse:[ |
923 scrolledView scrolledView:View new. |
935 scrolledView borderWidth:0; level:0. |
924 frame realizeAllSubViews. |
936 |
925 frame sizeChanged:nil. |
937 outerFrame addSubView:scrolledView. |
926 |
938 scrolledView origin:0@0 corner:1.0 @ (scrolledView preferredExtent y). |
927 "/ we dont want any 3D effect for the scrolled view. |
939 scrolledView := scrolledView. |
928 "/ must change the slaveViews level late, after realization. |
940 scrolledView allViewBackground:(self viewBackground). |
929 "/ (scrolledView has its own idea, changing the level of |
941 ]. |
930 "/ the scrolled view. |
942 |
931 scrolledView level:0. |
943 realized ifTrue:[ |
932 ]. |
944 scrolledView realize. |
933 ^ scrolledView |
945 self sizeChanged:nil. |
934 |
946 ]. |
935 "Modified: / 21.5.1998 / 00:59:05 / cg" |
947 |
936 ! |
948 |
937 |
949 |
938 windowFrame |
950 |
939 windowFrame isNil ifTrue:[ |
951 |
940 windowFrame := builder componentAt:#Frame |
|
941 ]. |
|
942 ^ windowFrame. |
|
943 ! ! |
952 ! ! |
944 |
953 |
945 !UISpecificationTool class methodsFor:'documentation'! |
954 !UISpecificationTool class methodsFor:'documentation'! |
946 |
955 |
947 version |
956 version |