Code

Force non-interruptible canvas redraws to ensure accurate display while creating...
authorjohncoswell <johncoswell@users.sourceforge.net>
Mon, 4 Sep 2006 15:46:12 +0000 (15:46 +0000)
committerjohncoswell <johncoswell@users.sourceforge.net>
Mon, 4 Sep 2006 15:46:12 +0000 (15:46 +0000)
src/arc-context.cpp
src/pen-context.cpp
src/rect-context.cpp
src/rubberband.cpp
src/spiral-context.cpp
src/star-context.cpp

index 0b0aad79e563890d2fcea8120b8a992e920f0593..032d7febb7375f75f29cc257806bd02033e483ff 100644 (file)
@@ -412,6 +412,8 @@ static void sp_arc_drag(SPArcContext *ac, NR::Point pt, guint state)
 
     NR::Rect const r = Inkscape::snap_rectangular_box(desktop, ac->item, pt, ac->center, state);
 
+    sp_canvas_force_full_redraws(desktop->canvas, 1);
+
     sp_arc_position_set(SP_ARC(ac->item),
                         r.midpoint()[NR::X], r.midpoint()[NR::Y],
                         r.dimensions()[NR::X] / 2, r.dimensions()[NR::Y] / 2);
@@ -437,6 +439,8 @@ static void sp_arc_finish(SPArcContext *ac)
                          _("Create ellipse"));
 
         ac->item = NULL;
+
+        sp_canvas_clear_forced_full_redraws(desktop->canvas);
     }
 }
 
index c050c888b0ffff0d17a2135d05d9b8b6ce65a76b..adfc5eb7aa061ec27418968ed6ae774b91d20baa 100644 (file)
@@ -226,6 +226,8 @@ pen_cancel (SPPenContext *const pc)
     sp_canvas_item_hide(pc->cl1);
     pc->_message_context->clear();
     pc->_message_context->flash(Inkscape::NORMAL_MESSAGE, _("Drawing cancelled"));
+
+    sp_canvas_clear_forced_full_redraws(pc->desktop->canvas);
 }
 
 /**
@@ -1034,6 +1036,8 @@ 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;
@@ -1050,6 +1054,7 @@ spdc_pen_set_subsequent_point(SPPenContext *const pc, NR::Point const p, bool st
         sp_curve_lineto(pc->red_curve, p);
         is_curve = false;
     }
+
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
 
     if (statusbar) {
@@ -1170,6 +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);
+
     pen_enable_events(pc);
 }
 
index b03cdeead7c08dc5aee4bd0a3be52900a8587bfc..b337b53a1f5bd5e3e819f4c5cb2d677bdfee5883 100644 (file)
@@ -455,6 +455,8 @@ static void sp_rect_drag(SPRectContext &rc, NR::Point const pt, guint state)
 
     NR::Rect const r = Inkscape::snap_rectangular_box(desktop, rc.item, pt, rc.center, state);
 
+    sp_canvas_force_full_redraws(desktop->canvas, 2);
+
     sp_rect_position_set(SP_RECT(rc.item), r.min()[NR::X], r.min()[NR::Y], r.dimensions()[NR::X], r.dimensions()[NR::Y]);
     if ( rc.rx != 0.0 ) {
         sp_rect_set_rx (SP_RECT(rc.item), TRUE, rc.rx);
@@ -490,6 +492,8 @@ static void sp_rect_finish(SPRectContext *rc)
                          _("Create rectangle"));
 
         rc->item = NULL;
+
+        sp_canvas_clear_forced_full_redraws(dt->canvas);
     }
 }
 
index cc0e70a7444c564dc72cacd8e58f3288b33ead26..49fb34592bd935cf5d283e01b2c594dfa233ed03 100644 (file)
@@ -35,6 +35,8 @@ void Inkscape::Rubberband::start(SPDesktop *d, NR::Point const &p)
 
 void Inkscape::Rubberband::stop()
 {
+    sp_canvas_clear_forced_full_redraws(_desktop->canvas);
+
     if (_canvas) {
         gtk_object_destroy((GtkObject *) _canvas);
         _canvas = NULL;
@@ -50,6 +52,8 @@ void Inkscape::Rubberband::move(NR::Point const &p)
     _desktop->scroll_to_point(&p);
     _end = p;
 
+    sp_canvas_force_full_redraws(_desktop->canvas, 2);
+
     _canvas->setRectangle(NR::Rect(_start, _end));
 }
 
index 1dc6bd6cbbd9064e8a89ef8b2cc35a075477452c..e878154ba47dc493328aa8f14c64e87081ae4aad 100644 (file)
@@ -430,6 +430,8 @@ sp_spiral_drag(SPSpiralContext *sc, NR::Point p, guint state)
         arg = sp_round(arg, M_PI/snaps);
     }
 
+    sp_canvas_force_full_redraws(desktop->canvas, 1);
+    
     /* Fixme: these parameters should be got from dialog box */
     sp_spiral_position_set(spiral, p0[NR::X], p0[NR::Y],
                            /*expansion*/ sc->exp,
@@ -462,6 +464,8 @@ sp_spiral_finish(SPSpiralContext *sc)
                          /* TODO: annotate */ "spiral-context.cpp:462");
 
         sc->item = NULL;
+
+        sp_canvas_clear_forced_full_redraws(desktop->canvas);
     }
 }
 
index 74b252860ee13c083eec82d085e8abb5f9573f9b..fc1d710528ed07b5df78ee3a3b58428f0eb3eb25 100644 (file)
@@ -442,6 +442,8 @@ static void sp_star_drag(SPStarContext *sc, NR::Point p, guint state)
         arg1 = sp_round(arg1, M_PI / snaps);
     }
 
+    sp_canvas_force_full_redraws(desktop->canvas, 1);
+
     sp_star_position_set(star, sc->magnitude, p0, r1, r1 * sc->proportion,
                          arg1, arg1 + M_PI / sides, sc->isflatsided, sc->rounded, sc->randomized);
 
@@ -474,6 +476,8 @@ sp_star_finish (SPStarContext * sc)
                          /* TODO: annotate */ "star-context.cpp:474");
 
         sc->item = NULL;
+
+        sp_canvas_clear_forced_full_redraws(desktop->canvas);
     }
 }