path.h revision 94f2e710e9cc2e0eb14c8d73abfe77d60f961db2
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_PATH_H
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_PATH_H
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm/*
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm * Inkscape::LivePathEffectParameters
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm *
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm *
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm * Released under GNU GPL, read the file 'COPYING' for more information
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm */
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#include <glib/gtypes.h>
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#include <2geom/path.h>
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#include <gtkmm/tooltips.h>
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#include "live_effects/parameter/parameter.h"
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen#include "live_effects/parameter/path-reference.h"
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#include <sigc++/sigc++.h>
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmnamespace Inkscape {
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmnamespace LivePathEffect {
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
afb717c6e7d29c86c404b6627855c438d6dc2c0fjohanengelenclass PathParam : public Parameter {
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrmpublic:
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm PathParam ( const Glib::ustring& label,
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm const Glib::ustring& tip,
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm const Glib::ustring& key,
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm Inkscape::UI::Widget::Registry* wr,
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm Effect* effect,
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm const gchar * default_value = "M0,0 L1,1");
62d835b4bbb0f1f046e30d9b67f8e9517cc6175cjohanengelen virtual ~PathParam();
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
d73ff87f5c0a6d911b9808d81e1cbdee5337e069cilix virtual ParamType paramType() { return PATH_PARAM; }
d73ff87f5c0a6d911b9808d81e1cbdee5337e069cilix
1673045848db9654bcb07a81fad34afb4b0623d1johanengelen std::vector<Geom::Path> const & get_pathvector();
3cc77bbe681dd68bde92a2c4796cd5020aecb214johanengelen Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2();
afb717c6e7d29c86c404b6627855c438d6dc2c0fjohanengelen
c0cd5511d3b975ebe07d019c1f5528108725e438johanengelen virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
94f2e710e9cc2e0eb14c8d73abfe77d60f961db2johanengelen virtual bool param_readSVGValue(const gchar * strvalue);
94f2e710e9cc2e0eb14c8d73abfe77d60f961db2johanengelen virtual gchar * param_getSVGValue() const;
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
94f2e710e9cc2e0eb14c8d73abfe77d60f961db2johanengelen virtual void param_set_default();
9bddaf7172a6bb788ccae3ba5a30599d63acf424johanengelen void param_set_and_write_default();
94f2e710e9cc2e0eb14c8d73abfe77d60f961db2johanengelen void set_new_value (std::vector<Geom::Path> const &newpath, bool write_to_svg);
94f2e710e9cc2e0eb14c8d73abfe77d60f961db2johanengelen void set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &newpath, bool write_to_svg);
42e99769805c14a5cc01c805faa3c3b03f9dd1c0johanengelen
d431763a9ec8059aa4962688de8144319969fb0fjohanengelen virtual void param_editOncanvas(SPItem * item, SPDesktop * dt);
d431763a9ec8059aa4962688de8144319969fb0fjohanengelen virtual void param_setup_nodepath(Inkscape::NodePath::Path *np);
fb5a72174252e0e79107dcad3bf5a2bbd73e349cjohanengelen
0903335a0099bd7ee779925f43a15a2216a0e863johanengelen virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/);
bdd7add6c064afee52d2eabeaa18f745430e5a4djohanengelen
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm sigc::signal <void> signal_path_pasted;
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm sigc::signal <void> signal_path_changed;
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
390745fa4524b55aad12d5d2d656cd73e75a0bc0cilix void paste_param_path(const char *svgd);
390745fa4524b55aad12d5d2d656cd73e75a0bc0cilix void on_paste_button_click();
390745fa4524b55aad12d5d2d656cd73e75a0bc0cilix
afb717c6e7d29c86c404b6627855c438d6dc2c0fjohanengelenprotected:
1673045848db9654bcb07a81fad34afb4b0623d1johanengelen std::vector<Geom::Path> _pathvector; // this is primary data storage, since it is closest to SVG.
1673045848db9654bcb07a81fad34afb4b0623d1johanengelen
1673045848db9654bcb07a81fad34afb4b0623d1johanengelen Geom::Piecewise<Geom::D2<Geom::SBasis> > _pwd2; // secondary, hence the bool must_recalculate_pwd2
1673045848db9654bcb07a81fad34afb4b0623d1johanengelen bool must_recalculate_pwd2; // set when _pathvector was updated, but _pwd2 not
1673045848db9654bcb07a81fad34afb4b0623d1johanengelen void ensure_pwd2(); // ensures _pwd2 is up to date
1673045848db9654bcb07a81fad34afb4b0623d1johanengelen
442e92e07cfe50f73dda0d06638025a65e23a956johanengelen gchar * href; // contains link to other object, e.g. "#path2428", NULL if PathParam contains pathdata itself
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen PathReference ref;
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen sigc::connection ref_changed_connection;
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen sigc::connection linked_delete_connection;
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen sigc::connection linked_modified_connection;
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen void ref_changed(SPObject *old_ref, SPObject *new_ref);
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen void remove_link();
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen void start_listening(SPObject * to);
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen void quit_listening(void);
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen void linked_delete(SPObject *deleted);
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen void linked_modified(SPObject *linked_obj, guint flags);
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm void on_edit_button_click();
539b02bd98b6985f91ccbf7041f88fdf93061531johanengelen void on_copy_button_click();
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen void on_link_button_click();
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm gchar * defvalue;
afb717c6e7d29c86c404b6627855c438d6dc2c0fjohanengelen
afb717c6e7d29c86c404b6627855c438d6dc2c0fjohanengelenprivate:
afb717c6e7d29c86c404b6627855c438d6dc2c0fjohanengelen PathParam(const PathParam&);
afb717c6e7d29c86c404b6627855c438d6dc2c0fjohanengelen PathParam& operator=(const PathParam&);
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm};
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm} //namespace LivePathEffect
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm} //namespace Inkscape
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#endif