diff options
| author | MenTaLguY <mental@rydia.net> | 2006-01-16 02:36:01 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2006-01-16 02:36:01 +0000 |
| commit | 179fa413b047bede6e32109e2ce82437c5fb8d34 (patch) | |
| tree | a5a6ac2c1708bd02288fbd8edb2ff500ff2e0916 /src/extension/internal/eps-out.cpp | |
| download | inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.tar.gz inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.zip | |
moving trunk for module inkscape
(bzr r1)
Diffstat (limited to 'src/extension/internal/eps-out.cpp')
| -rw-r--r-- | src/extension/internal/eps-out.cpp | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/src/extension/internal/eps-out.cpp b/src/extension/internal/eps-out.cpp new file mode 100644 index 000000000..849f9cfa4 --- /dev/null +++ b/src/extension/internal/eps-out.cpp @@ -0,0 +1,108 @@ +/* + * Authors: + * Ted Gould <ted@gould.cx> + * + * Copyright (C) 2004 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include "eps-out.h" +#include <print.h> +#include "extension/system.h" +#include "extension/db.h" +#include "extension/output.h" + +namespace Inkscape { +namespace Extension { +namespace Internal { + +bool +EpsOutput::check (Inkscape::Extension::Extension * module) +{ + if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_PS)) + return FALSE; + + return TRUE; +} + +/** + \brief This function calls the print system with the filename + \param mod unused + \param doc Document to be saved + \param uri Filename to save to (probably will end in .eps) + + The most interesting thing that this function does is just attach + an '>' on the front of the filename. This is the syntax used to + tell the printing system to save to file. +*/ +void +EpsOutput::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gchar *uri) +{ + gchar * final_name; + Inkscape::Extension::Extension * ext; + + ext = Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_PS); + if (ext == NULL) + return; + + bool old_pageBoundingBox = ext->get_param_bool("pageBoundingBox"); + bool new_val = mod->get_param_bool("pageBoundingBox"); + ext->set_param_bool("pageBoundingBox", new_val); + + bool old_textToPath = ext->get_param_bool("textToPath"); + new_val = mod->get_param_bool("textToPath"); + ext->set_param_bool("textToPath", new_val); + + final_name = g_strdup_printf("> %s", uri); + sp_print_document_to_file(doc, final_name); + g_free(final_name); + + ext->set_param_bool("pageBoundingBox", old_pageBoundingBox); + ext->set_param_bool("textToPath", old_textToPath); + + return; +} + +/** + \brief A function allocate a copy of this function. + + This is the definition of postscript out. This function just + calls the extension system with the memory allocated XML that + describes the data. +*/ +void +EpsOutput::init (void) +{ + Inkscape::Extension::build_from_mem( + "<inkscape-extension>\n" + "<name>Encapsulated Postscript Output</name>\n" + "<id>org.inkscape.output.eps</id>\n" + "<param name=\"pageBoundingBox\" type=\"boolean\" gui-text=\"Make bounding box around full page\">FALSE</param>\n" + "<param name=\"textToPath\" type=\"boolean\" gui-text=\"Convert text to path\">TRUE</param>\n" + "<output>\n" + "<extension>.eps</extension>\n" + "<mimetype>image/x-e-postscript</mimetype>\n" + "<filetypename>Encapsulated Postscript (*.eps)</filetypename>\n" + "<filetypetooltip>Encapsulated Postscript File</filetypetooltip>\n" + "</output>\n" + "</inkscape-extension>", new EpsOutput()); + + return; +} + +} } } /* 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 : |
