Fix 1438545: hide and reshow the sketch after 'undo' or 'clear' to ensure it's update...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 16 Mar 2007 14:44:45 +0000 (14:44 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 16 Mar 2007 14:44:45 +0000 (14:44 +0000)
git-svn-id: http://svn.voria.com/code@347 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/state_sketch.cpp

index ec6e840..32ab3d3 100644 (file)
@@ -190,7 +190,15 @@ void
 StateSketch_Context::clear_sketch()
 {
        get_work_area()->clear_persistant_strokes();
-       get_canvas_view()->get_smach().process_event(EVENT_REFRESH);
+
+       // if the sketch is currently shown, make sure it is updated
+       //! \todo is there a better way than this of getting Duckmatic to update its stroke_list_?
+       if (checkbutton_show_sketch.get_active())
+       {
+               get_work_area()->set_show_persistant_strokes(false);
+               get_work_area()->set_show_persistant_strokes(true);
+               get_canvas_view()->get_smach().process_event(EVENT_REFRESH);
+       }
 }
 
 void
@@ -199,7 +207,15 @@ StateSketch_Context::undo_stroke()
        if(!get_work_area()->persistant_stroke_list().empty())
        {
                get_work_area()->persistant_stroke_list().pop_back();
-               get_canvas_view()->get_smach().process_event(EVENT_REFRESH);
+
+               // if the sketch is currently shown, make sure it is updated
+               //! \todo is there a better way than this of getting Duckmatic to update its stroke_list_?
+               if (checkbutton_show_sketch.get_active())
+               {
+                       get_work_area()->set_show_persistant_strokes(false);
+                       get_work_area()->set_show_persistant_strokes(true);
+                       get_canvas_view()->get_smach().process_event(EVENT_REFRESH);
+               }
        }
 }