--- a/GridBagLayoutView.st Thu Sep 09 13:31:30 1999 +0200
+++ b/GridBagLayoutView.st Thu Sep 09 13:39:21 1999 +0200
@@ -281,9 +281,9 @@
(((subViews := self 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.
].
"/ Pass #1: scan all the slaves to figure out the total amount
@@ -293,8 +293,8 @@
d := self getMinSize:info.
((width < (d width)) or:[(height < (d height))]) ifTrue:[
- info := self getLayoutInfo:#MINIMUM_SIZE.
- d := self getMinSize:info.
+ info := self getLayoutInfo:#MINIMUM_SIZE.
+ d := self getMinSize:info.
].
layoutInfo := info.
@@ -306,48 +306,48 @@
diffw := width - (r width).
(diffw ~~ 0) ifTrue:[
- weight := 0.0.
- 0 to:((info width) - 1) do:[ :i |
- weight := weight + ((info weightX) at:(i + 1)).
- ].
- (weight > 0.0) ifTrue:[
- 0 to:((info width) - 1) do:[ :i |
- | dx |
- dx := ((diffw * ((info weightX) at:(i + 1))) / weight) asInteger.
- (info minWidth) at:(i + 1) put:(((info minWidth) at:(i + 1)) + dx).
- r width:((r width) + dx).
- (((info minWidth) at:(i + 1)) < 0) ifTrue:[
- r width:((r width) - ((info minWidth) at:(i + 1))).
- (info minWidth) at:(i + 1) put:0.
- ].
- ].
- ].
- diffw := width - (r width).
+ weight := 0.0.
+ 0 to:((info width) - 1) do:[ :i |
+ weight := weight + ((info weightX) at:(i + 1)).
+ ].
+ (weight > 0.0) ifTrue:[
+ 0 to:((info width) - 1) do:[ :i |
+ | dx |
+ dx := ((diffw * ((info weightX) at:(i + 1))) / weight) asInteger.
+ (info minWidth) at:(i + 1) put:(((info minWidth) at:(i + 1)) + dx).
+ r width:((r width) + dx).
+ (((info minWidth) at:(i + 1)) < 0) ifTrue:[
+ r width:((r width) - ((info minWidth) at:(i + 1))).
+ (info minWidth) at:(i + 1) put:0.
+ ].
+ ].
+ ].
+ diffw := width - (r width).
] ifFalse:[
- diffw := 0.
+ diffw := 0.
].
diffh := height - (r height).
(diffh ~~ 0) ifTrue:[
- weight := 0.0.
- 0 to:((info height) - 1) do:[ :i |
- weight := weight + ((info weightY) at:(i + 1)).
- ].
- (weight > 0.0) ifTrue:[
- 0 to:((info height) - 1) do:[ :i |
- | dy |
- dy := ((diffh * ((info weightY) at:(i + 1))) / weight) asInteger.
- (info minHeight) at:(i + 1) put:(((info minHeight) at:(i + 1)) + dy).
- r height:((r height) + dy).
- (((info minHeight) at:(i + 1)) < 0) ifTrue:[
- r height:((r height) - ((info minHeight) at:(i + 1))).
- (info minHeight) at:(i + 1) put:0.
- ].
- ].
- ].
- diffh := height - (r height).
+ weight := 0.0.
+ 0 to:((info height) - 1) do:[ :i |
+ weight := weight + ((info weightY) at:(i + 1)).
+ ].
+ (weight > 0.0) ifTrue:[
+ 0 to:((info height) - 1) do:[ :i |
+ | dy |
+ dy := ((diffh * ((info weightY) at:(i + 1))) / weight) asInteger.
+ (info minHeight) at:(i + 1) put:(((info minHeight) at:(i + 1)) + dy).
+ r height:((r height) + dy).
+ (((info minHeight) at:(i + 1)) < 0) ifTrue:[
+ r height:((r height) - ((info minHeight) at:(i + 1))).
+ (info minHeight) at:(i + 1) put:0.
+ ].
+ ].
+ ].
+ diffh := height - (r height).
] ifFalse:[
- diffh := 0.
+ diffh := 0.
].
"/ Now do the actual layout of the slaves using the layout information
@@ -357,37 +357,41 @@
info startY:(((diffh / 2) + (insets top)) asInteger).
subViews do:[ :child |
- c := self constraints:child.
+ |rW rH|
- r setLeft:(info startX).
- 0 to:((c tempX) - 1) do:[ :i | r setLeft:((r left) + ((info minWidth) at:(i + 1))). ].
+ c := self constraints:child.
+
+ r setLeft:(info startX).
+ 0 to:((c tempX) - 1) do:[ :i | r setLeft:((r left) + ((info minWidth) at:(i + 1))). ].
- r setTop:(info startY).
- 0 to:((c tempY) - 1) do:[ :i | r setTop:((r top) + ((info minHeight) at:(i + 1))). ].
+ r setTop:(info startY).
+ 0 to:((c tempY) - 1) do:[ :i | r setTop:((r top) + ((info minHeight) at:(i + 1))). ].
- r width:0.
- (c tempX) to:((c tempX) + (c tempWidth) - 1) do:[ :i |
- r width:((r width) + ((info minWidth) at:(i + 1))).
- ].
+ r width:0.
+ (c tempX) to:((c tempX) + (c tempWidth) - 1) do:[ :i |
+ r width:((r width) + ((info minWidth) at:(i + 1))).
+ ].
- r height:0.
- (c tempY) to:((c tempY) + (c tempHeight) - 1) do:[ :i |
- r height:((r height) + ((info minHeight) at:(i + 1))).
- ].
+ r height:0.
+ (c tempY) to:((c tempY) + (c tempHeight) - 1) do:[ :i |
+ r height:((r height) + ((info minHeight) at:(i + 1))).
+ ].
- self adjustForGravity:c in:r.
+ self adjustForGravity:c in:r.
- "/ If the window is too small to be interesting then
- "/ unmap it. Otherwise configure it and then make sure
- "/ its mapped.
+ "/ If the window is too small to be interesting then
+ "/ unmap it. Otherwise configure it and then make sure
+ "/ its mapped.
+ rW := r width.
+ rH := r height.
- (((r width) <= 0) or:[(r height) <= 0]) ifTrue:[
- child origin:(0@0) ; width:0 height:0.
- ] ifFalse:[
- child origin:((r left) @ (r top)).
- child width:(r width).
- child height:(r height).
- ].
+ ((rW <= 0) or:[rH <= 0]) ifTrue:[
+ child origin:(0@0) ; width:0 height:0.
+ ] ifFalse:[
+ child origin:((r left) @ (r top)).
+ child width:rW.
+ child height:rH.
+ ].
].
"Modified: / 1.2.1998 / 12:53:37 / av"
@@ -843,5 +847,5 @@
!GridBagLayoutView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/GridBagLayoutView.st,v 1.2 1998-02-26 01:38:46 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/GridBagLayoutView.st,v 1.3 1999-09-09 11:39:21 cg Exp $'
! !