Apply duration limit: Fix check selected lines - thx PM :)

This commit is contained in:
niksedk 2021-06-27 22:24:33 +02:00
parent 08724c30d8
commit 82ac167024
2 changed files with 15 additions and 9 deletions

View File

@ -44,6 +44,7 @@
* Try to fix Tools - Join... with different ASSA styles - thx Joe
* Fix crash in "Continuation style" - thx ivandrofly
* Fix export to "dvd studio stl" - thx nonofx
* Apply duration limit: Only fix "checked" lines - thx PM
3.6.1 (20th May 2021)

View File

@ -144,13 +144,13 @@ namespace Nikse.SubtitleEdit.Forms
double minDisplayTime = (double)numericUpDownDurationMin.Value;
for (int i = 0; i < _working.Paragraphs.Count; i++)
{
Paragraph p = _working.Paragraphs[i];
double displayTime = p.Duration.TotalMilliseconds;
var p = _working.Paragraphs[i];
var displayTime = p.Duration.TotalMilliseconds;
if (displayTime < minDisplayTime)
{
var next = _working.GetParagraphOrDefault(i + 1);
var wantedEndMs = p.StartTime.TotalMilliseconds + minDisplayTime;
if (next == null || wantedEndMs < next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines && AllowFix(p))
if (next == null || wantedEndMs < next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines)
{
AddFix(p, wantedEndMs, DefaultBackColor);
}
@ -180,21 +180,26 @@ namespace Nikse.SubtitleEdit.Forms
private void AddFix(Paragraph p, double endMs, Color backgroundColor)
{
string before = p.StartTime.ToShortString() + " --> " + p.EndTime.ToShortString() + " - " + p.Duration.ToShortString();
if (!AllowFix(p))
{
return;
}
var before = p.StartTime.ToShortString() + " --> " + p.EndTime.ToShortString() + " - " + p.Duration.ToShortString();
p.EndTime.TotalMilliseconds = endMs;
string after = p.StartTime.ToShortString() + " --> " + p.EndTime.ToShortString() + " - " + p.Duration.ToShortString();
var after = p.StartTime.ToShortString() + " --> " + p.EndTime.ToShortString() + " - " + p.Duration.ToShortString();
_totalFixes++;
AddFixToListView(p, before, after, backgroundColor);
}
public void FixLongDisplayTimes()
{
double maxDisplayTime = (double)numericUpDownDurationMax.Value;
var maxDisplayTime = (double)numericUpDownDurationMax.Value;
for (int i = 0; i < _working.Paragraphs.Count; i++)
{
Paragraph p = _working.Paragraphs[i];
double displayTime = p.Duration.TotalMilliseconds;
if (displayTime > maxDisplayTime && AllowFix(p))
var p = _working.Paragraphs[i];
var displayTime = p.Duration.TotalMilliseconds;
if (displayTime > maxDisplayTime)
{
AddFix(p, p.StartTime.TotalMilliseconds + maxDisplayTime, DefaultBackColor);
}