The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Add glyphs from overivew to spacing class

These changes was commited to the Birdfont repository Mon, 13 Jun 2016 09:19:33 +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>
Mon, 13 Jun 2016 09:19:33 +0000 (11:19 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 13 Jun 2016 09:19:33 +0000 (11:19 +0200)
commit 4a03e1e42fe8a6aae26f9ced527791c9eaa114b8
tree d9bb8fcabd31642e07e6865ec9140bf4f7cb5482
parent 8e40a9aabd00e361b6a1e23756156901f75493ca
Add glyphs from overivew to spacing class

libbirdfont/AbstractMenu.vala
libbirdfont/GlyphSelection.vala
libbirdfont/SpacingClassTab.vala
libbirdfont/SpacingClassTools.vala
libbirdfont/Toolbox.vala
--- a/libbirdfont/AbstractMenu.vala +++ b/libbirdfont/AbstractMenu.vala @@ -231,6 +231,7 @@ public void add_tool_key_bindings () { ToolItem tool_item; + foreach (ToolCollection tool_set in MainWindow.get_toolbox ().tool_sets) { foreach (Expander e in tool_set.get_expanders ()) { foreach (Tool t in e.tool) {
--- a/libbirdfont/GlyphSelection.vala +++ b/libbirdfont/GlyphSelection.vala @@ -27,7 +27,9 @@ FontDisplay.dirty_scrollbar = true; open_glyph_signal.connect ((gc) => { - selected_glyph (gc); + print(@"name $(gc.get_name ())\n"); + print(@"g name $(gc.get_current ().get_name ())\n"); + selected_glyph (gc); Toolbox.redraw_tool_box (); });
--- a/libbirdfont/SpacingClassTab.vala +++ b/libbirdfont/SpacingClassTab.vala @@ -29,6 +29,17 @@ public override Gee.ArrayList<Row> get_rows () { return rows; + } + + public static void set_class (string glyph) { + print(@"G: $(glyph)\n"); + if (current_class_first_element) { + current_class.first = glyph; + } else { + current_class.next = glyph; + } + + MainWindow.get_spacing_class_tab ().update_rows (); } public override void selected_row (Row row, int column, bool delete_button) { @@ -56,11 +67,13 @@ } current_class = spacing.classes.get (row.get_index ()); current_class.set_first (); + current_class_first_element = true; font.touch (); } else if (column == 2) { return_if_fail (0 <= row.get_index () < spacing.classes.size); current_class = spacing.classes.get (row.get_index ()); - current_class .set_next (); + current_class.set_next (); + current_class_first_element = false; font.touch (); } }
--- a/libbirdfont/SpacingClassTools.vala +++ b/libbirdfont/SpacingClassTools.vala @@ -21,6 +21,11 @@ public static Gee.ArrayList<Expander> expanders; public SpacingClassTools () { + expanders = new Gee.ArrayList<Expander> (); + + Expander font_name = new Expander (); + font_name.add_tool (new FontName ()); + Expander spacing_class_tools = new Expander (); Tool insert = new Tool ("insert_glyph_from_overview_in_spacing_class", t_("Insert glyph from overview")); @@ -30,15 +35,20 @@ GlyphSelection glyph_selection = new GlyphSelection (); glyph_selection.selected_glyph.connect ((glyph_collection) => { - SpacingClassTab.current_class.update_class (glyph_collection.get_name (), - SpacingClassTab.current_class_first_element); + print (@"glyph_collection.get_name (): $(glyph_collection.get_name ())\n"); + SpacingClassTab.set_class (glyph_collection.get_name ()); MainWindow.get_tab_bar ().select_tab_name ("SpacingClasses"); }); GlyphCanvas.set_display (glyph_selection); self.set_selected (false); + + TabContent.hide_text_input (); }); spacing_class_tools.add_tool (insert); + + expanders.add (font_name); + expanders.add (spacing_class_tools); } public override Gee.ArrayList<Expander> get_expanders () {
--- a/libbirdfont/Toolbox.vala +++ b/libbirdfont/Toolbox.vala @@ -126,6 +126,8 @@ current_set = (ToolCollection) overview_tools; } else if (tab_name == "Backgrounds") { current_set = (ToolCollection) background_tools; + } else if (tab_name == "SpacingClasses") { + current_set = (ToolCollection) spacing_class_tools; } else if (tab_name == "Themes") { current_set = (ToolCollection) theme_tools; } else if (t != null && ((!) t).get_display () is GlyphTab) {