[hyena] Fix virtal size calculation (bgo#612587)



commit 321eef2837ec4c6f45115b0ec4a25e8d0ed43f71
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Fri Mar 12 18:55:50 2010 +1100

    Fix virtal size calculation (bgo#612587)

 src/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)
---
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs b/src/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs
index 41a1cce..4072d34 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs
+++ b/src/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs
@@ -51,20 +51,10 @@ namespace Hyena.Data.Gui
 
         protected override void InvalidateVirtualSize ()
         {
-            // FIXME: Improper virtual size allocation
-            //          - Verify width and height generally computed correctly
-            //          - Not accounting for spacing/padding or rounding error
-            int model_rows = Model == null ? 0 : Model.Count;
+            double model_rows = Model == null ? 0 : Model.Count;
             VirtualSize = new Size (
                 ChildSize.Width * Math.Max (Columns, 1),
-                (ChildSize.Height * (model_rows + 1)) / Math.Max (Columns, 1));
-
-            /*Console.WriteLine ("======");
-            Console.WriteLine ("   VIEW COLUMNS = {0}", Columns);
-            Console.WriteLine ("   VIEW ROWS = {0}", Rows);
-            Console.WriteLine ("   MODEL ROWS = {0}", model_rows);
-            Console.WriteLine ("   CHILD SIZE = {0}", ChildSize);
-            Console.WriteLine ("   VIRTUAL SIZE = {0}", VirtualSize);*/
+                ChildSize.Height * Math.Ceiling (model_rows / Math.Max (Columns, 1)));
         }
 
         protected override void InvalidateChildCollection ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]