summaryrefslogtreecommitdiffstats
path: root/src/snap-preferences.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/snap-preferences.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/snap-preferences.cpp b/src/snap-preferences.cpp
index 15c976466..4859b111e 100644
--- a/src/snap-preferences.cpp
+++ b/src/snap-preferences.cpp
@@ -1,5 +1,3 @@
-#define __SNAPPREFERENCES_CPP__
-
/**
* \file snap-preferences.cpp
* \brief Storing of snapping preferences
@@ -27,15 +25,16 @@ Inkscape::SnapPreferences::SnapPreferences() :
_snap_to_page_border(false),
_strict_snapping(true)
{
- setSnapFrom(SnapSourceType(SNAPSOURCE_BBOX_CATEGORY | SNAPSOURCE_NODE_CATEGORY | SNAPSOURCE_OTHER_CATEGORY), true); //Snap any point. In v0.45 and earlier, this was controlled in the preferences tab
+ setSnapFrom(SnapSourceType(SNAPSOURCE_BBOX_CATEGORY | SNAPSOURCE_NODE_CATEGORY | SNAPSOURCE_OTHERS_CATEGORY), true); //Snap any point. In v0.45 and earlier, this was controlled in the preferences tab
}
/*
* The snappers have too many parameters to adjust individually. Therefore only
- * two snapping modes are presented to the user: snapping bounding box corners (to
+ * three snapping modes are presented to the user: snapping bounding box corners (to
* other bounding boxes, grids or guides), and/or snapping nodes (to other nodes,
- * paths, grids or guides). To select either of these modes (or both), use the
- * methods defined below: setSnapModeBBox() and setSnapModeNode().
+ * paths, grids or guides), and or snapping to/from others (e.g. grids, guide, text, etc)
+ * To select either of these three modes (or all), use the
+ * methods defined below: setSnapModeBBox(), setSnapModeNode(), or setSnapModeOthers()
*
* */
@@ -68,11 +67,26 @@ bool Inkscape::SnapPreferences::getSnapModeNode() const
return (_snap_from & Inkscape::SNAPSOURCE_NODE_CATEGORY);
}
-bool Inkscape::SnapPreferences::getSnapModeBBoxOrNodes() const
+void Inkscape::SnapPreferences::setSnapModeOthers(bool enabled)
{
- return (_snap_from & (Inkscape::SNAPSOURCE_BBOX_CATEGORY | Inkscape::SNAPSOURCE_NODE_CATEGORY) );
+ if (enabled) {
+ _snap_from = SnapSourceType(_snap_from | Inkscape::SNAPSOURCE_OTHERS_CATEGORY);
+ } else {
+ _snap_from = SnapSourceType(_snap_from & ~Inkscape::SNAPSOURCE_OTHERS_CATEGORY);
+ }
}
+bool Inkscape::SnapPreferences::getSnapModeOthers() const
+{
+ return (_snap_from & Inkscape::SNAPSOURCE_OTHERS_CATEGORY);
+}
+
+
+//bool Inkscape::SnapPreferences::getSnapModeBBoxOrNodes() const
+//{
+// return (_snap_from & (Inkscape::SNAPSOURCE_BBOX_CATEGORY | Inkscape::SNAPSOURCE_NODE_CATEGORY) );
+//}
+
bool Inkscape::SnapPreferences::getSnapModeAny() const
{
return (_snap_from != 0);
@@ -81,15 +95,15 @@ bool Inkscape::SnapPreferences::getSnapModeAny() const
void Inkscape::SnapPreferences::setSnapModeGuide(bool enabled)
{
if (enabled) {
- _snap_from = SnapSourceType(_snap_from | Inkscape::SNAPSOURCE_OTHER_CATEGORY);
+ _snap_from = SnapSourceType(_snap_from | Inkscape::SNAPSOURCE_OTHERS_CATEGORY);
} else {
- _snap_from = SnapSourceType(_snap_from & ~Inkscape::SNAPSOURCE_OTHER_CATEGORY);
+ _snap_from = SnapSourceType(_snap_from & ~Inkscape::SNAPSOURCE_OTHERS_CATEGORY);
}
}
bool Inkscape::SnapPreferences::getSnapModeGuide() const
{
- return (_snap_from & Inkscape::SNAPSOURCE_OTHER_CATEGORY);
+ return (_snap_from & Inkscape::SNAPSOURCE_OTHERS_CATEGORY);
}
/**