}
};
+ enum Side
+ {
+ SIDE_UNSPECIFIED, SIDE_LEFT, SIDE_RIGHT,
+
+ SIDE_END=2 //!< \internal
+ };
+
/*
-- ** -- D A T A -------------------------------------------------------------
*/
// // Connect Signals
// if(children_tree)children_tree->signal_edited_value().connect(sigc::mem_fun(*this, &studio::CanvasView::on_edited_value));
// if(children_tree)children_tree->signal_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
-// if(children_tree)children_tree->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked));
+// if(children_tree)children_tree->signal_waypoint_clicked_childrentree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview));
// if(children_tree)children_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
//
// return children_tree;
// layer_tree->signal_edited_value().connect(sigc::mem_fun(*this, &studio::CanvasView::on_edited_value));
// layer_tree->signal_layer_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_user_click));
// layer_tree->signal_param_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
-// layer_tree->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked));
+// layer_tree->signal_waypoint_clicked_layertree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview));
// layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
//
// layer_tree->hide();
}
+static void
+set_waypoint_model(std::set<synfig::Waypoint, std::less<UniqueID> > waypoints,
+ Waypoint::Model model,
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface)
+{
+ // Create the action group
+ synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Change Waypoint Group"));
+
+ std::set<synfig::Waypoint, std::less<UniqueID> >::const_iterator iter;
+ for(iter=waypoints.begin();iter!=waypoints.end();++iter)
+ {
+ Waypoint waypoint(*iter);
+ waypoint.apply_model(model);
+
+ synfigapp::Action::Handle action(synfigapp::Action::create("waypoint_set"));
+
+ assert(action);
+
+ action->set_param("canvas",canvas_interface->get_canvas());
+ action->set_param("canvas_interface",canvas_interface);
+
+ action->set_param("waypoint",waypoint);
+ action->set_param("value_node",waypoint.get_parent_value_node());
+
+ if(!canvas_interface->get_instance()->perform_action(action))
+ {
+ group.cancel();
+ return;
+ }
+ }
+}
+
+static void
+duplicate_waypoints(std::set<synfig::Waypoint, std::less<UniqueID> > waypoints,
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface)
+{
+ // Create the action group
+ synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Duplicate Waypoints"));
+
+ std::set<synfig::Waypoint, std::less<UniqueID> >::const_iterator iter;
+ for (iter = waypoints.begin(); iter != waypoints.end(); iter++)
+ {
+ Waypoint waypoint(*iter);
+ ValueNode::Handle value_node(iter->get_parent_value_node());
+ canvas_interface->waypoint_duplicate(value_node, waypoint);
+ }
+}
+
+static void
+remove_waypoints(std::set<synfig::Waypoint, std::less<UniqueID> > waypoints,
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface)
+{
+ // Create the action group
+ synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Remove Waypoints"));
+
+ std::set<synfig::Waypoint, std::less<UniqueID> >::const_iterator iter;
+ for (iter = waypoints.begin(); iter != waypoints.end(); iter++)
+ {
+ Waypoint waypoint(*iter);
+ ValueNode::Handle value_node(iter->get_parent_value_node());
+ canvas_interface->waypoint_remove(value_node, waypoint);
+ }
+}
+
void
-CanvasView::on_waypoint_clicked(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint,int button)
+CanvasView::on_waypoint_clicked_canvasview(synfigapp::ValueDesc value_desc,
+ std::set<synfig::Waypoint, std::less<UniqueID> > waypoint_set,
+ int button,
+ synfig::Waypoint::Side side)
{
- waypoint_dialog.set_value_desc(value_desc);
- waypoint_dialog.set_waypoint(waypoint);
+ int size = waypoint_set.size();
+ Waypoint waypoint(*(waypoint_set.begin()));
+ Time time(waypoint.get_time());
+
+ if (size == 1)
+ {
+ waypoint_dialog.set_value_desc(value_desc);
+ waypoint_dialog.set_waypoint(waypoint);
+ }
switch(button)
{
case -1:
- waypoint_dialog.show();
+ if (size == 1)
+ waypoint_dialog.show();
break;
case 2:
- {
- Gtk::Menu* waypoint_menu(manage(new Gtk::Menu()));
- waypoint_menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), waypoint_menu));
+ {
+ Gtk::Menu* waypoint_menu(manage(new Gtk::Menu()));
+ waypoint_menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), waypoint_menu));
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-jump-to"),
- sigc::bind(
- sigc::mem_fun(
- *canvas_interface(),
- &synfigapp::CanvasInterface::set_time
- ),
- waypoint.get_time()
- )
- ));
+ Waypoint::Model model;
+ String side_string(String(" ") + (side==Waypoint::SIDE_LEFT ? _("In") : _("Out")));
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID(_("Edit Waypoint")),
- sigc::mem_fun(
- waypoint_dialog,
- &Gtk::Widget::show
- )
- ));
+ // ------------------------------------------------------------------------
+ if(side==Waypoint::SIDE_LEFT) model.set_before(INTERPOLATION_TCB);
+ else model.set_after(INTERPOLATION_TCB);
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB") + side_string,
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ if(side==Waypoint::SIDE_LEFT) model.set_before(INTERPOLATION_LINEAR);
+ else model.set_after(INTERPOLATION_LINEAR);
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear") + side_string,
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ if(side==Waypoint::SIDE_LEFT) model.set_before(INTERPOLATION_HALT);
+ else model.set_after(INTERPOLATION_HALT);
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease") + side_string,
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ if(side==Waypoint::SIDE_LEFT) model.set_before(INTERPOLATION_CONSTANT);
+ else model.set_after(INTERPOLATION_CONSTANT);
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant") + side_string,
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ // ------------------------------------------------------------------------
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+
+ model.set_after(INTERPOLATION_TCB); model.set_before(INTERPOLATION_TCB);
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("TC_B Both"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ model.set_after(INTERPOLATION_LINEAR); model.set_before(INTERPOLATION_LINEAR);
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Li_near Both"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ model.set_after(INTERPOLATION_HALT); model.set_before(INTERPOLATION_HALT);
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Ea_se Both"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ model.set_after(INTERPOLATION_CONSTANT); model.set_before(INTERPOLATION_CONSTANT);
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("C_onstant Both"),
+ sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+
+ // ------------------------------------------------------------------------
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Jump To"),
+ sigc::bind(sigc::mem_fun(*canvas_interface(), &synfigapp::CanvasInterface::set_time), time)));
+
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Duplicate"),
+ sigc::bind(sigc::ptr_fun(duplicate_waypoints), waypoint_set, canvas_interface())));
+
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem((size == 1) ? _("_Remove") : strprintf(_("_Remove %d Waypoints"), size),
+ sigc::bind(sigc::ptr_fun(remove_waypoints), waypoint_set, canvas_interface())));
+
+ if (size == 1)
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Properties"),
+ sigc::mem_fun(waypoint_dialog,&Gtk::Widget::show)));
+
+ waypoint_menu->popup(button+1,gtk_get_current_event_time());
+ }
+ break;
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-duplicate"),
- sigc::bind(
- sigc::bind(
- sigc::mem_fun(
- *canvas_interface(),
- &synfigapp::CanvasInterface::waypoint_duplicate
- ),
- waypoint
- ),
- value_desc
- )
- ));
- waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-delete"),
- sigc::bind(
- sigc::bind(
- sigc::mem_fun(
- *canvas_interface(),
- &synfigapp::CanvasInterface::waypoint_remove
- ),
- waypoint
- ),
- value_desc
- )
- ));
- waypoint_menu->popup(button+1,gtk_get_current_event_time());
- }
- break;
default:
break;
}
layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
layer_tree->signal_layer_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_user_click));
layer_tree->signal_param_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
- layer_tree->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked));
+ layer_tree->signal_waypoint_clicked_layertree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview));
}
if(x=="children")
{
children_tree=dynamic_cast<ChildrenTree*>(y);
if(children_tree)children_tree->signal_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click));
- if(children_tree)children_tree->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked));
+ if(children_tree)children_tree->signal_waypoint_clicked_childrentree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview));
if(children_tree)children_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS));
}
if(x=="keyframes")
void image_import();
- void on_waypoint_clicked(synfigapp::ValueDesc,synfig::Waypoint, int button);
+ void on_waypoint_clicked_canvasview(synfigapp::ValueDesc,std::set<synfig::Waypoint,std::less<synfig::UniqueID> >, int button, synfig::Waypoint::Side side);
void preview_option() {on_preview_option();}
void on_edited_value(synfigapp::ValueDesc,synfig::ValueBase);
- //void on_waypoint_clicked(synfigapp::ValueDesc,synfig::ValueNode_Animated::WaypointList::iterator, int button);
-
void on_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& selection_data, guint info, guint time);
//void on_audio_play();
#include <synfigapp/canvasinterface.h>
#include "instance.h"
-#include <synfig/timepointcollect.h>
-
#include "general.h"
#endif
if(clickfound && node)
{
- show_timepoint_menu(node, stime, time_offset, actual_time+time_offset<stime?SIDE_LEFT:SIDE_RIGHT);
+ show_timepoint_menu(node, stime, time_offset, actual_time+time_offset<stime?Waypoint::SIDE_LEFT:Waypoint::SIDE_RIGHT);
}
}
/*if(event->button.button==3 && selection)
{
- signal_waypoint_clicked_(path,*selected_waypoint,event->button.button-1);
+ signal_waypoint_clicked_cellrenderer_(path,*selected_waypoint,event->button.button-1);
return true;
}
*/
/*if(value_node && selection)
{
if(selected_time==drag_time && event->button.button!=3)
- signal_waypoint_clicked_(path,*selected_waypoint,event->button.button-1);
+ signal_waypoint_clicked_cellrenderer_(path,*selected_waypoint,event->button.button-1);
else
if(event->button.button==1)
{
canvas_interface_ = h;
}
-static void
-set_waypoint_model(std::set<synfig::Waypoint, std::less<UniqueID> > waypoints, Waypoint::Model model, etl::loose_handle<synfigapp::CanvasInterface> canvas_interface)
-{
- // Create the action group
- synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Change Waypoint Group"));
-
- std::set<synfig::Waypoint, std::less<UniqueID> >::const_iterator iter;
- for(iter=waypoints.begin();iter!=waypoints.end();++iter)
- {
- Waypoint waypoint(*iter);
- waypoint.apply_model(model);
-
- synfigapp::Action::Handle action(synfigapp::Action::create("waypoint_set"));
-
- assert(action);
-
- action->set_param("canvas",canvas_interface->get_canvas());
- action->set_param("canvas_interface",canvas_interface);
-
- action->set_param("waypoint",waypoint);
- action->set_param("value_node",waypoint.get_parent_value_node());
-
- if(!canvas_interface->get_instance()->perform_action(action))
- {
- group.cancel();
- return;
- }
- }
-}
-
void
-CellRenderer_TimeTrack::show_timepoint_menu(const etl::handle<synfig::Node>& node, const synfig::Time& time, const synfig::Time& time_offset, Side side)
+CellRenderer_TimeTrack::show_timepoint_menu(const etl::handle<synfig::Node>& node, const synfig::Time& time, const synfig::Time& time_offset, Waypoint::Side side)
{
- std::set<synfig::Waypoint, std::less<UniqueID> > waypoint_set;
- int n;
- n=synfig::waypoint_collect(waypoint_set,time,node);
-
- Gtk::Menu* menu(manage(new Gtk::Menu()));
- menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), menu));
-
- // Create the interpolation method menu
- if(!waypoint_set.empty())
- {
- Gtk::Menu* interp_menu(manage(new Gtk::Menu()));
- // no need to connect to signal_hide for this one - it will be deleted when its parent is deleted
- Waypoint::Model model;
-
- // note: each of the following 4 'if' blocks provokes these warnings:
- // /usr/include/sigc++-2.0/sigc++/adaptors/bound_argument.h:57: warning:
- // 'model.synfig::Waypoint::Model::temporal_tension' is used uninitialized in this function
- // 'model.synfig::Waypoint::Model::bias' is used uninitialized in this function
- // 'model.synfig::Waypoint::Model::continuity' is used uninitialized in this function
- // 'model.synfig::Waypoint::Model::tension' is used uninitialized in this function
- // 'model.synfig::Waypoint::Model::priority' is used uninitialized in this function
- // I don't know if that matters or not.
-
- if(side==SIDE_LEFT)model.set_before(INTERPOLATION_TCB);
- else model.set_after(INTERPOLATION_TCB);
- interp_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("TCB"),
- sigc::bind(
- sigc::ptr_fun(set_waypoint_model),
- waypoint_set,
- model,
- canvas_interface()
- )
- ));
-
- if(side==SIDE_LEFT)model.set_before(INTERPOLATION_LINEAR);
- else model.set_after(INTERPOLATION_LINEAR);
- interp_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Linear"),
- sigc::bind(
- sigc::ptr_fun(set_waypoint_model),
- waypoint_set,
- model,
- canvas_interface()
- )
- ));
-
- if(side==SIDE_LEFT)model.set_before(INTERPOLATION_HALT);
- else model.set_after(INTERPOLATION_HALT);
- interp_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Ease"),
- sigc::bind(
- sigc::ptr_fun(set_waypoint_model),
- waypoint_set,
- model,
- canvas_interface()
- )
- ));
-
- if(side==SIDE_LEFT)model.set_before(INTERPOLATION_CONSTANT);
- else model.set_after(INTERPOLATION_CONSTANT);
- interp_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Constant"),
- sigc::bind(
- sigc::ptr_fun(set_waypoint_model),
- waypoint_set,
- model,
- canvas_interface()
- )
- ));
-
-
- menu->items().push_back(
- Gtk::Menu_Helpers::MenuElem(
- side==SIDE_LEFT?_("Change \"In\" Interp."):_("Change \"Out\" Interp."),
- *interp_menu
- )
- );
- }
-
- menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-jump-to"),
- sigc::bind(
- sigc::mem_fun(
- *canvas_interface(),
- &synfigapp::CanvasInterface::set_time
- ),
- time - time_offset
- )
- ));
-
- if(!waypoint_set.empty())
- {
- // attempting to locate the valuenode for the clicked waypoint doesn't work if this is a Canvas parameter,
- // so act as if there were multiple waypoints in that case as a workaround
- if(waypoint_set.size()==1 && !Canvas::Handle::cast_dynamic(node))
- {
- delete menu;
- menu=0;
- signal_waypoint_clicked_(" ",*waypoint_set.begin(),2);
- return;
- }
- else
- synfig::info("Too many waypoints under me");
- }
- else
- synfig::info("ZERO waypoints under me");
-
- if(menu)menu->popup(3,gtk_get_current_event_time());
+ signal_waypoint_clicked_cellrenderer_(node,time,time_offset,2,side);
}
namespace studio {
class Widget_ValueBase;
-enum Side
-{
- SIDE_LEFT,
- SIDE_RIGHT
-};
-
/*! \class CellRenderer_TimeTrack
** \brief A cell renderer that displays the waypoints for Animated ValueNodes.
*/
Gtk::Adjustment adjustment_;
//! Signal for when the user clicks on a waypoint
- sigc::signal<void, const Glib::ustring&,synfig::Waypoint, int> signal_waypoint_clicked_;
+ sigc::signal<void, const etl::handle<synfig::Node>&, const synfig::Time&, const synfig::Time&, int, synfig::Waypoint::Side> signal_waypoint_clicked_cellrenderer_;
sigc::signal<void, synfig::Waypoint, synfig::ValueNode::Handle> signal_waypoint_changed_;
public:
- sigc::signal<void, const Glib::ustring&,synfig::Waypoint,int> &signal_waypoint_clicked()
- {return signal_waypoint_clicked_; }
+ sigc::signal<void, const etl::handle<synfig::Node>&, const synfig::Time&, const synfig::Time&, int, synfig::Waypoint::Side> &signal_waypoint_clicked_cellrenderer()
+ {return signal_waypoint_clicked_cellrenderer_; }
sigc::signal<void, synfig::Waypoint, synfig::ValueNode::Handle> &signal_waypoint_changed()
{return signal_waypoint_changed_; }
CellRenderer_TimeTrack();
~CellRenderer_TimeTrack();
- void show_timepoint_menu(const etl::handle<synfig::Node>& node, const synfig::Time& time, const synfig::Time& time_offset, Side side=SIDE_RIGHT);
+ void show_timepoint_menu(const etl::handle<synfig::Node>&, const synfig::Time&, const synfig::Time&, synfig::Waypoint::Side side=synfig::Waypoint::SIDE_RIGHT);
void set_adjustment(Gtk::Adjustment &x);
Gtk::Adjustment *get_adjustment();
// Set up the value-node cell-renderer
cellrenderer_time_track=ChildrenTreeStore::add_cell_renderer_value_node(column);
cellrenderer_time_track->property_mode()=Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
- cellrenderer_time_track->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_waypoint_clicked) );
+ cellrenderer_time_track->signal_waypoint_clicked_cellrenderer().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_waypoint_clicked_childrentree) );
column->add_attribute(cellrenderer_time_track->property_value_desc(), model.value_desc);
column->add_attribute(cellrenderer_time_track->property_canvas(), model.canvas);
}
void
-ChildrenTree::on_waypoint_clicked(const Glib::ustring &path_string, synfig::Waypoint waypoint,int button)
+ChildrenTree::on_waypoint_clicked_childrentree(const etl::handle<synfig::Node>& node __attribute__ ((unused)),
+ const synfig::Time& time __attribute__ ((unused)),
+ const synfig::Time& time_offset __attribute__ ((unused)),
+ int button __attribute__ ((unused)),
+ synfig::Waypoint::Side side __attribute__ ((unused)))
{
- Gtk::TreePath path(path_string);
-
- const Gtk::TreeRow row = *(tree_view.get_model()->get_iter(path));
+ //! \todo writeme
- signal_waypoint_clicked()(static_cast<synfigapp::ValueDesc>(row[model.value_desc]),waypoint,button);
+ // std::set<synfig::Waypoint, std::less<UniqueID> > waypoint_set;
+ // signal_waypoint_clicked_childrentree()(waypoint_set,button,side);
}
bool
sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_user_click_;
- sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint, int> signal_waypoint_clicked_;
+ sigc::signal<void,synfigapp::ValueDesc,std::set<synfig::Waypoint,std::less<synfig::UniqueID> >,int,synfig::Waypoint::Side> signal_waypoint_clicked_childrentree_;
Gtk::Button *button_raise;
Gtk::Button *button_lower;
void on_edited_value(const Glib::ustring&path_string,synfig::ValueBase value);
- void on_waypoint_clicked(const Glib::ustring &, synfig::Waypoint,int button);
+ void on_waypoint_clicked_childrentree(const etl::handle<synfig::Node>& node,const synfig::Time&,const synfig::Time&,int button,synfig::Waypoint::Side side);
bool on_tree_event(GdkEvent *event);
sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_user_click() { return signal_user_click_; }
- sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint, int>& signal_waypoint_clicked() { return signal_waypoint_clicked_; }
+ sigc::signal<void,synfigapp::ValueDesc,std::set<synfig::Waypoint,std::less<synfig::UniqueID> >,int,synfig::Waypoint::Side>& signal_waypoint_clicked_childrentree() { return signal_waypoint_clicked_childrentree_; }
etl::handle<synfigapp::SelectionManager> get_selection_manager() { return children_tree_store_->canvas_interface()->get_selection_manager(); }
#include "widget_timeslider.h"
#include "layerparamtreestore.h"
#include "general.h"
+#include <synfig/timepointcollect.h>
#endif
Gtk::TreeView *mimic_tree_view;
public:
- sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int> signal_waypoint_clicked;
+ sigc::signal<void,synfigapp::ValueDesc,std::set<synfig::Waypoint, std::less<UniqueID> >,int,synfig::Waypoint::Side> signal_waypoint_clicked_timetrackview;
LayerParamTreeStore::Model model;
// Set up the value-node cell-renderer
cellrenderer_time_track=LayerParamTreeStore::add_cell_renderer_value_node(column);
cellrenderer_time_track->property_mode()=Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
- cellrenderer_time_track->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_clicked) );
+ cellrenderer_time_track->signal_waypoint_clicked_cellrenderer().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_clicked_timetrackview) );
cellrenderer_time_track->signal_waypoint_changed().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_changed) );
column->add_attribute(cellrenderer_time_track->property_value_desc(), model.value_desc);
column->add_attribute(cellrenderer_time_track->property_canvas(), model.canvas);
}
void
- on_waypoint_clicked(const Glib::ustring &/*path_string*/, synfig::Waypoint waypoint,int button)
+ on_waypoint_clicked_timetrackview(const etl::handle<synfig::Node>& node,
+ const synfig::Time& time,
+ const synfig::Time& time_offset __attribute__ ((unused)),
+ int button,
+ synfig::Waypoint::Side side)
{
-/*
- Gtk::TreePath path(path_string);
+ std::set<synfig::Waypoint, std::less<UniqueID> > waypoint_set;
+ int n=synfig::waypoint_collect(waypoint_set,time,node);
- const Gtk::TreeRow row = *(get_model()->get_iter(path));
- if(!row)
- return;
-*/
-
- ValueNode::Handle value_node(waypoint.get_parent_value_node());
- assert(value_node);
-
- Gtk::TreeRow row;
- if(!param_tree_store_->find_first_value_node(value_node, row))
+ synfigapp::ValueDesc value_desc;
+ bool first = true;
+ if(!waypoint_set.empty())
{
- synfig::error(__FILE__":%d: Unable to find the valuenode",__LINE__);
- return;
- }
+ for (std::set<synfig::Waypoint, std::less<UniqueID> >::iterator iter = waypoint_set.begin(); iter != waypoint_set.end(); iter++)
+ {
+ ValueNode::Handle value_node(iter->get_parent_value_node());
+ assert(value_node);
+
+ Gtk::TreeRow row;
+ if(!param_tree_store_->find_first_value_node(value_node, row))
+ {
+ synfig::error(__FILE__":%d: Unable to find the valuenode",__LINE__);
+ return;
+ }
- if(!row)
- return;
+ if(!row)
+ return;
- synfigapp::ValueDesc value_desc(static_cast<synfigapp::ValueDesc>(row[model.value_desc]));
+ if (first)
+ {
+ value_desc = static_cast<synfigapp::ValueDesc>(row[model.value_desc]);
+ first = false;
+ }
+ }
- signal_waypoint_clicked(value_desc,waypoint,button);
+ signal_waypoint_clicked_timetrackview(value_desc,waypoint_set,button,side);
+ }
}
};
Gtk::TreeView* param_tree_view(dynamic_cast<Gtk::TreeView*>(canvas_view->get_ext_widget("params")));
tree_view->mimic(param_tree_view);
- tree_view->signal_waypoint_clicked.connect(sigc::mem_fun(*canvas_view, &studio::CanvasView::on_waypoint_clicked));
+ tree_view->signal_waypoint_clicked_timetrackview.connect(sigc::mem_fun(*canvas_view, &studio::CanvasView::on_waypoint_clicked_canvasview));
canvas_view->time_adjustment().signal_value_changed().connect(sigc::mem_fun(*tree_view,&Gtk::TreeView::queue_draw));
try
{
+ // try to find a waypoint at the current time - if we
+ // can't, we don't want the menu entry - an exception is thrown
WaypointList::iterator iter(value_node->find(canvas->get_time()));
+ std::set<synfig::Waypoint, std::less<UniqueID> > waypoint_set;
+ waypoint_set.insert(*iter);
+
parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Edit Waypoint"),
sigc::bind(
sigc::bind(
sigc::bind(
- sigc::mem_fun(*find_canvas_view(canvas),&studio::CanvasView::on_waypoint_clicked),
+ sigc::bind(
+ sigc::mem_fun(*find_canvas_view(canvas),&studio::CanvasView::on_waypoint_clicked_canvasview),
+ synfig::Waypoint::SIDE_UNSPECIFIED
+ ),
-1
),
- *iter
+ waypoint_set
),
value_desc
)
// Set up the value-node cell-renderer
cellrenderer_time_track=LayerParamTreeStore::add_cell_renderer_value_node(column);
cellrenderer_time_track->property_mode()=Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
- cellrenderer_time_track->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::LayerTree::on_waypoint_clicked) );
+ cellrenderer_time_track->signal_waypoint_clicked_cellrenderer().connect(sigc::mem_fun(*this, &studio::LayerTree::on_waypoint_clicked_layertree) );
cellrenderer_time_track->signal_waypoint_changed().connect(sigc::mem_fun(*this, &studio::LayerTree::on_waypoint_changed) );
column->add_attribute(cellrenderer_time_track->property_value_desc(), param_model.value_desc);
column->add_attribute(cellrenderer_time_track->property_canvas(), param_model.canvas);
}
void
-LayerTree::on_waypoint_clicked(const Glib::ustring &path_string, synfig::Waypoint waypoint,int button)
+LayerTree::on_waypoint_clicked_layertree(const etl::handle<synfig::Node>& node __attribute__ ((unused)),
+ const synfig::Time& time __attribute__ ((unused)),
+ const synfig::Time& time_offset __attribute__ ((unused)),
+ int button __attribute__ ((unused)),
+ synfig::Waypoint::Side side __attribute__ ((unused)))
{
- Gtk::TreePath path(path_string);
-
- const Gtk::TreeRow row = *(get_param_tree_view().get_model()->get_iter(path));
- if(!row)
- return;
+ //! \todo writeme
- signal_waypoint_clicked()(static_cast<synfigapp::ValueDesc>(row[param_model.value_desc]),waypoint,button);
+ // synfigapp::ValueDesc value_desc;
+ // std::set<synfig::Waypoint, std::less<UniqueID> > waypoint_set;
+ // signal_waypoint_clicked_layertree()(value_desc,waypoint_set,button,side);
}
bool
sigc::signal<bool, int, Gtk::TreeRow, ColumnID> signal_param_user_click_;
- sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int> signal_waypoint_clicked_;
+ sigc::signal<void,synfigapp::ValueDesc,std::set<synfig::Waypoint,std::less<synfig::UniqueID> >,int,synfig::Waypoint::Side> signal_waypoint_clicked_layertree_;
bool disable_amount_changed_signal;
void on_layer_toggle(const Glib::ustring& path_string);
- void on_waypoint_clicked(const Glib::ustring &, synfig::Waypoint, int button);
+ void on_waypoint_clicked_layertree(const etl::handle<synfig::Node>& node, const synfig::Time&, const synfig::Time&, int button, synfig::Waypoint::Side side);
void on_waypoint_changed( synfig::Waypoint waypoint , synfig::ValueNode::Handle value_node);
sigc::signal<bool,int, Gtk::TreeRow, ColumnID>& signal_param_user_click() { return signal_param_user_click_; }
- sigc::signal<void,synfigapp::ValueDesc,synfig::Waypoint,int>& signal_waypoint_clicked() { return signal_waypoint_clicked_; }
+ sigc::signal<void,synfigapp::ValueDesc,std::set<synfig::Waypoint,std::less<synfig::UniqueID> >,int,synfig::Waypoint::Side>& signal_waypoint_clicked_layertree() { return signal_waypoint_clicked_layertree_; }
etl::handle<synfigapp::SelectionManager> get_selection_manager() { return layer_tree_store_->canvas_interface()->get_selection_manager(); }