summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/extension/effect.cpp8
-rw-r--r--src/extension/execution-env.cpp33
-rw-r--r--src/extension/execution-env.h11
-rw-r--r--src/extension/extension-forward.h1
4 files changed, 46 insertions, 7 deletions
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp
index 6b03014f8..f7caf125d 100644
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
@@ -13,7 +13,7 @@
#include "desktop-handles.h"
#include "selection.h"
#include "sp-namedview.h"
-#include "document.h"
+#include "desktop.h"
#include "implementation/implementation.h"
#include "effect.h"
#include "execution-env.h"
@@ -219,9 +219,11 @@ Effect::prefs (Inkscape::UI::View::View * doc)
sigc::signal<void> * changeSignal = new sigc::signal<void>;
Gtk::Widget * controls;
- controls = imp->prefs_effect(this, doc, changeSignal, NULL);
+ SPDesktop * spdesktop = (SPDesktop *)doc;
+ Implementation::ImplementationDocumentCache * docCache = imp->newDocCache(this, spdesktop->doc());
+ controls = imp->prefs_effect(this, doc, changeSignal, docCache);
- ExecutionEnv executionEnv(this, doc, controls, changeSignal);
+ ExecutionEnv executionEnv(this, doc, controls, changeSignal, NULL, docCache);
timer->lock();
executionEnv.run();
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;
}
diff --git a/src/extension/execution-env.h b/src/extension/execution-env.h
index a6c4ebf64..7b35f33a2 100644
--- a/src/extension/execution-env.h
+++ b/src/extension/execution-env.h
@@ -19,6 +19,7 @@
#include "forward.h"
#include "extension-forward.h"
+#include "extension.h"
namespace Inkscape {
namespace Extension {
@@ -41,11 +42,17 @@ private:
sigc::connection _dialogsig;
sigc::connection _changesig;
sigc::connection _timersig;
+ Implementation::ImplementationDocumentCache * _docCache;
public:
Effect * _effect;
- ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk::Widget * controls = NULL, sigc::signal<void> * changeSignal = NULL, Gtk::Dialog * prefDialog = NULL);
+ ExecutionEnv (Effect * effect,
+ Inkscape::UI::View::View * doc,
+ Gtk::Widget * controls = NULL,
+ sigc::signal<void> * changeSignal = NULL,
+ Gtk::Dialog * prefDialog = NULL,
+ Implementation::ImplementationDocumentCache * docCache = NULL);
~ExecutionEnv (void);
void run (void);
@@ -64,6 +71,8 @@ private:
void documentCancel (void);
void documentCommit (void);
void reselect (void);
+ void genDocCache (void);
+ void killDocCache (void);
};
} } /* namespace Inkscape, Extension */
diff --git a/src/extension/extension-forward.h b/src/extension/extension-forward.h
index f0346b488..d836c29ab 100644
--- a/src/extension/extension-forward.h
+++ b/src/extension/extension-forward.h
@@ -16,6 +16,7 @@ class ExpirationTimer;
namespace Implementation {
class Implementation;
+class ImplementationDocumentCache;
}
} }