Code

Tiny bit of refactoring (inverting some logic)
authorDiederik van Lierop <mailat-signdiedenrezidotnl>
Sat, 6 Feb 2010 14:59:28 +0000 (15:59 +0100)
committerDiederik van Lierop <mailat-signdiedenrezidotnl>
Sat, 6 Feb 2010 14:59:28 +0000 (15:59 +0100)
src/arc-context.cpp
src/box3d-context.cpp
src/connector-context.cpp
src/event-context.cpp
src/gradient-context.cpp
src/pen-context.cpp
src/pencil-context.cpp
src/rect-context.cpp
src/spiral-context.cpp
src/star-context.cpp

index ccaaedd14e6d6f5be8e24d37a462400c882673a2..799167a72a156528d79b5536a604c9d3bb8c75aa 100644 (file)
@@ -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);
 
index bf9bd7b6faa49bf97c017d08b161de8f12a2a62b..5534aa4109187b45df4c6d2ae009b06b9d1f171d 100644 (file)
@@ -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);
 
index 294e129b3f4e40bdda229aeedd30fd44d9bbb9f8..b61c00df6a9a15968c82be0f0ee46f745f35ddee 100644 (file)
@@ -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;
index 1e47b9d9da4be0790ec4094543c7138eca6f8a2a..77c10765bdb37e014c4a29a5f784024bfe1a48f7 100644 (file)
@@ -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;
index b73d258fdddfb31d1216cdd3a8b6eae2aa45891c..8bdfe2f7c9cb6281d5aa4873c66452b55ec6972d 100644 (file)
@@ -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);
 
index 9cf4d5420ef10ad905cce0210c6206beb3183224..74c402c425284d823c2e83b8ac1b7784311dec04 100644 (file)
@@ -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));
index 328c011ff9fb24b4d4dfccff7bdfce0b3b72251a..f181744577a10f620378e618bb25da7186ca4270 100644 (file)
@@ -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));
index 9eab188ddea51a9a1ee0f87327be2bdb4ab8d600..a3c3ab0b5a048cab4203b639a457280d474b781e 100644 (file)
@@ -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);
 
index f8a4bddfb8c4f0b81f2ab322e363f6a95b15482a..7ce9d47107a24c4bcd367195d98316aabe457f14 100644 (file)
@@ -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);
 
index 693d5188860d9c07eaeb10619dcbf41a80dbbd93..4d5d9780cbe3cec6693c5495c518817a6c2c1cb5 100644 (file)
@@ -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);