Code

small cleanup in src/trace (warnings and trailing spaces)
[inkscape.git] / src / shape-editor.h
index 37117331bf8d8e572879af0b17bf7aaabfb13068..8780586c40b7ac227e94c8955b23bfb57c2f7ce2 100644 (file)
  */
 
 #include <forward.h>
+#include <libnr/nr-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 <boost/optional.hpp>
+#include <vector>
 
-class SPKnotHolder;
+class KnotHolder;
 class SPDesktop;
 class SPNodeContext;
 class ShapeEditorsCollective;
 
+enum SubType{
+    SH_NODEPATH,
+    SH_KNOTHOLDER
+};
+
 class ShapeEditor {
 public:
 
     ShapeEditor(SPDesktop *desktop);
     ~ShapeEditor();
 
-    void set_item (SPItem *item);
-    void unset_item ();
+    void set_item (SPItem *item, SubType type, bool keep_knotholder = false);
+    void set_item_lpe_path_parameter(SPItem *item, SPObject *lpeobject, const char * key);
+    void set_knotholder(KnotHolder * knot_holder);
+    void reset_item (SubType type, bool keep_knotholder = true);
+    void unset_item (SubType type, bool keep_knotholder = false);
 
-    SPItem *get_item ();
+    const SPItem *get_item (SubType type);
 
     bool has_nodepath ();
     bool has_knotholder ();
+    void update_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);
@@ -52,7 +61,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
 
@@ -66,7 +75,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 ();
@@ -78,18 +87,20 @@ public:
 
     void delete_nodes();
     void delete_nodes_preserving_shape();
+    void delete_segment();
 
     void set_node_type(int type);
 
     void break_at_nodes();
     void join_nodes();
+    void join_segments();
 
     void duplicate_nodes();
 
     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);
 
@@ -101,16 +112,21 @@ public:
     void select_next ();
     void select_prev ();
 
-    void flip (NR::Dim2 axis);
+    void show_handles (bool show);
+    void show_helperpath (bool show);
+
+    void flip (Geom::Dim2 axis, boost::optional<Geom::Point> center = boost::optional<Geom::Point>());
 
-    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);
 
 private:
     SPDesktop *desktop;
 
     Inkscape::NodePath::Path *nodepath;
-    SPKnotHolder *knotholder;
+    KnotHolder *knotholder;
 
     ShapeEditorsCollective *container;
 
@@ -119,8 +135,10 @@ 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 *listener_attached_for;
 };