summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_line.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-01-08 19:55:37 +0000
committerCarl Hetherington <carl@carlh.net>2010-01-08 19:55:37 +0000
commitc115b3d71c47f5bac7fa59de3c97918e764658bd (patch)
treeb9f7e079ecde209f5f17f8b11168caf9cc8988f1 /gtk2_ardour/automation_line.cc
parentb408ec00fae61266026fb58ad153d1e3298f2f3d (diff)
Update verbose cursor correctly when y drags are clamped.
git-svn-id: svn://localhost/ardour2/branches/3.0@6469 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/automation_line.cc')
-rw-r--r--gtk2_ardour/automation_line.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index b304dcf2d4..03df016adf 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -237,7 +237,9 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
trackview.editor().session()->set_dirty ();
}
-
+/** Move a view point to a new position (without changing the model)
+ * @param y New y position as a normalised fraction (0.0-1.0)
+ */
void
AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool keep_x, bool with_push)
{
@@ -245,10 +247,6 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool ke
uint32_t last_movable = UINT_MAX;
double x_limit = DBL_MAX;
- /* this just changes the current view. it does not alter
- the model in any way at all.
- */
-
/* clamp y-coord appropriately. y is supposed to be a normalized fraction (0.0-1.0),
and needs to be converted to a canvas unit distance.
*/
@@ -769,16 +767,13 @@ AutomationLine::start_drag_common (nframes_t x, float fraction)
/** Should be called to indicate motion during a drag.
* @param x New x position of the drag in frames, or 0 if x is being ignored.
* @param fraction New y fraction.
+ * @return x position and y fraction that were actually used (once clamped).
*/
-void
+pair<nframes_t, float>
AutomationLine::drag_motion (nframes_t x, float fraction, bool with_push)
{
int64_t const dx = x - drag_x;
- drag_distance += dx;
- drag_x = x;
-
double dy = fraction - _last_drag_fraction;
- _last_drag_fraction = fraction;
/* clamp y so that the "lowest" point hits the bottom but goes no further
and similarly with the "highest" and the top
@@ -793,6 +788,11 @@ AutomationLine::drag_motion (nframes_t x, float fraction, bool with_push)
}
}
+ pair<nframes_t, float> const clamped (drag_x + dx, _last_drag_fraction + dy);
+ drag_distance += dx;
+ drag_x += dx;
+ _last_drag_fraction += dy;
+
for (list<ControlPoint*>::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) {
modify_view_point (
@@ -810,6 +810,8 @@ AutomationLine::drag_motion (nframes_t x, float fraction, bool with_push)
_drag_had_movement = true;
did_push = with_push;
+
+ return clamped;
}
/** Should be called to indicate the end of a drag */