editor::paste fix a thinko in undo nesting
This commit is contained in:
parent
5310e1e099
commit
dbe49ae8c4
@ -5173,6 +5173,7 @@ Editor::paste_internal (timepos_t const & pos, float times)
|
|||||||
R1.A1, R1.A2, R2, R2.A1, ... */
|
R1.A1, R1.A2, R2, R2.A1, ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool commit = false;
|
||||||
begin_reversible_command (Operations::paste);
|
begin_reversible_command (Operations::paste);
|
||||||
|
|
||||||
if (ts.size() == 1 && cut_buffer->lines.size() == 1 &&
|
if (ts.size() == 1 && cut_buffer->lines.size() == 1 &&
|
||||||
@ -5181,7 +5182,7 @@ Editor::paste_internal (timepos_t const & pos, float times)
|
|||||||
"greedy" paste from one automation type to another. */
|
"greedy" paste from one automation type to another. */
|
||||||
|
|
||||||
PasteContext ctx(paste_count, times, ItemCounts(), true);
|
PasteContext ctx(paste_count, times, ItemCounts(), true);
|
||||||
ts.front()->paste (position, *cut_buffer, ctx);
|
commit |= ts.front()->paste (position, *cut_buffer, ctx);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -5189,13 +5190,17 @@ Editor::paste_internal (timepos_t const & pos, float times)
|
|||||||
|
|
||||||
PasteContext ctx(paste_count, times, ItemCounts(), false);
|
PasteContext ctx(paste_count, times, ItemCounts(), false);
|
||||||
for (TrackViewList::iterator i = ts.begin(); i != ts.end(); ++i) {
|
for (TrackViewList::iterator i = ts.begin(); i != ts.end(); ++i) {
|
||||||
(*i)->paste (position, *cut_buffer, ctx);
|
commit |= (*i)->paste (position, *cut_buffer, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++paste_count;
|
++paste_count;
|
||||||
|
|
||||||
|
if (commit) {
|
||||||
commit_reversible_command ();
|
commit_reversible_command ();
|
||||||
|
} else {
|
||||||
|
abort_reversible_command ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -3837,7 +3837,7 @@ MidiRegionView::duplicate_selection ()
|
|||||||
paste (dup_pos, local_selection, ctxt);
|
paste (dup_pos, local_selection, ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method handles undo */
|
/** undo commands were initiated at the 'action' level. ::paste and ::paste_internal should implement subcommands */
|
||||||
bool
|
bool
|
||||||
MidiRegionView::paste (timepos_t const & pos, const ::Selection& selection, PasteContext& ctx)
|
MidiRegionView::paste (timepos_t const & pos, const ::Selection& selection, PasteContext& ctx)
|
||||||
{
|
{
|
||||||
@ -3865,17 +3865,11 @@ MidiRegionView::paste (timepos_t const & pos, const ::Selection& selection, Past
|
|||||||
const ATracks& atracks = midi_view()->automation_tracks();
|
const ATracks& atracks = midi_view()->automation_tracks();
|
||||||
for (ATracks::const_iterator a = atracks.begin(); a != atracks.end(); ++a) {
|
for (ATracks::const_iterator a = atracks.begin(); a != atracks.end(); ++a) {
|
||||||
if (a->second->paste(pos, selection, ctx)) {
|
if (a->second->paste(pos, selection, ctx)) {
|
||||||
if(!commit) {
|
|
||||||
trackview.editor().begin_reversible_command (Operations::paste);
|
|
||||||
}
|
|
||||||
commit = true;
|
commit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commit) {
|
return commit;
|
||||||
trackview.editor().commit_reversible_command ();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** undo commands were initiated at the 'action' level. ::paste and ::paste_internal should implement subcommands */
|
/** undo commands were initiated at the 'action' level. ::paste and ::paste_internal should implement subcommands */
|
||||||
|
Loading…
Reference in New Issue
Block a user