diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-01-15 23:43:23 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-01-15 23:43:23 +0000 |
| commit | b32949eaefba1f07e3898efe060b21a6377b6741 (patch) | |
| tree | 21e97f39886b62bcc5fa2a284a61640cfdfb62a6 /src/live_effects/parameter | |
| parent | Slightly more 'object-oriented' way to invoke item-specific conversion-to-gui... (diff) | |
| download | inkscape-b32949eaefba1f07e3898efe060b21a6377b6741.tar.gz inkscape-b32949eaefba1f07e3898efe060b21a6377b6741.zip | |
RegisteredCheckbutton is now subclassed from RegisteredWidget<CheckButton>
(bzr r4500)
Diffstat (limited to 'src/live_effects/parameter')
| -rw-r--r-- | src/live_effects/parameter/bool.cpp | 27 | ||||
| -rw-r--r-- | src/live_effects/parameter/bool.h | 2 | ||||
| -rw-r--r-- | src/live_effects/parameter/point.cpp | 56 | ||||
| -rw-r--r-- | src/live_effects/parameter/point.h | 3 |
4 files changed, 38 insertions, 50 deletions
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp index 14fd88423..383dc8186 100644 --- a/src/live_effects/parameter/bool.cpp +++ b/src/live_effects/parameter/bool.cpp @@ -28,13 +28,10 @@ BoolParam::BoolParam( const Glib::ustring& label, const Glib::ustring& tip, Effect* effect, bool default_value ) : Parameter(label, tip, key, wr, effect), value(default_value), defvalue(default_value) { - checkwdg = NULL; } BoolParam::~BoolParam() { - if (checkwdg) - delete checkwdg; } void @@ -60,23 +57,25 @@ BoolParam::param_writeSVGValue() const Gtk::Widget * BoolParam::param_newWidget(Gtk::Tooltips * tooltips) { - // WIDGET TODO: This implementation is incorrect, it should create a *new* widget for the caller, not just return an already created widget - g_warning("BoolParam::param_newWidget still needs recoding to work with multiple document views"); - if (!checkwdg) { - checkwdg = new Inkscape::UI::Widget::RegisteredCheckButton(); - checkwdg->init(param_label, param_tooltip, param_key, *param_wr, false, param_effect->getRepr(), param_effect->getSPDoc()); - checkwdg->setActive(value); - checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change bool parameter")); - } - return dynamic_cast<Gtk::Widget *> (checkwdg->_button); + Inkscape::UI::Widget::RegisteredCheckButton * checkwdg = Gtk::manage( + new Inkscape::UI::Widget::RegisteredCheckButton( param_label, + param_tooltip, + param_key, + *param_wr, + false, + param_effect->getRepr(), + param_effect->getSPDoc()) ); + + checkwdg->setActive(value); + checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change bool parameter")); + + return dynamic_cast<Gtk::Widget *> (checkwdg); } void BoolParam::param_setValue(bool newvalue) { value = newvalue; - if (checkwdg) - checkwdg->setActive(newvalue); } } /* namespace LivePathEffect */ diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h index 38811812d..55197721d 100644 --- a/src/live_effects/parameter/bool.h +++ b/src/live_effects/parameter/bool.h @@ -45,8 +45,6 @@ private: BoolParam(const BoolParam&); BoolParam& operator=(const BoolParam&); - Inkscape::UI::Widget::RegisteredCheckButton * checkwdg; - bool value; bool defvalue; }; diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 5284bc797..31c4ae55b 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -32,19 +32,11 @@ PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip, Effect* effect, Geom::Point default_value ) : Geom::Point(default_value), Parameter(label, tip, key, wr, effect), defvalue(default_value) { - _widget = NULL; - pointwdg = NULL; knot = NULL; - _tooltips = NULL; } PointParam::~PointParam() { - if (pointwdg) - delete pointwdg; - if (_tooltips) - delete _tooltips; - if (knot) g_object_unref (G_OBJECT (knot)); } @@ -84,39 +76,41 @@ PointParam::param_newWidget(Gtk::Tooltips * tooltips) { // WIDGET TODO: This implementation is incorrect, it should create a *new* widget for the caller, not just return an already created widget g_warning("PointParam::param_newWidget still needs recoding to work with multiple document views"); - if (!_widget) { - pointwdg = new Inkscape::UI::Widget::RegisteredPoint(); - pointwdg->init(param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc()); - pointwdg->setValue( (*this)[0], (*this)[1] ); - pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter")); - - Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "draw_node", Inkscape::ICON_SIZE_BUTTON) ); - Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - pButton->signal_clicked().connect(sigc::mem_fun(*this, &PointParam::on_button_click)); + Inkscape::UI::Widget::RegisteredPoint * pointwdg = Gtk::manage( + new Inkscape::UI::Widget::RegisteredPoint( param_label, + param_tooltip, + param_key, + *param_wr, + param_effect->getRepr(), + param_effect->getSPDoc() ) ); + pointwdg->setValue( (*this)[0], (*this)[1] ); + pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter")); + + Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "draw_node", Inkscape::ICON_SIZE_BUTTON) ); + Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); + pButton->set_relief(Gtk::RELIEF_NONE); + pIcon->show(); + pButton->add(*pIcon); + pButton->show(); + pButton->signal_clicked().connect(sigc::mem_fun(*this, &PointParam::on_button_click)); #ifndef LPEPOINTPARAM_DEBUG - pButton->set_sensitive(false); + pButton->set_sensitive(false); #endif - _widget = Gtk::manage( new Gtk::HBox() ); - static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true); - static_cast<Gtk::HBox*>(_widget)->pack_start(*(pointwdg->getPoint()), true, true); - static_cast<Gtk::HBox*>(_widget)->show_all_children(); + Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() ); + static_cast<Gtk::HBox*>(hbox)->pack_start(*pButton, true, true); + static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true); + static_cast<Gtk::HBox*>(hbox)->show_all_children(); - tooltips->set_tip(*pButton, _("Edit on-canvas")); - } - return dynamic_cast<Gtk::Widget *> (_widget); + tooltips->set_tip(*pButton, _("Edit on-canvas")); + + return dynamic_cast<Gtk::Widget *> (hbox); } void PointParam::param_setValue(Geom::Point newpoint) { *dynamic_cast<Geom::Point *>( this ) = newpoint; - if (pointwdg) - pointwdg->setValue(newpoint[0], newpoint[1]); } void diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index 7eb1a70c1..a47fa77f5 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -51,9 +51,6 @@ private: PointParam(const PointParam&); PointParam& operator=(const PointParam&); - Gtk::Widget * _widget; - Gtk::Tooltips * _tooltips; - Inkscape::UI::Widget::RegisteredPoint * pointwdg; void on_button_click(); SPKnot *knot; |
