UISpecificationTool.st
changeset 759 f0c325edcc6c
parent 752 2dc82cdfdd90
child 780 96270af95475
equal deleted inserted replaced
758:1370f99f4c09 759:f0c325edcc6c
    12 
    12 
    13 
    13 
    14 
    14 
    15 
    15 
    16 ApplicationModel subclass:#UISpecificationTool
    16 ApplicationModel subclass:#UISpecificationTool
    17 	instanceVariableNames:'modifiedHolder aspects specification selection specChannel'
    17 	instanceVariableNames:'modifiedHolder aspects specification selection specChannel
       
    18 		scrolledView windowFrame'
    18 	classVariableNames:''
    19 	classVariableNames:''
    19 	poolDictionaries:''
    20 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    21 	category:'Interface-UIPainter'
    21 !
    22 !
    22 
    23 
   561         specification class addBindingsTo:aspects for:specification channel:specChannel.
   562         specification class addBindingsTo:aspects for:specification channel:specChannel.
   562         aspects do:[:el| el addDependent:self ].
   563         aspects do:[:el| el addDependent:self ].
   563     ].
   564     ].
   564 
   565 
   565     selection notNil ifTrue:[
   566     selection notNil ifTrue:[
   566         (builder componentAt:#Frame) destroySubViews.
   567         self clearScrolledView.
   567         selection := nil.
   568         selection := nil.
   568     ].
   569     ].
   569 
   570 
   570     "Modified: / 30.1.1998 / 13:50:51 / cg"
   571     "Modified: / 30.1.1998 / 13:50:51 / cg"
   571 ! !
   572 ! !
   627 !
   628 !
   628 
   629 
   629 releaseResources
   630 releaseResources
   630     "release resources
   631     "release resources
   631     "
   632     "
   632     |frame appl|
   633     |frame appl view vscroller|
   633 
   634 
   634     frame := builder componentAt:#Frame.
   635     frame := self windowFrame.
   635     appl  := builder application.
   636     appl  := builder application.
   636     builder := UIBuilder new.
   637     builder := UIBuilder new.
   637     builder application:appl.
   638     builder application:appl.
   638     builder componentAt:#Frame put:frame.
   639     builder componentAt:#Frame put:frame.
   639 
       
   640 !
   640 !
   641 
   641 
   642 specificationFor:aKey
   642 specificationFor:aKey
   643     "this is called if our current specification contains 
   643     "this is called if our current specification contains 
   644      subspecifications or subcanvases.
   644      subspecifications or subcanvases.
   683 !UISpecificationTool methodsFor:'selection'!
   683 !UISpecificationTool methodsFor:'selection'!
   684 
   684 
   685 selection:something
   685 selection:something
   686     "selection changed
   686     "selection changed
   687     "
   687     "
   688     |slices idx spec frame|
   688     |slices idx spec frame y window|
   689 
   689 
   690     specification notNil ifTrue:[
   690     specification notNil ifTrue:[
   691         slices := specification class slices.
   691         slices := specification class slices.
   692         idx:= slices findFirst:[:aSlice| aSlice first = something ].
   692         idx:= slices findFirst:[:aSlice| aSlice first = something ].
   693 
   693 
   695             spec := specification class perform:((slices at:idx) last).
   695             spec := specification class perform:((slices at:idx) last).
   696         ]
   696         ]
   697     ].
   697     ].
   698 
   698 
   699     spec ~= selection ifTrue:[
   699     spec ~= selection ifTrue:[
   700 
       
   701         self releaseResources.
   700         self releaseResources.
   702         frame := builder componentAt:#Frame.
   701         self clearScrolledView.
   703         frame destroySubViews.
   702 
       
   703         window  := self scrolledView scrolledView.
   704 
   704 
   705         spec notNil ifTrue:[
   705         spec notNil ifTrue:[
   706             builder buildFromSpec:spec in:frame.
   706             builder buildFromSpec:spec in:window.
   707             frame allViewBackground:(frame viewBackground).
   707 
       
   708             window allViewBackground:(self windowFrame viewBackground).
       
   709             window extent:1.0@(window preferredExtent y).
   708             masterApplication updateFonts.
   710             masterApplication updateFonts.
   709             frame realizeAllSubViews. 
   711             window realizeAllSubViews.
       
   712             self scrolledView sizeChanged:nil.
   710         ]
   713         ]
   711     ].
   714     ].
   712     selection := spec.
   715     selection := spec.
       
   716 ! !
       
   717 
       
   718 !UISpecificationTool methodsFor:'spec. window'!
       
   719 
       
   720 clearScrolledView
       
   721 
       
   722     scrolledView isNil ifFalse:[
       
   723         scrolledView scrolledView destroySubViews.
       
   724     ]
       
   725 !
       
   726 
       
   727 scrolledView
       
   728     |frame vscroller|
       
   729 
       
   730     scrolledView isNil ifTrue:[
       
   731         frame     := self windowFrame.
       
   732         vscroller := ScrollableView for:ViewScroller origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:frame.
       
   733         vscroller verticalScrollable:true.
       
   734         vscroller verticalMini:true.
       
   735         vscroller autoHideScrollBars:true.
       
   736         scrolledView := vscroller scrolledView.
       
   737         scrolledView scrolledView:View new.
       
   738         frame realizeAllSubViews.
       
   739         frame sizeChanged:nil.
       
   740     ].
       
   741     ^ scrolledView
       
   742 !
       
   743 
       
   744 windowFrame
       
   745     windowFrame isNil ifTrue:[
       
   746         windowFrame := builder componentAt:#Frame
       
   747     ].
       
   748     ^ windowFrame.
   713 ! !
   749 ! !
   714 
   750 
   715 !UISpecificationTool class methodsFor:'documentation'!
   751 !UISpecificationTool class methodsFor:'documentation'!
   716 
   752 
   717 version
   753 version