# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1300902565 0 # Node ID 1b0a0775ec19cd77e35d4df1cb8053e735b47bdf # Parent aca4e104127c9575513e75652b3edf86cc497967 Ok... groupbox calculation fix try #2! diff -r aca4e104127c -r 1b0a0775ec19 mac/dw.m --- 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;zcount;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; } }