Code

fix shift+middle button zoom area when there are other modifiers in the mask; safe...
[inkscape.git] / src / object-snapper.h
index 74bdec0cef3bad0a2ac04385943b7ea0ce7c6c57..baa60a096fdc392049dfb48664aad4bb3563c8cb 100644 (file)
@@ -53,13 +53,17 @@ public:
                GUIDE_TRANSL_SNAP_X, // For snapping a vertical guide (normal in the X-direction) to objects,
                GUIDE_TRANSL_SNAP_Y, // For snapping a horizontal guide (normal in the Y-direction) to objects
                ANGLED_GUIDE_TRANSL_SNAP, // For snapping an angled guide, while translating it accross the desktop
-               ANGLED_GUIDE_ROT_SNAP, // For snapping an angled guide, while rotating it around some pivot point
                TRANSL_SNAP_XY}; // All other cases; for snapping to objects, other than guides
 
-       void guideSnap(SnappedConstraints &sc,
+       void guideFreeSnap(SnappedConstraints &sc,
                                   Geom::Point const &p,
                                   Geom::Point const &guide_normal) const;
 
+       void guideConstrainedSnap(SnappedConstraints &sc,
+                                          Geom::Point const &p,
+                                          Geom::Point const &guide_normal,
+                                          ConstraintLine const &c) const;
+
        bool ThisSnapperMightSnap() const;
        bool GuidesMightSnap() const;
 
@@ -69,14 +73,16 @@ public:
        void freeSnap(SnappedConstraints &sc,
                                  Inkscape::SnapPreferences::PointType const &t,
                                  Geom::Point const &p,
+                                 SnapSourceType const &source_type,
                                  bool const &first_point,
                                  Geom::OptRect const &bbox_to_snap,
                                  std::vector<SPItem const *> const *it,
-                                 std::vector<Geom::Point> *unselected_nodes) const;
+                                 std::vector<std::pair<Geom::Point, int> > *unselected_nodes) const;
 
        void constrainedSnap(SnappedConstraints &sc,
                                  Inkscape::SnapPreferences::PointType const &t,
                                  Geom::Point const &p,
+                                 SnapSourceType const &source_type,
                                  bool const &first_point,
                                  Geom::OptRect const &bbox_to_snap,
                                  ConstraintLine const &c,
@@ -85,8 +91,8 @@ public:
 private:
     //store some lists of candidates, points and paths, so we don't have to rebuild them for each point we want to snap
     std::vector<SnapCandidate> *_candidates;
-    std::vector<Geom::Point> *_points_to_snap_to;
-    std::vector<Geom::PathVector*> *_paths_to_snap_to;
+    std::vector<std::pair<Geom::Point, int> > *_points_to_snap_to;
+    std::vector<std::pair<Geom::PathVector*, SnapTargetType> > *_paths_to_snap_to;
 
     void _findCandidates(SPObject* parent,
                        std::vector<SPItem const *> const *it,
@@ -99,8 +105,9 @@ private:
     void _snapNodes(SnappedConstraints &sc,
                       Inkscape::SnapPreferences::PointType const &t,
                       Geom::Point const &p, // in desktop coordinates
+                      SnapSourceType const &source_type,
                       bool const &first_point,
-                      std::vector<Geom::Point> *unselected_nodes) const; // in desktop coordinates
+                      std::vector<std::pair<Geom::Point, int> > *unselected_nodes) const; // in desktop coordinates
 
     void _snapTranslatingGuideToNodes(SnappedConstraints &sc,
                      Inkscape::SnapPreferences::PointType const &t,
@@ -113,17 +120,19 @@ private:
     void _snapPaths(SnappedConstraints &sc,
                       Inkscape::SnapPreferences::PointType const &t,
                       Geom::Point const &p,    // in desktop coordinates
+                      SnapSourceType const &source_type,
                       bool const &first_point,
-                      std::vector<Geom::Point> *unselected_nodes, // in desktop coordinates
+                      std::vector<std::pair<Geom::Point, int> > *unselected_nodes, // in desktop coordinates
                       SPPath const *selected_path) const;
 
     void _snapPathsConstrained(SnappedConstraints &sc,
                  Inkscape::SnapPreferences::PointType const &t,
                  Geom::Point const &p, // in desktop coordinates
-                 bool const &first_point,
+                 SnapSourceType const source_type,
+                                bool const &first_point,
                  ConstraintLine const &c) const;
 
-    bool isUnselectedNode(Geom::Point const &point, std::vector<Geom::Point> const *unselected_nodes) const;
+    bool isUnselectedNode(Geom::Point const &point, std::vector<std::pair<Geom::Point, int> > const *unselected_nodes) const;
 
     void _collectPaths(Inkscape::SnapPreferences::PointType const &t,
                   bool const &first_point) const;
@@ -131,11 +140,11 @@ private:
     void _clear_paths() const;
     Geom::PathVector* _getBorderPathv() const;
     Geom::PathVector* _getPathvFromRect(Geom::Rect const rect) const;
-    void _getBorderNodes(std::vector<Geom::Point> *points) const;
+    void _getBorderNodes(std::vector<std::pair<Geom::Point, int> > *points) const;
 
 }; // end of ObjectSnapper class
 
-void getBBoxPoints(Geom::OptRect const bbox, std::vector<Geom::Point> *points, bool const includeCorners, bool const includeLineMidpoints, bool const includeObjectMidpoints);
+void getBBoxPoints(Geom::OptRect const bbox, std::vector<std::pair<Geom::Point, int> > *points, bool const isTarget, bool const includeCorners, bool const includeLineMidpoints, bool const includeObjectMidpoints);
 
 } // end of namespace Inkscape