diff options
Diffstat (limited to 'src/io')
| -rw-r--r-- | src/io/file-export-cmd.cpp | 15 | ||||
| -rw-r--r-- | src/io/file.cpp | 17 | ||||
| -rw-r--r-- | src/io/file.h | 13 |
3 files changed, 34 insertions, 11 deletions
diff --git a/src/io/file-export-cmd.cpp b/src/io/file-export-cmd.cpp index 9af2d61ac..bf1d72a75 100644 --- a/src/io/file-export-cmd.cpp +++ b/src/io/file-export-cmd.cpp @@ -611,12 +611,12 @@ InkFileExportCmd::do_export_ps_pdf(SPDocument* doc, std::string filename_in, std const gchar *pdfver_param_name = "PDFversion"; if (!export_pdf_level.empty()) { // combine "PDF " and the given command line - std::string version_gui_string = std::string("PDF ") + export_pdf_level; - try{ + std::string version_gui_string = std::string("PDF-") + export_pdf_level; + try { // first, check if the given pdf version is selectable in the ComboBox - if((*i)->get_param_enum_contains("PDFversion", version_gui_string.c_str())) { - (*i)->set_param_enum(pdfver_param_name, version_gui_string.c_str()); - set_export_pdf_version_fail=false; + if ((*i)->get_param_optiongroup_contains("PDFversion", version_gui_string.c_str())) { + (*i)->set_param_optiongroup(pdfver_param_name, version_gui_string.c_str()); + set_export_pdf_version_fail = false; } else { g_warning("Desired PDF export version \"%s\" not supported! Hint: input one of the versions found in the pdf export dialog e.g. \"1.4\".", export_pdf_level.c_str()); @@ -631,7 +631,7 @@ InkFileExportCmd::do_export_ps_pdf(SPDocument* doc, std::string filename_in, std // set default pdf export version to 1.4, also if something went wrong if(set_export_pdf_version_fail) { - (*i)->set_param_enum(pdfver_param_name, "PDF 1.4"); + (*i)->set_param_optiongroup(pdfver_param_name, "PDF-1.4"); } } @@ -642,8 +642,7 @@ InkFileExportCmd::do_export_ps_pdf(SPDocument* doc, std::string filename_in, std export_ps_level = 2; } - (*i)->set_param_enum("PSlevel", (export_ps_level == 3) - ? "PostScript level 3" : "PostScript level 2"); + (*i)->set_param_optiongroup("PSlevel", (export_ps_level == 3) ? "PS3" : "PS2"); } diff --git a/src/io/file.cpp b/src/io/file.cpp index a87453d47..6317622bb 100644 --- a/src/io/file.cpp +++ b/src/io/file.cpp @@ -8,11 +8,11 @@ * */ +#include "file.h" + #include <iostream> #include <gtkmm.h> -#include "file.h" - #include "document.h" #include "document-undo.h" @@ -24,6 +24,9 @@ #include "object/sp-root.h" +#include "xml/repr.h" + + /** * Create a blank document, remove any template data. * Input: Empty string or template file name. @@ -36,7 +39,15 @@ ink_file_new(const std::string &Template) if (doc) { // Remove all the template info from xml tree Inkscape::XML::Node *myRoot = doc->getReprRoot(); - Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + Inkscape::XML::Node *nodeToRemove; + + nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:templateinfo"); + if (nodeToRemove != nullptr) { + Inkscape::DocumentUndo::ScopedInsensitive no_undo(doc); + sp_repr_unparent(nodeToRemove); + delete nodeToRemove; + } + nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); // backwards-compatibility if (nodeToRemove != nullptr) { Inkscape::DocumentUndo::ScopedInsensitive no_undo(doc); sp_repr_unparent(nodeToRemove); diff --git a/src/io/file.h b/src/io/file.h index 3b53bce4f..1767de2a0 100644 --- a/src/io/file.h +++ b/src/io/file.h @@ -11,6 +11,19 @@ #ifndef INK_FILE_IO_H #define INK_FILE_IO_H +#include <string> + +namespace Gio { +class File; +} + +namespace Glib { +class ustring; + +template <class T> +class RefPtr; +} + class SPDocument; SPDocument* ink_file_new(const std::string &Template = nullptr); |
