summaryrefslogtreecommitdiffstats
path: root/src/snapper.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2007-07-28 15:47:49 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2007-07-28 15:47:49 +0000
commitb79f13c5491131606a50a112a296e1011ddc91ee (patch)
tree5959773e1d0206a0d6a4b240dd3f137507232861 /src/snapper.cpp
parentSet top-level groups as layers with the name of the PDF document (diff)
downloadinkscape-b79f13c5491131606a50a112a296e1011ddc91ee.tar.gz
inkscape-b79f13c5491131606a50a112a296e1011ddc91ee.zip
1) Changes to snapping preferences dialog
2) Strict snapping implemented, i.e. bbox only to bbox and nodes only to paths/nodes 3) Renaming of some constants to improve readability (bzr r3331)
Diffstat (limited to 'src/snapper.cpp')
-rw-r--r--src/snapper.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/snapper.cpp b/src/snapper.cpp
index 390e0957e..7a82fe1d4 100644
--- a/src/snapper.cpp
+++ b/src/snapper.cpp
@@ -13,8 +13,8 @@
#include "inkscape.h"
#include "desktop.h"
-Inkscape::Snapper::PointType const Inkscape::Snapper::BBOX_POINT = 0x1;
-Inkscape::Snapper::PointType const Inkscape::Snapper::SNAP_POINT = 0x2;
+Inkscape::Snapper::PointType const Inkscape::Snapper::SNAPPOINT_BBOX = 0x1;
+Inkscape::Snapper::PointType const Inkscape::Snapper::SNAPPOINT_NODE = 0x2;
/**
* Construct new Snapper for named view.
@@ -26,7 +26,7 @@ Inkscape::Snapper::Snapper(SPNamedView const *nv, NR::Coord const d) : _named_vi
g_assert(_named_view != NULL);
g_assert(SP_IS_NAMEDVIEW(_named_view));
- setSnapTo(BBOX_POINT | SNAP_POINT, true); //Snap any point. In v0.45 and earlier, this was controlled in the preferences tab
+ setSnapFrom(SNAPPOINT_BBOX | SNAPPOINT_NODE, true); //Snap any point. In v0.45 and earlier, this was controlled in the preferences tab
}
/**
@@ -51,12 +51,12 @@ NR::Coord Inkscape::Snapper::getDistance() const
* \param t Point type.
* \param s true to snap to this point type, otherwise false;
*/
-void Inkscape::Snapper::setSnapTo(PointType t, bool s)
+void Inkscape::Snapper::setSnapFrom(PointType t, bool s)
{
if (s) {
- _snap_to |= t;
+ _snap_from |= t;
} else {
- _snap_to &= ~t;
+ _snap_from &= ~t;
}
}
@@ -64,9 +64,9 @@ void Inkscape::Snapper::setSnapTo(PointType t, bool s)
* \param t Point type.
* \return true if snapper will snap this type of point, otherwise false.
*/
-bool Inkscape::Snapper::getSnapTo(PointType t) const
+bool Inkscape::Snapper::getSnapFrom(PointType t) const
{
- return (_snap_to & t);
+ return (_snap_from & t);
}
/**
@@ -90,7 +90,7 @@ void Inkscape::Snapper::setEnabled(bool s)
* \return Snapped point.
*/
-Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType t,
+Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t,
NR::Point const &p,
SPItem const *it) const
{
@@ -111,15 +111,15 @@ Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType t,
* \return Snapped point.
*/
-Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType t,
+Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t,
NR::Point const &p,
std::list<SPItem const *> const &it) const
{
- if (_enabled == false || getSnapTo(t) == false) {
+ if (_enabled == false || getSnapFrom(t) == false) {
return SnappedPoint(p, NR_HUGE);
}
- return _doFreeSnap(p, it);
+ return _doFreeSnap(t, p, it);
}
@@ -136,7 +136,7 @@ Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType t,
* \return Snapped point.
*/
-Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType t,
+Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t,
NR::Point const &p,
ConstraintLine const &c,
SPItem const *it) const
@@ -158,16 +158,16 @@ Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType t,
* \return Snapped point.
*/
-Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType t,
+Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t,
NR::Point const &p,
ConstraintLine const &c,
std::list<SPItem const *> const &it) const
{
- if (_enabled == false || getSnapTo(t) == false) {
+ if (_enabled == false || getSnapFrom(t) == false) {
return SnappedPoint(p, NR_HUGE);
}
- return _doConstrainedSnap(p, c, it);
+ return _doConstrainedSnap(t, p, c, it);
}
/*