Commit 6fb69400 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Don't snap on subtitles when locked

parent a315ab89
Pipeline #43247 passed with stage
in 10 minutes and 8 seconds
......@@ -1066,6 +1066,27 @@ void SubtitleModel::switchLocked()
{
bool isLocked = m_subtitleFilter->get_int("kdenlive:locked") == 1;
m_subtitleFilter->set("kdenlive:locked", isLocked ? 0 : 1);
// En/disable snapping on lock
std::vector<std::weak_ptr<SnapInterface>> validSnapModels;
for (const auto &snapModel : m_regSnaps) {
if (auto ptr = snapModel.lock()) {
validSnapModels.push_back(snapModel);
if (isLocked) {
for (const auto &subtitle : m_subtitleList) {
ptr->addPoint(subtitle.first.frames(pCore->getCurrentFps()));
ptr->addPoint(subtitle.second.second.frames(pCore->getCurrentFps()));
}
} else {
for (const auto &subtitle : m_subtitleList) {
ptr->removePoint(subtitle.first.frames(pCore->getCurrentFps()));
ptr->removePoint(subtitle.second.second.frames(pCore->getCurrentFps()));
}
}
}
}
// Update the list of snapModel known to be valid
std::swap(m_regSnaps, validSnapModels);
if (!isLocked) {
// Clear selection
while (!m_selected.isEmpty()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment