~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/extension/effect.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
9
 
 
10
 
 
11
#ifndef INKSCAPE_EXTENSION_EFFECT_H__
 
12
#define INKSCAPE_EXTENSION_EFFECT_H__
 
13
 
 
14
#include <config.h>
 
15
 
 
16
#include <glibmm/i18n.h>
 
17
#include <gtkmm/dialog.h>
 
18
#include <gtk/gtkdialog.h>
 
19
#include "verbs.h"
 
20
 
 
21
#include "prefdialog.h"
 
22
#include "extension.h"
 
23
 
 
24
struct SPDocument;
 
25
 
 
26
namespace Inkscape {
 
27
namespace UI {
 
28
namespace View {
 
29
typedef View View;
 
30
};
 
31
};
 
32
 
 
33
namespace Extension {
 
34
 
 
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 Extensions and Filters menus 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
    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);
 
50
 
 
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 {
 
55
        private:
 
56
            static void perform (SPAction * action, void * mydata, void * otherdata);
 
57
            /** \brief  Function to call for specific actions */
 
58
            static SPActionEventVector vector;
 
59
 
 
60
            /** \brief  The effect that this verb represents. */
 
61
            Effect * _effect;
 
62
            /** \brief  Whether or not to show preferences on display */
 
63
            bool _showPrefs;
 
64
            /** \brief  Name with elipses if that makes sense */
 
65
            gchar * _elip_name;
 
66
        protected:
 
67
            virtual SPAction * make_action (Inkscape::UI::View::View * view);
 
68
        public:
 
69
            /** \brief Use the Verb initializer with the same parameters. */
 
70
            EffectVerb(gchar const * id,
 
71
                       gchar const * name,
 
72
                       gchar const * tip,
 
73
                       gchar const * image,
 
74
                       Effect *      effect,
 
75
                       bool          showPrefs) :
 
76
                    Verb(id, _(name), _(tip), image), 
 
77
                    _effect(effect), 
 
78
                    _showPrefs(showPrefs),
 
79
                    _elip_name(NULL) {
 
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));
 
84
                    set_name(_elip_name);
 
85
                }
 
86
            }
 
87
            
 
88
            /** \brief  Destructor */
 
89
            ~EffectVerb() {
 
90
                if (_elip_name != NULL) {
 
91
                    g_free(_elip_name);
 
92
                }
 
93
            }
 
94
    };
 
95
 
 
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;
 
100
 
 
101
    /** \brief  The verb representing this effect. */
 
102
    EffectVerb _verb;
 
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 */
 
108
    bool _workingDialog;
 
109
 
 
110
    /** \brief  The preference dialog if it is shown */
 
111
    PrefDialog * _prefDialog;
 
112
public:
 
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; };
 
121
 
 
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);
 
125
 
 
126
    static void      place_menus (void);
 
127
    void             place_menu (Inkscape::XML::Node * menus);
 
128
 
 
129
    Gtk::VBox *    get_info_widget(void);
 
130
 
 
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
 
133
 
 
134
    void        set_pref_dialog (PrefDialog * prefdialog);
 
135
private:
 
136
    static gchar *   remove_ (gchar * instr);
 
137
};
 
138
 
 
139
} }  /* namespace Inkscape, Extension */
 
140
#endif /* INKSCAPE_EXTENSION_EFFECT_H__ */
 
141
 
 
142
/*
 
143
  Local Variables:
 
144
  mode:c++
 
145
  c-file-style:"stroustrup"
 
146
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
147
  indent-tabs-mode:nil
 
148
  fill-column:99
 
149
  End:
 
150
*/
 
151
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :