From a638f8196e2487af835b7852bfae63828763dcc9 Mon Sep 17 00:00:00 2001 From: gouldtj Date: Sat, 1 Sep 2007 04:31:13 +0000 Subject: [PATCH] --- src/extension/prefdialog.cpp | 13 +++++++++++-- src/extension/prefdialog.h | 16 ++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index c9c218b4d..66a04dc1d 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -72,14 +72,23 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co // If we're working with an effect that can be live and // the dialog can be pinned, put those options in too if (_exEnv != NULL) { + if (_param_preview == NULL) { + XML::Document * doc = sp_repr_read_mem(live_param_xml, strlen(live_param_xml), NULL); + _param_preview = Parameter::make(doc->root(), _exEnv->_effect); + } + if (_param_pinned == NULL) { + XML::Document * doc = sp_repr_read_mem(pinned_param_xml, strlen(pinned_param_xml), NULL); + _param_pinned = Parameter::make(doc->root(), _exEnv->_effect); + } + Gtk::HSeparator * sep = Gtk::manage(new Gtk::HSeparator()); sep->show(); this->get_vbox()->pack_start(*sep, true, true, 4); hbox = Gtk::manage(new Gtk::HBox()); - _button_preview = Gtk::manage(new Gtk::CheckButton(_("Live Preview"))); + _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview); _button_preview->show(); - _button_pinned = Gtk::manage(new Gtk::CheckButton(_("Pin Dialog"))); + _button_pinned = _param_pinned->get_widget(NULL, NULL, &_signal_pinned); _button_pinned->show(); hbox->pack_start(*_button_preview, true, true,6); hbox->pack_start(*_button_pinned, true, true,6); diff --git a/src/extension/prefdialog.h b/src/extension/prefdialog.h index 90dcb14ae..059cfce45 100644 --- a/src/extension/prefdialog.h +++ b/src/extension/prefdialog.h @@ -19,6 +19,7 @@ #include #include "execution-env.h" +#include "parameter.h" namespace Inkscape { namespace Extension { @@ -38,15 +39,25 @@ class PrefDialog : public Gtk::Dialog { Gtk::Button * _button_cancel; /** \brief Button to control live preview */ - Gtk::CheckButton * _button_preview; + Gtk::Widget * _button_preview; /** \brief Button to control whether the dialog is pinned */ - Gtk::CheckButton * _button_pinned; + Gtk::Widget * _button_pinned; + + /** \brief Parameter to control live preview */ + Parameter * _param_preview; + /** \brief Parameter to control pinning the dialog */ + Parameter * _param_pinned; /** \brief XML to define the pinned parameter on the dialog */ static const char * pinned_param_xml; /** \brief XML to define the live effects parameter on the dialog */ static const char * live_param_xml; + /** \brief Signal that the user is changing the live effect state */ + sigc::signal _signal_preview; + /** \brief Signal that the user is changing the pinned state */ + sigc::signal _signal_pinned; + Effect * _effect; void preview_toggle(void); @@ -60,6 +71,7 @@ public: Gtk::Widget * controls, ExecutionEnv * exEnv = NULL, Effect * effect = NULL); + ~PrefDialog (); int run (void); void setPreviewState (Glib::ustring state); -- 2.30.2