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 CURVE_STITCH,\r
51 INVALID_LPE // This must be last\r
52 };\r
53 \r
54 extern const Util::EnumData<EffectType> LPETypeData[INVALID_LPE];\r
55 extern const Util::EnumDataConverter<EffectType> LPETypeConverter;\r
56 \r
57 class Parameter;\r
58 \r
59 class Effect {\r
60 public:\r
61 virtual ~Effect();\r
62 \r
63 Glib::ustring getName();\r
64 \r
65 virtual void doEffect (SPCurve * curve);\r
66 \r
67 static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj);\r
68 \r
69 virtual Gtk::Widget * getWidget();\r
70 \r
71 Inkscape::XML::Node * getRepr();\r
72 SPDocument * getSPDoc();\r
73 \r
74 void readallParameters(Inkscape::XML::Node * repr);\r
75 void setParameter(Inkscape::XML::Node * repr, const gchar * key, const gchar * old_value, const gchar * new_value);\r
76 \r
77 protected:\r
78 Effect(LivePathEffectObject *lpeobject);\r
79 \r
80 // provide a set of doEffect functions so the developer has a choice \r
81 // of what kind of input/output parameters he desires.\r
82 // the order in which they appear is the order in which they are \r
83 // called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling\r
84 // doEffect(std::vector<Geom::Path> )\r
85 virtual NArtBpath *\r
86 doEffect (NArtBpath * path_in);\r
87 virtual std::vector<Geom::Path> \r
88 doEffect (std::vector<Geom::Path> & path_in);\r
89 virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > \r
90 doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);\r
91 \r
92 void registerParameter(Parameter * param);\r
93 \r
94 typedef std::map<Glib::ustring, Parameter *> param_map_type;\r
95 param_map_type param_map;\r
96 \r
97 Inkscape::UI::Widget::Registry wr; \r
98 Gtk::VBox * vbox;\r
99 Gtk::Tooltips * tooltips;\r
100 \r
101 LivePathEffectObject *lpeobj;\r
102 \r
103 private:\r
104 Effect(const Effect&);\r
105 Effect& operator=(const Effect&);\r
106 };\r
107 \r
108 \r
109 } //namespace LivePathEffect\r
110 } //namespace Inkscape\r
111 \r
112 #endif\r