diff -r 1735e40c6825 -r 560a9eb1a5d8 UIPainter.st --- a/UIPainter.st Sat Mar 20 02:28:24 1999 +0100 +++ b/UIPainter.st Sat Mar 20 16:23:19 1999 +0100 @@ -1855,13 +1855,6 @@ ^Icon helpIcon ! -modifiedChannel - "returns a boolean value holder which is set to true if something is modified - and not accepted" - - ^ builder booleanValueAspectFor:#modifiedChannel -! - noteBookView "returns the notebook view; initialize the tools embedded in the notebook" @@ -2156,17 +2149,18 @@ "called by the painter/canvas whenever the property of the current selected widget has changed" - |property| + |property spec| (property := treeView propertySelected) notNil ifTrue:[ - self specTool specification:(property spec copy). - self setViewInLayoutTool:(property view). - self modifiedChannel value:false + spec := property spec copy. + self specTool specification:spec. + self setViewInLayoutTool:(property view) spec:spec. + self modifiedChannel value:false ] ifFalse:[ - self layoutTool layoutView notNil ifTrue:[ - self modifiedChannel value:false. - self treeSelection - ] + self layoutTool layoutView notNil ifTrue:[ + self modifiedChannel value:false. + self treeSelection + ] ] ! @@ -2477,15 +2471,15 @@ "Modified: / 5.2.1998 / 09:44:58 / stefan" ! -setViewInLayoutTool:aView +setViewInLayoutTool:aView spec:aSpec "sets view for layout tool" |type| self painter topView == aView ifTrue:[ - type := #Extent + type := #Extent ]. - self layoutTool layoutView:aView type:type + self layoutTool layoutView:aView type:type spec:aSpec ! @@ -2620,62 +2614,62 @@ |view list spec slices size property tabComponent| self isModified ifTrue:[ - (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[ - self accept - ] + (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[ + self accept + ] ]. treeView isCanvasSelected ifTrue:[ - spec := treeView canvasSpec. - view := self painter topView. + spec := treeView canvasSpec. + view := self painter topView. ] ifFalse:[ - (property := treeView propertySelected) notNil ifTrue:[ - treeView canResizeSelectedWidget ifTrue:[ - view := property view. - ]. - spec := property spec copy. - ] + (property := treeView propertySelected) notNil ifTrue:[ + treeView canResizeSelectedWidget ifTrue:[ + view := property view. + ]. + spec := property spec copy. + ] ]. tabComponent := builder componentAt:#noteBook. - self setViewInLayoutTool:view. + self setViewInLayoutTool:view spec:spec. self specTool specification:spec. spec notNil ifTrue:[ - self helpTool helpKey:(spec activeHelpKey). - slices := spec class slices. - size := slices size. - - view notNil ifTrue:[ - self treeView isCanvasSelected - ifFalse: - [ - list := Array new:(size + 2). - list at:(size + 2) put:(UILayoutTool label). - ] - ifTrue: - [ - list := Array new:(size + 1). - list at:(size + 1) put:(UILayoutTool label). - ]. - ] ifFalse:[ - list := Array new:(size + 1). - ]. - - 1 to:size do:[:i| list at:i put:((slices at:i) first asString)]. - self treeView isCanvasSelected ifFalse: [list at:(size + 1) put:(UIHelpTool label)]. - - self tabList value:list. - self showHelp:spec class name for:self. - tabComponent enabled:true. - - (tabSelection := tabComponent selection) isNil ifTrue:[ - tabComponent setSelection:(tabSelection := list first) - ]. - self raiseTabView + self helpTool helpKey:(spec activeHelpKey). + slices := spec class slices. + size := slices size. + + view notNil ifTrue:[ + self treeView isCanvasSelected + ifFalse: + [ + list := Array new:(size + 2). + list at:(size + 2) put:(UILayoutTool label). + ] + ifTrue: + [ + list := Array new:(size + 1). + list at:(size + 1) put:(UILayoutTool label). + ]. + ] ifFalse:[ + list := Array new:(size + 1). + ]. + + 1 to:size do:[:i| list at:i put:((slices at:i) first asString)]. + self treeView isCanvasSelected ifFalse: [list at:(size + 1) put:(UIHelpTool label)]. + + self tabList value:list. + self showHelp:spec class name for:self. + tabComponent enabled:true. + + (tabSelection := tabComponent selection) isNil ifTrue:[ + tabComponent setSelection:(tabSelection := list first) + ]. + self raiseTabView ] ifFalse:[ - self helpTool helpKey:nil. - tabComponent enabled:false. - self defaultInfoLabel. + self helpTool helpKey:nil. + tabComponent enabled:false. + self defaultInfoLabel. ]. self modifiedChannel value:false. @@ -2929,37 +2923,50 @@ accept "accepts all modifications done to the attributes of the current section" - |painter layout spec layoutTool| + |painter layout spec layoutTool layoutView t| self acceptChannel value:true; value:false. "/ force editFields to accept self modifiedChannel value:false. - modified := true. painter := self painter. + spec := self specTool specification. self isLayoutToolSelected ifTrue:[ layoutTool := self layoutTool. (layout := layoutTool layout) notNil ifTrue:[ layoutTool layoutType == #Extent ifTrue:[ - layoutTool layoutView == painter topView ifTrue:[ - layoutTool layoutView extent:layout + layoutView := layoutTool layoutView. + + layoutView == painter topView ifTrue:[ + layoutView extent:layout ] ifFalse:[ - painter setExtent:layout + spec useDefaultExtent:(layoutTool aspectFor:#useDefaultExtent) value. + spec useDefaultExtent ifTrue:[ + "/ temporarily unfreeze the widgets size + "/ (but remember, the old setting, which is actually + "/ controlled by the resizeForLabel attribute) + t := layoutView sizeFixed. + layoutView sizeFixed:false. + layout := layoutView preferredExtent. + layoutView sizeFixed:t. + ]. + painter setExtent:layout. + painter updateFromSpec:spec. ] ] ifFalse:[ painter setLayout:layout ] ] ] ifFalse:[ - spec := self specTool specification. - self isHelpToolSelected ifTrue:[ self helpTool accept. spec activeHelpKey:self helpTool helpKey. ]. painter updateFromSpec:spec - ] + ]. + + modified := false. ! addWidget: aSpecClass @@ -3001,23 +3008,23 @@ |spec key view| self isModified ifTrue:[ - (spec := self painter specForSelection) notNil ifTrue:[ - key := spec activeHelpKey. - ]. - self helpTool helpKey:key. - - treeView isCanvasSelected ifTrue: [ - spec := treeView canvasSpec. - ]. - self specTool specification:spec. - view := self layoutTool layoutView. - - self setViewInLayoutTool:view. - spec class == DataSetSpec ifTrue:[ - view columnDescriptors:(spec columns) - ]. - self modifiedChannel value:false. - modified := false + (spec := self painter specForSelection) notNil ifTrue:[ + key := spec activeHelpKey. + ]. + self helpTool helpKey:key. + + treeView isCanvasSelected ifTrue: [ + spec := treeView canvasSpec. + ]. + self specTool specification:spec. + view := self layoutTool layoutView. + + self setViewInLayoutTool:view spec:spec. + spec class == DataSetSpec ifTrue:[ + view columnDescriptors:(spec columns) + ]. + self modifiedChannel value:false. + modified := false ] !