When right-clicking on a simple waypoint in a PasteCanvas' 'canvas' parameter, pop...
[synfig.git] / synfig-studio / trunk / src / gtkmm / cellrenderer_timetrack.cpp
index 0e11f39..1a91215 100644 (file)
@@ -746,8 +746,9 @@ CellRenderer_TimeTrack::activate_vfunc(
                                Time stime;
                                synfigapp::ValueDesc valdesc = property_value_desc().get_value();
                                const Node::time_set *tset = get_times_from_vdesc(valdesc);
+                               synfig::Time time_offset = get_time_offset_from_vdesc(valdesc);
 
-                               bool clickfound = tset && get_closest_time(*tset,actual_time+get_time_offset_from_vdesc(valdesc),pixel_width*cell_area.get_height(),stime);
+                               bool clickfound = tset && get_closest_time(*tset,actual_time+time_offset,pixel_width*cell_area.get_height(),stime);
 
                                etl::handle<synfig::Node> node;
                                if(valdesc.get_value(stime).get_type()==ValueBase::TYPE_CANVAS)
@@ -761,7 +762,7 @@ CellRenderer_TimeTrack::activate_vfunc(
 
                                if(clickfound && node)
                                {
-                                       show_timepoint_menu(node, stime, actual_time<stime?SIDE_LEFT:SIDE_RIGHT);
+                                       show_timepoint_menu(node, stime, time_offset, actual_time+time_offset<stime?SIDE_LEFT:SIDE_RIGHT);
                                }
                        }
 
@@ -930,7 +931,7 @@ set_waypoint_model(std::set<synfig::Waypoint, std::less<UniqueID> > waypoints, W
 }
 
 void
-CellRenderer_TimeTrack::show_timepoint_menu(const etl::handle<synfig::Node>& node, const synfig::Time& time, Side side)
+CellRenderer_TimeTrack::show_timepoint_menu(const etl::handle<synfig::Node>& node, const synfig::Time& time, const synfig::Time& time_offset, Side side)
 {
        std::set<synfig::Waypoint, std::less<UniqueID> > waypoint_set;
        int n;
@@ -1012,13 +1013,15 @@ CellRenderer_TimeTrack::show_timepoint_menu(const etl::handle<synfig::Node>& nod
                                *canvas_interface(),
                                &synfigapp::CanvasInterface::set_time
                        ),
-                       time
+                       time - time_offset
                )
        ));
 
        if(!waypoint_set.empty())
        {
-               if(waypoint_set.size()==1)
+               // 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;