speeddurationdialog: reordered duration/reverse settings

This commit is contained in:
itsmattkc
2022-04-11 18:32:11 -07:00
parent 245a0a112a
commit c073fb418f
@@ -155,6 +155,34 @@ void SpeedDurationDialog::accept()
MultiUndoCommand *command = new MultiUndoCommand();
// Set duration values
foreach (ClipBlock *c, clips_) {
rational proposed_length = c->length();
if (dur_slider_->IsTristate()) {
if (link_box_->isChecked() && !speed_slider_->IsTristate()) {
proposed_length = GetLengthAdjustment(c->length(), c->speed(), speed_slider_->GetValue(), timebase_);
}
} else {
proposed_length = dur_slider_->GetValue();
}
if (proposed_length != c->length()) {
// Clip length should ideally change, but check if there's "room" to do so
if (proposed_length > c->length() && c->next()) {
if (GapBlock *gap = dynamic_cast<GapBlock*>(c->next())) {
proposed_length = qMin(proposed_length, gap->out() - c->in());
} else {
proposed_length = c->length();
}
}
if (proposed_length != c->length()) {
command->add_child(new BlockTrimCommand(c->track(), c, proposed_length, Timeline::kTrimOut));
}
}
}
// Set speed values
if (speed_slider_->IsTristate()) {
if (link_box_->isChecked() && !dur_slider_->IsTristate()) {
@@ -184,34 +212,6 @@ void SpeedDurationDialog::accept()
}
}
// Set duration values
foreach (ClipBlock *c, clips_) {
rational proposed_length = c->length();
if (dur_slider_->IsTristate()) {
if (link_box_->isChecked() && !speed_slider_->IsTristate()) {
proposed_length = GetLengthAdjustment(c->length(), c->speed(), speed_slider_->GetValue(), timebase_);
}
} else {
proposed_length = dur_slider_->GetValue();
}
if (proposed_length != c->length()) {
// Clip length should ideally change, but check if there's "room" to do so
if (proposed_length > c->length() && c->next()) {
if (GapBlock *gap = dynamic_cast<GapBlock*>(c->next())) {
proposed_length = qMin(proposed_length, gap->out() - c->in());
} else {
proposed_length = c->length();
}
}
if (proposed_length != c->length()) {
command->add_child(new BlockTrimCommand(c->track(), c, proposed_length, Timeline::kTrimOut));
}
}
}
Core::instance()->undo_stack()->push(command);
super::accept();