comparison mac/dw.m @ 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
comparison
equal deleted inserted replaced
797:aca4e104127c 798:1b0a0775ec19
1622 int uymax = 0, uxmax = 0; 1622 int uymax = 0, uxmax = 0;
1623 int upymax = 0, upxmax = 0; 1623 int upymax = 0, upxmax = 0;
1624 /* Used for the SIZEEXPAND */ 1624 /* Used for the SIZEEXPAND */
1625 int nux = *usedx, nuy = *usedy; 1625 int nux = *usedx, nuy = *usedy;
1626 int nupx = *usedpadx, nupy = *usedpady; 1626 int nupx = *usedpadx, nupy = *usedpady;
1627 1627 int thispadx = thisbox->pad * 2;
1628 (*usedx) += (thisbox->pad * 2); 1628 int thispady = thisbox->pad * 2;
1629 (*usedy) += (thisbox->pad * 2); 1629
1630 /* Handle special groupbox case */
1631 if(thisbox->grouphwnd)
1632 {
1633 if(thispadx < _DW_GROUPBOX_BORDER_X)
1634 {
1635 thispadx = _DW_GROUPBOX_BORDER_X;
1636 }
1637 if(thispady < _DW_GROUPBOX_BORDER_Y)
1638 {
1639 thispady = _DW_GROUPBOX_BORDER_Y;
1640 }
1641 }
1642
1643 (*usedx) += thispadx;
1644 (*usedy) += thispady;
1630 1645
1631 for(z=0;z<thisbox->count;z++) 1646 for(z=0;z<thisbox->count;z++)
1632 { 1647 {
1633 if(thisbox->items[z].type == TYPEBOX) 1648 if(thisbox->items[z].type == TYPEBOX)
1634 { 1649 {
1641 1656
1642 if(tmp) 1657 if(tmp)
1643 { 1658 {
1644 int newx, newy; 1659 int newx, newy;
1645 int nux = *usedx, nuy = *usedy; 1660 int nux = *usedx, nuy = *usedy;
1646 int thispadx = tmp->pad*2; 1661 int tmppadx = tmp->pad*2;
1647 int thispady = tmp->pad*2; 1662 int tmppady = tmp->pad*2;
1648 int upx, upy; 1663 int upx, upy;
1649 1664
1650 /* Handle special groupbox case */ 1665 /* Handle special groupbox case */
1651 if(tmp->grouphwnd) 1666 if(tmp->grouphwnd)
1652 { 1667 {
1653 if(thispadx < _DW_GROUPBOX_BORDER_X) 1668 if(tmppadx < _DW_GROUPBOX_BORDER_X)
1654 { 1669 {
1655 thispadx = _DW_GROUPBOX_BORDER_X; 1670 tmppadx = _DW_GROUPBOX_BORDER_X;
1656 } 1671 }
1657 if(thispady < _DW_GROUPBOX_BORDER_Y) 1672 if(tmppady < _DW_GROUPBOX_BORDER_Y)
1658 { 1673 {
1659 thispady = _DW_GROUPBOX_BORDER_Y; 1674 tmppady = _DW_GROUPBOX_BORDER_Y;
1660 } 1675 }
1661 } 1676 }
1662 1677
1663 upx = *usedpadx + thispadx; 1678 upx = *usedpadx + tmppadx;
1664 upy = *usedpady + thispady; 1679 upy = *usedpady + tmppady;
1665 1680
1666 /* On the second pass we know how big the box needs to be and how 1681 /* On the second pass we know how big the box needs to be and how
1667 * much space we have, so we can calculate a ratio for the new box. 1682 * much space we have, so we can calculate a ratio for the new box.
1668 */ 1683 */
1669 if(pass == 2) 1684 if(pass == 2)
1710 if((thisbox->items[z].height-tmp->upy)!=0) 1725 if((thisbox->items[z].height-tmp->upy)!=0)
1711 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy)); 1726 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy));
1712 } 1727 }
1713 1728
1714 nux = *usedx; nuy = *usedy; 1729 nux = *usedx; nuy = *usedy;
1715 upx = *usedpadx + thispadx; upy = *usedpady + thispady; 1730 upx = *usedpadx + tmppadx; upy = *usedpady + tmppady;
1716 } 1731 }
1717 1732
1718 (*depth)++; 1733 (*depth)++;
1719 1734
1720 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy); 1735 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy);
1887 { 1902 {
1888 float calcval; 1903 float calcval;
1889 1904
1890 if(thisbox->type == DW_VERT) 1905 if(thisbox->type == DW_VERT)
1891 { 1906 {
1892 calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2))); 1907 calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+thispadx));
1893 if(calcval == 0.0) 1908 if(calcval == 0.0)
1894 tmp->xratio = thisbox->xratio; 1909 tmp->xratio = thisbox->xratio;
1895 else 1910 else
1896 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; 1911 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+thispadx)))/calcval;
1897 tmp->width = thisbox->items[z].width; 1912 tmp->width = thisbox->items[z].width;
1898 } 1913 }
1899 if(thisbox->type == DW_HORZ) 1914 if(thisbox->type == DW_HORZ)
1900 { 1915 {
1901 calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2))); 1916 calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+thispady));
1902 if(calcval == 0.0) 1917 if(calcval == 0.0)
1903 tmp->yratio = thisbox->yratio; 1918 tmp->yratio = thisbox->yratio;
1904 else 1919 else
1905 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; 1920 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+thispady)))/calcval;
1906 tmp->height = thisbox->items[z].height; 1921 tmp->height = thisbox->items[z].height;
1907 } 1922 }
1908 } 1923 }
1909 1924
1910 (*depth)++; 1925 (*depth)++;