From eae8322c8b968bbf076323eb68707124bfc810d9 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 18 Jul 2009 12:56:25 +0000 Subject: Make the snap delay mechanism easier to implement for the devs, and get rid of the related warning messages (bzr r8302) --- src/arc-context.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/arc-context.cpp') diff --git a/src/arc-context.cpp b/src/arc-context.cpp index d47e22b1a..dcb326bcd 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -223,7 +223,6 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent if (event->button.button == 1 && !event_context->space_panning) { dragging = true; - sp_event_context_snap_window_open(event_context); ac->center = Inkscape::setup_for_drag_start(desktop, event_context, event); /* Snap center */ @@ -267,7 +266,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent event_context->xp = event_context->yp = 0; if (event->button.button == 1 && !event_context->space_panning) { dragging = false; - sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings + 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); @@ -324,7 +323,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent case GDK_Escape: if (dragging) { dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); // if drawing, cancel, otherwise pass it up for deselecting sp_arc_cancel(ac); ret = TRUE; @@ -335,7 +334,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); dragging = false; - sp_event_context_snap_window_closed(event_context); + 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); -- cgit v1.2.3 From 1619e274a9d9193fbd6df1b7817beaa96d030e6a Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 1 Aug 2009 12:29:37 +0000 Subject: 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 (bzr r8375) --- src/arc-context.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/arc-context.cpp') 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); -- cgit v1.2.3 From e8b5612f8dbe3cefaf56469320fa12bea9713a1b Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 18:32:38 +0000 Subject: xml/Document -> DocumentTree (bzr r8417) --- src/arc-context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/arc-context.cpp') diff --git a/src/arc-context.cpp b/src/arc-context.cpp index e689c93db..835e43a26 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -25,6 +25,7 @@ #include "display/sp-canvas.h" #include "sp-ellipse.h" #include "document.h" +#include "xml/document.h" #include "sp-namedview.h" #include "selection.h" #include "desktop-handles.h" @@ -403,7 +404,7 @@ static void sp_arc_drag(SPArcContext *ac, Geom::Point pt, guint state) } /* Create object */ - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc()); + Inkscape::XML::DocumentTree *xml_doc = sp_document_repr_doc(desktop->doc()); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); repr->setAttribute("sodipodi:type", "arc"); -- cgit v1.2.3 From 51c2905fd3e99955db2d823b79abb763d8097028 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Thu, 6 Aug 2009 14:17:17 +0000 Subject: Revert recent refactoring changes by johnce because they break the build, which cannot be fixed easily. (bzr r8422) --- src/arc-context.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/arc-context.cpp') diff --git a/src/arc-context.cpp b/src/arc-context.cpp index 835e43a26..e689c93db 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -25,7 +25,6 @@ #include "display/sp-canvas.h" #include "sp-ellipse.h" #include "document.h" -#include "xml/document.h" #include "sp-namedview.h" #include "selection.h" #include "desktop-handles.h" @@ -404,7 +403,7 @@ static void sp_arc_drag(SPArcContext *ac, Geom::Point pt, guint state) } /* Create object */ - Inkscape::XML::DocumentTree *xml_doc = sp_document_repr_doc(desktop->doc()); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc()); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); repr->setAttribute("sodipodi:type", "arc"); -- cgit v1.2.3