diff options
| author | Ted Gould <ted@gould.cx> | 2007-10-30 19:28:31 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2007-10-30 19:28:31 +0000 |
| commit | cabb72a8c874cf939150e02af804a1c781cd0b17 (patch) | |
| tree | da8834a6d8e32e2c631f1b29b835c3ac76f72a59 /src/extension/implementation | |
| parent | r16676@shi: ted | 2007-10-12 21:09:50 -0700 (diff) | |
| download | inkscape-cabb72a8c874cf939150e02af804a1c781cd0b17.tar.gz inkscape-cabb72a8c874cf939150e02af804a1c781cd0b17.zip | |
r16677@shi: ted | 2007-10-17 19:31:04 -0700
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.
(bzr r3977)
Diffstat (limited to 'src/extension/implementation')
| -rw-r--r-- | src/extension/implementation/implementation.cpp | 15 | ||||
| -rw-r--r-- | src/extension/implementation/implementation.h | 7 | ||||
| -rw-r--r-- | src/extension/implementation/script.cpp | 7 | ||||
| -rw-r--r-- | src/extension/implementation/script.h | 6 |
4 files changed, 25 insertions, 10 deletions
diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 3bf9b0b75..acec99041 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -38,8 +38,17 @@ Implementation::unload(Inkscape::Extension::Extension *module) { 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; } @@ -71,12 +80,12 @@ Implementation::open(Inkscape::Extension::Input *module, gchar const *filename) } /* 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 ca4f12069..bd380c07e 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -37,6 +37,7 @@ public: return; }; virtual ~ImplementationDocumentCache ( ) { return; }; + SPDocument const * doc ( ) { return _doc; }; }; /** @@ -55,7 +56,7 @@ public: 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); @@ -73,8 +74,8 @@ public: /* ----- 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. */ diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index bde0871ba..bec24f165 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -495,7 +495,8 @@ Script::prefs_output(Inkscape::Extension::Output *module) 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(); @@ -681,7 +682,9 @@ Script::save(Inkscape::Extension::Output *module, 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); diff --git a/src/extension/implementation/script.h b/src/extension/implementation/script.h index 417b42a89..6a6256f3c 100644 --- a/src/extension/implementation/script.h +++ b/src/extension/implementation/script.h @@ -90,13 +90,15 @@ public: */ 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); |
