changeset 798:1b0a0775ec19

Ok... groupbox calculation fix try #2!
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 23 Mar 2011 17:49:25 +0000
parents aca4e104127c
children 3aa5d0777af2
files mac/dw.m
diffstat 1 files changed, 31 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Wed Mar 23 09:41:03 2011 +0000
+++ b/mac/dw.m	Wed Mar 23 17:49:25 2011 +0000
@@ -1624,9 +1624,24 @@
    /* Used for the SIZEEXPAND */
    int nux = *usedx, nuy = *usedy;
    int nupx = *usedpadx, nupy = *usedpady;
-
-   (*usedx) += (thisbox->pad * 2);
-   (*usedy) += (thisbox->pad * 2);
+   int thispadx = thisbox->pad * 2;
+   int thispady = thisbox->pad * 2;
+
+    /* Handle special groupbox case */
+    if(thisbox->grouphwnd)
+    {
+        if(thispadx < _DW_GROUPBOX_BORDER_X)
+        {
+            thispadx = _DW_GROUPBOX_BORDER_X;
+        }
+        if(thispady < _DW_GROUPBOX_BORDER_Y)
+        {
+            thispady = _DW_GROUPBOX_BORDER_Y;
+        }
+    }
+    
+   (*usedx) += thispadx;
+   (*usedy) += thispady;
 
    for(z=0;z<thisbox->count;z++)
    {
@@ -1643,25 +1658,25 @@
          {
             int newx, newy;
             int nux = *usedx, nuy = *usedy;
-            int thispadx = tmp->pad*2;
-            int thispady = tmp->pad*2;
+            int tmppadx = tmp->pad*2;
+            int tmppady = tmp->pad*2;
             int upx, upy;
             
             /* Handle special groupbox case */
             if(tmp->grouphwnd)
             {
-                if(thispadx < _DW_GROUPBOX_BORDER_X)
+                if(tmppadx < _DW_GROUPBOX_BORDER_X)
                 {
-                    thispadx = _DW_GROUPBOX_BORDER_X;
+                    tmppadx = _DW_GROUPBOX_BORDER_X;
                 }
-                if(thispady < _DW_GROUPBOX_BORDER_Y)
+                if(tmppady < _DW_GROUPBOX_BORDER_Y)
                 {
-                    thispady = _DW_GROUPBOX_BORDER_Y;
+                    tmppady = _DW_GROUPBOX_BORDER_Y;
                 }
             }
              
-            upx = *usedpadx + thispadx;
-            upy = *usedpady + thispady;
+            upx = *usedpadx + tmppadx;
+            upy = *usedpady + tmppady;
 
             /* On the second pass we know how big the box needs to be and how
              * much space we have, so we can calculate a ratio for the new box.
@@ -1712,7 +1727,7 @@
                }
 
                nux = *usedx; nuy = *usedy;
-               upx = *usedpadx + thispadx; upy = *usedpady + thispady;
+               upx = *usedpadx + tmppadx; upy = *usedpady + tmppady;
             }
 
             (*depth)++;
@@ -1889,20 +1904,20 @@
 
                   if(thisbox->type == DW_VERT)
                   {
-                     calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
+                     calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+thispadx));
                      if(calcval == 0.0)
                         tmp->xratio = thisbox->xratio;
                      else
-                        tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
+                        tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+thispadx)))/calcval;
                      tmp->width = thisbox->items[z].width;
                   }
                   if(thisbox->type == DW_HORZ)
                   {
-                     calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
+                     calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+thispady));
                      if(calcval == 0.0)
                         tmp->yratio = thisbox->yratio;
                      else
-                        tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
+                        tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+thispady)))/calcval;
                      tmp->height = thisbox->items[z].height;
                   }
                }