diff options
| author | VinÃcius dos Santos Oliveira <vini.ipsmaker@gmail.com> | 2013-06-05 19:03:06 +0000 |
|---|---|---|
| committer | VinÃcius dos Santos Oliveira <vini.ipsmaker@gmail.com> | 2013-06-05 19:03:06 +0000 |
| commit | 4cec6d0c7d401ed0616e91a923a7ec4caf806f3d (patch) | |
| tree | 4737bd0075f714385a55b0f3d9339211baaecbf9 /src/extension/param | |
| parent | Correct to compile against recent gtkmm, including updated macports versions.... (diff) | |
| download | inkscape-4cec6d0c7d401ed0616e91a923a7ec4caf806f3d.tar.gz inkscape-4cec6d0c7d401ed0616e91a923a7ec4caf806f3d.zip | |
Add command line option to specify PDF export version. Patch from schwieni.
From the patch's author:
Additional command line option added to export to different PDF-versions
supported by cairo (currently only "PDF 1.4" and "PDF 1.5"). The user must
provide the exact string found in the PDF-export dialog of Inkscape. This
feature was previously only accessible via the GUI of Inkscape. This option is
useful for people opting for PDF-a conformance in their PDFs. Moreover, the
Extension and Parameter classes are extended by setters for enum parameters
(used in combo boxes).
(bzr r12348)
Diffstat (limited to 'src/extension/param')
| -rw-r--r-- | src/extension/param/enum.cpp | 18 | ||||
| -rw-r--r-- | src/extension/param/enum.h | 5 | ||||
| -rw-r--r-- | src/extension/param/parameter.cpp | 18 | ||||
| -rw-r--r-- | src/extension/param/parameter.h | 6 |
4 files changed, 46 insertions, 1 deletions
diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 292e677a7..9cdc05049 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -175,6 +175,24 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape return _value; } +/** + * function to test if \c guitext is selectable + */ +bool ParamComboBox::contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const +{ + if (guitext == NULL) { + return false; /* Can't have NULL string */ + } + + for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { + enumentry * entr = reinterpret_cast<enumentry *>(list->data); + if ( !entr->guitext.compare(guitext) ) + return true; + } + // if we did not find the guitext in this ParamComboBox: + return false; +} + void ParamComboBox::changed (void) { diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h index ac7d72abd..52e018469 100644 --- a/src/extension/param/enum.h +++ b/src/extension/param/enum.h @@ -51,6 +51,11 @@ public: const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); + /** + * @returns true if guitext is part of this enum + */ + bool contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const; + void changed (void); }; /* class ParamComboBox */ diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 97e4f9d8c..202b8110f 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -183,6 +183,15 @@ gchar const *Parameter::get_enum(SPDocument const *doc, Inkscape::XML::Node cons return param->get(doc, node); } +bool Parameter::get_enum_contains(gchar const * value, SPDocument const *doc, Inkscape::XML::Node const *node) const +{ + ParamComboBox const *param = dynamic_cast<ParamComboBox const *>(this); + if (!param) { + throw Extension::param_not_enum_param(); + } + return param->contains(value, doc, node); +} + gchar const *Parameter::get_optiongroup(SPDocument const *doc, Inkscape::XML::Node const * node) const { ParamRadioButton const *param = dynamic_cast<ParamRadioButton const *>(this); @@ -247,6 +256,15 @@ gchar const * Parameter::set_optiongroup( gchar const * in, SPDocument * doc, In return param->set(in, doc, node); } +gchar const *Parameter::set_enum( gchar const * in, SPDocument * doc, Inkscape::XML::Node * node ) +{ + ParamComboBox *param = dynamic_cast<ParamComboBox *>(this); + if (!param) { + throw Extension::param_not_enum_param(); + } + return param->set(in, doc, node); +} + /** Wrapper to cast to the object and use it's function. */ guint32 diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index d08efc554..5e1e3897f 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -88,8 +88,10 @@ public: gchar const *get_enum(SPDocument const *doc, Inkscape::XML::Node const *node) const; /** Wrapper to cast to the object and use it's function. */ - gchar const *get_optiongroup(SPDocument const * doc, Inkscape::XML::Node const *node) const; + bool get_enum_contains(gchar const * value, SPDocument const *doc, Inkscape::XML::Node const *node) const; + /** Wrapper to cast to the object and use it's function. */ + gchar const *get_optiongroup(SPDocument const * doc, Inkscape::XML::Node const *node) const; /** Wrapper to cast to the object and use it's function. */ bool set_bool(bool in, SPDocument * doc, Inkscape::XML::Node * node); @@ -101,6 +103,8 @@ public: gchar const *set_optiongroup(gchar const *in, SPDocument * doc, Inkscape::XML::Node *node); + gchar const *set_enum(gchar const * in, SPDocument * doc, Inkscape::XML::Node *node); + gchar const *set_string(gchar const * in, SPDocument * doc, Inkscape::XML::Node * node); guint32 set_color(guint32 in, SPDocument * doc, Inkscape::XML::Node * node); |
