From: dvlierop2 Date: Sat, 1 Aug 2009 12:29:37 +0000 (+0000) Subject: When switching context by pressing a key, while dragging to create a new shape, the... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a7c592d421a63ced285b65869e7b16b3dee0fd87;p=inkscape.git When switching context by pressing a key, while dragging to create a new shape, the original context should be finished properly and sp_canvas_item_ungrab should be called. set_event_context() was looking for e.g. sp_rect_context_finish, but this wasn't implemented for any of the shape tools. This closes bug #195101 --- diff --git a/src/arc-context.cpp b/src/arc-context.cpp index dcb326bcd..e689c93db 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -50,6 +50,7 @@ static void sp_arc_context_init(SPArcContext *arc_context); static void sp_arc_context_dispose(GObject *object); static void sp_arc_context_setup(SPEventContext *ec); +static void sp_arc_context_finish(SPEventContext *ec); static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent *event); static gint sp_arc_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event); @@ -89,6 +90,7 @@ static void sp_arc_context_class_init(SPArcContextClass *klass) object_class->dispose = sp_arc_context_dispose; event_context_class->setup = sp_arc_context_setup; + event_context_class->finish = sp_arc_context_finish; event_context_class->root_handler = sp_arc_context_root_handler; event_context_class->item_handler = sp_arc_context_item_handler; } @@ -111,6 +113,20 @@ static void sp_arc_context_init(SPArcContext *arc_context) new (&arc_context->sel_changed_connection) sigc::connection(); } +static void sp_arc_context_finish(SPEventContext *ec) +{ + SPArcContext *ac = SP_ARC_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + 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); + } +} + static void sp_arc_context_dispose(GObject *object) { SPEventContext *ec = SP_EVENT_CONTEXT(object); diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index fd72e406b..128b5f2ff 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -54,6 +54,7 @@ static void sp_box3d_context_init(Box3DContext *box3d_context); static void sp_box3d_context_dispose(GObject *object); static void sp_box3d_context_setup(SPEventContext *ec); +static void sp_box3d_context_finish(SPEventContext *ec); static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEvent *event); static gint sp_box3d_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event); @@ -92,6 +93,7 @@ static void sp_box3d_context_class_init(Box3DContextClass *klass) object_class->dispose = sp_box3d_context_dispose; event_context_class->setup = sp_box3d_context_setup; + event_context_class->finish = sp_box3d_context_finish; event_context_class->root_handler = sp_box3d_context_root_handler; event_context_class->item_handler = sp_box3d_context_item_handler; } @@ -119,6 +121,21 @@ static void sp_box3d_context_init(Box3DContext *box3d_context) new (&box3d_context->sel_changed_connection) sigc::connection(); } +static void sp_box3d_context_finish(SPEventContext *ec) +{ + Box3DContext *bc = SP_BOX3D_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_box3d_finish(bc); + bc->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + + static void sp_box3d_context_dispose(GObject *object) { Box3DContext *bc = SP_BOX3D_CONTEXT(object); diff --git a/src/rect-context.cpp b/src/rect-context.cpp index ef5881378..b88b4b83a 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -50,6 +50,7 @@ static void sp_rect_context_init(SPRectContext *rect_context); static void sp_rect_context_dispose(GObject *object); static void sp_rect_context_setup(SPEventContext *ec); +static void sp_rect_context_finish(SPEventContext *ec); static void sp_rect_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val); static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent *event); @@ -91,6 +92,7 @@ static void sp_rect_context_class_init(SPRectContextClass *klass) object_class->dispose = sp_rect_context_dispose; event_context_class->setup = sp_rect_context_setup; + event_context_class->finish = sp_rect_context_finish; event_context_class->set = sp_rect_context_set; event_context_class->root_handler = sp_rect_context_root_handler; event_context_class->item_handler = sp_rect_context_item_handler; @@ -117,6 +119,21 @@ static void sp_rect_context_init(SPRectContext *rect_context) new (&rect_context->sel_changed_connection) sigc::connection(); } +static void sp_rect_context_finish(SPEventContext *ec) +{ + SPRectContext *rc = SP_RECT_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + 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); + } +} + + static void sp_rect_context_dispose(GObject *object) { SPRectContext *rc = SP_RECT_CONTEXT(object); diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index 5c7c43c83..3825f74c7 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -46,6 +46,7 @@ static void sp_spiral_context_class_init(SPSpiralContextClass * klass); static void sp_spiral_context_init(SPSpiralContext *spiral_context); static void sp_spiral_context_dispose(GObject *object); static void sp_spiral_context_setup(SPEventContext *ec); +static void sp_spiral_context_finish(SPEventContext *ec); static void sp_spiral_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val); static gint sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event); @@ -87,6 +88,7 @@ sp_spiral_context_class_init(SPSpiralContextClass *klass) object_class->dispose = sp_spiral_context_dispose; event_context_class->setup = sp_spiral_context_setup; + event_context_class->finish = sp_spiral_context_finish; event_context_class->set = sp_spiral_context_set; event_context_class->root_handler = sp_spiral_context_root_handler; } @@ -114,6 +116,20 @@ sp_spiral_context_init(SPSpiralContext *spiral_context) new (&spiral_context->sel_changed_connection) sigc::connection(); } +static void sp_spiral_context_finish(SPEventContext *ec) +{ + SPSpiralContext *sc = SP_SPIRAL_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_spiral_finish(sc); + sc->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + static void sp_spiral_context_dispose(GObject *object) { diff --git a/src/star-context.cpp b/src/star-context.cpp index 80d378f27..3d6825e31 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -52,6 +52,7 @@ static void sp_star_context_init (SPStarContext * star_context); static void sp_star_context_dispose (GObject *object); static void sp_star_context_setup (SPEventContext *ec); +static void sp_star_context_finish(SPEventContext *ec); static void sp_star_context_set (SPEventContext *ec, Inkscape::Preferences::Entry *val); static gint sp_star_context_root_handler (SPEventContext *ec, GdkEvent *event); @@ -92,6 +93,7 @@ sp_star_context_class_init (SPStarContextClass * klass) object_class->dispose = sp_star_context_dispose; event_context_class->setup = sp_star_context_setup; + event_context_class->finish = sp_star_context_finish; event_context_class->set = sp_star_context_set; event_context_class->root_handler = sp_star_context_root_handler; } @@ -119,6 +121,21 @@ sp_star_context_init (SPStarContext * star_context) new (&star_context->sel_changed_connection) sigc::connection(); } +static void sp_star_context_finish(SPEventContext *ec) +{ + SPStarContext *sc = SP_STAR_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_star_finish(sc); + sc->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + + static void sp_star_context_dispose (GObject *object) {