3
* Ted Gould <ted@gould.cx>
5
* Copyright (C) 2002-2004 Authors
7
* Released under GNU GPL, read the file 'COPYING' for more information
11
#ifndef INKSCAPE_EXTENSION_EFFECT_H__
12
#define INKSCAPE_EXTENSION_EFFECT_H__
16
#include <glibmm/i18n.h>
17
#include <gtkmm/dialog.h>
18
#include <gtk/gtkdialog.h>
21
#include "prefdialog.h"
22
#include "extension.h"
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.
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 Extensions and Filters menus on the menu structure
44
XML file. This is saved so it only has to be discovered
46
static Inkscape::XML::Node * _effects_list;
47
static Inkscape::XML::Node * _filters_list;
48
Inkscape::XML::Node *find_menu (Inkscape::XML::Node * menustruct, const gchar *name);
49
void merge_menu (Inkscape::XML::Node * base, Inkscape::XML::Node * start, Inkscape::XML::Node * patern, Inkscape::XML::Node * mergee);
51
/** \brief This is the verb type that is used for all effect's verbs.
52
It provides convience functions and maintains a pointer
53
back to the effect that created it. */
54
class EffectVerb : public Inkscape::Verb {
56
static void perform (SPAction * action, void * mydata, void * otherdata);
57
/** \brief Function to call for specific actions */
58
static SPActionEventVector vector;
60
/** \brief The effect that this verb represents. */
62
/** \brief Whether or not to show preferences on display */
64
/** \brief Name with elipses if that makes sense */
67
virtual SPAction * make_action (Inkscape::UI::View::View * view);
69
/** \brief Use the Verb initializer with the same parameters. */
70
EffectVerb(gchar const * id,
76
Verb(id, _(name), _(tip), image),
78
_showPrefs(showPrefs),
80
/* No clue why, but this is required */
81
this->set_default_sensitive(true);
82
if (_showPrefs && effect != NULL && effect->param_visible_count() != 0) {
83
_elip_name = g_strdup_printf("%s...", _(name));
88
/** \brief Destructor */
90
if (_elip_name != NULL) {
96
/** \brief ID used for the verb without preferences */
97
Glib::ustring _id_noprefs;
98
/** \brief Name used for the verb without preferences */
99
Glib::ustring _name_noprefs;
101
/** \brief The verb representing this effect. */
103
/** \brief The verb representing this effect. Without preferences. */
104
EffectVerb _verb_nopref;
105
/** \brief Menu node created for this effect */
106
Inkscape::XML::Node * _menu_node;
107
/** \brief Whehter a working dialog should be shown */
110
/** \brief The preference dialog if it is shown */
111
PrefDialog * _prefDialog;
113
Effect (Inkscape::XML::Node * in_repr,
114
Implementation::Implementation * in_imp);
115
virtual ~Effect (void);
116
virtual bool check (void);
117
bool prefs (Inkscape::UI::View::View * doc);
118
void effect (Inkscape::UI::View::View * doc);
119
/** \brief Accessor function for a pointer to the verb */
120
Inkscape::Verb * get_verb (void) { return &_verb; };
122
/** \brief Static function to get the last effect used */
123
static Effect * get_last_effect (void) { return _last_effect; };
124
static void set_last_effect (Effect * in_effect);
126
static void place_menus (void);
127
void place_menu (Inkscape::XML::Node * menus);
129
Gtk::VBox * get_info_widget(void);
131
bool no_doc; // if true, the effect does not process SVG document at all, so no need to save, read, and watch for errors
132
bool no_live_preview; // if true, the effect does not need "live preview" checkbox in its dialog
134
void set_pref_dialog (PrefDialog * prefdialog);
136
static gchar * remove_ (gchar * instr);
139
} } /* namespace Inkscape, Extension */
140
#endif /* INKSCAPE_EXTENSION_EFFECT_H__ */
145
c-file-style:"stroustrup"
146
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
151
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :