From 767534eea3ae7e3684692ccdabc11c69e15103cc Mon Sep 17 00:00:00 2001 From: gouldtj Date: Sat, 1 Sep 2007 04:31:58 +0000 Subject: [PATCH] r16339@tres: ted | 2007-08-19 19:47:57 -0700 Live preview toggling is working. Pinning, not as much. But getting there. --- src/extension/execution-env.cpp | 15 ++++++++++++++- src/extension/execution-env.h | 2 ++ src/extension/prefdialog.cpp | 5 +++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index b21d7a0f5..adcd2a3d7 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -36,6 +36,7 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk _humanWait(false), _canceled(false), _prefsChanged(false), + _livePreview(true), _doc(doc) { SPDesktop *desktop = (SPDesktop *)_doc; @@ -204,7 +205,7 @@ void ExecutionEnv::run (void) { while (!_finished) { _canceled = false; - if (_humanWait) { + if (_humanWait || !_livePreview) { _mainloop->run(); } else { _prefsChanged = false; @@ -219,6 +220,18 @@ ExecutionEnv::run (void) { return; } +void +ExecutionEnv::livePreview (bool state) { + _mainloop->quit(); + if (_livePreview && !state) { + _canceled = true; + } + if (!_livePreview && state) { + _humanWait = false; + } + _livePreview = state; + return; +} } } /* namespace Inkscape, Extension */ diff --git a/src/extension/execution-env.h b/src/extension/execution-env.h index a20c0ba3d..3c4b13198 100644 --- a/src/extension/execution-env.h +++ b/src/extension/execution-env.h @@ -31,6 +31,7 @@ private: bool _humanWait; bool _canceled; bool _prefsChanged; + bool _livePreview; Glib::RefPtr _mainloop; Inkscape::UI::View::View * _doc; std::list _selected; @@ -43,6 +44,7 @@ public: void run (void); void preferencesChange (void); + void livePreview (bool state = true); private: void createPrefsDialog (Gtk::Widget * controls); diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 66a04dc1d..eb6cbf6fa 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -99,6 +99,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co pinned_toggle(); _signal_preview.connect(sigc::mem_fun(this, &PrefDialog::preview_toggle)); _signal_pinned.connect(sigc::mem_fun(this, &PrefDialog::pinned_toggle)); + } GtkWidget *dlg = GTK_WIDGET(gobj()); @@ -152,9 +153,9 @@ PrefDialog::setPreviewState (Glib::ustring state) { void PrefDialog::preview_toggle (void) { if(_param_preview->get_bool(NULL, NULL) && !_param_pinned->get_bool(NULL, NULL)) { - //std::cout << "Live Preview" << std::endl; + _exEnv->livePreview(true); } else { - //std::cout << "No Preview" << std::endl; + _exEnv->livePreview(false); } } -- 2.30.2