Code

Changed the embed/link dialog to use radio buttons instead of a checkbox to make...
authorJon A. Cruz <jon@joncruz.org>
Thu, 18 Mar 2010 01:21:55 +0000 (18:21 -0700)
committerJon A. Cruz <jon@joncruz.org>
Thu, 18 Mar 2010 01:21:55 +0000 (18:21 -0700)
src/extension/internal/gdkpixbuf-input.cpp
src/interface.cpp
src/ui/clipboard.cpp

index 3f78b3f36f78904e15342b1ec4e3d21f28564aac..a1295406c09c00a470e356a620bb3f5308c80f1d 100644 (file)
@@ -30,7 +30,8 @@ static std::set<Glib::ustring> 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<Glib::ustring> lossy = create_lossy_set();
@@ -147,9 +148,11 @@ GdkpixbufInput::init(void)
                 "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
                     "<name>" N_("%s GDK pixbuf Input") "</name>\n"
                     "<id>org.inkscape.input.gdkpixbuf.%s</id>\n"
-                    "<param name=\"link\" gui-text=\""
-                        N_("Link to image? (Leave unchecked to embed)")
-                        "\" type=\"boolean\">false</param>"
+                    "<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"
index cb021db18132c14c9812c4c2de3ece980e7588b1..1a6da5635d5ae2fbbc70bc19fc2bd419ef73c36e 100644 (file)
@@ -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"));
index db509da2e2cc9efc85c9bae7c2393f8c97c2ff7a..649f5408a2b561815748e102bcb2f8cd47f738ca 100644 (file)
@@ -874,6 +874,7 @@ bool ClipboardManagerImpl::_pasteImage()
     Glib::RefPtr<Gdk::Pixbuf> 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;