Update UI for Use once

This commit is contained in:
Martijn van Berkel (Flitskikker) 2022-09-20 14:48:35 +02:00
parent 80ed0c0d8f
commit bdd170412c
6 changed files with 93 additions and 39 deletions

View File

@ -79,6 +79,7 @@
this.Column15 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column15 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.labelItalicOn2 = new System.Windows.Forms.Label(); this.labelItalicOn2 = new System.Windows.Forms.Label();
this.labelSubtitleImage = new System.Windows.Forms.Label(); this.labelSubtitleImage = new System.Windows.Forms.Label();
this.buttonOnce = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSubtitleImage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxSubtitleImage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCharacter)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCharacter)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLastEdit)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxLastEdit)).BeginInit();
@ -102,10 +103,10 @@
this.buttonSkip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonSkip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonSkip.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonSkip.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonSkip.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonSkip.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonSkip.Location = new System.Drawing.Point(410, 373); this.buttonSkip.Location = new System.Drawing.Point(491, 373);
this.buttonSkip.Name = "buttonSkip"; this.buttonSkip.Name = "buttonSkip";
this.buttonSkip.Size = new System.Drawing.Size(75, 23); this.buttonSkip.Size = new System.Drawing.Size(75, 23);
this.buttonSkip.TabIndex = 4; this.buttonSkip.TabIndex = 5;
this.buttonSkip.Text = "&Skip"; this.buttonSkip.Text = "&Skip";
this.buttonSkip.UseVisualStyleBackColor = true; this.buttonSkip.UseVisualStyleBackColor = true;
this.buttonSkip.Click += new System.EventHandler(this.buttonSkip_Click); this.buttonSkip.Click += new System.EventHandler(this.buttonSkip_Click);
@ -118,7 +119,7 @@
this.pictureBoxSubtitleImage.BackColor = System.Drawing.Color.Transparent; this.pictureBoxSubtitleImage.BackColor = System.Drawing.Color.Transparent;
this.pictureBoxSubtitleImage.Location = new System.Drawing.Point(12, 35); this.pictureBoxSubtitleImage.Location = new System.Drawing.Point(12, 35);
this.pictureBoxSubtitleImage.Name = "pictureBoxSubtitleImage"; this.pictureBoxSubtitleImage.Name = "pictureBoxSubtitleImage";
this.pictureBoxSubtitleImage.Size = new System.Drawing.Size(554, 164); this.pictureBoxSubtitleImage.Size = new System.Drawing.Size(635, 164);
this.pictureBoxSubtitleImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBoxSubtitleImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBoxSubtitleImage.TabIndex = 12; this.pictureBoxSubtitleImage.TabIndex = 12;
this.pictureBoxSubtitleImage.TabStop = false; this.pictureBoxSubtitleImage.TabStop = false;
@ -177,10 +178,10 @@
this.buttonAbort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonAbort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonAbort.DialogResult = System.Windows.Forms.DialogResult.Abort; this.buttonAbort.DialogResult = System.Windows.Forms.DialogResult.Abort;
this.buttonAbort.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonAbort.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonAbort.Location = new System.Drawing.Point(491, 373); this.buttonAbort.Location = new System.Drawing.Point(572, 373);
this.buttonAbort.Name = "buttonAbort"; this.buttonAbort.Name = "buttonAbort";
this.buttonAbort.Size = new System.Drawing.Size(75, 23); this.buttonAbort.Size = new System.Drawing.Size(75, 23);
this.buttonAbort.TabIndex = 5; this.buttonAbort.TabIndex = 6;
this.buttonAbort.Text = "&Abort"; this.buttonAbort.Text = "&Abort";
this.buttonAbort.UseVisualStyleBackColor = true; this.buttonAbort.UseVisualStyleBackColor = true;
// //
@ -201,7 +202,7 @@
// //
this.buttonExpandSelection.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonExpandSelection.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonExpandSelection.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonExpandSelection.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonExpandSelection.Location = new System.Drawing.Point(453, 4); this.buttonExpandSelection.Location = new System.Drawing.Point(534, 4);
this.buttonExpandSelection.Name = "buttonExpandSelection"; this.buttonExpandSelection.Name = "buttonExpandSelection";
this.buttonExpandSelection.Size = new System.Drawing.Size(112, 23); this.buttonExpandSelection.Size = new System.Drawing.Size(112, 23);
this.buttonExpandSelection.TabIndex = 20; this.buttonExpandSelection.TabIndex = 20;
@ -213,7 +214,7 @@
// //
this.buttonShrinkSelection.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonShrinkSelection.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonShrinkSelection.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonShrinkSelection.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonShrinkSelection.Location = new System.Drawing.Point(335, 4); this.buttonShrinkSelection.Location = new System.Drawing.Point(416, 4);
this.buttonShrinkSelection.Name = "buttonShrinkSelection"; this.buttonShrinkSelection.Name = "buttonShrinkSelection";
this.buttonShrinkSelection.Size = new System.Drawing.Size(112, 23); this.buttonShrinkSelection.Size = new System.Drawing.Size(112, 23);
this.buttonShrinkSelection.TabIndex = 21; this.buttonShrinkSelection.TabIndex = 21;
@ -274,7 +275,7 @@
this.labelItalicOn.AutoSize = true; this.labelItalicOn.AutoSize = true;
this.labelItalicOn.Font = new System.Drawing.Font("Tahoma", 24F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelItalicOn.Font = new System.Drawing.Font("Tahoma", 24F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelItalicOn.ForeColor = System.Drawing.Color.Red; this.labelItalicOn.ForeColor = System.Drawing.Color.Red;
this.labelItalicOn.Location = new System.Drawing.Point(193, -1); this.labelItalicOn.Location = new System.Drawing.Point(234, -1);
this.labelItalicOn.Name = "labelItalicOn"; this.labelItalicOn.Name = "labelItalicOn";
this.labelItalicOn.Size = new System.Drawing.Size(101, 39); this.labelItalicOn.Size = new System.Drawing.Size(101, 39);
this.labelItalicOn.TabIndex = 26; this.labelItalicOn.TabIndex = 26;
@ -317,7 +318,7 @@
this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.None; this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.dataGridView1.Size = new System.Drawing.Size(553, 49); this.dataGridView1.Size = new System.Drawing.Size(634, 49);
this.dataGridView1.TabIndex = 27; this.dataGridView1.TabIndex = 27;
this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
// //
@ -473,7 +474,6 @@
// //
// labelItalicOn2 // labelItalicOn2
// //
this.labelItalicOn2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.labelItalicOn2.AutoSize = true; this.labelItalicOn2.AutoSize = true;
this.labelItalicOn2.Font = new System.Drawing.Font("Tahoma", 24F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelItalicOn2.Font = new System.Drawing.Font("Tahoma", 24F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelItalicOn2.ForeColor = System.Drawing.Color.Red; this.labelItalicOn2.ForeColor = System.Drawing.Color.Red;
@ -493,12 +493,25 @@
this.labelSubtitleImage.TabIndex = 29; this.labelSubtitleImage.TabIndex = 29;
this.labelSubtitleImage.Text = "subtitle image"; this.labelSubtitleImage.Text = "subtitle image";
// //
// buttonOnce
//
this.buttonOnce.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOnce.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOnce.Location = new System.Drawing.Point(410, 373);
this.buttonOnce.Name = "buttonOnce";
this.buttonOnce.Size = new System.Drawing.Size(75, 23);
this.buttonOnce.TabIndex = 4;
this.buttonOnce.Text = "&Use once";
this.buttonOnce.UseVisualStyleBackColor = true;
this.buttonOnce.Click += new System.EventHandler(this.buttonOnce_Click);
//
// VobSubOcrCharacter // VobSubOcrCharacter
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DimGray; this.BackColor = System.Drawing.Color.DimGray;
this.ClientSize = new System.Drawing.Size(577, 404); this.ClientSize = new System.Drawing.Size(658, 404);
this.Controls.Add(this.buttonOnce);
this.Controls.Add(this.textBoxCharacters); this.Controls.Add(this.textBoxCharacters);
this.Controls.Add(this.labelSubtitleImage); this.Controls.Add(this.labelSubtitleImage);
this.Controls.Add(this.labelItalicOn2); this.Controls.Add(this.labelItalicOn2);
@ -577,5 +590,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column15; private System.Windows.Forms.DataGridViewTextBoxColumn Column15;
private System.Windows.Forms.Label labelItalicOn2; private System.Windows.Forms.Label labelItalicOn2;
private System.Windows.Forms.Label labelSubtitleImage; private System.Windows.Forms.Label labelSubtitleImage;
private System.Windows.Forms.Button buttonOnce;
} }
} }

