timeline: automate waveform resizing

Now each UndoCommand won't have to handle it (unless it can introduce
specific optimizations).
This commit is contained in:
itsmattkc
2020-06-01 14:54:14 +10:00
parent a62960ecc0
commit 1fce380cc6
7 changed files with 103 additions and 72 deletions
+19 -2
View File
@@ -101,7 +101,11 @@ void Block::set_length_and_media_out(const rational &length)
return;
}
length_input_->set_standard_value(QVariant::fromValue(length));
rational old_length = this->length();
set_length_internal(length);
LengthChangedEvent(old_length, length, Timeline::kTrimOut);
}
void Block::set_length_and_media_in(const rational &length)
@@ -115,8 +119,12 @@ void Block::set_length_and_media_in(const rational &length)
// Calculate media_in adjustment
set_media_in(media_in() + (this->length() - length) * speed());
rational old_length = this->length();
// Set the length without setting media out
set_length_and_media_out(length);
set_length_internal(length);
LengthChangedEvent(old_length, length, Timeline::kTrimIn);
}
Block *Block::previous()
@@ -246,6 +254,15 @@ QList<NodeInput *> Block::GetInputsToHash() const
return inputs;
}
void Block::LengthChangedEvent(const rational &, const rational &, const Timeline::MovementMode &)
{
}
void Block::set_length_internal(const rational &length)
{
length_input_->set_standard_value(QVariant::fromValue(length));
}
void Block::LengthInputChanged()
{
emit LengthChanged(length());