diff options
| author | Ted Gould <ted@gould.cx> | 2007-03-01 07:14:41 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2007-03-01 07:14:41 +0000 |
| commit | 99ffaf09bea5e0104cce510cf476ffdeafe73331 (patch) | |
| tree | f3661358275555cdbb52fbab0e9672b888ca793c /src/extension/effect.cpp | |
| parent | r14583@tres: ted | 2007-02-28 19:29:48 -0800 (diff) | |
| download | inkscape-99ffaf09bea5e0104cce510cf476ffdeafe73331.tar.gz inkscape-99ffaf09bea5e0104cce510cf476ffdeafe73331.zip | |
r14584@tres: ted | 2007-02-28 20:01:52 -0800
Effects now register two different verbs. One is the same one they've
always registered and one is the same ID with ".nopref" added to it.
This one executes the effect without the prefrences dialog. Default
values will be used.
(bzr r2480)
Diffstat (limited to 'src/extension/effect.cpp')
| -rw-r--r-- | src/extension/effect.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 0f9434c17..10ac493b5 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -24,7 +24,12 @@ Effect * Effect::_last_effect = NULL; Inkscape::XML::Node * Effect::_effects_list = NULL; Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) - : Extension(in_repr, in_imp), _verb(get_id(), get_name(), NULL, NULL, this), _menu_node(NULL) + : Extension(in_repr, in_imp), + _id_noprefs(Glib::ustring(get_id()) + ".noprefs"), + _name_noprefs(Glib::ustring(get_name()) + _(" (No preferences)")), + _verb(get_id(), get_name(), NULL, NULL, this, true), + _verb_nopref(_id_noprefs.c_str(), _name_noprefs.c_str(), NULL, NULL, this, false), + _menu_node(NULL) { Inkscape::XML::Node * local_effects_menu = NULL; @@ -293,7 +298,7 @@ Effect::get_info_widget(void) SPAction * Effect::EffectVerb::make_action (Inkscape::UI::View::View * view) { - return make_action_helper(view, &vector, static_cast<void *>(_effect)); + return make_action_helper(view, &vector, static_cast<void *>(this)); } /** \brief Decode the verb code and take appropriate action */ @@ -302,13 +307,18 @@ Effect::EffectVerb::perform (SPAction *action, void * data, void *pdata) { Inkscape::UI::View::View * current_view = sp_action_get_view(action); // SPDocument * current_document = current_view->doc; - Effect * effect = reinterpret_cast<Effect *>(data); + Effect::EffectVerb * ev = reinterpret_cast<Effect::EffectVerb *>(data); + Effect * effect = ev->_effect; if (effect == NULL) return; if (current_view == NULL) return; // std::cout << "Executing: " << effect->get_name() << std::endl; - if (effect->prefs(current_view)) + bool execute = true; + + if (ev->_showPrefs) + execute = effect->prefs(current_view); + if (execute) effect->effect(current_view); return; |
