summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2015-10-28 02:46:03 +1100
committernick_m <mainsbridge@gmail.com>2015-10-28 02:46:03 +1100
commitfc8b03eef54da4de254070b44906bb40b3a9f9b7 (patch)
tree93d43c129b0cd8a657f61a7be5cb7dc5e32d4e71
parent653e80ee21d1f76aa6aa53451a672282c7ea2f63 (diff)
Fix incorrectly placed control points (y-axis). fixes #6647.
- also use the return from AutomationLine::drag_motion () in anticipation of it correctly reporting its clamping to AutomationRangeDrag.
-rw-r--r--gtk2_ardour/automation_line.cc3
-rw-r--r--gtk2_ardour/editor_drag.cc23
2 files changed, 13 insertions, 13 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index 72cf283ff4..edefa38ac0 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -694,7 +694,6 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
}
/* clamp y */
-
for (list<ControlPoint*>::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) {
double const y = ((_height - (*i)->get_y()) / _height) + dy;
if (y < 0) {
@@ -736,7 +735,7 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
_last_drag_fraction = fraction;
did_push = with_push;
- return pair<double, float> (_drag_x + dx, _last_drag_fraction + dy);
+ return pair<double, float> (_drag_x + dx, fraction);
}
/** Should be called to indicate the end of a drag */
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 963dbfe429..7667d93d57 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -4228,15 +4228,15 @@ ControlPointDrag::motion (GdkEvent* event, bool first_motion)
_cumulative_x_drag = cx - _fixed_grab_x;
_cumulative_y_drag = cy - _fixed_grab_y;
+ cx = max (0.0, cx);
+ cy = max (0.0, cy);
+ cy = min ((double) _point->line().height(), cy);
+
// make sure we hit zero when passing through
if ((cy < zero_gain_y && (cy - dy) > zero_gain_y) || (cy > zero_gain_y && (cy - dy) < zero_gain_y)) {
cy = zero_gain_y;
}
- cx = max (0.0, cx);
- cy = max (0.0, cy);
- cy = min ((double) _point->line().height(), cy);
-
framepos_t cx_frames = _editor->pixel_to_sample (cx) + snap_delta (event->button.state);
if (!_x_constrained && need_snap) {
@@ -4249,13 +4249,14 @@ ControlPointDrag::motion (GdkEvent* event, bool first_motion)
float const fraction = 1.0 - (cy / _point->line().height());
if (first_motion) {
+ float const initial_fraction = 1.0 - (_fixed_grab_y / _point->line().height());
_editor->begin_reversible_command (_("automation event move"));
- _point->line().start_drag_single (_point, _fixed_grab_x, fraction);
+ _point->line().start_drag_single (_point, _fixed_grab_x, initial_fraction);
}
+ pair<double, float> result;
+ result = _point->line().drag_motion (_editor->sample_to_pixel_unrounded (cx_frames), fraction, false, _pushing, _final_index);
- _point->line().drag_motion (_editor->sample_to_pixel_unrounded (cx_frames), fraction, false, _pushing, _final_index);
-
- show_verbose_cursor_text (_point->line().get_verbose_cursor_string (fraction));
+ show_verbose_cursor_text (_point->line().get_verbose_cursor_string (result.second));
}
void
@@ -4269,7 +4270,6 @@ ControlPointDrag::finished (GdkEvent* event, bool movement_occurred)
}
} else {
- motion (event, false);
_point->line().end_drag (_pushing, _final_index);
_editor->commit_reversible_command ();
}
@@ -5785,9 +5785,10 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move)
for (list<Line>::iterator l = _lines.begin(); l != _lines.end(); ++l) {
float const f = y_fraction (l->line, current_pointer_y());
/* we are ignoring x position for this drag, so we can just pass in anything */
+ pair<double, float> result;
uint32_t ignored;
- l->line->drag_motion (0, f, true, false, ignored);
- show_verbose_cursor_text (l->line->get_verbose_cursor_relative_string (l->original_fraction, f));
+ result = l->line->drag_motion (0, f, true, false, ignored);
+ show_verbose_cursor_text (l->line->get_verbose_cursor_relative_string (l->original_fraction, result.second));
}
}