summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_mixer.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-08-12 19:43:09 +0000
committerDavid Robillard <d@drobilla.net>2006-08-12 19:43:09 +0000
commita98a67120eea8ebb817eebea048affc182ea054e (patch)
tree2c8c9db7c0d8d18bf5185e10d471d6daa7a7de3d /gtk2_ardour/editor_mixer.cc
parent30ab1fd61569f9d7fb7410d483fa68cbf9865c37 (diff)
Merged with trunk R795
Fiddled with scrolling to leave a bit of context on each side. 'scroll interval' is a single float, should make it a configuration variable some day git-svn-id: svn://localhost/ardour2/branches/midi@796 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_mixer.cc')
-rw-r--r--gtk2_ardour/editor_mixer.cc29
1 files changed, 20 insertions, 9 deletions
diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc
index 246dbdc647..9fa1a0b0b6 100644
--- a/gtk2_ardour/editor_mixer.cc
+++ b/gtk2_ardour/editor_mixer.cc
@@ -165,19 +165,30 @@ Editor::update_current_screen ()
if (_follow_playhead) {
- playhead_cursor->canvas_item.show();
+
+ playhead_cursor->canvas_item.show();
if (frame != last_update_frame) {
+ const jack_nframes_t page_width = current_page_frames();
+
+ // Percentage width of the visible range to use as a scroll interval
+ // Idea: snap this to the nearest bar/beat/tick/etc, would make scrolling much
+ // less jarring when zoomed in.. and it would be fun to watch :)
+ static const double scroll_pct = 3.0/4.0;
+
+ const jack_nframes_t rightmost_frame = leftmost_frame + page_width;
+ const jack_nframes_t scroll_interval = (jack_nframes_t)(page_width * scroll_pct);
+ const jack_nframes_t padding = (jack_nframes_t)floor((page_width-scroll_interval) / 2.0);
+
+ if (frame < leftmost_frame + padding || frame > rightmost_frame - padding) {
- if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
-
if (session->transport_speed() < 0) {
- if (frame > (current_page_frames()/2)) {
- center_screen (frame-(current_page_frames()/2));
+ if (frame > scroll_interval) {
+ center_screen (frame - scroll_interval/2);
} else {
- center_screen (current_page_frames()/2);
+ center_screen (scroll_interval);
}
} else {
- center_screen (frame+(current_page_frames()/2));
+ center_screen(frame + scroll_interval/2);
}
}
@@ -185,7 +196,7 @@ Editor::update_current_screen ()
}
} else {
-
+
if (frame != last_update_frame) {
if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
playhead_cursor->canvas_item.hide();
@@ -200,7 +211,7 @@ Editor::update_current_screen ()
if (current_mixer_strip) {
current_mixer_strip->fast_update ();
}
-
+
}
}