index fe23ec5574112c4d7b974ae566e368ebf9846b0a..825a935adc93d0babac69cf0c9210fc498d0391a 100644 (file)
@@ -91,15 +91,15 @@ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementat
if (!strcmp(chname, "help")) {
_help = g_strdup (sp_repr_children(child_repr)->content());
} /* name */
- if (!strcmp(chname, "param")) {
+ if (!strcmp(chname, "param") || !strcmp(chname, "_param")) {
Parameter * param;
param = Parameter::make(child_repr, this);
if (param != NULL)
parameters = g_slist_append(parameters, param);
- } /* param */
+ } /* param || _param */
if (!strcmp(chname, "dependency")) {
_deps.push_back(new Dependency(child_repr));
- } /* param */
+ } /* dependency */
child_repr = sp_repr_next(child_repr);
}
delete timer;
timer = NULL;
/** \todo Need to do parameters here */
-
+
+ // delete parameters:
+ for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
+ Parameter * param = reinterpret_cast<Parameter *>(list->data);
+ delete param;
+ }
+ g_slist_free(parameters);
+
+
for (unsigned int i = 0 ; i < _deps.size(); i++) {
delete _deps[i];
}
@@ -420,6 +428,13 @@ Extension::get_param_string (const gchar * name, const SPDocument * doc, const I
return param->get_string(doc, node);
}
+const gchar *
+Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node)
+{
+ Parameter* param = param_shared(name, parameters);
+ return param->get_enum(doc, node);
+}
+
/**
\return The value of the parameter identified by the name
\brief Gets a parameter identified by name with the bool placed
@@ -479,6 +494,24 @@ Extension::get_param_float (const gchar * name, const SPDocument * doc, const In
return param->get_float(doc, node);
}
+/**
+ \return The string value for the parameter specified
+ \brief Gets a parameter identified by name with the float placed
+ in value.
+ \param name The name of the parameter to get
+ \param doc The document to look in for document specific parameters
+ \param node The node to look in for a specific parameter
+
+ Look up in the parameters list, then execute the function on that
+ found parameter.
+*/
+guint32
+Extension::get_param_color (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node)
+{
+ Parameter* param = param_shared(name, parameters);
+ return param->get_color(doc, node);
+}
+
/**
\return The passed in value
\brief Sets a parameter identified by name with the boolean
@@ -559,6 +592,25 @@ Extension::set_param_string (const gchar * name, const gchar * value, SPDocument
return param->set_string(value, doc, node);
}
+/**
+ \return The passed in value
+ \brief Sets a parameter identified by name with the string
+ in the parameter value.
+ \param name The name of the parameter to set
+ \param value The value to set the parameter to
+ \param doc The document to look in for document specific parameters
+ \param node The node to look in for a specific parameter
+
+ Look up in the parameters list, then execute the function on that
+ found parameter.
+*/
+guint32
+Extension::set_param_color (const gchar * name, guint32 color, SPDocument * doc, Inkscape::XML::Node * node)
+{
+ Parameter* param = param_shared(name, parameters);
+ return param->set_color(color, doc, node);
+}
+
/** \brief A function to open the error log file. */
void
Extension::error_file_open (void)
*/
void addWidget (Gtk::Widget * widg, gchar const * tooltip) {
if (widg == NULL) return;
- this->pack_start(*widg, true, true);
+ this->pack_start(*widg, true, true, 2);
if (tooltip != NULL) {
_tooltips.set_tip(*widg, Glib::ustring(tooltip));
- // printf("Setting tooltip: %s\n", tooltip);
}
return;
};
If there are no parameters, this function just returns NULL.
*/
Gtk::Widget *
-Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node)
+Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
if (g_slist_length(parameters) == 0) return NULL;
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
- Gtk::Widget * widg = param->get_widget(doc, node);
+ Gtk::Widget * widg = param->get_widget(doc, node, changeSignal);
gchar const * tip = param->get_tooltip();
agui->addWidget(widg, tip);
}
/**
\brief A function to get the parameters in a string form
- \return A string with all the parameters as command line arguements
-
- I don't really like this function, but it works for now.
+ \return An array with all the parameters in it.
- \todo Do this better.
*/
-Glib::ustring *
-Extension::paramString (void)
+void
+Extension::paramListString (std::list <std::string> &retlist)
{
- Glib::ustring * param_string = new Glib::ustring("");
+ //std::list <std::string> retarray;
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
- *param_string += " --";
- *param_string += param->name();
- *param_string += "=";
- Glib::ustring * paramstr = param->string();
- *param_string += *paramstr;
- delete paramstr;
+ std::string param_string;
+ param_string += "--";
+ param_string += param->name();
+ param_string += "=";
+ Glib::ustring * out = param->string();
+ param_string += *out;
+ delete out;
+
+ retlist.insert(retlist.end(), param_string);
}
+ //g_message("paramstring=%s", param_string->c_str());
- return param_string;
+ return;
}
/* Extension editor dialog stuff */