The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Update open glyph and set zoom level after undo in overview tab

These changes was commited to the Birdfont repository Mon, 13 Jun 2016 13:32:00 +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 13:32:00 +0000 (15:32 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 13 Jun 2016 13:32:00 +0000 (15:32 +0200)
commit cc6706cbbd2b53fad835b920b07d545540f9a181
tree 05b3a625f5eb6c312e7b03e62d9e1b827db98cc1
parent 1ddf8b9a6bb8f05f52f103c58bffc11bd59f9f9e
Update open glyph and set zoom level after undo in overview tab

libbirdfont/OverView.vala
--- a/libbirdfont/OverView.vala +++ b/libbirdfont/OverView.vala @@ -93,16 +93,13 @@ TabBar tabs = MainWindow.get_tab_bar (); string n = glyph_collection.get_current ().name; bool selected = tabs.select_char (n); - GlyphCanvas canvas; Glyph g = glyph_collection.get_current (); GlyphTab glyph_tab; if (!selected) { glyph_tab = new GlyphTab (glyph_collection); - canvas = MainWindow.get_glyph_canvas (); tabs.add_tab (glyph_tab, true, glyph_collection); - canvas.set_current_glyph_collection (glyph_collection); - set_initial_zoom (); + set_glyph_zoom (glyph_collection); PenTool.update_orientation (); } }); @@ -196,7 +193,7 @@ canvas = MainWindow.get_glyph_canvas (); canvas.set_current_glyph_collection (glyph_collection); - set_initial_zoom (); + set_glyph_zoom (glyph_collection); } else { warning ("Glyph is already open"); } @@ -284,15 +281,18 @@ return null; } - public void set_initial_zoom () { + public void set_glyph_zoom (GlyphCollection glyphs) { + GlyphCanvas canvas; + canvas = MainWindow.get_glyph_canvas (); + canvas.set_current_glyph_collection (glyphs); Toolbox tools = MainWindow.get_toolbox (); ZoomTool z = (ZoomTool) tools.get_tool ("zoom_tool"); z.store_current_view (); - MainWindow.get_current_glyph ().default_zoom (); + glyphs.get_current ().default_zoom (); z.store_current_view (); OverViewItem.reset_label (); } - + public double get_height () { double l; Font f; @@ -1053,6 +1053,16 @@ if (g.length () > 0) { font.add_glyph_collection (g); + } + + TabBar tabs = MainWindow.get_tab_bar (); + Tab? tab = tabs.get_tab (g.get_name ()); + + if (tab != null) { + Tab t = (!) tab; + set_glyph_zoom (g); + t.set_glyph_collection (g); + t.set_display (new GlyphTab (g)); } } @@ -1078,6 +1088,16 @@ foreach (GlyphCollection g in previous_collection.glyphs) { font.delete_glyph (g); font.add_glyph_collection (g); + + TabBar tabs = MainWindow.get_tab_bar (); + Tab? tab = tabs.get_tab (g.get_name ()); + + if (tab != null) { + Tab t = (!) tab; + set_glyph_zoom (g); + t.set_glyph_collection (g); + t.set_display (new GlyphTab (g)); + } } font.alternates = previous_collection.alternate_sets.copy ();