index a4ae7de9b8fecfc43d82fea87a88020a1e22347f..b4cf06bda3b513490631118270c61b17cd5a7f78 100644 (file)
not related to the module directly. If the Repr does not include
a name and an ID the module will be left in an errored state.
*/
-Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) : _help(NULL)
+Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp)
+ : _help(NULL)
+ , _gui(true)
{
repr = in_repr;
Inkscape::GC::anchor(in_repr);
/* TODO: Handle what happens if we don't have these two */
while (child_repr != NULL) {
char const * chname = child_repr->name();
+ if (!strncmp(chname, INKSCAPE_EXTENSION_NS_NC, strlen(INKSCAPE_EXTENSION_NS_NC))) {
+ chname += strlen(INKSCAPE_EXTENSION_NS);
+ }
if (chname[0] == '_') /* Allow _ for translation of tags */
chname++;
if (!strcmp(chname, "id")) {
@@ -435,6 +440,14 @@ Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Ink
return param->get_enum(doc, node);
}
+
+gchar const *Extension::get_param_optiongroup( gchar const * name, SPDocument const * doc, Inkscape::XML::Node const * node)
+{
+ Parameter* param = param_shared(name, parameters);
+ return param->get_optiongroup(doc, node);
+}
+
+
/**
\return The value of the parameter identified by the name
\brief Gets a parameter identified by name with the bool placed
@@ -592,6 +605,13 @@ Extension::set_param_string (const gchar * name, const gchar * value, SPDocument
return param->set_string(value, doc, node);
}
+gchar const * Extension::set_param_optiongroup(gchar const * name, gchar const * value, SPDocument * doc, Inkscape::XML::Node * node)
+{
+ Parameter * param = param_shared(name, parameters);
+ return param->set_optiongroup(value, doc, node);
+}
+
+
/**
\return The passed in value
\brief Sets a parameter identified by name with the string
function to get each widget. Then, each of those is placed into
a Gtk::VBox, which is then returned to the calling function.
- If there are no parameters, this function just returns NULL.
+ If there are no visible parameters, this function just returns NULL.
+ If all parameters are gui_visible = false NULL is returned as well.
*/
Gtk::Widget *
Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (g_slist_length(parameters) == 0) return NULL;
+ if (!_gui || param_visible_count() == 0) return NULL;
AutoGUI * agui = Gtk::manage(new AutoGUI());
+ //go through the list of parameters to see if there are any non-hidden ones
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
+ if (param->get_gui_hidden()) continue; //Ignore hidden parameters
Gtk::Widget * widg = param->get_widget(doc, node, changeSignal);
gchar const * tip = param->get_tooltip();
agui->addWidget(widg, tip);
- }
-
+ }
+
agui->show();
return agui;
};
Gtk::VBox * retval = Gtk::manage(new Gtk::VBox());
if (_help == NULL) {
- Gtk::Label * content = Gtk::manage(new Gtk::Label("Currently there is no help available for this Extension. Please look on the Inkscape website or ask on the mailing lists if you have questions regarding this extension."));
+ Gtk::Label * content = Gtk::manage(new Gtk::Label(_("Currently there is no help available for this Extension. Please look on the Inkscape website or ask on the mailing lists if you have questions regarding this extension.")));
retval->pack_start(*content, true, true, 5);
content->set_line_wrap(true);
content->show();
return retval;
}
+unsigned int Extension::param_visible_count ( )
+{
+ unsigned int _visible_count = 0;
+ for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
+ Parameter * param = reinterpret_cast<Parameter *>(list->data);
+ if (!param->get_gui_hidden()) _visible_count++;
+ }
+ return _visible_count;
+}
+
} /* namespace Extension */
} /* namespace Inkscape */