The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Update toolbox when glyphs are inserted into to kerning tab from overview

These changes was commited to the Birdfont repository Wed, 23 Sep 2015 13:03:10 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Wed, 23 Sep 2015 13:03:10 +0000 (15:03 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Wed, 23 Sep 2015 13:03:10 +0000 (15:03 +0200)
commit ca0c4b422f3924042959dc409c7d7dd6f9a6a18d
tree f7f6f6c6403de136502019b8ca4b7f2a0f0d006a
parent 7c50656beb22c79364fafd224a1379f5c2da2dcb
Update toolbox when glyphs are inserted into to kerning tab from overview

libbirdfont/GlyphSelection.vala
libbirdfont/OverView.vala
libbirdfont/OverviewTools.vala
--- a/libbirdfont/GlyphSelection.vala +++ b/libbirdfont/GlyphSelection.vala @@ -14,13 +14,36 @@ namespace BirdFont { + /** A tab for picking characters in the font. */ public class GlyphSelection : OverView { public signal void selected_glyph (GlyphCollection gc); public GlyphSelection () { - base (null, false); + base (null, false, false); + update_default_characterset (); + OverviewTools.update_overview_characterset (this); + FontDisplay.dirty_scrollbar = true; + + open_glyph_signal.connect ((gc) => { + selected_glyph (gc); + Toolbox.redraw_tool_box (); + }); + + Toolbox.set_toolbox_from_tab (get_name ()); + + IdleSource idle = new IdleSource (); + + idle.set_callback (() => { + update_default_characterset (); + return false; + }); + + idle.attach (null); + } + + void update_default_characterset () { if (BirdFont.get_current_font ().length () > 0) { display_all_available_glyphs (); } else { @@ -28,16 +51,10 @@ DefaultCharacterSet.use_default_range (gr); set_current_glyph_range (gr); } - - OverviewTools.update_overview_characterset (this); - FontDisplay.dirty_scrollbar = true; - open_glyph_signal.connect ((gc) => { - selected_glyph (gc); - Toolbox.redraw_tool_box (); - }); + update_item_list (); } } }
--- a/libbirdfont/OverView.vala +++ b/libbirdfont/OverView.vala @@ -76,7 +76,9 @@ double scroll_size = 1; const double UCD_LINE_HEIGHT = 17 * 1.3; - public OverView (GlyphRange? range = null, bool open_selected = true) { + public OverView (GlyphRange? range = null, + bool open_selected = true, bool default_character_set = true) { + GlyphRange gr; if (range == null) { @@ -111,19 +113,21 @@ }); } - IdleSource idle = new IdleSource (); + if (default_character_set) { + IdleSource idle = new IdleSource (); - idle.set_callback (() => { - use_default_character_set (); - selected_canvas (); - return false; - }); - - idle.attach (null); + idle.set_callback (() => { + use_default_character_set (); + selected_canvas (); + return false; + }); + + idle.attach (null); + } + update_item_list (); update_scrollbar (); reset_zoom (); - update_item_list (); } public void select_all_glyphs () { @@ -446,12 +450,15 @@ int get_items_per_row () { int i = 1; + double tab_with = allocation.width; OverViewItem.margin = OverViewItem.width * 0.1; double l = OverViewItem.margin + OverViewItem.full_width (); - while (l <= allocation.width) { + + while (l <= tab_with) { l += OverViewItem.full_width (); i++; } + return i - 1; } @@ -464,6 +471,9 @@ double x, y; unichar character; Glyph glyph; + double tab_with; + + tab_with = allocation.width - 30; // scrollbar items_per_row = get_items_per_row (); rows = (int) (allocation.height / OverViewItem.full_height ()) + 2; @@ -506,7 +516,7 @@ x += OverViewItem.full_width (); - if (x + OverViewItem.full_width () >= allocation.width) { + if (x + OverViewItem.full_width () >= tab_with) { x = OverViewItem.margin; y += OverViewItem.full_height (); } @@ -1202,7 +1212,6 @@ update_item_list (); } - // FIXME: update_item_list (); GlyphCanvas.redraw (); }
--- a/libbirdfont/OverviewTools.vala +++ b/libbirdfont/OverviewTools.vala @@ -54,7 +54,7 @@ all_glyphs.select_action.connect ((self) => { OverView overview = get_overview (); overview.display_all_available_glyphs (); - update_overview_characterset (); + update_overview_characterset (overview); FontDisplay.dirty_scrollbar = true; }); character_sets.add_tool (all_glyphs); @@ -66,7 +66,7 @@ GlyphRange gr = new GlyphRange (); DefaultCharacterSet.use_default_range (gr); overview.set_current_glyph_range (gr); - update_overview_characterset (); + update_overview_characterset (overview); FontDisplay.dirty_scrollbar = true; }); character_sets.add_tool (default_glyphs); @@ -78,7 +78,7 @@ GlyphRange gr = new GlyphRange (); DefaultCharacterSet.use_full_unicode_range (gr); overview.set_current_glyph_range (gr); - update_overview_characterset (); + update_overview_characterset (overview); FontDisplay.dirty_scrollbar = true; }); character_sets.add_tool (unicode);