From 644f4f4a93a81735fb8265907533308df80d6b11 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 18 Jan 2009 20:00:19 +0000 Subject: - Snap to the midpoint of shapes and bboxes - Snap to the midpoint of paths and bbox edges - Refactor the snapping toggle, i.e. what snaps to what when toggling a specific option in the snapping toolbar PS: icons.svg has been modified, so use "make install" if needed (bzr r7144) --- src/snap.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/snap.cpp') diff --git a/src/snap.cpp b/src/snap.cpp index a6c4b8729..24cfefe0b 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -107,6 +107,25 @@ bool SnapManager::someSnapperMightSnap() const return (i != s.end()); } +/** + * \return true if one of the snappers will try to snap something. + */ + +bool SnapManager::gridSnapperMightSnap() const +{ + if ( !snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally() ) { + return false; + } + + SnapperList const s = getGridSnappers(); + SnapperList::const_iterator i = s.begin(); + while (i != s.end() && (*i)->ThisSnapperMightSnap() == false) { + i++; + } + + return (i != s.end()); +} + /** * Try to snap a point to any of the specified snappers. * -- cgit v1.2.3