X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fshape-editor.h;h=98dbb35d7f94c266d5f4ac7899e963971f40c4be;hb=e0ade2e2a1738f87d3c589a7dfb3631e11696b7e;hp=8e563b433d0185afb658cb2f31d6fcc8f2db781b;hpb=72aa7310f3a87958233d5cb4bf1386ff999be0ac;p=inkscape.git diff --git a/src/shape-editor.h b/src/shape-editor.h index 8e563b433..98dbb35d7 100644 --- a/src/shape-editor.h +++ b/src/shape-editor.h @@ -13,21 +13,26 @@ */ #include +#include <2geom/forward.h> -namespace Inkscape { -namespace NodePath { -class Path; -} -} +namespace Inkscape { namespace NodePath { class Path; } } +namespace Inkscape { namespace XML { class Node; } } -#include "libnr/nr-path-code.h" -#include "libnr/nr-point.h" -#include "libnr/nr-maybe.h" - -class SPKnotHolder; +class KnotHolder; class SPDesktop; class SPNodeContext; class ShapeEditorsCollective; +class LivePathEffectObject; + +#include "libnr/nr-path-code.h" +#include <2geom/point.h> +#include +#include + +enum SubType{ + SH_NODEPATH, + SH_KNOTHOLDER +}; class ShapeEditor { public: @@ -35,18 +40,15 @@ public: ShapeEditor(SPDesktop *desktop); ~ShapeEditor(); - void set_item (SPItem *item); - void set_item_livepatheffect_parameter(SPItem *item, SPObject *lpeobject, const char * key); - void reset_item (); - void unset_item (); + void set_item (SPItem *item, SubType type, bool keep_knotholder = false); + void set_item_lpe_path_parameter(SPItem *item, LivePathEffectObject *lpeobject, const char * key); + void unset_item (SubType type, bool keep_knotholder = false); - SPItem *get_item (); + bool has_nodepath (); //((deprecated)) + void update_knotholder (); //((deprecated)) - bool has_nodepath (); - bool has_knotholder (); - - bool has_local_change (); - void decrement_local_change (); + bool has_local_change (SubType type); + void decrement_local_change (SubType type); GList *save_nodepath_selection (); void restore_nodepath_selection (GList *saved); @@ -55,7 +57,7 @@ public: void update_statusbar (); - bool is_over_stroke (NR::Point event_p, bool remember); + bool is_over_stroke (Geom::Point event_p, bool remember); void add_node_near_point(); // uses the shapeeditor's remembered point, if any @@ -69,7 +71,7 @@ public: void finish_drag (); - void select_rect (NR::Rect const &rect, bool add); + void select_rect (Geom::Rect const &rect, bool add); bool has_selection (); void deselect (); @@ -94,7 +96,7 @@ public: void set_type_of_segments(NRPathcode code); void move_nodes(gdouble dx, gdouble dy); - void move_nodes_screen(gdouble dx, gdouble dy); + void move_nodes_screen(SPDesktop *desktop, gdouble dx, gdouble dy); void rotate_nodes(gdouble angle, int which, bool screen); @@ -109,18 +111,27 @@ public: void show_handles (bool show); void show_helperpath (bool show); - void flip (NR::Dim2 axis, NR::Maybe center = NR::Nothing()); + void flip (Geom::Dim2 axis, boost::optional center = boost::optional()); - void distribute (NR::Dim2 axis); - void align (NR::Dim2 axis); + void distribute (Geom::Dim2 axis); + void align (Geom::Dim2 axis); bool nodepath_edits_repr_key(gchar const *name); + // this one is only public because it's called from non-C++ repr changed callback + void shapeeditor_event_attr_changed(gchar const *name); + private: + bool has_knotholder (); + void reset_item (SubType type, bool keep_knotholder = true); + const SPItem *get_item (SubType type); + SPDesktop *desktop; Inkscape::NodePath::Path *nodepath; - SPKnotHolder *knotholder; + + // TODO: std::list knotholders; + KnotHolder *knotholder; ShapeEditorsCollective *container; @@ -129,8 +140,11 @@ private: double grab_t; int grab_node; // number of node grabbed by sp_node_context_is_over_stroke bool hit; - NR::Point curvepoint_event; // int coords from event - NR::Point curvepoint_doc; // same, in doc coords + Geom::Point curvepoint_event; // int coords from event + Geom::Point curvepoint_doc; // same, in doc coords + + Inkscape::XML::Node *knotholder_listener_attached_for; + Inkscape::XML::Node *nodepath_listener_attached_for; };