fix some bugs with dragging patch/program changes around

git-svn-id: svn://localhost/ardour2/branches/3.0@12692 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-06-13 02:00:51 +00:00
parent 0d002fb231
commit 5573b6a049
3 changed files with 6 additions and 12 deletions

View File

@ -218,12 +218,6 @@ CanvasPatchChange::on_event (GdkEvent* ev)
_region.patch_left (this);
break;
case GDK_KEY_RELEASE:
return true;
case GDK_BUTTON_RELEASE:
return true;
default:
break;
}

View File

@ -4309,7 +4309,9 @@ PatchChangeDrag::PatchChangeDrag (Editor* e, CanvasPatchChange* i, MidiRegionVie
, _patch_change (i)
, _cumulative_dx (0)
{
DEBUG_TRACE (DEBUG::Drags, "New PatchChangeDrag\n");
DEBUG_TRACE (DEBUG::Drags, string_compose ("New PatchChangeDrag, patch @ %1, grab @ %2\n",
_region_view->source_beats_to_absolute_frames (_patch_change->patch()->time()),
grab_frame()));
}
void
@ -4320,8 +4322,8 @@ PatchChangeDrag::motion (GdkEvent* ev, bool)
f = max (f, r->position ());
f = min (f, r->last_frame ());
framecnt_t const dxf = f - grab_frame();
double const dxu = _editor->frame_to_unit (dxf);
framecnt_t const dxf = f - grab_frame(); // permitted dx in frames
double const dxu = _editor->frame_to_unit (dxf); // permitted fx in units
_patch_change->move (dxu - _cumulative_dx, 0);
_cumulative_dx = dxu;
}
@ -4334,14 +4336,13 @@ PatchChangeDrag::finished (GdkEvent* ev, bool movement_occurred)
}
boost::shared_ptr<Region> r (_region_view->region ());
framepos_t f = adjusted_current_frame (ev);
f = max (f, r->position ());
f = min (f, r->last_frame ());
_region_view->move_patch_change (
*_patch_change,
_region_view->region_frames_to_region_beats (f - r->position() - r->start())
_region_view->region_frames_to_region_beats (f - (r->position() - r->start()))
);
}

View File

@ -4749,7 +4749,6 @@ Editor::insert_patch_change (bool from_context)
MidiRegionView* const mrv = dynamic_cast<MidiRegionView*> (*i);
if (mrv) {
if (p >= mrv->region()->first_frame() && p <= mrv->region()->last_frame()) {
cerr << "Adding patch change @ " << p << " to " << mrv->region()->name() << endl;
mrv->add_patch_change (p - mrv->region()->position(), d.patch ());
}
}