When setting the start or end time of a subtitle line to the current video frame, if the resulting line duration would be less than one frame also update the other time
Originally committed to SVN as r5742.
This commit is contained in:
parent
6895e91e7c
commit
8daa6cfdc2
1 changed files with 8 additions and 7 deletions
|
@ -160,21 +160,22 @@ struct time_shift : public Command {
|
|||
}
|
||||
};
|
||||
|
||||
static void snap_subs_video(agi::Context *c, bool start) {
|
||||
static void snap_subs_video(agi::Context *c, bool set_start) {
|
||||
std::set<AssDialogue*> sel = c->selectionController->GetSelectedSet();
|
||||
|
||||
if (!c->videoController->IsLoaded() || sel.empty()) return;
|
||||
|
||||
int ms = c->videoController->TimeAtFrame(c->videoController->GetFrameN(), start ? agi::vfr::START : agi::vfr::END);
|
||||
int start = c->videoController->TimeAtFrame(c->videoController->GetFrameN(), agi::vfr::START);
|
||||
int end = c->videoController->TimeAtFrame(c->videoController->GetFrameN(), agi::vfr::END);
|
||||
|
||||
for (std::set<AssDialogue*>::iterator it = sel.begin(); it != sel.end(); ++it) {
|
||||
if (start)
|
||||
(*it)->Start.SetMS(ms);
|
||||
else
|
||||
(*it)->End.SetMS(ms);
|
||||
if (set_start || (*it)->Start.GetMS() > start)
|
||||
(*it)->Start.SetMS(start);
|
||||
if (!set_start || (*it)->End.GetMS() < end)
|
||||
(*it)->End.SetMS(end);
|
||||
}
|
||||
|
||||
c->ass->Commit(_("timing"), AssFile::COMMIT_DIAG_TIME);
|
||||
c->ass->Commit(_("timing"), AssFile::COMMIT_DIAG_TIME);
|
||||
}
|
||||
|
||||
/// Set end of selected subtitles to current video frame.
|
||||
|
|
Loading…
Reference in a new issue