From e3ad9bfc9912ee6ab8d29245450e911b9fbba176 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Mon, 14 Mar 2011 18:03:26 +0100 Subject: Extensions. Slider in Float and Int extension widgets. (bzr r10103) --- src/extension/param/parameter.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 529d5a775..4abfeb231 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -124,9 +124,17 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * if (!strcmp(type, "boolean")) { param = new ParamBool(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); } else if (!strcmp(type, "int")) { - param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + if (appearance && !strcmp(appearance, "minimal")) { + param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::MINIMAL); + } else { + param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::FULL); + } } else if (!strcmp(type, "float")) { - param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + if (appearance && !strcmp(appearance, "minimal")) { + param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::MINIMAL); + } else { + param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::FULL); + } } else if (!strcmp(type, "string")) { param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); const gchar * max_length = in_repr->attribute("max_length"); -- cgit v1.2.3 From 88a617b7c8709c1e5f39967abf003ac1cf4f982d Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 15 Mar 2011 18:04:49 +0100 Subject: Extensions. Float and Int default mode set to minimal. Filters' mode changed to full. (bzr r10106) --- src/extension/param/parameter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 4abfeb231..d35fb3d3c 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -124,16 +124,16 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * if (!strcmp(type, "boolean")) { param = new ParamBool(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); } else if (!strcmp(type, "int")) { - if (appearance && !strcmp(appearance, "minimal")) { - param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::MINIMAL); - } else { + if (appearance && !strcmp(appearance, "full")) { param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::FULL); + } else { + param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::MINIMAL); } } else if (!strcmp(type, "float")) { - if (appearance && !strcmp(appearance, "minimal")) { - param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::MINIMAL); - } else { + if (appearance && !strcmp(appearance, "full")) { param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::FULL); + } else { + param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::MINIMAL); } } else if (!strcmp(type, "string")) { param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); -- cgit v1.2.3 From 939f84facd2f8beb4f5a1601c09bf7b71f1274a0 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 25 Mar 2011 16:09:55 +0100 Subject: Extensions. Replacing the groupheader element with an appearance mode in the description element. (bzr r10129) --- src/extension/param/parameter.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index d35fb3d3c..a9935cfe6 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -36,7 +36,6 @@ #include "bool.h" #include "color.h" #include "description.h" -#include "groupheader.h" #include "enum.h" #include "float.h" #include "int.h" @@ -143,9 +142,11 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * ps->setMaxLength(atoi(max_length)); } } else if (!strcmp(type, "description")) { - param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); - } else if (!strcmp(type, "groupheader")) { - param = new ParamGroupHeader(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + if (appearance && !strcmp(appearance, "header")) { + param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamDescription::HEADER); + } else { + param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamDescription::DESC); + } } else if (!strcmp(type, "enum")) { param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); } else if (!strcmp(type, "notebook")) { -- cgit v1.2.3 From 5bce9c92692548162b10aa06370f1e28806572f7 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 16 Apr 2011 23:57:13 +0200 Subject: remove unnecessary includes. (bzr r10174) --- src/extension/param/parameter.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index a9935cfe6..fb53035a1 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -19,10 +19,6 @@ # define ESCAPE_DOLLAR_COMMANDLINE #endif -#include -#include -#include - #include #include -- cgit v1.2.3 From 3638efba5bec8a6afc9211aa6bbe289767d20b38 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 3 Jun 2011 19:45:55 -0700 Subject: Removed outdated/unsafe SP_DOCUMENT_DEFS macro and reduced usage of SP_ROOT() gtk type function/macro. (bzr r10254) --- src/extension/param/parameter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index fb53035a1..455fcc3bb 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -354,7 +354,7 @@ Parameter::new_child (Inkscape::XML::Node * parent) Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) { Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::XML::Node * defs = SP_DOCUMENT_DEFS(doc)->getRepr(); + Inkscape::XML::Node * defs = doc->getDefs()->getRepr(); Inkscape::XML::Node * params = NULL; GQuark const name_quark = g_quark_from_string("inkscape:extension-params"); -- cgit v1.2.3 From 72d63966662421b4316e74ff1fb0799c4629f146 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 23 Oct 2011 01:00:27 -0700 Subject: Warning cleanup. (bzr r10691) --- src/extension/param/parameter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 455fcc3bb..0a88fdda8 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -412,9 +412,8 @@ Parameter::string (std::list &list) return; } -/** \brief All the code in Notebook::get_param to get the notebook content */ -Parameter * -Parameter::get_param(const gchar * name) +/** All the code in Notebook::get_param to get the notebook content. */ +Parameter *Parameter::get_param(const gchar * /*name*/) { return NULL; } -- cgit v1.2.3 From efbfc732bbed46c3e615fcd88294a02ee98b7530 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 28 Oct 2011 21:41:31 +0200 Subject: one constructor cannot call the other to initialize the object. See C++faq-lite 10.3 (bzr r10699) --- src/extension/param/parameter.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 0a88fdda8..106cd76a6 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -307,11 +307,27 @@ Parameter::Parameter (const gchar * name, const gchar * guitext, const gchar * d _gui_tip = g_strdup(gui_tip); } + if (guitext != NULL) { + _text = g_strdup(guitext); + } else { + _text = g_strdup(name); + } + + return; +} - if (guitext != NULL) +/** \brief Oop, now that we need a parameter, we need it's name. */ +Parameter::Parameter (const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext) : + extension(ext), _name(NULL), _desc(NULL), _scope(Parameter::SCOPE_USER), _text(NULL), _gui_hidden(false), _gui_tip(NULL) +{ + if (name != NULL) { + _name = g_strdup(name); + } + if (guitext != NULL) { _text = g_strdup(guitext); - else + } else { _text = g_strdup(name); + } return; } -- cgit v1.2.3 From af07ce24271fc904e432cdf77714f49b8cbc8db8 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 18 Dec 2011 22:54:08 -0800 Subject: Const correctness fixes that also correct bug #893146. Fixed bugs: - https://launchpad.net/bugs/893146 (bzr r10783) --- src/extension/param/parameter.cpp | 269 +++++++++++++++++--------------------- 1 file changed, 122 insertions(+), 147 deletions(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 106cd76a6..063ec32be 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -1,5 +1,5 @@ /** @file - * @brief Parameters for extensions. + * Parameters for extensions. */ /* Author: * Ted Gould @@ -42,76 +42,52 @@ namespace Inkscape { namespace Extension { -/** - \return None - \brief This function creates a parameter that can be used later. This - is typically done in the creation of the extension and defined - in the XML file describing the extension (it's private so people - have to use the system) :) - \param in_repr The XML describing the parameter - - This function first grabs all of the data out of the Repr and puts - it into local variables. Actually, these are just pointers, and the - data is not duplicated so we need to be careful with it. If there - isn't a name or a type in the XML, then no parameter is created as - the function just returns. - - From this point on, we're pretty committed as we've allocated an - object and we're starting to fill it. The name is set first, and - is created with a strdup to actually allocate memory for it. Then - there is a case statement (roughly because strcmp requires 'ifs') - based on what type of parameter this is. Depending which type it - is, the value is interpreted differently, but they are relatively - straight forward. In all cases the value is set to the default - value from the XML and the type is set to the interpreted type. -*/ -Parameter * -Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext) +Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext) { - const char * name; - const char * type; - const char * guitext; - const char * desc; - const char * scope_str; - Parameter::_scope_t scope = Parameter::SCOPE_USER; - bool gui_hidden = false; - const char * gui_hide; - const char * gui_tip; - - name = in_repr->attribute("name"); - type = in_repr->attribute("type"); - guitext = in_repr->attribute("gui-text"); - if (guitext == NULL) + const char *name = in_repr->attribute("name"); + const char *type = in_repr->attribute("type"); + + // In this case we just don't have enough information + if (!name || !type) { + return NULL; + } + + const char *guitext = in_repr->attribute("gui-text"); + if (guitext == NULL) { guitext = in_repr->attribute("_gui-text"); - gui_tip = in_repr->attribute("gui-tip"); - if (gui_tip == NULL) + } + const char *gui_tip = in_repr->attribute("gui-tip"); + if (gui_tip == NULL) { gui_tip = in_repr->attribute("_gui-tip"); - desc = in_repr->attribute("gui-description"); - if (desc == NULL) + } + const char *desc = in_repr->attribute("gui-description"); + if (desc == NULL) { desc = in_repr->attribute("_gui-description"); - scope_str = in_repr->attribute("scope"); - gui_hide = in_repr->attribute("gui-hidden"); - if (gui_hide != NULL) { - if (strcmp(gui_hide, "1") == 0 || - strcmp(gui_hide, "true") == 0) { - gui_hidden = true; - } - /* else stays false */ - } - const gchar* appearance = in_repr->attribute("appearance"); - - /* In this case we just don't have enough information */ - if (name == NULL || type == NULL) { - return NULL; } + bool gui_hidden = false; + { + const char *gui_hide = in_repr->attribute("gui-hidden"); + if (gui_hide != NULL) { + if (strcmp(gui_hide, "1") == 0 || + strcmp(gui_hide, "true") == 0) { + gui_hidden = true; + } + /* else stays false */ + } + } + const gchar* appearance = in_repr->attribute("appearance"); - if (scope_str != NULL) { - if (!strcmp(scope_str, "user")) { - scope = Parameter::SCOPE_USER; - } else if (!strcmp(scope_str, "document")) { - scope = Parameter::SCOPE_DOCUMENT; - } else if (!strcmp(scope_str, "node")) { - scope = Parameter::SCOPE_NODE; + Parameter::_scope_t scope = Parameter::SCOPE_USER; + { + const char *scope_str = in_repr->attribute("scope"); + if (scope_str != NULL) { + if (!strcmp(scope_str, "user")) { + scope = Parameter::SCOPE_USER; + } else if (!strcmp(scope_str, "document")) { + scope = Parameter::SCOPE_DOCUMENT; + } else if (!strcmp(scope_str, "node")) { + scope = Parameter::SCOPE_NODE; + } } } @@ -132,10 +108,10 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * } } else if (!strcmp(type, "string")) { param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); - const gchar * max_length = in_repr->attribute("max_length"); + gchar const * max_length = in_repr->attribute("max_length"); if (max_length != NULL) { - ParamString * ps = dynamic_cast(param); - ps->setMaxLength(atoi(max_length)); + ParamString * ps = dynamic_cast(param); + ps->setMaxLength(atoi(max_length)); } } else if (!strcmp(type, "description")) { if (appearance && !strcmp(appearance, "header")) { @@ -157,82 +133,74 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * param = new ParamColor(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); } - /* Note: param could equal NULL */ + // Note: param could equal NULL return param; } -/** \brief Wrapper to cast to the object and use it's function. */ -bool -Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node) +bool Parameter::get_bool(SPDocument const *doc, Inkscape::XML::Node const *node) const { - ParamBool * boolpntr = dynamic_cast(this); - if (boolpntr == NULL) + ParamBool const *boolpntr = dynamic_cast(this); + if (!boolpntr) { throw Extension::param_not_bool_param(); + } return boolpntr->get(doc, node); } -/** \brief Wrapper to cast to the object and use it's function. */ -int -Parameter::get_int (const SPDocument * doc, const Inkscape::XML::Node * node) +int Parameter::get_int(SPDocument const *doc, Inkscape::XML::Node const *node) const { - ParamInt * intpntr = dynamic_cast(this); - if (intpntr == NULL) + ParamInt const *intpntr = dynamic_cast(this); + if (!intpntr) { throw Extension::param_not_int_param(); + } return intpntr->get(doc, node); } -/** \brief Wrapper to cast to the object and use it's function. */ -float -Parameter::get_float (const SPDocument * doc, const Inkscape::XML::Node * node) +float Parameter::get_float(SPDocument const *doc, Inkscape::XML::Node const *node) const { - ParamFloat * floatpntr = dynamic_cast(this); - if (floatpntr == NULL) + ParamFloat const *floatpntr = dynamic_cast(this); + if (!floatpntr) { throw Extension::param_not_float_param(); + } return floatpntr->get(doc, node); } -/** \brief Wrapper to cast to the object and use it's function. */ -const gchar * -Parameter::get_string (const SPDocument * doc, const Inkscape::XML::Node * node) +gchar const *Parameter::get_string(SPDocument const *doc, Inkscape::XML::Node const *node) const { - ParamString * stringpntr = dynamic_cast(this); - if (stringpntr == NULL) + ParamString const *stringpntr = dynamic_cast(this); + if (!stringpntr) { throw Extension::param_not_string_param(); + } return stringpntr->get(doc, node); } -/** \brief Wrapper to cast to the object and use it's function. */ -const gchar * -Parameter::get_enum (const SPDocument * doc, const Inkscape::XML::Node * node) +gchar const *Parameter::get_enum(SPDocument const *doc, Inkscape::XML::Node const *node) const { - ParamComboBox * param = dynamic_cast(this); - if (param == NULL) + ParamComboBox const *param = dynamic_cast(this); + if (!param) { throw Extension::param_not_enum_param(); + } return param->get(doc, node); } -/** \brief Wrapper to cast to the object and use it's function. */ -gchar const *Parameter::get_optiongroup(SPDocument const * doc, Inkscape::XML::Node const * node) +gchar const *Parameter::get_optiongroup(SPDocument const *doc, Inkscape::XML::Node const * node) const { - ParamRadioButton * param = dynamic_cast(this); + ParamRadioButton const *param = dynamic_cast(this); if (!param) { throw Extension::param_not_optiongroup_param(); } return param->get(doc, node); } -guint32 -Parameter::get_color(const SPDocument* doc, const Inkscape::XML::Node* node) +guint32 Parameter::get_color(const SPDocument* doc, Inkscape::XML::Node const *node) const { - ParamColor* param = dynamic_cast(this); - if (param == NULL) + ParamColor const *param = dynamic_cast(this); + if (!param) { throw Extension::param_not_color_param(); + } return param->get(doc, node); } -/** \brief Wrapper to cast to the object and use it's function. */ -bool -Parameter::set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node) +bool Parameter::set_bool(bool in, SPDocument * doc, Inkscape::XML::Node * node) { ParamBool * boolpntr = dynamic_cast(this); if (boolpntr == NULL) @@ -240,9 +208,7 @@ Parameter::set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node) return boolpntr->set(in, doc, node); } -/** \brief Wrapper to cast to the object and use it's function. */ -int -Parameter::set_int (int in, SPDocument * doc, Inkscape::XML::Node * node) +int Parameter::set_int(int in, SPDocument * doc, Inkscape::XML::Node * node) { ParamInt * intpntr = dynamic_cast(this); if (intpntr == NULL) @@ -250,7 +216,7 @@ Parameter::set_int (int in, SPDocument * doc, Inkscape::XML::Node * node) return intpntr->set(in, doc, node); } -/** \brief Wrapper to cast to the object and use it's function. */ +/** Wrapper to cast to the object and use it's function. */ float Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) { @@ -261,9 +227,9 @@ Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) return floatpntr->set(in, doc, node); } -/** \brief Wrapper to cast to the object and use it's function. */ -const gchar * -Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node) +/** Wrapper to cast to the object and use it's function. */ +gchar const * +Parameter::set_string (gchar const * in, SPDocument * doc, Inkscape::XML::Node * node) { ParamString * stringpntr = dynamic_cast(this); if (stringpntr == NULL) @@ -281,7 +247,7 @@ gchar const * Parameter::set_optiongroup( gchar const * in, SPDocument * doc, In } -/** \brief Wrapper to cast to the object and use it's function. */ +/** Wrapper to cast to the object and use it's function. */ guint32 Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) { @@ -292,9 +258,15 @@ Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) } -/** \brief Oop, now that we need a parameter, we need it's name. */ -Parameter::Parameter (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext) : - extension(ext), _name(NULL), _desc(NULL), _scope(scope), _text(NULL), _gui_hidden(gui_hidden), _gui_tip(NULL) +/** Oop, now that we need a parameter, we need it's name. */ +Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, const Parameter::_scope_t scope, bool gui_hidden, gchar const * gui_tip, Inkscape::Extension::Extension * ext) : + _desc(0), + _scope(scope), + _text(0), + _gui_hidden(gui_hidden), + _gui_tip(0), + extension(ext), + _name(0) { if (name != NULL) { _name = g_strdup(name); @@ -316,9 +288,15 @@ Parameter::Parameter (const gchar * name, const gchar * guitext, const gchar * d return; } -/** \brief Oop, now that we need a parameter, we need it's name. */ -Parameter::Parameter (const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext) : - extension(ext), _name(NULL), _desc(NULL), _scope(Parameter::SCOPE_USER), _text(NULL), _gui_hidden(false), _gui_tip(NULL) +/** Oop, now that we need a parameter, we need it's name. */ +Parameter::Parameter (gchar const * name, gchar const * guitext, Inkscape::Extension::Extension * ext) : + _desc(0), + _scope(Parameter::SCOPE_USER), + _text(0), + _gui_hidden(false), + _gui_tip(0), + extension(ext), + _name(0) { if (name != NULL) { _name = g_strdup(name); @@ -332,19 +310,22 @@ Parameter::Parameter (const gchar * name, const gchar * guitext, Inkscape::Exten return; } -/** \brief Just free the allocated name. */ -Parameter::~Parameter (void) +Parameter::~Parameter(void) { g_free(_name); + _name = 0; + g_free(_text); - g_free(_gui_tip); + _text = 0; + + g_free(_gui_tip); + _gui_tip = 0; + g_free(_desc); + _desc = 0; } -/** \brief Build the name to write the parameter from the extension's - ID and the name of this parameter. */ -gchar * -Parameter::pref_name (void) +gchar *Parameter::pref_name(void) const { return g_strdup_printf("%s.%s", extension->get_id(), _name); } @@ -395,49 +376,43 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) return params; } -/** \brief Basically, if there is no widget pass a NULL. */ +/** Basically, if there is no widget pass a NULL. */ Gtk::Widget * Parameter::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) { return NULL; } -/** \brief If I'm not sure which it is, just don't return a value. */ -void -Parameter::string (std::string &/*string*/) +/** If I'm not sure which it is, just don't return a value. */ +void Parameter::string(std::string &/*string*/) const { - return; + // TODO investigate clearing the target string. } -void -Parameter::string (std::list &list) +void Parameter::string(std::list &list) const { std::string value; string(value); - if (value == "") { - return; + if (!value.empty()) { + std::string final; + final += "--"; + final += name(); + final += "="; + final += value; + + list.insert(list.end(), final); } - - std::string final; - final += "--"; - final += name(); - final += "="; - final += value; - - list.insert(list.end(), final); - return; } -/** All the code in Notebook::get_param to get the notebook content. */ -Parameter *Parameter::get_param(const gchar * /*name*/) +Parameter *Parameter::get_param(gchar const * /*name*/) { return NULL; } Glib::ustring const extension_pref_root = "/extensions/"; -} /* namespace Extension */ -} /* namespace Inkscape */ +} // namespace Extension +} // namespace Inkscape /* Local Variables: -- cgit v1.2.3