1. Avoid endless recursion with #elementsChangesSize.
authorStefan Vogel <sv@exept.de>
Fri, 07 Jan 2005 11:26:51 +0100
changeset 3118 996b7fc6dee7
parent 3117 6d0c7aa281f2
child 3119 dcb3db1033e3
1. Avoid endless recursion with #elementsChangesSize. (#setChildPositions -> #origin:corner: -> #sizeChanged -> ... ->#setChildPositions) 2. Fix computation of first element in #rightFit #rightSpaceFit #bottomFit #bottomSpaceFit
HorizontalPanelView.st
VerticalPanelView.st
--- a/HorizontalPanelView.st	Fri Jan 07 11:22:50 2005 +0100
+++ b/HorizontalPanelView.st	Fri Jan 07 11:26:51 2005 +0100
@@ -1308,6 +1308,10 @@
         hChild := child heightIncludingBorder.
         bwChild := child borderWidth.
 
+        elementsChangeSize ifTrue:[
+            "to avoid a recursion when we change the elements size"
+            child removeDependent:self.
+        ].
         resizeToMaxV ifTrue:[
             child height:(hChild := maxHeight - (bwChild  * 2)).
         ].
@@ -1392,20 +1396,22 @@
             ].
         ].
         index == 1 ifTrue:[
-            |x xR|
-
             (hL == #rightFit or:[hL == #rightSpaceFit]) ifTrue:[
-                x := margin + 0 + (bwChild * 2) - borderWidth.
+                xpos := margin + 0 + (bwChild * 2) - borderWidth.
                 hL == #rightSpaceFit ifTrue:[
-                    x := x + space
+                    xpos := xpos + space
                 ].
-                xR := child corner x.
-                child origin:(x @ (child origin y))
-                      corner:(xR @ (child corner y))
+                advance := restWidth.
+                child origin:(xpos @ (child origin y))
+                      corner:((xpos+advance) @ (child corner y))
             ].
         ].
 
         xpos := xpos + advance + space.
+        elementsChangeSize ifTrue:[
+            "reinstall dependency that we removed above"
+            child addDependent:self.
+        ].
     ].
 
     "Modified: / 4.9.1995 / 18:43:10 / claus"
@@ -1498,5 +1504,5 @@
 !HorizontalPanelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.50 2003-02-25 15:04:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.51 2005-01-07 10:26:51 stefan Exp $'
 ! !
--- a/VerticalPanelView.st	Fri Jan 07 11:22:50 2005 +0100
+++ b/VerticalPanelView.st	Fri Jan 07 11:26:51 2005 +0100
@@ -892,6 +892,10 @@
         wChild := child widthIncludingBorder.
         bwChild := child borderWidth.
 
+        elementsChangeSize ifTrue:[
+            "to avoid a recursion when we change the elements size"
+            child removeDependent:self.
+        ].
         resizeToMaxH ifTrue:[
             child width:(wChild := maxWidth - (bwChild  * 2)).
         ].
@@ -963,20 +967,22 @@
             ].
         ].
         index == 1 ifTrue:[
-            |y yB|
-
             (vL == #bottomFit or:[vL == #bottomSpaceFit]) ifTrue:[
-                y := margin + 0 + (child borderWidth * 2) - borderWidth.
+                ypos := margin + 0 + (child borderWidth * 2) - borderWidth.
                 vL == #bottomSpaceFit ifTrue:[
-                    y := y + space
+                    ypos := ypos + space
                 ].
-                yB := child corner y.
-                child origin:((child origin x) @ y)
-                      corner:((child corner x) @ yB)
+                advance := restHeight.
+                child origin:((child origin x) @ ypos)
+                      corner:((child corner x) @ (ypos+advance))
             ].
         ].
 
         ypos := ypos + advance + space.
+        elementsChangeSize ifTrue:[
+            "reinstall dependency that we removed above"
+            child addDependent:self.
+        ].
     ]
 
     "Modified: / 4.9.1995 / 18:43:29 / claus"
@@ -1063,5 +1069,5 @@
 !VerticalPanelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/VerticalPanelView.st,v 1.39 2001-08-01 13:23:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/VerticalPanelView.st,v 1.40 2005-01-07 10:26:49 stefan Exp $'
 ! !