Draw tiny lines in the background
authorEnrico Zini <enrico@enricozini.org>
Thu, 10 Dec 2009 10:18:11 +0000 (10:18 +0000)
committerEnrico Zini <enrico@enricozini.org>
Thu, 10 Dec 2009 10:18:11 +0000 (10:18 +0000)
src/fisheye.vala

index f3c05d380d7f391febf27cf0e9ba4cc94debc5da..32cdc6236b4060831d5e2ea8c97c1505841b5918 100644 (file)
@@ -224,8 +224,6 @@ public class FisheyeList : Gtk.DrawingArea
        protected void base_layout()
        {
                background = new Gdk.Pixmap(window, allocation.width, allocation.height, -1);
-               draw_background(background);
-
                backing_store = new Gdk.Pixmap(window, allocation.width, allocation.height, -1);
 
                // Recreate the renderers
@@ -233,7 +231,7 @@ public class FisheyeList : Gtk.DrawingArea
                renderers[renderers.length-1].set_fixed_height_from_font(1);
 
                renderers[0] = make_cell_renderer();
-               renderers[0].size = 1;
+               renderers[0].size = Pango.SCALE;
                renderers[0].set_fixed_height_from_font(1);
 
                for (int i = 1; i < renderers.length-1; ++i)
@@ -267,6 +265,9 @@ public class FisheyeList : Gtk.DrawingArea
                        }
                }
 
+               // Draw background
+               draw_background(background);
+
                base_layout_needed = false;
                focus_layout_needed = true;
        }
@@ -309,9 +310,35 @@ public class FisheyeList : Gtk.DrawingArea
                // Background
                drawable.draw_rectangle(style.bg_gc[Gtk.StateType.NORMAL], true, 0, 0, allocation.width, allocation.height);
 
-               // Focus lock area
-               drawable.draw_rectangle(style.bg_gc[Gtk.StateType.ACTIVE], true,
-                       0, focus_starts[0], allocation.width/2, focus_starts[focus_end - focus_first]-focus_starts[0]);
+               // Focus movement area
+               drawable.draw_rectangle(style.bg_gc[Gtk.StateType.INSENSITIVE], true,
+                       allocation.width/2, 0, allocation.width, allocation.height);
+
+               Gdk.Rectangle expose_area = Gdk.Rectangle();
+               expose_area.x = expose_area.y = 0;
+               expose_area.width = allocation.width;
+               expose_area.height = allocation.height;
+
+               stderr.printf("BG %d %d\n", label_cache.length, allocation.height);
+               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;
+                               cell_area.y = y;
+                               renderers[0].text = label_cache[idx];
+                               renderers[0].render((Gdk.Window*)drawable, this, 
+                                               cell_area,
+                                               cell_area,
+                                               expose_area,
+                                               0);
+                       }
+               }
        }
 
        protected void draw()
@@ -335,9 +362,9 @@ public class FisheyeList : Gtk.DrawingArea
                        0, 0, 0, 0,
                        allocation.width, allocation.height);
 
-               // Focus movement area
-               drawable.draw_rectangle(style.bg_gc[Gtk.StateType.INSENSITIVE], true,
-                       allocation.width/2, 0, allocation.width, allocation.height);
+               // Focus lock area
+               drawable.draw_rectangle(style.bg_gc[Gtk.StateType.ACTIVE], true,
+                       0, focus_starts[0], allocation.width/2, focus_starts[focus_end - focus_first]-focus_starts[0]);
 
                // Paint items around focus
                Gdk.Rectangle cell_area = Gdk.Rectangle();