-bool
-RegionMotionDrag::compute_y_delta (
- TimeAxisView const * last_pointer_view, TimeAxisView* current_pointer_view,
- int32_t last_pointer_layer, int32_t current_pointer_layer,
- TimeAxisViewSummary const & tavs,
- int32_t* pointer_order_span, int32_t* pointer_layer_span,
- int32_t* canvas_pointer_order_span
- )
-{
- if (_brushing) {
- *pointer_order_span = 0;
- *pointer_layer_span = 0;
- return true;
- }
-
- bool clamp_y_axis = false;
-
- /* the change in track order between this callback and the last */
- *pointer_order_span = last_pointer_view->order() - current_pointer_view->order();
- /* the change in layer between this callback and the last;
- only meaningful if pointer_order_span == 0 (ie we've not moved tracks) */
- *pointer_layer_span = last_pointer_layer - current_pointer_layer;
-
- if (*pointer_order_span != 0) {
-
- /* find the actual pointer span, in terms of the number of visible tracks;
- to do this, we reduce |pointer_order_span| by the number of hidden tracks
- over the span */
-
- *canvas_pointer_order_span = *pointer_order_span;
- if (last_pointer_view->order() >= current_pointer_view->order()) {
- for (int32_t y = current_pointer_view->order(); y < last_pointer_view->order(); y++) {
- if (tavs.height_list[y] == 0) {
- *canvas_pointer_order_span--;
- }
- }
- } else {
- for (int32_t y = last_pointer_view->order(); y <= current_pointer_view->order(); y++) {
- if (tavs.height_list[y] == 0) {
- *canvas_pointer_order_span++;
- }
- }
- }
-
- for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
-
- RegionView* rv = i->view;
-
- if (rv->region()->locked()) {
- continue;
- }
-
- double ix1, ix2, iy1, iy2;
- rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
- rv->get_canvas_frame()->i2w (ix1, iy1);
- iy1 += _editor->vertical_adjustment.get_value() - _editor->canvas_timebars_vsize;
-
- /* get the new trackview for this particular region */
- pair<TimeAxisView*, int> const tvp = _editor->trackview_by_y_position (iy1);
- assert (tvp.first);
- RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tvp.first);
-
- /* XXX: not sure that we should be passing canvas_pointer_order_span in here,
- as surely this is a per-region thing... */
-
- clamp_y_axis = y_movement_disallowed (
- rtv->order(), last_pointer_view->order(), *canvas_pointer_order_span, tavs
- );
-
- if (clamp_y_axis) {
- break;
- }
- }
-
- } else if (_dest_trackview == current_pointer_view) {
-
- if (current_pointer_layer == last_pointer_layer) {
- /* No movement; clamp */
- clamp_y_axis = true;
- }
- }
-
- if (!clamp_y_axis) {
- _dest_trackview = current_pointer_view;
- _dest_layer = current_pointer_layer;
- }
-
- return clamp_y_axis;
-}
-
-