summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-03-25 17:14:48 +0100
committerRobin Gareus <robin@gareus.org>2015-03-25 17:15:32 +0100
commit3c55eb1e39e24848766b9fd4379166d3d52db30b (patch)
tree3c69a0bff520fa36f9a4b50a3791b17b38b48335
parenta9b2f973958ba3680f160123033a0b8d4f3b20be (diff)
DnD, only use track relationship
Ignore any routes or automation lanes during region y-axis distance calculation.
-rw-r--r--gtk2_ardour/editor_drag.cc38
-rw-r--r--gtk2_ardour/editor_drag.h2
2 files changed, 34 insertions, 6 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 9d1ff29e83..470a57ade2 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -641,7 +641,7 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, framepos_t* pending_r
}
int
-RegionDrag::apply_track_delta (const int start, const int delta, const int skip) const
+RegionDrag::apply_track_delta (const int start, const int delta, const int skip, const bool distance_only) const
{
if (delta == 0) {
return start;
@@ -657,17 +657,40 @@ RegionDrag::apply_track_delta (const int start, const int delta, const int skip)
#ifdef DEBUG_DROPZONEDRAG
if (current >= _time_axis_views.size() && target >= 0 && target < _time_axis_views.size()) {
printf("MOVE OUT OF THE ZONE cur: %d d: %d s: %d\n", start, delta, skip);
+ } else {
+ printf("CALC DISTANCE cur: %d d: %d s: %d\n", start, delta, skip);
}
#endif
while (current >= 0 && current != target) {
current += dt;
+ if (current < 0 && dt < 0) {
+#ifdef DEBUG_DROPZONEDRAG
+ printf("BREAK AT BOTTOM\n");
+#endif
+ break;
+ }
+ if (current >= _time_axis_views.size() && dt > 0) {
+#ifdef DEBUG_DROPZONEDRAG
+ printf("BREAK AT TOP\n");
+#endif
+ break;
+ }
if (current < 0 || current >= _time_axis_views.size()) {
continue;
}
- if (_time_axis_views[current]->hidden()) {
+
+ RouteTimeAxisView const * rtav = dynamic_cast<RouteTimeAxisView const *> (_time_axis_views[current]);
+ if (_time_axis_views[current]->hidden() || !rtav || !rtav->is_track()) {
target += dt;
}
+
+ if (distance_only && current == start + delta) {
+#ifdef DEBUG_DROPZONEDRAG
+ printf("BREAK AFTER DISTANCE\n");
+#endif
+ break;
+ }
}
return target;
}
@@ -682,7 +705,9 @@ RegionMotionDrag::y_movement_allowed (int delta_track, double delta_layer, int s
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
int n = apply_track_delta (i->time_axis_view, delta_track, skip_invisible);
#ifdef DEBUG_DROPZONEDRAG
- printf("Y MOVEMENT CHECK: from %d to %d skip: %d\n", i->time_axis_view, i->time_axis_view + delta_track, skip_invisible);
+ printf("Y MOVEMENT CHECK: from %d to %d skip: %d\n",
+ i->time_axis_view, i->time_axis_view + delta_track,
+ skip_invisible);
#endif
assert (n < 0 || n >= _time_axis_views.size() || !_time_axis_views[n]->hidden());
@@ -777,6 +802,9 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
/* Here's the current pointer position in terms of time axis view and layer */
current_pointer_time_axis_view = find_time_axis_view (tv);
assert(current_pointer_time_axis_view >= 0);
+#ifdef DEBUG_DROPZONEDRAG
+ printf(" On AXIS: %d\n", current_pointer_time_axis_view);
+#endif
double const current_pointer_layer = tv->layer_display() == Overlaid ? 0 : layer;
@@ -861,14 +889,14 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
int delta_skip = 0;
if (_last_pointer_time_axis_view < 0) {
// Moving out of the zone, check for hidden tracks at the bottom.
- delta_skip = apply_track_delta(_time_axis_views.size(), delta_time_axis_view, 0)
+ delta_skip = apply_track_delta(_time_axis_views.size(), delta_time_axis_view, 0, true)
-_time_axis_views.size() - delta_time_axis_view;
#ifdef DEBUG_DROPZONEDRAG
printf("NOW WHAT?? last: %d delta %d || skip %d\n", _last_pointer_time_axis_view, delta_time_axis_view, delta_skip);
#endif
} else {
// calculate hidden tracks that are skipped by the pointer movement
- delta_skip = apply_track_delta(_last_pointer_time_axis_view, delta_time_axis_view, 0)
+ delta_skip = apply_track_delta(_last_pointer_time_axis_view, delta_time_axis_view, 0, true)
- _last_pointer_time_axis_view
- delta_time_axis_view;
#ifdef DEBUG_DROPZONEDRAG
diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h
index ae4191909e..08812e6639 100644
--- a/gtk2_ardour/editor_drag.h
+++ b/gtk2_ardour/editor_drag.h
@@ -292,7 +292,7 @@ protected:
/** a list of the non-hidden TimeAxisViews sorted by editor order key */
std::vector<TimeAxisView*> _time_axis_views;
int find_time_axis_view (TimeAxisView *) const;
- int apply_track_delta (const int start, const int delta, const int skip) const;
+ int apply_track_delta (const int start, const int delta, const int skip, const bool distance_only = false) const;
int _visible_y_low;
int _visible_y_high;