Duckmatic::Type old_duckmask;
void fill_last_stroke();
+ void fill_last_stroke_and_unselect_other_layers();
Smach::event_result new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline_flag,float radius);
if(id[id.size()-1]<='9' && id[id.size()-1]>='0')
{
// figure out how many digits it is
- for(digits=0;(int)id.size()-1>=digits && id[id.size()-1-digits]<='9' && id[id.size()-1-digits]>='0';digits++)while(false);
+ for (digits = 0;
+ (int)id.size()-1 >= digits && id[id.size()-1-digits] <= '9' && id[id.size()-1-digits] >= '0';
+ digits++)
+ ;
String str_number;
str_number=String(id,id.size()-digits,id.size());
}
// If the start and end points are similar, then make them the same point
- if(get_auto_loop_flag() &&
- bline.size()>2&&(bline.front().get_vertex()-bline.back().get_vertex()).mag()<=radius)
+ if (get_auto_loop_flag() &&
+ bline.size() > 2 &&
+ (bline.front().get_vertex() - bline.back().get_vertex()).mag() <= radius)
{
loop_bline_flag=true;
Vector tangent;
Real width(0);
- while(bline.size()>2&&(bline.front().get_vertex()-bline.back().get_vertex()).mag()<=radius)
+ while (bline.size() > 2 &&
+ (bline.front().get_vertex() - bline.back().get_vertex()).mag() <= radius)
{
tangent=bline.back().get_tangent1();
width=bline.back().get_width();
}
// 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);
Smach::event_result
StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline_flag,float radius)
{
+ synfigapp::SelectionManager::LayerList layer_list = get_canvas_view()->get_selection_manager()->get_selected_layers();
+
// Create the action group
synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Sketch BLine"));
// don't extend looped blines
if(finish_duck_value_node_bline&&!finish_duck_value_node_bline->get_loop()&&
(finish_duck_index==0||finish_duck_index==finish_duck_value_node_bline->link_count()-1))
+ {
if(extend_start)
{
// we've started and finished drawing at the end of a bline. we can't
shift_offset=true;
shift_offset_vector=finish_duck->get_origin();
}
+ }
}while(0);
// if the new line's start didn't extend an existing line,
// fill_last_stroke() will take care of clearing the selection if we're calling it
if(get_outline_flag() && get_region_flag())
- fill_last_stroke();
+ fill_last_stroke_and_unselect_other_layers();
else
get_canvas_interface()->get_selection_manager()->clear_selected_layers();
//refresh_ducks();
return Smach::RESULT_ERROR;
}
- get_canvas_view()->get_selection_manager()->set_selected_layer(layer);
+ layer_list.push_back(layer);
+ get_canvas_view()->get_selection_manager()->set_selected_layers(layer_list);
//refresh_ducks();
}
{
if (started) printf(", "); else started = true;
if (start != -1)
+ {
if (dir != 0)
printf("%d--%d", start, prev);
else
printf("%d", start);
+ }
printf(")");
}
printf("\n");
this_index = iter->get_index();
// printf("index went from %d to %d\n", last_index, this_index);
if (looped)
+ {
if (this_index - last_index > points_in_line/2)
while (this_index - last_index > points_in_line/2)
this_index -= points_in_line;
else if (last_index - this_index > points_in_line/2)
while (last_index - this_index > points_in_line/2)
this_index += points_in_line;
+ }
if (this_index < min_index) min_index = this_index;
if (this_index > max_index) max_index = this_index;
}
void
-StateDraw_Context::fill_last_stroke()
+StateDraw_Context::fill_last_stroke_and_unselect_other_layers()
{
if(!last_stroke)
return;
}
get_canvas_view()->get_selection_manager()->set_selected_layer(layer);
}
+
+void
+StateDraw_Context::fill_last_stroke()
+{
+ if(!last_stroke)
+ return;
+
+ synfigapp::SelectionManager::LayerList layer_list = get_canvas_view()->get_selection_manager()->get_selected_layers();
+ fill_last_stroke_and_unselect_other_layers();
+ get_canvas_view()->get_selection_manager()->set_selected_layers(layer_list);
+}