diff options
| author | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-01-30 22:04:33 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-01-30 22:04:33 +0000 |
| commit | e52fb9fac3f1bbd924c0ca3b6b5e214a095d44af (patch) | |
| tree | 05abc6241c288c5adf39733b914059e393f2fc75 /src/arc-context.cpp | |
| parent | Really fix btool build. (diff) | |
| download | inkscape-e52fb9fac3f1bbd924c0ca3b6b5e214a095d44af.tar.gz inkscape-e52fb9fac3f1bbd924c0ca3b6b5e214a095d44af.zip | |
Finally introducing the pre-snap indicator
(bzr r9034)
Diffstat (limited to 'src/arc-context.cpp')
| -rw-r--r-- | src/arc-context.cpp | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/src/arc-context.cpp b/src/arc-context.cpp index 9cb6e8222..ccaaedd14 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -116,15 +116,15 @@ static void sp_arc_context_init(SPArcContext *arc_context) static void sp_arc_context_finish(SPEventContext *ec) { SPArcContext *ac = SP_ARC_CONTEXT(ec); - SPDesktop *desktop = ec->desktop; + SPDesktop *desktop = ec->desktop; - sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); - sp_arc_finish(ac); + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_arc_finish(ac); ac->sel_changed_connection.disconnect(); if (((SPEventContextClass *) parent_class)->finish) { - ((SPEventContextClass *) parent_class)->finish(ec); - } + ((SPEventContextClass *) parent_class)->finish(ec); + } } static void sp_arc_context_dispose(GObject *object) @@ -274,6 +274,13 @@ 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)){ + 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: @@ -283,7 +290,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the arc - sp_arc_finish(ac); + sp_arc_finish(ac); } else if (event_context->item_to_select) { // no dragging, select clicked item if any if (event->button.state & GDK_SHIFT_MASK) { @@ -335,14 +342,14 @@ static gint sp_arc_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_arc_cancel(ac); - 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_arc_cancel(ac); + ret = TRUE; + } + break; case GDK_space: if (dragging) { sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), @@ -480,13 +487,13 @@ static void sp_arc_finish(SPArcContext *ac) if (ac->item != NULL) { - SPGenericEllipse *ge = SP_GENERICELLIPSE(SP_ARC(ac->item)); - if (ge->rx.computed == 0 || ge->ry.computed == 0) { - sp_arc_cancel(ac); // Don't allow the creating of zero sized arc, for example when the start and and point snap to the snap grid point - return; - } + SPGenericEllipse *ge = SP_GENERICELLIPSE(SP_ARC(ac->item)); + if (ge->rx.computed == 0 || ge->ry.computed == 0) { + sp_arc_cancel(ac); // Don't allow the creating of zero sized arc, for example when the start and and point snap to the snap grid point + return; + } - SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop; + SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop; SP_OBJECT(ac->item)->updateRepr(); @@ -502,14 +509,14 @@ static void sp_arc_finish(SPArcContext *ac) static void sp_arc_cancel(SPArcContext *ac) { - SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop; + SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->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 (ac->item != NULL) { - SP_OBJECT(ac->item)->deleteObject(); - ac->item = NULL; + SP_OBJECT(ac->item)->deleteObject(); + ac->item = NULL; } ac->within_tolerance = false; |
