Make the draw tool quieter.
[synfig.git] / synfig-studio / trunk / src / gtkmm / state_draw.cpp
index 9f7f823..1b7e493 100644 (file)
@@ -425,8 +425,6 @@ StateDraw_Context::StateDraw_Context(CanvasView* canvas_view):
        check_localerror(_("LocalError"))
 
 {
-       synfig::info("STATE SKETCH: entering state");
-
        nested=0;
        load_settings();
 
@@ -755,8 +753,15 @@ StateDraw_Context::process_stroke(StrokeData stroke_data, WidthData width_data,
        }
 
        // If the bline only has one blinepoint, then there is nothing to do.
-       if(bline.size()<=1)
+       if(bline.size() < 2)
+       {
+               // hide the 'stroke' line we were drawing, unless the user
+               // explicitly requests that they are kept
+               if (!getenv("SYNFIG_KEEP_ABORTED_DRAW_LINES"))
+                       refresh_ducks();
+
                return Smach::RESULT_OK;
+       }
 
        if(region_flag)
                return new_region(bline,radius);
@@ -929,6 +934,11 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
                        trans_bline.push_back(bline_point);
                }
                value_node=ValueNode_BLine::create(synfig::ValueBase(trans_bline,loop_bline_flag));
+
+               Canvas::Handle canvas(get_canvas_view()->get_canvas());
+               Layer::Handle layer(get_canvas_view()->get_selection_manager()->get_selected_layer());
+               if (layer) canvas=layer->get_canvas();
+               value_node->set_member_canvas(canvas);
        }
 
        Smach::event_result result;
@@ -999,8 +1009,7 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
                LinkableValueNode::Handle::cast_dynamic(value_node->list.back().value_node)->
                  set_link(0,finish_duck_value_desc.get_value_node());
 
-       if(get_auto_export_flag()) {
-               printf("this is where we would export the new line\n");
+       if(get_auto_export_flag())
                if (!get_canvas_interface()->add_value_node(value_node,get_id()))
                {
                        /* it's no big deal, is it?  let's keep the shape anyway */
@@ -1009,7 +1018,6 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
                        // increment_id();
                        // return Smach::RESULT_ERROR;
                }
-       }
 
        last_stroke=value_node;
        last_stroke_id=get_id();