Code

Added forced redraws to other tools
authorjohncoswell <johncoswell@users.sourceforge.net>
Sun, 24 Sep 2006 22:24:25 +0000 (22:24 +0000)
committerjohncoswell <johncoswell@users.sourceforge.net>
Sun, 24 Sep 2006 22:24:25 +0000 (22:24 +0000)
src/arc-context.cpp
src/pen-context.cpp
src/rect-context.cpp
src/rubberband.cpp
src/select-context.cpp
src/spiral-context.cpp
src/star-context.cpp

index 0b0aad79e563890d2fcea8120b8a992e920f0593..934995b0a4fc6a0977dab22dafd2e7df102fd77d 100644 (file)
@@ -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"));
index 96140a06cd2b7c2cd0f3d4ed181d742c826fcafb..ab933fbbf7aea7024fee6a4c1b76735e91451e9a 100644 (file)
@@ -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);
 }
index b03cdeead7c08dc5aee4bd0a3be52900a8587bfc..f1494646341f08b87dba252a36bb5bf943f7b77e 100644 (file)
@@ -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;
index cc0e70a7444c564dc72cacd8e58f3288b33ead26..b6211c519bafcc1c85517b45ce09470c24f8f872 100644 (file)
@@ -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);
     }
 }
 
index 7efd013ec99edeecc6b68b9eaf8d463a2853dfba..c527471f5a22c093da8c24bce6f9cbb5b95a1a2c 100644 (file)
@@ -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<SPObject *>(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);
                     }
index 1dc6bd6cbbd9064e8a89ef8b2cc35a075477452c..348cd88118bbfd440cfbcbdbd9a8fe4c276a865c 100644 (file)
@@ -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");
index 74b252860ee13c083eec82d085e8abb5f9573f9b..3147dd213fc8d596657b070da5d088e6b3665942 100644 (file)
@@ -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");