use RegionCommand for same-track region drags

git-svn-id: svn://localhost/ardour2/branches/3.0@6653 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-02-08 19:41:43 +00:00
parent e2baff4f7d
commit 30dd55bccd
4 changed files with 14 additions and 10 deletions

View File

@ -661,7 +661,7 @@ AudioStreamView::update_rec_regions ()
region->freeze ();
region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this);
region->set_length (nlen, this);
region->thaw ("updated");
region->thaw ();
if (origlen == 1) {
/* our special initial length */
@ -686,7 +686,7 @@ AudioStreamView::update_rec_regions ()
region->freeze ();
region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this);
region->set_length (nlen, this);
region->thaw ("updated");
region->thaw ();
if (origlen == 1) {
/* our special initial length */

View File

@ -22,6 +22,7 @@
#include "pbd/memento_command.h"
#include "pbd/basename.h"
#include "ardour/diskstream.h"
#include "ardour/region_command.h"
#include "ardour/session.h"
#include "ardour/dB.h"
#include "ardour/region_factory.h"
@ -949,6 +950,8 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
}
} else {
RegionCommand* rcmd = new RegionCommand (rv->region());
/*
motion on the same track. plonk the previously reparented region
back to its original canvas group (its streamview).
@ -962,10 +965,12 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
/* just change the model */
boost::shared_ptr<Playlist> playlist = dest_rtv->playlist();
if (dest_rtv->view()->layer_display() == Stacked) {
layer_t old_layer = rv->region()->layer();
rv->region()->set_layer (dest_layer);
rv->region()->set_pending_explicit_relayer (true);
rcmd->add_property_change (RegionCommand::Layer, old_layer, dest_layer);
}
/* freeze playlist to avoid lots of relayering in the case of a multi-region drag */
@ -976,10 +981,11 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
playlist->freeze();
}
XMLNode& before (rv->region()->get_state());
nframes64_t old_pos = rv->region()->position();
rv->region()->set_position (where, (void*) this);
_editor->session()->add_command (new MementoCommand<Region>(*rv->region(), &before, &playlist->get_state()));
rcmd->add_property_change (RegionCommand::Position, old_pos, where);
_editor->session()->add_command (rcmd);
}
if (changed_tracks && !_copy) {

View File

@ -2354,7 +2354,7 @@ Editor::thaw_region_after_trim (RegionView& rv)
return;
}
region->thaw (_("trimmed region"));
region->thaw ();
AudioRegionView* arv = dynamic_cast<AudioRegionView*>(&rv);
@ -2488,8 +2488,6 @@ Editor::add_region_drag (ArdourCanvas::Item* item, GdkEvent* event, RegionView*
_drags->add (new RegionMoveDrag (this, item, region_view, s.by_layer(), false, false));
}
begin_reversible_command (_("move region(s)"));
/* sync the canvas to what we think is its current state */
update_canvas_now();
}

View File

@ -554,7 +554,7 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t
region->freeze ();
region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this);
region->set_length (start + dur - region->position(), this);
region->thaw ("updated");
region->thaw ();
if (origlen == 1) {
/* our special initial length */
@ -618,7 +618,7 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t
region->freeze ();
region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this);
region->set_length (nlen, this);
region->thaw ("updated");
region->thaw ();
if (origlen == 1) {
/* our special initial length */