1 #ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_VECTOR_H
2 #define INKSCAPE_LIVEPATHEFFECT_PARAMETER_VECTOR_H
4 /*
5 * Inkscape::LivePathEffectParameters
6 *
7 * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
12 #include <glib/gtypes.h>
13 #include <2geom/point.h>
15 #include <gtkmm/tooltips.h>
17 #include "live_effects/parameter/parameter.h"
19 #include "knot-holder-entity.h"
21 namespace Inkscape {
23 namespace LivePathEffect {
26 class VectorParam : public Parameter {
27 public:
28 VectorParam( const Glib::ustring& label,
29 const Glib::ustring& tip,
30 const Glib::ustring& key,
31 Inkscape::UI::Widget::Registry* wr,
32 Effect* effect,
33 Geom::Point default_vector = Geom::Point(1,0) );
34 virtual ~VectorParam();
36 virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
37 inline const gchar *handleTip() const { return param_tooltip.c_str(); }
39 virtual bool param_readSVGValue(const gchar * strvalue);
40 virtual gchar * param_getSVGValue() const;
42 Geom::Point getVector() const { return vector; };
43 Geom::Point getOrigin() const { return origin; };
44 void setValues(Geom::Point const &new_origin, Geom::Point const &new_vector) { setVector(new_vector); setOrigin(new_origin); };
45 void setVector(Geom::Point const &new_vector) { vector = new_vector; };
46 void setOrigin(Geom::Point const &new_origin) { origin = new_origin; };
47 virtual void param_set_default();
49 void set_and_write_new_values(Geom::Point const &new_origin, Geom::Point const &new_vector);
51 virtual void param_transform_multiply(Geom::Matrix const &postmul, bool set);
53 void set_vector_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
54 void set_origin_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
56 virtual bool providesKnotHolderEntities() { return true; }
57 virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
59 private:
60 VectorParam(const VectorParam&);
61 VectorParam& operator=(const VectorParam&);
63 Geom::Point defvalue;
65 Geom::Point origin;
66 Geom::Point vector;
68 /// The looks of the vector and origin knots oncanvas
69 SPKnotShapeType vec_knot_shape;
70 SPKnotModeType vec_knot_mode;
71 guint32 vec_knot_color;
72 SPKnotShapeType ori_knot_shape;
73 SPKnotModeType ori_knot_mode;
74 guint32 ori_knot_color;
76 friend class VectorParamKnotHolderEntity_Origin;
77 friend class VectorParamKnotHolderEntity_Vector;
78 };
81 } //namespace LivePathEffect
83 } //namespace Inkscape
85 #endif