Introducing the prefix area
authorEnrico Zini <enrico@enricozini.org>
Mon, 14 Dec 2009 17:42:39 +0000 (17:42 +0000)
committerEnrico Zini <enrico@enricozini.org>
Mon, 14 Dec 2009 17:42:39 +0000 (17:42 +0000)
gtkfisheyelist/gtkfisheyelistview.vala

index dc49c73d365319faf4ef6f94bb9edaea17da63a6..9599dbedf82c001ecf46a7e5ba9d9e0a03a277d1 100644 (file)
@@ -203,9 +203,9 @@ public class FisheyeListView : Gtk.DrawingArea
 
                if (is_fisheye)
                {
-                       focus_locked = !focus_layout_needed && x < allocation.width/2 && y >= focus_area_start+focus_info[0].y && y < focus_area_start+focus_info[focus_end - focus_first].y;
+                       focus_locked = !focus_layout_needed && x < allocation.width/3 && y >= focus_area_start+focus_info[0].y && y < focus_area_start+focus_info[focus_end - focus_first].y;
 
-                       if (y < focus_area_start+focus_info[0].y || y >= focus_area_start+focus_info[focus_end - focus_first].y)
+                       if (!focus_locked || y < focus_area_start+focus_info[0].y || y >= focus_area_start+focus_info[focus_end - focus_first].y)
                                cur_el = y * (label_cache.length+1) / allocation.height;
                        else
                                for (int idx = 0; idx < focus_info.length; ++idx)
@@ -423,16 +423,16 @@ public class FisheyeListView : Gtk.DrawingArea
 
                // Focus movement area
                drawable.draw_rectangle(style.bg_gc[Gtk.StateType.INSENSITIVE], true,
-                       allocation.width/2, 0, allocation.width, allocation.height);
+                       allocation.width/3, 0, allocation.width/3, allocation.height);
 
                for (int y = 0; y < allocation.height/2 - 30; y += 30)
                {
                        Gtk.paint_arrow(style, (Gdk.Window*)drawable, Gtk.StateType.INSENSITIVE, Gtk.ShadowType.NONE,
                                null, this, null, Gtk.ArrowType.UP, false,
-                               allocation.width/2, y, allocation.width/2, 10);
+                               allocation.width/3, y, allocation.width/3, 10);
                        Gtk.paint_arrow(style, (Gdk.Window*)drawable, Gtk.StateType.INSENSITIVE, Gtk.ShadowType.NONE,
                                null, this, null, Gtk.ArrowType.DOWN, false,
-                               allocation.width/2, allocation.height-y-30, allocation.width/2, 10);
+                               allocation.width/3, allocation.height-y-30, allocation.width/3, 10);
                }
 
                // Draw tiny labels
@@ -488,21 +488,16 @@ public class FisheyeListView : Gtk.DrawingArea
                layout.set_alignment(Pango.Alignment.RIGHT);
                layout.set_width(allocation.width*Pango.SCALE/3);
                layout.set_height(0);
-//stderr.printf("HEIGHT %d+%d = %d\n", lr.y, lr.height, lr.y + lr.height);
-               //layout.set_wrap(Pango.WrapMode.
                layout.set_ellipsize(Pango.EllipsizeMode.END);
 
                int last_covered = 0;
 
                for (weak List<PrefixInfo> i = prefixes; i != null; i = i.next)
                {
-stderr.printf("DRAW %s at %d lc %d\n", i.data.prefix, i.data.layout_pos, last_covered);
                        if (i.data.layout_pos < last_covered)
-                       {
                                i.data.layout_pos = last_covered;
-                       }
                        layout.set_text(i.data.prefix, int.max(10, (int)i.data.pfx_len));
-                       Gtk.paint_layout(style, (Gdk.Window*)drawable, Gtk.StateType.NORMAL, true, null, this, null, allocation.width*2/3, i.data.layout_pos, layout);
+                       Gtk.paint_layout(style, (Gdk.Window*)drawable, Gtk.StateType.INSENSITIVE, true, null, this, null, allocation.width*2/3, i.data.layout_pos, layout);
                        last_covered = i.data.layout_pos + label_height;
                }
        }
@@ -532,12 +527,12 @@ stderr.printf("DRAW %s at %d lc %d\n", i.data.prefix, i.data.layout_pos, last_co
                {
                        // Focus lock area
                        drawable.draw_rectangle(style.bg_gc[Gtk.StateType.ACTIVE], true,
-                               0, focus_area_start + focus_info[0].y, allocation.width/2, focus_info[focus_end - focus_first].y);
+                               0, focus_area_start + focus_info[0].y, allocation.width/3, focus_info[focus_end - focus_first].y);
 
                        // Paint items around focus
                        Gdk.Rectangle cell_area = Gdk.Rectangle();
                        cell_area.x = 0;
-                       cell_area.width = allocation.width;
+                       cell_area.width = expose_area.width;
                        for (int idx = 0; idx < focus_info.length; ++idx)
                        {
                                var renderer = renderers[focus_info[idx].renderer];
@@ -549,7 +544,7 @@ stderr.printf("DRAW %s at %d lc %d\n", i.data.prefix, i.data.layout_pos, last_co
                                {
                                        rflags |= Gtk.CellRendererState.SELECTED | Gtk.CellRendererState.FOCUSED;
                                        drawable.draw_rectangle(style.bg_gc[Gtk.StateType.SELECTED], true,
-                                                       cell_area.x, cell_area.y, cell_area.width, cell_area.height);
+                                                       cell_area.x, cell_area.y, allocation.width, cell_area.height);
                                }
                        
                                renderer.text = label_cache[idx + focus_first];