Improved drawing of background
authorEnrico Zini <enrico@enricozini.org>
Thu, 10 Dec 2009 10:22:23 +0000 (10:22 +0000)
committerEnrico Zini <enrico@enricozini.org>
Thu, 10 Dec 2009 10:22:23 +0000 (10:22 +0000)
src/fisheye.vala

index 32cdc6236b4060831d5e2ea8c97c1505841b5918..59cf1824e4ee699df5fe83c1b12eac176630e203 100644 (file)
@@ -319,14 +319,12 @@ public class FisheyeList : Gtk.DrawingArea
                expose_area.width = allocation.width;
                expose_area.height = allocation.height;
 
-               stderr.printf("BG %d %d\n", label_cache.length, allocation.height);
+               Gdk.Rectangle cell_area = Gdk.Rectangle();
+               cell_area.x = 0;
+               cell_area.width = allocation.width;
+               cell_area.height = 1;
                if (label_cache.length >= allocation.height)
                {
-                       stderr.printf("LABELS\n");
-                       Gdk.Rectangle cell_area = Gdk.Rectangle();
-                       cell_area.x = 0;
-                       cell_area.width = allocation.width;
-                       cell_area.height = 1;
                        for (int y = 0; y < allocation.height; ++y)
                        {
                                int idx = y * label_cache.length / allocation.height;
@@ -338,6 +336,26 @@ public class FisheyeList : Gtk.DrawingArea
                                                expose_area,
                                                0);
                        }
+               } else {
+                       int count = int.min(allocation.height/2, label_cache.length); 
+                       for (int y = 0; y < count; ++y)
+                       {
+                               cell_area.y = y;
+                               renderers[0].text = label_cache[y];
+                               renderers[0].render((Gdk.Window*)drawable, this, 
+                                               cell_area,
+                                               cell_area,
+                                               expose_area,
+                                               0);
+
+                               cell_area.y = allocation.height-y;
+                               renderers[0].text = label_cache[label_cache.length-y];
+                               renderers[0].render((Gdk.Window*)drawable, this, 
+                                               cell_area,
+                                               cell_area,
+                                               expose_area,
+                                               0);
+                       }
                }
        }