964bcd12b256fcb2807d90b95254ce5a216da8c8
1 #ifndef INKSCAPE_LIVEPATHEFFECT_H
2 #define INKSCAPE_LIVEPATHEFFECT_H
4 /*
5 * Inkscape::LivePathEffect
6 *
7 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
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"
20 #define LPE_CONVERSION_TOLERANCE 0.01 // FIXME: find good solution for this.
22 //#define LPE_ENABLE_TEST_EFFECTS
24 struct SPDocument;
25 struct SPDesktop;
26 struct SPItem;
27 class NArtBpath;
28 struct LivePathEffectObject;
30 namespace Gtk {
31 class Widget;
32 class VBox;
33 class Tooltips;
34 }
36 namespace Inkscape {
38 namespace XML {
39 class Node;
40 }
42 namespace NodePath {
43 class Path ;
44 }
46 namespace LivePathEffect {
48 enum EffectType {
49 PATH_ALONG_PATH = 0,
50 SKELETAL_STROKES,
51 #ifdef LPE_ENABLE_TEST_EFFECTS
52 SLANT,
53 DOEFFECTSTACK_TEST,
54 #endif
55 GEARS,
56 CURVE_STITCH,
57 INVALID_LPE // This must be last
58 };
60 extern const Util::EnumData<EffectType> LPETypeData[INVALID_LPE];
61 extern const Util::EnumDataConverter<EffectType> LPETypeConverter;
63 class Parameter;
65 class Effect {
66 public:
67 static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj);
69 virtual ~Effect();
71 virtual void doEffect (SPCurve * curve);
73 virtual Gtk::Widget * getWidget();
75 virtual void resetDefaults(SPItem * item);
77 Glib::ustring getName();
78 Inkscape::XML::Node * getRepr();
79 SPDocument * getSPDoc();
80 LivePathEffectObject * getLPEObj() {return lpeobj;};
81 Parameter * getParameter(const char * key);
83 void readallParameters(Inkscape::XML::Node * repr);
84 void setParameter(const gchar * key, const gchar * new_value);
86 void editNextParamOncanvas(SPItem * item, SPDesktop * desktop);
88 virtual void setup_notepath(Inkscape::NodePath::Path *np);
90 protected:
91 Effect(LivePathEffectObject *lpeobject);
93 // provide a set of doEffect functions so the developer has a choice
94 // of what kind of input/output parameters he desires.
95 // the order in which they appear is the order in which they are
96 // called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling
97 // doEffect(std::vector<Geom::Path> )
98 virtual NArtBpath *
99 doEffect_nartbpath (NArtBpath * path_in);
100 virtual std::vector<Geom::Path>
101 doEffect_path (std::vector<Geom::Path> & path_in);
102 virtual Geom::Piecewise<Geom::D2<Geom::SBasis> >
103 doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
105 void registerParameter(Parameter * param);
106 Parameter * getNextOncanvasEditableParam();
108 std::vector<Parameter *> param_vector;
109 int oncanvasedit_it;
112 Inkscape::UI::Widget::Registry wr;
113 Gtk::VBox * vbox;
114 Gtk::Tooltips * tooltips;
116 LivePathEffectObject *lpeobj;
118 private:
119 Effect(const Effect&);
120 Effect& operator=(const Effect&);
121 };
124 } //namespace LivePathEffect
125 } //namespace Inkscape
127 #endif