Code

Add lpe-skeleton for easy implementation!
[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 struct SPShape;\r
23 struct SPDocument;\r
24 class NArtBpath;\r
25 struct LivePathEffectObject;\r
26 \r
27 namespace Gtk {\r
28     class Widget;\r
29     class VBox;\r
30     class Tooltips;\r
31 }\r
32 \r
33 namespace Inkscape {\r
34 \r
35 namespace XML {\r
36     class Node;\r
37 }\r
38 \r
39 namespace LivePathEffect {\r
40 \r
41 enum EffectType {\r
42     SKELETAL_STROKES = 0,\r
43     SLANT,\r
44     DOEFFECTSTACK_TEST,\r
45     GEARS,\r
46     INVALID_LPE // This must be last\r
47 };\r
48 \r
49 extern const Util::EnumData<EffectType> LPETypeData[INVALID_LPE];\r
50 extern const Util::EnumDataConverter<EffectType> LPETypeConverter;\r
51 \r
52 class Parameter;\r
53 \r
54 class Effect {\r
55 public:\r
56     virtual ~Effect();\r
57 \r
58     Glib::ustring getName();\r
59 \r
60     virtual void doEffect (SPCurve * curve);\r
61 \r
62     static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj);\r
63 \r
64     virtual Gtk::Widget * getWidget();\r
65 \r
66     Inkscape::XML::Node * getRepr();\r
67     SPDocument * getSPDoc();\r
68 \r
69     void readallParameters(Inkscape::XML::Node * repr);\r
70     void setParameter(Inkscape::XML::Node * repr, const gchar * key, const gchar * old_value, const gchar * new_value);\r
71 \r
72 protected:\r
73     Effect(LivePathEffectObject *lpeobject);\r
74 \r
75     // provide a set of doEffect functions so the developer has a choice \r
76     // of what kind of input/output parameters he desires.\r
77     // the order in which they appear is the order in which they are \r
78     // called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling\r
79     // doEffect(std::vector<Geom::Path> )\r
80     virtual NArtBpath *\r
81             doEffect (NArtBpath * path_in);\r
82     virtual std::vector<Geom::Path> \r
83             doEffect (std::vector<Geom::Path> & path_in);\r
84     virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > \r
85             doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);\r
86 \r
87     void registerParameter(Parameter * param);\r
88 \r
89     typedef std::map<Glib::ustring, Parameter *> param_map_type;\r
90     param_map_type param_map;\r
91 \r
92     Inkscape::UI::Widget::Registry wr; \r
93     Gtk::VBox * vbox;\r
94     Gtk::Tooltips * tooltips;\r
95 \r
96     LivePathEffectObject *lpeobj;\r
97 \r
98 private:\r
99     Effect(const Effect&);\r
100     Effect& operator=(const Effect&);\r
101 };\r
102 \r
103 \r
104 } //namespace LivePathEffect\r
105 } //namespace Inkscape\r
106 \r
107 #endif\r