summaryrefslogtreecommitdiffstats
path: root/src/extension/execution-env.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2007-10-30 19:29:36 +0000
committergouldtj <gouldtj@users.sourceforge.net>2007-10-30 19:29:36 +0000
commitd0090423642f0d4eea455ff77087027be242b148 (patch)
tree21f238ed7d056f98929384e053831247300f69f0 /src/extension/execution-env.cpp
parentr16677@shi: ted | 2007-10-17 19:31:04 -0700 (diff)
downloadinkscape-d0090423642f0d4eea455ff77087027be242b148.tar.gz
inkscape-d0090423642f0d4eea455ff77087027be242b148.zip
r16892@shi: ted | 2007-10-29 21:33:09 -0700
Okay, so now the caches get into the execution environment and can be passed around to the effects. Now it's a matter of implementing the caches in the drivers. (bzr r3978)
Diffstat (limited to 'src/extension/execution-env.cpp')
-rw-r--r--src/extension/execution-env.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp
index b7746289e..21df42b9d 100644
--- a/src/extension/execution-env.cpp
+++ b/src/extension/execution-env.cpp
@@ -18,6 +18,7 @@
#include "selection.h"
#include "effect.h"
#include "document.h"
+#include "desktop.h"
#include "ui/view/view.h"
#include "sp-namedview.h"
#include "desktop-handles.h"
@@ -28,7 +29,7 @@ namespace Inkscape {
namespace Extension {
-ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk::Widget * controls, sigc::signal<void> * changeSignal, Gtk::Dialog * prefDialog) :
+ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk::Widget * controls, sigc::signal<void> * changeSignal, Gtk::Dialog * prefDialog, Implementation::ImplementationDocumentCache * docCache) :
_visibleDialog(NULL),
_prefsVisible(false),
_finished(false),
@@ -40,7 +41,8 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk
_selfdelete(false),
_changeSignal(changeSignal),
_doc(doc),
- _effect(effect) {
+ _effect(effect),
+ _docCache(docCache) {
SPDesktop *desktop = (SPDesktop *)_doc;
sp_namedview_document_from_window(desktop);
@@ -93,10 +95,31 @@ ExecutionEnv::~ExecutionEnv (void) {
if (_changeSignal != NULL && !_shutdown) {
delete _changeSignal;
}
+ killDocCache();
return;
}
void
+ExecutionEnv::genDocCache (void) {
+ if (_docCache == NULL) {
+ printf("Gen Doc Cache\n");
+ SPDesktop * spdesktop = (SPDesktop *)_doc;
+ Implementation::ImplementationDocumentCache * _docCache = _effect->get_imp()->newDocCache(_effect, spdesktop->doc());
+ }
+ return;
+}
+
+void
+ExecutionEnv::killDocCache (void) {
+ if (_docCache != NULL) {
+ printf("Killed Doc Cache\n");
+ delete _docCache;
+ _docCache = NULL;
+ }
+ return;
+}
+
+void
ExecutionEnv::preferencesChange (void) {
_timersig.disconnect();
_timersig = Glib::signal_timeout().connect(sigc::mem_fun(this, &ExecutionEnv::preferencesTimer), 100, Glib::PRIORITY_DEFAULT_IDLE);
@@ -250,7 +273,8 @@ ExecutionEnv::run (void) {
_mainloop->run();
} else {
_prefsChanged = false;
- _effect->get_imp()->effect(_effect, _doc, NULL);
+ genDocCache();
+ _effect->get_imp()->effect(_effect, _doc, _docCache);
processingComplete();
}
if (_canceled) {
@@ -275,6 +299,9 @@ ExecutionEnv::livePreview (bool state) {
_humanWait = false;
}
_livePreview = state;
+ if (!_livePreview) {
+ killDocCache();
+ }
return;
}