sigc::mem_fun(*work_area,&studio::WorkArea::select_all_ducks)
);
+ action_group->add( Gtk::Action::create("unselect-all-ducks", _("Unselect All Ducks")),
+ sigc::mem_fun(*work_area,&studio::WorkArea::unselect_all_ducks)
+ );
+
+ action_group->add( Gtk::Action::create("select-all-layers", _("Select All Layers")),
+ sigc::mem_fun(*this,&CanvasView::on_select_layers)
+ );
+
action_group->add( Gtk::Action::create("unselect-all-layers", _("Unselect All Layers")),
sigc::mem_fun(*this,&CanvasView::on_unselect_layers)
);
// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-paste"),NOT_IMPLEMENTED_SLOT));
// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Ducks"),Gtk::AccelKey('E',Gdk::CONTROL_MASK),sigc::mem_fun(*work_area,&studio::WorkArea::select_all_ducks)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Unselect All Ducks"),Gtk::AccelKey('E',Gdk::CONTROL_MASK),sigc::mem_fun(*work_area,&studio::WorkArea::unselect_all_ducks)));
+// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Layers"),Gtk::AccelKey('A',Gdk::CONTROL_MASK),sigc::mem_fun(*this,&CanvasView::on_select_layers)));
// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Unselect All Layers"),Gtk::AccelKey('D',Gdk::CONTROL_MASK),sigc::mem_fun(*this,&CanvasView::on_unselect_layers)));
// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem());
//
}
void
+CanvasView::on_select_layers()
+{
+ Canvas::Handle canvas(get_canvas());
+ for (CanvasBase::iterator iter = canvas->begin(); iter != canvas->end(); iter++)
+ layer_tree->select_all_children_layers(*iter);
+}
+
+void
CanvasView::on_unselect_layers()
{
layer_tree->clear_selected_layers();
}
//clamp time to big bounds...
+ if(time_window_adjustment().get_value() < begin_time)
+ {
+ time_window_adjustment().set_value(begin_time);
+ time_window_adjustment().value_changed();
+ }
+
+ if(time_window_adjustment().get_value() + time_window_adjustment().get_page_size() > end_time)
+ {
+ time_window_adjustment().set_value(end_time - time_window_adjustment().get_page_size());
+ time_window_adjustment().value_changed();
+ }
+
if(time_adjustment().get_value() < begin_time)
{
time_adjustment().set_value(begin_time);
bool
CanvasView::on_duck_changed(const synfig::Point &value,const synfigapp::ValueDesc& value_desc)
{
- switch(value_desc.get_value_type())
+ if (ValueNode_BLineCalcWidth::Handle bline_width = ValueNode_BLineCalcWidth::Handle::cast_dynamic(value_desc.get_value_node()))
{
- case ValueBase::TYPE_REAL:
- if (ValueNode_BLineCalcWidth::Handle bline_width = ValueNode_BLineCalcWidth::Handle::cast_dynamic(value_desc.get_value_node()))
+ Real old_width((*bline_width)(get_time()).get(Real()));
+ Real new_width(value.mag());
+ int scale_index(bline_width->get_link_index_from_name("scale"));
+ Real scale((*(bline_width->get_link(scale_index)))(get_time()).get(Real()));
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_width,scale_index), new_width * scale / old_width);
+ }
+
+ if (ValueNode_BLineCalcVertex::Handle bline_vertex = ValueNode_BLineCalcVertex::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ ValueNode_BLine::Handle bline = ValueNode_BLine::Handle::cast_dynamic(bline_vertex->get_link(bline_vertex->get_link_index_from_name("bline")));
+ Real radius = 0.0;
+ Real amount = synfig::find_closest_point((*bline)(get_time()), value, radius, bline->get_loop());
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_vertex,bline_vertex->get_link_index_from_name("amount")), amount);
+ }
+
+ if (ValueNode_BLineCalcTangent::Handle bline_tangent = ValueNode_BLineCalcTangent::Handle::cast_dynamic(value_desc.get_value_node()))
+ {
+ switch(value_desc.get_value_type())
+ {
+ case ValueBase::TYPE_REAL:
{
- Real old_width((*bline_width)(get_time()).get(Real()));
- Real new_width(value.mag());
- int scale_index(bline_width->get_link_index_from_name("scale"));
- Real scale((*(bline_width->get_link(scale_index)))(get_time()).get(Real()));
- return canvas_interface()->change_value(synfigapp::ValueDesc(bline_width,scale_index), new_width * scale / old_width);
+ Real old_length = (*bline_tangent)(get_time()).get(Real());
+ Real new_length = value.mag();
+ int scale_index(bline_tangent->get_link_index_from_name("scale"));
+ int fixed_length_index(bline_tangent->get_link_index_from_name("fixed_length"));
+ Real scale((*(bline_tangent->get_link(scale_index)))(get_time()).get(Real()));
+ bool fixed_length((*(bline_tangent->get_link(fixed_length_index)))(get_time()).get(bool()));
+ if (fixed_length)
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length);
+ if (old_length == 0)
+ return true;
+ return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length * scale / old_length);
}
- return canvas_interface()->change_value(value_desc,value.mag());
-
- case ValueBase::TYPE_ANGLE:
- return canvas_interface()->change_value(value_desc,Angle::tan(value[1],value[0]));
+ case ValueBase::TYPE_ANGLE:
+ assert(0); // doesn't happen?
+ break;
- case ValueBase::TYPE_VECTOR:
- if (ValueNode_BLineCalcTangent::Handle bline_tangent = ValueNode_BLineCalcTangent::Handle::cast_dynamic(value_desc.get_value_node()))
+ case ValueBase::TYPE_VECTOR:
{
Vector old_tangent = (*bline_tangent)(get_time()).get(Vector());
Angle old_angle = old_tangent.angle();
bool fixed_length((*(bline_tangent->get_link(fixed_length_index)))(get_time()).get(bool()));
if (fixed_length)
{
- if (!(canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index),
- new_length)))
+ if (!(canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length)))
return false;
}
- else if (old_length != 0 &&
- !(canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index),
- new_length * scale / old_length)))
+ else if (old_length != 0 && !(canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length * scale / old_length)))
return false;
return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,offset_index), old_offset + new_angle - old_angle);
}
-
- if (ValueNode_BLineCalcVertex::Handle bline_vertex = ValueNode_BLineCalcVertex::Handle::cast_dynamic(value_desc.get_value_node()))
- {
- ValueNode_BLine::Handle bline = ValueNode_BLine::Handle::cast_dynamic(bline_vertex->get_link(bline_vertex->get_link_index_from_name("bline")));
- Real radius = 0.0;
- Real amount = synfig::find_closest_point((*bline)(get_time()), value, radius, bline->get_loop());
- return canvas_interface()->change_value(synfigapp::ValueDesc(bline_vertex,bline_vertex->get_link_index_from_name("amount")), amount);
+ default:
+ break;
}
- default: // fall through
+ }
+ switch(value_desc.get_value_type())
+ {
+ case ValueBase::TYPE_REAL:
+ return canvas_interface()->change_value(value_desc,value.mag());
+ case ValueBase::TYPE_ANGLE:
+ return canvas_interface()->change_value(value_desc,Angle::tan(value[1],value[0]));
+ default:
return canvas_interface()->change_value(value_desc,value);
- break;
}
-
- return true;
}
bool