mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
DnD, only use track relationship
Ignore any routes or automation lanes during region y-axis distance calculation.
This commit is contained in:
parent
a9b2f97395
commit
3c55eb1e39
2 changed files with 34 additions and 6 deletions
|
|
@ -641,7 +641,7 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, framepos_t* pending_r
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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) {
|
if (delta == 0) {
|
||||||
return start;
|
return start;
|
||||||
|
|
@ -657,17 +657,40 @@ RegionDrag::apply_track_delta (const int start, const int delta, const int skip)
|
||||||
#ifdef DEBUG_DROPZONEDRAG
|
#ifdef DEBUG_DROPZONEDRAG
|
||||||
if (current >= _time_axis_views.size() && target >= 0 && target < _time_axis_views.size()) {
|
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);
|
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
|
#endif
|
||||||
|
|
||||||
while (current >= 0 && current != target) {
|
while (current >= 0 && current != target) {
|
||||||
current += dt;
|
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()) {
|
if (current < 0 || current >= _time_axis_views.size()) {
|
||||||
continue;
|
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;
|
target += dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (distance_only && current == start + delta) {
|
||||||
|
#ifdef DEBUG_DROPZONEDRAG
|
||||||
|
printf("BREAK AFTER DISTANCE\n");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return target;
|
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) {
|
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);
|
int n = apply_track_delta (i->time_axis_view, delta_track, skip_invisible);
|
||||||
#ifdef DEBUG_DROPZONEDRAG
|
#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
|
#endif
|
||||||
assert (n < 0 || n >= _time_axis_views.size() || !_time_axis_views[n]->hidden());
|
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 */
|
/* Here's the current pointer position in terms of time axis view and layer */
|
||||||
current_pointer_time_axis_view = find_time_axis_view (tv);
|
current_pointer_time_axis_view = find_time_axis_view (tv);
|
||||||
assert(current_pointer_time_axis_view >= 0);
|
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;
|
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;
|
int delta_skip = 0;
|
||||||
if (_last_pointer_time_axis_view < 0) {
|
if (_last_pointer_time_axis_view < 0) {
|
||||||
// Moving out of the zone, check for hidden tracks at the bottom.
|
// 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;
|
-_time_axis_views.size() - delta_time_axis_view;
|
||||||
#ifdef DEBUG_DROPZONEDRAG
|
#ifdef DEBUG_DROPZONEDRAG
|
||||||
printf("NOW WHAT?? last: %d delta %d || skip %d\n", _last_pointer_time_axis_view, delta_time_axis_view, delta_skip);
|
printf("NOW WHAT?? last: %d delta %d || skip %d\n", _last_pointer_time_axis_view, delta_time_axis_view, delta_skip);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// calculate hidden tracks that are skipped by the pointer movement
|
// 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
|
- _last_pointer_time_axis_view
|
||||||
- delta_time_axis_view;
|
- delta_time_axis_view;
|
||||||
#ifdef DEBUG_DROPZONEDRAG
|
#ifdef DEBUG_DROPZONEDRAG
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ protected:
|
||||||
/** a list of the non-hidden TimeAxisViews sorted by editor order key */
|
/** a list of the non-hidden TimeAxisViews sorted by editor order key */
|
||||||
std::vector<TimeAxisView*> _time_axis_views;
|
std::vector<TimeAxisView*> _time_axis_views;
|
||||||
int find_time_axis_view (TimeAxisView *) const;
|
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_low;
|
||||||
int _visible_y_high;
|
int _visible_y_high;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue