index 6eb3a1728abd1dce629d25a9e6bf2433c5db24e8..fe23ec5574112c4d7b974ae566e368ebf9846b0a 100644 (file)
#include <gtkmm/label.h>
#include <gtkmm/frame.h>
#include <gtkmm/table.h>
+#include <gtkmm/tooltips.h>
#include "inkscape.h"
#include "extension/implementation/implementation.h"
in value. It isn't duplicated into the value string.
\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.
*/
const gchar *
-Extension::get_param_string (const gchar * name, const Inkscape::XML::Document * doc)
+Extension::get_param_string (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node)
{
Parameter * param;
param = param_shared(name, parameters);
- return param->get_string(doc);
+ return param->get_string(doc, node);
}
/**
@@ -424,17 +426,18 @@ Extension::get_param_string (const gchar * name, const Inkscape::XML::Document *
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.
*/
bool
-Extension::get_param_bool (const gchar * name, const Inkscape::XML::Document * doc)
+Extension::get_param_bool (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node)
{
Parameter * param;
param = param_shared(name, parameters);
- return param->get_bool(doc);
+ return param->get_bool(doc, node);
}
/**
@@ -443,17 +446,18 @@ Extension::get_param_bool (const gchar * name, const Inkscape::XML::Document * d
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.
*/
int
-Extension::get_param_int (const gchar * name, const Inkscape::XML::Document * doc)
+Extension::get_param_int (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node)
{
Parameter * param;
param = param_shared(name, parameters);
- return param->get_int(doc);
+ return param->get_int(doc, node);
}
/**
@@ -462,16 +466,17 @@ Extension::get_param_int (const gchar * name, const Inkscape::XML::Document * do
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.
*/
float
-Extension::get_param_float (const gchar * name, const Inkscape::XML::Document * doc)
+Extension::get_param_float (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node)
{
Parameter * param;
param = param_shared(name, parameters);
- return param->get_float(doc);
+ return param->get_float(doc, node);
}
/**
@@ -481,16 +486,17 @@ Extension::get_param_float (const gchar * name, const Inkscape::XML::Document *
\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.
*/
bool
-Extension::set_param_bool (const gchar * name, bool value, Inkscape::XML::Document * doc)
+Extension::set_param_bool (const gchar * name, bool value, SPDocument * doc, Inkscape::XML::Node * node)
{
Parameter * param;
param = param_shared(name, parameters);
- return param->set_bool(value, doc);
+ return param->set_bool(value, doc, node);
}
/**
@@ -500,16 +506,17 @@ Extension::set_param_bool (const gchar * name, bool value, Inkscape::XML::Docume
\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.
*/
int
-Extension::set_param_int (const gchar * name, int value, Inkscape::XML::Document * doc)
+Extension::set_param_int (const gchar * name, int value, SPDocument * doc, Inkscape::XML::Node * node)
{
Parameter * param;
param = param_shared(name, parameters);
- return param->set_int(value, doc);
+ return param->set_int(value, doc, node);
}
/**
@@ -519,16 +526,17 @@ Extension::set_param_int (const gchar * name, int value, Inkscape::XML::Document
\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.
*/
float
-Extension::set_param_float (const gchar * name, float value, Inkscape::XML::Document * doc)
+Extension::set_param_float (const gchar * name, float value, SPDocument * doc, Inkscape::XML::Node * node)
{
Parameter * param;
param = param_shared(name, parameters);
- return param->set_float(value, doc);
+ return param->set_float(value, doc, node);
}
/**
@@ -538,16 +546,17 @@ Extension::set_param_float (const gchar * name, float value, Inkscape::XML::Docu
\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.
*/
const gchar *
-Extension::set_param_string (const gchar * name, const gchar * value, Inkscape::XML::Document * doc)
+Extension::set_param_string (const gchar * name, const gchar * value, SPDocument * doc, Inkscape::XML::Node * node)
{
Parameter * param;
param = param_shared(name, parameters);
- return param->set_string(value, doc);
+ return param->set_string(value, doc, node);
}
/** \brief A function to open the error log file. */
error_file.close();
};
+/** \brief A widget to represent the inside of an AutoGUI widget */
+class AutoGUI : public Gtk::VBox {
+ Gtk::Tooltips _tooltips;
+public:
+ /** \brief Create an AutoGUI object */
+ AutoGUI (void) : Gtk::VBox() {};
+ /** \brief Adds a widget with a tool tip into the autogui
+ \param widg Widget to add
+ \param tooltip Tooltip for the widget
+
+ If there is no widget, nothing happens. Otherwise it is just
+ added into the VBox. If there is a tooltip (non-NULL) then it
+ is placed on the widget.
+ */
+ void addWidget (Gtk::Widget * widg, gchar const * tooltip) {
+ if (widg == NULL) return;
+ this->pack_start(*widg, true, true);
+ if (tooltip != NULL) {
+ _tooltips.set_tip(*widg, Glib::ustring(tooltip));
+ // printf("Setting tooltip: %s\n", tooltip);
+ }
+ return;
+ };
+};
+
/** \brief A function to automatically generate a GUI using the parameters
\return Generated widget
If there are no parameters, this function just returns NULL.
*/
Gtk::Widget *
-Extension::autogui (void)
+Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node)
{
if (g_slist_length(parameters) == 0) return NULL;
- Gtk::VBox * vbox = new Gtk::VBox();
- vbox = new Gtk::VBox();
+ AutoGUI * agui = Gtk::manage(new AutoGUI());
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
- Gtk::Widget * widg = param->get_widget();
- if (widg != NULL)
- vbox->pack_start(*widg, true, true);
+ Gtk::Widget * widg = param->get_widget(doc, node);
+ gchar const * tip = param->get_tooltip();
+ agui->addWidget(widg, tip);
}
- vbox->show();
- return vbox;
+ agui->show();
+ return agui;
};
/**