summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c2b22c9)
raw | patch | inline | side by side (parent: c2b22c9)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Tue, 30 Oct 2007 19:28:31 +0000 (19:28 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Tue, 30 Oct 2007 19:28:31 +0000 (19:28 +0000) |
Creating and adding interfaces for a document based cache that an effect can define. This removes the effect from
having to know if the document has changed, and keep track of that. This allows them to optimize their performance
when doing things like live effects.
having to know if the document has changed, and keep track of that. This allows them to optimize their performance
when doing things like live effects.
12 files changed:
index 7ac4825a3afdcf274d73beac0185858bd8e1df82..6b03014f83bfe0286bbafbe5b45dc2e31c57e2b6 100644 (file)
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
sigc::signal<void> * changeSignal = new sigc::signal<void>;
Gtk::Widget * controls;
- controls = imp->prefs_effect(this, doc, changeSignal);
+ controls = imp->prefs_effect(this, doc, changeSignal, NULL);
ExecutionEnv executionEnv(this, doc, controls, changeSignal);
index 12cccbf908539e837de29903e3788555451e79d5..b7746289e864bfce9a05697d78594b2d0f57833b 100644 (file)
_mainloop->run();
} else {
_prefsChanged = false;
- _effect->get_imp()->effect(_effect, _doc);
+ _effect->get_imp()->effect(_effect, _doc, NULL);
processingComplete();
}
if (_canceled) {
diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp
index 3bf9b0b750f311c2ae67f85d544abc480edda6c3..acec99041de7a9faf9d9f58d4c2aa56289d731b3 100644 (file)
return;
} /* Implementation::unload */
+/** \brief Create a new document cache object
+ \param ext The extension that is referencing us
+ \param doc The document to create the cache of
+ \return A new document cache that is valid as long as the document
+ is not changed.
+
+ This function just returns \c NULL. Subclasses are likely
+ to reimplement it to do something useful.
+*/
ImplementationDocumentCache *
-Implementation::newDocCache (SPDocument * doc) {
+Implementation::newDocCache (Inkscape::Extension::Extension * ext, SPDocument * doc) {
return NULL;
}
} /* Implementation::open */
Gtk::Widget *
-Implementation::prefs_output(Inkscape::Extension::Output *module, ImplementationDocumentCache * docCache) {
+Implementation::prefs_output(Inkscape::Extension::Output *module) {
return module->autogui(NULL, NULL);
} /* Implementation::prefs_output */
void
-Implementation::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename, ImplementationDocumentCache * docCache) {
+Implementation::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename) {
/* throw save_fail */
return;
} /* Implementation::save */
diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h
index ca4f120699195f7b735440b5d3bbec44f7246b63..bd380c07eaf2cbb8ea8e9208c6052c917da1be70 100644 (file)
return;
};
virtual ~ImplementationDocumentCache ( ) { return; };
+ SPDocument const * doc ( ) { return _doc; };
};
/**
virtual bool load(Inkscape::Extension::Extension *module);
virtual void unload(Inkscape::Extension::Extension *module);
- ImplementationDocumentCache * newDocCache (SPDocument * doc);
+ ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * ext, SPDocument * doc);
/** Verify any dependencies. */
virtual bool check(Inkscape::Extension::Extension *module);
/* ----- Output functions ----- */
/** Find out information about the file. */
- virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module, ImplementationDocumentCache * docCache);
- virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename, ImplementationDocumentCache * docCache);
+ virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module);
+ virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename);
/* ----- Effect functions ----- */
/** Find out information about the file. */
index bde0871ba501703fb92e161a7e0a8cf691438c59..bec24f165dfd78310eb1c71d77e6d658519677a9 100644 (file)
Gtk::Widget *
Script::prefs_effect(Inkscape::Extension::Effect *module,
Inkscape::UI::View::View *view,
- sigc::signal<void> * changeSignal)
+ sigc::signal<void> * changeSignal,
+ ImplementationDocumentCache * docCache)
{
SPDocument * current_document = view->doc();
point both should be full, and the second one is loaded.
*/
void
-Script::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc)
+Script::effect(Inkscape::Extension::Effect *module,
+ Inkscape::UI::View::View *doc,
+ ImplementationDocumentCache * docCache)
{
std::list<std::string> params;
module->paramListString(params);
index 417b42a891d6f6185037f22fb451a78f8a22c920..6a6256f3c4a7f93f078cf9fb8a1b516b7f9f625b 100644 (file)
*/
virtual Gtk::Widget *prefs_effect(Inkscape::Extension::Effect *module,
Inkscape::UI::View::View * view,
- sigc::signal<void> * changeSignal);
+ sigc::signal<void> * changeSignal,
+ ImplementationDocumentCache * docCache);
/**
*
*/
virtual void effect(Inkscape::Extension::Effect *module,
- Inkscape::UI::View::View *doc);
+ Inkscape::UI::View::View *doc,
+ ImplementationDocumentCache * docCache);
virtual bool cancelProcessing (void);
diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp
index a6c30a587b6c1666d34d91fd64d340c348bbc76c..ddb7a0145840bb66c0512238f2bc138ab628d595 100644 (file)
return TRUE;
}
+/*
void
ImageMagick::commitDocument(void) {
_loaded = FALSE;
}
-/*void
+void
ImageMagick::cancelDocument(void) {
for (int i = 0; i < _imageCount; i++) {
_nodes[i]->setAttribute("xlink:href", _originals[i], true);
}
void
-ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document)
+ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache)
{
refreshParameters(module);
+ _loaded = FALSE;
if (!_loaded)
{
@@ -177,7 +179,7 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi
Uses AutoGUI for creating the GUI.
*/
Gtk::Widget *
-ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal)
+ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache)
{
SPDocument * current_document = view->doc();
diff --git a/src/extension/internal/bitmap/imagemagick.h b/src/extension/internal/bitmap/imagemagick.h
index 4afdcfbb497dd7597504bf368c6283f80b63a15e..3060ddd33f6c3ce6950f56428ff378ad6d3d2528 100644 (file)
namespace Internal {
namespace Bitmap {
+class ImageMagickDocCache: public Inkscape::Extension::Implementation::ImplementationDocumentCache {
+public:
+ ImageMagickDocCache(SPDocument * doc) : Inkscape::Extension::Implementation::ImplementationDocumentCache(doc) { };
+ ~ImageMagickDocCache ( ) { };
+};
+
class ImageMagick : public Inkscape::Extension::Implementation::Implementation {
private:
virtual void refreshParameters(Inkscape::Extension::Effect *module) { };
bool load(Inkscape::Extension::Extension *module);
- void commitDocument(void);
+ /*void commitDocument(void);*/
/*void cancelDocument(void);*/
void readImage(char const *xlink, Magick::Image *image);
- void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document);
+ void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache);
- Gtk::Widget* prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal);
+ Gtk::Widget* prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache);
};
}; /* namespace Bitmap */
index aa1f3ece3fa29852248e95473bd153a6e75fe63d..5c64d982ae225e12aa848c29ff2c48a35ac3abdd 100644 (file)
\param document What should be edited.
*/
void
-BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document)
+BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache)
{
Inkscape::Selection * selection = ((SPDesktop *)document)->selection;
}
Gtk::Widget *
-BlurEdge::prefs_effect(Inkscape::Extension::Effect * module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal)
+BlurEdge::prefs_effect(Inkscape::Extension::Effect * module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache)
{
return module->autogui(NULL, NULL, changeSignal);
}
index d97e73c9a682b1de1b221f707a2c33e3242b5add..48e30c054719773bcf1a9c7ad68cf0eedfd4e1fa 100644 (file)
public:
bool load(Inkscape::Extension::Extension *module);
- void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document);
- Gtk::Widget * prefs_effect(Inkscape::Extension::Effect * module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal);
+ void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache);
+ Gtk::Widget * prefs_effect(Inkscape::Extension::Effect * module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache);
static void init (void);
};
index 1957813e5cf53cc6fbe9e2b0c3f2afcdc9c454d9..6937cdcc9b70a067c88aa035740c3b64580bed0a 100644 (file)
\param document What should be edited.
*/
void
-Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document)
+Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache)
{
Inkscape::Selection * selection = ((SPDesktop *)document)->selection;
Uses AutoGUI for creating the GUI.
*/
Gtk::Widget *
-Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal)
+Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache)
{
SPDocument * current_document = view->doc();
index c4a97aeba4a279e4b3bdfb8262db28596ef61c10..1f37b144124ac27abf124714da37b1829656cacd 100644 (file)
public:
bool load(Inkscape::Extension::Extension *module);
- void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document);
- Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal);
+ void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache);
+ Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache);
static void init (void);
};