X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fstate_rectangle.cpp;h=8959429bc1a07dcbb895321e7a1db155ee6b5606;hb=23afd999cfa673044db848f8b6c2f9eccb6c639f;hp=9bc2c232733f0317e294fe78fb4aaec353204b63;hpb=58575b7ece3fabec0c0ffa2633590819c8812e7b;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/state_rectangle.cpp b/synfig-studio/trunk/src/gtkmm/state_rectangle.cpp index 9bc2c23..8959429 100644 --- a/synfig-studio/trunk/src/gtkmm/state_rectangle.cpp +++ b/synfig-studio/trunk/src/gtkmm/state_rectangle.cpp @@ -103,12 +103,12 @@ class studio::StateRectangle_Context : public sigc::trackable Gtk::CheckButton checkbutton_layer_outline; Gtk::CheckButton checkbutton_layer_curve_gradient; Gtk::CheckButton checkbutton_layer_plant; - Gtk::CheckButton checkbutton_layer_link_offsets; + Gtk::CheckButton checkbutton_layer_link_origins; public: // this only counts the layers which use blines - they're the only - // ones we link the offsets for + // ones we link the origins for int layers_to_create()const { return @@ -145,8 +145,8 @@ public: bool get_layer_plant_flag()const { return checkbutton_layer_plant.get_active(); } void set_layer_plant_flag(bool x) { return checkbutton_layer_plant.set_active(x); } - bool get_layer_link_offsets_flag()const { return checkbutton_layer_link_offsets.get_active(); } - void set_layer_link_offsets_flag(bool x) { return checkbutton_layer_link_offsets.set_active(x); } + bool get_layer_link_origins_flag()const { return checkbutton_layer_link_origins.get_active(); } + void set_layer_link_origins_flag(bool x) { return checkbutton_layer_link_origins.set_active(x); } void refresh_tool_options(); //to refresh the toolbox @@ -253,10 +253,10 @@ StateRectangle_Context::load_settings() else set_layer_plant_flag(false); - if(settings.get_value("rectangle.layer_link_offsets",value) && value=="0") - set_layer_link_offsets_flag(false); + if(settings.get_value("rectangle.layer_link_origins",value) && value=="0") + set_layer_link_origins_flag(false); else - set_layer_link_offsets_flag(true); + set_layer_link_origins_flag(true); } void @@ -271,7 +271,7 @@ StateRectangle_Context::save_settings() settings.set_value("rectangle.layer_region",get_layer_region_flag()?"1":"0"); settings.set_value("rectangle.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0"); settings.set_value("rectangle.layer_plant",get_layer_plant_flag()?"1":"0"); - settings.set_value("rectangle.layer_link_offsets",get_layer_link_offsets_flag()?"1":"0"); + settings.set_value("rectangle.layer_link_origins",get_layer_link_origins_flag()?"1":"0"); } void @@ -342,32 +342,32 @@ StateRectangle_Context::StateRectangle_Context(CanvasView* canvas_view): checkbutton_layer_outline(_("Create Outline BLine")), checkbutton_layer_curve_gradient(_("Create Curve Gradient BLine")), checkbutton_layer_plant(_("Create Plant BLine")), - checkbutton_layer_link_offsets(_("Link BLine Offsets")) + checkbutton_layer_link_origins(_("Link BLine Origins")) { egress_on_selection_change=true; load_settings(); // Set up the tool options dialog - //options_table.attach(*manage(new Gtk::Label(_("Rectangle 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(*manage(new Gtk::Label(_("Rectangle 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); //expand stuff - options_table.attach(*manage(new Gtk::Label(_("Expansion:"))), 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(spin_expand, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(*manage(new Gtk::Label(_("Expansion:"))), 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(spin_expand, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); //feather stuff - options_table.attach(*manage(new Gtk::Label(_("Feather:"))), 0, 1, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(spin_feather, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(*manage(new Gtk::Label(_("Feather:"))), 0, 1, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(spin_feather, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); //invert flag - options_table.attach(checkbutton_invert, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(checkbutton_invert, 1, 2, 4 , 5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(checkbutton_layer_rectangle, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(checkbutton_layer_outline, 0, 2, 8, 9, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(checkbutton_layer_region, 0, 2, 9, 10, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(checkbutton_layer_plant, 0, 2, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(checkbutton_layer_curve_gradient, 0, 2, 11, 12, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(checkbutton_layer_link_offsets, 0, 2, 12, 13, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(checkbutton_layer_rectangle, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(checkbutton_layer_outline, 0, 2, 8, 9, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(checkbutton_layer_region, 0, 2, 9, 10, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(checkbutton_layer_plant, 0, 2, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(checkbutton_layer_curve_gradient, 0, 2, 11, 12, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(checkbutton_layer_link_origins, 0, 2, 12, 13, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); options_table.show_all(); @@ -497,8 +497,8 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) ValueNode_BLine::Handle value_node_bline(ValueNode_BLine::create(new_list)); assert(value_node_bline); - ValueNode_Const::Handle value_node_offset(ValueNode_Const::create(Vector())); - assert(value_node_offset); + ValueNode_Const::Handle value_node_origin(ValueNode_Const::create(Vector())); + assert(value_node_origin); // Set the looping flag value_node_bline->set_loop(true); @@ -534,6 +534,12 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) layer->set_description(get_id()); get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description()); + + if(get_layer_outline_flag()) + { + layer->set_param("color",synfigapp::Main::get_background_color()); + get_canvas_interface()->signal_layer_param_changed()(layer,"color"); + } } /////////////////////////////////////////////////////////////////////////// @@ -571,8 +577,8 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) } } - // only link the curve gradient's offset parameter if the option is selected and we're creating more than one layer - if (get_layer_link_offsets_flag() && layers_to_create > 1) + // only link the curve gradient's origin parameter if the option is selected and we're creating more than one layer + if (get_layer_link_origins_flag() && layers_to_create > 1) { synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect")); assert(action); @@ -580,9 +586,9 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("layer",layer); - if(!action->set_param("param",String("offset"))) + if(!action->set_param("param",String("origin"))) synfig::error("LayerParamConnect didn't like \"param\""); - if(!action->set_param("value_node",ValueNode::Handle(value_node_offset))) + if(!action->set_param("value_node",ValueNode::Handle(value_node_origin))) synfig::error("LayerParamConnect didn't like \"value_node\""); if(!get_canvas_interface()->get_instance()->perform_action(action)) @@ -630,8 +636,8 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) } } - // only link the plant's offset parameter if the option is selected and we're creating more than one layer - if (get_layer_link_offsets_flag() && layers_to_create > 1) + // only link the plant's origin parameter if the option is selected and we're creating more than one layer + if (get_layer_link_origins_flag() && layers_to_create > 1) { synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect")); assert(action); @@ -639,9 +645,9 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("layer",layer); - if(!action->set_param("param",String("offset"))) + if(!action->set_param("param",String("origin"))) synfig::error("LayerParamConnect didn't like \"param\""); - if(!action->set_param("value_node",ValueNode::Handle(value_node_offset))) + if(!action->set_param("value_node",ValueNode::Handle(value_node_origin))) synfig::error("LayerParamConnect didn't like \"value_node\""); if(!get_canvas_interface()->get_instance()->perform_action(action)) @@ -700,8 +706,8 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) } } - // only link the region's offset parameter if the option is selected and we're creating more than one layer - if (get_layer_link_offsets_flag() && layers_to_create > 1) + // only link the region's origin parameter if the option is selected and we're creating more than one layer + if (get_layer_link_origins_flag() && layers_to_create > 1) { synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect")); assert(action); @@ -709,9 +715,9 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("layer",layer); - if(!action->set_param("param",String("offset"))) + if(!action->set_param("param",String("origin"))) synfig::error("LayerParamConnect didn't like \"param\""); - if(!action->set_param("value_node",ValueNode::Handle(value_node_offset))) + if(!action->set_param("value_node",ValueNode::Handle(value_node_origin))) synfig::error("LayerParamConnect didn't like \"value_node\""); if(!get_canvas_interface()->get_instance()->perform_action(action)) @@ -763,8 +769,8 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) } } - // only link the outline's offset parameter if the option is selected and we're creating more than one layer - if (get_layer_link_offsets_flag() && layers_to_create > 1) + // only link the outline's origin parameter if the option is selected and we're creating more than one layer + if (get_layer_link_origins_flag() && layers_to_create > 1) { synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect")); assert(action); @@ -772,9 +778,9 @@ StateRectangle_Context::make_rectangle(const Point& _p1, const Point& _p2) action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("layer",layer); - if(!action->set_param("param",String("offset"))) + if(!action->set_param("param",String("origin"))) synfig::error("LayerParamConnect didn't like \"param\""); - if(!action->set_param("value_node",ValueNode::Handle(value_node_offset))) + if(!action->set_param("value_node",ValueNode::Handle(value_node_origin))) synfig::error("LayerParamConnect didn't like \"value_node\""); if(!get_canvas_interface()->get_instance()->perform_action(action)) @@ -823,6 +829,7 @@ StateRectangle_Context::event_mouse_click_handler(const Smach::event& x) if(event.key==EVENT_WORKAREA_MOUSE_BUTTON_DRAG && event.button==BUTTON_LEFT) { + if (!point2_duck) return Smach::RESULT_OK; point2_duck->set_point(get_work_area()->snap_point_to_grid(event.pos)); get_work_area()->queue_draw(); return Smach::RESULT_ACCEPT;