From 9e698451e43ff82a92d9d6644d661c43873ecdc2 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 6 Sep 2012 08:17:13 +0900 Subject: Fix for 499965 : PS Output : Convert export area to radio buttons (bzr r11654) --- src/extension/internal/cairo-ps-out.cpp | 106 +++++++++++----------- src/extension/internal/cairo-renderer-pdf-out.cpp | 65 ++++++------- 2 files changed, 82 insertions(+), 89 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 8b1b3fbfd..605f0237c 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -169,13 +169,10 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con bool new_areaPage = true; try { - new_areaPage = mod->get_param_bool("areaPage"); + new_areaPage = (strcmp(ext->get_param_optiongroup("area"), "page") == 0); } catch(...) {} - bool new_areaDrawing = true; - try { - new_areaDrawing = mod->get_param_bool("areaDrawing"); - } catch(...) {} + bool new_areaDrawing = !new_areaPage; const gchar *new_exportId = NULL; try { @@ -252,13 +249,10 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co bool new_areaPage = true; try { - new_areaPage = mod->get_param_bool("areaPage"); + new_areaPage = (strcmp(ext->get_param_optiongroup("area"), "page") == 0); } catch(...) {} - bool new_areaDrawing = true; - try { - new_areaDrawing = mod->get_param_bool("areaDrawing"); - } catch(...) {} + bool new_areaDrawing = !new_areaPage; const gchar *new_exportId = NULL; try { @@ -310,32 +304,34 @@ CairoEpsOutput::textToPath(Inkscape::Extension::Print * ext) void CairoPsOutput::init (void) { - Inkscape::Extension::build_from_mem( - "\n" - "" N_("PostScript") "\n" - "" SP_MODULE_KEY_PRINT_CAIRO_PS "\n" - "\n" - "<_item value='PS3'>" N_("PostScript level 3") "\n" + Inkscape::Extension::build_from_mem( + "\n" + "" N_("PostScript") "\n" + "" SP_MODULE_KEY_PRINT_CAIRO_PS "\n" + "\n" + "<_item value='PS3'>" N_("PostScript level 3") "\n" #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) "<_item value='PS2'>" N_("PostScript level 2") "\n" #endif "\n" - "false\n" - "false\n" - "true\n" - "90\n" - "true\n" - "true\n" - "\n" - "\n" - ".ps\n" - "image/x-postscript\n" - "" N_("PostScript (*.ps)") "\n" - "" N_("PostScript File") "\n" - "\n" - "", new CairoPsOutput()); - - return; + "false\n" + "false\n" + "true\n" + "90\n" + "\n" + "" + "" + "" + "\n" + "\n" + ".ps\n" + "image/x-postscript\n" + "" N_("PostScript (*.ps)") "\n" + "" N_("PostScript File") "\n" + "\n" + "", new CairoPsOutput()); + + return; } /** @@ -348,32 +344,34 @@ CairoPsOutput::init (void) void CairoEpsOutput::init (void) { - Inkscape::Extension::build_from_mem( - "\n" - "" N_("Encapsulated PostScript") "\n" - "" SP_MODULE_KEY_PRINT_CAIRO_EPS "\n" - "\n" - "<_item value='PS3'>" N_("PostScript level 3") "\n" + Inkscape::Extension::build_from_mem( + "\n" + "" N_("Encapsulated PostScript") "\n" + "" SP_MODULE_KEY_PRINT_CAIRO_EPS "\n" + "\n" + "<_item value='PS3'>" N_("PostScript level 3") "\n" #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) "<_item value='PS2'>" N_("PostScript level 2") "\n" #endif "\n" - "false\n" - "false\n" - "true\n" - "90\n" - "true\n" - "true\n" - "\n" - "\n" - ".eps\n" - "image/x-e-postscript\n" - "" N_("Encapsulated PostScript (*.eps)") "\n" - "" N_("Encapsulated PostScript File") "\n" - "\n" - "", new CairoEpsOutput()); - - return; + "false\n" + "false\n" + "true\n" + "90\n" + "\n" + "" + "" + "" + "\n" + "\n" + ".eps\n" + "image/x-e-postscript\n" + "" N_("Encapsulated PostScript (*.eps)") "\n" + "" N_("Encapsulated PostScript File") "\n" + "\n" + "", new CairoEpsOutput()); + + return; } } } } /* 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 5d45fcf87..494ff1e8d 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -185,21 +185,14 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, g_warning("Parameter might not exist"); } - bool new_exportDrawing = FALSE; + bool new_exportCanvas = true; try { - new_exportDrawing = mod->get_param_bool("areaDrawing"); - } - catch(...) { - g_warning("Parameter might not exist"); + new_exportCanvas = (strcmp(ext->get_param_optiongroup("area"), "page") == 0); + } catch(...) { + g_warning("Parameter might not exist"); } - bool new_exportCanvas = FALSE; - try { - new_exportCanvas = mod->get_param_bool("areaPage"); - } - catch(...) { - g_warning("Parameter might not exist"); - } + bool new_exportDrawing = !new_exportCanvas; // Create PDF file { @@ -235,32 +228,34 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, void CairoRendererPdfOutput::init (void) { - Inkscape::Extension::build_from_mem( - "\n" - "Portable Document Format\n" - "org.inkscape.output.pdf.cairorenderer\n" - "\n" + Inkscape::Extension::build_from_mem( + "\n" + "Portable Document Format\n" + "org.inkscape.output.pdf.cairorenderer\n" + "\n" #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)) - "<_item value='PDF-1.5'>" N_("PDF 1.5") "\n" + "<_item value='PDF-1.5'>" N_("PDF 1.5") "\n" #endif "<_item value='PDF-1.4'>" N_("PDF 1.4") "\n" - "\n" - "false\n" - "false\n" - "true\n" - "90\n" - "false\n" - "false\n" - "\n" - "\n" - ".pdf\n" - "application/pdf\n" - "Portable Document Format (*.pdf)\n" - "PDF File\n" - "\n" - "", new CairoRendererPdfOutput()); - - return; + "\n" + "false\n" + "false\n" + "true\n" + "90\n" + "\n" + "" + "" + "" + "\n" + "\n" + ".pdf\n" + "application/pdf\n" + "Portable Document Format (*.pdf)\n" + "PDF File\n" + "\n" + "", new CairoRendererPdfOutput()); + + return; } } } } /* namespace Inkscape, Extension, Internal */ -- cgit v1.2.3