1 #ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_PATH_H
2 #define INKSCAPE_LIVEPATHEFFECT_PARAMETER_PATH_H
4 /*
5 * Inkscape::LivePathEffectParameters
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 */
12 #include <glib/gtypes.h>
13 #include <2geom/path.h>
15 #include <gtkmm/tooltips.h>
17 #include "live_effects/parameter/parameter.h"
18 #include "live_effects/parameter/path-reference.h"
19 #include <sigc++/sigc++.h>
21 namespace Inkscape {
23 namespace LivePathEffect {
25 class PathParam : public Parameter {
26 public:
27 PathParam ( const Glib::ustring& label,
28 const Glib::ustring& tip,
29 const Glib::ustring& key,
30 Inkscape::UI::Widget::Registry* wr,
31 Effect* effect,
32 const gchar * default_value = "M0,0 L1,1");
33 virtual ~PathParam();
35 virtual ParamType paramType() { return PATH_PARAM; }
37 std::vector<Geom::Path> const & get_pathvector();
38 Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2();
40 virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
42 bool param_readSVGValue(const gchar * strvalue);
43 gchar * param_getSVGValue() const;
45 void param_set_default();
46 void param_set_and_write_default();
47 void param_set_and_write_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & newpath);
48 void param_set_and_write_new_value (std::vector<Geom::Path> const & newpath);
50 virtual void param_editOncanvas(SPItem * item, SPDesktop * dt);
51 virtual void param_setup_nodepath(Inkscape::NodePath::Path *np);
53 virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/);
55 sigc::signal <void> signal_path_pasted;
56 sigc::signal <void> signal_path_changed;
58 void paste_param_path(const char *svgd);
59 void on_paste_button_click();
61 protected:
62 std::vector<Geom::Path> _pathvector; // this is primary data storage, since it is closest to SVG.
64 Geom::Piecewise<Geom::D2<Geom::SBasis> > _pwd2; // secondary, hence the bool must_recalculate_pwd2
65 bool must_recalculate_pwd2; // set when _pathvector was updated, but _pwd2 not
66 void ensure_pwd2(); // ensures _pwd2 is up to date
68 gchar * href; // contains link to other object, e.g. "#path2428", NULL if PathParam contains pathdata itself
69 PathReference ref;
70 sigc::connection ref_changed_connection;
71 sigc::connection linked_delete_connection;
72 sigc::connection linked_modified_connection;
73 void ref_changed(SPObject *old_ref, SPObject *new_ref);
74 void remove_link();
75 void start_listening(SPObject * to);
76 void quit_listening(void);
77 void linked_delete(SPObject *deleted);
78 void linked_modified(SPObject *linked_obj, guint flags);
80 void on_edit_button_click();
81 void on_copy_button_click();
82 void on_link_button_click();
84 gchar * defvalue;
86 private:
87 PathParam(const PathParam&);
88 PathParam& operator=(const PathParam&);
89 };
92 } //namespace LivePathEffect
94 } //namespace Inkscape
96 #endif