Improve the waypoint context menus. Now it's possible to delete and duplicate comple...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 4 Feb 2008 23:35:30 +0000 (23:35 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 4 Feb 2008 23:35:30 +0000 (23:35 +0000)
git-svn-id: http://svn.voria.com/code@1584 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/waypoint.h
synfig-studio/trunk/src/gtkmm/canvasview.cpp
synfig-studio/trunk/src/gtkmm/canvasview.h
synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp
synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.h
synfig-studio/trunk/src/gtkmm/childrentree.cpp
synfig-studio/trunk/src/gtkmm/childrentree.h
synfig-studio/trunk/src/gtkmm/dock_timetrack.cpp
synfig-studio/trunk/src/gtkmm/instance.cpp
synfig-studio/trunk/src/gtkmm/layertree.cpp
synfig-studio/trunk/src/gtkmm/layertree.h

index 3536839..4420f48 100644 (file)
@@ -145,6 +145,13 @@ public:
                }
        };
 
+       enum Side
+       {
+               SIDE_UNSPECIFIED, SIDE_LEFT, SIDE_RIGHT,
+
+           SIDE_END=2                          //!< \internal
+       };
+
        /*
  --    ** -- D A T A -------------------------------------------------------------
        */
index 47a92d5..7ebbcdb 100644 (file)
@@ -1073,7 +1073,7 @@ CanvasView::on_current_time_widget_changed()
 //             // 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;
@@ -1155,7 +1155,7 @@ CanvasView::on_current_time_widget_changed()
 //             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();
@@ -3090,66 +3090,160 @@ CanvasView::set_sensitive_timebar(bool sensitive)
 }
 
 
+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;
        }
@@ -3658,13 +3752,13 @@ CanvasView::set_ext_widget(const synfig::String& x, Gtk::Widget* y)
                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")
index 112b166..40003d2 100644 (file)
@@ -594,7 +594,7 @@ public:
 
        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();}
 
@@ -681,8 +681,6 @@ private:
 
        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();
index f57b9a1..21ff895 100644 (file)
@@ -46,8 +46,6 @@
 #include <synfigapp/canvasinterface.h>
 #include "instance.h"
 
-#include <synfig/timepointcollect.h>
-
 #include "general.h"
 
 #endif
@@ -765,7 +763,7 @@ CellRenderer_TimeTrack::activate_vfunc(
 
                                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);
                                }
                        }
 
@@ -783,7 +781,7 @@ CellRenderer_TimeTrack::activate_vfunc(
 
                        /*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;
                        }
                        */
@@ -844,7 +842,7 @@ CellRenderer_TimeTrack::activate_vfunc(
                        /*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)
                                {
@@ -904,141 +902,8 @@ CellRenderer_TimeTrack::set_canvas_interface(etl::loose_handle<synfigapp::Canvas
        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);
 }
index 98af667..39e3f3a 100644 (file)
 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.
 */
@@ -90,7 +84,7 @@ private:
        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_;
 
@@ -158,8 +152,8 @@ public:
 
 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_; }
@@ -173,7 +167,7 @@ public:
        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();
index deb4334..5a03b88 100644 (file)
@@ -141,7 +141,7 @@ ChildrenTree::ChildrenTree()
                // 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);
 
@@ -278,13 +278,16 @@ ChildrenTree::on_edited_value(const Glib::ustring&path_string,synfig::ValueBase
 }
 
 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
index 504ad2f..b82cbbc 100644 (file)
@@ -98,7 +98,7 @@ private:
 
        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;
@@ -121,7 +121,7 @@ private:
 
        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);
 
@@ -164,7 +164,7 @@ public:
 
        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(); }
 
index 8b1e312..b3dc0bf 100644 (file)
@@ -45,6 +45,7 @@
 #include "widget_timeslider.h"
 #include "layerparamtreestore.h"
 #include "general.h"
+#include <synfig/timepointcollect.h>
 
 #endif
 
@@ -68,7 +69,7 @@ class TimeTrackView : public Gtk::TreeView
        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;
 
@@ -88,7 +89,7 @@ public:
                        // 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);
@@ -365,32 +366,43 @@ public:
        }
 
        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);
+               }
        }
 };
 
@@ -442,7 +454,7 @@ Dock_Timetrack::init_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view
        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));
index 8ac71f2..e148787 100644 (file)
@@ -1065,15 +1065,23 @@ Instance::make_param_menu(Gtk::Menu *menu,synfig::Canvas::Handle canvas, synfiga
 
                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
                                )
index eeb47f0..b914568 100644 (file)
@@ -360,7 +360,7 @@ LayerTree::create_param_tree()
                // 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);
@@ -722,15 +722,17 @@ LayerTree::on_layer_toggle(const Glib::ustring& path_string)
 }
 
 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
index 77bd6e1..97b1195 100644 (file)
@@ -138,7 +138,7 @@ private:
 
        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;
 
@@ -170,7 +170,7 @@ private:
 
        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);
 
@@ -234,7 +234,7 @@ public:
 
        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(); }