From bc576428c38521984964e4f9e6289c8da1157173 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Thu, 24 Dec 2009 21:10:43 +0100 Subject: refactoring the snapping code (laying the groundwork for my next commit which reduces snap jitter) (bzr r8906) --- src/snapper.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/snapper.h') diff --git a/src/snapper.h b/src/snapper.h index 110b3d36a..93756f7af 100644 --- a/src/snapper.h +++ b/src/snapper.h @@ -39,9 +39,9 @@ namespace Inkscape class Snapper { public: - Snapper() {} - Snapper(SnapManager *sm, ::Geom::Coord const t); - virtual ~Snapper() {} + Snapper() {} + Snapper(SnapManager *sm, ::Geom::Coord const t); + virtual ~Snapper() {} virtual Geom::Coord getSnapperTolerance() const = 0; //returns the tolerance of the snapper in screen pixels (i.e. independent of zoom) virtual bool getSnapperAlwaysSnap() const = 0; //if true, then the snapper will always snap, regardless of its tolerance @@ -53,7 +53,7 @@ public: // These four methods are only used for grids, for which snapping can be enabled individually void setEnabled(bool s); - void setSnapVisibleOnly(bool s); + void setSnapVisibleOnly(bool s); bool getEnabled() const {return _snap_enabled;} bool getSnapVisibleOnly() const {return _snap_visible_only;} @@ -61,7 +61,7 @@ public: SnapPreferences::PointType const &/*t*/, Geom::Point const &/*p*/, SnapSourceType const &/*source_type*/, - bool const &/*first_point*/, + long source_num, Geom::OptRect const &/*bbox_to_snap*/, std::vector const */*it*/, std::vector > */*unselected_nodes*/) const {}; @@ -90,9 +90,9 @@ public: } Geom::Point projection(Geom::Point const &p) const { // returns the projection of p on this constraintline - Geom::Point const p1_on_cl = _has_point ? _point : p; - Geom::Point const p2_on_cl = p1_on_cl + _direction; - return Geom::projection(p, Geom::Line(p1_on_cl, p2_on_cl)); + Geom::Point const p1_on_cl = _has_point ? _point : p; + Geom::Point const p2_on_cl = p1_on_cl + _direction; + return Geom::projection(p, Geom::Line(p1_on_cl, p2_on_cl)); } private: @@ -103,20 +103,20 @@ public: }; virtual void constrainedSnap(SnappedConstraints &/*sc*/, - SnapPreferences::PointType const &/*t*/, + SnapPreferences::PointType const &/*t*/, Geom::Point const &/*p*/, SnapSourceType const &/*source_type*/, - bool const &/*first_point*/, + long source_num, Geom::OptRect const &/*bbox_to_snap*/, ConstraintLine const &/*c*/, std::vector const */*it*/) const {}; protected: - SnapManager *_snapmanager; + SnapManager *_snapmanager; - // This is only used for grids, for which snapping can be enabled individually - bool _snap_enabled; ///< true if this snapper is enabled, otherwise false - bool _snap_visible_only; + // This is only used for grids, for which snapping can be enabled individually + bool _snap_enabled; ///< true if this snapper is enabled, otherwise false + bool _snap_visible_only; }; } -- cgit v1.2.3 From 95e85b55ac17a5418d971ace335650ba0fc082e0 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 26 Dec 2009 19:27:32 -0800 Subject: Warning cleanup. (bzr r8915) --- src/snapper.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/snapper.h') diff --git a/src/snapper.h b/src/snapper.h index 93756f7af..dcc0fbb81 100644 --- a/src/snapper.h +++ b/src/snapper.h @@ -61,7 +61,7 @@ public: SnapPreferences::PointType const &/*t*/, Geom::Point const &/*p*/, SnapSourceType const &/*source_type*/, - long source_num, + long /*source_num*/, Geom::OptRect const &/*bbox_to_snap*/, std::vector const */*it*/, std::vector > */*unselected_nodes*/) const {}; @@ -106,7 +106,7 @@ public: SnapPreferences::PointType const &/*t*/, Geom::Point const &/*p*/, SnapSourceType const &/*source_type*/, - long source_num, + long /*source_num*/, Geom::OptRect const &/*bbox_to_snap*/, ConstraintLine const &/*c*/, std::vector const */*it*/) const {}; -- cgit v1.2.3 From e8f4c644181a8a68e2c33e1783f77a400dc1a29f Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 9 Jan 2010 22:14:38 +0100 Subject: Refactoring the snapping API (making it easier to maintain and understand for the devs) (bzr r8960) --- src/snapper.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/snapper.h') diff --git a/src/snapper.h b/src/snapper.h index dcc0fbb81..dbbf7ebe9 100644 --- a/src/snapper.h +++ b/src/snapper.h @@ -20,6 +20,7 @@ #include "snapped-line.h" #include "snapped-curve.h" #include "snap-preferences.h" +#include "snap-candidate.h" struct SnappedConstraints { std::list points; @@ -34,7 +35,6 @@ struct SPItem; namespace Inkscape { - /// Parent for classes that can snap points to something class Snapper { @@ -59,12 +59,10 @@ public: virtual void freeSnap(SnappedConstraints &/*sc*/, SnapPreferences::PointType const &/*t*/, - Geom::Point const &/*p*/, - SnapSourceType const &/*source_type*/, - long /*source_num*/, + Inkscape::SnapCandidatePoint const &/*p*/, Geom::OptRect const &/*bbox_to_snap*/, std::vector const */*it*/, - std::vector > */*unselected_nodes*/) const {}; + std::vector */*unselected_nodes*/) const {}; class ConstraintLine { @@ -104,9 +102,7 @@ public: virtual void constrainedSnap(SnappedConstraints &/*sc*/, SnapPreferences::PointType const &/*t*/, - Geom::Point const &/*p*/, - SnapSourceType const &/*source_type*/, - long /*source_num*/, + Inkscape::SnapCandidatePoint const &/*p*/, Geom::OptRect const &/*bbox_to_snap*/, ConstraintLine const &/*c*/, std::vector const */*it*/) const {}; -- cgit v1.2.3