summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-01-02 02:10:49 +0000
committerCarl Hetherington <carl@carlh.net>2010-01-02 02:10:49 +0000
commitc88716665a62399efa6278b5eaa254434a77a305 (patch)
treeea96855a41953872ebd31a864263c01a61165e99
parent0daf21cec119a9898550410cff286a2543e69a42 (diff)
Fix confusion between model and view points when dragging ranges. Clamp both top and bottom when dragging vertically. Fix some wacky formatting.
git-svn-id: svn://localhost/ardour2/branches/3.0@6436 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/automation_line.cc12
-rw-r--r--gtk2_ardour/editor_drag.cc11
2 files changed, 13 insertions, 10 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index ac50ac44db..7286b20bdf 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -770,12 +770,17 @@ AutomationLine::drag_motion (nframes_t x, float fraction, bool with_push)
double dy = fraction - _last_drag_fraction;
_last_drag_fraction = fraction;
- /* clamp y so that the "lowest" point hits the bottom but goes no further */
+ /* clamp y so that the "lowest" point hits the bottom but goes no further
+ and similarly with the "highest" and the top
+ */
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) {
dy -= y;
}
+ if (y > 1) {
+ dy -= (y - 1);
+ }
}
for (list<ControlPoint*>::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) {
@@ -1072,8 +1077,9 @@ AutomationLine::set_selected_points (PointSelection& points)
}
-void AutomationLine::set_colors() {
- set_line_color( ARDOUR_UI::config()->canvasvar_AutomationLine.get() );
+void AutomationLine::set_colors()
+{
+ set_line_color (ARDOUR_UI::config()->canvasvar_AutomationLine.get());
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->show_color (false, !points_visible);
}
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 5920e08afa..ca2468cd2c 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -3577,21 +3577,18 @@ AutomationRangeDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
}
uint32_t const N = _line->npoints ();
- AutomationList::const_iterator j = the_list->begin ();
for (uint32_t i = 0; i < N; ++i) {
ControlPoint* p = _line->nth (i);
- list<AudioRange>::const_iterator k = _ranges.begin ();
- while (k != _ranges.end() && (k->start >= (*j)->when || k->end <= (*j)->when)) {
- ++k;
+ list<AudioRange>::const_iterator j = _ranges.begin ();
+ while (j != _ranges.end() && (j->start >= (*p->model())->when || j->end <= (*p->model())->when)) {
+ ++j;
}
- if (k != _ranges.end()) {
+ if (j != _ranges.end()) {
points.push_back (p);
}
-
- ++j;
}
}