1 /*
2 * Authors:
3 * Ted Gould <ted@gould.cx>
4 *
5 * Copyright (C) 2002-2004 Authors
6 *
7 * Released under GNU GPL, read the file 'COPYING' for more information
8 */
11 #ifndef INKSCAPE_EXTENSION_EFFECT_H__
12 #define INKSCAPE_EXTENSION_EFFECT_H__
14 #include <config.h>
16 #include <glibmm/i18n.h>
17 #include <gtk/gtkdialog.h>
18 #include "verbs.h"
20 #include "extension.h"
22 struct SPDocument;
24 namespace Inkscape {
25 namespace UI {
26 namespace View {
27 typedef View View;
28 };
29 };
31 namespace Extension {
33 /** \brief Effects are extensions that take a document and do something
34 to it in place. This class adds the extra functions required
35 to make extensions effects.
36 */
37 class Effect : public Extension {
38 /** \brief This is the last effect that was used. This is used in
39 a menu item to rapidly recall the same effect. */
40 static Effect * _last_effect;
41 /** \brief The location of the effects menu on the menu structure
42 XML file. This is saved so it only has to be discovered
43 once. */
44 static Inkscape::XML::Node * _effects_list;
45 bool find_effects_list (Inkscape::XML::Node * menustruct);
46 void merge_menu (Inkscape::XML::Node * base, Inkscape::XML::Node * start, Inkscape::XML::Node * patern, Inkscape::XML::Node * mergee);
48 /** \brief This is the verb type that is used for all effect's verbs.
49 It provides convience functions and maintains a pointer
50 back to the effect that created it. */
51 class EffectVerb : public Inkscape::Verb {
52 private:
53 static void perform (SPAction * action, void * mydata, void * otherdata);
54 /** \brief Function to call for specific actions */
55 static SPActionEventVector vector;
57 /** \brief The effect that this verb represents. */
58 Effect * _effect;
59 protected:
60 virtual SPAction * make_action (Inkscape::UI::View::View * view);
61 public:
62 /** \brief Use the Verb initializer with the same parameters. */
63 EffectVerb(gchar const * id,
64 gchar const * name,
65 gchar const * tip,
66 gchar const * image,
67 Effect * effect) :
68 Verb(id, _(name), _(tip), image), _effect(effect) {
69 /* No clue why, but this is required */
70 this->set_default_sensitive(true);
71 }
72 };
74 /** \brief The verb representing this effect. */
75 EffectVerb _verb;
76 /** \brief Menu node created for this effect */
77 Inkscape::XML::Node * _menu_node;
78 public:
79 Effect (Inkscape::XML::Node * in_repr,
80 Implementation::Implementation * in_imp);
81 virtual ~Effect (void);
82 virtual bool check (void);
83 bool prefs (Inkscape::UI::View::View * doc);
84 void effect (Inkscape::UI::View::View * doc);
85 /** \brief Accessor function for a pointer to the verb */
86 Inkscape::Verb * get_verb (void) { return &_verb; };
88 /** \brief Static function to get the last effect used */
89 static Effect * get_last_effect (void) { return _last_effect; };
90 static void set_last_effect (Effect * in_effect);
92 static void place_menus (void);
93 void place_menu (Inkscape::XML::Node * menus);
95 Gtk::VBox * get_info_widget(void);
97 private:
98 static gchar * remove_ (gchar * instr);
99 };
101 } } /* namespace Inkscape, Extension */
102 #endif /* INKSCAPE_EXTENSION_EFFECT_H__ */
104 /*
105 Local Variables:
106 mode:c++
107 c-file-style:"stroustrup"
108 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
109 indent-tabs-mode:nil
110 fill-column:99
111 End:
112 */
113 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :