summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/extension/effect.cpp18
-rw-r--r--src/extension/effect.h14
2 files changed, 26 insertions, 6 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;
diff --git a/src/extension/effect.h b/src/extension/effect.h
index c0231eac4..b6fc80aa5 100644
--- a/src/extension/effect.h
+++ b/src/extension/effect.h
@@ -56,6 +56,8 @@ class Effect : public Extension {
/** \brief The effect that this verb represents. */
Effect * _effect;
+ /** \brief Whether or not to show preferences on display */
+ bool _showPrefs;
protected:
virtual SPAction * make_action (Inkscape::UI::View::View * view);
public:
@@ -64,15 +66,23 @@ class Effect : public Extension {
gchar const * name,
gchar const * tip,
gchar const * image,
- Effect * effect) :
- Verb(id, _(name), _(tip), image), _effect(effect) {
+ Effect * effect,
+ bool showPrefs) :
+ Verb(id, _(name), _(tip), image), _effect(effect), _showPrefs(showPrefs) {
/* No clue why, but this is required */
this->set_default_sensitive(true);
}
};
+ /** \brief ID used for the verb without preferences */
+ Glib::ustring _id_noprefs;
+ /** \brief Name used for the verb without preferences */
+ Glib::ustring _name_noprefs;
+
/** \brief The verb representing this effect. */
EffectVerb _verb;
+ /** \brief The verb representing this effect. Without preferences. */
+ EffectVerb _verb_nopref;
/** \brief Menu node created for this effect */
Inkscape::XML::Node * _menu_node;
public: