Fix for issue #1108.

This commit is contained in:
J.D. Purcell 2015-09-26 14:18:32 -04:00
parent c4e32907d5
commit faf1dd4fe0

View File

@ -8016,15 +8016,15 @@ namespace Nikse.SubtitleEdit.Forms
private void UpdateOverlapErrors(TimeCode startTime)
{
labelStartTimeWarning.Text = string.Empty;
labelDurationWarning.Text = string.Empty;
string startTimeWarning = string.Empty;
string durationWarning = string.Empty;
if (_subtitle.Paragraphs.Count > 0 && SubtitleListview1.SelectedItems.Count > 0 && startTime != null)
{
int firstSelectedIndex = SubtitleListview1.SelectedItems[0].Index;
var prevParagraph = _subtitle.GetParagraphOrDefault(firstSelectedIndex - 1);
if (prevParagraph != null && prevParagraph.EndTime.TotalMilliseconds > startTime.TotalMilliseconds && Configuration.Settings.Tools.ListViewSyntaxColorOverlap)
labelStartTimeWarning.Text = string.Format(_languageGeneral.OverlapPreviousLineX, prevParagraph.EndTime.TotalSeconds - startTime.TotalSeconds);
startTimeWarning = string.Format(_languageGeneral.OverlapPreviousLineX, prevParagraph.EndTime.TotalSeconds - startTime.TotalSeconds);
var nextParagraph = _subtitle.GetParagraphOrDefault(firstSelectedIndex + 1);
if (nextParagraph != null)
@ -8032,21 +8032,23 @@ namespace Nikse.SubtitleEdit.Forms
double durationMilliSeconds = GetDurationInMilliseconds();
if (startTime.TotalMilliseconds + durationMilliSeconds > nextParagraph.StartTime.TotalMilliseconds && Configuration.Settings.Tools.ListViewSyntaxColorOverlap)
{
labelDurationWarning.Text = string.Format(_languageGeneral.OverlapX, ((startTime.TotalMilliseconds + durationMilliSeconds) - nextParagraph.StartTime.TotalMilliseconds) / TimeCode.BaseUnit);
durationWarning = string.Format(_languageGeneral.OverlapX, ((startTime.TotalMilliseconds + durationMilliSeconds) - nextParagraph.StartTime.TotalMilliseconds) / TimeCode.BaseUnit);
}
if (labelStartTimeWarning.Text.Length == 0 &&
if (startTimeWarning.Length == 0 &&
startTime.TotalMilliseconds > nextParagraph.StartTime.TotalMilliseconds && Configuration.Settings.Tools.ListViewSyntaxColorOverlap)
{
double di = (startTime.TotalMilliseconds - nextParagraph.StartTime.TotalMilliseconds) / TimeCode.BaseUnit;
labelStartTimeWarning.Text = string.Format(_languageGeneral.OverlapNextX, di);
startTimeWarning = string.Format(_languageGeneral.OverlapNextX, di);
}
else if (numericUpDownDuration.Value < 0)
{
labelDurationWarning.Text = _languageGeneral.Negative;
durationWarning = _languageGeneral.Negative;
}
}
}
labelStartTimeWarning.Text = startTimeWarning;
labelDurationWarning.Text = durationWarning;
}
private double GetDurationInMilliseconds()
@ -11064,7 +11066,6 @@ namespace Nikse.SubtitleEdit.Forms
}
checkBoxSyncListViewWithVideoWhilePlaying.Checked = oldSync;
numericUpDownDuration.ValueChanged += NumericUpDownDurationValueChanged;
if (goToNext)
{