summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_canvas.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-07-14 12:36:44 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-07-14 12:36:51 -0400
commitd0bc4b55faa25e754d1f15eab4656434aba1a568 (patch)
tree3a07c0fd68ae69b774657c97bb1e8454c4705ee4 /gtk2_ardour/editor_canvas.cc
parentacc1977cbd6699f25a2081184f9fc63e7714f2b9 (diff)
scroll up/down by tracks uses top edge as "focal point"; fix some other nasty code details
Diffstat (limited to 'gtk2_ardour/editor_canvas.cc')
-rw-r--r--gtk2_ardour/editor_canvas.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index c64ee7ccc2..c518472f0c 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -805,7 +805,7 @@ Editor::entered_track_canvas (GdkEventCrossing */*ev*/)
}
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()) {
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 ();
if (!at_top &&
- (track_min_y > current_view_min_y &&
- track_max_y <= current_view_max_y)) {
+ (track_min_y >= current_view_min_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;
}
double new_value;
- if (track_min_y < current_view_min_y) {
- // Track is above the current view
+ if (at_top) {
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();
+ if (track_min_y < current_view_min_y) {
+ // 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);