Merge pull request #1330 from jdpurcell/patch3

Fix for issue #1108
This commit is contained in:
Nikolaj Olsson 2015-09-27 19:36:44 +02:00
commit b2966f9d1a

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)
{