Merge pull request #605 from ivandrofly/optimization/patch-2

Optimized: Remove text from Hearing Impaired
This commit is contained in:
Nikolaj Olsson 2015-03-03 19:24:54 +01:00
commit 6698c4a639

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;
}
}
}
}