summaryrefslogtreecommitdiffstats
path: root/src/snapper.cpp
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2006-05-09 11:16:07 +0000
committercth103 <cth103@users.sourceforge.net>2006-05-09 11:16:07 +0000
commit59c4341913f56e5fdc21c58ebf2425eadaec1eaa (patch)
treee193ba7062a50fddeace35edfe09dbe9aff4b8c1 /src/snapper.cpp
parentSmall comment cleanups. (diff)
downloadinkscape-59c4341913f56e5fdc21c58ebf2425eadaec1eaa.tar.gz
inkscape-59c4341913f56e5fdc21c58ebf2425eadaec1eaa.zip
Re-enable link between grid visibility and grid snap.
(bzr r795)
Diffstat (limited to '')
-rw-r--r--src/snapper.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/snapper.cpp b/src/snapper.cpp
index 963cf7c9d..723213afe 100644
--- a/src/snapper.cpp
+++ b/src/snapper.cpp
@@ -19,7 +19,7 @@ Inkscape::Snapper::PointType const Inkscape::Snapper::SNAP_POINT = 0x2;
* \param nv Named view.
* \param d Snap distance.
*/
-Inkscape::Snapper::Snapper(SPNamedView const *nv, NR::Coord const d) : _named_view(nv), _distance(d)
+Inkscape::Snapper::Snapper(SPNamedView const *nv, NR::Coord const d) : _named_view(nv), _distance(d), _enabled(true)
{
g_assert(_named_view != NULL);
g_assert(SP_IS_NAMEDVIEW(_named_view));
@@ -72,10 +72,19 @@ bool Inkscape::Snapper::getSnapTo(PointType t) const
*/
bool Inkscape::Snapper::willSnapSomething() const
{
- return (_snap_to != 0);
+ return (_enabled && _snap_to != 0);
}
+/**
+ * \param s true to enable this snapper, otherwise false.
+ */
+
+void Inkscape::Snapper::setEnabled(bool s)
+{
+ _enabled = s;
+}
+
/**
* Try to snap a point to whatever this snapper is interested in. Any
@@ -113,7 +122,7 @@ Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType t,
NR::Point const &p,
std::list<SPItem const *> const &it) const
{
- if (getSnapTo(t) == false) {
+ if (_enabled == false || getSnapTo(t) == false) {
return SnappedPoint(p, NR_HUGE);
}
@@ -161,7 +170,7 @@ Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType t,
ConstraintLine const &c,
std::list<SPItem const *> const &it) const
{
- if (getSnapTo(t) == false) {
+ if (_enabled == false || getSnapTo(t) == false) {
return SnappedPoint(p, NR_HUGE);
}