add optional arg to Editor::ensure_time_axis_view_is_visible() to "force" "make it visible as the top track" behaviour
This commit is contained in:
parent
6f3ebba3b6
commit
95f81e2d24
|
@ -178,6 +178,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 foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
|
||||
void add_to_idle_resize (TimeAxisView*, int32_t);
|
||||
|
||||
|
@ -350,7 +351,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
|
||||
void show_window ();
|
||||
|
||||
void ensure_time_axis_view_is_visible (const TimeAxisView& tav);
|
||||
void scroll_tracks_down_line ();
|
||||
void scroll_tracks_up_line ();
|
||||
bool scroll_up_one_track ();
|
||||
|
|
|
@ -731,19 +731,26 @@ Editor::entered_track_canvas (GdkEventCrossing */*ev*/)
|
|||
}
|
||||
|
||||
void
|
||||
Editor::ensure_time_axis_view_is_visible (const TimeAxisView& tav)
|
||||
Editor::_ensure_time_axis_view_is_visible (const TimeAxisView& tav, bool at_top)
|
||||
{
|
||||
double begin = tav.y_position();
|
||||
|
||||
double v = vertical_adjustment.get_value ();
|
||||
|
||||
if (begin < v || begin + tav.current_height() > v + _visible_canvas_height) {
|
||||
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;
|
||||
}
|
||||
vertical_adjustment.set_value (begin);
|
||||
}
|
||||
|
||||
/* Clamp the y pos so that we do not extend beyond the canvas full
|
||||
* height.
|
||||
*/
|
||||
if (_full_canvas_height - begin < _visible_canvas_height){
|
||||
begin = _full_canvas_height - _visible_canvas_height;
|
||||
}
|
||||
|
||||
vertical_adjustment.set_value (begin);
|
||||
}
|
||||
|
||||
/** Called when the main vertical_adjustment has changed */
|
||||
|
|
|
@ -1293,7 +1293,7 @@ EditorRoutes::button_press (GdkEventButton* ev)
|
|||
TimeAxisView *tv = row[_columns.tv];
|
||||
|
||||
if (tv) {
|
||||
_editor->ensure_time_axis_view_is_visible (*tv);
|
||||
_editor->ensure_time_axis_view_is_visible (*tv, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1322,7 +1322,7 @@ EditorRoutes::selection_changed ()
|
|||
}
|
||||
|
||||
_editor->get_selection().set (selected);
|
||||
_editor->ensure_time_axis_view_is_visible (*(selected.front()));
|
||||
_editor->ensure_time_axis_view_is_visible (*(selected.front()), true);
|
||||
|
||||
} else {
|
||||
_editor->get_selection().clear_tracks ();
|
||||
|
|
|
@ -267,7 +267,9 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
|
|||
virtual framecnt_t current_page_samples() const = 0;
|
||||
virtual double visible_canvas_height () const = 0;
|
||||
virtual void temporal_zoom_step (bool coarser) = 0;
|
||||
virtual void ensure_time_axis_view_is_visible (const TimeAxisView& tav) = 0;
|
||||
virtual void ensure_time_axis_view_is_visible (const TimeAxisView& tav, bool at_top = false) {
|
||||
_ensure_time_axis_view_is_visible (tav, at_top);
|
||||
}
|
||||
virtual void scroll_tracks_down_line () = 0;
|
||||
virtual void scroll_tracks_up_line () = 0;
|
||||
virtual bool scroll_down_one_track () = 0;
|
||||
|
@ -409,6 +411,9 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
|
|||
|
||||
PBD::Signal0<void> SnapChanged;
|
||||
PBD::Signal0<void> MouseModeChanged;
|
||||
|
||||
protected:
|
||||
virtual void _ensure_time_axis_view_is_visible (const TimeAxisView& tav, bool at_top) = 0;
|
||||
};
|
||||
|
||||
#endif // __gtk_ardour_public_editor_h__
|
||||
|
|
Loading…
Reference in New Issue