View File

@ -35,6 +35,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
labelItalicOn2.Visible = false; labelItalicOn2.Visible = false;
buttonAbort.Text = language.Abort; buttonAbort.Text = language.Abort;
buttonOK.Text = LanguageSettings.Current.General.Ok; buttonOK.Text = LanguageSettings.Current.General.Ok;
buttonOnce.Text = language.UseOnce;
buttonSkip.Text = language.Skip; buttonSkip.Text = language.Skip;
checkBoxAutoSubmitOfFirstChar.Text = language.AutoSubmitOnFirstChar; checkBoxAutoSubmitOfFirstChar.Text = language.AutoSubmitOnFirstChar;
@ -70,12 +71,14 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
public bool ShrinkSelection { get; private set; } public bool ShrinkSelection { get; private set; }
public bool SkipImage { get; private set; } public bool SkipImage { get; private set; }
public bool UseOnce { get; private set; }
internal void Initialize(Bitmap vobSubImage, ImageSplitterItem character, Point position, bool italicChecked, bool showShrink, VobSubOcr.CompareMatch bestGuess, List<VobSubOcr.ImageCompareAddition> additions, VobSubOcr vobSubForm, bool allowExpand = true) internal void Initialize(Bitmap vobSubImage, ImageSplitterItem character, Point position, bool italicChecked, bool showShrink, VobSubOcr.CompareMatch bestGuess, List<VobSubOcr.ImageCompareAddition> additions, VobSubOcr vobSubForm, bool allowExpand = true)
{ {
ShrinkSelection = false; ShrinkSelection = false;
ExpandSelection = false; ExpandSelection = false;
SkipImage = false; SkipImage = false;
UseOnce = false;
textBoxCharacters.Text = string.Empty; textBoxCharacters.Text = string.Empty;
if (bestGuess != null) if (bestGuess != null)
@ -336,5 +339,11 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
{ {
DialogResult = DialogResult.Cancel; DialogResult = DialogResult.Cancel;
} }
private void buttonOnce_Click(object sender, EventArgs e)
{
UseOnce = true;
DialogResult = DialogResult.OK;
}
} }
} }

