X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Flive_effects%2Fparameter%2Fbool.cpp;h=505a70493941dba13ede403b3d1f026d56d40573;hb=4ea30e1bba14987abced98e7bf194b69153e9e21;hp=14fd88423821c7aa406e33190b48efdd3a7ece72;hpb=c0cd5511d3b975ebe07d019c1f5528108725e438;p=inkscape.git diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp index 14fd88423..505a70493 100644 --- a/src/live_effects/parameter/bool.cpp +++ b/src/live_effects/parameter/bool.cpp @@ -12,13 +12,11 @@ #include "svg/stringstream.h" #include #include "widgets/icon.h" - +#include "ui/widget/registered-widget.h" #include "inkscape.h" #include "verbs.h" #include "helper-fns.h" -#define noLPEBOOLPARAM_DEBUG - namespace Inkscape { namespace LivePathEffect { @@ -28,13 +26,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 @@ -51,32 +46,35 @@ BoolParam::param_readSVGValue(const gchar * strvalue) } gchar * -BoolParam::param_writeSVGValue() const +BoolParam::param_getSVGValue() const { gchar * str = g_strdup(value ? "true" : "false"); return str; } Gtk::Widget * -BoolParam::param_newWidget(Gtk::Tooltips * tooltips) +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->setProgrammatically = false; + 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 */