summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_drag.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-03-30 00:14:26 +0100
committerRobin Gareus <robin@gareus.org>2019-03-30 00:14:26 +0100
commitf40456a649a882fed2b7a678d88d42c55c13e65e (patch)
tree4ac448149e956f3c117a431cb27bc90714f8bdb0 /gtk2_ardour/editor_drag.cc
parentd8571e2572e750f5cbe4f439ba3d6f9655713bc9 (diff)
cont'd AutomationRangeDrag update
Properly adding guard-points for all lanes, not just the first found for each range.
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r--gtk2_ardour/editor_drag.cc38
1 files changed, 17 insertions, 21 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 1c89f7ad20..9a036fd3d3 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -6253,7 +6253,6 @@ AutomationRangeDrag::AutomationRangeDrag (Editor* editor, list<RegionView*> cons
void
AutomationRangeDrag::setup (list<boost::shared_ptr<AutomationLine> > const & lines)
{
- printf ("AutomationRangeDrag::setup %d lines\n", lines.size());
/* find the lines that overlap the ranges being dragged */
list<boost::shared_ptr<AutomationLine> >::const_iterator i = lines.begin ();
while (i != lines.end ()) {
@@ -6344,26 +6343,25 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move)
}
if (first_move) {
- _editor->begin_reversible_command (_("automation range move")); // XXX
+ _editor->begin_reversible_command (_("automation range move"));
if (!_ranges.empty()) {
+ /* add guard points */
for (list<AudioRange>::const_iterator i = _ranges.begin(); i != _ranges.end(); ++i) {
samplecnt_t const half = (i->start + i->end) / 2;
- /* find the line that this audio range starts in */
- list<Line>::iterator j = _lines.begin();
- while (j != _lines.end() && (j->range.first > i->start || j->range.second < i->start)) {
- ++j;
- }
+ for (list<Line>::iterator j = _lines.begin(); j != _lines.end(); ++j) {
+ if (j->range.first > i->start || j->range.second < i->start) {
+ continue;
+ }
- if (j != _lines.end()) {
boost::shared_ptr<AutomationList> the_list = j->line->the_list ();
- /* j is the line that this audio range starts in; fade into it;
- 64 samples length plucked out of thin air.
- */
+ /* j is the line that this audio range starts in; fade into it;
+ * 64 samples length plucked out of thin air.
+ */
samplepos_t a = i->start + 64;
if (a > half) {
@@ -6384,18 +6382,17 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move)
}
/* same thing for the end */
+ for (list<Line>::iterator j = _lines.begin(); j != _lines.end(); ++j) {
- j = _lines.begin();
- while (j != _lines.end() && (j->range.first > i->end || j->range.second < i->end)) {
- ++j;
- }
+ if (j->range.first > i->end || j->range.second < i->end) {
+ continue;
+ }
- if (j != _lines.end()) {
boost::shared_ptr<AutomationList> the_list = j->line->the_list ();
/* j is the line that this audio range starts in; fade out of it;
- 64 samples length plucked out of thin air.
- */
+ * 64 samples length plucked out of thin air.
+ */
samplepos_t b = i->end - 64;
if (b < half) {
@@ -6419,9 +6416,8 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move)
_nothing_to_drag = true;
/* Find all the points that should be dragged and put them in the relevant
- points lists in the Line structs.
- */
-
+ * points lists in the Line structs.
+ */
for (list<Line>::iterator i = _lines.begin(); i != _lines.end(); ++i) {
uint32_t const N = i->line->npoints ();