diff options
| author | Ted Gould <ted@gould.cx> | 2006-05-02 05:28:49 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2006-05-02 05:28:49 +0000 |
| commit | ea07a3251ec366956e9a162b44940718be1141d0 (patch) | |
| tree | cd83cdfac8d6fa5b3a34bb5ffa1fdfbd45d01262 /src | |
| parent | r11518@tres: ted | 2006-04-28 22:21:01 -0700 (diff) | |
| download | inkscape-ea07a3251ec366956e9a162b44940718be1141d0.tar.gz inkscape-ea07a3251ec366956e9a162b44940718be1141d0.zip | |
r11569@tres: ted | 2006-04-29 08:55:02 -0700
Pushing the document and node deeper into the code. This way parameters
can be placed and edited on those. Mostly, this commit involves getting
them into the autogui.
(bzr r689)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/extension.cpp | 20 | ||||
| -rw-r--r-- | src/extension/extension.h | 19 | ||||
| -rw-r--r-- | src/extension/implementation/implementation.cpp | 6 | ||||
| -rw-r--r-- | src/extension/implementation/script.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/bluredge.cpp | 2 | ||||
| -rw-r--r-- | src/extension/parameter.cpp | 98 | ||||
| -rw-r--r-- | src/extension/parameter.h | 18 |
7 files changed, 88 insertions, 77 deletions
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 79f063591..fe23ec557 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -412,7 +412,7 @@ param_shared (const gchar * name, GSList * list) found parameter. */ const gchar * -Extension::get_param_string (const gchar * name, const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_string (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter * param; @@ -432,7 +432,7 @@ Extension::get_param_string (const gchar * name, const Inkscape::XML::Document * found parameter. */ bool -Extension::get_param_bool (const gchar * name, const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_bool (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter * param; @@ -452,7 +452,7 @@ Extension::get_param_bool (const gchar * name, const Inkscape::XML::Document * d found parameter. */ int -Extension::get_param_int (const gchar * name, const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_int (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter * param; @@ -472,7 +472,7 @@ Extension::get_param_int (const gchar * name, const Inkscape::XML::Document * do found parameter. */ float -Extension::get_param_float (const gchar * name, const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_float (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -492,7 +492,7 @@ Extension::get_param_float (const gchar * name, const Inkscape::XML::Document * found parameter. */ bool -Extension::set_param_bool (const gchar * name, bool value, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +Extension::set_param_bool (const gchar * name, bool value, SPDocument * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -512,7 +512,7 @@ Extension::set_param_bool (const gchar * name, bool value, Inkscape::XML::Docume found parameter. */ int -Extension::set_param_int (const gchar * name, int value, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +Extension::set_param_int (const gchar * name, int value, SPDocument * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -532,7 +532,7 @@ Extension::set_param_int (const gchar * name, int value, Inkscape::XML::Document found parameter. */ float -Extension::set_param_float (const gchar * name, float value, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +Extension::set_param_float (const gchar * name, float value, SPDocument * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -552,7 +552,7 @@ Extension::set_param_float (const gchar * name, float value, Inkscape::XML::Docu found parameter. */ const gchar * -Extension::set_param_string (const gchar * name, const gchar * value, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +Extension::set_param_string (const gchar * name, const gchar * value, SPDocument * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -616,7 +616,7 @@ public: 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; @@ -624,7 +624,7 @@ Extension::autogui (void) for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { Parameter * param = reinterpret_cast<Parameter *>(list->data); - Gtk::Widget * widg = param->get_widget(); + Gtk::Widget * widg = param->get_widget(doc, node); gchar const * tip = param->get_tooltip(); agui->addWidget(widg, tip); } diff --git a/src/extension/extension.h b/src/extension/extension.h index f6010b1ea..1e3d8ead0 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -22,6 +22,7 @@ #include <gtkmm/table.h> #include <glibmm/ustring.h> #include "xml/repr.h" +#include "document.h" #include "extension/extension-forward.h" /** The key that is used to identify that the I/O should be autodetected */ @@ -143,32 +144,32 @@ private: #endif public: bool get_param_bool (const gchar * name, - const Inkscape::XML::Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); int get_param_int (const gchar * name, - const Inkscape::XML::Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); float get_param_float (const gchar * name, - const Inkscape::XML::Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); const gchar * get_param_string (const gchar * name, - const Inkscape::XML::Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); bool set_param_bool (const gchar * name, bool value, - Inkscape::XML::Document * doc = NULL, + SPDocument * doc = NULL, Inkscape::XML::Node * node = NULL); int set_param_int (const gchar * name, int value, - Inkscape::XML::Document * doc = NULL, + SPDocument * doc = NULL, Inkscape::XML::Node * node = NULL); float set_param_float (const gchar * name, float value, - Inkscape::XML::Document * doc = NULL, + SPDocument * doc = NULL, Inkscape::XML::Node * node = NULL); const gchar * set_param_string (const gchar * name, const gchar * value, - Inkscape::XML::Document * doc = NULL, + SPDocument * doc = NULL, Inkscape::XML::Node * node = NULL); /* Error file handling */ @@ -177,7 +178,7 @@ public: static void error_file_close (void); public: - Gtk::Widget * autogui (void); + Gtk::Widget * autogui (SPDocument * doc, Inkscape::XML::Node * node); Glib::ustring * paramString (void); /* Extension editor dialog stuff */ diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index fe7c03463..a621dc838 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -46,7 +46,7 @@ Implementation::check(Inkscape::Extension::Extension *module) { Gtk::Widget * Implementation::prefs_input(Inkscape::Extension::Input *module, gchar const *filename) { - return module->autogui(); + return module->autogui(NULL, NULL); } /* Implementation::prefs_input */ SPDocument * @@ -57,7 +57,7 @@ Implementation::open(Inkscape::Extension::Input *module, gchar const *filename) Gtk::Widget * Implementation::prefs_output(Inkscape::Extension::Output *module) { - return module->autogui(); + return module->autogui(NULL, NULL); } /* Implementation::prefs_output */ void @@ -68,7 +68,7 @@ Implementation::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar Gtk::Widget * Implementation::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *view) { - return module->autogui(); + return module->autogui(NULL, NULL); } /* Implementation::prefs_effect */ void diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 8f121800f..e28015f6f 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -380,7 +380,7 @@ Script::prefs_output(Inkscape::Extension::Output *module) Gtk::Widget * Script::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *view) { - return module->autogui(); + return module->autogui(NULL, NULL); } /** diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index aa1e849b2..29036df7a 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -122,7 +122,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View Gtk::Widget * BlurEdge::prefs_effect(Inkscape::Extension::Effect * module, Inkscape::UI::View::View * view) { - return module->autogui(); + return module->autogui(NULL, NULL); } #include "clear-n_.h" diff --git a/src/extension/parameter.cpp b/src/extension/parameter.cpp index b407db9a9..eda540a9d 100644 --- a/src/extension/parameter.cpp +++ b/src/extension/parameter.cpp @@ -22,6 +22,8 @@ #include <glibmm/i18n.h> +#include <xml/node.h> + #include "extension.h" #include "prefs-utils.h" #include "document-private.h" @@ -44,9 +46,9 @@ private: public: ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); /** \brief Returns \c _value */ - bool get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) { return _value; } - bool set (bool in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node); - Gtk::Widget * get_widget(void); + bool get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; } + bool set (bool in, SPDocument * doc, Inkscape::XML::Node * node); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node); Glib::ustring * string (void); }; @@ -80,11 +82,11 @@ private: public: ParamInt (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); /** \brief Returns \c _value */ - int get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) { return _value; } - int set (int in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node); + int get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; } + int set (int in, SPDocument * doc, Inkscape::XML::Node * node); int max (void) { return _max; } int min (void) { return _min; } - Gtk::Widget * get_widget(void); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node); Glib::ustring * string (void); }; @@ -134,11 +136,11 @@ private: public: ParamFloat (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); /** \brief Returns \c _value */ - float get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) { return _value; } - float set (float in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node); + float get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; } + float set (float in, SPDocument * doc, Inkscape::XML::Node * node); float max (void) { return _max; } float min (void) { return _min; } - Gtk::Widget * get_widget(void); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node); Glib::ustring * string (void); }; @@ -188,9 +190,9 @@ public: ParamString(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); ~ParamString(void); /** \brief Returns \c _value, with a \i const to protect it. */ - const gchar * get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) { return _value; } - const gchar * set (const gchar * in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node); - Gtk::Widget * get_widget(void); + const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; } + const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node); Glib::ustring * string (void); }; @@ -277,7 +279,7 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * and \c pref_name() are used. */ bool -ParamBool::set (bool in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +ParamBool::set (bool in, SPDocument * doc, Inkscape::XML::Node * node) { _value = in; @@ -298,7 +300,7 @@ ParamBool::set (bool in, Inkscape::XML::Document * doc, Inkscape::XML::Node * no and \c pref_name() are used. */ int -ParamInt::set (int in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +ParamInt::set (int in, SPDocument * doc, Inkscape::XML::Node * node) { _value = in; if (_value > _max) _value = _max; @@ -321,7 +323,7 @@ ParamInt::set (int in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node and \c pref_name() are used. */ float -ParamFloat::set (float in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +ParamFloat::set (float in, SPDocument * doc, Inkscape::XML::Node * node) { _value = in; if (_value > _max) _value = _max; @@ -348,7 +350,7 @@ ParamFloat::set (float in, Inkscape::XML::Document * doc, Inkscape::XML::Node * the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamString::set (const gchar * in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +ParamString::set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node) { if (in == NULL) return NULL; /* Can't have NULL string */ @@ -365,7 +367,7 @@ ParamString::set (const gchar * in, Inkscape::XML::Document * doc, Inkscape::XML /** \brief Wrapper to cast to the object and use it's function. */ bool -Parameter::get_bool (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) +Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamBool * boolpntr; boolpntr = dynamic_cast<ParamBool *>(this); @@ -376,7 +378,7 @@ Parameter::get_bool (const Inkscape::XML::Document * doc, const Inkscape::XML::N /** \brief Wrapper to cast to the object and use it's function. */ int -Parameter::get_int (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) +Parameter::get_int (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamInt * intpntr; intpntr = dynamic_cast<ParamInt *>(this); @@ -387,7 +389,7 @@ Parameter::get_int (const Inkscape::XML::Document * doc, const Inkscape::XML::No /** \brief Wrapper to cast to the object and use it's function. */ float -Parameter::get_float (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) +Parameter::get_float (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamFloat * floatpntr; floatpntr = dynamic_cast<ParamFloat *>(this); @@ -398,7 +400,7 @@ Parameter::get_float (const Inkscape::XML::Document * doc, const Inkscape::XML:: /** \brief Wrapper to cast to the object and use it's function. */ const gchar * -Parameter::get_string (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) +Parameter::get_string (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamString * stringpntr; stringpntr = dynamic_cast<ParamString *>(this); @@ -409,7 +411,7 @@ Parameter::get_string (const Inkscape::XML::Document * doc, const Inkscape::XML: /** \brief Wrapper to cast to the object and use it's function. */ bool -Parameter::set_bool (bool in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +Parameter::set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node) { ParamBool * boolpntr; boolpntr = dynamic_cast<ParamBool *>(this); @@ -420,7 +422,7 @@ Parameter::set_bool (bool in, Inkscape::XML::Document * doc, Inkscape::XML::Node /** \brief Wrapper to cast to the object and use it's function. */ int -Parameter::set_int (int in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +Parameter::set_int (int in, SPDocument * doc, Inkscape::XML::Node * node) { ParamInt * intpntr; intpntr = dynamic_cast<ParamInt *>(this); @@ -431,7 +433,7 @@ Parameter::set_int (int in, Inkscape::XML::Document * doc, Inkscape::XML::Node * /** \brief Wrapper to cast to the object and use it's function. */ float -Parameter::set_float (float in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) { ParamFloat * floatpntr; floatpntr = dynamic_cast<ParamFloat *>(this); @@ -442,7 +444,7 @@ Parameter::set_float (float in, Inkscape::XML::Document * doc, Inkscape::XML::No /** \brief Wrapper to cast to the object and use it's function. */ const gchar * -Parameter::set_string (const gchar * in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node) +Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node) { ParamString * stringpntr; stringpntr = dynamic_cast<ParamString *>(this); @@ -558,7 +560,7 @@ Parameter::document_param_node (SPDocument * doc) /** \brief Basically, if there is no widget pass a NULL. */ Gtk::Widget * -Parameter::get_widget (void) +Parameter::get_widget (SPDocument * doc, Inkscape::XML::Node * node) { return NULL; } @@ -575,11 +577,13 @@ Parameter::string (void) class ParamFloatAdjustment : public Gtk::Adjustment { /** The parameter to adjust */ ParamFloat * _pref; + SPDocument * _doc; + Inkscape::XML::Node * _node; public: /** \brief Make the adjustment using an extension and the string describing the parameter. */ - ParamFloatAdjustment (ParamFloat * param) : - Gtk::Adjustment(0.0, param->min(), param->max(), 0.1), _pref(param) { + ParamFloatAdjustment (ParamFloat * param, SPDocument * doc, Inkscape::XML::Node * node) : + Gtk::Adjustment(0.0, param->min(), param->max(), 0.1), _pref(param), _doc(doc), _node(node) { this->set_value(_pref->get(NULL, NULL) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamFloatAdjustment::val_changed)); return; @@ -598,7 +602,7 @@ void ParamFloatAdjustment::val_changed (void) { // std::cout << "Value Changed to: " << this->get_value() << std::endl; - _pref->set(this->get_value(), NULL /* \todo fix */, NULL); + _pref->set(this->get_value(), _doc, _node); return; } @@ -606,11 +610,13 @@ ParamFloatAdjustment::val_changed (void) class ParamIntAdjustment : public Gtk::Adjustment { /** The parameter to adjust */ ParamInt * _pref; + SPDocument * _doc; + Inkscape::XML::Node * _node; public: /** \brief Make the adjustment using an extension and the string describing the parameter. */ - ParamIntAdjustment (ParamInt * param) : - Gtk::Adjustment(0.0, param->min(), param->max(), 1.0), _pref(param) { + ParamIntAdjustment (ParamInt * param, SPDocument * doc, Inkscape::XML::Node * node) : + Gtk::Adjustment(0.0, param->min(), param->max(), 1.0), _pref(param), _doc(doc), _node(node) { this->set_value(_pref->get(NULL, NULL) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamIntAdjustment::val_changed)); return; @@ -629,7 +635,7 @@ void ParamIntAdjustment::val_changed (void) { // std::cout << "Value Changed to: " << this->get_value() << std::endl; - _pref->set((int)this->get_value(), NULL /* \todo fix */, NULL); + _pref->set((int)this->get_value(), _doc, _node); return; } @@ -639,7 +645,7 @@ ParamIntAdjustment::val_changed (void) Builds a hbox with a label and a float adjustment in it. */ Gtk::Widget * -ParamFloat::get_widget (void) +ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node) { Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); @@ -647,7 +653,7 @@ ParamFloat::get_widget (void) label->show(); hbox->pack_start(*label, true, true); - ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this)); + ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node)); Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 0.1, 1)); spin->show(); hbox->pack_start(*spin, false, false); @@ -663,7 +669,7 @@ ParamFloat::get_widget (void) Builds a hbox with a label and a int adjustment in it. */ Gtk::Widget * -ParamInt::get_widget (void) +ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node) { Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); @@ -671,7 +677,7 @@ ParamInt::get_widget (void) label->show(); hbox->pack_start(*label, true, true); - ParamIntAdjustment * fadjust = Gtk::manage(new ParamIntAdjustment(this)); + ParamIntAdjustment * fadjust = Gtk::manage(new ParamIntAdjustment(this, doc, node)); Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 1.0, 0)); spin->show(); hbox->pack_start(*spin, false, false); @@ -688,6 +694,8 @@ class ParamBoolCheckButton : public Gtk::CheckButton { private: /** \brief Param to change */ ParamBool * _pref; + SPDocument * _doc; + Inkscape::XML::Node * _node; public: /** \brief Initialize the check button \param param Which parameter to adjust on changing the check button @@ -695,8 +703,8 @@ public: This function sets the value of the checkbox to be that of the parameter, and then sets up a callback to \c on_toggle. */ - ParamBoolCheckButton (ParamBool * param) : - Gtk::CheckButton(), _pref(param) { + ParamBoolCheckButton (ParamBool * param, SPDocument * doc, Inkscape::XML::Node * node) : + Gtk::CheckButton(), _pref(param), _doc(doc), _node(node) { this->set_active(_pref->get(NULL, NULL) /**\todo fix */); this->signal_toggled().connect(sigc::mem_fun(this, &ParamBoolCheckButton::on_toggle)); return; @@ -722,7 +730,7 @@ ParamBoolCheckButton::on_toggle (void) Builds a hbox with a label and a check button in it. */ Gtk::Widget * -ParamBool::get_widget (void) +ParamBool::get_widget (SPDocument * doc, Inkscape::XML::Node * node) { Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); @@ -730,7 +738,7 @@ ParamBool::get_widget (void) label->show(); hbox->pack_start(*label, true, true); - ParamBoolCheckButton * checkbox = new ParamBoolCheckButton(this); + ParamBoolCheckButton * checkbox = new ParamBoolCheckButton(this, doc, node); checkbox->show(); hbox->pack_start(*checkbox, false, false); @@ -743,13 +751,15 @@ ParamBool::get_widget (void) class ParamStringEntry : public Gtk::Entry { private: ParamString * _pref; + SPDocument * _doc; + Inkscape::XML::Node * _node; public: /** \brief Build a string preference for the given parameter \param pref Where to get the string from, and where to put it when it changes. */ - ParamStringEntry (ParamString * pref) : - Gtk::Entry(), _pref(pref) { + ParamStringEntry (ParamString * pref, SPDocument * doc, Inkscape::XML::Node * node) : + Gtk::Entry(), _pref(pref), _doc(doc), _node(node) { if (_pref->get(NULL, NULL) != NULL) this->set_text(Glib::ustring(_pref->get(NULL, NULL))); this->signal_changed().connect(sigc::mem_fun(this, &ParamStringEntry::changed_text)); @@ -766,7 +776,7 @@ void ParamStringEntry::changed_text (void) { Glib::ustring data = this->get_text(); - _pref->set(data.c_str(), NULL, NULL); + _pref->set(data.c_str(), _doc, _node); return; } @@ -776,7 +786,7 @@ ParamStringEntry::changed_text (void) Builds a hbox with a label and a text box in it. */ Gtk::Widget * -ParamString::get_widget (void) +ParamString::get_widget (SPDocument * doc, Inkscape::XML::Node * node) { Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); @@ -784,7 +794,7 @@ ParamString::get_widget (void) label->show(); hbox->pack_start(*label, true, true); - ParamStringEntry * textbox = new ParamStringEntry(this); + ParamStringEntry * textbox = new ParamStringEntry(this, doc, node); textbox->show(); hbox->pack_start(*textbox, false, false); diff --git a/src/extension/parameter.h b/src/extension/parameter.h index 806876e73..e1e27302c 100644 --- a/src/extension/parameter.h +++ b/src/extension/parameter.h @@ -68,24 +68,24 @@ public: Parameter(name, guitext, NULL, Parameter::SCOPE_USER, ext); }; virtual ~Parameter (void); - bool get_bool (const Inkscape::XML::Document * doc, + bool get_bool (const SPDocument * doc, const Inkscape::XML::Node * node); - int get_int (const Inkscape::XML::Document * doc, + int get_int (const SPDocument * doc, const Inkscape::XML::Node * node); - float get_float (const Inkscape::XML::Document * doc, + float get_float (const SPDocument * doc, const Inkscape::XML::Node * node); - const gchar * get_string (const Inkscape::XML::Document * doc, + const gchar * get_string (const SPDocument * doc, const Inkscape::XML::Node * node); - bool set_bool (bool in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node); - int set_int (int in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node); - float set_float (float in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node); - const gchar * set_string (const gchar * in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node); + bool set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node); + int set_int (int in, SPDocument * doc, Inkscape::XML::Node * node); + float set_float (float in, SPDocument * doc, Inkscape::XML::Node * node); + const gchar * set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); const gchar * name (void) {return _name;} static Parameter * make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext); - virtual Gtk::Widget * get_widget (void); + virtual Gtk::Widget * get_widget (SPDocument * doc, Inkscape::XML::Node * node); virtual Glib::ustring * string (void); gchar const * get_tooltip (void) { return _desc; } }; |
