From bdf703831ff93438d49324ab842052ccaf390a5d Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 26 Jun 2011 22:00:36 +0200 Subject: =?UTF-8?q?-=20Add=20a=20third=20group=20of=20snap=20sources/targe?= =?UTF-8?q?ts,=20called=20=C2=A8others=C2=A8=20(before=20we=20had=20only?= =?UTF-8?q?=20=C2=A8bounding=20box=C2=A8=20and=20nodes=20(see=20bug=20#788?= =?UTF-8?q?178)=20-=20Fix=20the=20display=20of=20the=20snap=20source=20-?= =?UTF-8?q?=20Fix=20snapping=20of=20guides=20to=20other=20guides=20&=20gri?= =?UTF-8?q?ds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r10372) --- src/snap-preferences.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/snap-preferences.cpp') diff --git a/src/snap-preferences.cpp b/src/snap-preferences.cpp index 15c976466..816320145 100644 --- a/src/snap-preferences.cpp +++ b/src/snap-preferences.cpp @@ -27,7 +27,7 @@ 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 } /* @@ -68,11 +68,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 +96,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); } /** -- cgit v1.2.3 From 8911d9a8ca0c7f4ef1476b2f056adf2afa4e99cd Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Thu, 30 Jun 2011 22:46:15 +0200 Subject: Implement decent snapping to text (baseline & anchor), and provide a toggle button for this (as requested in LP bug #727281 ) (bzr r10392) --- src/snap-preferences.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/snap-preferences.cpp') diff --git a/src/snap-preferences.cpp b/src/snap-preferences.cpp index 816320145..fba9beb43 100644 --- a/src/snap-preferences.cpp +++ b/src/snap-preferences.cpp @@ -32,10 +32,11 @@ Inkscape::SnapPreferences::SnapPreferences() : /* * 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() * * */ -- cgit v1.2.3 From 3f65497cec234309706ed240a8986f48cdf1a8b7 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 1 Jul 2011 23:26:50 -0700 Subject: Removed outdated and undesired "I'm in this cpp, so change your behavior" macros. (bzr r10400) --- src/snap-preferences.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/snap-preferences.cpp') diff --git a/src/snap-preferences.cpp b/src/snap-preferences.cpp index fba9beb43..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 -- cgit v1.2.3