summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-03-02 16:18:59 +0000
committerCarl Hetherington <carl@carlh.net>2011-03-02 16:18:59 +0000
commitf14b079a9af6c03b6da03eb69ae49fe0968083b2 (patch)
treedf6a07f614cd2049b0581eccaf6d6e1ff0c66cf1 /gtk2_ardour/editor_ops.cc
parent6b4622a3f05d2d09bf4f10f3f8aadd3e09ca75fa (diff)
Fix up undo/redo of MIDI note paste (#3815).
git-svn-id: svn://localhost/ardour2/branches/3.0@9033 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc32
1 files changed, 15 insertions, 17 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index d6e3761f3f..e521beb64f 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -3911,8 +3911,6 @@ Editor::mouse_paste ()
void
Editor::paste_internal (framepos_t position, float times)
{
- bool commit = false;
-
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("apparent paste position is %1\n", position));
if (internal_editing()) {
@@ -3930,8 +3928,6 @@ Editor::paste_internal (framepos_t position, float times)
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("preferred edit position is %1\n", position));
}
- begin_reversible_command (Operations::paste);
-
TrackViewList ts;
TrackViewList::iterator i;
size_t nth;
@@ -3949,18 +3945,18 @@ Editor::paste_internal (framepos_t position, float times)
ts.push_back (_last_cut_copy_source_track);
}
- for (nth = 0, i = ts.begin(); i != ts.end(); ++i, ++nth) {
+ if (internal_editing ()) {
/* undo/redo is handled by individual tracks/regions */
-
- if (internal_editing()) {
-
+
+ for (nth = 0, i = ts.begin(); i != ts.end(); ++i, ++nth) {
+
RegionSelection rs;
RegionSelection::iterator r;
MidiNoteSelection::iterator cb;
-
+
get_regions_at (rs, position, ts);
-
+
for (cb = cut_buffer->midi_notes.begin(), r = rs.begin();
cb != cut_buffer->midi_notes.end() && r != rs.end(); ++r) {
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (*r);
@@ -3969,16 +3965,18 @@ Editor::paste_internal (framepos_t position, float times)
++cb;
}
}
+ }
+
+ } else {
- } else {
+ /* we do redo (do you do voodoo?) */
- if ((*i)->paste (position, times, *cut_buffer, nth)) {
- commit = true;
- }
+ begin_reversible_command (Operations::paste);
+
+ for (nth = 0, i = ts.begin(); i != ts.end(); ++i, ++nth) {
+ (*i)->paste (position, times, *cut_buffer, nth);
}
- }
-
- if (commit) {
+
commit_reversible_command ();
}
}