diff options
| author | Ted Gould <ted@gould.cx> | 2006-07-31 05:15:25 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2006-07-31 05:15:25 +0000 |
| commit | 4e40c0479f4a447dc4e5f1cd4c04e835cc6caa01 (patch) | |
| tree | f1ce3c26ae56cfeac9a7dac8c2d6b9d59f8f263c /src/extension/internal/wpg-input.cpp | |
| parent | r13108@tres: ted | 2006-07-30 12:27:51 -0700 (diff) | |
| download | inkscape-4e40c0479f4a447dc4e5f1cd4c04e835cc6caa01.tar.gz inkscape-4e40c0479f4a447dc4e5f1cd4c04e835cc6caa01.zip | |
r13109@tres: ted | 2006-07-30 22:11:20 -0700
Making this all work with the Inkscape world view.
(bzr r1526)
Diffstat (limited to 'src/extension/internal/wpg-input.cpp')
| -rw-r--r-- | src/extension/internal/wpg-input.cpp | 19 |
1 files 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("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
printf("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"");
printf(" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\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"
|
