From: gouldtj Date: Mon, 31 Jul 2006 05:14:59 +0000 (+0000) Subject: r13108@tres: ted | 2006-07-30 12:27:51 -0700 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2246a6186a6546d9c6131eaefff9924feed1cc01;p=inkscape.git r13108@tres: ted | 2006-07-30 12:27:51 -0700 Builds and links. Doesn't work, but builds and links. --- diff --git a/src/extension/init.cpp b/src/extension/init.cpp index 48ebeff78..affa3bcd0 100644 --- a/src/extension/init.cpp +++ b/src/extension/init.cpp @@ -45,6 +45,7 @@ #include "internal/bluredge.h" #include "internal/gimpgrad.h" #include "internal/grid.h" +#include "internal/wpg-input.h" #include "prefs-utils.h" #include "io/sys.h" @@ -121,6 +122,7 @@ init() Internal::OdfOutput::init(); Internal::PrintLatex::init(); Internal::LatexOutput::init(); + Internal::WpgInput::init(); /* Effects */ Internal::BlurEdge::init(); diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert index 57fd17b36..f39317374 100644 --- a/src/extension/internal/Makefile_insert +++ b/src/extension/internal/Makefile_insert @@ -48,5 +48,7 @@ extension_internal_libinternal_a_SOURCES = \ extension/internal/latex-pstricks.h \ extension/internal/latex-pstricks-out.cpp \ extension/internal/latex-pstricks-out.h \ + extension/internal/wpg-input.cpp \ + extension/internal/wpg-input.h \ $(extension_internal_gnome_print_sources) diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 4f296f2ab..13335cf79 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -1,3 +1,18 @@ +/* + * This file came from libwpg as a source, their utility wpg2svg + * specifically. It has been modified to work as an Inkscape extension. + * The Inkscape extension code is covered by this copyright, but the + * rest is covered by the one bellow. + * + * Authors: + * Ted Gould + * + * Copyright (C) 2006 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + * + */ + /* libwpg * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch) @@ -25,11 +40,19 @@ #include +#include "wpg-input.h" +#include "extension/system.h" +#include "extension/input.h" + #include "libwpg/libwpg.h" #include "libwpg/WPGStreamImplementation.h" using namespace libwpg; +namespace Inkscape { +namespace Extension { +namespace Internal { + class InkscapePainter : public libwpg::WPGPaintInterface { public: InkscapePainter(); @@ -54,6 +77,9 @@ private: FillRule m_fillRule; int m_gradientIndex; void writeStyle(); + +public: + std::string document; }; InkscapePainter::InkscapePainter(): m_fillRule(AlternatingFill), m_gradientIndex(1) @@ -66,7 +92,7 @@ void InkscapePainter::startDocument(double width, double height) printf("\n"); - printf("\n", LIBWPG_VERSION_STRING); +// printf("\n", LIBWPG_VERSION_STRING); printf("\n"); - return -1; - } - - const char* filename = argv[1]; - WPGInputStream* input = new WPGFileStream(filename); - if (input->isOle()) - { - WPGInputStream* olestream = input->getWPGOleStream(); - if (olestream) - { - delete input; - input = olestream; - } - } - - if (!WPGraphics::isSupported(input)) - { - fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); - return 1; - } - - InkscapePainter painter; - WPGraphics::parse(input, &painter); - - return 0; +SPDocument * +WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { + WPGInputStream* input = new WPGFileStream(uri); + if (input->isOle()) { + WPGInputStream* olestream = input->getWPGOleStream(); + if (olestream) { + delete input; + input = olestream; + } + } + + if (!WPGraphics::isSupported(input)) { + //! \todo Dialog here + // fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); + return NULL; + } + + InkscapePainter painter; + WPGraphics::parse(input, &painter); + + return 0; } + +#include "clear-n_.h" + +void +WpgInput::init(void) { + Inkscape::Extension::Extension * ext; + + ext = Inkscape::Extension::build_from_mem( + "\n" + "" N_("WPG Input") "\n" + "org.inkscape.input.wpg\n" + "\n" + "", new WpgInput()); +} // init + +} } } /* namespace Inkscape, Extension, Implementation */ + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/extension/internal/wpg-input.h b/src/extension/internal/wpg-input.h new file mode 100644 index 000000000..0be4c8d23 --- /dev/null +++ b/src/extension/internal/wpg-input.h @@ -0,0 +1,43 @@ +/* + * This code abstracts the libwpg interfaces into the Inkscape + * input extension interface. + * + * Authors: + * Ted Gould + * + * Copyright (C) 2006 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef __EXTENSION_INTERNAL_WPGOUTPUT_H__ +#define __EXTENSION_INTERNAL_WPGOUTPUT_H__ + +#include "../implementation/implementation.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { + +class WpgInput : public Inkscape::Extension::Implementation::Implementation { + WpgInput () { }; +public: + SPDocument *open( Inkscape::Extension::Input *mod, + const gchar *uri ); + static void init( void ); + +}; + +} } } /* namespace Inkscape, Extension, Implementation */ +#endif /* __EXTENSION_INTERNAL_WPGOUTPUT_H__ */ + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :