diff options
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/muse/undo.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/muse2/muse/undo.cpp b/muse2/muse/undo.cpp index b4a2a26f..103b47ac 100644 --- a/muse2/muse/undo.cpp +++ b/muse2/muse/undo.cpp @@ -326,6 +326,9 @@ void prepareOperationGroup(Undo& group) QSet<const Track*> deleted_tracks; QSet<const Part*> deleted_parts; + int songlen = MusEGlobal::song->len(); + + for (iUndoOp op=group.begin(); op!=group.end();) { iUndoOp op_=op; @@ -360,10 +363,32 @@ void prepareOperationGroup(Undo& group) else deleted_parts.insert(op->part); } + else if (op->type==UndoOp::AddPart || op->type==UndoOp::ModifyPartLength || + op->type==UndoOp::ModifyPartTick) + { + if (op->type==UndoOp::AddPart) + { + if (songlen < op->part->endTick()) + songlen = op->part->endTick(); + } + else if (op->type==UndoOp::ModifyPartTick) + { + if (songlen < op->new_partlen_or_tick+op->part->lenTick()) + songlen = op->new_partlen_or_tick+op->part->lenTick(); + } + else if (op->type==UndoOp::ModifyPartLength) + { + if (songlen < op->part->tick()+op->new_partlen_or_tick) + songlen=op->part->tick()+op->new_partlen_or_tick; + } + } op=op_; } + if (songlen >= MusEGlobal::song->len()) + group.push_back(UndoOp(UndoOp::ModifySongLen, songlen, MusEGlobal::song->len())); + // replicate Event modifications to keep clones up to date. // do not replicate SelectEvent because... umm, it just doesn't feel right. for (iUndoOp op=group.begin(); op!=group.end(); op++) |