Gtk::CheckButton checkbutton_layer_region;
Gtk::CheckButton checkbutton_layer_bline;
Gtk::CheckButton checkbutton_layer_curve_gradient;
+ Gtk::CheckButton checkbutton_layer_link_offsets;
Gtk::CheckButton checkbutton_auto_export;
Gtk::Button button_make;
Gtk::Button button_clear;
bool get_layer_curve_gradient_flag()const { return checkbutton_layer_curve_gradient.get_active(); }
void set_layer_curve_gradient_flag(bool x) { return checkbutton_layer_curve_gradient.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); }
+
Real get_feather() const { return adj_feather.get_value(); }
void set_feather(Real x) { return adj_feather.set_value(x); }
synfig::String get_id()const { return entry_id.get_text(); }
else
set_layer_curve_gradient_flag(false);
+ if(settings.get_value("bline.layer_link_offsets",value) && value=="0")
+ set_layer_link_offsets_flag(false);
+ else
+ set_layer_link_offsets_flag(true);
+
if(settings.get_value("bline.auto_export",value) && value=="1")
set_auto_export_flag(true);
else
settings.set_value("bline.layer_bline",get_layer_bline_flag()?"1":"0");
settings.set_value("bline.layer_region",get_layer_region_flag()?"1":"0");
settings.set_value("bline.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
+ settings.set_value("bline.layer_link_offsets",get_layer_link_offsets_flag()?"1":"0");
settings.set_value("bline.auto_export",get_auto_export_flag()?"1":"0");
settings.set_value("bline.id",get_id().c_str());
settings.set_value("bline.feather",strprintf("%f",get_feather()));
checkbutton_layer_region(_("Fill")),
checkbutton_layer_bline(_("Outline")),
checkbutton_layer_curve_gradient(_("Gradient")),
+ checkbutton_layer_link_offsets(_("Link Offsets")),
checkbutton_auto_export(_("Auto Export")),
button_make(_("Make")),
button_clear(_("Clear")),
// Set up the tool options dialog
//options_table.attach(*manage(new Gtk::Label(_("BLine 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_layer_region, 0, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- options_table.attach(checkbutton_layer_bline, 0, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- options_table.attach(checkbutton_layer_curve_gradient, 0, 2, 4, 5, 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_layer_region, 0, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ options_table.attach(checkbutton_layer_bline, 0, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ options_table.attach(checkbutton_layer_curve_gradient, 0, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ options_table.attach(checkbutton_layer_link_offsets, 0, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ options_table.attach(checkbutton_auto_export, 0, 2, 6, 7, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
options_table.attach(*manage(new Gtk::Label(_("Feather"))), 0, 1, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- options_table.attach(spin_feather, 1, 2, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- options_table.attach(checkbutton_auto_export, 0, 2, 11, 12, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ options_table.attach(spin_feather, 1, 2, 10, 11, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
//options_table.attach(button_make, 0, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
//button_make.signal_pressed().connect(sigc::mem_fun(*this,&StateBLine_Context::run));
options_table.show_all();
}
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);
+
// Set the looping flag
value_node_bline->set_loop(loop_);
synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer(get_canvas_interface()->add_layer_to("region",canvas,depth));
- layer_selection.push_back(layer);
assert(layer);
+ layer_selection.push_back(layer);
layer->set_description(get_id()+_(" Region"));
get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
if(get_layer_bline_flag())
layer->set_param("color",synfigapp::Main::get_background_color());
- synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
-
- assert(action);
-
- 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("bline")))
- synfig::error("LayerParamConnect didn't like \"param\"");
- if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
- synfig::error("LayerParamConnect didn't like \"value_node\"");
+ // I don't know if it's safe to reuse the same layer_param_connect action, so I'm
+ // using 2 separate ones.
+ {
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
+ assert(action);
+
+ 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("bline")))
+ synfig::error("LayerParamConnect didn't like \"param\"");
+ if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
+
+ if(!get_canvas_interface()->get_instance()->perform_action(action))
+ {
+ //get_canvas_view()->get_ui_interface()->error(_("Unable to create Region layer"));
+ group.cancel();
+ throw String(_("Unable to create Region layer"));
+ return false;
+ }
+ }
- if(!get_canvas_interface()->get_instance()->perform_action(action))
+ if (get_layer_link_offsets_flag())
{
- //get_canvas_view()->get_ui_interface()->error(_("Unable to create Region layer"));
- group.cancel();
- throw String(_("Unable to create Region layer"));
- return false;
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
+ assert(action);
+
+ 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")))
+ synfig::error("LayerParamConnect didn't like \"param\"");
+ if(!action->set_param("value_node",ValueNode::Handle(value_node_offset)))
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
+
+ if(!get_canvas_interface()->get_instance()->perform_action(action))
+ {
+ //get_canvas_view()->get_ui_interface()->error(_("Unable to create Region layer"));
+ group.cancel();
+ throw String(_("Unable to create Region layer"));
+ return false;
+ }
}
}
synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer(get_canvas_interface()->add_layer_to("outline",canvas,depth));
+ assert(layer);
layer_selection.push_back(layer);
layer->set_description(get_id()+_(" Outline"));
get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
get_canvas_interface()->signal_layer_param_changed()(layer,"feather");
}
- assert(layer);
-
-
- synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
-
- assert(action);
-
- 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("bline")))
- synfig::error("LayerParamConnect didn't like \"param\"");
- if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
- synfig::error("LayerParamConnect didn't like \"value_node\"");
+ {
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
+ assert(action);
+
+ 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("bline")))
+ synfig::error("LayerParamConnect didn't like \"param\"");
+ if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
+
+ if(!get_canvas_interface()->get_instance()->perform_action(action))
+ {
+ //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
+ group.cancel();
+ throw String(_("Unable to create Outline layer"));
+ return false;
+ }
+ }
- if(!get_canvas_interface()->get_instance()->perform_action(action))
+ if (get_layer_link_offsets_flag())
{
- //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
- group.cancel();
- throw String(_("Unable to create Outline layer"));
- return false;
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
+ assert(action);
+
+ 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")))
+ synfig::error("LayerParamConnect didn't like \"param\"");
+ if(!action->set_param("value_node",ValueNode::Handle(value_node_offset)))
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
+
+ if(!get_canvas_interface()->get_instance()->perform_action(action))
+ {
+ //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
+ group.cancel();
+ throw String(_("Unable to create Outline layer"));
+ return false;
+ }
}
/*if(get_layer_region_flag() && !get_auto_export_flag())
synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer(get_canvas_interface()->add_layer_to("curve_gradient",canvas,depth));
+ assert(layer);
layer_selection.push_back(layer);
layer->set_description(get_id()+_(" Gradient"));
get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
- assert(layer);
-
-
- synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
-
- assert(action);
-
- 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("bline")))
- synfig::error("LayerParamConnect didn't like \"param\"");
- if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
- synfig::error("LayerParamConnect didn't like \"value_node\"");
+ {
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
+ assert(action);
+
+ 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("bline")))
+ synfig::error("LayerParamConnect didn't like \"param\"");
+ if(!action->set_param("value_node",ValueNode::Handle(value_node_bline)))
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
+
+ if(!get_canvas_interface()->get_instance()->perform_action(action))
+ {
+ //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
+ group.cancel();
+ throw String(_("Unable to create Gradient layer"));
+ return false;
+ }
+ }
- if(!get_canvas_interface()->get_instance()->perform_action(action))
+ if (get_layer_link_offsets_flag())
{
- //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
- group.cancel();
- throw String(_("Unable to create Gradient layer"));
- return false;
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
+ assert(action);
+
+ 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")))
+ synfig::error("LayerParamConnect didn't like \"param\"");
+ if(!action->set_param("value_node",ValueNode::Handle(value_node_offset)))
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
+
+ if(!get_canvas_interface()->get_instance()->perform_action(action))
+ {
+ //get_canvas_view()->get_ui_interface()->error(_("Unable to create BLine layer"));
+ group.cancel();
+ throw String(_("Unable to create Gradient layer"));
+ return false;
+ }
}
/*if(get_layer_region_flag() && !get_auto_export_flag())