Commit 70af652
Add glyph tab to tab bar instead of raw glyph
Changed files (7)
modifiedlibbirdfont/LoadCallback.valamodifiedlibbirdfont/MainWindow.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/RecentFiles.valamodifiedlibbirdfont/TabBar.valamodifiedlibbirdfont/Toolbox.valamodifiedlibbirdfont/VersionList.vala
Diff
@@ -86,8 +86,6 @@ public class LoadCallback : GLib.Object { f = BirdFont.new_font (); - MainWindow.clear_glyph_cache ();- f.set_file ((!) fn); Preferences.add_recent_files ((!) fn); MainWindow.native_window.load ();@@ -216,16 +216,6 @@ public class MainWindow : GLib.Object { public static bool select_tab (Tab t) { return tabs.selected_open_tab (t); } - - public static OverView get_overview () { - foreach (Tab t in tabs.tabs) { - if (t.get_display () is OverView) { - return (OverView) t.get_display (); - } - } - - return overview; - } public static SpacingClassTab get_spacing_class_tab () { return spacing_class_tab; @@ -275,21 +265,6 @@ public class MainWindow : GLib.Object { MainWindow.native_window.set_scrollbar_position (position); } } - - /** Reaload all paths and help lines from disk. */ - public static void clear_glyph_cache () { - Glyph g;- GlyphTab tab; - foreach (Tab t in get_tab_bar ().tabs) { - if (t.get_display () is GlyphTab) {- tab = (GlyphTab) t.get_display (); - g = tab.glyphs.get_current (); - g.add_help_lines (); - } - } - - GlyphCanvas.redraw (); - } public static void close_all_tabs () { get_tab_bar ().close_all_tabs (); @@ -343,6 +318,10 @@ public class MainWindow : GLib.Object { public static void set_toolbox (Toolbox tb) { tools = tb; } ++ public static OverView get_overview () { + return overview; + } } } @@ -95,7 +95,7 @@ public class OverView : FontDisplay { bool selected = tabs.select_char (n); GlyphCanvas canvas; Glyph g = glyph_collection.get_current (); - GlyphTab glyph_tab; + GlyphTab glyph_tab; if (!selected) { glyph_tab = new GlyphTab (glyph_collection);@@ -240,7 +240,6 @@ public class RecentFiles : Table { f = BirdFont.new_font (); - MainWindow.clear_glyph_cache (); MainWindow.close_all_tabs (); f.set_file (fn);@@ -21,7 +21,7 @@ public class TabBar : GLib.Object { public int width = 0; public int height = 0; - public Gee.ArrayList<Tab> tabs;+ private Gee.ArrayList<Tab> tabs; static const int NO_TAB = -1; static const int NEXT_TAB = -2;@@ -468,8 +468,7 @@ public class TabBar : GLib.Object { t = tabs.get (index); previous_tab = current_tab; current_tab = t;-- scroll_to_tab (selected, signal_selected);+ scroll_to_tab (selected, signal_selected); } private bool has_scroll () {@@ -581,8 +580,8 @@ public class TabBar : GLib.Object { public void add_tab (FontDisplay display_item, bool signal_selected = true, GlyphCollection? gc = null) { double tab_width = -1; bool always_open = false;- int s = (tabs.size == 0) ? 0 : selected + 1;- Tab t;+ int position = (tabs.size == 0) ? 0 : selected + 1;+ Tab tab; if (MenuTab.has_suppress_event ()) { warn_if_test ("Event suppressed");@@ -594,21 +593,21 @@ public class TabBar : GLib.Object { tab_width += 36; } - t = new Tab (display_item, tab_width, always_open);- tabs.insert (s,t);+ tab = new Tab (display_item, tab_width, always_open); + tabs.insert (position, tab); if (gc != null) {- t.set_glyph_collection ((!) gc);+ tab.set_glyph_collection ((!) gc); } - GlyphCanvas.set_display (t.get_display ());+ GlyphCanvas.set_display (tab.get_display ()); MainWindow.get_glyph_canvas ()- .set_current_glyph_collection (t.get_glyph_collection ());+ .set_current_glyph_collection (tab.get_glyph_collection ()); - select_tab (s, signal_selected);+ select_tab (position, signal_selected); }- + /** Returns true if the new item was added to the bar. */ public bool add_unique_tab (FontDisplay display_item, bool signal_selected = true) { bool i;@@ -127,6 +127,9 @@ public class Toolbox : GLib.Object { current_set = (ToolCollection) theme_tools; } else if (t != null && ((!) t).get_display () is GlyphTab) { current_set = (ToolCollection) drawing_tools;+ } else if (t != null && ((!) t).get_display () is Glyph) {+ warning ("Expecting GlyphTab instead of Glyph.");+ current_set = (ToolCollection) drawing_tools; } else { current_set = (ToolCollection) file_tools; }@@ -251,7 +251,7 @@ public class VersionList : GLib.Object { } updated_glyph = (!) ug;- tab.set_display (updated_glyph);+ tab.set_display (glyph_tab); updated_glyph.view_zoom = glyph.view_zoom; updated_glyph.view_offset_x = glyph.view_offset_x; updated_glyph.view_offset_y = glyph.view_offset_y;