mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
[FCE] - Call subtitle its GetParagraphOrDefault.
This commit is contained in:
parent
b6a283278a
commit
34ec44f8a5
@ -1027,8 +1027,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int firstSelectedIndex = 0;
|
||||
if (subtitleListView1.SelectedItems.Count > 0)
|
||||
firstSelectedIndex = subtitleListView1.SelectedItems[0].Index;
|
||||
|
||||
Paragraph p = GetParagraphOrDefault(firstSelectedIndex);
|
||||
Paragraph p = _originalSubtitle.GetParagraphOrDefault(firstSelectedIndex);
|
||||
if (p != null)
|
||||
{
|
||||
textBoxListViewText.TextChanged -= TextBoxListViewTextTextChanged;
|
||||
@ -1067,14 +1066,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private Paragraph GetParagraphOrDefault(int index)
|
||||
{
|
||||
if (_originalSubtitle.Paragraphs == null || _originalSubtitle.Paragraphs.Count <= index || index < 0)
|
||||
return null;
|
||||
|
||||
return _originalSubtitle.Paragraphs[index];
|
||||
}
|
||||
|
||||
private void InitializeListViewEditBox(Paragraph p)
|
||||
{
|
||||
textBoxListViewText.TextChanged -= TextBoxListViewTextTextChanged;
|
||||
@ -1096,7 +1087,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
int firstSelectedIndex = subtitleListView1.SelectedItems[0].Index;
|
||||
|
||||
Paragraph currentParagraph = GetParagraphOrDefault(firstSelectedIndex);
|
||||
Paragraph currentParagraph = _originalSubtitle.GetParagraphOrDefault(firstSelectedIndex);
|
||||
if (currentParagraph != null)
|
||||
{
|
||||
UpdateOverlapErrors();
|
||||
@ -1118,11 +1109,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
int firstSelectedIndex = subtitleListView1.SelectedItems[0].Index;
|
||||
|
||||
Paragraph prevParagraph = GetParagraphOrDefault(firstSelectedIndex - 1);
|
||||
Paragraph prevParagraph = _originalSubtitle.GetParagraphOrDefault(firstSelectedIndex - 1);
|
||||
if (prevParagraph != null && prevParagraph.EndTime.TotalMilliseconds > startTime.TotalMilliseconds)
|
||||
labelStartTimeWarning.Text = string.Format(_languageGeneral.OverlapPreviousLineX, (prevParagraph.EndTime.TotalMilliseconds - startTime.TotalMilliseconds) / TimeCode.BaseUnit);
|
||||
|
||||
Paragraph nextParagraph = GetParagraphOrDefault(firstSelectedIndex + 1);
|
||||
Paragraph nextParagraph = _originalSubtitle.GetParagraphOrDefault(firstSelectedIndex + 1);
|
||||
if (nextParagraph != null)
|
||||
{
|
||||
double durationMilliSeconds = (double)numericUpDownDuration.Value * TimeCode.BaseUnit;
|
||||
|
Loading…
Reference in New Issue
Block a user