Save OCR language selection

This commit is contained in:
Jaex 2016-05-15 11:47:30 +03:00
parent 4c3f0efd1f
commit c477c8a011
4 changed files with 18 additions and 7 deletions

View file

@ -80,13 +80,13 @@ private void InitializeComponent()
// llAttribution
//
this.llAttribution.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.llAttribution.AutoSize = true;
this.llAttribution.Location = new System.Drawing.Point(440, 8);
this.llAttribution.Location = new System.Drawing.Point(320, 8);
this.llAttribution.Name = "llAttribution";
this.llAttribution.Size = new System.Drawing.Size(114, 13);
this.llAttribution.Size = new System.Drawing.Size(232, 24);
this.llAttribution.TabIndex = 4;
this.llAttribution.TabStop = true;
this.llAttribution.Text = "Using OCR.Space API";
this.llAttribution.Text = "Powered by OCR.Space API";
this.llAttribution.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.llAttribution.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llAttribution_LinkClicked);
//
// btnStartOCR

View file

@ -26,6 +26,7 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib;
using ShareX.ScreenCaptureLib;
using ShareX.UploadersLib;
using ShareX.UploadersLib.OtherServices;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
@ -257,5 +258,11 @@ public ApplicationConfig()
public WebpageCaptureOptions WebpageCaptureOptions = new WebpageCaptureOptions();
#endregion Webpage Capture Form
#region OCR Form
public OCRSpaceLanguages OCRLanguage = OCRSpaceLanguages.eng;
#endregion OCR Form
}
}

View file

@ -675,13 +675,15 @@ public static void OpenOCR()
{
if (img != null)
{
using (Stream stream = SaveImage(img, EImageFormat.JPEG, 90))
using (Stream stream = SaveImage(img, EImageFormat.JPEG, 95))
{
if (stream != null)
{
using (OCRSpaceForm form = new OCRSpaceForm(stream, "ShareX.jpg"))
{
form.Language = Program.Settings.OCRLanguage;
form.ShowDialog();
Program.Settings.OCRLanguage = form.Language;
}
}
}

View file

@ -968,9 +968,11 @@ private void DoOCR()
{
if (Data != null && Info.DataType == EDataType.Image)
{
using (OCRSpaceForm ocrForm = new OCRSpaceForm(Data, Info.FileName))
using (OCRSpaceForm form = new OCRSpaceForm(Data, Info.FileName))
{
ocrForm.ShowDialog();
form.Language = Program.Settings.OCRLanguage;
form.ShowDialog();
Program.Settings.OCRLanguage = form.Language;
}
}
}