timeline: add exception to never splicing gaps
This commit is contained in:
@@ -340,7 +340,7 @@ void TrackPlaceBlockCommand::redo()
|
||||
// Place the Block at this point
|
||||
if (!ripple_remove_command_) {
|
||||
ripple_remove_command_ = new TrackRippleRemoveAreaCommand(track, TimeRange(in_, in_ + insert_->length()));
|
||||
|
||||
ripple_remove_command_->SetAllowSplittingGaps(true);
|
||||
}
|
||||
|
||||
ripple_remove_command_->redo_now();
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace olive {
|
||||
TrackRippleRemoveAreaCommand::TrackRippleRemoveAreaCommand(Track* track, const TimeRange& range) :
|
||||
track_(track),
|
||||
range_(range),
|
||||
allow_splitting_gaps_(false),
|
||||
splice_split_command_(nullptr)
|
||||
{
|
||||
trim_out_.block = nullptr;
|
||||
@@ -63,7 +64,7 @@ void TrackRippleRemoveAreaCommand::prepare()
|
||||
|
||||
// If it's getting trimmed, determine if it's actually getting spliced
|
||||
if (first_block_is_out_trimmed && first_block_is_in_trimmed) {
|
||||
if (dynamic_cast<GapBlock*>(first_block)) {
|
||||
if (!allow_splitting_gaps_ && dynamic_cast<GapBlock*>(first_block)) {
|
||||
// As a rule, we don't split gaps, so we just treat it as a trim of the range requested
|
||||
trim_out_ = {first_block,
|
||||
first_block->length(),
|
||||
|
||||
@@ -67,6 +67,11 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SetAllowSplittingGaps(bool e)
|
||||
{
|
||||
allow_splitting_gaps_ = e;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void prepare() override;
|
||||
|
||||
@@ -93,6 +98,7 @@ private:
|
||||
QVector<RemoveOperation> removals_;
|
||||
TrimOperation trim_in_;
|
||||
Block* insert_previous_;
|
||||
bool allow_splitting_gaps_;
|
||||
|
||||
BlockSplitCommand* splice_split_command_;
|
||||
QVector<UndoCommand*> remove_block_commands_;
|
||||
|
||||
Reference in New Issue
Block a user