Code

Node tool: snap while scaling a selection of nodes. Consider this as experimental...
[inkscape.git] / src / seltrans.h
index 64ced3dc5fa3e2521d38582ab1336e79df516938..bb26aa2cbae7d5de0179b28343b76dfa72c01840 100644 (file)
@@ -24,6 +24,7 @@
 #include "selcue.h"
 #include "message-context.h"
 #include <vector>
+#include "sp-item.h"
 
 struct SPKnot;
 class SPDesktop;
@@ -53,7 +54,7 @@ public:
     void increaseState();
     void resetState();
     void setCenter(Geom::Point const &p);
-    void grab(Geom::Point const &p, gdouble x, gdouble y, bool show_handles);
+    void grab(Geom::Point const &p, gdouble x, gdouble y, bool show_handles, bool translating);
     void transform(Geom::Matrix const &rel_affine, Geom::Point const &norm);
     void ungrab();
     void stamp();
@@ -86,7 +87,7 @@ public:
         return _empty;
     }
     bool isGrabbed() {
-        return _grabbed;    
+        return _grabbed;
     }
        bool centerIsVisible() {
                return ( _chandle && SP_KNOT_IS_VISIBLE (_chandle) );
@@ -102,22 +103,24 @@ private:
     Geom::Point _getGeomHandlePos(Geom::Point const &visual_handle_pos);
     Geom::Point _calcAbsAffineDefault(Geom::Scale const default_scale);
     Geom::Point _calcAbsAffineGeom(Geom::Scale const geom_scale);
+    void _display_snapsource();
 
     enum State {
         STATE_SCALE, //scale or stretch
         STATE_ROTATE //rotate or skew
     };
-    
+
     SPDesktop *_desktop;
 
     std::vector<SPItem *> _items;
     std::vector<SPItem const *> _items_const;
     std::vector<Geom::Matrix> _items_affines;
     std::vector<Geom::Point> _items_centers;
-    
-    std::vector<Geom::Point> _snap_points;
-    std::vector<Geom::Point> _bbox_points;
-    
+
+    std::vector<Inkscape::SnapCandidatePoint> _snap_points;
+    std::vector<Inkscape::SnapCandidatePoint> _bbox_points; // the bbox point of the selection as a whole, i.e. max. 4 corners plus optionally some midpoints
+    std::vector<Inkscape::SnapCandidatePoint> _bbox_points_for_translating; // the bbox points of each selected item, only to be used for translating
+
     Inkscape::SelCue _selcue;
 
     Inkscape::Selection *_selection;
@@ -130,12 +133,12 @@ private:
     bool _changed;
 
     SPItem::BBoxType _snap_bbox_type;
-    
-    boost::optional<Geom::Rect> _bbox;
-    boost::optional<Geom::Rect> _approximate_bbox;
-    boost::optional<Geom::Rect> _geometric_bbox;
+
+    Geom::OptRect _bbox;
+    Geom::OptRect _approximate_bbox;
+    Geom::OptRect _geometric_bbox;
     gdouble _strokewidth;
-    
+
     Geom::Matrix _current_relative_affine;
     Geom::Matrix _absolute_affine;
     Geom::Matrix _relative_affine;
@@ -144,8 +147,8 @@ private:
      * lines into straight lines and parallel lines into parallel lines but may alter distance between points
      * and angles between lines <affine geometry>
      */
-    
-    Geom::Point _opposite; ///< opposite point to where a scale is taking place    
+
+    Geom::Point _opposite; ///< opposite point to where a scale is taking place
     Geom::Point _opposite_for_specpoints;
     Geom::Point _opposite_for_bboxpoints;
     Geom::Point _origin_for_specpoints;