summaryrefslogtreecommitdiffstats
path: root/src/extension/prefdialog
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-08-07 00:28:50 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-08-31 14:50:39 +0000
commitc0317efc1e86f75ee72d6f65b978bfe634bd3b2c (patch)
treee4f82b94e7b47f62815f889e902a42de03102356 /src/extension/prefdialog
parentInherit destructor and recursively delete all widgets (diff)
downloadinkscape-c0317efc1e86f75ee72d6f65b978bfe634bd3b2c.tar.gz
inkscape-c0317efc1e86f75ee72d6f65b978bfe634bd3b2c.zip
Re-implement get_param() locally using get_widgets()
Diffstat (limited to 'src/extension/prefdialog')
-rw-r--r--src/extension/prefdialog/parameter-notebook.cpp37
-rw-r--r--src/extension/prefdialog/parameter-notebook.h3
-rw-r--r--src/extension/prefdialog/parameter.cpp5
-rw-r--r--src/extension/prefdialog/parameter.h4
-rw-r--r--src/extension/prefdialog/widget.cpp2
-rw-r--r--src/extension/prefdialog/widget.h2
6 files changed, 3 insertions, 50 deletions
diff --git a/src/extension/prefdialog/parameter-notebook.cpp b/src/extension/prefdialog/parameter-notebook.cpp
index 1fca1b402..9cdf5df8e 100644
--- a/src/extension/prefdialog/parameter-notebook.cpp
+++ b/src/extension/prefdialog/parameter-notebook.cpp
@@ -91,27 +91,10 @@ Gtk::Widget *ParamNotebook::ParamNotebookPage::get_widget(SPDocument *doc, Inksc
return dynamic_cast<Gtk::Widget *>(vbox);
}
-/** Search the parameter's name in the page content. */
-InxParameter *ParamNotebook::ParamNotebookPage::get_param(const char *name)
-{
- if (name == nullptr) {
- throw Extension::param_not_exist();
- }
- if (_children.empty()) {
- throw Extension::param_not_exist();
- }
+/** End ParamNotebookPage **/
- for (auto child : _children) {
- InxParameter *parameter = dynamic_cast<InxParameter *>(child);
- if (parameter && !strcmp(parameter->name(), name)) {
- return parameter;
- }
- }
- return nullptr;
-}
-/** End ParamNotebookPage **/
/** ParamNotebook **/
ParamNotebook::ParamNotebook(Inkscape::XML::Node *xml, Inkscape::Extension::Extension *ext)
@@ -234,24 +217,6 @@ void NotebookWidget::changed_page(Gtk::Widget * /*page*/, guint pagenum)
}
}
-/** Search the parameter's name in the notebook content. */
-InxParameter *ParamNotebook::get_param(const char *name)
-{
- if (name == nullptr) {
- throw Extension::param_not_exist();
- }
- for (auto child : _children) {
- ParamNotebookPage *page = dynamic_cast<ParamNotebookPage *>(child);
- InxParameter *subparam = page->get_param(name);
- if (subparam) {
- return subparam;
- }
- }
-
- return nullptr;
-}
-
-
/**
* Creates a Notebook widget for a notebook parameter.
*
diff --git a/src/extension/prefdialog/parameter-notebook.h b/src/extension/prefdialog/parameter-notebook.h
index ee8727158..bba6cdd64 100644
--- a/src/extension/prefdialog/parameter-notebook.h
+++ b/src/extension/prefdialog/parameter-notebook.h
@@ -49,7 +49,6 @@ private:
ParamNotebookPage(Inkscape::XML::Node *xml, Inkscape::Extension::Extension *ext);
Gtk::Widget *get_widget(SPDocument *doc, Inkscape::XML::Node *node, sigc::signal<void> *changeSignal) override;
- InxParameter *get_param(const char *name) override;
// ParamNotebookPage is not a real parameter (it has no value), so make sure it does not return one
std::string value_to_string() const override { return ""; };
@@ -68,8 +67,6 @@ public:
std::string value_to_string() const override;
- InxParameter *get_param (const char *name) override;
-
const Glib::ustring& get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; }
const Glib::ustring& set (const int in, SPDocument *doc, Inkscape::XML::Node *node);
}; /* class ParamNotebook */
diff --git a/src/extension/prefdialog/parameter.cpp b/src/extension/prefdialog/parameter.cpp
index 7d8751353..d0e284ea7 100644
--- a/src/extension/prefdialog/parameter.cpp
+++ b/src/extension/prefdialog/parameter.cpp
@@ -272,11 +272,6 @@ std::string InxParameter::value_to_string() const
return "";
}
-InxParameter *InxParameter::get_param(const char */*name*/)
-{
- return nullptr;
-}
-
const Glib::ustring InxParameter::extension_pref_root = "/extensions/";
} // namespace Extension
diff --git a/src/extension/prefdialog/parameter.h b/src/extension/prefdialog/parameter.h
index eba096be2..23fea0204 100644
--- a/src/extension/prefdialog/parameter.h
+++ b/src/extension/prefdialog/parameter.h
@@ -118,10 +118,6 @@ public:
*/
virtual std::string value_to_string() const;
- /** All the code in Notebook::get_param to get the notebook content. */
- virtual InxParameter *get_param(char const *name);
-
-
/** Recommended spacing between the widgets making up a single Parameter (e.g. label and input) (in px) */
const static int GUI_PARAM_WIDGETS_SPACING = 4;
diff --git a/src/extension/prefdialog/widget.cpp b/src/extension/prefdialog/widget.cpp
index efd97e099..db5700b2e 100644
--- a/src/extension/prefdialog/widget.cpp
+++ b/src/extension/prefdialog/widget.cpp
@@ -136,7 +136,7 @@ const char *InxWidget::get_translation(const char* msgid) {
return _extension->get_translation(msgid, _context);
}
-void InxWidget::get_widgets(std::vector<const InxWidget *> &list) const
+void InxWidget::get_widgets(std::vector<InxWidget *> &list)
{
list.push_back(this);
for (auto child : _children) {
diff --git a/src/extension/prefdialog/widget.h b/src/extension/prefdialog/widget.h
index b31fc1d53..07706f8d6 100644
--- a/src/extension/prefdialog/widget.h
+++ b/src/extension/prefdialog/widget.h
@@ -76,7 +76,7 @@ public:
*
* @param list Reference to a vector of pointers to \a InxWidget that will be appended with the new \a InxWidgets
*/
- virtual void get_widgets(std::vector<const InxWidget *> &list) const;
+ virtual void get_widgets(std::vector<InxWidget *> &list);
/** Recommended margin of boxes containing multiple widgets (in px) */