Commit ded7163
Import SVG files in overview
Changed files (2)
Diff
@@ -289,7 +289,37 @@ public class Menu : AbstractMenu { import_color_svg = add_menu_item (t_("Import SVG file"), "import svg file color", "Glyph"); import_color_svg.action.connect (() => {+ FontDisplay current_display = MainWindow.get_current_display ();+ OverView overview = MainWindow.get_overview ();+ + if (current_display is OverView) {+ GlyphCollection? gc;+ + gc = overview.get_selected_item ().glyphs;+ + OverViewItem item = overview.get_selected_item ();+ + if (gc == null) {+ // ignore control characters+ if (item.character <= 0x1F) {+ show_menu = false;+ return;+ }+ + gc = overview.create_new_glyph (item.character, false);+ }++ GlyphCanvas canvas = MainWindow.get_glyph_canvas ();+ canvas.set_current_glyph_collection ((!) gc, false);+ }+ SvgParser.import (SvgType.COLOR);+ + if (current_display is OverView) {+ overview.reset_thumbnails ();+ GlyphCanvas.redraw ();+ }+ show_menu = false; }); export_menu.items.add (import_color_svg);@@ -186,7 +186,7 @@ public class OverView : FontDisplay { FontDisplay.dirty_scrollbar = true; } - public GlyphCollection create_new_glyph (unichar character) {+ public GlyphCollection create_new_glyph (unichar character, bool select_tab = true) { StringBuilder name = new StringBuilder (); TabBar tabs = MainWindow.get_tab_bar (); bool selected;@@ -204,7 +204,10 @@ public class OverView : FontDisplay { glyph_tab = new GlyphTab (glyph_collection); glyph = glyph_collection.get_current (); glyph.layers.add_layer (new Layer ());- tabs.add_tab (glyph_tab, true, glyph_collection);+ + if (select_tab) {+ tabs.add_tab (glyph_tab, true, glyph_collection);+ } selected_items.add (glyph_collection); @@ -518,7 +521,7 @@ public class OverView : FontDisplay { GlyphCanvas.redraw (); } - OverViewItem get_selected_item () {+ public OverViewItem get_selected_item () { if (visible_items.size == 0) { return new OverViewItem (); }@@ -686,6 +689,7 @@ public class OverView : FontDisplay { for (int i = 0; i < visible_items.size; i++) { OverViewItem item = visible_items.get (i); item.clear_cache ();+ item.draw_glyph_from_font (); } update_item_list ();