Code

create options for cairo pdf/ps export dialog
authortheAdib <theAdib@users.sourceforge.net>
Sun, 23 Dec 2007 00:56:16 +0000 (00:56 +0000)
committertheAdib <theAdib@users.sourceforge.net>
Sun, 23 Dec 2007 00:56:16 +0000 (00:56 +0000)
src/extension/internal/cairo-pdf-out.cpp
src/extension/internal/cairo-ps-out.cpp
src/extension/internal/cairo-ps-out.h
src/extension/internal/cairo-renderer-pdf-out.cpp

index 88010e686a7e0c1110384c65a3765026a7e20ed9..4e7f54c8610930d2d0eb1b5e1e24039e9970fe3e 100644 (file)
@@ -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)
                "<inkscape-extension>\n"
                        "<name>Cairo PDF Output</name>\n"
                        "<id>org.inkscape.output.pdf.cairo</id>\n"
+                       "<param name=\"PDFversion\" gui-text=\"" N_("Restrict to PDF version") "\" type=\"enum\" >\n"
+                               "<item value='PDF14'>" N_("PDF 1.4") "</item>\n"
+            "</param>\n"
+                       "<param name=\"blurToBitmap\" gui-text=\"" N_("Convert blur effects to bitmaps") "\" type=\"boolean\">false</param>\n"
                        "<output>\n"
                                "<extension>.pdf</extension>\n"
                                "<mimetype>application/pdf</mimetype>\n"
index 8d062fa3ab35b5103fda41724c2a3b38ab0385bc..06e0f92c6144e0c23c289f050c4b2d4579f94841 100644 (file)
@@ -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)
                "<inkscape-extension>\n"
                        "<name>Cairo PS Output</name>\n"
                        "<id>org.inkscape.print.ps.cairo</id>\n"
+                       "<param name=\"PSlevel\" gui-text=\"" N_("Restrict to PS level") "\" type=\"enum\" >\n"
+#if (CAIRO_VERSION >= 010502)
+                "<item value='PS2'>" N_("PostScript level 2") "</item>\n"
+#endif
+                               "<item value='PS3'>" N_("PostScript 3") "</item>\n"
+            "</param>\n"
+                       "<param name=\"textToPath\" gui-text=\"" N_("Convert texts to paths") "\" type=\"boolean\">true</param>\n"
+                       "<param name=\"blurToBitmap\" gui-text=\"" N_("Convert blur effects to bitmaps") "\" type=\"boolean\">false</param>\n"
                        "<output>\n"
                                "<extension>.ps</extension>\n"
                 "<mimetype>application/ps</mimetype>\n"
index 27f7234dde3e324d5ad559a4773b43d3ef5f0bd2..14fc0ba69573ee5bc53f83ca40d6b81881852d47 100644 (file)
@@ -31,6 +31,8 @@ public:
               SPDocument *doc,
               gchar const *uri);
     static void init();
+    bool textToPath(Inkscape::Extension::Print *ext);
+
 };
 
 } } }  /* namespace Inkscape, Extension, Implementation */
index 82b736ad26f58b6abe82b5f4409569e9af55e483..f1975eb3914f9c563c8075643d7d477c36b56b93 100644 (file)
@@ -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();