The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Reset zoom when new glyphs are selected in the version list

These changes was commited to the Birdfont repository Thu, 28 May 2015 11:08:43 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Thu, 28 May 2015 11:08:43 +0000]

Updated Files

libbirdfont/VersionList.vala
--- a/libbirdfont/VersionList.vala +++ b/libbirdfont/VersionList.vala @@ -73,7 +73,7 @@ add_glyph (g, false); } - set_selected_version (gc.get_current ().version_id); + set_selected_version (gc.get_current ().version_id, false); n_lists++; } @@ -135,9 +135,9 @@ return 0; } - public void set_selected_version (int version_id) { + public void set_selected_version (int version_id, bool update_loaded_glyph) { current_version_id = version_id; - update_selection (); + update_selection (update_loaded_glyph); } public Glyph get_current () { @@ -152,7 +152,7 @@ if (unlikely (glyphs.size > 0)) { warning (@"Can not find current glyph for id $current_version_id"); gl = glyphs.get (glyphs.size - 1); - set_selected_version (((!) gl).version_id); + set_selected_version (((!) gl).version_id, false); return (!) gl; } @@ -177,7 +177,7 @@ return glyphs.get (glyphs.size - 1).version_id; } - private void set_selected_item (MenuAction ma) { + private void set_selected_item (MenuAction ma, bool update_loaded_glyph = true) { int i = ma.index; Glyph current_glyph; Glyph g; @@ -193,7 +193,7 @@ reload_all_open_glyphs (); - if (!is_null (BirdFont.current_glyph_collection)) { + if (update_loaded_glyph && !is_null (BirdFont.current_glyph_collection)) { current_glyph = MainWindow.get_current_glyph (); g.set_allocation (current_glyph.allocation); g.close_path (); @@ -285,12 +285,12 @@ return false; } - void update_selection () { + void update_selection (bool update_loaded_glyph = true) { int index; if (has_version (current_version_id)) { index = get_current_version_index (); - set_selected_item (get_action_index (index + 1)); // the first item is the "new version" + set_selected_item (get_action_index (index + 1), update_loaded_glyph); // the first item is the "new version" } }