summaryrefslogtreecommitdiffstats
path: root/src/extension/internal
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2012-03-18 19:13:44 +0000
committerJazzyNico <nicoduf@yahoo.fr>2012-03-18 19:13:44 +0000
commit6dc600fc4521fb8c547e8f16930487e8ada99766 (patch)
tree00c75e78331f07762f9a67ce4e06706d25dd2c17 /src/extension/internal
parentChange finalization order in SPObject: delete signals before calling (diff)
downloadinkscape-6dc600fc4521fb8c547e8f16930487e8ada99766.tar.gz
inkscape-6dc600fc4521fb8c547e8f16930487e8ada99766.zip
Import. Bitmap import improvements (see Bugs #171842 and #847374).
(bzr r11097)
Diffstat (limited to 'src/extension/internal')
-rw-r--r--src/extension/internal/gdkpixbuf-input.cpp46
1 files changed, 31 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],