From 74796c7a531d71f29c9e603fe33998f19cb96622 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 14 Sep 2011 13:57:20 +0000 Subject: [PATCH] Clamp left hand side zoom drags of the summary (fixes #4317). git-svn-id: svn://localhost/ardour2/branches/3.0@10075 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_summary.cc | 22 +++++++++++++++++----- gtk2_ardour/editor_summary.h | 8 ++++---- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index 1c9ca94021..0c6f1cac58 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -608,7 +608,7 @@ EditorSummary::set_editor (double const x, double const y) * x and y parameters are specified in summary coordinates. */ void -EditorSummary::set_editor (pair const & x, double const y) +EditorSummary::set_editor (pair const x, double const y) { if (_editor->pending_visual_change.idle_handler_id >= 0) { /* see comment in other set_editor () */ @@ -624,7 +624,7 @@ EditorSummary::set_editor (pair const & x, double const y) * x and y parameters are specified in summary coordinates. */ void -EditorSummary::set_editor (pair const & x, pair const & y) +EditorSummary::set_editor (pair const x, pair const y) { if (_editor->pending_visual_change.idle_handler_id >= 0) { /* see comment in other set_editor () */ @@ -640,8 +640,12 @@ EditorSummary::set_editor (pair const & x, pair c * @param x new x left position in summary coordinates. */ void -EditorSummary::set_editor_x (double const x) +EditorSummary::set_editor_x (double x) { + if (x < 0) { + x = 0; + } + _editor->reset_x_origin (x / _x_scale + _start); } @@ -650,8 +654,16 @@ EditorSummary::set_editor_x (double const x) * @param x new x range in summary coordinates. */ void -EditorSummary::set_editor_x (pair const & x) +EditorSummary::set_editor_x (pair x) { + if (x.first < 0) { + x.first = 0; + } + + if (x.second < 0) { + x.second = 1; + } + _editor->reset_x_origin (x.first / _x_scale + _start); double const nx = ( @@ -694,7 +706,7 @@ EditorSummary::set_editor_y (double const y) * @param y new editor range in summary coodinates. */ void -EditorSummary::set_editor_y (pair const & y) +EditorSummary::set_editor_y (pair const y) { /* Compute current height of tracks between y.first and y.second. We add up the total height into `total_height' and the height of complete tracks into diff --git a/gtk2_ardour/editor_summary.h b/gtk2_ardour/editor_summary.h index 3085f70c49..b465709100 100644 --- a/gtk2_ardour/editor_summary.h +++ b/gtk2_ardour/editor_summary.h @@ -70,12 +70,12 @@ private: void render_region (RegionView*, cairo_t*, double) const; void get_editor (std::pair *, std::pair *) const; void set_editor (double, double); - void set_editor (std::pair const &, double); - void set_editor (std::pair const &, std::pair const &); + void set_editor (std::pair, double); + void set_editor (std::pair, std::pair); void set_editor_x (double); - void set_editor_x (std::pair const &); + void set_editor_x (std::pair); void set_editor_y (double); - void set_editor_y (std::pair const &); + void set_editor_y (std::pair); void playhead_position_changed (framepos_t); double summary_y_to_editor (double) const; double editor_y_to_summary (double) const;