return *node;
}
-/** @param y y is an offset into the trackview area, in pixel units
+/** if @param trackview_relative_offset is true, @param y y is an offset into the trackview area, in pixel units
+ * if @param trackview_relative_offset is false, @param y y is a global canvas * coordinate, in pixel units
*
* @return pair: TimeAxisView that y is over, layer index.
*
* in stacked or expanded region display mode, otherwise 0.
*/
std::pair<TimeAxisView *, double>
-Editor::trackview_by_y_position (double y)
+Editor::trackview_by_y_position (double y, bool trackview_relative_offset)
{
+ if (!trackview_relative_offset) {
+ y -= _trackview_group->canvas_origin().y;
+ }
+
if (y < 0) {
return std::make_pair ( (TimeAxisView *) 0, 0);
}
-
+
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
std::pair<TimeAxisView*, double> const r = (*iter)->covers_y_position (y);
return r;
}
}
+
+ return std::make_pair ( (TimeAxisView *) 0, 0);
}
/** Snap a position to the grid, if appropriate, taking into account current
/* track views */
TrackViewList track_views;
- std::pair<TimeAxisView*, double> trackview_by_y_position (double);
+ std::pair<TimeAxisView*, double> trackview_by_y_position (double, bool trackview_relative_offset = true);
RouteTimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const;
TrackViewList get_tracks_for_range_action () const;
}
/** Update _join_object_range_state which indicate whether we are over the top or bottom half of a region view,
- * used by the `join object/range' tool mode.
+ * used by the `join object/range' tool mode. Coordinates in canvas space.
*/
void
Editor::update_join_object_range_location (double /*x*/, double y)
}
/* XXX: maybe we should make entered_track work in all cases, rather than resorting to this */
- pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
+ pair<TimeAxisView*, int> tvp = trackview_by_y_position (y, false);
if (tvp.first) {