From e6616e3a2aa1ffa83fe173e2180849d1ca14a49d Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sun, 13 May 2018 16:35:04 +0200 Subject: Fix bug embeding SVG as PNG --- src/extension/internal/svg.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/extension/internal/svg.cpp') diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index bf4924b2a..41fca734f 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -137,12 +137,11 @@ Svg::init(void) "\n" "" N_("SVG Input") "\n" "" SP_MODULE_KEY_INPUT_SVG "\n" - "\n" - "<_option value='include' >" N_("Include SVG image as editable object(s) in the current file") "\n" - "<_option value='link' >" N_("Link the SVG file in a image tag (not editable in this document") "\n" - "<_option value='embed' >" N_("Embed the SVG file in a image tag (not editable in this document") "\n" + "\n" + "<_option value='include' >" N_("Include") "\n" + "<_option value='embed' >" N_("Embed") "\n" + "<_option value='link' >" N_("Link") "\n" "\n" - "\n" "<_option value='auto' >" N_("None (auto)") "\n" "<_option value='optimizeQuality' >" N_("Smooth (optimizeQuality)") "\n" @@ -206,19 +205,19 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) const auto path = file->get_path(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool ask = prefs->getBool("/dialogs/import/ask"); - Glib::ustring method = prefs->getString("/dialogs/import/method"); + Glib::ustring link_svg = prefs->getString("/dialogs/import/link_svg"); Glib::ustring scale = prefs->getString("/dialogs/import/scale"); bool is_import = false; if (strcmp(prefs->getString("/options/openmethod/value").c_str(), "import") == 0) { is_import = true; } if(INKSCAPE.use_gui() && is_import && ask) { - Glib::ustring mod_method = mod->get_param_optiongroup("method"); + Glib::ustring mod_link_svg = mod->get_param_optiongroup("link_svg"); Glib::ustring mod_scale = mod->get_param_optiongroup("scale"); - if( method.compare( mod_method) != 0 ) { - method = mod_method; + if( link_svg.compare( mod_link_svg) != 0 ) { + link_svg = mod_link_svg; } - prefs->setString("/dialogs/import/method", method ); + prefs->setString("/dialogs/import/link_svg", link_svg ); if( scale.compare( mod_scale ) != 0 ) { scale = mod_scale; } @@ -227,8 +226,8 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) } SPDocument * doc = SPDocument::createNewDoc (NULL, TRUE, TRUE); - if (method.compare("include") != 0 && is_import) { - bool embed = ( method.compare( "embed" ) == 0 ); + if (link_svg.compare("include") != 0 && is_import) { + bool embed = ( link_svg.compare( "embed" ) == 0 ); SPDocument * ret = SPDocument::createNewDoc(uri, TRUE); SPNamedView *nv = sp_document_namedview(doc, NULL); Glib::ustring display_unit = nv->display_units->abbr; @@ -257,7 +256,7 @@ Svg::open (Inkscape::Extension::Input *mod, const gchar *uri) if (embed) { std::unique_ptr pb(Inkscape::Pixbuf::create_from_file(uri)); if(pb) { - sp_embed_image(image_node, pb.get()); + sp_embed_svg(image_node, uri); } } else { gchar* _uri = g_filename_to_uri(uri, NULL, NULL); -- cgit v1.2.3