fixed rounding errors in variable status bar panes widths computation (patch 1030021)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29179 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2004-09-17 19:12:41 +00:00
parent 566a06e8a5
commit 1a83b9bd10

View File

@ -243,16 +243,7 @@ wxArrayInt wxStatusBarBase::CalculateAbsWidths(wxCoord widthTotal) const
}
// the amount of extra width we have per each var width field
int nVarWidth;
if ( nVarCount )
{
int widthExtra = widthTotal - nTotalWidth;
nVarWidth = widthExtra > 0 ? widthExtra / nVarCount : 0;
}
else // no var width fields at all
{
nVarWidth = 0;
}
int widthExtra = widthTotal - nTotalWidth;
// do fill the array
for ( i = 0; i < m_nFields; i++ )
@ -263,7 +254,10 @@ wxArrayInt wxStatusBarBase::CalculateAbsWidths(wxCoord widthTotal) const
}
else
{
widths.Add(-m_statusWidths[i]*nVarWidth);
int nVarWidth = widthExtra > 0 ? (widthExtra * -m_statusWidths[i]) / nVarCount : 0;
nVarCount += m_statusWidths[i];
widthExtra -= nVarWidth;
widths.Add(nVarWidth);
}
}
}