From c4aa590bedcf358acf15bdf0d8134ae99e3be167 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 23 Jan 2010 14:36:56 +0100 Subject: Remove redundancy from snapping API (type of snapsource no longer has to be specified explicitly) (bzr r9014) --- src/rect-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rect-context.cpp') diff --git a/src/rect-context.cpp b/src/rect-context.cpp index b88b4b83a..dcc1f0aa1 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -283,7 +283,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent /* Snap center */ SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); - m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, button_dt, Inkscape::SNAPSOURCE_HANDLE); + m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); rc->center = from_2geom(button_dt); sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), -- cgit v1.2.3 From e52fb9fac3f1bbd924c0ca3b6b5e214a095d44af Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 30 Jan 2010 23:04:33 +0100 Subject: Finally introducing the pre-snap indicator (bzr r9034) --- src/rect-context.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/rect-context.cpp') diff --git a/src/rect-context.cpp b/src/rect-context.cpp index dcc1f0aa1..9eab188dd 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -317,6 +317,13 @@ 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)) { + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop); + + Geom::Point const motion_w(event->motion.x, event->motion.y); + Geom::Point motion_dt(desktop->w2d(motion_w)); + m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE)); } break; case GDK_BUTTON_RELEASE: -- cgit v1.2.3 From 195208c56145d9b9673aff0bb2f8795f5bc6fe22 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 6 Feb 2010 15:59:28 +0100 Subject: Tiny bit of refactoring (inverting some logic) (bzr r9059) --- src/rect-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rect-context.cpp') 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); -- cgit v1.2.3 From 611c78a2a2a89141435de1581b1a9b82780afe69 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 14 Feb 2010 09:18:22 +0100 Subject: Implementation of snap delay mechanism for guides (bzr r9088) --- src/rect-context.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/rect-context.cpp') diff --git a/src/rect-context.cpp b/src/rect-context.cpp index a3c3ab0b5..7ae27c13d 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -122,15 +122,15 @@ static void sp_rect_context_init(SPRectContext *rect_context) static void sp_rect_context_finish(SPEventContext *ec) { SPRectContext *rc = SP_RECT_CONTEXT(ec); - SPDesktop *desktop = ec->desktop; + SPDesktop *desktop = ec->desktop; - sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); - sp_rect_finish(rc); + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_rect_finish(rc); rc->sel_changed_connection.disconnect(); if (((SPEventContextClass *) parent_class)->finish) { - ((SPEventContextClass *) parent_class)->finish(ec); - } + ((SPEventContextClass *) parent_class)->finish(ec); + } } @@ -396,14 +396,14 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent break; case GDK_Escape: - if (dragging) { - dragging = false; - sp_event_context_discard_delayed_snap_event(event_context); - // if drawing, cancel, otherwise pass it up for deselecting - sp_rect_cancel(rc); - ret = TRUE; - } - break; + if (dragging) { + dragging = false; + sp_event_context_discard_delayed_snap_event(event_context); + // if drawing, cancel, otherwise pass it up for deselecting + sp_rect_cancel(rc); + ret = TRUE; + } + break; case GDK_space: if (dragging) { @@ -534,8 +534,8 @@ static void sp_rect_finish(SPRectContext *rc) if ( rc->item != NULL ) { SPRect *rect = SP_RECT(rc->item); if (rect->width.computed == 0 || rect->height.computed == 0) { - sp_rect_cancel(rc); // Don't allow the creating of zero sized rectangle, for example when the start and and point snap to the snap grid point - return; + sp_rect_cancel(rc); // Don't allow the creating of zero sized rectangle, for example when the start and and point snap to the snap grid point + return; } SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(rc); @@ -554,14 +554,14 @@ static void sp_rect_finish(SPRectContext *rc) static void sp_rect_cancel(SPRectContext *rc) { - SPDesktop *desktop = SP_EVENT_CONTEXT(rc)->desktop; + SPDesktop *desktop = SP_EVENT_CONTEXT(rc)->desktop; - sp_desktop_selection(desktop)->clear(); - sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0); + sp_desktop_selection(desktop)->clear(); + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0); if (rc->item != NULL) { - SP_OBJECT(rc->item)->deleteObject(); - rc->item = NULL; + SP_OBJECT(rc->item)->deleteObject(); + rc->item = NULL; } rc->within_tolerance = false; -- cgit v1.2.3