From 50656054cfff930f05d3ea734e56b8c31a99fcc3 Mon Sep 17 00:00:00 2001 From: johncoswell Date: Sun, 24 Sep 2006 22:24:25 +0000 Subject: [PATCH] Added forced redraws to other tools --- src/arc-context.cpp | 4 ++++ src/pen-context.cpp | 9 +++++---- src/rect-context.cpp | 12 ++++++++---- src/rubberband.cpp | 3 +++ src/select-context.cpp | 17 ++++++++++++++++- src/spiral-context.cpp | 4 ++++ src/star-context.cpp | 4 ++++ 7 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src/arc-context.cpp b/src/arc-context.cpp index 0b0aad79e..934995b0a 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -408,6 +408,8 @@ static void sp_arc_drag(SPArcContext *ac, NR::Point pt, guint state) Inkscape::GC::release(repr); ac->item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer()); ac->item->updateRepr(); + + sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5); } NR::Rect const r = Inkscape::snap_rectangular_box(desktop, ac->item, pt, ac->center, state); @@ -432,6 +434,8 @@ static void sp_arc_finish(SPArcContext *ac) SP_OBJECT(ac->item)->updateRepr(); + sp_canvas_end_forced_full_redraws(desktop->canvas); + sp_desktop_selection(desktop)->set(ac->item); sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, _("Create ellipse")); diff --git a/src/pen-context.cpp b/src/pen-context.cpp index 96140a06c..ab933fbbf 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -227,7 +227,7 @@ pen_cancel (SPPenContext *const pc) pc->_message_context->clear(); pc->_message_context->flash(Inkscape::NORMAL_MESSAGE, _("Drawing cancelled")); - //sp_canvas_clear_forced_full_redraws(pc->desktop->canvas); + sp_canvas_end_forced_full_redraws(pc->desktop->canvas); } /** @@ -1028,6 +1028,8 @@ spdc_pen_set_initial_point(SPPenContext *const pc, NR::Point const p) pc->p[1] = p; pc->npoints = 2; sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL); + + sp_canvas_force_full_redraw_after_interruptions(pc->desktop->canvas, 5); } static void @@ -1036,8 +1038,6 @@ spdc_pen_set_subsequent_point(SPPenContext *const pc, NR::Point const p, bool st g_assert( pc->npoints != 0 ); /* todo: Check callers to see whether 2 <= npoints is guaranteed. */ - //sp_canvas_force_full_redraws(pc->desktop->canvas, 4); - pc->p[2] = p; pc->p[3] = p; pc->p[4] = p; @@ -1175,7 +1175,8 @@ spdc_pen_finish(SPPenContext *const pc, gboolean const closed) pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor); } - //sp_canvas_clear_forced_full_redraws(desktop->canvas); + + sp_canvas_end_forced_full_redraws(pc->desktop->canvas); pen_enable_events(pc); } diff --git a/src/rect-context.cpp b/src/rect-context.cpp index b03cdeead..f14946463 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -451,6 +451,8 @@ static void sp_rect_drag(SPRectContext &rc, NR::Point const pt, guint state) Inkscape::GC::release(repr); rc.item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer()); rc.item->updateRepr(); + + sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5); } NR::Rect const r = Inkscape::snap_rectangular_box(desktop, rc.item, pt, rc.center, state); @@ -479,14 +481,16 @@ static void sp_rect_finish(SPRectContext *rc) rc->_message_context->clear(); if ( rc->item != NULL ) { - SPDesktop * dt; + SPDesktop * desktop; - dt = SP_EVENT_CONTEXT_DESKTOP(rc); + desktop = SP_EVENT_CONTEXT_DESKTOP(rc); SP_OBJECT(rc->item)->updateRepr(); - sp_desktop_selection(dt)->set(rc->item); - sp_document_done(sp_desktop_document(dt), SP_VERB_CONTEXT_RECT, + sp_canvas_end_forced_full_redraws(desktop->canvas); + + sp_desktop_selection(desktop)->set(rc->item); + sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_RECT, _("Create rectangle")); rc->item = NULL; diff --git a/src/rubberband.cpp b/src/rubberband.cpp index cc0e70a74..b6211c519 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -31,6 +31,8 @@ void Inkscape::Rubberband::start(SPDesktop *d, NR::Point const &p) stop(); _desktop = d; _start = p; + + sp_canvas_force_full_redraw_after_interruptions(_desktop->canvas, 5); } void Inkscape::Rubberband::stop() @@ -38,6 +40,7 @@ void Inkscape::Rubberband::stop() if (_canvas) { gtk_object_destroy((GtkObject *) _canvas); _canvas = NULL; + sp_canvas_end_forced_full_redraws(_desktop->canvas); } } diff --git a/src/select-context.cpp b/src/select-context.cpp index 7efd013ec..c527471f5 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -318,6 +318,8 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE sc->dragging = TRUE; sc->moved = FALSE; + sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5); + // remember the clicked item in sc->item: sc->item = sp_event_context_find_item (desktop, NR::Point(event->button.x, event->button.y), event->button.state & GDK_MOD1_MASK, FALSE); @@ -331,6 +333,8 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE NULL, event->button.time); sc->grabbed = SP_CANVAS_ITEM(desktop->drawing); + sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5); + ret = TRUE; } } else if (event->button.button == 3) { @@ -403,6 +407,8 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) desktop->setCurrentLayer(reinterpret_cast(clicked_item)); sp_desktop_selection(desktop)->clear(); sc->dragging = false; + + sp_canvas_end_forced_full_redraws(desktop->canvas); } else { // switch tool tools_switch_by_item (desktop, clicked_item); } @@ -459,9 +465,13 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) // motion notify coordinates as given (no snapping back to origin) within_tolerance = false; - if (sc->button_press_ctrl || sc->button_press_alt) // if ctrl or alt was pressed and it's not click, we want to drag rather than rubberband + if (sc->button_press_ctrl || sc->button_press_alt) { + // if ctrl or alt was pressed and it's not click, we want to drag rather than rubberband sc->dragging = TRUE; + sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5); + } + if (sc->dragging) { /* User has dragged fast, so we get events on root (lauris)*/ // not only that; we will end up here when ctrl-dragging as well @@ -498,6 +508,8 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) ret = TRUE; } else { sc->dragging = FALSE; + + sp_canvas_end_forced_full_redraws(desktop->canvas); } } else { Inkscape::Rubberband::get()->move(p); @@ -535,6 +547,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) } } sc->dragging = FALSE; + + sp_canvas_end_forced_full_redraws(desktop->canvas); + if (sc->item) { sp_object_unref( SP_OBJECT(sc->item), NULL); } diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index 1dc6bd6cb..348cd8811 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -412,6 +412,8 @@ sp_spiral_drag(SPSpiralContext *sc, NR::Point p, guint state) Inkscape::GC::release(repr); sc->item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer()); sc->item->updateRepr(); + + sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5); } NR::Point const p0 = sp_desktop_dt2root_xy_point(desktop, sc->center); @@ -457,6 +459,8 @@ sp_spiral_finish(SPSpiralContext *sc) sp_shape_set_shape(SP_SHAPE(spiral)); SP_OBJECT(spiral)->updateRepr(NULL, SP_OBJECT_WRITE_EXT); + sp_canvas_end_forced_full_redraws(desktop->canvas); + sp_desktop_selection(desktop)->set(sc->item); sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_SPIRAL, /* TODO: annotate */ "spiral-context.cpp:462"); diff --git a/src/star-context.cpp b/src/star-context.cpp index 74b252860..3147dd213 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -421,6 +421,8 @@ static void sp_star_drag(SPStarContext *sc, NR::Point p, guint state) Inkscape::GC::release(repr); sc->item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer()); sc->item->updateRepr(); + + sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5); } NR::Point const p0 = sp_desktop_dt2root_xy_point(desktop, sc->center); @@ -469,6 +471,8 @@ sp_star_finish (SPStarContext * sc) object->updateRepr(NULL, SP_OBJECT_WRITE_EXT); + sp_canvas_end_forced_full_redraws(desktop->canvas); + sp_desktop_selection(desktop)->set(sc->item); sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR, /* TODO: annotate */ "star-context.cpp:474"); -- 2.30.2