index b356c297e9c3a75696fbb617024ca097b1e8daf6..94260cc56523e59ed3bdd0416d86a952e21c6e5f 100644 (file)
-/** \file
- * Parameters for extensions.
+/** @file
+ * @brief Parameters for extensions.
*/
-
-/*
- * Author:
+/* Author:
* Ted Gould <ted@gould.cx>
* Johan Engelen <johan@shouraizou.nl>
*
#include "bool.h"
#include "color.h"
#include "description.h"
+#include "groupheader.h"
#include "enum.h"
#include "float.h"
#include "int.h"
@@ -103,6 +102,7 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
}
/* 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) {
@@ -135,12 +135,18 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
}
} 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);
} 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")) {
param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "optiongroup")) {
- param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
+ if (appearance && !strcmp(appearance, "minimal")) {
+ param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamRadioButton::MINIMAL);
+ } else {
+ param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamRadioButton::FULL);
+ }
} else if (!strcmp(type, "color")) {
param = new ParamColor(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
}
@@ -149,8 +155,6 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
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)
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)
+{
+ ParamRadioButton * param = dynamic_cast<ParamRadioButton *>(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)
{
@@ -250,6 +264,17 @@ Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node *
throw Extension::param_not_string_param();
return stringpntr->set(in, doc, node);
}
+
+gchar const * Parameter::set_optiongroup( gchar const * in, SPDocument * doc, Inkscape::XML::Node * node )
+{
+ ParamRadioButton *param = dynamic_cast<ParamRadioButton *>(this);
+ if (!param) {
+ throw Extension::param_not_optiongroup_param();
+ }
+ return param->set(in, doc, node);
+}
+
+
/** \brief Wrapper to cast to the object and use it's function. */
guint32
Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node)
@@ -270,7 +295,7 @@ Parameter::Parameter (const gchar * name, const gchar * guitext, const gchar * d
}
if (desc != NULL) {
_desc = g_strdup(desc);
- // printf("Adding description: '%s' on '%s'\n", _desc, _name);
+// printf("Adding description: '%s' on '%s'\n", _desc, _name);
}
if (gui_tip != NULL) {
_gui_tip = g_strdup(gui_tip);
g_free(_name);
g_free(_text);
g_free(_gui_tip);
+ g_free(_desc);
}
/** \brief Build the name to write the parameter from the extension's
retval->setAttribute("name", _name);
parent->appendChild(retval);
+ Inkscape::GC::release(retval);
return retval;
}
params = xml_doc->createElement("inkscape:extension-param");
params->setAttribute("extension", extension->get_id());
defs->appendChild(params);
+ Inkscape::GC::release(params);
}
return params;
return;
}
+/** \brief All the code in Notebook::get_param to get the notebook content */
+Parameter *
+Parameter::get_param(const gchar * name)
+{
+ return NULL;
+}
+
+Glib::ustring const extension_pref_root = "/extensions/";
+
} /* namespace Extension */
} /* namespace Inkscape */
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :