diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-08-04 20:40:14 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-08-31 14:50:38 +0000 |
| commit | 9185b26e396867391d92e4ab6edf933eec77db3a (patch) | |
| tree | ae557ad7fd6bc9a0ec1293a7d85fb0765b9707ba /src/extension/prefdialog/parameter.cpp | |
| parent | Rename Parameter -> InxParameter for consistency (diff) | |
| download | inkscape-9185b26e396867391d92e4ab6edf933eec77db3a.tar.gz inkscape-9185b26e396867391d92e4ab6edf933eec77db3a.zip | |
Add WidgetLabel replacing the former ParamDescription
This improves consistency, as "description" parameter were not
actually parameters with a value that could be modified or saved.
The old syntax is deprecated but still supported for now.
Diffstat (limited to 'src/extension/prefdialog/parameter.cpp')
| -rw-r--r-- | src/extension/prefdialog/parameter.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/extension/prefdialog/parameter.cpp b/src/extension/prefdialog/parameter.cpp index 6a9c744b3..9bb87f7a2 100644 --- a/src/extension/prefdialog/parameter.cpp +++ b/src/extension/prefdialog/parameter.cpp @@ -21,13 +21,13 @@ #include "parameter.h" #include "parameter-bool.h" #include "parameter-color.h" -#include "parameter-description.h" #include "parameter-float.h" #include "parameter-int.h" #include "parameter-notebook.h" #include "parameter-optiongroup.h" #include "parameter-string.h" #include "widget.h" +#include "widget-label.h" #include "extension/extension.h" @@ -41,6 +41,24 @@ namespace Inkscape { namespace Extension { + +// Re-implement ParamDescription for backwards-compatibility, deriving from both, WidgetLabel and InxParameter. +// TODO: Should go away eventually... +class ParamDescription : public virtual WidgetLabel, public virtual InxParameter { +public: + ParamDescription(Inkscape::XML::Node *xml, Inkscape::Extension::Extension *ext) + : WidgetLabel(xml, ext) + , InxParameter(xml, ext) + {} + + Gtk::Widget *get_widget(SPDocument *doc, Inkscape::XML::Node *node, sigc::signal<void> *changeSignal) override + { + return this->WidgetLabel::get_widget(doc, node, changeSignal); + } +}; + + + InxParameter *InxParameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext) { InxParameter *param = nullptr; @@ -58,12 +76,13 @@ InxParameter *InxParameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extensi } else if (!strcmp(type, "string")) { param = new ParamString(in_repr, in_ext); } else if (!strcmp(type, "description")) { + // support deprecated "description" for backwards-compatibility param = new ParamDescription(in_repr, in_ext); } else if (!strcmp(type, "notebook")) { param = new ParamNotebook(in_repr, in_ext); } else if (!strcmp(type, "optiongroup")) { param = new ParamOptionGroup(in_repr, in_ext); - } else if (!strcmp(type, "enum")) { // support deprecated "enum" for backwards-compatibilty + } else if (!strcmp(type, "enum")) { // support deprecated "enum" for backwards-compatibility in_repr->setAttribute("appearance", "combo"); param = new ParamOptionGroup(in_repr, in_ext); } else if (!strcmp(type, "color")) { |