View File

@ -66,6 +66,7 @@
this.contextMenuLinesForeground = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuLinesForeground = new System.Windows.Forms.ContextMenuStrip(this.components);
this.removeForegroundToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeForegroundToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonOnce = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCharacter)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCharacter)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSubtitleImage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxSubtitleImage)).BeginInit();
this.groupBoxNewInput.SuspendLayout(); this.groupBoxNewInput.SuspendLayout();
@ -107,7 +108,7 @@
this.buttonAbort.Location = new System.Drawing.Point(541, 613); this.buttonAbort.Location = new System.Drawing.Point(541, 613);
this.buttonAbort.Name = "buttonAbort"; this.buttonAbort.Name = "buttonAbort";
this.buttonAbort.Size = new System.Drawing.Size(75, 23); this.buttonAbort.Size = new System.Drawing.Size(75, 23);
this.buttonAbort.TabIndex = 25; this.buttonAbort.TabIndex = 26;
this.buttonAbort.Text = "&Abort"; this.buttonAbort.Text = "&Abort";
this.buttonAbort.UseVisualStyleBackColor = true; this.buttonAbort.UseVisualStyleBackColor = true;
this.buttonAbort.Click += new System.EventHandler(this.buttonAbort_Click); this.buttonAbort.Click += new System.EventHandler(this.buttonAbort_Click);
@ -159,13 +160,13 @@
// contextMenuStripLetters // contextMenuStripLetters
// //
this.contextMenuStripLetters.Name = "contextMenuStripLetters"; this.contextMenuStripLetters.Name = "contextMenuStripLetters";
this.contextMenuStripLetters.Size = new System.Drawing.Size(181, 26); this.contextMenuStripLetters.Size = new System.Drawing.Size(61, 4);
// //
// buttonOK // buttonOK
// //
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(379, 613); this.buttonOK.Location = new System.Drawing.Point(298, 613);
this.buttonOK.Name = "buttonOK"; this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 23; this.buttonOK.TabIndex = 23;
@ -181,7 +182,7 @@
this.buttonCancel.Location = new System.Drawing.Point(460, 613); this.buttonCancel.Location = new System.Drawing.Point(460, 613);
this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 24; this.buttonCancel.TabIndex = 25;
this.buttonCancel.Text = "&Skip"; this.buttonCancel.Text = "&Skip";
this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.UseVisualStyleBackColor = true;
// //
@ -472,11 +473,24 @@
this.clearToolStripMenuItem.Text = "Clear"; this.clearToolStripMenuItem.Text = "Clear";
this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click); this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
// //
// buttonOnce
//
this.buttonOnce.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOnce.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOnce.Location = new System.Drawing.Point(379, 613);
this.buttonOnce.Name = "buttonOnce";
this.buttonOnce.Size = new System.Drawing.Size(75, 23);
this.buttonOnce.TabIndex = 24;
this.buttonOnce.Text = "&Use once";
this.buttonOnce.UseVisualStyleBackColor = true;
this.buttonOnce.Click += new System.EventHandler(this.buttonOnce_Click);
//
// VobSubOcrNOcrCharacter // VobSubOcrNOcrCharacter
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(648, 642); this.ClientSize = new System.Drawing.Size(648, 642);
this.Controls.Add(this.buttonOnce);
this.Controls.Add(this.groupBoxNewInput); this.Controls.Add(this.groupBoxNewInput);
this.Controls.Add(this.buttonShrinkSelection); this.Controls.Add(this.buttonShrinkSelection);
this.Controls.Add(this.buttonExpandSelection); this.Controls.Add(this.buttonExpandSelection);
@ -548,5 +562,6 @@
private System.Windows.Forms.Label labelLinestoDraw; private System.Windows.Forms.Label labelLinestoDraw;
private System.Windows.Forms.Button buttonGuessAgain; private System.Windows.Forms.Button buttonGuessAgain;
private System.Windows.Forms.ContextMenuStrip contextMenuStripLetters; private System.Windows.Forms.ContextMenuStrip contextMenuStripLetters;
private System.Windows.Forms.Button buttonOnce;
} }
} }

