From af768e2870043b0cb44827e9c412b2ce419cbafd Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 17 Mar 2010 18:21:55 -0700 Subject: [PATCH] Changed the embed/link dialog to use radio buttons instead of a checkbox to make the link/embed effect clearer. --- src/extension/internal/gdkpixbuf-input.cpp | 11 +++++++---- src/interface.cpp | 6 +++--- src/ui/clipboard.cpp | 7 ++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 3f78b3f36..a1295406c 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -30,7 +30,8 @@ static std::set create_lossy_set() SPDocument * GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) { - bool embed = !mod->get_param_bool("link"); + bool embed = (strcmp(mod->get_param_optiongroup("link"), "embed") == 0); + SPDocument *doc = NULL; GdkPixbuf *pb = Inkscape::IO::pixbuf_new_from_file( uri, NULL ); static std::set lossy = create_lossy_set(); @@ -147,9 +148,11 @@ GdkpixbufInput::init(void) "\n" "" N_("%s GDK pixbuf Input") "\n" "org.inkscape.input.gdkpixbuf.%s\n" - "false" + "\n" + "<_option value='embed'>" N_("embed") "\n" + "<_option value='link'>" N_("link") "\n" + "\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.") "\n" "\n" ".%s\n" "%s\n" diff --git a/src/interface.cpp b/src/interface.cpp index cb021db18..1a6da5635 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1465,8 +1465,8 @@ sp_ui_drag_data_received(GtkWidget *widget, ++i; } Inkscape::Extension::Extension *ext = *i; - bool save = ext->get_param_bool("link"); - ext->set_param_bool("link", false); + bool save = (strcmp(ext->get_param_optiongroup("link"), "embed") == 0); + ext->set_param_optiongroup("link", "embed"); ext->set_gui(false); gchar *filename = g_build_filename( g_get_tmp_dir(), "inkscape-dnd-import", NULL ); @@ -1474,7 +1474,7 @@ sp_ui_drag_data_received(GtkWidget *widget, file_import(doc, filename, ext); g_free(filename); - ext->set_param_bool("link", save); + ext->set_param_optiongroup("link", save ? "embed" : "link"); ext->set_gui(true); sp_document_done( doc , SP_VERB_NONE, _("Drop bitmap image")); diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index db509da2e..649f5408a 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -874,6 +874,7 @@ bool ClipboardManagerImpl::_pasteImage() Glib::RefPtr img = _clipboard->wait_for_image(); if (!img) return false; + // TODO unify with interface.cpp's sp_ui_drag_data_received() // AARGH stupid Inkscape::Extension::DB::InputList o; Inkscape::Extension::db.get_input_list(o); @@ -882,8 +883,8 @@ bool ClipboardManagerImpl::_pasteImage() ++i; } Inkscape::Extension::Extension *png = *i; - bool save = png->get_param_bool("link"); - png->set_param_bool("link", false); + bool save = (strcmp(png->get_param_optiongroup("link"), "embed") == 0); + png->set_param_optiongroup("link", "embed"); png->set_gui(false); gchar *filename = g_build_filename( g_get_tmp_dir(), "inkscape-clipboard-import", NULL ); @@ -891,7 +892,7 @@ bool ClipboardManagerImpl::_pasteImage() file_import(doc, filename, png); g_free(filename); - png->set_param_bool("link", save); + png->set_param_optiongroup("link", save ? "embed" : "link"); png->set_gui(true); return true; -- 2.30.2