fix problem with calls to Editor::trackview_by_y_position() when using motion events. The coordinate passed in was in canvas space and the method expected trackview space
To handle any further issues like this, I generalized and added an optional argument specifying that the canvas=>trackview transform is required, thus centralizing where this done.
This commit is contained in:
parent
b86e1204ec
commit
92bb0e0d7f
|
@ -2421,7 +2421,8 @@ Editor::get_state ()
|
|||
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.
|
||||
*
|
||||
|
@ -2429,12 +2430,16 @@ Editor::get_state ()
|
|||
* 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);
|
||||
|
@ -2443,6 +2448,8 @@ Editor::trackview_by_y_position (double y)
|
|||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_pair ( (TimeAxisView *) 0, 0);
|
||||
}
|
||||
|
||||
/** Snap a position to the grid, if appropriate, taking into account current
|
||||
|
|
|
@ -1054,7 +1054,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
|
||||
/* 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;
|
||||
|
|
|
@ -2839,7 +2839,7 @@ Editor::set_internal_edit (bool yn)
|
|||
}
|
||||
|
||||
/** 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)
|
||||
|
@ -2864,7 +2864,7 @@ 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) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user