From b32949eaefba1f07e3898efe060b21a6377b6741 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Tue, 15 Jan 2008 23:43:23 +0000 Subject: RegisteredCheckbutton is now subclassed from RegisteredWidget (bzr r4500) --- src/live_effects/parameter/bool.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/live_effects/parameter/bool.cpp') 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 (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 (checkwdg); } void BoolParam::param_setValue(bool newvalue) { value = newvalue; - if (checkwdg) - checkwdg->setActive(newvalue); } } /* namespace LivePathEffect */ -- cgit v1.2.3