Use the z printf length modifier when printing the value of size_t values, fixes...
[synfig.git] / synfig-studio / trunk / src / gtkmm / state_draw.cpp
index 646afa7..b1123b5 100644 (file)
@@ -377,7 +377,7 @@ StateDraw_Context::increment_id()
                String str_number;
                str_number=String(id,id.size()-digits,id.size());
                id=String(id,0,id.size()-digits);
-               synfig::info("---------------- \"%s\"",str_number.c_str());
+               // synfig::info("---------------- \"%s\"",str_number.c_str());
 
                number=atoi(str_number.c_str());
        }
@@ -410,8 +410,8 @@ StateDraw_Context::StateDraw_Context(CanvasView* canvas_view):
        checkbutton_auto_loop(_("Auto Loop")),
        checkbutton_auto_extend(_("Auto Extend")),
        checkbutton_auto_link(_("Auto Link")),
-       checkbutton_region(_("Create Region")),
-       checkbutton_outline(_("Create Outline")),
+       checkbutton_region(_("Create Region BLine")),
+       checkbutton_outline(_("Create Outline BLine")),
        checkbutton_auto_export(_("Auto Export")),
        button_fill_last_stroke(_("Fill Last Stroke")),
        adj_min_pressure(0,0,1,0.01,0.1),
