summaryrefslogtreecommitdiffstats
path: root/src/snap-preferences.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2012-01-14 13:35:29 +0000
committerDiederik van Lierop <mail@diedenrezi.nl>2012-01-14 13:35:29 +0000
commit62ab3cc3fe08cee5968581360d1509a6b01ff9f1 (patch)
tree74e36cf0869c7fb8cc6ee457c353b09fcb96ead7 /src/snap-preferences.cpp
parentCleanup variable declarations in ruler, and a couple of GSEAL fixes. (diff)
downloadinkscape-62ab3cc3fe08cee5968581360d1509a6b01ff9f1.tar.gz
inkscape-62ab3cc3fe08cee5968581360d1509a6b01ff9f1.zip
Enable tangential and perpendicular snapping to paths (in the node-tool, pen-tool, pencil-tool, and for guide manipulation; cannot be toggled yet, will always be active when snapping to paths)
(bzr r10886)
Diffstat (limited to 'src/snap-preferences.cpp')
-rw-r--r--src/snap-preferences.cpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/snap-preferences.cpp b/src/snap-preferences.cpp
index f3df788c9..821073fb5 100644
--- a/src/snap-preferences.cpp
+++ b/src/snap-preferences.cpp
@@ -54,9 +54,28 @@ void Inkscape::SnapPreferences::_mapTargetToArrayIndex(Inkscape::SnapTargetType
if (target & SNAPTARGET_BBOX_CATEGORY) {
group_on = isTargetSnappable(SNAPTARGET_BBOX_CATEGORY); // Only if the group with bbox sources/targets has been enabled, then we might snap to any of the bbox targets
+ return;
+ }
- } else if (target & SNAPTARGET_NODE_CATEGORY) {
+ if (target & SNAPTARGET_NODE_CATEGORY) {
group_on = isTargetSnappable(SNAPTARGET_NODE_CATEGORY); // Only if the group with path/node sources/targets has been enabled, then we might snap to any of the nodes/paths
+ switch (target) {
+ case SNAPTARGET_RECT_CORNER:
+ target = SNAPTARGET_NODE_CUSP;
+ break;
+ case SNAPTARGET_ELLIPSE_QUADRANT_POINT:
+ target = SNAPTARGET_NODE_SMOOTH;
+ break;
+ case SNAPTARGET_PATH_GUIDE_INTERSECTION:
+ target = SNAPTARGET_PATH_INTERSECTION;
+ break;
+ case SNAPTARGET_PATH_PERPENDICULAR:
+ case SNAPTARGET_PATH_TANGENTIAL:
+ target = SNAPTARGET_PATH;
+ break;
+ default:
+ break;
+ }
if (target == SNAPTARGET_RECT_CORNER) {
target = SNAPTARGET_NODE_CUSP;
} else if (target == SNAPTARGET_ELLIPSE_QUADRANT_POINT) {
@@ -65,11 +84,14 @@ void Inkscape::SnapPreferences::_mapTargetToArrayIndex(Inkscape::SnapTargetType
target = SNAPTARGET_PATH_INTERSECTION;
}
- } else if (target & SNAPTARGET_DATUMS_CATEGORY) {
+ return;
+ }
+
+ if (target & SNAPTARGET_DATUMS_CATEGORY) {
group_on = true; // These snap targets cannot be disabled as part of a disabled group;
switch (target) {
// Some snap targets don't have their own toggle. These targets are called "secondary targets". We will re-map
- // them to their cousin which does have a toggle, and which is called a "primary target"case SNAPTARGET_GRID_INTERSECTION:
+ // them to their cousin which does have a toggle, and which is called a "primary target"
case SNAPTARGET_GRID_INTERSECTION:
target = SNAPTARGET_GRID;
break;
@@ -96,9 +118,10 @@ void Inkscape::SnapPreferences::_mapTargetToArrayIndex(Inkscape::SnapTargetType
g_warning("Snap-preferences warning: Undefined snap target (#%i)", target);
break;
}
+ return;
+ }
-
- } else if (target & SNAPTARGET_OTHERS_CATEGORY) {
+ if (target & SNAPTARGET_OTHERS_CATEGORY) {
// Only if the group with "other" snap sources/targets has been enabled, then we might snap to any of those targets
// ... but this doesn't hold for the page border, grids, and guides
group_on = isTargetSnappable(SNAPTARGET_OTHERS_CATEGORY);
@@ -129,9 +152,13 @@ void Inkscape::SnapPreferences::_mapTargetToArrayIndex(Inkscape::SnapTargetType
break;
}
+ return;
+ }
- } else if (target == SNAPTARGET_UNDEFINED ) {
+ if (target == SNAPTARGET_UNDEFINED ) {
g_warning("Snap-preferences warning: Undefined snaptarget (#%i)", target);
+ } else {
+ g_warning("Snap-preferences warning: Snaptarget not handled (#%i)", target);
}
}