diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2012-03-18 19:13:44 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2012-03-18 19:13:44 +0000 |
| commit | 6dc600fc4521fb8c547e8f16930487e8ada99766 (patch) | |
| tree | 00c75e78331f07762f9a67ce4e06706d25dd2c17 /src/extension | |
| parent | Change finalization order in SPObject: delete signals before calling (diff) | |
| download | inkscape-6dc600fc4521fb8c547e8f16930487e8ada99766.tar.gz inkscape-6dc600fc4521fb8c547e8f16930487e8ada99766.zip | |
Import. Bitmap import improvements (see Bugs #171842 and #847374).
(bzr r11097)
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/internal/gdkpixbuf-input.cpp | 46 | ||||
| -rw-r--r-- | src/extension/system.cpp | 16 |
2 files changed, 47 insertions, 15 deletions
diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index deb354d00..4519befcf 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -8,6 +8,7 @@ #include "extension/input.h" #include "extension/system.h" #include "gdkpixbuf-input.h" +#include "preferences.h" #include "selection-chemistry.h" #include "sp-image.h" #include "document-undo.h" @@ -33,7 +34,20 @@ static std::set<Glib::ustring> create_lossy_set() SPDocument * GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) { - bool embed = (strcmp(mod->get_param_optiongroup("link"), "embed") == 0); + bool embed = false; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring attr = prefs->getString("/dialogs/import/link"); + if (strcmp(attr.c_str(), "embed") == 0) { + embed = true; + } else if (strcmp(attr.c_str(), "link") == 0) { + embed = false; + } else { + embed = (strcmp(mod->get_param_optiongroup("link"), "embed") == 0); + if (mod->get_param_bool("ask")) { + prefs->setString("/dialogs/import/link", mod->get_param_optiongroup("link")); + mod->set_param_bool("ask", false); + } + } SPDocument *doc = NULL; GdkPixbuf *pb = Inkscape::IO::pixbuf_new_from_file( uri, NULL ); @@ -146,22 +160,24 @@ GdkpixbufInput::init(void) if (strcmp(extensions[i], "svg.gz") == 0) { continue; } - gchar *caption = g_strdup_printf(_("%s GDK pixbuf Input"), name); + gchar *caption = g_strdup_printf(_("%s bitmap image import"), name); + gchar *xmlString = g_strdup_printf( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" - "<name>%s</name>\n" - "<id>org.inkscape.input.gdkpixbuf.%s</id>\n" - "<param name='link' type='optiongroup' appearance='full' _gui-text='" N_("Link or embed image:") "' >\n" - "<_option value='embed'>" N_("Embed") "</_option>\n" - "<_option value='link'>" N_("Link") "</_option>\n" - "</param>\n" - "<_param name='help' type='description'>" N_("Embed results in stand-alone, larger SVG files. Link references a file outside this SVG document and all files must be moved together.") "</_param>\n" - "<input>\n" - "<extension>.%s</extension>\n" - "<mimetype>%s</mimetype>\n" - "<filetypename>%s (*.%s)</filetypename>\n" - "<filetypetooltip>%s</filetypetooltip>\n" - "</input>\n" + "<name>%s</name>\n" + "<id>org.inkscape.input.gdkpixbuf.%s</id>\n" + "<param name='link' type='optiongroup' appearance='full' _gui-text='" N_("Link or embed image:") "' >\n" + "<_option value='embed' >" N_("Embed") "</_option>\n" + "<_option value='link' >" N_("Link") "</_option>\n" + "</param>\n" + "<_param name='help' type='description'>" N_("Embed results in stand-alone, larger SVG files. Link references a file outside this SVG document and all files must be moved together.") "</_param>\n" + "<param name=\"ask\" _gui-description='" N_("Hide the dialog next time and always apply the same action.") "' gui-text=\"" N_("Don't ask again") "\" type=\"boolean\" >false</param>\n" + "<input>\n" + "<extension>.%s</extension>\n" + "<mimetype>%s</mimetype>\n" + "<filetypename>%s (*.%s)</filetypename>\n" + "<filetypetooltip>%s</filetypetooltip>\n" + "</input>\n" "</inkscape-extension>", caption, extensions[i], diff --git a/src/extension/system.cpp b/src/extension/system.cpp index b3e9beebf..ebad0c050 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -88,6 +88,19 @@ SPDocument *open(Extension *key, gchar const *filename) throw Input::no_extension_found(); } + // Hide pixbuf extensions depending on user preferences. + //g_warning("Extension: %s", imod->get_id()); + + bool show = true; + if (strlen(imod->get_id()) > 27) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring attr = prefs->getString("/dialogs/import/link"); + Glib::ustring id = Glib::ustring(imod->get_id(), 28); + if (strcmp(attr.c_str(), "ask") != 0 and strcmp(id.c_str(), "org.inkscape.input.gdkpixbuf") == 0) { + show = false; + imod->set_gui(false); + } + } imod->set_state(Extension::STATE_LOADED); if (!imod->loaded()) { @@ -112,6 +125,9 @@ SPDocument *open(Extension *key, gchar const *filename) } doc->setUri(filename); + if (!show) { + imod->set_gui(true); + } return doc; } |