@@ -425,32 +425,30 @@ StateDraw_Context::StateDraw_Context(CanvasView* canvas_view):
        check_localerror(_("LocalError"))
 
 {
-       synfig::info("STATE SKETCH: entering state");
-
        nested=0;
        load_settings();
 
        UpdateErrorBox();
 
-       //options_table.attach(*manage(new Gtk::Label(_("Draw Tool"))), 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(entry_id,                                                          0, 2,  1,  2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_region,                                        0, 2,  2,  3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_outline,                                       0, 2,  3,  4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_auto_loop,                                     0, 2,  4,  5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_auto_extend,                           0, 2,  5,  6, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_auto_link,                                     0, 2,  6,  7, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_auto_export,                           0, 2,  7,  8, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(checkbutton_pressure_width,                        0, 2,  8,  9, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(check_localerror,                                          0, 2,  9, 10, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(*manage(new Gtk::Label(_("Draw Tool"))),   0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(entry_id,                                                                  0, 2,  1,  2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_outline,                                               0, 2,  2,  3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_region,                                                0, 2,  3,  4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_auto_loop,                                             0, 2,  4,  5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_auto_extend,                                   0, 2,  5,  6, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_auto_link,                                             0, 2,  6,  7, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_auto_export,                                   0, 2,  7,  8, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(checkbutton_pressure_width,                                0, 2,  8,  9, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(check_localerror,                                                  0, 2,  9, 10, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
 
-       options_table.attach(check_min_pressure,                                        0, 1, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(spin_min_pressure,                                         1, 2, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(check_min_pressure,                                                0, 1, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(spin_min_pressure,                                                 1, 2, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
 
-       options_table.attach(*manage(new Gtk::Label(_("Smooth"))),      0, 1, 11, 12, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(spin_globalthres,                                          1, 2, 11, 12, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(*manage(new Gtk::Label(_("Smooth"))),              0, 1, 11, 12, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(spin_globalthres,                                                  1, 2, 11, 12, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
 
-       options_table.attach(*manage(new Gtk::Label(_("Feather"))), 0, 1, 12, 13, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(spin_feather,                                                      1, 2, 12, 13, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(*manage(new Gtk::Label(_("Feather"))),     0, 1, 12, 13, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(spin_feather,                                                              1, 2, 12, 13, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
 
        //options_table.attach(button_fill_last_stroke, 0, 2, 13, 14, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
 
@@ -779,8 +777,8 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
        // Create the action group
        synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Sketch BLine"));
 
-       bool shift_offset = false;
-       Vector shift_offset_vector;
+       bool shift_origin = false;
+       Vector shift_origin_vector;
        bool join_start_no_extend=false,join_finish_no_extend=false;
        synfigapp::ValueDesc start_duck_value_desc,finish_duck_value_desc;
        bool extend_start=false,extend_finish=false,complete_loop=false;
@@ -816,8 +814,8 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
                           (start_duck_index==0||start_duck_index==start_duck_value_node_bline->link_count()-1))
                        {
                                extend_start=true;
-                               shift_offset=true;
-                               shift_offset_vector=start_duck->get_origin();
+                               shift_origin=true;
+                               shift_origin_vector=start_duck->get_origin();
                        }
                }while(0);
 
@@ -847,8 +845,8 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
                                                complete_loop=extend_finish=true;
                                }else{
                                        extend_finish=true;
-                                       shift_offset=true;
-                                       shift_offset_vector=finish_duck->get_origin();
+                                       shift_origin=true;
+                                       shift_origin_vector=finish_duck->get_origin();
                                }
                        }
                }while(0);
@@ -862,10 +860,10 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
                                start_duck_value_desc=synfigapp::ValueDesc(LinkableValueNode::Handle::cast_dynamic(start_duck_value_desc.get_value_node()),0);
                                // fall through
                        case synfig::ValueBase::TYPE_VECTOR:
-                               if (shift_offset && shift_offset_vector != start_duck->get_origin())
+                               if (shift_origin && shift_origin_vector != start_duck->get_origin())
                                        break;
-                               shift_offset = true;
-                               shift_offset_vector = start_duck->get_origin();
+                               shift_origin = true;
+                               shift_origin_vector = start_duck->get_origin();
                                get_canvas_interface()->auto_export(start_duck_value_desc);
                                if (extend_finish)
                                        if(start_duck_value_node_bline&&start_duck_value_node_bline==finish_duck_value_node_bline)
@@ -887,10 +885,10 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
                                finish_duck_value_desc=synfigapp::ValueDesc(LinkableValueNode::Handle::cast_dynamic(finish_duck_value_desc.get_value_node()),0);
                                // fall through
                        case synfig::ValueBase::TYPE_VECTOR:
-                               if (shift_offset && shift_offset_vector != finish_duck->get_origin())
+                               if (shift_origin && shift_origin_vector != finish_duck->get_origin())
                                        break;
-                               shift_offset = true;
-                               shift_offset_vector = finish_duck->get_origin();
+                               shift_origin = true;
+                               shift_origin_vector = finish_duck->get_origin();
                                get_canvas_interface()->auto_export(finish_duck_value_desc);
                                if(extend_start)
                                        if(finish_duck_value_node_bline&&start_duck_value_node_bline==finish_duck_value_node_bline)
@@ -928,8 +926,8 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
                                ) -new_vertex
                        );
 
-                       if (shift_offset)
-                               new_vertex=new_vertex-shift_offset_vector;
+                       if (shift_origin)
+                               new_vertex=new_vertex-shift_origin_vector;
 
                        bline_point.set_vertex(new_vertex);
 
@@ -1011,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 */
@@ -1021,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();
@@ -1071,9 +1067,9 @@ StateDraw_Context::new_bline(std::list<synfig::BLinePoint> bline,bool loop_bline
                //layer->set_description(strprintf("Stroke %d",number));
                //get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
 
-               if (shift_offset)
+               if (shift_origin)
                        get_canvas_interface()->
-                         change_value(synfigapp::ValueDesc(layer,"offset"),shift_offset_vector);
+                         change_value(synfigapp::ValueDesc(layer,"origin"),shift_origin_vector);
 
                synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
 
@@ -1277,7 +1273,7 @@ StateDraw_Context::new_region(std::list<synfig::BLinePoint> bline, synfig::Real
 
        std::list<synfigapp::ValueDesc> vertex_list;
 
-       printf("new_region with %d bline points\n", bline.size());
+       printf("new_region with %zd bline points\n", bline.size());
 
        // First we need to come up with a rough list of
        // BLinePoints that we are going to be using to
@@ -1320,7 +1316,7 @@ StateDraw_Context::new_region(std::list<synfig::BLinePoint> bline, synfig::Real
 
        assert(vertex_list.back().is_valid());
 
-       printf("vertex list with %d bline points\n", vertex_list.size());
+       printf("vertex list with %zd bline points\n", vertex_list.size());
 
        // Remove any duplicates
        {