X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsnapper.cpp;h=1daa1d15183574d90839e1f668ec014b11155d3c;hb=68ac087bc09b818a5e1a7e6bdabc0bc1c3d1dfad;hp=7a82fe1d462f384e3be8c9ff85146c1d3f768fff;hpb=b28c4e3da388087b108e7a5749d75668afcd2d58;p=inkscape.git diff --git a/src/snapper.cpp b/src/snapper.cpp index 7a82fe1d4..1daa1d151 100644 --- a/src/snapper.cpp +++ b/src/snapper.cpp @@ -15,13 +15,14 @@ Inkscape::Snapper::PointType const Inkscape::Snapper::SNAPPOINT_BBOX = 0x1; Inkscape::Snapper::PointType const Inkscape::Snapper::SNAPPOINT_NODE = 0x2; +Inkscape::Snapper::PointType const Inkscape::Snapper::SNAPPOINT_GUIDE = 0x4; /** * Construct new Snapper for named view. * \param nv Named view. * \param d Snap distance. */ -Inkscape::Snapper::Snapper(SPNamedView const *nv, NR::Coord const d) : _named_view(nv), _enabled(true), _distance(d) +Inkscape::Snapper::Snapper(SPNamedView const *nv, NR::Coord const d) : _named_view(nv), _snap_enabled(true), _distance(d) { g_assert(_named_view != NULL); g_assert(SP_IS_NAMEDVIEW(_named_view)); @@ -75,7 +76,7 @@ bool Inkscape::Snapper::getSnapFrom(PointType t) const void Inkscape::Snapper::setEnabled(bool s) { - _enabled = s; + _snap_enabled = s; } @@ -90,13 +91,17 @@ void Inkscape::Snapper::setEnabled(bool s) * \return Snapped point. */ -Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t, +void Inkscape::Snapper::freeSnap(SnappedConstraints &sc, + + PointType const &t, NR::Point const &p, + bool const &first_point, + std::vector &points_to_snap, SPItem const *it) const { std::list lit; lit.push_back(it); - return freeSnap(t, p, lit); + freeSnap(sc, t, p, first_point, points_to_snap, lit); } @@ -111,15 +116,19 @@ Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t, * \return Snapped point. */ -Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t, +void Inkscape::Snapper::freeSnap(SnappedConstraints &sc, + + PointType const &t, NR::Point const &p, + bool const &first_point, + std::vector &points_to_snap, std::list const &it) const { - if (_enabled == false || getSnapFrom(t) == false) { - return SnappedPoint(p, NR_HUGE); + if (_snap_enabled == false || getSnapFrom(t) == false) { + return; } - return _doFreeSnap(t, p, it); + _doFreeSnap(sc, t, p, first_point, points_to_snap, it); } @@ -136,14 +145,18 @@ Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t, * \return Snapped point. */ -Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t, +void Inkscape::Snapper::constrainedSnap(SnappedConstraints &sc, + + PointType const &t, NR::Point const &p, + bool const &first_point, + std::vector &points_to_snap, ConstraintLine const &c, SPItem const *it) const { std::list lit; lit.push_back(it); - return constrainedSnap(t, p, c, lit); + constrainedSnap(sc, t, p, first_point, points_to_snap, c, lit); } @@ -158,16 +171,19 @@ Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t, * \return Snapped point. */ -Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t, +void Inkscape::Snapper::constrainedSnap(SnappedConstraints &sc, + PointType const &t, NR::Point const &p, + bool const &first_point, + std::vector &points_to_snap, ConstraintLine const &c, std::list const &it) const { - if (_enabled == false || getSnapFrom(t) == false) { - return SnappedPoint(p, NR_HUGE); + if (_snap_enabled == false || getSnapFrom(t) == false) { + return; } - return _doConstrainedSnap(t, p, c, it); + _doConstrainedSnap(sc, t, p, first_point, points_to_snap, c, it); } /*