mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-21 22:26:29 +01:00
replace old implementation of Editor::_ensure_time_axis_view_is_visible() with the guts of Editor::ensure_track_is_visible(), then remove the latter.
Also change all users of ensure_track_is_visible() to use _ensure_time_axis_view_is_visible()
This commit is contained in:
parent
91fa5f7b2a
commit
21c26c8688
3 changed files with 32 additions and 55 deletions
|
|
@ -185,7 +185,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
void set_internal_edit (bool yn);
|
||||
bool toggle_internal_editing_from_double_click (GdkEvent*);
|
||||
|
||||
void _ensure_time_axis_view_is_visible (const TimeAxisView& tav, bool at_top);
|
||||
void _ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
|
||||
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
|
||||
void add_to_idle_resize (TimeAxisView*, int32_t);
|
||||
|
||||
|
|
@ -1976,7 +1976,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
bool entered_track_canvas (GdkEventCrossing*);
|
||||
void set_entered_track (TimeAxisView*);
|
||||
void set_entered_regionview (RegionView*);
|
||||
void ensure_track_visible (TimeAxisView*);
|
||||
gint left_automation_track ();
|
||||
|
||||
void reset_canvas_action_sensitivity (bool);
|
||||
|
|
|
|||
|
|
@ -805,26 +805,39 @@ Editor::entered_track_canvas (GdkEventCrossing */*ev*/)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::_ensure_time_axis_view_is_visible (const TimeAxisView& tav, bool at_top)
|
||||
Editor::_ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_top)
|
||||
{
|
||||
double begin = tav.y_position();
|
||||
double v = vertical_adjustment.get_value ();
|
||||
|
||||
if (!at_top && (begin < v || begin + tav.current_height() > v + _visible_canvas_height)) {
|
||||
/* try to put the TimeAxisView roughly central */
|
||||
if (begin >= _visible_canvas_height/2.0) {
|
||||
begin -= _visible_canvas_height/2.0;
|
||||
}
|
||||
if (track.hidden()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Clamp the y pos so that we do not extend beyond the canvas full
|
||||
* height.
|
||||
/* compute visible area of trackview group, as offsets from top of
|
||||
* trackview group.
|
||||
*/
|
||||
if (_full_canvas_height - begin < _visible_canvas_height){
|
||||
begin = _full_canvas_height - _visible_canvas_height;
|
||||
|
||||
double const current_view_min_y = vertical_adjustment.get_value();
|
||||
double const current_view_max_y = current_view_min_y + vertical_adjustment.get_page_size();
|
||||
|
||||
double const track_min_y = track.y_position ();
|
||||
double const track_max_y = track.y_position () + track.effective_height ();
|
||||
|
||||
if (!at_top &&
|
||||
(track_min_y > current_view_min_y &&
|
||||
track_max_y <= current_view_max_y)) {
|
||||
return;
|
||||
}
|
||||
|
||||
vertical_adjustment.set_value (begin);
|
||||
double new_value;
|
||||
|
||||
if (track_min_y < current_view_min_y) {
|
||||
// Track is above the current view
|
||||
new_value = track_min_y;
|
||||
} else {
|
||||
// Track is below the current view
|
||||
new_value = track.y_position () + track.effective_height() - vertical_adjustment.get_page_size();
|
||||
}
|
||||
|
||||
vertical_adjustment.set_value(new_value);
|
||||
}
|
||||
|
||||
/** Called when the main vertical_adjustment has changed */
|
||||
|
|
|
|||
|
|
@ -1358,7 +1358,7 @@ Editor::scroll_down_one_track ()
|
|||
/* move to the track below the first one that covers the */
|
||||
|
||||
if (next != track_views.rend()) {
|
||||
ensure_track_visible (*next);
|
||||
ensure_time_axis_view_is_visible (**next);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1391,7 +1391,7 @@ Editor::scroll_up_one_track ()
|
|||
}
|
||||
|
||||
if (prev != track_views.end()) {
|
||||
ensure_track_visible (*prev);
|
||||
ensure_time_axis_view_is_visible (**prev);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -5657,7 +5657,7 @@ Editor::select_next_route()
|
|||
|
||||
selection->set(current);
|
||||
|
||||
ensure_track_visible(current);
|
||||
ensure_time_axis_view_is_visible (*current);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -5688,42 +5688,7 @@ Editor::select_prev_route()
|
|||
|
||||
selection->set (current);
|
||||
|
||||
ensure_track_visible(current);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::ensure_track_visible(TimeAxisView *track)
|
||||
{
|
||||
if (track->hidden()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* compute visible area of trackview group, as offsets from top of
|
||||
* trackview group.
|
||||
*/
|
||||
|
||||
double const current_view_min_y = vertical_adjustment.get_value();
|
||||
double const current_view_max_y = current_view_min_y + vertical_adjustment.get_page_size();
|
||||
|
||||
double const track_min_y = track->y_position ();
|
||||
double const track_max_y = track->y_position () + track->effective_height ();
|
||||
|
||||
if (track_min_y > current_view_min_y &&
|
||||
track_max_y <= current_view_max_y) {
|
||||
return;
|
||||
}
|
||||
|
||||
double new_value;
|
||||
|
||||
if (track_min_y < current_view_min_y) {
|
||||
// Track is above the current view
|
||||
new_value = track_min_y;
|
||||
} else {
|
||||
// Track is below the current view
|
||||
new_value = track->y_position () + track->effective_height() - vertical_adjustment.get_page_size();
|
||||
}
|
||||
|
||||
vertical_adjustment.set_value(new_value);
|
||||
ensure_time_axis_view_is_visible (*current);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue