From c3a160589a9cb41c70a56e5e7b66a65857a0d10e Mon Sep 17 00:00:00 2001 From: Eric Greveson Date: Mon, 1 Jul 2013 21:04:32 +0100 Subject: Factored layer model out into new Inkscape::LayerModel class. This allows Inkscape::Selection to use a LayerModel that is not associated with a UI. Changed the interface of verbs (SPAction) to use a new ActionContext rather than UI::View::View, again so that verbs may be used in a console mode. Modified boolean operation verbs to work in console-only mode. Fixed up DESKTOP_IS_ACTIVE macro to work in the case of no desktops. Modified main.cpp to process selections and verbs in no-GUI mode. Other changes are all consequences of the SPDesktop, Selection and LayerModel interface changes. (bzr r12387.1.1) --- src/extension/effect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/extension/effect.cpp') diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 1df8002ad..22c5e4989 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -359,9 +359,9 @@ Effect::set_pref_dialog (PrefDialog * prefdialog) } SPAction * -Effect::EffectVerb::make_action (Inkscape::UI::View::View * view) +Effect::EffectVerb::make_action (Inkscape::ActionContext const & context) { - return make_action_helper(view, &perform, static_cast(this)); + return make_action_helper(context, &perform, static_cast(this)); } /** \brief Decode the verb code and take appropriate action */ -- cgit v1.2.3 From 2a53d44964f9105ce0f9c8725853150dc5360096 Mon Sep 17 00:00:00 2001 From: Eric Greveson Date: Mon, 1 Jul 2013 22:27:23 +0100 Subject: Added error messages when attempting to use verbs requiring GUI in console (--without-gui) mode. (bzr r12387.1.3) --- src/extension/effect.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/extension/effect.cpp') diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 22c5e4989..93b1bb91d 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -369,12 +369,15 @@ void Effect::EffectVerb::perform( SPAction *action, void * data ) { Inkscape::UI::View::View * current_view = sp_action_get_view(action); + if (current_view == NULL) { + show_gui_required_message(action); + return; + } // SPDocument * current_document = current_view->doc; Effect::EffectVerb * ev = reinterpret_cast(data); Effect * effect = ev->_effect; if (effect == NULL) return; - if (current_view == NULL) return; if (ev->_showPrefs) { effect->prefs(current_view); -- cgit v1.2.3 From 104efe4e3ecadc975ab76748c66f041abf8ee7b1 Mon Sep 17 00:00:00 2001 From: Eric Greveson Date: Thu, 4 Jul 2013 15:01:44 +0100 Subject: Code readability improvements and licence changes for action-context.* based on merge request code review and feedback (bzr r12387.1.7) --- src/extension/effect.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/extension/effect.cpp') diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 93b1bb91d..dcccf3d7d 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -368,12 +368,9 @@ Effect::EffectVerb::make_action (Inkscape::ActionContext const & context) void Effect::EffectVerb::perform( SPAction *action, void * data ) { + g_return_if_fail(ensure_desktop_valid(action)); Inkscape::UI::View::View * current_view = sp_action_get_view(action); - if (current_view == NULL) { - show_gui_required_message(action); - return; - } -// SPDocument * current_document = current_view->doc; + Effect::EffectVerb * ev = reinterpret_cast(data); Effect * effect = ev->_effect; -- cgit v1.2.3