mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
nOCR selected lines
This commit is contained in:
parent
c875a5959f
commit
323bdbfa94
@ -1339,7 +1339,6 @@ To use an API key go to "Options -> Settings -> Tools" to enter your Googl
|
||||
<SplitLineAtCursorAndWaveformPosition>Split line at cursor/video position</SplitLineAtCursorAndWaveformPosition>
|
||||
<AutoDurationCurrentLine>Auto duration (current line)</AutoDurationCurrentLine>
|
||||
<SelectAll>Select all</SelectAll>
|
||||
<Insert>Insert</Insert>
|
||||
<InsertFirstLine>Insert line</InsertFirstLine>
|
||||
<InsertBefore>Insert before</InsertBefore>
|
||||
<InsertAfter>Insert after</InsertAfter>
|
||||
@ -1355,6 +1354,7 @@ To use an API key go to "Options -> Settings -> Tools" to enter your Googl
|
||||
<ColumnTextUp>Text up</ColumnTextUp>
|
||||
<ColumnTextDown>Text down</ColumnTextDown>
|
||||
<ColumnCopyOriginalTextToCurrent>Copy text from original to current</ColumnCopyOriginalTextToCurrent>
|
||||
<OcrSelectedLines>OCR selected lines</OcrSelectedLines>
|
||||
<Split>Split</Split>
|
||||
<MergeSelectedLines>Merge selected lines</MergeSelectedLines>
|
||||
<MergeSelectedLinesAsDialog>Merge selected lines as dialog</MergeSelectedLinesAsDialog>
|
||||
|
20
src/ui/Forms/Ocr/VobSubOcr.Designer.cs
generated
20
src/ui/Forms/Ocr/VobSubOcr.Designer.cs
generated
@ -19,6 +19,8 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.contextMenuStripListview = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.oCRSelectedLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparatorOcrSelected = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.normalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.italicToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
@ -209,6 +211,8 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
// contextMenuStripListview
|
||||
//
|
||||
this.contextMenuStripListview.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.oCRSelectedLinesToolStripMenuItem,
|
||||
this.toolStripSeparatorOcrSelected,
|
||||
this.normalToolStripMenuItem,
|
||||
this.italicToolStripMenuItem,
|
||||
this.toolStripSeparator1,
|
||||
@ -231,9 +235,21 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
this.toolStripSeparator3,
|
||||
this.deleteToolStripMenuItem});
|
||||
this.contextMenuStripListview.Name = "contextMenuStripListview";
|
||||
this.contextMenuStripListview.Size = new System.Drawing.Size(306, 386);
|
||||
this.contextMenuStripListview.Size = new System.Drawing.Size(306, 436);
|
||||
this.contextMenuStripListview.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListviewOpening);
|
||||
//
|
||||
// oCRSelectedLinesToolStripMenuItem
|
||||
//
|
||||
this.oCRSelectedLinesToolStripMenuItem.Name = "oCRSelectedLinesToolStripMenuItem";
|
||||
this.oCRSelectedLinesToolStripMenuItem.Size = new System.Drawing.Size(305, 22);
|
||||
this.oCRSelectedLinesToolStripMenuItem.Text = "OCR selected lines...";
|
||||
this.oCRSelectedLinesToolStripMenuItem.Click += new System.EventHandler(this.oCRSelectedLinesToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparatorOcrSelected
|
||||
//
|
||||
this.toolStripSeparatorOcrSelected.Name = "toolStripSeparatorOcrSelected";
|
||||
this.toolStripSeparatorOcrSelected.Size = new System.Drawing.Size(302, 6);
|
||||
//
|
||||
// normalToolStripMenuItem
|
||||
//
|
||||
this.normalToolStripMenuItem.Name = "normalToolStripMenuItem";
|
||||
@ -2175,5 +2191,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
private System.Windows.Forms.ToolStripMenuItem underlineToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem imageWithTimeCodeInFileNameToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem removeAllXToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem oCRSelectedLinesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparatorOcrSelected;
|
||||
}
|
||||
}
|
@ -284,6 +284,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
private int _mainOcrIndex;
|
||||
private bool _mainOcrRunning;
|
||||
private Bitmap _mainOcrBitmap;
|
||||
private List<int> _mainOcrSelectedIndices;
|
||||
|
||||
private Type _modiType;
|
||||
private object _modiDoc;
|
||||
@ -543,6 +544,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
checkBoxShowOnlyForced.Text = language.ShowOnlyForcedSubtitles;
|
||||
checkBoxUseTimeCodesFromIdx.Text = language.UseTimeCodesFromIdx;
|
||||
|
||||
oCRSelectedLinesToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.OcrSelectedLines;
|
||||
normalToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.RemoveFormattingAll;
|
||||
italicToolStripMenuItem.Text = LanguageSettings.Current.General.Italic;
|
||||
importTextWithMatchingTimeCodesToolStripMenuItem.Text = language.ImportTextWithMatchingTimeCodes;
|
||||
@ -5078,6 +5080,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
subtitleListView1.MultiSelect = true;
|
||||
checkBoxUseTimeCodesFromIdx.Enabled = checkBoxUseTimeCodesFromIdx.Visible;
|
||||
checkBoxShowOnlyForced.Enabled = _hasForcedSubtitles;
|
||||
_mainOcrSelectedIndices = null;
|
||||
}
|
||||
|
||||
private bool _isLatinDb;
|
||||
@ -5672,7 +5675,24 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
}
|
||||
else
|
||||
{
|
||||
_mainOcrIndex++;
|
||||
if (_mainOcrSelectedIndices != null)
|
||||
{
|
||||
var idx = _mainOcrSelectedIndices.IndexOf(_mainOcrIndex);
|
||||
if (idx >= 0 && idx + 1 < _mainOcrSelectedIndices.Count)
|
||||
{
|
||||
_mainOcrIndex = _mainOcrSelectedIndices[idx + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
_abort = true;
|
||||
_mainOcrSelectedIndices = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_mainOcrIndex++;
|
||||
}
|
||||
|
||||
_mainOcrTimer.Start();
|
||||
}
|
||||
}
|
||||
@ -7543,24 +7563,35 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
// Enable toolstrips if event was raised by Subtitle listview.
|
||||
// Enable toolstrips if event was raised by Subtitle listview
|
||||
bool enableIfRaisedBySubListView = contextMenuStripListview.SourceControl == subtitleListView1;
|
||||
normalToolStripMenuItem.Visible = enableIfRaisedBySubListView;
|
||||
italicToolStripMenuItem.Visible = enableIfRaisedBySubListView;
|
||||
toolStripSeparator1.Visible = enableIfRaisedBySubListView && subtitleListView1.SelectedItems.Count == 1;
|
||||
saveImageAsToolStripMenuItem.Visible = !enableIfRaisedBySubListView || subtitleListView1.SelectedItems.Count == 1;
|
||||
|
||||
// Image compare.
|
||||
// Image compare
|
||||
bool enableIfImageCompare = _ocrMethodIndex == _ocrMethodBinaryImageCompare;
|
||||
inspectImageCompareMatchesForCurrentImageToolStripMenuItem.Visible = enableIfImageCompare;
|
||||
EditLastAdditionsToolStripMenuItem.Visible = enableIfImageCompare && _lastAdditions != null && _lastAdditions.Count > 0;
|
||||
|
||||
// Use N-OCR compare. (Only available in Beta mode).
|
||||
// Use N-OCR compare
|
||||
bool useNocrCompare = _ocrMethodIndex == _ocrMethodNocr;
|
||||
toolStripMenuItemInspectNOcrMatches.Visible = useNocrCompare;
|
||||
OcrTrainingToolStripMenuItem.Visible = useNocrCompare || enableIfImageCompare;
|
||||
|
||||
toolStripSeparatorImageCompare.Visible = useNocrCompare || enableIfImageCompare;
|
||||
|
||||
if (subtitleListView1.SelectedItems.Count > 0 && (_ocrMethodIndex == _ocrMethodNocr || _ocrMethodIndex == _ocrMethodBinaryImageCompare))
|
||||
{
|
||||
oCRSelectedLinesToolStripMenuItem.Visible = true;
|
||||
toolStripSeparatorOcrSelected.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
oCRSelectedLinesToolStripMenuItem.Visible = true;
|
||||
toolStripSeparatorOcrSelected.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveImageAsToolStripMenuItemClick(object sender, EventArgs e)
|
||||
@ -10010,5 +10041,11 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
removeAllXToolStripMenuItem.Text = string.Format(LanguageSettings.Current.Settings.RemoveX.RemoveChar('?'), word);
|
||||
}
|
||||
}
|
||||
|
||||
private void oCRSelectedLinesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_mainOcrSelectedIndices = subtitleListView1.GetSelectedIndices().ToList();
|
||||
ButtonStartOcrClick(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1889,7 +1889,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
SplitLineAtCursorAndWaveformPosition = "Split line at cursor/video position",
|
||||
AutoDurationCurrentLine = "Auto duration (current line)",
|
||||
SelectAll = "Select all",
|
||||
Insert = "Insert",
|
||||
InsertFirstLine = "Insert line",
|
||||
InsertBefore = "Insert before",
|
||||
InsertAfter = "Insert after",
|
||||
@ -1905,6 +1904,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
ColumnTextUp = "Text up",
|
||||
ColumnTextDown = "Text down",
|
||||
ColumnCopyOriginalTextToCurrent = "Copy text from original to current",
|
||||
OcrSelectedLines = "OCR selected lines",
|
||||
Split = "Split",
|
||||
MergeSelectedLines = "Merge selected lines",
|
||||
MergeSelectedLinesAsDialog = "Merge selected lines as dialog",
|
||||
|
@ -4387,9 +4387,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "Main/Menu/ContextMenu/SelectAll":
|
||||
language.Main.Menu.ContextMenu.SelectAll = reader.Value;
|
||||
break;
|
||||
case "Main/Menu/ContextMenu/Insert":
|
||||
language.Main.Menu.ContextMenu.Insert = reader.Value;
|
||||
break;
|
||||
case "Main/Menu/ContextMenu/InsertFirstLine":
|
||||
language.Main.Menu.ContextMenu.InsertFirstLine = reader.Value;
|
||||
break;
|
||||
@ -4435,6 +4432,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "Main/Menu/ContextMenu/ColumnCopyOriginalTextToCurrent":
|
||||
language.Main.Menu.ContextMenu.ColumnCopyOriginalTextToCurrent = reader.Value;
|
||||
break;
|
||||
case "Main/Menu/ContextMenu/OcrSelectedLines":
|
||||
language.Main.Menu.ContextMenu.OcrSelectedLines = reader.Value;
|
||||
break;
|
||||
case "Main/Menu/ContextMenu/Split":
|
||||
language.Main.Menu.ContextMenu.Split = reader.Value;
|
||||
break;
|
||||
|
@ -1734,7 +1734,6 @@
|
||||
public string SplitLineAtCursorAndWaveformPosition { get; set; }
|
||||
public string AutoDurationCurrentLine { get; set; }
|
||||
public string SelectAll { get; set; }
|
||||
public string Insert { get; set; }
|
||||
public string InsertFirstLine { get; set; }
|
||||
public string InsertBefore { get; set; }
|
||||
public string InsertAfter { get; set; }
|
||||
@ -1750,6 +1749,7 @@
|
||||
public string ColumnTextUp { get; set; }
|
||||
public string ColumnTextDown { get; set; }
|
||||
public string ColumnCopyOriginalTextToCurrent { get; set; }
|
||||
public string OcrSelectedLines { get; set; }
|
||||
public string Split { get; set; }
|
||||
public string MergeSelectedLines { get; set; }
|
||||
public string MergeSelectedLinesAsDialog { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user