Commit ca0c4b4
Update toolbox when glyphs are inserted into to kerning tab from overview
Changed files (3)
modifiedlibbirdfont/GlyphSelection.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/OverviewTools.vala
Diff
@@ -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,14 +51,8 @@ public class GlyphSelection : OverView { 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 (); } } @@ -76,7 +76,9 @@ public class OverView : FontDisplay { 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 @@ public class OverView : FontDisplay { }); } - 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 @@ public class OverView : FontDisplay { 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 @@ public class OverView : FontDisplay { 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 @@ public class OverView : FontDisplay { 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 @@ public class OverView : FontDisplay { update_item_list (); } - // FIXME: update_item_list (); GlyphCanvas.redraw (); } @@ -54,7 +54,7 @@ public class OverviewTools : ToolCollection { 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 @@ public class OverviewTools : ToolCollection { 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 @@ public class OverviewTools : ToolCollection { 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);