Merge branch 'track-redux' into move-serialization

This commit is contained in:
itsmattkc
2023-02-23 11:09:45 -08:00
35 changed files with 346 additions and 114 deletions
+17 -5
View File
@@ -203,6 +203,8 @@ void TrackSlideCommand::redo()
in_adjacent_remove_command_->redo_now();
}
we_removed_in_adjacent_ = true;
} else {
// Simply resize adjacent
in_adjacent_->set_length_and_media_out(in_adjacent_->length() + movement_);
@@ -225,6 +227,8 @@ void TrackSlideCommand::redo()
out_adjacent_remove_command_->redo_now();
}
we_removed_out_adjacent_ = true;
} else {
// Simply resize adjacent
out_adjacent_->set_length_and_media_in(out_adjacent_->length() - movement_);
@@ -246,9 +250,13 @@ void TrackSlideCommand::undo()
// We created this, so we can remove it now
track_->RippleRemoveBlock(in_adjacent_);
in_adjacent_->setParent(&memory_manager_);
} else if (in_adjacent_remove_command_) {
// We removed this, so we can restore it now
in_adjacent_remove_command_->undo_now();
} else if (we_removed_in_adjacent_) {
if (in_adjacent_remove_command_) {
// We removed this, so we can restore it now
in_adjacent_remove_command_->undo_now();
}
track_->InsertBlockBefore(in_adjacent_, blocks_.first());
} else {
// Simply resize adjacent
in_adjacent_->set_length_and_media_out(in_adjacent_->length() - movement_);
@@ -259,8 +267,12 @@ void TrackSlideCommand::undo()
// We created this, so we can remove it now
track_->RippleRemoveBlock(out_adjacent_);
out_adjacent_->setParent(&memory_manager_);
} else if (out_adjacent_remove_command_) {
out_adjacent_remove_command_->undo_now();
} else if (we_removed_out_adjacent_) {
if (out_adjacent_remove_command_) {
out_adjacent_remove_command_->undo_now();
}
track_->InsertBlockAfter(out_adjacent_, blocks_.last());
} else {
out_adjacent_->set_length_and_media_in(out_adjacent_->length() + movement_);
}
+4
View File
@@ -116,8 +116,10 @@ public:
track_(track),
blocks_(moving_blocks),
movement_(movement),
we_removed_in_adjacent_(false),
in_adjacent_(in_adjacent),
in_adjacent_remove_command_(nullptr),
we_removed_out_adjacent_(false),
out_adjacent_(out_adjacent),
out_adjacent_remove_command_(nullptr)
{
@@ -148,9 +150,11 @@ private:
rational movement_;
bool we_created_in_adjacent_;
bool we_removed_in_adjacent_;
Block* in_adjacent_;
UndoCommand* in_adjacent_remove_command_;
bool we_created_out_adjacent_;
bool we_removed_out_adjacent_;
Block* out_adjacent_;
UndoCommand* out_adjacent_remove_command_;