diff options
| author | Jabiertxo Arraiza Cenoz <jtx@jtx.markerlab.es> | 2018-06-06 19:54:37 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Cenoz <jtx@jtx.markerlab.es> | 2018-06-06 19:54:37 +0000 |
| commit | 418e2db02e4c6ed7ebccd0d518f2c6331704f050 (patch) | |
| tree | 48c573fdf1737bc87167ac7d2b65aa14dfb0b5c5 /src | |
| parent | Remove tables that should not be exposed to user from OpenType table list. (diff) | |
| download | inkscape-418e2db02e4c6ed7ebccd0d518f2c6331704f050.tar.gz inkscape-418e2db02e4c6ed7ebccd0d518f2c6331704f050.zip | |
Fixes to extension system and simplify the code
Diffstat (limited to 'src')
| -rw-r--r-- | src/desktop.cpp | 1 | ||||
| -rw-r--r-- | src/desktop.h | 1 | ||||
| -rw-r--r-- | src/extension/effect.cpp | 3 | ||||
| -rw-r--r-- | src/extension/execution-env.cpp | 6 | ||||
| -rw-r--r-- | src/extension/execution-env.h | 2 | ||||
| -rw-r--r-- | src/extension/implementation/implementation.cpp | 17 | ||||
| -rw-r--r-- | src/extension/implementation/implementation.h | 2 | ||||
| -rw-r--r-- | src/extension/implementation/script.cpp | 18 | ||||
| -rw-r--r-- | src/extension/prefdialog.cpp | 29 |
9 files changed, 19 insertions, 60 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index 72739305a..47c82b6d9 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -117,7 +117,6 @@ SPDesktop::SPDesktop() : waiting_cursor( false ), showing_dialogs ( false ), guides_active( false ), - on_live_extension(false), gr_item( NULL ), gr_point_type( POINT_LG_BEGIN ), gr_point_i( 0 ), diff --git a/src/desktop.h b/src/desktop.h index 8b20195db..73463ffd5 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -190,7 +190,6 @@ public: bool showing_dialogs; /// \todo fixme: This has to be implemented in different way */ guint guides_active : 1; - bool on_live_extension; // storage for selected dragger used by GrDrag as it's // created and deleted by tools 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; } |