View File

@ -56,6 +56,8 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
public bool IsItalic => checkBoxItalic.Checked; public bool IsItalic => checkBoxItalic.Checked;
public bool UseOnce { get; private set; }
internal void Initialize(Bitmap vobSubImage, ImageSplitterItem character, Point position, bool italicChecked, bool showExpand, bool showShrink, string text) internal void Initialize(Bitmap vobSubImage, ImageSplitterItem character, Point position, bool italicChecked, bool showExpand, bool showShrink, string text)
{ {
listBoxLinesForeground.Items.Clear(); listBoxLinesForeground.Items.Clear();
@ -66,6 +68,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
radioButtonHot.Checked = true; radioButtonHot.Checked = true;
ShrinkSelection = false; ShrinkSelection = false;
ExpandSelection = false; ExpandSelection = false;
UseOnce = false;
textBoxCharacters.Text = text; textBoxCharacters.Text = text;
NOcrChar = new NOcrChar { MarginTop = character.Top }; NOcrChar = new NOcrChar { MarginTop = character.Top };
@ -168,30 +171,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
private void buttonOK_Click(object sender, EventArgs e) private void buttonOK_Click(object sender, EventArgs e)
{ {
if (listBoxLinesForeground.Items.Count == 0) HandleOKClicked(false);
{
MessageBox.Show("No foreground lines!");
return;
}
if (listBoxlinesBackground.Items.Count == 0 && !_warningNoNotForegroundLinesShown)
{
MessageBox.Show("No not-foreground lines!");
_warningNoNotForegroundLinesShown = true;
return;
}
if (textBoxCharacters.Text.Length == 0)
{
MessageBox.Show("Text is empty!");
return;
}
if (!IsMatch())
{
MessageBox.Show("Lines does not match image!");
return;
}
NOcrChar.Text = textBoxCharacters.Text;
NOcrChar.Italic = checkBoxItalic.Checked;
DialogResult = DialogResult.OK;
} }
private void pictureBoxCharacter_Paint(object sender, PaintEventArgs e) private void pictureBoxCharacter_Paint(object sender, PaintEventArgs e)
@ -1008,5 +988,39 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
{ {
textBoxCharacters.Focus(); textBoxCharacters.Focus();
} }
private void buttonOnce_Click(object sender, EventArgs e)
{
HandleOKClicked(true);
}
private void HandleOKClicked(bool useOnce)
{
if (listBoxLinesForeground.Items.Count == 0)
{
MessageBox.Show("No foreground lines!");
return;
}
if (listBoxlinesBackground.Items.Count == 0 && !_warningNoNotForegroundLinesShown)
{
MessageBox.Show("No not-foreground lines!");
_warningNoNotForegroundLinesShown = true;
return;
}
if (textBoxCharacters.Text.Length == 0)
{
MessageBox.Show("Text is empty!");
return;
}
if (!IsMatch())
{
MessageBox.Show("Lines does not match image!");
return;
}
NOcrChar.Text = textBoxCharacters.Text;
NOcrChar.Italic = checkBoxItalic.Checked;
UseOnce = useOnce;
DialogResult = DialogResult.OK;
}
} }
} }

View File

@ -3418,6 +3418,7 @@ Keep changes?",
Title = "OCR - Manual image to text", Title = "OCR - Manual image to text",
Abort = "&Abort", Abort = "&Abort",
Skip = "&Skip", Skip = "&Skip",
UseOnce = "&Use once",
SubtitleImage = "Subtitle image", SubtitleImage = "Subtitle image",
ShrinkSelection = "Shrink selection", ShrinkSelection = "Shrink selection",
ExpandSelection = "Expand selection", ExpandSelection = "Expand selection",

View File

@ -3268,6 +3268,7 @@
public string Italic { get; set; } public string Italic { get; set; }
public string Abort { get; set; } public string Abort { get; set; }
public string Skip { get; set; } public string Skip { get; set; }
public string UseOnce { get; set; }
public string Nordic { get; set; } public string Nordic { get; set; }
public string Spanish { get; set; } public string Spanish { get; set; }
public string German { get; set; } public string German { get; set; }