OCR inspect line - 'Add' now updates all occurrances (also to avoid crash later)

This commit is contained in:
Nikolaj Olsson 2016-07-20 08:31:52 +02:00
parent a051b7bc2b
commit b252c4f0e1

View File

@ -340,6 +340,24 @@ namespace Nikse.SubtitleEdit.Forms
listBoxInspectItems.SelectedIndex = index;
listBoxInspectItems_SelectedIndexChanged(null, null);
ShowCount();
// update other letters that are exact matches
for (int i = 0; i < _matches.Count; i++)
{
if (i != index && i < _imageSources.Count && _matches[i].ExpandCount == 0)
{
var newMatch = _binOcrDb.FindExactMatch(new BinaryOcrBitmap(new NikseBitmap(_imageSources[i])));
if (newMatch >= 0 && _binOcrDb.CompareImages[newMatch].Hash == bob.Hash)
{
_matches[i].Name = bob.Key;
_matches[i].ExpandCount = 0;
_matches[i].Italic = checkBoxItalic.Checked;
_matches[i].Text = textBoxText.Text;
listBoxInspectItems.Items[i] = textBoxText.Text;
}
}
}
return;
}