diff --git a/src/common/statbar.cpp b/src/common/statbar.cpp index 1ebaf0e3df..76278969ea 100644 --- a/src/common/statbar.cpp +++ b/src/common/statbar.cpp @@ -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); } } }