summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-01-07 11:26:22 +1000
committerTim Mayberry <mojofunk@gmail.com>2016-01-21 11:25:56 +1000
commit08cbe0532cdb948d993530028dd4e2e1194feea5 (patch)
tree3b29d049f4ee6375076575a428c43d4d43ba7458 /gtk2_ardour/editor_ops.cc
parent743e324c6a25a545f7a03bc0c6d16a421116f7f0 (diff)
Refactor scrolling in Editor ruler canvas area into two utility methods
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 33e5e80efa..d0b24be866 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -1614,6 +1614,28 @@ Editor::scroll_right_step ()
}
}
+void
+Editor::scroll_left_half_page ()
+{
+ framepos_t xdelta = (current_page_samples() / 2);
+ if (leftmost_frame > xdelta) {
+ reset_x_origin (leftmost_frame - xdelta);
+ } else {
+ reset_x_origin (0);
+ }
+}
+
+void
+Editor::scroll_right_half_page ()
+{
+ framepos_t xdelta = (current_page_samples() / 2);
+ if (max_framepos - xdelta > leftmost_frame) {
+ reset_x_origin (leftmost_frame + xdelta);
+ } else {
+ reset_x_origin (max_framepos - current_page_samples());
+ }
+}
+
/* ZOOM */
void