Implement use once flags

This commit is contained in:
Martijn van Berkel (Flitskikker) 2022-09-20 15:03:51 +02:00
parent ed67ef4f50
commit 7a60455bf9

View File

@ -3417,9 +3417,14 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
else if (result == DialogResult.OK)
{
string text = _vobSubOcrCharacter.ManualRecognizedCharacters;
string name = SaveCompareItemNew(item, text, _vobSubOcrCharacter.IsItalic, expandSelectionList);
var addition = new ImageCompareAddition(name, text, item.NikseBitmap, _vobSubOcrCharacter.IsItalic, listViewIndex);
_lastAdditions.Add(addition);
if (!_vobSubOcrCharacter.UseOnce)
{
string name = SaveCompareItemNew(item, text, _vobSubOcrCharacter.IsItalic, expandSelectionList);
var addition = new ImageCompareAddition(name, text, item.NikseBitmap, _vobSubOcrCharacter.IsItalic, listViewIndex);
_lastAdditions.Add(addition);
}
matches.Add(new CompareMatch(text, _vobSubOcrCharacter.IsItalic, expandSelectionList.Count, null));
expandSelectionList = new List<ImageSplitterItem>();
}
@ -3473,9 +3478,13 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
else if (result == DialogResult.OK)
{
string text = _vobSubOcrCharacter.ManualRecognizedCharacters;
string name = SaveCompareItemNew(item, text, _vobSubOcrCharacter.IsItalic, null);
var addition = new ImageCompareAddition(name, text, item.NikseBitmap, _vobSubOcrCharacter.IsItalic, listViewIndex);
_lastAdditions.Add(addition);
if (!_vobSubOcrCharacter.UseOnce) {
string name = SaveCompareItemNew(item, text, _vobSubOcrCharacter.IsItalic, null);
var addition = new ImageCompareAddition(name, text, item.NikseBitmap, _vobSubOcrCharacter.IsItalic, listViewIndex);
_lastAdditions.Add(addition);
}
matches.Add(new CompareMatch(text, _vobSubOcrCharacter.IsItalic, 0, null, item));
SetBinOcrLowercaseUppercase(item.NikseBitmap.Height, text);
}
@ -3837,8 +3846,12 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
c.MarginTop = expandSelectionList.First().Top - expandSelectionList.Min(p => p.Top);
}
_nOcrDb.Add(c);
SaveNOcrWithCurrentLanguage();
if (!_vobSubOcrNOcrCharacter.UseOnce)
{
_nOcrDb.Add(c);
SaveNOcrWithCurrentLanguage();
}
var text = _vobSubOcrNOcrCharacter.NOcrChar.Text;
matches.Add(new CompareMatch(text, _vobSubOcrNOcrCharacter.IsItalic, expandSelectionList.Count, null));
expandSelectionList = new List<ImageSplitterItem>();
@ -3873,8 +3886,11 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
}
else if (result == DialogResult.OK)
{
_nOcrDb.Add(_vobSubOcrNOcrCharacter.NOcrChar);
SaveNOcrWithCurrentLanguage();
if (!_vobSubOcrNOcrCharacter.UseOnce) {
_nOcrDb.Add(_vobSubOcrNOcrCharacter.NOcrChar);
SaveNOcrWithCurrentLanguage();
}
string text = _vobSubOcrNOcrCharacter.NOcrChar.Text;
matches.Add(new CompareMatch(text, _vobSubOcrNOcrCharacter.IsItalic, 0, null) { ImageSplitterItem = item });
}