The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Fix overview selection

These changes was commited to the Birdfont repository Sun, 19 Apr 2015 17:10:12 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Sun, 19 Apr 2015 17:10:12 +0000]

Updated Files

libbirdfont/OverView.vala
libbirdfont/OverViewItem.vala
--- a/libbirdfont/OverView.vala +++ b/libbirdfont/OverView.vala @@ -234,12 +234,26 @@ key_up (); update_scrollbar (); GlyphCanvas.redraw (); + hide_menu (); + + selected_item = get_selected_item (); + selected_items.clear (); + if (selected_item.glyphs != null) { + selected_items.add ((!) selected_item.glyphs); + } } public override void scroll_wheel_down (double x, double y) { key_down (); update_scrollbar (); GlyphCanvas.redraw (); + hide_menu (); + + selected_item = get_selected_item (); + selected_items.clear (); + if (selected_item.glyphs != null) { + selected_items.add ((!) selected_item.glyphs); + } } public override void selected_canvas () { @@ -348,8 +362,9 @@ int get_items_per_row () { int i = 1; - double l = OverViewItem.full_width (); - while (l < allocation.width) { + OverViewItem.margin = OverViewItem.width * 0.1; + double l = OverViewItem.margin + OverViewItem.full_width (); + while (l <= allocation.width) { l += OverViewItem.full_width (); i++; } @@ -365,8 +380,7 @@ double x, y; unichar character; Glyph glyph; - - OverViewItem.margin = OverViewItem.width * 0.1; + items_per_row = get_items_per_row (); rows = (int) (allocation.height / OverViewItem.full_height ()) + 2; @@ -465,9 +479,10 @@ } void draw_empty_canvas (WidgetAllocation allocation, Context cr) { - Text t = new Text (t_("No glyphs in this view."), 24); + Text t; cr.save (); + t = new Text (t_("No glyphs in this view."), 24); Theme.text_color (t, "Text Foreground"); t.widget_x = 40; t.widget_y = 40; @@ -678,6 +693,7 @@ } public override void key_press (uint keyval) { + hide_menu (); GlyphCanvas.redraw (); if (KeyBindings.modifier == CTRL) { @@ -1012,6 +1028,12 @@ } return index; + } + + public void hide_menu () { + foreach (OverViewItem i in visible_items) { + i.hide_menu (); + } } public override void button_press (uint button, double x, double y) {
--- a/libbirdfont/OverViewItem.vala +++ b/libbirdfont/OverViewItem.vala @@ -269,6 +269,15 @@ double py = y + height - 21; info.set_position (px, py); info.draw_icon (cr, selected); + } + + public void hide_menu () { + GlyphCollection g; + + if (glyphs != null) { + g = (!) glyphs; + g.get_version_list ().menu_visible = false; + } } private void draw_menu (Context cr) {