Code

Fixed messed up transformations because of a missing cairo_restore() and removed...
[inkscape.git] / src / extension / effect.h
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 <gtkmm/dialog.h>
18 #include <gtk/gtkdialog.h>
19 #include "verbs.h"
21 #include "prefdialog.h"
22 #include "extension.h"
24 struct SPDocument;
26 namespace Inkscape {
27 namespace UI {
28 namespace View {
29 typedef View View;
30 };
31 };
33 namespace Extension {
35 /** \brief  Effects are extensions that take a document and do something
36             to it in place.  This class adds the extra functions required
37             to make extensions effects.
38 */
39 class Effect : public Extension {
40     /** \brief  This is the last effect that was used.  This is used in
41                 a menu item to rapidly recall the same effect. */
42     static Effect * _last_effect;
43     /** \brief  The location of the effects menu on the menu structure
44                 XML file.  This is saved so it only has to be discovered
45                 once. */
46     static Inkscape::XML::Node * _effects_list;
47     bool find_effects_list (Inkscape::XML::Node * menustruct);
48     void merge_menu (Inkscape::XML::Node * base, Inkscape::XML::Node * start, Inkscape::XML::Node * patern, Inkscape::XML::Node * mergee);
50     /** \brief  This is the verb type that is used for all effect's verbs.
51                 It provides convience functions and maintains a pointer
52                 back to the effect that created it.  */
53     class EffectVerb : public Inkscape::Verb {
54         private:
55             static void perform (SPAction * action, void * mydata, void * otherdata);
56             /** \brief  Function to call for specific actions */
57             static SPActionEventVector vector;
59             /** \brief  The effect that this verb represents. */
60             Effect * _effect;
61             /** \brief  Whether or not to show preferences on display */
62             bool _showPrefs;
63         protected:
64             virtual SPAction * make_action (Inkscape::UI::View::View * view);
65         public:
66             /** \brief Use the Verb initializer with the same parameters. */
67             EffectVerb(gchar const * id,
68                        gchar const * name,
69                        gchar const * tip,
70                        gchar const * image,
71                        Effect *      effect,
72                        bool          showPrefs) :
73                     Verb(id, _(name), _(tip), image), _effect(effect), _showPrefs(showPrefs) {
74                 /* No clue why, but this is required */
75                 this->set_default_sensitive(true);
76             }
77     };
79     /** \brief  ID used for the verb without preferences */
80     Glib::ustring _id_noprefs;
81     /** \brief  Name used for the verb without preferences */
82     Glib::ustring _name_noprefs;
84     /** \brief  The verb representing this effect. */
85     EffectVerb _verb;
86     /** \brief  The verb representing this effect.  Without preferences. */
87     EffectVerb _verb_nopref;
88     /** \brief  Menu node created for this effect */
89     Inkscape::XML::Node * _menu_node;
90     /** \brief  Whehter a working dialog should be shown */
91     bool _workingDialog;
93     /** \brief  The preference dialog if it is shown */
94     PrefDialog * _prefDialog;
95 public:
96                  Effect  (Inkscape::XML::Node * in_repr,
97                           Implementation::Implementation * in_imp);
98     virtual     ~Effect  (void);
99     virtual bool check                (void);
100     bool         prefs   (Inkscape::UI::View::View * doc);
101     void         effect  (Inkscape::UI::View::View * doc);
102     /** \brief  Accessor function for a pointer to the verb */
103     Inkscape::Verb * get_verb (void) { return &_verb; };
105     /** \brief  Static function to get the last effect used */
106     static Effect *  get_last_effect (void) { return _last_effect; };
107     static void      set_last_effect (Effect * in_effect);
109     static void      place_menus (void);
110     void             place_menu (Inkscape::XML::Node * menus);
112     Gtk::VBox *    get_info_widget(void);
114     bool no_doc; // if true, the effect does not process SVG document at all, so no need to save, read, and watch for errors
116     void        set_pref_dialog (PrefDialog * prefdialog);
117 private:
118     static gchar *   remove_ (gchar * instr);
119 };
121 } }  /* namespace Inkscape, Extension */
122 #endif /* INKSCAPE_EXTENSION_EFFECT_H__ */
124 /*
125   Local Variables:
126   mode:c++
127   c-file-style:"stroustrup"
128   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
129   indent-tabs-mode:nil
130   fill-column:99
131   End:
132 */
133 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :