The Birdfont Source Code


All Repositories / birdfont.git / blobdiff – RSS feed

Merge branch 'master' of github.com:johanmattssonm/birdfont

Changes made to libbirdfont/Menu.vala

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
--- libbirdfont/Menu.vala +++ libbirdfont/Menu.vala @@ -287,9 +287,39 @@ MenuItem import_color_svg; import_color_svg = add_menu_item (t_("Import SVG file"), - "import svg file color", "Glyph"); + "import svg file color", ""); 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);