summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 15e9c80)
raw | patch | inline | side by side (parent: 15e9c80)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Thu, 1 Mar 2007 07:14:41 +0000 (07:14 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Thu, 1 Mar 2007 07:14:41 +0000 (07:14 +0000) |
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.
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.
src/extension/effect.cpp | patch | blob | history | |
src/extension/effect.h | patch | blob | history |
index 0f9434c17abafcf8c01b7955771a58fd1c6a6b36..10ac493b5a2a3b06700797c5ea4697bb02aabbf8 100644 (file)
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
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;
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 */
{
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 c0231eac40f5ed89ee2b42e8b9c565418b88b41c..b6fc80aa5c00ff63fdcaaf53ec62c1e00a505615 100644 (file)
--- a/src/extension/effect.h
+++ b/src/extension/effect.h
/** \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:
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: