Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / extension / internal / gdkpixbuf-input.cpp
index 69fdbcfd1dc02e1f1ca9023a6f211257c0432aae..c3a30a2f002f072dcc1ed128a2274d1058b7857a 100644 (file)
@@ -2,6 +2,7 @@
 # include <config.h>
 #endif
 #include <glib/gprintf.h>
+#include <glibmm/i18n.h>
 #include "document-private.h"
 #include <dir-util.h>
 #include "extension/input.h"
@@ -55,8 +56,8 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri)
         }
 
         doc = SPDocument::createNewDoc(NULL, TRUE, TRUE);
-        bool saved = SPDocumentUndo::get_undo_sensitive(doc);
-               SPDocumentUndo::set_undo_sensitive(doc, false); // no need to undo in this temporary document
+        bool saved = DocumentUndo::getUndoSensitive(doc);
+        DocumentUndo::setUndoSensitive(doc, false); // no need to undo in this temporary document
 
         double width = gdk_pixbuf_get_width(pb);
         double height = gdk_pixbuf_get_height(pb);
@@ -78,7 +79,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri)
         }
 
         // Create image node
-        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
+        Inkscape::XML::Document *xml_doc = doc->getReprDoc();
         Inkscape::XML::Node *image_node = xml_doc->createElement("svg:image");
         sp_repr_set_svg_double(image_node, "width", width);
         sp_repr_set_svg_double(image_node, "height", height);
@@ -99,11 +100,11 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri)
         g_object_unref(pb);
 
         // Add it to the current layer
-        SP_DOCUMENT_ROOT(doc)->appendChildRepr(image_node);
+        doc->getRoot()->appendChildRepr(image_node);
         Inkscape::GC::release(image_node);
         fit_canvas_to_drawing(doc);
         // restore undo, as now this document may be shown to the user if a bitmap was opened
-               SPDocumentUndo::set_undo_sensitive(doc, saved);
+        DocumentUndo::setUndoSensitive(doc, saved);
     } else {
         printf("GdkPixbuf loader failed\n");
     }
@@ -143,10 +144,10 @@ GdkpixbufInput::init(void)
             if (strcmp(extensions[i], "svg.gz") == 0) {
                 continue;
             }
-
+            gchar *caption = g_strdup_printf(_("%s GDK pixbuf Input"), name);
             gchar *xmlString = g_strdup_printf(
                 "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
-                    "<name>" N_("%s GDK pixbuf Input") "</name>\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"
@@ -160,7 +161,7 @@ GdkpixbufInput::init(void)
                         "<filetypetooltip>%s</filetypetooltip>\n"
                     "</input>\n"
                 "</inkscape-extension>",
-                name,
+                caption,
                 extensions[i],
                 extensions[i],
                 mimetypes[j],
@@ -171,6 +172,7 @@ GdkpixbufInput::init(void)
 
             Inkscape::Extension::build_from_mem(xmlString, new GdkpixbufInput());
             g_free(xmlString);
+            g_free(caption);
         }}
 
         g_free(name);
@@ -193,4 +195,4 @@ GdkpixbufInput::init(void)
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :