From: Diederik van Lierop Date: Sat, 6 Feb 2010 14:59:28 +0000 (+0100) Subject: Tiny bit of refactoring (inverting some logic) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ba9d21c2fb778a31551d84eb855d3c35a229f9b7;p=inkscape.git Tiny bit of refactoring (inverting some logic) --- diff --git a/src/arc-context.cpp b/src/arc-context.cpp index ccaaedd14..799167a72 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -274,7 +274,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent gobble_motion_events(GDK_BUTTON1_MASK); ret = TRUE; - } else if (sp_event_context_knot_mouseover(ac)){ + } else if (!sp_event_context_knot_mouseover(ac)){ SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index bf9bd7b6f..5534aa410 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -387,7 +387,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven sp_box3d_drag(*bc, event->motion.state); ret = TRUE; - } else if (sp_event_context_knot_mouseover(bc)) { + } else if (!sp_event_context_knot_mouseover(bc)) { SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 294e129b3..b61c00df6 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -976,7 +976,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons /* This is perfectly valid */ break; default: - if (sp_event_context_knot_mouseover(cc)) { + if (!sp_event_context_knot_mouseover(cc)) { m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_OTHER_HANDLE)); } break; diff --git a/src/event-context.cpp b/src/event-context.cpp index 1e47b9d9d..77c10765b 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -744,10 +744,14 @@ gint sp_event_context_private_item_handler(SPEventContext *ec, SPItem *item, return ret; } +/** + * @brief: Returns true if we're hovering above a knot (needed because we don't want to pre-snap in that case) + */ + bool sp_event_context_knot_mouseover(SPEventContext *ec) { if (ec->shape_editor) { - return !(ec->shape_editor->knot_mouseover()); + return ec->shape_editor->knot_mouseover(); } return false; diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index b73d258fd..8bdfe2f7c 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -593,7 +593,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) ret = TRUE; } else { - if (sp_event_context_knot_mouseover(event_context)) { + if (!sp_event_context_knot_mouseover(event_context)) { SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); diff --git a/src/pen-context.cpp b/src/pen-context.cpp index 9cf4d5420..74c402c42 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -632,7 +632,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent) spdc_endpoint_snap(pc, p, mevent.state); spdc_pen_set_subsequent_point(pc, p, true); ret = TRUE; - } else if (sp_event_context_knot_mouseover(pc)) { + } else if (!sp_event_context_knot_mouseover(pc)) { SnapManager &m = dt->namedview->snap_manager; m.setup(dt); m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE)); @@ -681,7 +681,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent) pc->_message_context->clear(); pc->anchor_statusbar = false; } - if (sp_event_context_knot_mouseover(pc)) { + if (!sp_event_context_knot_mouseover(pc)) { SnapManager &m = dt->namedview->snap_manager; m.setup(dt); m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE)); @@ -707,7 +707,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent) /* This is perfectly valid */ break; default: - if (sp_event_context_knot_mouseover(pc)) { + if (!sp_event_context_knot_mouseover(pc)) { SnapManager &m = dt->namedview->snap_manager; m.setup(dt); m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE)); diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index 328c011ff..f18174457 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -364,10 +364,6 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev /* Create green anchor */ pc->green_anchor = sp_draw_anchor_new(pc, pc->green_curve, TRUE, pc->p[0]); } - /** \todo - * fixme: I am not sure whether we want to snap to anchors - * in middle of freehand (Lauris) - */ if (anchor) { p = anchor->dp; } @@ -395,7 +391,7 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev pc->_message_context->clear(); pc->anchor_statusbar = false; } - if (sp_event_context_knot_mouseover(pc)) { + if (!sp_event_context_knot_mouseover(pc)) { SnapManager &m = dt->namedview->snap_manager; m.setup(dt); m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE)); diff --git a/src/rect-context.cpp b/src/rect-context.cpp index 9eab188dd..a3c3ab0b5 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -317,7 +317,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent sp_rect_drag(*rc, motion_dt, event->motion.state); // this will also handle the snapping gobble_motion_events(GDK_BUTTON1_MASK); ret = TRUE; - } else if (sp_event_context_knot_mouseover(rc)) { + } else if (!sp_event_context_knot_mouseover(rc)) { SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index f8a4bddfb..7ce9d4710 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -277,7 +277,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) gobble_motion_events(GDK_BUTTON1_MASK); ret = TRUE; - } else if (sp_event_context_knot_mouseover(sc)) { + } else if (!sp_event_context_knot_mouseover(sc)) { SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); diff --git a/src/star-context.cpp b/src/star-context.cpp index 693d51888..4d5d9780c 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -291,7 +291,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent gobble_motion_events(GDK_BUTTON1_MASK); ret = TRUE; - } else if (sp_event_context_knot_mouseover(event_context)) { + } else if (!sp_event_context_knot_mouseover(event_context)) { SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop);