From 3fa7c9044653435c086b5a985a08442bef9a41c4 Mon Sep 17 00:00:00 2001 From: theAdib Date: Sun, 23 Dec 2007 00:56:16 +0000 Subject: [PATCH] create options for cairo pdf/ps export dialog --- src/extension/internal/cairo-pdf-out.cpp | 11 +++++-- src/extension/internal/cairo-ps-out.cpp | 32 +++++++++++++++++-- src/extension/internal/cairo-ps-out.h | 2 ++ .../internal/cairo-renderer-pdf-out.cpp | 2 +- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/extension/internal/cairo-pdf-out.cpp b/src/extension/internal/cairo-pdf-out.cpp index 88010e686..4e7f54c86 100644 --- a/src/extension/internal/cairo-pdf-out.cpp +++ b/src/extension/internal/cairo-pdf-out.cpp @@ -65,14 +65,14 @@ pdf_print_document_to_file(SPDocument *doc, gchar const *filename) mod->arena = NRArena::create(); mod->dkey = sp_item_display_key_new(1); mod->root = sp_item_invoke_show(mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); - + /* Print document */ ret = mod->begin(doc); if (ret) { sp_item_invoke_print(mod->base, &context); ret = mod->finish(); } - + /* Release arena */ sp_item_invoke_hide(mod->base, mod->dkey); mod->base = NULL; @@ -113,13 +113,14 @@ CairoPdfOutput::save (Inkscape::Extension::Output *mod, SPDocument *doc, const g final_name = g_strdup_printf("> %s", uri); ret = pdf_print_document_to_file(doc, final_name); g_free(final_name); - + if (!ret) throw Inkscape::Extension::Output::save_failed(); return; } +#include "clear-n_.h" /** \brief A function allocate a copy of this function. @@ -134,6 +135,10 @@ CairoPdfOutput::init (void) "\n" "Cairo PDF Output\n" "org.inkscape.output.pdf.cairo\n" + "\n" + "" N_("PDF 1.4") "\n" + "\n" + "false\n" "\n" ".pdf\n" "application/pdf\n" diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 8d062fa3a..06e0f92c6 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -64,7 +64,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename) NRArena *arena = NRArena::create(); unsigned dkey = sp_item_display_key_new(1); NRArenaItem *root = sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY); - + /* Create renderer and context */ renderer = new CairoRenderer(); ctx = renderer->createContext(); @@ -106,11 +106,23 @@ CairoPsOutput::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gc if (ext == NULL) return; + bool old_textToPath = ext->get_param_bool("textToPath"); + bool new_val = mod->get_param_bool("textToPath"); + ext->set_param_bool("textToPath", new_val); + + bool old_blurToBitmap = ext->get_param_bool("blurToBitmap"); + new_val = mod->get_param_bool("blurToBitmap"); + ext->set_param_bool("blurToBitmap", new_val); + + gchar * final_name; final_name = g_strdup_printf("> %s", uri); ret = ps_print_document_to_file(doc, final_name); g_free(final_name); - + + ext->set_param_bool("blurToBitmap", old_blurToBitmap); + ext->set_param_bool("textToPath", old_textToPath); + if (!ret) throw Inkscape::Extension::Output::save_failed(); @@ -118,6 +130,14 @@ CairoPsOutput::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gc } +bool +CairoPsOutput::textToPath(Inkscape::Extension::Print * ext) +{ + return ext->get_param_bool("textToPath"); +} + +#include "clear-n_.h" + /** \brief A function allocate a copy of this function. @@ -132,6 +152,14 @@ CairoPsOutput::init (void) "\n" "Cairo PS Output\n" "org.inkscape.print.ps.cairo\n" + "\n" +#if (CAIRO_VERSION >= 010502) + "" N_("PostScript level 2") "\n" +#endif + "" N_("PostScript 3") "\n" + "\n" + "true\n" + "false\n" "\n" ".ps\n" "application/ps\n" diff --git a/src/extension/internal/cairo-ps-out.h b/src/extension/internal/cairo-ps-out.h index 27f7234dd..14fc0ba69 100644 --- a/src/extension/internal/cairo-ps-out.h +++ b/src/extension/internal/cairo-ps-out.h @@ -31,6 +31,8 @@ public: SPDocument *doc, gchar const *uri); static void init(); + bool textToPath(Inkscape::Extension::Print *ext); + }; } } } /* namespace Inkscape, Extension, Implementation */ diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 82b736ad2..f1975eb39 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -56,7 +56,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename) NRArena *arena = NRArena::create(); unsigned dkey = sp_item_display_key_new(1); NRArenaItem *root = sp_item_invoke_show(base, arena, dkey, SP_ITEM_SHOW_DISPLAY); - + /* Create renderer and context */ CairoRenderer *renderer = new CairoRenderer(); CairoRenderContext *ctx = renderer->createContext(); -- 2.30.2