Code

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