[banshee/grid: 346/346] [grid] fix VirtualSize computation



commit 324bd2a6bdcca555c551e5fdf0d9a795383d60b0
Author: Aaron Bockover <abockover novell com>
Date:   Tue Mar 9 15:40:46 2010 -0500

    [grid] fix VirtualSize computation
    
    Still slightly buggy, but the remaining bug might actually be related to
    the host adjustment, not the data layout. At least all children in the model
    can be seen now.

 .../Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs
index b75b80f..41a1cce 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs
@@ -51,13 +51,20 @@ 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;
-
-            // FIXME: this is too simplistic and can result in
-            // an extra row of allocation, check the model size
             VirtualSize = new Size (
                 ChildSize.Width * Math.Max (Columns, 1),
-                (ChildSize.Height * model_rows) / Math.Max (Rows, 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);*/
         }
 
         protected override void InvalidateChildCollection ()



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