~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/live_effects/effect.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef INKSCAPE_LIVEPATHEFFECT_H
 
2
#define INKSCAPE_LIVEPATHEFFECT_H
 
3
 
 
4
/*
 
5
 * Inkscape::LivePathEffect
 
6
 *
 
7
* Copyright (C) Johan Engelen 2007-2008 <j.b.c.engelen@utwente.nl>
 
8
 *
 
9
 * Released under GNU GPL, read the file 'COPYING' for more information
 
10
 */
 
11
 
 
12
 
 
13
#include "display/display-forward.h"
 
14
#include <map>
 
15
#include <glibmm/ustring.h>
 
16
#include <2geom/path.h>
 
17
#include "ui/widget/registry.h"
 
18
#include "util/enums.h"
 
19
 
 
20
#define  LPE_CONVERSION_TOLERANCE 0.01    // FIXME: find good solution for this.
 
21
 
 
22
//#define LPE_ENABLE_TEST_EFFECTS
 
23
 
 
24
struct SPDocument;
 
25
struct SPDesktop;
 
26
struct SPItem;
 
27
class NArtBpath;
 
28
struct LivePathEffectObject;
 
29
 
 
30
namespace Gtk {
 
31
    class Widget;
 
32
    class VBox;
 
33
    class Tooltips;
 
34
}
 
35
 
 
36
namespace Geom {
 
37
    class Matrix;
 
38
}
 
39
 
 
40
namespace Inkscape {
 
41
 
 
42
namespace XML {
 
43
    class Node;
 
44
}
 
45
 
 
46
namespace NodePath {
 
47
    class Path ;
 
48
}
 
49
 
 
50
namespace LivePathEffect {
 
51
 
 
52
enum EffectType {
 
53
    PATH_ALONG_PATH = 0,
 
54
    SKELETAL_STROKES,
 
55
#ifdef LPE_ENABLE_TEST_EFFECTS
 
56
    SLANT,
 
57
    DOEFFECTSTACK_TEST,
 
58
#endif
 
59
    GEARS,
 
60
    CURVE_STITCH,
 
61
    INVALID_LPE // This must be last
 
62
};
 
63
 
 
64
extern const Util::EnumData<EffectType> LPETypeData[INVALID_LPE];
 
65
extern const Util::EnumDataConverter<EffectType> LPETypeConverter;
 
66
 
 
67
class Parameter;
 
68
 
 
69
class Effect {
 
70
public:
 
71
    static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj);
 
72
 
 
73
    virtual ~Effect();
 
74
 
 
75
    virtual void doEffect (SPCurve * curve);
 
76
 
 
77
    virtual Gtk::Widget * newWidget(Gtk::Tooltips * tooltips);
 
78
 
 
79
    virtual void resetDefaults(SPItem * item);
 
80
 
 
81
    virtual void setup_nodepath(Inkscape::NodePath::Path *np);
 
82
 
 
83
    virtual void transform_multiply(Geom::Matrix const& postmul, bool set);
 
84
 
 
85
    Glib::ustring          getName();
 
86
    Inkscape::XML::Node *  getRepr();
 
87
    SPDocument *           getSPDoc();
 
88
    LivePathEffectObject * getLPEObj() {return lpeobj;};
 
89
    Parameter *            getParameter(const char * key);
 
90
 
 
91
    void readallParameters(Inkscape::XML::Node * repr);
 
92
    void setParameter(const gchar * key, const gchar * new_value);
 
93
 
 
94
    void editNextParamOncanvas(SPItem * item, SPDesktop * desktop);
 
95
 
 
96
protected:
 
97
    Effect(LivePathEffectObject *lpeobject);
 
98
 
 
99
    // provide a set of doEffect functions so the developer has a choice
 
100
    // of what kind of input/output parameters he desires.
 
101
    // the order in which they appear is the order in which they are
 
102
    // called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling
 
103
    // doEffect(std::vector<Geom::Path> )
 
104
    virtual NArtBpath *
 
105
            doEffect_nartbpath (NArtBpath * path_in);
 
106
    virtual std::vector<Geom::Path>
 
107
            doEffect_path (std::vector<Geom::Path> & path_in);
 
108
    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> >
 
109
            doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
 
110
 
 
111
    void registerParameter(Parameter * param);
 
112
    Parameter * getNextOncanvasEditableParam();
 
113
 
 
114
    std::vector<Parameter *> param_vector;
 
115
    int oncanvasedit_it;
 
116
 
 
117
 
 
118
    Inkscape::UI::Widget::Registry wr;
 
119
 
 
120
    LivePathEffectObject *lpeobj;
 
121
 
 
122
private:
 
123
    Effect(const Effect&);
 
124
    Effect& operator=(const Effect&);
 
125
};
 
126
 
 
127
 
 
128
} //namespace LivePathEffect
 
129
} //namespace Inkscape
 
130
 
 
131
#endif