From 99782f7d46ac7a656babf272ac84b0717d581a5a Mon Sep 17 00:00:00 2001 From: gouldtj Date: Mon, 31 Jul 2006 05:15:25 +0000 Subject: [PATCH] r13109@tres: ted | 2006-07-30 22:11:20 -0700 Making this all work with the Inkscape world view. --- src/extension/internal/wpg-input.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 13335cf79..fc730a3ce 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -43,6 +43,7 @@ #include "wpg-input.h" #include "extension/system.h" #include "extension/input.h" +#include "document.h" #include "libwpg/libwpg.h" #include "libwpg/WPGStreamImplementation.h" @@ -77,9 +78,19 @@ private: FillRule m_fillRule; int m_gradientIndex; void writeStyle(); + void printf (char * fmt, ...) { + va_list args; + va_start(args, fmt); + gchar * buf = g_strdup_vprintf(fmt, args); + va_end(args); + if (buf) { + document += buf; + g_free(buf); + } + } public: - std::string document; + Glib::ustring document; }; InkscapePainter::InkscapePainter(): m_fillRule(AlternatingFill), m_gradientIndex(1) @@ -88,6 +99,7 @@ InkscapePainter::InkscapePainter(): m_fillRule(AlternatingFill), m_gradientIndex void InkscapePainter::startDocument(double width, double height) { + document = ""; printf("\n"); printf("\n"); @@ -304,13 +316,16 @@ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { if (!WPGraphics::isSupported(input)) { //! \todo Dialog here // fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); + // printf("I'm giving up not supported\n"); return NULL; } InkscapePainter painter; WPGraphics::parse(input, &painter); - return 0; + //printf("I've got a doc: \n%s", painter.document.c_str()); + + return sp_document_new_from_mem(painter.document.c_str(), strlen(painter.document.c_str()), TRUE); } #include "clear-n_.h" -- 2.30.2