[hyena] fix VirtualSize computation



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

    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.

 src/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs b/src/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs
index b75b80f..41a1cce 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/DataViewLayoutGrid.cs
+++ b/src/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]