summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
Diffstat (limited to 'src/extension')
-rw-r--r--src/extension/effect.cpp3
-rw-r--r--src/extension/execution-env.cpp6
-rw-r--r--src/extension/execution-env.h2
-rw-r--r--src/extension/implementation/implementation.cpp17
-rw-r--r--src/extension/implementation/implementation.h2
-rw-r--r--src/extension/implementation/script.cpp18
-rw-r--r--src/extension/prefdialog.cpp29
7 files changed, 19 insertions, 58 deletions
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp
index 076698616..0a9b56ed6 100644
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
@@ -270,8 +270,7 @@ Effect::effect (Inkscape::UI::View::View * doc)
if (!loaded())
set_state(Extension::STATE_LOADED);
if (!loaded()) return;
-
-
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
ExecutionEnv executionEnv(this, doc);
execution_env = &executionEnv;
timer->lock();
diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp
index bde04d924..0c979660d 100644
--- a/src/extension/execution-env.cpp
+++ b/src/extension/execution-env.cpp
@@ -163,7 +163,6 @@ ExecutionEnv::cancel (void) {
void
ExecutionEnv::undo (void) {
DocumentUndo::cancel(_doc->doc());
- reselect();
return;
}
@@ -179,10 +178,9 @@ ExecutionEnv::commit (void) {
void
ExecutionEnv::reselect (void) {
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Inkscape::Selection * selection = NULL;
if(desktop) {
- selection = desktop->getSelection();
- if (!desktop->on_live_extension) {
+ Inkscape::Selection * selection = desktop->getSelection();
+ if (selection) {
selection->restoreBackup();
}
}
diff --git a/src/extension/execution-env.h b/src/extension/execution-env.h
index 8af97cd92..f75e97efa 100644
--- a/src/extension/execution-env.h
+++ b/src/extension/execution-env.h
@@ -94,6 +94,7 @@ public:
void undo (void);
/** \brief Wait for the effect to complete if it hasn't. */
bool wait (void);
+ void reselect (void);
/** \brief Return reference to working dialog (if any) */
Gtk::Dialog *get_working_dialog (void) { return _visibleDialog; };
@@ -102,7 +103,6 @@ private:
void runComplete (void);
void createWorkingDialog (void);
void workingCanceled (const int resp);
- void reselect (void);
void genDocCache (void);
void killDocCache (void);
};
diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp
index e05dbf3c4..6e6100d2b 100644
--- a/src/extension/implementation/implementation.cpp
+++ b/src/extension/implementation/implementation.cpp
@@ -27,23 +27,6 @@ namespace Inkscape {
namespace Extension {
namespace Implementation {
-ImplementationDocumentCache::ImplementationDocumentCache (Inkscape::UI::View::View * view)
- : _view(view)
-{
- SPDesktop *desktop = (SPDesktop*)view;
- Inkscape::Selection * selection = NULL;
- if (desktop) {
- selection = desktop->getSelection();
- if (selection && !selection->params.empty()) {
- selection->restoreBackup();
- if (!desktop->on_live_extension) {
- selection->emptyBackup();
- }
- }
- }
- return;
-}
-
Gtk::Widget *
Implementation::prefs_input(Inkscape::Extension::Input *module, gchar const */*filename*/) {
return module->autogui(NULL, NULL);
diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h
index 5bb909ef2..cf41e5517 100644
--- a/src/extension/implementation/implementation.h
+++ b/src/extension/implementation/implementation.h
@@ -56,7 +56,7 @@ class ImplementationDocumentCache {
*/
Inkscape::UI::View::View * _view;
public:
- ImplementationDocumentCache (Inkscape::UI::View::View * view);
+ ImplementationDocumentCache (Inkscape::UI::View::View * view) { return; };
virtual ~ImplementationDocumentCache ( ) { return; };
Inkscape::UI::View::View const * view ( ) { return _view; };
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index d77695bf1..d725ff8cc 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -690,11 +690,17 @@ void Script::effect(Inkscape::Extension::Effect *module,
if (desktop) {
Inkscape::Selection * selection = desktop->getSelection();
- if (!selection->isEmpty()) {
- selection->setBackup();
+ if (selection) {
+ //No working dialog run once
+ if (!selection->isEmpty()) {
+ selection->setBackup();
+ } else {
+ selection->restoreBackup();
+ }
+ params = selection->params;
+ module->paramListString(params);
+ selection->clear();
}
- params = selection->params;
- module->paramListString(params);
}
file_listener fileout;
@@ -758,12 +764,10 @@ void Script::effect(Inkscape::Extension::Effect *module,
//set the current layer
desktop->setCurrentLayer(layer);
}
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop) {
Inkscape::Selection * selection = desktop->getSelection();
- if (selection && selection->isEmpty() && !desktop->on_live_extension) {
+ if (selection && selection->isEmpty()) {
selection->restoreBackup();
- selection->emptyBackup();
}
}
}
diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp
index 0861f1dc3..b5b1f9bfe 100644
--- a/src/extension/prefdialog.cpp
+++ b/src/extension/prefdialog.cpp
@@ -63,13 +63,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, NULL);
_signal_param_change.connect(sigc::mem_fun(this, &PrefDialog::param_change));
}
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (desktop) {
- Inkscape::Selection * selection = desktop->getSelection();
- if (selection) {
- selection->emptyBackup();
- }
- }
+
hbox->pack_start(*controls, true, true, 0);
hbox->show();
@@ -181,40 +175,23 @@ void
PrefDialog::preview_toggle (void) {
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
SPDocument *document = SP_ACTIVE_DOCUMENT;
- Inkscape::Selection * selection = NULL;
bool modified = document->isModifiedSinceSave();
- if(desktop) {
- selection = desktop->getSelection();
- if (!selection->isEmpty()) {
- selection->setBackup();
- }
- }
if(_param_preview->get_bool(NULL, NULL)) {
if (_exEnv == NULL) {
set_modal(true);
- if (desktop && selection) {
- desktop->on_live_extension = true;
-
- }
_exEnv = new ExecutionEnv(_effect, SP_ACTIVE_DESKTOP, NULL, false, false);
_effect->set_execution_env(_exEnv);
_exEnv->run();
- if (desktop && selection) {
- selection->clear();
- }
}
} else {
set_modal(false);
if (_exEnv != NULL) {
_exEnv->cancel();
_exEnv->undo();
+ _exEnv->reselect();
delete _exEnv;
_exEnv = NULL;
_effect->set_execution_env(_exEnv);
- if (desktop && selection) {
- selection->restoreBackup();
- desktop->on_live_extension = false;
- }
}
}
document->setModifiedSinceSave(modified);
@@ -261,6 +238,7 @@ PrefDialog::on_response (int signal) {
_exEnv->commit();
} else {
_exEnv->undo();
+ _exEnv->reselect();
}
delete _exEnv;
_exEnv = NULL;
@@ -275,7 +253,6 @@ PrefDialog::on_response (int signal) {
if ((signal == Gtk::RESPONSE_CANCEL || signal == Gtk::RESPONSE_DELETE_EVENT) && _effect != NULL) {
delete this;
}
-
return;
}