summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_summary.cc
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2017-07-19 08:12:25 -0500
committerBen Loftis <ben@harrisonconsoles.com>2017-07-19 08:12:25 -0500
commit255d633eddc1d4b8242dd1c4601ace9ce637bccd (patch)
tree7e9d65602646ae249a039c60d54f9679cfb86b3c /gtk2_ardour/editor_summary.cc
parent1955ff3ad2315fb6377140d45a133d041c1c9dc1 (diff)
Editor Summary: implement summary_zoom_step() to lessen redundant code.
Diffstat (limited to 'gtk2_ardour/editor_summary.cc')
-rw-r--r--gtk2_ardour/editor_summary.cc48
1 files changed, 23 insertions, 25 deletions
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc
index da0174f103..3296ce0910 100644
--- a/gtk2_ardour/editor_summary.cc
+++ b/gtk2_ardour/editor_summary.cc
@@ -544,6 +544,25 @@ EditorSummary::set_cursor (Position p)
}
}
+void
+EditorSummary::summary_zoom_step ( int steps /* negative steps to zoom "out" , positive steps to zoom "in" */ )
+{
+ pair<double, double> xn;
+
+ get_editor (&xn);
+// {
+// xn.first = (_editor->leftmost_sample () - _start) * _x_scale;
+// xn.second = xn.first + _editor->current_page_samples() * _x_scale;
+// }
+
+ xn.first += steps;
+ xn.second -= steps;
+
+ set_overlays_dirty ();
+ set_editor_x (xn);
+}
+
+
bool
EditorSummary::on_motion_notify_event (GdkEventMotion* ev)
{
@@ -570,15 +589,8 @@ EditorSummary::on_motion_notify_event (GdkEventMotion* ev)
double const dy = ev->y - _zoom_last_y;
- pair<double, double> xn;
- get_editor (&xn);
+ summary_zoom_step( dy );
- xn.first -= dy;
- xn.second += dy;
-
- set_overlays_dirty ();
- set_editor_x (xn);
-
_zoom_last_y = ev->y;
} else if (_zoom_trim_dragging) {
@@ -675,29 +687,15 @@ EditorSummary::on_scroll_event (GdkEventScroll* ev)
switch (ev->direction) {
case GDK_SCROLL_UP: {
- //ToDo: use function summary_zoom_in/out
- pair<double, double> xn;
- get_editor (&xn);
-
- xn.first += 2;
- xn.second -= 2;
-
- set_overlays_dirty ();
- set_editor_x (xn);
+ summary_zoom_step( -2 );
return true;
} break;
case GDK_SCROLL_DOWN: {
- pair<double, double> xn;
- get_editor (&xn);
-
- xn.first -= 2;
- xn.second += 2;
-
- set_overlays_dirty ();
- set_editor_x (xn);
+
+ summary_zoom_step( 2 );
return true;
} break;