UISpecificationTool.st
changeset 1315 8722cfe3cce1
parent 1313 95ef9b917d82
child 1320 9c9600432a09
equal deleted inserted replaced
1314:f22b28597a05 1315:8722cfe3cce1
   696          
   696          
   697         )
   697         )
   698       )
   698       )
   699 ! !
   699 ! !
   700 
   700 
   701 !UISpecificationTool methodsFor:'accessing'!
   701 !UISpecificationTool methodsFor:'accessing channels'!
   702 
   702 
   703 acceptChannel
   703 modifiedHolder:aValueHolder
   704     "return the value of the instance variable 'acceptChannel' (automatically generated)"
   704     "set the value holder set to true in case of modifying attributes
   705 
   705     "
   706     ^ masterApplication acceptChannel
   706 
   707 !
   707     modifiedHolder removeDependent:self.
       
   708 
       
   709     (modifiedHolder := aValueHolder) notNil ifTrue:[
       
   710         modifiedHolder addDependent:self.
       
   711     ].
       
   712 
       
   713 ! !
       
   714 
       
   715 !UISpecificationTool methodsFor:'accessing specification'!
   708 
   716 
   709 specification
   717 specification
   710     "gets current edit specification
   718     "gets current edit specification
   711     "
   719     "
   712     ^ specification
   720     ^ specification
   715 !
   723 !
   716 
   724 
   717 specification:aSpec
   725 specification:aSpec
   718     "sets current edit specification
   726     "sets current edit specification
   719     "
   727     "
   720     aSpec isNil ifTrue:[
   728     aSpec notNil ifTrue:[
   721         ^ self specificationChanged
   729         "/ same type of spec - simply change the spec;  no need to setup everything
       
   730         specification class == aSpec class ifTrue:[
       
   731             specification := aSpec.
       
   732             specChannel value:specification.
       
   733           ^ self
       
   734         ]
   722     ].
   735     ].
   723     "/ same type of spec - simply change the spec;  no need to setup everything
   736 
   724 
   737     "/ release resources
   725     specification class == aSpec class ifTrue:[
   738     specChannel release.
   726         specification := aSpec.
   739     aspects     release.
   727       ^ specChannel value:specification.
   740     selection := listOfSpecViews := nil.
       
   741     buildInView destroyAllSubSpecs.
       
   742 
       
   743     (specification := aSpec) isNil ifTrue:[
       
   744         aspects := specChannel := nil.
       
   745       ^ self
   728     ].
   746     ].
   729     self specificationChanged.
       
   730     specification := aSpec.
       
   731     
   747     
   732     "/ some tricky specs need the builder during the addBindings phase.
   748     "/ some tricky specs need the builder during the addBindings phase.
   733     "/ This is passed down in a special UIBindingsDictionary
   749     "/ This is passed down in a special UIBindingsDictionary
   734     "/ (remain backward compatible)
   750     "/ (remain backward compatible)
   735 
   751 
   744     "/ arrange for being notified, if any aspect changes
   760     "/ arrange for being notified, if any aspect changes
   745     aspects do:[:el| el addDependent:self ].
   761     aspects do:[:el| el addDependent:self ].
   746 
   762 
   747 ! !
   763 ! !
   748 
   764 
   749 !UISpecificationTool methodsFor:'accessing channels'!
       
   750 
       
   751 modifiedHolder:aValueHolder
       
   752     "set the value holder set to true in case of modifying attributes
       
   753     "
       
   754 
       
   755     modifiedHolder removeDependent:self.
       
   756 
       
   757     (modifiedHolder := aValueHolder) notNil ifTrue:[
       
   758         modifiedHolder addDependent:self.
       
   759     ].
       
   760 
       
   761 ! !
       
   762 
       
   763 !UISpecificationTool methodsFor:'actions'!
   765 !UISpecificationTool methodsFor:'actions'!
   764 
   766 
   765 setMaxExtent
   767 setMaxExtent
   766     "set the windows maxExtent from its current extent"
   768     "set the windows maxExtent from its current extent"
   767 
   769 
   789     "Modified: / 29.10.1997 / 18:28:53 / cg"
   791     "Modified: / 29.10.1997 / 18:28:53 / cg"
   790 ! !
   792 ! !
   791 
   793 
   792 !UISpecificationTool methodsFor:'bindings'!
   794 !UISpecificationTool methodsFor:'bindings'!
   793 
   795 
       
   796 acceptChannel
       
   797     "return the value of the instance variable 'acceptChannel' (automatically generated)"
       
   798 
       
   799     ^ masterApplication acceptChannel
       
   800 !
       
   801 
   794 aspectFor:aKey
   802 aspectFor:aKey
   795     "returns aspect for a key or nil
   803     "returns aspect for a key or nil
   796     "
   804     "
   797     aspects notNil ifTrue:[
   805     aspects notNil ifTrue:[
   798         ^ aspects at:aKey ifAbsent:nil
   806         ^ aspects at:aKey ifAbsent:nil
   800     ^ super aspectFor:aKey
   808     ^ super aspectFor:aKey
   801 
   809 
   802 !
   810 !
   803 
   811 
   804 buildInView
   812 buildInView
   805 
       
   806     buildInView isNil ifTrue:[
       
   807         buildInView := BuildInView new.
       
   808     ].
       
   809     ^ buildInView
   813     ^ buildInView
   810 !
       
   811 
       
   812 specificationChanged
       
   813 
       
   814     specChannel notNil ifTrue:[
       
   815         specChannel release.
       
   816         specChannel := nil.
       
   817     ].
       
   818     aspects notNil ifTrue:[
       
   819         aspects release.
       
   820         aspects := nil.
       
   821     ].
       
   822     selection     := nil.
       
   823     specification := nil.
       
   824 
       
   825     listOfSpecViews notNil ifTrue:[
       
   826         self buildInView scrolledView:nil.
       
   827 
       
   828         listOfSpecViews do:[:aView|
       
   829             aView notNil ifTrue:[
       
   830                 aView destroy
       
   831             ]
       
   832         ].
       
   833         listOfSpecViews := nil.
       
   834     ].
       
   835 !
   814 !
   836 
   815 
   837 specificationFor:aKey
   816 specificationFor:aKey
   838     "this is called if our current specification contains 
   817     "this is called if our current specification contains 
   839      subspecifications or subcanvases.
   818      subspecifications or subcanvases.
   866 
   845 
   867         modifiedHolder value:true
   846         modifiedHolder value:true
   868     ]
   847     ]
   869 
   848 
   870     "Modified: / 16.7.1998 / 19:25:59 / cg"
   849     "Modified: / 16.7.1998 / 19:25:59 / cg"
       
   850 ! !
       
   851 
       
   852 !UISpecificationTool methodsFor:'initialization'!
       
   853 
       
   854 initialize
       
   855     super initialize.
       
   856     buildInView := BuildInView new.
   871 ! !
   857 ! !
   872 
   858 
   873 !UISpecificationTool methodsFor:'selection'!
   859 !UISpecificationTool methodsFor:'selection'!
   874 
   860 
   875 selection:something
   861 selection:something
   896             window isNil ifTrue:[
   882             window isNil ifTrue:[
   897                 builder buildFromSpec:spec in:(window := SimpleView new).
   883                 builder buildFromSpec:spec in:(window := SimpleView new).
   898                 listOfSpecViews at:index put:window.
   884                 listOfSpecViews at:index put:window.
   899             ].
   885             ].
   900         ].
   886         ].
   901         self buildInView scrolledView:window.
   887         buildInView scrolledView:window.
   902     ].
   888     ].
   903 ! !
   889 ! !
   904 
   890 
   905 !UISpecificationTool::BuildInView methodsFor:'accessing'!
   891 !UISpecificationTool::BuildInView methodsFor:'accessing'!
       
   892 
       
   893 destroyAllSubSpecs
       
   894     "destroy all subViews which represents a specification
       
   895     "
       
   896     outerFrame destroySubViews.
       
   897 
       
   898     scrolledView notNil ifTrue:[
       
   899         scrolledView := nil.
       
   900         self sizeChanged:nil.
       
   901     ]
       
   902 
       
   903 
       
   904 !
   906 
   905 
   907 scrolledView:aView
   906 scrolledView:aView
   908     "set the view to be scrolled"
   907     "set the view to be scrolled"
   909     |scr|
   908     |scr|
   910 
   909 
   911     scrolledView == aView ifTrue:[^ self].
   910     scrolledView == aView ifTrue:[^ self].
   912 
       
   913     outerFrame isNil ifTrue:[
       
   914         outerFrame := SimpleView origin:0.0@0.0 corner:1.0@1.0 in:self.
       
   915         outerFrame borderWidth:0; level:0.
       
   916         realized ifTrue:[outerFrame realize].
       
   917     ].
       
   918 
   911 
   919     scrolledView notNil ifTrue:[scrolledView unmap].
   912     scrolledView notNil ifTrue:[scrolledView unmap].
   920 
   913 
   921     (scrolledView := aView) isNil ifTrue:[
   914     (scrolledView := aView) isNil ifTrue:[
   922         ^ self
   915         ^ self
   942 
   935 
   943 ! !
   936 ! !
   944 
   937 
   945 !UISpecificationTool::BuildInView methodsFor:'initialization'!
   938 !UISpecificationTool::BuildInView methodsFor:'initialization'!
   946 
   939 
       
   940 initialize
       
   941     super initialize.
       
   942     outerFrame := SimpleView origin:0.0@0.0 corner:1.0@1.0 in:self.
       
   943     outerFrame borderWidth:0; level:0.
       
   944 
       
   945 
       
   946 !
       
   947 
   947 level:aLevel
   948 level:aLevel
   948     super level:0
   949     super level:0
   949 !
   950 !
   950 
   951 
   951 realize
   952 realize
       
   953 
   952     super realize.
   954     super realize.
   953     superView notNil ifTrue:[superView level:0].
   955     superView notNil ifTrue:[superView level:0].
   954 ! !
   956 ! !
   955 
   957 
   956 !UISpecificationTool class methodsFor:'documentation'!
   958 !UISpecificationTool class methodsFor:'documentation'!