mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
scroll up/down by tracks uses top edge as "focal point"; fix some other nasty code details
This commit is contained in:
parent
acc1977cbd
commit
d0bc4b55fa
5 changed files with 39 additions and 40 deletions
|
|
@ -180,7 +180,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
void set_internal_edit (bool yn);
|
void set_internal_edit (bool yn);
|
||||||
bool toggle_internal_editing_from_double_click (GdkEvent*);
|
bool toggle_internal_editing_from_double_click (GdkEvent*);
|
||||||
|
|
||||||
void _ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
|
|
||||||
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
|
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
|
||||||
void add_to_idle_resize (TimeAxisView*, int32_t);
|
void add_to_idle_resize (TimeAxisView*, int32_t);
|
||||||
|
|
||||||
|
|
@ -285,6 +284,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
framecnt_t get_current_zoom () const { return samples_per_pixel; }
|
framecnt_t get_current_zoom () const { return samples_per_pixel; }
|
||||||
void cycle_zoom_focus ();
|
void cycle_zoom_focus ();
|
||||||
void temporal_zoom_step (bool coarser);
|
void temporal_zoom_step (bool coarser);
|
||||||
|
void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top);
|
||||||
void tav_zoom_step (bool coarser);
|
void tav_zoom_step (bool coarser);
|
||||||
void tav_zoom_smooth (bool coarser, bool force_all);
|
void tav_zoom_smooth (bool coarser, bool force_all);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -805,7 +805,7 @@ Editor::entered_track_canvas (GdkEventCrossing */*ev*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::_ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_top)
|
Editor::ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_top)
|
||||||
{
|
{
|
||||||
if (track.hidden()) {
|
if (track.hidden()) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -822,19 +822,28 @@ Editor::_ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_t
|
||||||
double const track_max_y = track.y_position () + track.effective_height ();
|
double const track_max_y = track.y_position () + track.effective_height ();
|
||||||
|
|
||||||
if (!at_top &&
|
if (!at_top &&
|
||||||
(track_min_y > current_view_min_y &&
|
(track_min_y >= current_view_min_y &&
|
||||||
track_max_y <= current_view_max_y)) {
|
track_max_y < current_view_max_y)) {
|
||||||
|
/* already visible, and caller did not ask to place it at the
|
||||||
|
* top of the track canvas
|
||||||
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double new_value;
|
double new_value;
|
||||||
|
|
||||||
if (track_min_y < current_view_min_y) {
|
if (at_top) {
|
||||||
// Track is above the current view
|
|
||||||
new_value = track_min_y;
|
new_value = track_min_y;
|
||||||
} else {
|
} else {
|
||||||
// Track is below the current view
|
if (track_min_y < current_view_min_y) {
|
||||||
new_value = track.y_position () + track.effective_height() - vertical_adjustment.get_page_size();
|
// Track is above the current view
|
||||||
|
new_value = track_min_y;
|
||||||
|
} else if (track_max_y > current_view_max_y) {
|
||||||
|
// Track is below the current view
|
||||||
|
new_value = track.y_position () + track.effective_height() - vertical_adjustment.get_page_size();
|
||||||
|
} else {
|
||||||
|
new_value = track_min_y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vertical_adjustment.set_value(new_value);
|
vertical_adjustment.set_value(new_value);
|
||||||
|
|
|
||||||
|
|
@ -1364,32 +1364,35 @@ Editor::scroll_tracks_up_line ()
|
||||||
bool
|
bool
|
||||||
Editor::scroll_down_one_track ()
|
Editor::scroll_down_one_track ()
|
||||||
{
|
{
|
||||||
TrackViewList::reverse_iterator next = track_views.rend();
|
TrackViewList::reverse_iterator next = track_views.rbegin();
|
||||||
std::pair<TimeAxisView*,double> res;
|
std::pair<TimeAxisView*,double> res;
|
||||||
const double bottom_of_trackviews = vertical_adjustment.get_value() + vertical_adjustment.get_page_size() - 1;
|
const double top_of_trackviews = vertical_adjustment.get_value();
|
||||||
|
|
||||||
for (TrackViewList::reverse_iterator t = track_views.rbegin(); t != track_views.rend(); ++t) {
|
for (TrackViewList::reverse_iterator t = track_views.rbegin(); t != track_views.rend(); ++t) {
|
||||||
if ((*t)->hidden()) {
|
if ((*t)->hidden()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is the bottom visible trackview, we want to display
|
next = t;
|
||||||
the next one.
|
if (next != track_views.rbegin()) {
|
||||||
|
--next; // moves "next" towards the lower/later tracks since it is a reverse iterator
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If this is the upper-most visible trackview, we want to display
|
||||||
|
the one above it (next)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
res = (*t)->covers_y_position (bottom_of_trackviews);
|
res = (*t)->covers_y_position (top_of_trackviews);
|
||||||
|
|
||||||
if (res.first) {
|
if (res.first) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
++next; // moves "next" towards the "front" since it is a reverse iterator
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move to the track below the first one that covers the */
|
/* move to the track below the first one that covers the */
|
||||||
|
|
||||||
if (next != track_views.rend()) {
|
if (next != track_views.rbegin()) {
|
||||||
ensure_time_axis_view_is_visible (**next);
|
ensure_time_axis_view_is_visible (**next, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1399,11 +1402,10 @@ Editor::scroll_down_one_track ()
|
||||||
bool
|
bool
|
||||||
Editor::scroll_up_one_track ()
|
Editor::scroll_up_one_track ()
|
||||||
{
|
{
|
||||||
double vertical_pos = vertical_adjustment.get_value ();
|
|
||||||
|
|
||||||
TrackViewList::iterator prev = track_views.end();
|
TrackViewList::iterator prev = track_views.end();
|
||||||
std::pair<TimeAxisView*,double> res;
|
std::pair<TimeAxisView*,double> res;
|
||||||
|
double top_of_trackviews = vertical_adjustment.get_value ();
|
||||||
|
|
||||||
for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) {
|
for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) {
|
||||||
|
|
||||||
if ((*t)->hidden()) {
|
if ((*t)->hidden()) {
|
||||||
|
|
@ -1411,10 +1413,9 @@ Editor::scroll_up_one_track ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find the trackview at the top of the trackview group */
|
/* find the trackview at the top of the trackview group */
|
||||||
res = (*t)->covers_y_position (vertical_pos);
|
res = (*t)->covers_y_position (top_of_trackviews);
|
||||||
|
|
||||||
if (res.first) {
|
if (res.first) {
|
||||||
cerr << res.first->name() << " covers the top\n";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1422,7 +1423,7 @@ Editor::scroll_up_one_track ()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev != track_views.end()) {
|
if (prev != track_views.end()) {
|
||||||
ensure_time_axis_view_is_visible (**prev);
|
ensure_time_axis_view_is_visible (**prev, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5637,7 +5638,7 @@ Editor::select_next_route()
|
||||||
|
|
||||||
selection->set(current);
|
selection->set(current);
|
||||||
|
|
||||||
ensure_time_axis_view_is_visible (*current);
|
ensure_time_axis_view_is_visible (*current, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -5668,7 +5669,7 @@ Editor::select_prev_route()
|
||||||
|
|
||||||
selection->set (current);
|
selection->set (current);
|
||||||
|
|
||||||
ensure_time_axis_view_is_visible (*current);
|
ensure_time_axis_view_is_visible (*current, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -276,11 +276,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
|
||||||
virtual framecnt_t current_page_samples() const = 0;
|
virtual framecnt_t current_page_samples() const = 0;
|
||||||
virtual double visible_canvas_height () const = 0;
|
virtual double visible_canvas_height () const = 0;
|
||||||
virtual void temporal_zoom_step (bool coarser) = 0;
|
virtual void temporal_zoom_step (bool coarser) = 0;
|
||||||
/* The virtual version, without a default argument, is protected below.
|
virtual void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top = false) = 0;
|
||||||
*/
|
|
||||||
void ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top = false) {
|
|
||||||
_ensure_time_axis_view_is_visible (tav, at_top);
|
|
||||||
}
|
|
||||||
virtual void override_visible_track_count () = 0;
|
virtual void override_visible_track_count () = 0;
|
||||||
virtual void scroll_tracks_down_line () = 0;
|
virtual void scroll_tracks_down_line () = 0;
|
||||||
virtual void scroll_tracks_up_line () = 0;
|
virtual void scroll_tracks_up_line () = 0;
|
||||||
|
|
@ -429,13 +425,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
|
||||||
PBD::Signal0<void> MouseModeChanged;
|
PBD::Signal0<void> MouseModeChanged;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* This _ variant of ensure_time_axis_view_is_visible exists because
|
|
||||||
C++ doesn't really like default values for virtual methods. So the
|
|
||||||
public version is non-virtual, with a default value; the virtual
|
|
||||||
(and protected) method here does not have a default value.
|
|
||||||
*/
|
|
||||||
virtual void _ensure_time_axis_view_is_visible (TimeAxisView const & tav, bool at_top) = 0;
|
|
||||||
|
|
||||||
friend class DisplaySuspender;
|
friend class DisplaySuspender;
|
||||||
virtual void suspend_route_redisplay () = 0;
|
virtual void suspend_route_redisplay () = 0;
|
||||||
virtual void resume_route_redisplay () = 0;
|
virtual void resume_route_redisplay () = 0;
|
||||||
|
|
|
||||||
|
|
@ -675,7 +675,7 @@ TimeAxisView::end_name_edit (int response)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
|
if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
|
||||||
_editor.ensure_time_axis_view_is_visible (**i);
|
_editor.ensure_time_axis_view_is_visible (**i, false);
|
||||||
(*i)->begin_name_edit ();
|
(*i)->begin_name_edit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -706,7 +706,7 @@ TimeAxisView::end_name_edit (int response)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
|
if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
|
||||||
_editor.ensure_time_axis_view_is_visible (**i);
|
_editor.ensure_time_axis_view_is_visible (**i, false);
|
||||||
(*i)->begin_name_edit ();
|
(*i)->begin_name_edit ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue