summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1a53822)
raw | patch | inline | side by side (parent: 1a53822)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Mon, 4 Aug 2008 21:09:10 +0000 (21:09 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Mon, 4 Aug 2008 21:09:10 +0000 (21:09 +0000) |
src/draw-context.cpp | patch | blob | history | |
src/pen-context.cpp | patch | blob | history | |
src/pencil-context.cpp | patch | blob | history |
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index a127df87752c1f26bfb92d745f72634426162db5..2d02677577a7a7d91c17173800d007ed75d6e6dc 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
void spdc_endpoint_snap_rotation(SPEventContext const *const ec, NR::Point &p, NR::Point const o,
guint state)
{
- /* Control must be down for this snap to work */
- if ((state & GDK_CONTROL_MASK) == 0) {
- return;
- }
-
unsigned const snaps = abs(prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12));
/* 0 means no snapping. */
@@ -480,21 +475,20 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, NR::Point &p, N
if (fabs(bdot) > 0) {
p = o + bdot * best;
- /* Snap it along best vector */
- SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager;
- m.setup(SP_EVENT_CONTEXT_DESKTOP(ec), NULL);
- m.constrainedSnapReturnByRef( Inkscape::Snapper::SNAPPOINT_NODE, p, Inkscape::Snapper::ConstraintLine(best));
+ if (!(state & GDK_SHIFT_MASK)) { //SHIFT disables all snapping, except the angular snapping above
+ //After all, the user explicitely asked for angular snapping by
+ //pressing CTRL
+ /* Snap it along best vector */
+ SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager;
+ m.setup(SP_EVENT_CONTEXT_DESKTOP(ec), NULL);
+ m.constrainedSnapReturnByRef( Inkscape::Snapper::SNAPPOINT_NODE, p, Inkscape::Snapper::ConstraintLine(best));
+ }
}
}
-void spdc_endpoint_snap_free(SPEventContext const * const ec, NR::Point& p, guint const state)
+void spdc_endpoint_snap_free(SPEventContext const * const ec, NR::Point& p, guint const /*state*/)
{
- /* Shift disables this snap */
- if (state & GDK_SHIFT_MASK) {
- return;
- }
-
SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager;
m.setup(SP_EVENT_CONTEXT_DESKTOP(ec), NULL);
m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p);
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 1c9b30dc3b1877b10c88166cf9aa394b9356c38b..4fb7fbc99a2c4f31e9472688dd01e3926769c499 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
static void
spdc_endpoint_snap(SPPenContext const *const pc, NR::Point &p, guint const state)
{
- if (pc->npoints > 0) {
- spdc_endpoint_snap_rotation(pc, p, pc->p[0], state);
+
+ if ((state & GDK_CONTROL_MASK)) { //CTRL enables angular snapping
+ if (pc->npoints > 0) {
+ spdc_endpoint_snap_rotation(pc, p, pc->p[0], state);
+ }
+ } else {
+ if (!(state & GDK_SHIFT_MASK)) { //SHIFT disables all snapping, except the angular snapping above
+ //After all, the user explicitely asked for angular snapping by
+ //pressing CTRL
+ spdc_endpoint_snap_free(pc, p, state);
+ }
}
-
- spdc_endpoint_snap_free(pc, p, state);
}
/**
@@ -292,8 +299,13 @@ spdc_endpoint_snap_handle(SPPenContext const *const pc, NR::Point &p, guint cons
g_return_if_fail(( pc->npoints == 2 ||
pc->npoints == 5 ));
- spdc_endpoint_snap_rotation(pc, p, pc->p[pc->npoints - 2], state);
- spdc_endpoint_snap_free(pc, p, state);
+ if ((state & GDK_CONTROL_MASK)) { //CTRL enables angular snapping
+ spdc_endpoint_snap_rotation(pc, p, pc->p[pc->npoints - 2], state);
+ } else {
+ if (!(state & GDK_SHIFT_MASK)) { //SHIFT disables all snapping, except the angular snapping above
+ spdc_endpoint_snap_free(pc, p, state);
+ }
+ }
}
static gint
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 0a5bc74443e6a46ea533f7022589ff087b745248..894b5cd71878f986f131359ed36c02f76e571540 100644 (file)
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
static void
spdc_endpoint_snap(SPPencilContext const *pc, NR::Point &p, guint const state)
{
- spdc_endpoint_snap_rotation(pc, p, pc->p[0], state);
- spdc_endpoint_snap_free(pc, p, state);
+ if ((state & GDK_CONTROL_MASK)) { //CTRL enables constrained snapping
+ spdc_endpoint_snap_rotation(pc, p, pc->p[0], state);
+ } else {
+ if (!(state & GDK_SHIFT_MASK)) { //SHIFT disables all snapping, except the angular snapping above
+ //After all, the user explicitely asked for angular snapping by
+ //pressing CTRL
+ spdc_endpoint_snap_free(pc, p, state);
+ }
+ }
}
/**