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
c0537dcfe264414d52ad86579d57cb0cb2183dcbAlex Valavanis#include <glib.h>
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#include <2geom/path.h>
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm#include "live_effects/parameter/parameter.h"
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen#include "live_effects/parameter/path-reference.h"
364d9045bfd158352b8040721b3e2e2602e921eatheAdib#include <stddef.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
76addc201c409e81eaaa73fe27cc0f79c4db097cKrzysztof Kosiński Geom::PathVector const & get_pathvector() const;
3cc77bbe681dd68bde92a2c4796cd5020aecb214johanengelen Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2();
afb717c6e7d29c86c404b6627855c438d6dc2c0fjohanengelen
5cf332777b4c27336d64c273ac63bce3ee27a53dAlex Valavanis virtual Gtk::Widget * param_newWidget();
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();
76addc201c409e81eaaa73fe27cc0f79c4db097cKrzysztof Kosiński void set_new_value (Geom::PathVector 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);
0b2d8abc1011ad865fce3b883ccb2587cb15cc90Johan B. C. Engelen virtual void addCanvasIndicators(SPLPEItem const* lpeitem, std::vector<Geom::PathVector> &hp_vec);
fb5a72174252e0e79107dcad3bf5a2bbd73e349cjohanengelen
d37634d73670180f99a3e0ea583621373d90ec4fJohan Engelen virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/);
bdd7add6c064afee52d2eabeaa18f745430e5a4djohanengelen
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm sigc::signal <void> signal_path_pasted;
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm sigc::signal <void> signal_path_changed;
c776c7f3860f657ea9db62d62e9da98df09b0c70johanengelen bool changed; /* this gets set whenever the path is changed (this is set to true, and then the signal_path_changed signal is emitted).
c776c7f3860f657ea9db62d62e9da98df09b0c70johanengelen * the user must set it back to false if she wants to use it sensibly */
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
390745fa4524b55aad12d5d2d656cd73e75a0bc0cilix void paste_param_path(const char *svgd);
390745fa4524b55aad12d5d2d656cd73e75a0bc0cilix void on_paste_button_click();
390745fa4524b55aad12d5d2d656cd73e75a0bc0cilix
afb717c6e7d29c86c404b6627855c438d6dc2c0fjohanengelenprotected:
76addc201c409e81eaaa73fe27cc0f79c4db097cKrzysztof Kosiński Geom::PathVector _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;
588c60840c153d582c076b618f9a548ab002da4eJohan B. C. Engelen sigc::connection linked_transformed_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);
588c60840c153d582c076b618f9a548ab002da4eJohan B. C. Engelen void linked_transformed(Geom::Affine const *rel_transf, SPItem *moved_item);
05e1ec4d6f1ccc3a0db3cc13e8a3b18489714f14Johan Engelen virtual void linked_modified_callback(SPObject *linked_obj, guint flags);
588c60840c153d582c076b618f9a548ab002da4eJohan B. C. Engelen virtual void linked_transformed_callback(Geom::Affine const * /*rel_transf*/, SPItem * /*moved_item*/) {};
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm void on_edit_button_click();
539b02bd98b6985f91ccbf7041f88fdf93061531johanengelen void on_copy_button_click();
43f848b15ee40a6c108ae9d965cf06f055ecb7a5johanengelen void on_link_button_click();
f07bfd5a05d43a6d11f7cd442f085149092dea88pjrm
c776c7f3860f657ea9db62d62e9da98df09b0c70johanengelen void emit_changed();
c776c7f3860f657ea9db62d62e9da98df09b0c70johanengelen
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