]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed rounding errors in variable status bar panes widths computation (patch 1030021)
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 17 Sep 2004 19:12:41 +0000 (19:12 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 17 Sep 2004 19:12:41 +0000 (19:12 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29179 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/statbar.cpp

index 1ebaf0e3df76cb03a6da3ae9e4ecf9e888220015..76278969ea64a927174ce00517437e49efeee00d 100644 (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);
             }
         }
     }