From 9185b26e396867391d92e4ab6edf933eec77db3a Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Sun, 4 Aug 2019 22:40:14 +0200 Subject: 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. --- src/extension/prefdialog/parameter.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/extension/prefdialog/parameter.cpp') 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 *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")) { -- cgit v1.2.3