--- a/HPanelV.st Tue Jan 27 19:06:10 1998 +0100
+++ b/HPanelV.st Tue Jan 27 21:15:43 1998 +0100
@@ -1105,9 +1105,9 @@
subViews size == 0 ifTrue:[^ self].
extentChanged ifTrue:[
- ext := self computeExtent.
- width := ext x.
- height := ext y.
+ ext := self computeExtent.
+ width := ext x.
+ height := ext y.
].
space := horizontalSpace.
@@ -1121,151 +1121,152 @@
resizeToMaxH := false.
(hL endsWith:'Max') ifTrue:[
- resizeToMaxH := true.
- wEach := maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder].
- hL := (hL copyWithoutLast:3) asSymbol.
+ resizeToMaxH := true.
+ wEach := maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder].
+ hL := (hL copyWithoutLast:3) asSymbol.
].
numChilds == 1 ifTrue:[
- (hL == #leftFit or:[hL == #rightFit]) ifTrue:[
- hL := #fit
- ].
- (hL == #leftSpaceFit or:[hL == #rightSpaceFit]) ifTrue:[
- hL := #fitSpace
- ].
+ (hL == #leftFit or:[hL == #rightFit]) ifTrue:[
+ hL := #fit
+ ].
+ (hL == #leftSpaceFit or:[hL == #rightSpaceFit]) ifTrue:[
+ hL := #fitSpace
+ ].
].
hL == #fitSpace ifTrue:[
- "
- adjust childs extents and set origins.
- Be careful to avoid accumulation of rounding errors
- "
- wEach := (wInside - (numChilds + 1 * space)) / numChilds.
- xpos := space + margin - borderWidth.
+ "
+ adjust childs extents and set origins.
+ Be careful to avoid accumulation of rounding errors
+ "
+ wEach := (wInside - (numChilds + 1 * space)) / numChilds.
+ xpos := space + margin - borderWidth.
] ifFalse:[
- hL == #fit ifTrue:[
- "
- adjust childs extents and set origins.
- Be careful to avoid accumulation of rounding errors
- "
- wEach := (wInside - (numChilds - 1 * space)) / numChilds.
- xpos := margin - borderWidth.
- ] ifFalse:[
- l := hL.
+ hL == #fit ifTrue:[
+ "
+ adjust childs extents and set origins.
+ Be careful to avoid accumulation of rounding errors
+ "
+ wEach := (wInside - (numChilds - 1 * space)) / numChilds.
+ xpos := margin - borderWidth.
+ ] ifFalse:[
+ l := hL.
- "/ adjust - do not include width of last(first) element if doing a fit
- (hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[
- subViews last width:0.
- ].
- (hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[
- subViews first width:0.
- ].
+ "/ adjust - do not include width of last(first) element if doing a fit
+ (hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[
+ subViews last width:0.
+ ].
+ (hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[
+ subViews first width:0.
+ ].
- "
- compute net width needed
- "
- resizeToMaxH ifTrue:[
- sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxWidth + (child borderWidth*2)].
- ] ifFalse:[
- sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child widthIncludingBorder].
- ].
+ "
+ compute net width needed
+ "
+ resizeToMaxH ifTrue:[
+ sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxWidth + (child borderWidth*2)].
+ ] ifFalse:[
+ sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child widthIncludingBorder].
+ ].
- restWidth := width - sumOfWidths.
+ restWidth := width - sumOfWidths.
- ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
- (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
+ ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
+ (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
- "
- compute position of leftmost subview and space between them;
- if they do hardly fit, leave no space between them
- "
- ((sumOfWidths >= (width - m2))
- and:[l ~~ #fixLeftSpace and:[l ~~ #fixLeft]]) ifTrue:[
- xpos := margin.
- space := 0
- ] ifFalse: [
- l == #fixLeftSpace ifTrue:[
- l := #leftSpace
- ] ifFalse:[
- l == #fixLeft ifTrue:[
- l := #left
- ]
- ].
- ((l == #right) or:[l == #rightSpace
- or:[l == #rightFit or:[l == #rightSpaceFit]]]) ifTrue:[
- xpos := restWidth - (space * (numChilds - 1)).
- "
- borderWidth == 0 ifTrue:[
- xpos := xpos + space
- ].
- "
- (l == #rightSpace
- or:[l == #rightSpaceFit]) ifTrue:[
- xpos >= space ifTrue:[
- xpos := xpos - space
- ]
- ].
+ "
+ compute position of leftmost subview and space between them;
+ if they do hardly fit, leave no space between them
+ "
+ ((sumOfWidths >= (width - m2))
+ and:[l ~~ #fixLeftSpace and:[l ~~ #fixLeft]]) ifTrue:[
+ xpos := margin.
+ space := 0
+ ] ifFalse: [
+ l == #fixLeftSpace ifTrue:[
+ l := #leftSpace
+ ] ifFalse:[
+ l == #fixLeft ifTrue:[
+ l := #left
+ ]
+ ].
+ ((l == #right) or:[l == #rightSpace
+ or:[l == #rightFit or:[l == #rightSpaceFit]]]) ifTrue:[
+ xpos := restWidth - (space * (numChilds - 1)).
+"/
+"/ borderWidth == 0 ifTrue:[
+"/ xpos := xpos + space
+"/ ].
+"/
+ (l == #rightSpace
+ or:[l == #rightSpaceFit]) ifTrue:[
+ xpos >= space ifTrue:[
+ xpos := xpos - space
+ ]
+ ].
+ xpos := xpos - margin.
- xpos < 0 ifTrue:[
- space := space min:(restWidth // (numChilds + 1)).
- xpos := restWidth - (space * numChilds).
- ]
- ] ifFalse:[
- (l == #spread) ifTrue:[
- space := (restWidth - m2) // (numChilds - 1).
- xpos := margin.
- (space == 0) ifTrue:[
- xpos := restWidth // 2
- ]
- ] ifFalse:[
- (l == #spreadSpace) ifTrue:[
- space := restWidth // (numChilds + 1).
- xpos := space.
- (space == 0) ifTrue:[
- xpos := restWidth // 2
- ]
- ] ifFalse:[
- ((l == #left) or:[l == #leftSpace
- or:[l == #leftFit or:[l == #leftSpaceFit]]]) ifTrue:[
- space := space min:(restWidth - m2) // (numChilds + 1).
- (hL == #fixLeft or:[hL == #fixLeftSpace]) ifTrue:[
- space := space max:horizontalSpace.
- ] ifFalse:[
- space := space max:0.
- ].
- (l == #leftSpace or:[l == #leftSpaceFit]) ifTrue:[
- xpos := space.
- ] ifFalse:[
- "/
- "/ if the very first view has a 0-level AND
- "/ my level is non-zero, begin with margin
- "/
- (margin ~~ 0 and:[subViews first level == 0]) ifTrue:[
- xpos := margin
- ] ifFalse:[
- xpos := 0
- ]
- ]
- ] ifFalse:[
- "center"
- xpos := (restWidth - ((numChilds - 1) * space)) // 2.
- xpos < 0 ifTrue:[
- space := restWidth // (numChilds + 1).
- xpos := (restWidth - ((numChilds - 1) * space)) // 2.
- ]
- ]
- ]
- ]
- ]
- ].
- ].
+ xpos < 0 ifTrue:[
+ space := space min:(restWidth // (numChilds + 1)).
+ xpos := restWidth - (space * numChilds).
+ ]
+ ] ifFalse:[
+ (l == #spread) ifTrue:[
+ space := (restWidth - m2) // (numChilds - 1).
+ xpos := margin.
+ (space == 0) ifTrue:[
+ xpos := restWidth // 2
+ ]
+ ] ifFalse:[
+ (l == #spreadSpace) ifTrue:[
+ space := (restWidth - m2) // (numChilds + 1).
+ xpos := space + margin.
+ (space == 0) ifTrue:[
+ xpos := restWidth // 2
+ ]
+ ] ifFalse:[
+ ((l == #left) or:[l == #leftSpace
+ or:[l == #leftFit or:[l == #leftSpaceFit]]]) ifTrue:[
+ space := space min:(restWidth - m2) // (numChilds + 1).
+ (hL == #fixLeft or:[hL == #fixLeftSpace]) ifTrue:[
+ space := space max:horizontalSpace.
+ ] ifFalse:[
+ space := space max:0.
+ ].
+ (l == #leftSpace or:[l == #leftSpaceFit]) ifTrue:[
+ xpos := space + margin.
+ ] ifFalse:[
+ "/
+ "/ if the very first view has a 0-level AND
+ "/ my level is non-zero, begin with margin
+ "/
+ true "(margin ~~ 0 and:[subViews first level == 0])" ifTrue:[
+ xpos := margin
+ ] ifFalse:[
+ xpos := 0
+ ]
+ ]
+ ] ifFalse:[
+ "center"
+ xpos := (restWidth - ((numChilds - 1) * space)) // 2.
+ xpos < 0 ifTrue:[
+ space := restWidth // (numChilds + 1).
+ xpos := (restWidth - ((numChilds - 1) * space)) // 2.
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ ].
].
resizeToMaxV := false.
(vL endsWith:'Max') ifTrue:[
- resizeToMaxV := true.
- maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder].
- vL := (vL copyWithoutLast:3) asSymbol.
+ resizeToMaxV := true.
+ maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder].
+ vL := (vL copyWithoutLast:3) asSymbol.
].
"
@@ -1273,101 +1274,108 @@
"
subViews keysAndValuesDo:[:index :child |
- |ypos advance bwChild hChild newHChild|
-
- hChild := child heightIncludingBorder.
- bwChild := child borderWidth.
-
- resizeToMaxV ifTrue:[
- child height:(hChild := maxHeight - (bwChild * 2)).
- ].
+ |ypos advance bwChild hChild newHChild|
- vL == #top ifTrue:[
- ypos := margin
- ] ifFalse:[
- vL == #topSpace ifTrue:[
- ypos := verticalSpace
- ] ifFalse:[
- vL == #bottom ifTrue:[
- ypos := height - margin - child heightIncludingBorder
- ] ifFalse:[
- vL == #bottomSpace ifTrue:[
- ypos := height - verticalSpace - child heightIncludingBorder.
- ] ifFalse:[
- vL == #fitSpace ifTrue:[
- ypos := verticalSpace.
- newHChild := height - (verticalSpace + bwChild * 2)
- ] ifFalse:[
- vL == #fit ifTrue:[
- newHChild := height - (bwChild * 2).
- child level == 0 ifTrue:[
- ypos := margin.
- newHChild := newHChild - m2
- ] ifFalse:[
- ypos := 0.
- ].
- ] ifFalse:[
- "centered"
- ypos := (height - m2 - hChild) // 2.
- ]
- ]
- ]
- ]
- ]
- ].
- newHChild notNil ifTrue:[
- child height:newHChild
- ].
+ hChild := child heightIncludingBorder.
+ bwChild := child borderWidth.
+
+ resizeToMaxV ifTrue:[
+ child height:(hChild := maxHeight - (bwChild * 2)).
+ ].
- (ypos < 0) ifTrue:[ypos := 0].
-
- (hL == #fit
- or:[hL == #fitSpace
- or:[resizeToMaxH]]) ifTrue:[
- child sizeFixed ifTrue:[
- d := wEach - (child widthIncludingBorder) // 2.
- child origin:(xpos truncated + d @ ypos)
- ] ifFalse:[
- child origin:(xpos truncated @ ypos)
- corner:(xpos + wEach - (child borderWidth) - 1) truncated
- @ (ypos + child height - 1).
- ].
- advance := wEach.
- ] ifFalse:[
- child origin:(xpos @ ypos).
- advance := child widthIncludingBorder
- ].
-
- index == numChilds ifTrue:[
- |x|
+ vL == #top ifTrue:[
+ ypos := margin
+ ] ifFalse:[
+ vL == #topSpace ifTrue:[
+ ypos := margin + verticalSpace
+ ] ifFalse:[
+ vL == #bottom ifTrue:[
+ ypos := height - margin - child heightIncludingBorder
+ ] ifFalse:[
+ vL == #bottomSpace ifTrue:[
+ ypos := height - margin
+ - verticalSpace - child heightIncludingBorder.
+ ] ifFalse:[
+ vL == #fitSpace ifTrue:[
+ ypos := verticalSpace.
+ newHChild := height - (verticalSpace + bwChild * 2).
+ ypos := ypos + margin.
+ newHChild := newHChild - m2.
+ ] ifFalse:[
+ vL == #fit ifTrue:[
+ newHChild := height - (bwChild * 2).
+ "/
+ "/ if the view has a 0-level AND
+ "/ my level is non-zero, begin with margin
+ "/
+ true "(level ~~ 0 and:[child level == 0])" ifTrue:[
+ ypos := margin.
+ newHChild := newHChild - m2.
+ ] ifFalse:[
+ ypos := 0.
+ ].
+ ] ifFalse:[
+ "centered"
+ ypos := margin + ((height - m2 - hChild) // 2).
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ newHChild notNil ifTrue:[
+ child height:newHChild
+ ].
- (hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[
- x := width - margin - 1 - (child borderWidth * 2) + borderWidth.
- hL == #leftSpaceFit ifTrue:[
- x := x - space
- ].
- child corner:(x @ (ypos + child height - 1))
- ].
- ].
- index == 1 ifTrue:[
- |x xR|
+ (ypos < 0) ifTrue:[ypos := 0].
+
+ (hL == #fit
+ or:[hL == #fitSpace
+ or:[resizeToMaxH]]) ifTrue:[
+ child sizeFixed ifTrue:[
+ d := wEach - (child widthIncludingBorder) // 2.
+ child origin:(xpos truncated + d @ ypos)
+ ] ifFalse:[
+ child origin:(xpos truncated @ ypos)
+ corner:(xpos + wEach - (child borderWidth) - 1) truncated
+ @ (ypos + child height - 1).
+ ].
+ advance := wEach.
+ ] ifFalse:[
+ child origin:(xpos @ ypos).
+ advance := child widthIncludingBorder
+ ].
+
+ index == numChilds ifTrue:[
+ |x|
- (hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[
- x := 0 + (child borderWidth * 2) - borderWidth.
- hL == #rightSpaceFit ifTrue:[
- x := x + space
- ].
- xR := child corner x.
- child origin:(x @ (child origin y))
- corner:(xR @ (child corner y))
- ].
- ].
+ (hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[
+ x := width - margin - 1 - (child borderWidth * 2) + borderWidth.
+ hL == #leftSpaceFit ifTrue:[
+ x := x - space
+ ].
+ child corner:(x @ (ypos + child height - 1))
+ ].
+ ].
+ index == 1 ifTrue:[
+ |x xR|
- xpos := xpos + advance + space.
+ (hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[
+ x := margin + 0 + (child borderWidth * 2) - borderWidth.
+ hL == #rightSpaceFit ifTrue:[
+ x := x + space
+ ].
+ xR := child corner x.
+ child origin:(x @ (child origin y))
+ corner:(xR @ (child corner y))
+ ].
+ ].
+
+ xpos := xpos + advance + space.
].
"Modified: / 4.9.1995 / 18:43:10 / claus"
- "Modified: / 17.1.1998 / 00:17:33 / cg"
+ "Modified: / 27.1.1998 / 21:03:06 / cg"
! !
!HorizontalPanelView methodsFor:'queries'!
@@ -1452,5 +1460,5 @@
!HorizontalPanelView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Attic/HPanelV.st,v 1.35 1998-01-17 13:49:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Attic/HPanelV.st,v 1.36 1998-01-27 20:15:15 cg Exp $'
! !
--- a/HorizontalPanelView.st Tue Jan 27 19:06:10 1998 +0100
+++ b/HorizontalPanelView.st Tue Jan 27 21:15:43 1998 +0100
@@ -1105,9 +1105,9 @@
subViews size == 0 ifTrue:[^ self].
extentChanged ifTrue:[
- ext := self computeExtent.
- width := ext x.
- height := ext y.
+ ext := self computeExtent.
+ width := ext x.
+ height := ext y.
].
space := horizontalSpace.
@@ -1121,151 +1121,152 @@
resizeToMaxH := false.
(hL endsWith:'Max') ifTrue:[
- resizeToMaxH := true.
- wEach := maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder].
- hL := (hL copyWithoutLast:3) asSymbol.
+ resizeToMaxH := true.
+ wEach := maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder].
+ hL := (hL copyWithoutLast:3) asSymbol.
].
numChilds == 1 ifTrue:[
- (hL == #leftFit or:[hL == #rightFit]) ifTrue:[
- hL := #fit
- ].
- (hL == #leftSpaceFit or:[hL == #rightSpaceFit]) ifTrue:[
- hL := #fitSpace
- ].
+ (hL == #leftFit or:[hL == #rightFit]) ifTrue:[
+ hL := #fit
+ ].
+ (hL == #leftSpaceFit or:[hL == #rightSpaceFit]) ifTrue:[
+ hL := #fitSpace
+ ].
].
hL == #fitSpace ifTrue:[
- "
- adjust childs extents and set origins.
- Be careful to avoid accumulation of rounding errors
- "
- wEach := (wInside - (numChilds + 1 * space)) / numChilds.
- xpos := space + margin - borderWidth.
+ "
+ adjust childs extents and set origins.
+ Be careful to avoid accumulation of rounding errors
+ "
+ wEach := (wInside - (numChilds + 1 * space)) / numChilds.
+ xpos := space + margin - borderWidth.
] ifFalse:[
- hL == #fit ifTrue:[
- "
- adjust childs extents and set origins.
- Be careful to avoid accumulation of rounding errors
- "
- wEach := (wInside - (numChilds - 1 * space)) / numChilds.
- xpos := margin - borderWidth.
- ] ifFalse:[
- l := hL.
+ hL == #fit ifTrue:[
+ "
+ adjust childs extents and set origins.
+ Be careful to avoid accumulation of rounding errors
+ "
+ wEach := (wInside - (numChilds - 1 * space)) / numChilds.
+ xpos := margin - borderWidth.
+ ] ifFalse:[
+ l := hL.
- "/ adjust - do not include width of last(first) element if doing a fit
- (hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[
- subViews last width:0.
- ].
- (hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[
- subViews first width:0.
- ].
+ "/ adjust - do not include width of last(first) element if doing a fit
+ (hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[
+ subViews last width:0.
+ ].
+ (hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[
+ subViews first width:0.
+ ].
- "
- compute net width needed
- "
- resizeToMaxH ifTrue:[
- sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxWidth + (child borderWidth*2)].
- ] ifFalse:[
- sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child widthIncludingBorder].
- ].
+ "
+ compute net width needed
+ "
+ resizeToMaxH ifTrue:[
+ sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxWidth + (child borderWidth*2)].
+ ] ifFalse:[
+ sumOfWidths := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child widthIncludingBorder].
+ ].
- restWidth := width - sumOfWidths.
+ restWidth := width - sumOfWidths.
- ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
- (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
+ ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
+ (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
- "
- compute position of leftmost subview and space between them;
- if they do hardly fit, leave no space between them
- "
- ((sumOfWidths >= (width - m2))
- and:[l ~~ #fixLeftSpace and:[l ~~ #fixLeft]]) ifTrue:[
- xpos := margin.
- space := 0
- ] ifFalse: [
- l == #fixLeftSpace ifTrue:[
- l := #leftSpace
- ] ifFalse:[
- l == #fixLeft ifTrue:[
- l := #left
- ]
- ].
- ((l == #right) or:[l == #rightSpace
- or:[l == #rightFit or:[l == #rightSpaceFit]]]) ifTrue:[
- xpos := restWidth - (space * (numChilds - 1)).
- "
- borderWidth == 0 ifTrue:[
- xpos := xpos + space
- ].
- "
- (l == #rightSpace
- or:[l == #rightSpaceFit]) ifTrue:[
- xpos >= space ifTrue:[
- xpos := xpos - space
- ]
- ].
+ "
+ compute position of leftmost subview and space between them;
+ if they do hardly fit, leave no space between them
+ "
+ ((sumOfWidths >= (width - m2))
+ and:[l ~~ #fixLeftSpace and:[l ~~ #fixLeft]]) ifTrue:[
+ xpos := margin.
+ space := 0
+ ] ifFalse: [
+ l == #fixLeftSpace ifTrue:[
+ l := #leftSpace
+ ] ifFalse:[
+ l == #fixLeft ifTrue:[
+ l := #left
+ ]
+ ].
+ ((l == #right) or:[l == #rightSpace
+ or:[l == #rightFit or:[l == #rightSpaceFit]]]) ifTrue:[
+ xpos := restWidth - (space * (numChilds - 1)).
+"/
+"/ borderWidth == 0 ifTrue:[
+"/ xpos := xpos + space
+"/ ].
+"/
+ (l == #rightSpace
+ or:[l == #rightSpaceFit]) ifTrue:[
+ xpos >= space ifTrue:[
+ xpos := xpos - space
+ ]
+ ].
+ xpos := xpos - margin.
- xpos < 0 ifTrue:[
- space := space min:(restWidth // (numChilds + 1)).
- xpos := restWidth - (space * numChilds).
- ]
- ] ifFalse:[
- (l == #spread) ifTrue:[
- space := (restWidth - m2) // (numChilds - 1).
- xpos := margin.
- (space == 0) ifTrue:[
- xpos := restWidth // 2
- ]
- ] ifFalse:[
- (l == #spreadSpace) ifTrue:[
- space := restWidth // (numChilds + 1).
- xpos := space.
- (space == 0) ifTrue:[
- xpos := restWidth // 2
- ]
- ] ifFalse:[
- ((l == #left) or:[l == #leftSpace
- or:[l == #leftFit or:[l == #leftSpaceFit]]]) ifTrue:[
- space := space min:(restWidth - m2) // (numChilds + 1).
- (hL == #fixLeft or:[hL == #fixLeftSpace]) ifTrue:[
- space := space max:horizontalSpace.
- ] ifFalse:[
- space := space max:0.
- ].
- (l == #leftSpace or:[l == #leftSpaceFit]) ifTrue:[
- xpos := space.
- ] ifFalse:[
- "/
- "/ if the very first view has a 0-level AND
- "/ my level is non-zero, begin with margin
- "/
- (margin ~~ 0 and:[subViews first level == 0]) ifTrue:[
- xpos := margin
- ] ifFalse:[
- xpos := 0
- ]
- ]
- ] ifFalse:[
- "center"
- xpos := (restWidth - ((numChilds - 1) * space)) // 2.
- xpos < 0 ifTrue:[
- space := restWidth // (numChilds + 1).
- xpos := (restWidth - ((numChilds - 1) * space)) // 2.
- ]
- ]
- ]
- ]
- ]
- ].
- ].
+ xpos < 0 ifTrue:[
+ space := space min:(restWidth // (numChilds + 1)).
+ xpos := restWidth - (space * numChilds).
+ ]
+ ] ifFalse:[
+ (l == #spread) ifTrue:[
+ space := (restWidth - m2) // (numChilds - 1).
+ xpos := margin.
+ (space == 0) ifTrue:[
+ xpos := restWidth // 2
+ ]
+ ] ifFalse:[
+ (l == #spreadSpace) ifTrue:[
+ space := (restWidth - m2) // (numChilds + 1).
+ xpos := space + margin.
+ (space == 0) ifTrue:[
+ xpos := restWidth // 2
+ ]
+ ] ifFalse:[
+ ((l == #left) or:[l == #leftSpace
+ or:[l == #leftFit or:[l == #leftSpaceFit]]]) ifTrue:[
+ space := space min:(restWidth - m2) // (numChilds + 1).
+ (hL == #fixLeft or:[hL == #fixLeftSpace]) ifTrue:[
+ space := space max:horizontalSpace.
+ ] ifFalse:[
+ space := space max:0.
+ ].
+ (l == #leftSpace or:[l == #leftSpaceFit]) ifTrue:[
+ xpos := space + margin.
+ ] ifFalse:[
+ "/
+ "/ if the very first view has a 0-level AND
+ "/ my level is non-zero, begin with margin
+ "/
+ true "(margin ~~ 0 and:[subViews first level == 0])" ifTrue:[
+ xpos := margin
+ ] ifFalse:[
+ xpos := 0
+ ]
+ ]
+ ] ifFalse:[
+ "center"
+ xpos := (restWidth - ((numChilds - 1) * space)) // 2.
+ xpos < 0 ifTrue:[
+ space := restWidth // (numChilds + 1).
+ xpos := (restWidth - ((numChilds - 1) * space)) // 2.
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ ].
].
resizeToMaxV := false.
(vL endsWith:'Max') ifTrue:[
- resizeToMaxV := true.
- maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder].
- vL := (vL copyWithoutLast:3) asSymbol.
+ resizeToMaxV := true.
+ maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder].
+ vL := (vL copyWithoutLast:3) asSymbol.
].
"
@@ -1273,101 +1274,108 @@
"
subViews keysAndValuesDo:[:index :child |
- |ypos advance bwChild hChild newHChild|
-
- hChild := child heightIncludingBorder.
- bwChild := child borderWidth.
-
- resizeToMaxV ifTrue:[
- child height:(hChild := maxHeight - (bwChild * 2)).
- ].
+ |ypos advance bwChild hChild newHChild|
- vL == #top ifTrue:[
- ypos := margin
- ] ifFalse:[
- vL == #topSpace ifTrue:[
- ypos := verticalSpace
- ] ifFalse:[
- vL == #bottom ifTrue:[
- ypos := height - margin - child heightIncludingBorder
- ] ifFalse:[
- vL == #bottomSpace ifTrue:[
- ypos := height - verticalSpace - child heightIncludingBorder.
- ] ifFalse:[
- vL == #fitSpace ifTrue:[
- ypos := verticalSpace.
- newHChild := height - (verticalSpace + bwChild * 2)
- ] ifFalse:[
- vL == #fit ifTrue:[
- newHChild := height - (bwChild * 2).
- child level == 0 ifTrue:[
- ypos := margin.
- newHChild := newHChild - m2
- ] ifFalse:[
- ypos := 0.
- ].
- ] ifFalse:[
- "centered"
- ypos := (height - m2 - hChild) // 2.
- ]
- ]
- ]
- ]
- ]
- ].
- newHChild notNil ifTrue:[
- child height:newHChild
- ].
+ hChild := child heightIncludingBorder.
+ bwChild := child borderWidth.
+
+ resizeToMaxV ifTrue:[
+ child height:(hChild := maxHeight - (bwChild * 2)).
+ ].
- (ypos < 0) ifTrue:[ypos := 0].
-
- (hL == #fit
- or:[hL == #fitSpace
- or:[resizeToMaxH]]) ifTrue:[
- child sizeFixed ifTrue:[
- d := wEach - (child widthIncludingBorder) // 2.
- child origin:(xpos truncated + d @ ypos)
- ] ifFalse:[
- child origin:(xpos truncated @ ypos)
- corner:(xpos + wEach - (child borderWidth) - 1) truncated
- @ (ypos + child height - 1).
- ].
- advance := wEach.
- ] ifFalse:[
- child origin:(xpos @ ypos).
- advance := child widthIncludingBorder
- ].
-
- index == numChilds ifTrue:[
- |x|
+ vL == #top ifTrue:[
+ ypos := margin
+ ] ifFalse:[
+ vL == #topSpace ifTrue:[
+ ypos := margin + verticalSpace
+ ] ifFalse:[
+ vL == #bottom ifTrue:[
+ ypos := height - margin - child heightIncludingBorder
+ ] ifFalse:[
+ vL == #bottomSpace ifTrue:[
+ ypos := height - margin
+ - verticalSpace - child heightIncludingBorder.
+ ] ifFalse:[
+ vL == #fitSpace ifTrue:[
+ ypos := verticalSpace.
+ newHChild := height - (verticalSpace + bwChild * 2).
+ ypos := ypos + margin.
+ newHChild := newHChild - m2.
+ ] ifFalse:[
+ vL == #fit ifTrue:[
+ newHChild := height - (bwChild * 2).
+ "/
+ "/ if the view has a 0-level AND
+ "/ my level is non-zero, begin with margin
+ "/
+ true "(level ~~ 0 and:[child level == 0])" ifTrue:[
+ ypos := margin.
+ newHChild := newHChild - m2.
+ ] ifFalse:[
+ ypos := 0.
+ ].
+ ] ifFalse:[
+ "centered"
+ ypos := margin + ((height - m2 - hChild) // 2).
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ newHChild notNil ifTrue:[
+ child height:newHChild
+ ].
- (hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[
- x := width - margin - 1 - (child borderWidth * 2) + borderWidth.
- hL == #leftSpaceFit ifTrue:[
- x := x - space
- ].
- child corner:(x @ (ypos + child height - 1))
- ].
- ].
- index == 1 ifTrue:[
- |x xR|
+ (ypos < 0) ifTrue:[ypos := 0].
+
+ (hL == #fit
+ or:[hL == #fitSpace
+ or:[resizeToMaxH]]) ifTrue:[
+ child sizeFixed ifTrue:[
+ d := wEach - (child widthIncludingBorder) // 2.
+ child origin:(xpos truncated + d @ ypos)
+ ] ifFalse:[
+ child origin:(xpos truncated @ ypos)
+ corner:(xpos + wEach - (child borderWidth) - 1) truncated
+ @ (ypos + child height - 1).
+ ].
+ advance := wEach.
+ ] ifFalse:[
+ child origin:(xpos @ ypos).
+ advance := child widthIncludingBorder
+ ].
+
+ index == numChilds ifTrue:[
+ |x|
- (hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[
- x := 0 + (child borderWidth * 2) - borderWidth.
- hL == #rightSpaceFit ifTrue:[
- x := x + space
- ].
- xR := child corner x.
- child origin:(x @ (child origin y))
- corner:(xR @ (child corner y))
- ].
- ].
+ (hL == #leftFit or:[hL == #leftSpaceFit]) ifTrue:[
+ x := width - margin - 1 - (child borderWidth * 2) + borderWidth.
+ hL == #leftSpaceFit ifTrue:[
+ x := x - space
+ ].
+ child corner:(x @ (ypos + child height - 1))
+ ].
+ ].
+ index == 1 ifTrue:[
+ |x xR|
- xpos := xpos + advance + space.
+ (hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[
+ x := margin + 0 + (child borderWidth * 2) - borderWidth.
+ hL == #rightSpaceFit ifTrue:[
+ x := x + space
+ ].
+ xR := child corner x.
+ child origin:(x @ (child origin y))
+ corner:(xR @ (child corner y))
+ ].
+ ].
+
+ xpos := xpos + advance + space.
].
"Modified: / 4.9.1995 / 18:43:10 / claus"
- "Modified: / 17.1.1998 / 00:17:33 / cg"
+ "Modified: / 27.1.1998 / 21:03:06 / cg"
! !
!HorizontalPanelView methodsFor:'queries'!
@@ -1452,5 +1460,5 @@
!HorizontalPanelView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.35 1998-01-17 13:49:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.36 1998-01-27 20:15:15 cg Exp $'
! !
--- a/VPanelV.st Tue Jan 27 19:06:10 1998 +0100
+++ b/VPanelV.st Tue Jan 27 21:15:43 1998 +0100
@@ -710,9 +710,9 @@
subViews size == 0 ifTrue:[^ self].
extentChanged ifTrue:[
- ext := self computeExtent.
- width := ext x.
- height := ext y.
+ ext := self computeExtent.
+ width := ext x.
+ height := ext y.
].
space := verticalSpace.
@@ -726,255 +726,256 @@
resizeToMaxV := false.
(vL endsWith:'Max') ifTrue:[
- resizeToMaxV := true.
- hEach := maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder].
- vL := (vL copyWithoutLast:3) asSymbol.
+ resizeToMaxV := true.
+ hEach := maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder].
+ vL := (vL copyWithoutLast:3) asSymbol.
].
numChilds == 1 ifTrue:[
- (vL == #topFit or:[vL == #bottomFit]) ifTrue:[
- vL := #fit
- ].
- (vL == #topSpaceFit or:[vL == #bottomSpaceFit]) ifTrue:[
- vL := #fitSpace
- ].
+ (vL == #topFit or:[vL == #bottomFit]) ifTrue:[
+ vL := #fit
+ ].
+ (vL == #topSpaceFit or:[vL == #bottomSpaceFit]) ifTrue:[
+ vL := #fitSpace
+ ].
].
vL == #fitSpace ifTrue:[
- "
- adjust childs extents and set origins.
- Be careful to avoid accumulation of rounding errors
- "
- hEach := (hInside - (numChilds + 1 * space)) / numChilds.
- ypos := space + margin - borderWidth.
+ "
+ adjust childs extents and set origins.
+ Be careful to avoid accumulation of rounding errors
+ "
+ hEach := (hInside - (numChilds + 1 * space)) / numChilds.
+ ypos := space + margin - borderWidth.
] ifFalse:[
- vL == #fit ifTrue:[
- "
- adjust childs extents and set origins.
- Be careful to avoid accumulation of rounding errors
- "
- hEach := (hInside - (numChilds - 1 * space)) / numChilds.
- ypos := margin - borderWidth.
- ] ifFalse:[
- l := vL.
+ vL == #fit ifTrue:[
+ "
+ adjust childs extents and set origins.
+ Be careful to avoid accumulation of rounding errors
+ "
+ hEach := (hInside - (numChilds - 1 * space)) / numChilds.
+ ypos := margin - borderWidth.
+ ] ifFalse:[
+ l := vL.
- "/ adjust - do not include height of last(first) element if doing a fit
- (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
- subViews last height:0.
- ].
- (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
- subViews first height:0.
- ].
+ "/ adjust - do not include height of last(first) element if doing a fit
+ (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
+ subViews last height:0.
+ ].
+ (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
+ subViews first height:0.
+ ].
- "
- compute net height needed
- "
- resizeToMaxV ifTrue:[
- sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxHeight + (child borderWidth*2)].
- ] ifFalse:[
- sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child heightIncludingBorder].
- ].
+ "
+ compute net height needed
+ "
+ resizeToMaxV ifTrue:[
+ sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxHeight + (child borderWidth*2)].
+ ] ifFalse:[
+ sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child heightIncludingBorder].
+ ].
- restHeight := height - sumOfHeights.
+ restHeight := height - sumOfHeights.
- ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
- (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
+ ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
+ (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
- "
- compute position of topmost subview and space between them;
- if they do hardly fit, leave no space between them
- "
- ((sumOfHeights >= (height - m2))
- and:[l ~~ #fixTopSpace and:[l ~~ #fixTop]]) ifTrue:[
- "
- if we have not enough space for all the elements,
- fill them tight, and show what can be shown (at least)
- "
- ypos := margin.
- space := 0
- ] ifFalse:[
- l == #fixTopSpace ifTrue:[
- l := #topSpace
- ] ifFalse:[
- l == #fixTop ifTrue:[
- l := #top
- ]
- ].
- ((l == #bottom) or:[l == #bottomSpace
- or:[l == #bottomFit or:[l == #bottomSpaceFit]]]) ifTrue:[
- ypos := restHeight - (space * (numChilds - 1)).
- "
- borderWidth == 0 ifTrue:[
- ypos := ypos + space
- ].
- "
- (l == #bottomSpace
- or:[l == #bottomSpaceFit]) ifTrue:[
- ypos >= space ifTrue:[
- ypos := ypos - space
- ]
- ].
+ "
+ compute position of topmost subview and space between them;
+ if they do hardly fit, leave no space between them
+ "
+ ((sumOfHeights >= (height - m2))
+ and:[l ~~ #fixTopSpace and:[l ~~ #fixTop]]) ifTrue:[
+ "
+ if we have not enough space for all the elements,
+ fill them tight, and show what can be shown (at least)
+ "
+ ypos := margin.
+ space := 0
+ ] ifFalse:[
+ l == #fixTopSpace ifTrue:[
+ l := #topSpace
+ ] ifFalse:[
+ l == #fixTop ifTrue:[
+ l := #top
+ ]
+ ].
+ ((l == #bottom) or:[l == #bottomSpace
+ or:[l == #bottomFit or:[l == #bottomSpaceFit]]]) ifTrue:[
+ ypos := restHeight - (space * (numChilds - 1)).
+"/
+"/ borderWidth == 0 ifTrue:[
+"/ ypos := ypos + space
+"/ ].
+"/
+ (l == #bottomSpace
+ or:[l == #bottomSpaceFit]) ifTrue:[
+ ypos >= space ifTrue:[
+ ypos := ypos - space
+ ]
+ ].
+ ypos := ypos - margin.
- ypos < 0 ifTrue:[
- space := space min:(restHeight // (numChilds + 1)).
- ypos := restHeight - (space * numChilds).
- ]
- ] ifFalse: [
- (l == #spread) ifTrue:[
- space := (restHeight - m2) // (numChilds - 1).
- ypos := margin.
- (space == 0) ifTrue:[
- ypos := restHeight // 2
- ]
- ] ifFalse: [
- (l == #spreadSpace) ifTrue:[
- space := restHeight // (numChilds + 1).
- ypos := space.
- (space == 0) ifTrue:[
- ypos := restHeight // 2
- ]
- ] ifFalse: [
- ((l == #top) or:[l == #topSpace
- or:[l == #topFit or:[l == #topSpaceFit]]]) ifTrue:[
- space := space min:(restHeight - m2) // (numChilds + 1).
- (vL == #fixTop or:[vL == #fixTopSpace]) ifTrue:[
- space := space max:verticalSpace.
- ] ifFalse:[
- space := space max:0.
- ].
- (l == #topSpace or:[l == #topSpaceFit]) ifTrue:[
- ypos := space.
- ] ifFalse:[
- "/
- "/ if the very first view has a 0-level AND
- "/ my level is non-zero, begin with margin
- "/
- (margin ~~ 0 and:[subViews first level == 0]) ifTrue:[
- ypos := margin
- ] ifFalse:[
- ypos := 0
- ]
- ]
- ] ifFalse:[
- "center"
- ypos := (restHeight - ((numChilds - 1) * space)) // 2.
- ypos < 0 ifTrue:[
- space := restHeight // (numChilds + 1).
- ypos := (restHeight - ((numChilds - 1) * space)) // 2.
- ]
- ]
- ]
- ]
- ]
- ].
- ].
+ ypos < 0 ifTrue:[
+ space := space min:(restHeight // (numChilds + 1)).
+ ypos := restHeight - (space * numChilds).
+ ]
+ ] ifFalse: [
+ (l == #spread) ifTrue:[
+ space := (restHeight - m2) // (numChilds - 1).
+ ypos := margin.
+ (space == 0) ifTrue:[
+ ypos := restHeight // 2
+ ]
+ ] ifFalse: [
+ (l == #spreadSpace) ifTrue:[
+ space := (restHeight - m2) // (numChilds + 1).
+ ypos := space + margin.
+ (space == 0) ifTrue:[
+ ypos := restHeight // 2
+ ]
+ ] ifFalse: [
+ ((l == #top) or:[l == #topSpace
+ or:[l == #topFit or:[l == #topSpaceFit]]]) ifTrue:[
+ space := space min:(restHeight - m2) // (numChilds + 1).
+ (vL == #fixTop or:[vL == #fixTopSpace]) ifTrue:[
+ space := space max:verticalSpace.
+ ] ifFalse:[
+ space := space max:0.
+ ].
+ (l == #topSpace or:[l == #topSpaceFit]) ifTrue:[
+ ypos := space + margin.
+ ] ifFalse:[
+ "/
+ "/ if the very first view has a 0-level AND
+ "/ my level is non-zero, begin with margin
+ "/
+ true "(margin ~~ 0 and:[subViews first level == 0])" ifTrue:[
+ ypos := margin
+ ] ifFalse:[
+ ypos := 0
+ ]
+ ]
+ ] ifFalse:[
+ "center"
+ ypos := (restHeight - ((numChilds - 1) * space)) // 2.
+ ypos < 0 ifTrue:[
+ space := restHeight // (numChilds + 1).
+ ypos := (restHeight - ((numChilds - 1) * space)) // 2.
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ ].
].
resizeToMaxH := false.
(hL endsWith:'Max') ifTrue:[
- resizeToMaxH := true.
- maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder].
- hL := (hL copyWithoutLast:3) asSymbol.
+ resizeToMaxH := true.
+ maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder].
+ hL := (hL copyWithoutLast:3) asSymbol.
].
"
now set positions
"
subViews keysAndValuesDo:[:index :child |
- |xpos advance bwChild wChild newWChild x2|
+ |xpos advance bwChild wChild newWChild x2|
- wChild := child widthIncludingBorder.
- bwChild := child borderWidth.
+ wChild := child widthIncludingBorder.
+ bwChild := child borderWidth.
- resizeToMaxH ifTrue:[
- child width:(wChild := maxWidth - (bwChild * 2)).
- ].
+ resizeToMaxH ifTrue:[
+ child width:(wChild := maxWidth - (bwChild * 2)).
+ ].
- hL == #left ifTrue:[
- xpos := 0 - borderWidth.
- ] ifFalse:[
- hL == #leftSpace ifTrue:[
- xpos := horizontalSpace
- ] ifFalse:[
- hL == #right ifTrue:[
- xpos := width - wChild
- ] ifFalse:[
- hL == #rightSpace ifTrue:[
- xpos := width - horizontalSpace - wChild.
- ] ifFalse:[
- hL == #fitSpace ifTrue:[
- xpos := horizontalSpace.
- newWChild := width - (horizontalSpace + bwChild * 2)
- ] ifFalse:[
- hL == #fit ifTrue:[
- newWChild := width "- (bwChild * 2)".
- borderWidth == 0 ifTrue:[
- newWChild := newWChild - (bwChild * 2)
- ].
- child level == 0 ifTrue:[
- xpos := margin - borderWidth.
- newWChild := newWChild - m2
- ] ifFalse:[
- xpos := 0 - borderWidth.
- ].
- ] ifFalse:[
- "centered"
- xpos := (width - m2 - wChild) // 2.
- ]
- ]
- ]
- ]
- ]
- ].
- newWChild notNil ifTrue:[
- child width:newWChild
- ].
+ hL == #left ifTrue:[
+ xpos := 0 - borderWidth + margin.
+ ] ifFalse:[
+ hL == #leftSpace ifTrue:[
+ xpos := horizontalSpace + margin
+ ] ifFalse:[
+ hL == #right ifTrue:[
+ xpos := width - wChild - margin
+ ] ifFalse:[
+ hL == #rightSpace ifTrue:[
+ xpos := width - horizontalSpace - wChild - margin.
+ ] ifFalse:[
+ hL == #fitSpace ifTrue:[
+ xpos := horizontalSpace + margin.
+ newWChild := width - m2 - (horizontalSpace + bwChild * 2)
+ ] ifFalse:[
+ hL == #fit ifTrue:[
+ newWChild := width "- (bwChild * 2)".
+ borderWidth == 0 ifTrue:[
+ newWChild := newWChild - (bwChild * 2)
+ ].
+ true "child level == 0" ifTrue:[
+ xpos := margin - borderWidth.
+ newWChild := newWChild - m2
+ ] ifFalse:[
+ xpos := 0 - borderWidth.
+ ].
+ ] ifFalse:[
+ "centered"
+ xpos := margin + ((width - m2 - wChild) // 2).
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ newWChild notNil ifTrue:[
+ child width:newWChild
+ ].
"/ (xpos < 0) ifTrue:[ xpos := 0 ].
- x2 := xpos + (child widthIncludingBorder - 1).
+ x2 := xpos + (child widthIncludingBorder - 1).
- (vL == #fit
- or:[vL == #fitSpace
- or:[resizeToMaxV]]) ifTrue:[
- child origin:(xpos @ ypos rounded)
- corner:(x2 @ (ypos + hEach - bwChild - 1) rounded).
- advance := hEach
- ] ifFalse:[
- child origin:(xpos@ypos).
- advance := child heightIncludingBorder
- ].
+ (vL == #fit
+ or:[vL == #fitSpace
+ or:[resizeToMaxV]]) ifTrue:[
+ child origin:(xpos @ ypos rounded)
+ corner:(x2 @ (ypos + hEach - bwChild - 1) rounded).
+ advance := hEach
+ ] ifFalse:[
+ child origin:(xpos@ypos).
+ advance := child heightIncludingBorder
+ ].
- index == numChilds ifTrue:[
- |y|
+ index == numChilds ifTrue:[
+ |y|
- (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
- y := height - margin - 1.
- vL == #topSpaceFit ifTrue:[
- y := y - space
- ].
- child corner:x2 @ y
- ].
- ].
- index == 1 ifTrue:[
- |y yB|
+ (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
+ y := height - margin - 1.
+ vL == #topSpaceFit ifTrue:[
+ y := y - space
+ ].
+ child corner:x2 @ y
+ ].
+ ].
+ index == 1 ifTrue:[
+ |y yB|
- (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
- y := 0 + (child borderWidth * 2) - borderWidth.
- vL == #bottomSpaceFit ifTrue:[
- y := y + space
- ].
- yB := child corner y.
- child origin:((child origin x) @ y)
- corner:((child corner x) @ yB)
- ].
- ].
+ (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
+ y := margin + 0 + (child borderWidth * 2) - borderWidth.
+ vL == #bottomSpaceFit ifTrue:[
+ y := y + space
+ ].
+ yB := child corner y.
+ child origin:((child origin x) @ y)
+ corner:((child corner x) @ yB)
+ ].
+ ].
- ypos := ypos + advance + space.
+ ypos := ypos + advance + space.
]
"Modified: / 4.9.1995 / 18:43:29 / claus"
- "Modified: / 17.1.1998 / 00:17:52 / cg"
+ "Modified: / 27.1.1998 / 21:14:32 / cg"
! !
!VerticalPanelView methodsFor:'queries'!
@@ -1053,5 +1054,5 @@
!VerticalPanelView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Attic/VPanelV.st,v 1.33 1998-01-17 13:47:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Attic/VPanelV.st,v 1.34 1998-01-27 20:15:43 cg Exp $'
! !
--- a/VerticalPanelView.st Tue Jan 27 19:06:10 1998 +0100
+++ b/VerticalPanelView.st Tue Jan 27 21:15:43 1998 +0100
@@ -710,9 +710,9 @@
subViews size == 0 ifTrue:[^ self].
extentChanged ifTrue:[
- ext := self computeExtent.
- width := ext x.
- height := ext y.
+ ext := self computeExtent.
+ width := ext x.
+ height := ext y.
].
space := verticalSpace.
@@ -726,255 +726,256 @@
resizeToMaxV := false.
(vL endsWith:'Max') ifTrue:[
- resizeToMaxV := true.
- hEach := maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder].
- vL := (vL copyWithoutLast:3) asSymbol.
+ resizeToMaxV := true.
+ hEach := maxHeight := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child heightIncludingBorder].
+ vL := (vL copyWithoutLast:3) asSymbol.
].
numChilds == 1 ifTrue:[
- (vL == #topFit or:[vL == #bottomFit]) ifTrue:[
- vL := #fit
- ].
- (vL == #topSpaceFit or:[vL == #bottomSpaceFit]) ifTrue:[
- vL := #fitSpace
- ].
+ (vL == #topFit or:[vL == #bottomFit]) ifTrue:[
+ vL := #fit
+ ].
+ (vL == #topSpaceFit or:[vL == #bottomSpaceFit]) ifTrue:[
+ vL := #fitSpace
+ ].
].
vL == #fitSpace ifTrue:[
- "
- adjust childs extents and set origins.
- Be careful to avoid accumulation of rounding errors
- "
- hEach := (hInside - (numChilds + 1 * space)) / numChilds.
- ypos := space + margin - borderWidth.
+ "
+ adjust childs extents and set origins.
+ Be careful to avoid accumulation of rounding errors
+ "
+ hEach := (hInside - (numChilds + 1 * space)) / numChilds.
+ ypos := space + margin - borderWidth.
] ifFalse:[
- vL == #fit ifTrue:[
- "
- adjust childs extents and set origins.
- Be careful to avoid accumulation of rounding errors
- "
- hEach := (hInside - (numChilds - 1 * space)) / numChilds.
- ypos := margin - borderWidth.
- ] ifFalse:[
- l := vL.
+ vL == #fit ifTrue:[
+ "
+ adjust childs extents and set origins.
+ Be careful to avoid accumulation of rounding errors
+ "
+ hEach := (hInside - (numChilds - 1 * space)) / numChilds.
+ ypos := margin - borderWidth.
+ ] ifFalse:[
+ l := vL.
- "/ adjust - do not include height of last(first) element if doing a fit
- (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
- subViews last height:0.
- ].
- (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
- subViews first height:0.
- ].
+ "/ adjust - do not include height of last(first) element if doing a fit
+ (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
+ subViews last height:0.
+ ].
+ (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
+ subViews first height:0.
+ ].
- "
- compute net height needed
- "
- resizeToMaxV ifTrue:[
- sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxHeight + (child borderWidth*2)].
- ] ifFalse:[
- sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child heightIncludingBorder].
- ].
+ "
+ compute net height needed
+ "
+ resizeToMaxV ifTrue:[
+ sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + maxHeight + (child borderWidth*2)].
+ ] ifFalse:[
+ sumOfHeights := subViews inject:0 into:[:sumSoFar :child | sumSoFar + child heightIncludingBorder].
+ ].
- restHeight := height - sumOfHeights.
+ restHeight := height - sumOfHeights.
- ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
- (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
+ ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
+ (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
- "
- compute position of topmost subview and space between them;
- if they do hardly fit, leave no space between them
- "
- ((sumOfHeights >= (height - m2))
- and:[l ~~ #fixTopSpace and:[l ~~ #fixTop]]) ifTrue:[
- "
- if we have not enough space for all the elements,
- fill them tight, and show what can be shown (at least)
- "
- ypos := margin.
- space := 0
- ] ifFalse:[
- l == #fixTopSpace ifTrue:[
- l := #topSpace
- ] ifFalse:[
- l == #fixTop ifTrue:[
- l := #top
- ]
- ].
- ((l == #bottom) or:[l == #bottomSpace
- or:[l == #bottomFit or:[l == #bottomSpaceFit]]]) ifTrue:[
- ypos := restHeight - (space * (numChilds - 1)).
- "
- borderWidth == 0 ifTrue:[
- ypos := ypos + space
- ].
- "
- (l == #bottomSpace
- or:[l == #bottomSpaceFit]) ifTrue:[
- ypos >= space ifTrue:[
- ypos := ypos - space
- ]
- ].
+ "
+ compute position of topmost subview and space between them;
+ if they do hardly fit, leave no space between them
+ "
+ ((sumOfHeights >= (height - m2))
+ and:[l ~~ #fixTopSpace and:[l ~~ #fixTop]]) ifTrue:[
+ "
+ if we have not enough space for all the elements,
+ fill them tight, and show what can be shown (at least)
+ "
+ ypos := margin.
+ space := 0
+ ] ifFalse:[
+ l == #fixTopSpace ifTrue:[
+ l := #topSpace
+ ] ifFalse:[
+ l == #fixTop ifTrue:[
+ l := #top
+ ]
+ ].
+ ((l == #bottom) or:[l == #bottomSpace
+ or:[l == #bottomFit or:[l == #bottomSpaceFit]]]) ifTrue:[
+ ypos := restHeight - (space * (numChilds - 1)).
+"/
+"/ borderWidth == 0 ifTrue:[
+"/ ypos := ypos + space
+"/ ].
+"/
+ (l == #bottomSpace
+ or:[l == #bottomSpaceFit]) ifTrue:[
+ ypos >= space ifTrue:[
+ ypos := ypos - space
+ ]
+ ].
+ ypos := ypos - margin.
- ypos < 0 ifTrue:[
- space := space min:(restHeight // (numChilds + 1)).
- ypos := restHeight - (space * numChilds).
- ]
- ] ifFalse: [
- (l == #spread) ifTrue:[
- space := (restHeight - m2) // (numChilds - 1).
- ypos := margin.
- (space == 0) ifTrue:[
- ypos := restHeight // 2
- ]
- ] ifFalse: [
- (l == #spreadSpace) ifTrue:[
- space := restHeight // (numChilds + 1).
- ypos := space.
- (space == 0) ifTrue:[
- ypos := restHeight // 2
- ]
- ] ifFalse: [
- ((l == #top) or:[l == #topSpace
- or:[l == #topFit or:[l == #topSpaceFit]]]) ifTrue:[
- space := space min:(restHeight - m2) // (numChilds + 1).
- (vL == #fixTop or:[vL == #fixTopSpace]) ifTrue:[
- space := space max:verticalSpace.
- ] ifFalse:[
- space := space max:0.
- ].
- (l == #topSpace or:[l == #topSpaceFit]) ifTrue:[
- ypos := space.
- ] ifFalse:[
- "/
- "/ if the very first view has a 0-level AND
- "/ my level is non-zero, begin with margin
- "/
- (margin ~~ 0 and:[subViews first level == 0]) ifTrue:[
- ypos := margin
- ] ifFalse:[
- ypos := 0
- ]
- ]
- ] ifFalse:[
- "center"
- ypos := (restHeight - ((numChilds - 1) * space)) // 2.
- ypos < 0 ifTrue:[
- space := restHeight // (numChilds + 1).
- ypos := (restHeight - ((numChilds - 1) * space)) // 2.
- ]
- ]
- ]
- ]
- ]
- ].
- ].
+ ypos < 0 ifTrue:[
+ space := space min:(restHeight // (numChilds + 1)).
+ ypos := restHeight - (space * numChilds).
+ ]
+ ] ifFalse: [
+ (l == #spread) ifTrue:[
+ space := (restHeight - m2) // (numChilds - 1).
+ ypos := margin.
+ (space == 0) ifTrue:[
+ ypos := restHeight // 2
+ ]
+ ] ifFalse: [
+ (l == #spreadSpace) ifTrue:[
+ space := (restHeight - m2) // (numChilds + 1).
+ ypos := space + margin.
+ (space == 0) ifTrue:[
+ ypos := restHeight // 2
+ ]
+ ] ifFalse: [
+ ((l == #top) or:[l == #topSpace
+ or:[l == #topFit or:[l == #topSpaceFit]]]) ifTrue:[
+ space := space min:(restHeight - m2) // (numChilds + 1).
+ (vL == #fixTop or:[vL == #fixTopSpace]) ifTrue:[
+ space := space max:verticalSpace.
+ ] ifFalse:[
+ space := space max:0.
+ ].
+ (l == #topSpace or:[l == #topSpaceFit]) ifTrue:[
+ ypos := space + margin.
+ ] ifFalse:[
+ "/
+ "/ if the very first view has a 0-level AND
+ "/ my level is non-zero, begin with margin
+ "/
+ true "(margin ~~ 0 and:[subViews first level == 0])" ifTrue:[
+ ypos := margin
+ ] ifFalse:[
+ ypos := 0
+ ]
+ ]
+ ] ifFalse:[
+ "center"
+ ypos := (restHeight - ((numChilds - 1) * space)) // 2.
+ ypos < 0 ifTrue:[
+ space := restHeight // (numChilds + 1).
+ ypos := (restHeight - ((numChilds - 1) * space)) // 2.
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ ].
].
resizeToMaxH := false.
(hL endsWith:'Max') ifTrue:[
- resizeToMaxH := true.
- maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder].
- hL := (hL copyWithoutLast:3) asSymbol.
+ resizeToMaxH := true.
+ maxWidth := subViews inject:0 into:[:maxSoFar :child | maxSoFar max:child widthIncludingBorder].
+ hL := (hL copyWithoutLast:3) asSymbol.
].
"
now set positions
"
subViews keysAndValuesDo:[:index :child |
- |xpos advance bwChild wChild newWChild x2|
+ |xpos advance bwChild wChild newWChild x2|
- wChild := child widthIncludingBorder.
- bwChild := child borderWidth.
+ wChild := child widthIncludingBorder.
+ bwChild := child borderWidth.
- resizeToMaxH ifTrue:[
- child width:(wChild := maxWidth - (bwChild * 2)).
- ].
+ resizeToMaxH ifTrue:[
+ child width:(wChild := maxWidth - (bwChild * 2)).
+ ].
- hL == #left ifTrue:[
- xpos := 0 - borderWidth.
- ] ifFalse:[
- hL == #leftSpace ifTrue:[
- xpos := horizontalSpace
- ] ifFalse:[
- hL == #right ifTrue:[
- xpos := width - wChild
- ] ifFalse:[
- hL == #rightSpace ifTrue:[
- xpos := width - horizontalSpace - wChild.
- ] ifFalse:[
- hL == #fitSpace ifTrue:[
- xpos := horizontalSpace.
- newWChild := width - (horizontalSpace + bwChild * 2)
- ] ifFalse:[
- hL == #fit ifTrue:[
- newWChild := width "- (bwChild * 2)".
- borderWidth == 0 ifTrue:[
- newWChild := newWChild - (bwChild * 2)
- ].
- child level == 0 ifTrue:[
- xpos := margin - borderWidth.
- newWChild := newWChild - m2
- ] ifFalse:[
- xpos := 0 - borderWidth.
- ].
- ] ifFalse:[
- "centered"
- xpos := (width - m2 - wChild) // 2.
- ]
- ]
- ]
- ]
- ]
- ].
- newWChild notNil ifTrue:[
- child width:newWChild
- ].
+ hL == #left ifTrue:[
+ xpos := 0 - borderWidth + margin.
+ ] ifFalse:[
+ hL == #leftSpace ifTrue:[
+ xpos := horizontalSpace + margin
+ ] ifFalse:[
+ hL == #right ifTrue:[
+ xpos := width - wChild - margin
+ ] ifFalse:[
+ hL == #rightSpace ifTrue:[
+ xpos := width - horizontalSpace - wChild - margin.
+ ] ifFalse:[
+ hL == #fitSpace ifTrue:[
+ xpos := horizontalSpace + margin.
+ newWChild := width - m2 - (horizontalSpace + bwChild * 2)
+ ] ifFalse:[
+ hL == #fit ifTrue:[
+ newWChild := width "- (bwChild * 2)".
+ borderWidth == 0 ifTrue:[
+ newWChild := newWChild - (bwChild * 2)
+ ].
+ true "child level == 0" ifTrue:[
+ xpos := margin - borderWidth.
+ newWChild := newWChild - m2
+ ] ifFalse:[
+ xpos := 0 - borderWidth.
+ ].
+ ] ifFalse:[
+ "centered"
+ xpos := margin + ((width - m2 - wChild) // 2).
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ newWChild notNil ifTrue:[
+ child width:newWChild
+ ].
"/ (xpos < 0) ifTrue:[ xpos := 0 ].
- x2 := xpos + (child widthIncludingBorder - 1).
+ x2 := xpos + (child widthIncludingBorder - 1).
- (vL == #fit
- or:[vL == #fitSpace
- or:[resizeToMaxV]]) ifTrue:[
- child origin:(xpos @ ypos rounded)
- corner:(x2 @ (ypos + hEach - bwChild - 1) rounded).
- advance := hEach
- ] ifFalse:[
- child origin:(xpos@ypos).
- advance := child heightIncludingBorder
- ].
+ (vL == #fit
+ or:[vL == #fitSpace
+ or:[resizeToMaxV]]) ifTrue:[
+ child origin:(xpos @ ypos rounded)
+ corner:(x2 @ (ypos + hEach - bwChild - 1) rounded).
+ advance := hEach
+ ] ifFalse:[
+ child origin:(xpos@ypos).
+ advance := child heightIncludingBorder
+ ].
- index == numChilds ifTrue:[
- |y|
+ index == numChilds ifTrue:[
+ |y|
- (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
- y := height - margin - 1.
- vL == #topSpaceFit ifTrue:[
- y := y - space
- ].
- child corner:x2 @ y
- ].
- ].
- index == 1 ifTrue:[
- |y yB|
+ (vL == #topFit or:[vL == #topSpaceFit]) ifTrue:[
+ y := height - margin - 1.
+ vL == #topSpaceFit ifTrue:[
+ y := y - space
+ ].
+ child corner:x2 @ y
+ ].
+ ].
+ index == 1 ifTrue:[
+ |y yB|
- (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
- y := 0 + (child borderWidth * 2) - borderWidth.
- vL == #bottomSpaceFit ifTrue:[
- y := y + space
- ].
- yB := child corner y.
- child origin:((child origin x) @ y)
- corner:((child corner x) @ yB)
- ].
- ].
+ (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
+ y := margin + 0 + (child borderWidth * 2) - borderWidth.
+ vL == #bottomSpaceFit ifTrue:[
+ y := y + space
+ ].
+ yB := child corner y.
+ child origin:((child origin x) @ y)
+ corner:((child corner x) @ yB)
+ ].
+ ].
- ypos := ypos + advance + space.
+ ypos := ypos + advance + space.
]
"Modified: / 4.9.1995 / 18:43:29 / claus"
- "Modified: / 17.1.1998 / 00:17:52 / cg"
+ "Modified: / 27.1.1998 / 21:14:32 / cg"
! !
!VerticalPanelView methodsFor:'queries'!
@@ -1053,5 +1054,5 @@
!VerticalPanelView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/VerticalPanelView.st,v 1.33 1998-01-17 13:47:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/VerticalPanelView.st,v 1.34 1998-01-27 20:15:43 cg Exp $'
! !