Optimized: Remove text from Hearing Impaired

This commit is contained in:
ivandrofly 2015-03-02 21:15:27 +00:00
parent 9371fb8f2d
commit 5bc0ff83ee

View File

@ -159,11 +159,12 @@ namespace Nikse.SubtitleEdit.Forms
public int RemoveTextFromHearImpaired()
{
int count = 0;
for (int i = _subtitle.Paragraphs.Count - 1; i >= 0; i--)
for (int i = listViewFixes.Items.Count - 1; i >= 0; i--)
{
Paragraph p = _subtitle.Paragraphs[i];
if (IsFixAllowed(p))
var item = listViewFixes.Items[i];
if (item.Checked)
{
Paragraph p = (Paragraph)item.Tag;
_removeTextForHILib.Settings = GetSettings();
string newText = _removeTextForHILib.RemoveTextFromHearImpaired(p.Text);
if (string.IsNullOrEmpty(newText))
@ -180,16 +181,6 @@ namespace Nikse.SubtitleEdit.Forms
return count;
}
private bool IsFixAllowed(Paragraph p)
{
foreach (ListViewItem item in listViewFixes.Items)
{
if (item.Tag.ToString() == p.ToString())
return item.Checked;
}
return false;
}
private void CheckBoxRemoveTextBetweenCheckedChanged(object sender, EventArgs e)
{
Cursor = Cursors.WaitCursor;
@ -282,10 +273,11 @@ namespace Nikse.SubtitleEdit.Forms
RemoveTextBetweenBrackets = checkBoxRemoveTextBetweenBrackets.Checked,
RemoveTextBetweenQuestionMarks = checkBoxRemoveTextBetweenQuestionMarks.Checked,
RemoveTextBetweenParentheses = checkBoxRemoveTextBetweenParentheses.Checked,
CustomStart = comboBoxCustomStart.Text, CustomEnd = comboBoxCustomEnd.Text
CustomStart = comboBoxCustomStart.Text,
CustomEnd = comboBoxCustomEnd.Text
};
return settings;
}
}
}
}