From 8ed96e2b245309e6100aa7a663a15d437a498ee0 Mon Sep 17 00:00:00 2001 From: niksedk Date: Tue, 10 Oct 2023 22:33:28 +0200 Subject: [PATCH] Work on auto-translate --- src/libse/AutoTranslate/DeepLTranslate.cs | 132 ++ src/libse/AutoTranslate/GoogleTranslateV1.cs | 3 +- src/libse/AutoTranslate/GoogleTranslateV2.cs | 4 +- src/libse/AutoTranslate/IAutoTranslator.cs | 2 +- src/libse/AutoTranslate/LibreTranslate.cs | 3 +- .../AutoTranslate/MicrosoftTranslator.cs | 3 +- src/libse/AutoTranslate/MyMemoryApi.cs | 3 +- .../AutoTranslate/NoLanguageLeftBehindApi.cs | 3 +- .../NoLanguageLeftBehindServe.cs | 5 +- .../AutoTranslate/SeamlessM4TTranslate.cs | 3 +- src/libse/Common/Settings.cs | 33 + src/ui/Forms/BatchConvert.Designer.cs | 1307 +++++++++-------- src/ui/Forms/BatchConvert.cs | 63 + src/ui/Forms/Options/Settings.Designer.cs | 219 ++- src/ui/Forms/Options/Settings.cs | 11 + .../Forms/Translate/AutoTranslate.Designer.cs | 327 +++-- src/ui/Forms/Translate/AutoTranslate.cs | 125 +- .../CommandLineConverter.cs | 1 + 18 files changed, 1419 insertions(+), 828 deletions(-) create mode 100644 src/libse/AutoTranslate/DeepLTranslate.cs diff --git a/src/libse/AutoTranslate/DeepLTranslate.cs b/src/libse/AutoTranslate/DeepLTranslate.cs new file mode 100644 index 000000000..9431bcc1f --- /dev/null +++ b/src/libse/AutoTranslate/DeepLTranslate.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Core.Translate; + +namespace Nikse.SubtitleEdit.Core.AutoTranslate +{ + /// + /// DeepL Pro V2 translator - see https://www.deepl.com/api.html + /// + public class DeepLTranslate : IAutoTranslator + { + private string _apiKey; + private string _apiUrl; + private string _formality; + private HttpClient _client; + + public static string StaticName { get; set; } = "DeepL V2 translate"; + public string Name => StaticName; + public string Url => "https://www.deepl.com"; + public void Initialize() + { + _apiKey = Configuration.Settings.Tools.AutoTranslateDeepLApiKey; + _apiUrl = Configuration.Settings.Tools.AutoTranslateDeepLUrl; + _formality = Configuration.Settings.Tools.AutoTranslateDeepLFormality; + + if (string.IsNullOrEmpty(_apiKey) || string.IsNullOrEmpty(_apiUrl)) + { + return; + } + + _client = new HttpClient(); + _client.BaseAddress = new Uri(_apiUrl.Trim().TrimEnd('/')); + _client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "DeepL-Auth-Key " + _apiKey.Trim()); + _formality = string.IsNullOrWhiteSpace(_formality) ? "default" : _formality.Trim(); + } + + public List GetSupportedSourceLanguages() + { + return GetTranslationPairs(); + } + + public List GetSupportedTargetLanguages() + { + return GetTranslationPairs(); + } + + public List GetTranslationPairs() + { + return new List + { + new TranslationPair("Bulgarian", "bg"), + new TranslationPair("Chinese", "zh"), + new TranslationPair("Czech", "cs"), + new TranslationPair("Danish", "da"), + new TranslationPair("Dutch", "nl"), + new TranslationPair("English", "en"), + new TranslationPair("Estonian", "et"), + new TranslationPair("Finnish", "fi"), + new TranslationPair("French", "fr"), + new TranslationPair("German", "de"), + new TranslationPair("Greek", "el"), + new TranslationPair("Hungarian", "hu"), + new TranslationPair("Indonesian", "id"), + new TranslationPair("Italian", "it"), + new TranslationPair("Japanese", "ja"), + new TranslationPair("Korean", "ko"), + new TranslationPair("Latvian", "lv"), + new TranslationPair("Lithuanian", "lt"), + new TranslationPair("Norwegian (Bokmål)", "nb"), + new TranslationPair("Polish", "pl"), + new TranslationPair("Portuguese", "pt"), + new TranslationPair("Romanian", "ro"), + new TranslationPair("Russian", "ru"), + new TranslationPair("Slovak", "sk"), + new TranslationPair("Slovenian", "sl"), + new TranslationPair("Spanish", "es"), + new TranslationPair("Swedish", "sv"), + new TranslationPair("Turkish", "tr"), + new TranslationPair("Ukranian", "uk"), + }; + } + + //public List Translate(string sourceLanguage, string targetLanguage, Paragraph paragraph, StringBuilder log) + public Task Translate(string text, string sourceLanguageCode, string targetLanguageCode) + { + var postContent = new FormUrlEncodedContent(new[] + { + new KeyValuePair("text", text), + new KeyValuePair("target_lang", targetLanguageCode), + new KeyValuePair("source_lang", sourceLanguageCode), + new KeyValuePair("formality", _formality), + }); + var result = _client.PostAsync("/v2/translate", postContent).Result; + var resultContent = result.Content.ReadAsStringAsync().Result; + if (result.StatusCode == HttpStatusCode.Forbidden) + { + throw new Exception("Bad API key"); + } + + var resultList = new List(); + var parser = new JsonParser(); + var x = (Dictionary)parser.Parse(resultContent); + foreach (var k in x.Keys) + { + if (x[k] is List mainList) + { + foreach (var mainListItem in mainList) + { + if (mainListItem is Dictionary innerDic) + { + foreach (var transItem in innerDic.Keys) + { + if (transItem == "text") + { + var s = innerDic[transItem].ToString(); + resultList.Add(s); + } + } + } + } + } + } + + + return Task.FromResult(string.Join(Environment.NewLine, resultList)); + } + } +} diff --git a/src/libse/AutoTranslate/GoogleTranslateV1.cs b/src/libse/AutoTranslate/GoogleTranslateV1.cs index d1efc5525..3c9a8990b 100644 --- a/src/libse/AutoTranslate/GoogleTranslateV1.cs +++ b/src/libse/AutoTranslate/GoogleTranslateV1.cs @@ -19,7 +19,8 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate { private IDownloader _httpClient; - public string Name { get; set; } = "Google Translate V1 API"; + public static string StaticName { get; set; } = "Google Translate V1 API"; + public string Name => StaticName; public string Url => "https://translate.google.com/"; public void Initialize() diff --git a/src/libse/AutoTranslate/GoogleTranslateV2.cs b/src/libse/AutoTranslate/GoogleTranslateV2.cs index 645e5ecc7..722719974 100644 --- a/src/libse/AutoTranslate/GoogleTranslateV2.cs +++ b/src/libse/AutoTranslate/GoogleTranslateV2.cs @@ -21,7 +21,9 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate private string _apiKey; private IDownloader _httpClient; - public string Name { get; set; } = "Google Translate Cloud V2 API"; + public static string StaticName { get; set; } = "Google Translate V2 API"; + public string Name => StaticName; + public string Url => "https://translate.google.com/"; public void Initialize() diff --git a/src/libse/AutoTranslate/IAutoTranslator.cs b/src/libse/AutoTranslate/IAutoTranslator.cs index a74057822..0a77c7a5e 100644 --- a/src/libse/AutoTranslate/IAutoTranslator.cs +++ b/src/libse/AutoTranslate/IAutoTranslator.cs @@ -9,7 +9,7 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate /// /// Name of auto translator (can be translated). /// - string Name { get; set; } + string Name { get; } /// /// Url to homepage. diff --git a/src/libse/AutoTranslate/LibreTranslate.cs b/src/libse/AutoTranslate/LibreTranslate.cs index 45a0b9b56..1259ca9c2 100644 --- a/src/libse/AutoTranslate/LibreTranslate.cs +++ b/src/libse/AutoTranslate/LibreTranslate.cs @@ -15,7 +15,8 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate { private HttpClient _httpClient; - public string Name { get; set; } = "LibreTranslate"; + public static string StaticName { get; set; } = "LibreTranslate"; + public string Name => StaticName; public string Url => "https://github.com/LibreTranslate/LibreTranslate"; public void Initialize() diff --git a/src/libse/AutoTranslate/MicrosoftTranslator.cs b/src/libse/AutoTranslate/MicrosoftTranslator.cs index c24884d8c..885861392 100644 --- a/src/libse/AutoTranslate/MicrosoftTranslator.cs +++ b/src/libse/AutoTranslate/MicrosoftTranslator.cs @@ -28,7 +28,8 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate private string _category; private IDownloader _httpClient; - public string Name { get; set; } = "Bing Microsoft Translator"; + public static string StaticName { get; set; } = "Bing Microsoft Translator"; + public string Name => StaticName; public string Url => "https://www.bing.com/translator"; public void Initialize() diff --git a/src/libse/AutoTranslate/MyMemoryApi.cs b/src/libse/AutoTranslate/MyMemoryApi.cs index c1e1565c0..bb34e9078 100644 --- a/src/libse/AutoTranslate/MyMemoryApi.cs +++ b/src/libse/AutoTranslate/MyMemoryApi.cs @@ -12,7 +12,8 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate { private IDownloader _httpClient; - public string Name { get; set; } = "MyMemory Translate"; + public static string StaticName { get; set; } = "MyMemory Translate"; + public string Name => StaticName; public string Url => "https://mymemory.translated.net/"; public void Initialize() diff --git a/src/libse/AutoTranslate/NoLanguageLeftBehindApi.cs b/src/libse/AutoTranslate/NoLanguageLeftBehindApi.cs index adec7265b..4860299a0 100644 --- a/src/libse/AutoTranslate/NoLanguageLeftBehindApi.cs +++ b/src/libse/AutoTranslate/NoLanguageLeftBehindApi.cs @@ -14,7 +14,8 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate { private IDownloader _httpClient; - public string Name { get; set; } = "winstxnhdw-nllb-api"; + public static string StaticName { get; set; } = "winstxnhdw-nllb-api"; + public string Name => StaticName; public string Url => "https://github.com/winstxnhdw/nllb-api"; public void Initialize() diff --git a/src/libse/AutoTranslate/NoLanguageLeftBehindServe.cs b/src/libse/AutoTranslate/NoLanguageLeftBehindServe.cs index 81dfb48dd..172e788e1 100644 --- a/src/libse/AutoTranslate/NoLanguageLeftBehindServe.cs +++ b/src/libse/AutoTranslate/NoLanguageLeftBehindServe.cs @@ -14,8 +14,9 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate public class NoLanguageLeftBehindServe : IAutoTranslator { private IDownloader _httpClient; - - public string Name { get; set; } = "thammegowda-nllb-serve"; + + public static string StaticName { get; set; } = "thammegowda-nllb-serve"; + public string Name => StaticName; public string Url => "https://github.com/thammegowda/nllb-serve"; public void Initialize() diff --git a/src/libse/AutoTranslate/SeamlessM4TTranslate.cs b/src/libse/AutoTranslate/SeamlessM4TTranslate.cs index e746a0611..3bf1f0304 100644 --- a/src/libse/AutoTranslate/SeamlessM4TTranslate.cs +++ b/src/libse/AutoTranslate/SeamlessM4TTranslate.cs @@ -15,7 +15,8 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate { private HttpClient _httpClient; - public string Name { get; set; } = "SeamlessM4T"; + public static string StaticName { get; set; } = "SeamlessM4T"; + public string Name => StaticName; public string Url => "https://replicate.com/cjwbw/seamless_communication/api"; public void Initialize() diff --git a/src/libse/Common/Settings.cs b/src/libse/Common/Settings.cs index 5b3f8b82d..8f75d2a4b 100644 --- a/src/libse/Common/Settings.cs +++ b/src/libse/Common/Settings.cs @@ -161,6 +161,9 @@ namespace Nikse.SubtitleEdit.Core.Common public string AutoTranslateLibreApiKey { get; set; } public string AutoTranslateMyMemoryApiKey { get; set; } public string AutoTranslateSeamlessM4TUrl { get; set; } + public string AutoTranslateDeepLApiKey { get; set; } + public string AutoTranslateDeepLUrl { get; set; } + public string AutoTranslateDeepLFormality { get; set; } public bool TranslateAllowSplit { get; set; } public string TranslateLastService { get; set; } public string TranslateMergeStrategy { get; set; } @@ -219,6 +222,7 @@ namespace Nikse.SubtitleEdit.Core.Common public bool BatchConvertRemoveTextForHI { get; set; } public bool BatchConvertConvertColorsToDialog { get; set; } public bool BatchConvertBeautifyTimeCodes { get; set; } + public bool BatchConvertAutoTranslate { get; set; } public bool BatchConvertFixCommonErrors { get; set; } public bool BatchConvertMultipleReplace { get; set; } public bool BatchConvertFixRtl { get; set; } @@ -506,6 +510,7 @@ namespace Nikse.SubtitleEdit.Core.Common AutoTranslateNllbApiUrl = "http://localhost:7860/api/v2/"; AutoTranslateLibreUrl = "http://localhost:5000/"; AutoTranslateSeamlessM4TUrl = "http://localhost:5000/"; + AutoTranslateDeepLUrl = "https://api-free.deepl.com/"; TranslateAllowSplit = true; TranslateViaCopyPasteAutoCopyToClipboard = true; TranslateViaCopyPasteMaxSize = 5000; @@ -5121,6 +5126,24 @@ $HorzAlign = Center settings.Tools.AutoTranslateSeamlessM4TUrl = subNode.InnerText; } + subNode = node.SelectSingleNode("AutoTranslateDeepLApiKey"); + if (subNode != null) + { + settings.Tools.AutoTranslateDeepLApiKey = subNode.InnerText; + } + + subNode = node.SelectSingleNode("AutoTranslateDeepLUrl"); + if (subNode != null) + { + settings.Tools.AutoTranslateDeepLUrl = subNode.InnerText; + } + + subNode = node.SelectSingleNode("AutoTranslateDeepLFormality"); + if (subNode != null) + { + settings.Tools.AutoTranslateDeepLFormality = subNode.InnerText; + } + subNode = node.SelectSingleNode("TranslateAllowSplit"); if (subNode != null) { @@ -5463,6 +5486,12 @@ $HorzAlign = Center settings.Tools.BatchConvertBeautifyTimeCodes = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture); } + subNode = node.SelectSingleNode("BatchConvertAutoTranslate"); + if (subNode != null) + { + settings.Tools.BatchConvertAutoTranslate = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture); + } + subNode = node.SelectSingleNode("BatchConvertFixCommonErrors"); if (subNode != null) { @@ -11384,6 +11413,9 @@ $HorzAlign = Center textWriter.WriteElementString("AutoTranslateLibreApiKey", settings.Tools.AutoTranslateLibreApiKey); textWriter.WriteElementString("AutoTranslateMyMemoryApiKey", settings.Tools.AutoTranslateMyMemoryApiKey); textWriter.WriteElementString("AutoTranslateSeamlessM4TUrl", settings.Tools.AutoTranslateSeamlessM4TUrl); + textWriter.WriteElementString("AutoTranslateDeepLApiKey", settings.Tools.AutoTranslateDeepLApiKey); + textWriter.WriteElementString("AutoTranslateDeepLUrl", settings.Tools.AutoTranslateDeepLUrl); + textWriter.WriteElementString("AutoTranslateDeepLFormality", settings.Tools.AutoTranslateDeepLFormality); textWriter.WriteElementString("TranslateAllowSplit", settings.Tools.TranslateAllowSplit.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("TranslateLastService", settings.Tools.TranslateLastService); textWriter.WriteElementString("TranslateMergeStrategy", settings.Tools.TranslateMergeStrategy); @@ -11441,6 +11473,7 @@ $HorzAlign = Center textWriter.WriteElementString("BatchConvertRemoveTextForHI", settings.Tools.BatchConvertRemoveTextForHI.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("BatchConvertConvertColorsToDialog", settings.Tools.BatchConvertConvertColorsToDialog.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("BatchConvertBeautifyTimeCodes", settings.Tools.BatchConvertBeautifyTimeCodes.ToString(CultureInfo.InvariantCulture)); + textWriter.WriteElementString("BatchConvertAutoTranslate", settings.Tools.BatchConvertAutoTranslate.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("BatchConvertSplitLongLines", settings.Tools.BatchConvertSplitLongLines.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("BatchConvertFixCommonErrors", settings.Tools.BatchConvertFixCommonErrors.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("BatchConvertMultipleReplace", settings.Tools.BatchConvertMultipleReplace.ToString(CultureInfo.InvariantCulture)); diff --git a/src/ui/Forms/BatchConvert.Designer.cs b/src/ui/Forms/BatchConvert.Designer.cs index 8d1d3a313..bd07f7ebf 100644 --- a/src/ui/Forms/BatchConvert.Designer.cs +++ b/src/ui/Forms/BatchConvert.Designer.cs @@ -35,6 +35,51 @@ namespace Nikse.SubtitleEdit.Forms this.buttonConvert = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.groupBoxConvertOptions = new System.Windows.Forms.GroupBox(); + this.groupBoxAutoTranslate = new System.Windows.Forms.GroupBox(); + this.labelTarget = new System.Windows.Forms.Label(); + this.comboBoxTarget = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelSource = new System.Windows.Forms.Label(); + this.comboBoxSource = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.linkLabelPoweredBy = new System.Windows.Forms.LinkLabel(); + this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.listViewConvertOptions = new System.Windows.Forms.ListView(); + this.ActionCheckBox = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.Action = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.contextMenuStripOptions = new System.Windows.Forms.ContextMenuStrip(this.components); + this.toolStripMenuItemSelectAll = new System.Windows.Forms.ToolStripMenuItem(); + this.inverseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.buttonConvertOptionsSettings = new System.Windows.Forms.Button(); + this.groupBoxDeleteLines = new System.Windows.Forms.GroupBox(); + this.textBoxDeleteContains = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.labelDeleteLinesContaining = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.numericUpDownDeleteLast = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelDeleteLastLines = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.numericUpDownDeleteFirst = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelDeleteFirstLines = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.groupBoxRemoveStyle = new System.Windows.Forms.GroupBox(); + this.textBoxRemoveStyle = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.labelStyleActor = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.groupBoxOffsetTimeCodes = new System.Windows.Forms.GroupBox(); + this.radioButtonShowLater = new System.Windows.Forms.RadioButton(); + this.radioButtonShowEarlier = new System.Windows.Forms.RadioButton(); + this.timeUpDownAdjust = new Nikse.SubtitleEdit.Controls.NikseTimeUpDown(); + this.labelHourMinSecMilliSecond = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.groupBoxChangeFrameRate = new System.Windows.Forms.GroupBox(); + this.buttonSwapFrameRate = new System.Windows.Forms.Button(); + this.comboBoxFrameRateTo = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelToFrameRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxFrameRateFrom = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelFromFrameRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.groupBoxFixRtl = new System.Windows.Forms.GroupBox(); + this.radioButtonReverseStartEnd = new System.Windows.Forms.RadioButton(); + this.radioButtonRemoveUnicode = new System.Windows.Forms.RadioButton(); + this.radioButtonAddUnicode = new System.Windows.Forms.RadioButton(); + this.groupBoxSpeed = new System.Windows.Forms.GroupBox(); + this.radioButtonToDropFrame = new System.Windows.Forms.RadioButton(); + this.radioButtonSpeedFromDropFrame = new System.Windows.Forms.RadioButton(); + this.radioButtonSpeedCustom = new System.Windows.Forms.RadioButton(); + this.numericUpDownPercent = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelPercent = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.groupBoxRemoveFormatting = new System.Windows.Forms.GroupBox(); this.checkBoxRemoveAllFormatting = new System.Windows.Forms.CheckBox(); this.checkBoxRemoveAlignment = new System.Windows.Forms.CheckBox(); @@ -75,12 +120,6 @@ namespace Nikse.SubtitleEdit.Forms this.checkBoxBeautifyTimeCodesSnapToShotChanges = new System.Windows.Forms.CheckBox(); this.checkBoxBeautifyTimeCodesUseExactTimeCodes = new System.Windows.Forms.CheckBox(); this.checkBoxBeautifyTimeCodesAlignTimeCodes = new System.Windows.Forms.CheckBox(); - this.listViewConvertOptions = new System.Windows.Forms.ListView(); - this.ActionCheckBox = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.Action = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.contextMenuStripOptions = new System.Windows.Forms.ContextMenuStrip(this.components); - this.toolStripMenuItemSelectAll = new System.Windows.Forms.ToolStripMenuItem(); - this.inverseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBoxChangeCasing = new System.Windows.Forms.GroupBox(); this.checkBoxProperCaseOnlyUpper = new System.Windows.Forms.CheckBox(); this.radioButtonProperCase = new System.Windows.Forms.RadioButton(); @@ -96,7 +135,6 @@ namespace Nikse.SubtitleEdit.Forms this.numericUpDownMaxMillisecondsBetweenLines = new Nikse.SubtitleEdit.Controls.NikseUpDown(); this.labelMaxMillisecondsBetweenLines = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelMaxCharacters = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.buttonConvertOptionsSettings = new System.Windows.Forms.Button(); this.groupBoxAssaChangeRes = new System.Windows.Forms.GroupBox(); this.checkBoxDrawing = new System.Windows.Forms.CheckBox(); this.checkBoxPosition = new System.Windows.Forms.CheckBox(); @@ -118,37 +156,6 @@ namespace Nikse.SubtitleEdit.Forms this.checkBoxConvertColorsToDialogReBreakLines = new System.Windows.Forms.CheckBox(); this.checkBoxConvertColorsToDialogAddNewLines = new System.Windows.Forms.CheckBox(); this.checkBoxConvertColorsToDialogRemoveColorTags = new System.Windows.Forms.CheckBox(); - this.groupBoxDeleteLines = new System.Windows.Forms.GroupBox(); - this.textBoxDeleteContains = new Nikse.SubtitleEdit.Controls.NikseTextBox(); - this.labelDeleteLinesContaining = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.numericUpDownDeleteLast = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelDeleteLastLines = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.numericUpDownDeleteFirst = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelDeleteFirstLines = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.groupBoxRemoveStyle = new System.Windows.Forms.GroupBox(); - this.textBoxRemoveStyle = new Nikse.SubtitleEdit.Controls.NikseTextBox(); - this.labelStyleActor = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.groupBoxOffsetTimeCodes = new System.Windows.Forms.GroupBox(); - this.radioButtonShowLater = new System.Windows.Forms.RadioButton(); - this.radioButtonShowEarlier = new System.Windows.Forms.RadioButton(); - this.timeUpDownAdjust = new Nikse.SubtitleEdit.Controls.NikseTimeUpDown(); - this.labelHourMinSecMilliSecond = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.groupBoxChangeFrameRate = new System.Windows.Forms.GroupBox(); - this.buttonSwapFrameRate = new System.Windows.Forms.Button(); - this.comboBoxFrameRateTo = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelToFrameRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxFrameRateFrom = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelFromFrameRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.groupBoxFixRtl = new System.Windows.Forms.GroupBox(); - this.radioButtonReverseStartEnd = new System.Windows.Forms.RadioButton(); - this.radioButtonRemoveUnicode = new System.Windows.Forms.RadioButton(); - this.radioButtonAddUnicode = new System.Windows.Forms.RadioButton(); - this.groupBoxSpeed = new System.Windows.Forms.GroupBox(); - this.radioButtonToDropFrame = new System.Windows.Forms.RadioButton(); - this.radioButtonSpeedFromDropFrame = new System.Windows.Forms.RadioButton(); - this.radioButtonSpeedCustom = new System.Windows.Forms.RadioButton(); - this.numericUpDownPercent = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelPercent = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.groupBoxOutput = new System.Windows.Forms.GroupBox(); this.buttonBrowseEncoding = new System.Windows.Forms.Button(); this.radioButtonSaveInOutputFolder = new System.Windows.Forms.RadioButton(); @@ -194,6 +201,14 @@ namespace Nikse.SubtitleEdit.Forms this.labelStatus = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelError = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.groupBoxConvertOptions.SuspendLayout(); + this.groupBoxAutoTranslate.SuspendLayout(); + this.contextMenuStripOptions.SuspendLayout(); + this.groupBoxDeleteLines.SuspendLayout(); + this.groupBoxRemoveStyle.SuspendLayout(); + this.groupBoxOffsetTimeCodes.SuspendLayout(); + this.groupBoxChangeFrameRate.SuspendLayout(); + this.groupBoxFixRtl.SuspendLayout(); + this.groupBoxSpeed.SuspendLayout(); this.groupBoxRemoveFormatting.SuspendLayout(); this.groupBoxApplyDurationLimits.SuspendLayout(); this.groupBoxAdjustDuration.SuspendLayout(); @@ -202,19 +217,12 @@ namespace Nikse.SubtitleEdit.Forms this.panelAdjustDurationAddSeconds.SuspendLayout(); this.panelAdjustDurationRecalc.SuspendLayout(); this.groupBoxBeautifyTimeCodes.SuspendLayout(); - this.contextMenuStripOptions.SuspendLayout(); this.groupBoxChangeCasing.SuspendLayout(); this.groupBoxMergeShortLines.SuspendLayout(); this.groupBoxAssaChangeRes.SuspendLayout(); this.groupBoxSortBy.SuspendLayout(); this.groupBoxMergeSameTimeCodes.SuspendLayout(); this.groupBoxConvertColorsToDialog.SuspendLayout(); - this.groupBoxDeleteLines.SuspendLayout(); - this.groupBoxRemoveStyle.SuspendLayout(); - this.groupBoxOffsetTimeCodes.SuspendLayout(); - this.groupBoxChangeFrameRate.SuspendLayout(); - this.groupBoxFixRtl.SuspendLayout(); - this.groupBoxSpeed.SuspendLayout(); this.groupBoxOutput.SuspendLayout(); this.groupBoxInput.SuspendLayout(); this.contextMenuStripFiles.SuspendLayout(); @@ -248,6 +256,7 @@ namespace Nikse.SubtitleEdit.Forms // this.groupBoxConvertOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxConvertOptions.Controls.Add(this.groupBoxAutoTranslate); this.groupBoxConvertOptions.Controls.Add(this.listViewConvertOptions); this.groupBoxConvertOptions.Controls.Add(this.buttonConvertOptionsSettings); this.groupBoxConvertOptions.Controls.Add(this.groupBoxDeleteLines); @@ -273,6 +282,650 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxConvertOptions.TabStop = false; this.groupBoxConvertOptions.Text = "Convert options"; // + // groupBoxAutoTranslate + // + this.groupBoxAutoTranslate.Controls.Add(this.labelTarget); + this.groupBoxAutoTranslate.Controls.Add(this.comboBoxTarget); + this.groupBoxAutoTranslate.Controls.Add(this.labelSource); + this.groupBoxAutoTranslate.Controls.Add(this.comboBoxSource); + this.groupBoxAutoTranslate.Controls.Add(this.linkLabelPoweredBy); + this.groupBoxAutoTranslate.Controls.Add(this.nikseComboBoxEngine); + this.groupBoxAutoTranslate.Location = new System.Drawing.Point(306, 14); + this.groupBoxAutoTranslate.Name = "groupBoxAutoTranslate"; + this.groupBoxAutoTranslate.Size = new System.Drawing.Size(271, 220); + this.groupBoxAutoTranslate.TabIndex = 309; + this.groupBoxAutoTranslate.TabStop = false; + this.groupBoxAutoTranslate.Text = "Translate"; + this.groupBoxAutoTranslate.Visible = false; + // + // labelTarget + // + this.labelTarget.AutoSize = true; + this.labelTarget.Location = new System.Drawing.Point(26, 121); + this.labelTarget.Name = "labelTarget"; + this.labelTarget.Size = new System.Drawing.Size(23, 13); + this.labelTarget.TabIndex = 115; + this.labelTarget.Text = "To:"; + // + // comboBoxTarget + // + this.comboBoxTarget.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxTarget.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.comboBoxTarget.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.comboBoxTarget.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.comboBoxTarget.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.comboBoxTarget.ButtonForeColorDown = System.Drawing.Color.Orange; + this.comboBoxTarget.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.comboBoxTarget.DropDownHeight = 400; + this.comboBoxTarget.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxTarget.DropDownWidth = 140; + this.comboBoxTarget.FormattingEnabled = true; + this.comboBoxTarget.Location = new System.Drawing.Point(55, 117); + this.comboBoxTarget.MaxLength = 32767; + this.comboBoxTarget.Name = "comboBoxTarget"; + this.comboBoxTarget.SelectedIndex = -1; + this.comboBoxTarget.SelectedItem = null; + this.comboBoxTarget.SelectedText = ""; + this.comboBoxTarget.Size = new System.Drawing.Size(121, 21); + this.comboBoxTarget.TabIndex = 114; + this.comboBoxTarget.UsePopupWindow = false; + // + // labelSource + // + this.labelSource.AutoSize = true; + this.labelSource.Location = new System.Drawing.Point(13, 92); + this.labelSource.Name = "labelSource"; + this.labelSource.Size = new System.Drawing.Size(33, 13); + this.labelSource.TabIndex = 113; + this.labelSource.Text = "From:"; + // + // comboBoxSource + // + this.comboBoxSource.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxSource.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.comboBoxSource.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.comboBoxSource.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.comboBoxSource.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.comboBoxSource.ButtonForeColorDown = System.Drawing.Color.Orange; + this.comboBoxSource.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.comboBoxSource.DropDownHeight = 400; + this.comboBoxSource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxSource.DropDownWidth = 140; + this.comboBoxSource.FormattingEnabled = true; + this.comboBoxSource.Location = new System.Drawing.Point(55, 88); + this.comboBoxSource.MaxLength = 32767; + this.comboBoxSource.Name = "comboBoxSource"; + this.comboBoxSource.SelectedIndex = -1; + this.comboBoxSource.SelectedItem = null; + this.comboBoxSource.SelectedText = ""; + this.comboBoxSource.Size = new System.Drawing.Size(121, 21); + this.comboBoxSource.TabIndex = 112; + this.comboBoxSource.UsePopupWindow = false; + // + // linkLabelPoweredBy + // + this.linkLabelPoweredBy.AutoSize = true; + this.linkLabelPoweredBy.Location = new System.Drawing.Point(13, 33); + this.linkLabelPoweredBy.Name = "linkLabelPoweredBy"; + this.linkLabelPoweredBy.Size = new System.Drawing.Size(73, 13); + this.linkLabelPoweredBy.TabIndex = 111; + this.linkLabelPoweredBy.TabStop = true; + this.linkLabelPoweredBy.Text = "Powered by X"; + this.linkLabelPoweredBy.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelPoweredBy_LinkClicked); + // + // nikseComboBoxEngine + // + this.nikseComboBoxEngine.BackColor = System.Drawing.SystemColors.Window; + this.nikseComboBoxEngine.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseComboBoxEngine.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseComboBoxEngine.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseComboBoxEngine.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseComboBoxEngine.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseComboBoxEngine.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseComboBoxEngine.DropDownHeight = 400; + this.nikseComboBoxEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.nikseComboBoxEngine.DropDownWidth = 221; + this.nikseComboBoxEngine.FormattingEnabled = true; + this.nikseComboBoxEngine.Location = new System.Drawing.Point(11, 52); + this.nikseComboBoxEngine.MaxLength = 32767; + this.nikseComboBoxEngine.Name = "nikseComboBoxEngine"; + this.nikseComboBoxEngine.SelectedIndex = -1; + this.nikseComboBoxEngine.SelectedItem = null; + this.nikseComboBoxEngine.SelectedText = ""; + this.nikseComboBoxEngine.Size = new System.Drawing.Size(221, 21); + this.nikseComboBoxEngine.TabIndex = 110; + this.nikseComboBoxEngine.UsePopupWindow = false; + this.nikseComboBoxEngine.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxEngine_SelectedIndexChanged); + // + // listViewConvertOptions + // + this.listViewConvertOptions.CheckBoxes = true; + this.listViewConvertOptions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.ActionCheckBox, + this.Action}); + this.listViewConvertOptions.ContextMenuStrip = this.contextMenuStripOptions; + this.listViewConvertOptions.FullRowSelect = true; + this.listViewConvertOptions.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.listViewConvertOptions.HideSelection = false; + this.listViewConvertOptions.Location = new System.Drawing.Point(6, 17); + this.listViewConvertOptions.MultiSelect = false; + this.listViewConvertOptions.Name = "listViewConvertOptions"; + this.listViewConvertOptions.Size = new System.Drawing.Size(293, 252); + this.listViewConvertOptions.TabIndex = 301; + this.listViewConvertOptions.UseCompatibleStateImageBehavior = false; + this.listViewConvertOptions.View = System.Windows.Forms.View.Details; + this.listViewConvertOptions.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listViewConvertOptions_ItemChecked); + this.listViewConvertOptions.SelectedIndexChanged += new System.EventHandler(this.listViewConvertOptions_SelectedIndexChanged); + // + // ActionCheckBox + // + this.ActionCheckBox.Width = 30; + // + // Action + // + this.Action.Width = 400; + // + // contextMenuStripOptions + // + this.contextMenuStripOptions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItemSelectAll, + this.inverseSelectionToolStripMenuItem}); + this.contextMenuStripOptions.Name = "contextMenuStripOptions"; + this.contextMenuStripOptions.Size = new System.Drawing.Size(162, 48); + // + // toolStripMenuItemSelectAll + // + this.toolStripMenuItemSelectAll.Name = "toolStripMenuItemSelectAll"; + this.toolStripMenuItemSelectAll.Size = new System.Drawing.Size(161, 22); + this.toolStripMenuItemSelectAll.Text = "Select all"; + this.toolStripMenuItemSelectAll.Click += new System.EventHandler(this.toolStripMenuItemSelectAll_Click); + // + // inverseSelectionToolStripMenuItem + // + this.inverseSelectionToolStripMenuItem.Name = "inverseSelectionToolStripMenuItem"; + this.inverseSelectionToolStripMenuItem.Size = new System.Drawing.Size(161, 22); + this.inverseSelectionToolStripMenuItem.Text = "Inverse selection"; + this.inverseSelectionToolStripMenuItem.Click += new System.EventHandler(this.inverseSelectionToolStripMenuItem_Click); + // + // buttonConvertOptionsSettings + // + this.buttonConvertOptionsSettings.Location = new System.Drawing.Point(305, 144); + this.buttonConvertOptionsSettings.Name = "buttonConvertOptionsSettings"; + this.buttonConvertOptionsSettings.Size = new System.Drawing.Size(116, 23); + this.buttonConvertOptionsSettings.TabIndex = 302; + this.buttonConvertOptionsSettings.Text = "Settings..."; + this.buttonConvertOptionsSettings.UseVisualStyleBackColor = true; + this.buttonConvertOptionsSettings.Visible = false; + this.buttonConvertOptionsSettings.Click += new System.EventHandler(this.ButtonOptionConvertSettings); + // + // groupBoxDeleteLines + // + this.groupBoxDeleteLines.Controls.Add(this.textBoxDeleteContains); + this.groupBoxDeleteLines.Controls.Add(this.labelDeleteLinesContaining); + this.groupBoxDeleteLines.Controls.Add(this.numericUpDownDeleteLast); + this.groupBoxDeleteLines.Controls.Add(this.labelDeleteLastLines); + this.groupBoxDeleteLines.Controls.Add(this.numericUpDownDeleteFirst); + this.groupBoxDeleteLines.Controls.Add(this.labelDeleteFirstLines); + this.groupBoxDeleteLines.Location = new System.Drawing.Point(305, 94); + this.groupBoxDeleteLines.Name = "groupBoxDeleteLines"; + this.groupBoxDeleteLines.Size = new System.Drawing.Size(271, 140); + this.groupBoxDeleteLines.TabIndex = 308; + this.groupBoxDeleteLines.TabStop = false; + this.groupBoxDeleteLines.Text = "Delete lines"; + this.groupBoxDeleteLines.Visible = false; + // + // textBoxDeleteContains + // + this.textBoxDeleteContains.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.textBoxDeleteContains.Location = new System.Drawing.Point(10, 110); + this.textBoxDeleteContains.Name = "textBoxDeleteContains"; + this.textBoxDeleteContains.Size = new System.Drawing.Size(237, 20); + this.textBoxDeleteContains.TabIndex = 5; + // + // labelDeleteLinesContaining + // + this.labelDeleteLinesContaining.AutoSize = true; + this.labelDeleteLinesContaining.Location = new System.Drawing.Point(9, 89); + this.labelDeleteLinesContaining.Name = "labelDeleteLinesContaining"; + this.labelDeleteLinesContaining.Size = new System.Drawing.Size(114, 13); + this.labelDeleteLinesContaining.TabIndex = 4; + this.labelDeleteLinesContaining.Text = "Delete lines containing"; + // + // numericUpDownDeleteLast + // + this.numericUpDownDeleteLast.BackColor = System.Drawing.SystemColors.Window; + this.numericUpDownDeleteLast.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.numericUpDownDeleteLast.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.numericUpDownDeleteLast.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.numericUpDownDeleteLast.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.numericUpDownDeleteLast.ButtonForeColorDown = System.Drawing.Color.Orange; + this.numericUpDownDeleteLast.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.numericUpDownDeleteLast.DecimalPlaces = 0; + this.numericUpDownDeleteLast.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownDeleteLast.Location = new System.Drawing.Point(92, 45); + this.numericUpDownDeleteLast.Maximum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.numericUpDownDeleteLast.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.numericUpDownDeleteLast.Name = "numericUpDownDeleteLast"; + this.numericUpDownDeleteLast.Size = new System.Drawing.Size(43, 20); + this.numericUpDownDeleteLast.TabIndex = 3; + this.numericUpDownDeleteLast.TabStop = false; + this.numericUpDownDeleteLast.ThousandsSeparator = false; + this.numericUpDownDeleteLast.Value = new decimal(new int[] { + 0, + 0, + 0, + 0}); + // + // labelDeleteLastLines + // + this.labelDeleteLastLines.AutoSize = true; + this.labelDeleteLastLines.Location = new System.Drawing.Point(5, 47); + this.labelDeleteLastLines.Name = "labelDeleteLastLines"; + this.labelDeleteLastLines.Size = new System.Drawing.Size(81, 13); + this.labelDeleteLastLines.TabIndex = 2; + this.labelDeleteLastLines.Text = "Delete last lines"; + // + // numericUpDownDeleteFirst + // + this.numericUpDownDeleteFirst.BackColor = System.Drawing.SystemColors.Window; + this.numericUpDownDeleteFirst.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.numericUpDownDeleteFirst.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.numericUpDownDeleteFirst.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.numericUpDownDeleteFirst.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.numericUpDownDeleteFirst.ButtonForeColorDown = System.Drawing.Color.Orange; + this.numericUpDownDeleteFirst.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.numericUpDownDeleteFirst.DecimalPlaces = 0; + this.numericUpDownDeleteFirst.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownDeleteFirst.Location = new System.Drawing.Point(93, 19); + this.numericUpDownDeleteFirst.Maximum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.numericUpDownDeleteFirst.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.numericUpDownDeleteFirst.Name = "numericUpDownDeleteFirst"; + this.numericUpDownDeleteFirst.Size = new System.Drawing.Size(43, 20); + this.numericUpDownDeleteFirst.TabIndex = 1; + this.numericUpDownDeleteFirst.TabStop = false; + this.numericUpDownDeleteFirst.ThousandsSeparator = false; + this.numericUpDownDeleteFirst.Value = new decimal(new int[] { + 0, + 0, + 0, + 0}); + // + // labelDeleteFirstLines + // + this.labelDeleteFirstLines.AutoSize = true; + this.labelDeleteFirstLines.Location = new System.Drawing.Point(6, 20); + this.labelDeleteFirstLines.Name = "labelDeleteFirstLines"; + this.labelDeleteFirstLines.Size = new System.Drawing.Size(81, 13); + this.labelDeleteFirstLines.TabIndex = 0; + this.labelDeleteFirstLines.Text = "Delete first lines"; + // + // groupBoxRemoveStyle + // + this.groupBoxRemoveStyle.Controls.Add(this.textBoxRemoveStyle); + this.groupBoxRemoveStyle.Controls.Add(this.labelStyleActor); + this.groupBoxRemoveStyle.Location = new System.Drawing.Point(307, 12); + this.groupBoxRemoveStyle.Name = "groupBoxRemoveStyle"; + this.groupBoxRemoveStyle.Size = new System.Drawing.Size(271, 76); + this.groupBoxRemoveStyle.TabIndex = 307; + this.groupBoxRemoveStyle.TabStop = false; + this.groupBoxRemoveStyle.Text = "Remove style/actor"; + this.groupBoxRemoveStyle.Visible = false; + // + // textBoxRemoveStyle + // + this.textBoxRemoveStyle.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.textBoxRemoveStyle.Location = new System.Drawing.Point(6, 35); + this.textBoxRemoveStyle.Name = "textBoxRemoveStyle"; + this.textBoxRemoveStyle.Size = new System.Drawing.Size(257, 20); + this.textBoxRemoveStyle.TabIndex = 8; + // + // labelStyleActor + // + this.labelStyleActor.AutoSize = true; + this.labelStyleActor.Location = new System.Drawing.Point(6, 20); + this.labelStyleActor.Name = "labelStyleActor"; + this.labelStyleActor.Size = new System.Drawing.Size(59, 13); + this.labelStyleActor.TabIndex = 0; + this.labelStyleActor.Text = "Style/actor"; + // + // groupBoxOffsetTimeCodes + // + this.groupBoxOffsetTimeCodes.Controls.Add(this.radioButtonShowLater); + this.groupBoxOffsetTimeCodes.Controls.Add(this.radioButtonShowEarlier); + this.groupBoxOffsetTimeCodes.Controls.Add(this.timeUpDownAdjust); + this.groupBoxOffsetTimeCodes.Controls.Add(this.labelHourMinSecMilliSecond); + this.groupBoxOffsetTimeCodes.Location = new System.Drawing.Point(305, 19); + this.groupBoxOffsetTimeCodes.Name = "groupBoxOffsetTimeCodes"; + this.groupBoxOffsetTimeCodes.Size = new System.Drawing.Size(271, 119); + this.groupBoxOffsetTimeCodes.TabIndex = 306; + this.groupBoxOffsetTimeCodes.TabStop = false; + this.groupBoxOffsetTimeCodes.Text = "Offset time codes"; + this.groupBoxOffsetTimeCodes.Visible = false; + // + // radioButtonShowLater + // + this.radioButtonShowLater.AutoSize = true; + this.radioButtonShowLater.Checked = true; + this.radioButtonShowLater.Location = new System.Drawing.Point(9, 89); + this.radioButtonShowLater.Name = "radioButtonShowLater"; + this.radioButtonShowLater.Size = new System.Drawing.Size(75, 17); + this.radioButtonShowLater.TabIndex = 3; + this.radioButtonShowLater.TabStop = true; + this.radioButtonShowLater.Text = "Show later"; + this.radioButtonShowLater.UseVisualStyleBackColor = true; + // + // radioButtonShowEarlier + // + this.radioButtonShowEarlier.AutoSize = true; + this.radioButtonShowEarlier.Location = new System.Drawing.Point(9, 66); + this.radioButtonShowEarlier.Name = "radioButtonShowEarlier"; + this.radioButtonShowEarlier.Size = new System.Drawing.Size(83, 17); + this.radioButtonShowEarlier.TabIndex = 2; + this.radioButtonShowEarlier.Text = "Show earlier"; + this.radioButtonShowEarlier.UseVisualStyleBackColor = true; + // + // timeUpDownAdjust + // + this.timeUpDownAdjust.BackColor = System.Drawing.SystemColors.Window; + this.timeUpDownAdjust.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.timeUpDownAdjust.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.timeUpDownAdjust.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.timeUpDownAdjust.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.timeUpDownAdjust.ButtonForeColorDown = System.Drawing.Color.Orange; + this.timeUpDownAdjust.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.timeUpDownAdjust.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.timeUpDownAdjust.Increment = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.timeUpDownAdjust.Location = new System.Drawing.Point(7, 37); + this.timeUpDownAdjust.Margin = new System.Windows.Forms.Padding(4); + this.timeUpDownAdjust.Name = "timeUpDownAdjust"; + this.timeUpDownAdjust.Size = new System.Drawing.Size(113, 23); + this.timeUpDownAdjust.TabIndex = 1; + this.timeUpDownAdjust.TabStop = false; + timeCode1.Hours = 0; + timeCode1.Milliseconds = 0; + timeCode1.Minutes = 0; + timeCode1.Seconds = 0; + timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00"); + timeCode1.TotalMilliseconds = 0D; + timeCode1.TotalSeconds = 0D; + this.timeUpDownAdjust.TimeCode = timeCode1; + this.timeUpDownAdjust.UseVideoOffset = false; + // + // labelHourMinSecMilliSecond + // + this.labelHourMinSecMilliSecond.AutoSize = true; + this.labelHourMinSecMilliSecond.Location = new System.Drawing.Point(6, 20); + this.labelHourMinSecMilliSecond.Name = "labelHourMinSecMilliSecond"; + this.labelHourMinSecMilliSecond.Size = new System.Drawing.Size(90, 13); + this.labelHourMinSecMilliSecond.TabIndex = 0; + this.labelHourMinSecMilliSecond.Text = "Hours:min:sec.ms"; + // + // groupBoxChangeFrameRate + // + this.groupBoxChangeFrameRate.Controls.Add(this.buttonSwapFrameRate); + this.groupBoxChangeFrameRate.Controls.Add(this.comboBoxFrameRateTo); + this.groupBoxChangeFrameRate.Controls.Add(this.labelToFrameRate); + this.groupBoxChangeFrameRate.Controls.Add(this.comboBoxFrameRateFrom); + this.groupBoxChangeFrameRate.Controls.Add(this.labelFromFrameRate); + this.groupBoxChangeFrameRate.Location = new System.Drawing.Point(307, 12); + this.groupBoxChangeFrameRate.Name = "groupBoxChangeFrameRate"; + this.groupBoxChangeFrameRate.Size = new System.Drawing.Size(269, 90); + this.groupBoxChangeFrameRate.TabIndex = 305; + this.groupBoxChangeFrameRate.TabStop = false; + this.groupBoxChangeFrameRate.Text = "Change frame rate"; + this.groupBoxChangeFrameRate.Visible = false; + // + // buttonSwapFrameRate + // + this.buttonSwapFrameRate.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonSwapFrameRate.Location = new System.Drawing.Point(207, 28); + this.buttonSwapFrameRate.Name = "buttonSwapFrameRate"; + this.buttonSwapFrameRate.Size = new System.Drawing.Size(27, 28); + this.buttonSwapFrameRate.TabIndex = 9; + this.buttonSwapFrameRate.Text = "<->"; + this.buttonSwapFrameRate.UseVisualStyleBackColor = true; + this.buttonSwapFrameRate.Click += new System.EventHandler(this.buttonSwapFrameRate_Click); + // + // comboBoxFrameRateTo + // + this.comboBoxFrameRateTo.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxFrameRateTo.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.comboBoxFrameRateTo.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.comboBoxFrameRateTo.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.comboBoxFrameRateTo.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.comboBoxFrameRateTo.ButtonForeColorDown = System.Drawing.Color.Orange; + this.comboBoxFrameRateTo.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.comboBoxFrameRateTo.DropDownHeight = 400; + this.comboBoxFrameRateTo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; + this.comboBoxFrameRateTo.DropDownWidth = 71; + this.comboBoxFrameRateTo.FormattingEnabled = true; + this.comboBoxFrameRateTo.Location = new System.Drawing.Point(130, 46); + this.comboBoxFrameRateTo.MaxLength = 32767; + this.comboBoxFrameRateTo.Name = "comboBoxFrameRateTo"; + this.comboBoxFrameRateTo.SelectedIndex = -1; + this.comboBoxFrameRateTo.SelectedItem = null; + this.comboBoxFrameRateTo.SelectedText = ""; + this.comboBoxFrameRateTo.Size = new System.Drawing.Size(71, 21); + this.comboBoxFrameRateTo.TabIndex = 3; + this.comboBoxFrameRateTo.TabStop = false; + this.comboBoxFrameRateTo.UsePopupWindow = false; + // + // labelToFrameRate + // + this.labelToFrameRate.AutoSize = true; + this.labelToFrameRate.Location = new System.Drawing.Point(6, 50); + this.labelToFrameRate.Name = "labelToFrameRate"; + this.labelToFrameRate.Size = new System.Drawing.Size(70, 13); + this.labelToFrameRate.TabIndex = 2; + this.labelToFrameRate.Text = "To frame rate"; + // + // comboBoxFrameRateFrom + // + this.comboBoxFrameRateFrom.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxFrameRateFrom.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.comboBoxFrameRateFrom.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.comboBoxFrameRateFrom.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.comboBoxFrameRateFrom.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.comboBoxFrameRateFrom.ButtonForeColorDown = System.Drawing.Color.Orange; + this.comboBoxFrameRateFrom.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.comboBoxFrameRateFrom.DropDownHeight = 400; + this.comboBoxFrameRateFrom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; + this.comboBoxFrameRateFrom.DropDownWidth = 71; + this.comboBoxFrameRateFrom.FormattingEnabled = true; + this.comboBoxFrameRateFrom.Location = new System.Drawing.Point(130, 17); + this.comboBoxFrameRateFrom.MaxLength = 32767; + this.comboBoxFrameRateFrom.Name = "comboBoxFrameRateFrom"; + this.comboBoxFrameRateFrom.SelectedIndex = -1; + this.comboBoxFrameRateFrom.SelectedItem = null; + this.comboBoxFrameRateFrom.SelectedText = ""; + this.comboBoxFrameRateFrom.Size = new System.Drawing.Size(71, 21); + this.comboBoxFrameRateFrom.TabIndex = 1; + this.comboBoxFrameRateFrom.TabStop = false; + this.comboBoxFrameRateFrom.UsePopupWindow = false; + // + // labelFromFrameRate + // + this.labelFromFrameRate.AutoSize = true; + this.labelFromFrameRate.Location = new System.Drawing.Point(6, 21); + this.labelFromFrameRate.Name = "labelFromFrameRate"; + this.labelFromFrameRate.Size = new System.Drawing.Size(80, 13); + this.labelFromFrameRate.TabIndex = 0; + this.labelFromFrameRate.Text = "From frame rate"; + // + // groupBoxFixRtl + // + this.groupBoxFixRtl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxFixRtl.Controls.Add(this.radioButtonReverseStartEnd); + this.groupBoxFixRtl.Controls.Add(this.radioButtonRemoveUnicode); + this.groupBoxFixRtl.Controls.Add(this.radioButtonAddUnicode); + this.groupBoxFixRtl.Location = new System.Drawing.Point(305, 17); + this.groupBoxFixRtl.Name = "groupBoxFixRtl"; + this.groupBoxFixRtl.Size = new System.Drawing.Size(271, 115); + this.groupBoxFixRtl.TabIndex = 303; + this.groupBoxFixRtl.TabStop = false; + this.groupBoxFixRtl.Text = "Settings"; + this.groupBoxFixRtl.Visible = false; + // + // radioButtonReverseStartEnd + // + this.radioButtonReverseStartEnd.AutoSize = true; + this.radioButtonReverseStartEnd.Location = new System.Drawing.Point(19, 77); + this.radioButtonReverseStartEnd.Name = "radioButtonReverseStartEnd"; + this.radioButtonReverseStartEnd.Size = new System.Drawing.Size(135, 17); + this.radioButtonReverseStartEnd.TabIndex = 2; + this.radioButtonReverseStartEnd.TabStop = true; + this.radioButtonReverseStartEnd.Text = "Reverse RTL start/end"; + this.radioButtonReverseStartEnd.UseVisualStyleBackColor = true; + // + // radioButtonRemoveUnicode + // + this.radioButtonRemoveUnicode.AutoSize = true; + this.radioButtonRemoveUnicode.Location = new System.Drawing.Point(19, 54); + this.radioButtonRemoveUnicode.Name = "radioButtonRemoveUnicode"; + this.radioButtonRemoveUnicode.Size = new System.Drawing.Size(153, 17); + this.radioButtonRemoveUnicode.TabIndex = 1; + this.radioButtonRemoveUnicode.TabStop = true; + this.radioButtonRemoveUnicode.Text = "Remove RTL unicode tags"; + this.radioButtonRemoveUnicode.UseVisualStyleBackColor = true; + // + // radioButtonAddUnicode + // + this.radioButtonAddUnicode.AutoSize = true; + this.radioButtonAddUnicode.Location = new System.Drawing.Point(19, 31); + this.radioButtonAddUnicode.Name = "radioButtonAddUnicode"; + this.radioButtonAddUnicode.Size = new System.Drawing.Size(145, 17); + this.radioButtonAddUnicode.TabIndex = 0; + this.radioButtonAddUnicode.TabStop = true; + this.radioButtonAddUnicode.Text = "Fix RTL via Unicode tags"; + this.radioButtonAddUnicode.UseVisualStyleBackColor = true; + // + // groupBoxSpeed + // + this.groupBoxSpeed.Controls.Add(this.radioButtonToDropFrame); + this.groupBoxSpeed.Controls.Add(this.radioButtonSpeedFromDropFrame); + this.groupBoxSpeed.Controls.Add(this.radioButtonSpeedCustom); + this.groupBoxSpeed.Controls.Add(this.numericUpDownPercent); + this.groupBoxSpeed.Controls.Add(this.labelPercent); + this.groupBoxSpeed.Location = new System.Drawing.Point(305, 17); + this.groupBoxSpeed.Name = "groupBoxSpeed"; + this.groupBoxSpeed.Size = new System.Drawing.Size(271, 129); + this.groupBoxSpeed.TabIndex = 307; + this.groupBoxSpeed.TabStop = false; + this.groupBoxSpeed.Text = "Change speed"; + this.groupBoxSpeed.Visible = false; + // + // radioButtonToDropFrame + // + this.radioButtonToDropFrame.AutoSize = true; + this.radioButtonToDropFrame.Location = new System.Drawing.Point(6, 91); + this.radioButtonToDropFrame.Name = "radioButtonToDropFrame"; + this.radioButtonToDropFrame.Size = new System.Drawing.Size(91, 17); + this.radioButtonToDropFrame.TabIndex = 3; + this.radioButtonToDropFrame.Text = "To drop frame"; + this.radioButtonToDropFrame.UseVisualStyleBackColor = true; + this.radioButtonToDropFrame.CheckedChanged += new System.EventHandler(this.radioButtonToDropFrame_CheckedChanged); + // + // radioButtonSpeedFromDropFrame + // + this.radioButtonSpeedFromDropFrame.AutoSize = true; + this.radioButtonSpeedFromDropFrame.Location = new System.Drawing.Point(6, 68); + this.radioButtonSpeedFromDropFrame.Name = "radioButtonSpeedFromDropFrame"; + this.radioButtonSpeedFromDropFrame.Size = new System.Drawing.Size(101, 17); + this.radioButtonSpeedFromDropFrame.TabIndex = 2; + this.radioButtonSpeedFromDropFrame.Text = "From drop frame"; + this.radioButtonSpeedFromDropFrame.UseVisualStyleBackColor = true; + this.radioButtonSpeedFromDropFrame.CheckedChanged += new System.EventHandler(this.radioButtonSpeedFromDropFrame_CheckedChanged); + // + // radioButtonSpeedCustom + // + this.radioButtonSpeedCustom.AutoSize = true; + this.radioButtonSpeedCustom.Checked = true; + this.radioButtonSpeedCustom.Location = new System.Drawing.Point(6, 45); + this.radioButtonSpeedCustom.Name = "radioButtonSpeedCustom"; + this.radioButtonSpeedCustom.Size = new System.Drawing.Size(60, 17); + this.radioButtonSpeedCustom.TabIndex = 1; + this.radioButtonSpeedCustom.TabStop = true; + this.radioButtonSpeedCustom.Text = "Custom"; + this.radioButtonSpeedCustom.UseVisualStyleBackColor = true; + this.radioButtonSpeedCustom.CheckedChanged += new System.EventHandler(this.radioButtonSpeedCustom_CheckedChanged); + // + // numericUpDownPercent + // + this.numericUpDownPercent.BackColor = System.Drawing.SystemColors.Window; + this.numericUpDownPercent.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.numericUpDownPercent.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.numericUpDownPercent.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.numericUpDownPercent.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.numericUpDownPercent.ButtonForeColorDown = System.Drawing.Color.Orange; + this.numericUpDownPercent.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.numericUpDownPercent.DecimalPlaces = 4; + this.numericUpDownPercent.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDownPercent.Location = new System.Drawing.Point(6, 19); + this.numericUpDownPercent.Maximum = new decimal(new int[] { + 200, + 0, + 0, + 0}); + this.numericUpDownPercent.Minimum = new decimal(new int[] { + 50, + 0, + 0, + 0}); + this.numericUpDownPercent.Name = "numericUpDownPercent"; + this.numericUpDownPercent.Size = new System.Drawing.Size(81, 20); + this.numericUpDownPercent.TabIndex = 0; + this.numericUpDownPercent.TabStop = false; + this.numericUpDownPercent.ThousandsSeparator = false; + this.numericUpDownPercent.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + // + // labelPercent + // + this.labelPercent.AutoSize = true; + this.labelPercent.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelPercent.Location = new System.Drawing.Point(87, 22); + this.labelPercent.Name = "labelPercent"; + this.labelPercent.Size = new System.Drawing.Size(15, 13); + this.labelPercent.TabIndex = 12; + this.labelPercent.Text = "%"; + // // groupBoxRemoveFormatting // this.groupBoxRemoveFormatting.Controls.Add(this.checkBoxRemoveAllFormatting); @@ -895,56 +1548,6 @@ namespace Nikse.SubtitleEdit.Forms this.checkBoxBeautifyTimeCodesAlignTimeCodes.Text = "Align time codes to frame time codes"; this.checkBoxBeautifyTimeCodesAlignTimeCodes.UseVisualStyleBackColor = true; // - // listViewConvertOptions - // - this.listViewConvertOptions.CheckBoxes = true; - this.listViewConvertOptions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.ActionCheckBox, - this.Action}); - this.listViewConvertOptions.ContextMenuStrip = this.contextMenuStripOptions; - this.listViewConvertOptions.FullRowSelect = true; - this.listViewConvertOptions.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; - this.listViewConvertOptions.HideSelection = false; - this.listViewConvertOptions.Location = new System.Drawing.Point(6, 17); - this.listViewConvertOptions.MultiSelect = false; - this.listViewConvertOptions.Name = "listViewConvertOptions"; - this.listViewConvertOptions.Size = new System.Drawing.Size(293, 252); - this.listViewConvertOptions.TabIndex = 301; - this.listViewConvertOptions.UseCompatibleStateImageBehavior = false; - this.listViewConvertOptions.View = System.Windows.Forms.View.Details; - this.listViewConvertOptions.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listViewConvertOptions_ItemChecked); - this.listViewConvertOptions.SelectedIndexChanged += new System.EventHandler(this.listViewConvertOptions_SelectedIndexChanged); - // - // ActionCheckBox - // - this.ActionCheckBox.Width = 30; - // - // Action - // - this.Action.Width = 400; - // - // contextMenuStripOptions - // - this.contextMenuStripOptions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItemSelectAll, - this.inverseSelectionToolStripMenuItem}); - this.contextMenuStripOptions.Name = "contextMenuStripOptions"; - this.contextMenuStripOptions.Size = new System.Drawing.Size(162, 48); - // - // toolStripMenuItemSelectAll - // - this.toolStripMenuItemSelectAll.Name = "toolStripMenuItemSelectAll"; - this.toolStripMenuItemSelectAll.Size = new System.Drawing.Size(161, 22); - this.toolStripMenuItemSelectAll.Text = "Select all"; - this.toolStripMenuItemSelectAll.Click += new System.EventHandler(this.toolStripMenuItemSelectAll_Click); - // - // inverseSelectionToolStripMenuItem - // - this.inverseSelectionToolStripMenuItem.Name = "inverseSelectionToolStripMenuItem"; - this.inverseSelectionToolStripMenuItem.Size = new System.Drawing.Size(161, 22); - this.inverseSelectionToolStripMenuItem.Text = "Inverse selection"; - this.inverseSelectionToolStripMenuItem.Click += new System.EventHandler(this.inverseSelectionToolStripMenuItem_Click); - // // groupBoxChangeCasing // this.groupBoxChangeCasing.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -1166,17 +1769,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelMaxCharacters.TabIndex = 40; this.labelMaxCharacters.Text = "Maximum characters in one paragraph"; // - // buttonConvertOptionsSettings - // - this.buttonConvertOptionsSettings.Location = new System.Drawing.Point(305, 144); - this.buttonConvertOptionsSettings.Name = "buttonConvertOptionsSettings"; - this.buttonConvertOptionsSettings.Size = new System.Drawing.Size(116, 23); - this.buttonConvertOptionsSettings.TabIndex = 302; - this.buttonConvertOptionsSettings.Text = "Settings..."; - this.buttonConvertOptionsSettings.UseVisualStyleBackColor = true; - this.buttonConvertOptionsSettings.Visible = false; - this.buttonConvertOptionsSettings.Click += new System.EventHandler(this.ButtonOptionConvertSettings); - // // groupBoxAssaChangeRes // this.groupBoxAssaChangeRes.Controls.Add(this.checkBoxDrawing); @@ -1505,474 +2097,6 @@ namespace Nikse.SubtitleEdit.Forms this.checkBoxConvertColorsToDialogRemoveColorTags.Text = "Remove color tags"; this.checkBoxConvertColorsToDialogRemoveColorTags.UseVisualStyleBackColor = true; // - // groupBoxDeleteLines - // - this.groupBoxDeleteLines.Controls.Add(this.textBoxDeleteContains); - this.groupBoxDeleteLines.Controls.Add(this.labelDeleteLinesContaining); - this.groupBoxDeleteLines.Controls.Add(this.numericUpDownDeleteLast); - this.groupBoxDeleteLines.Controls.Add(this.labelDeleteLastLines); - this.groupBoxDeleteLines.Controls.Add(this.numericUpDownDeleteFirst); - this.groupBoxDeleteLines.Controls.Add(this.labelDeleteFirstLines); - this.groupBoxDeleteLines.Location = new System.Drawing.Point(305, 94); - this.groupBoxDeleteLines.Name = "groupBoxDeleteLines"; - this.groupBoxDeleteLines.Size = new System.Drawing.Size(271, 140); - this.groupBoxDeleteLines.TabIndex = 308; - this.groupBoxDeleteLines.TabStop = false; - this.groupBoxDeleteLines.Text = "Delete lines"; - this.groupBoxDeleteLines.Visible = false; - // - // textBoxDeleteContains - // - this.textBoxDeleteContains.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.textBoxDeleteContains.Location = new System.Drawing.Point(10, 110); - this.textBoxDeleteContains.Name = "textBoxDeleteContains"; - this.textBoxDeleteContains.Size = new System.Drawing.Size(237, 20); - this.textBoxDeleteContains.TabIndex = 5; - // - // labelDeleteLinesContaining - // - this.labelDeleteLinesContaining.AutoSize = true; - this.labelDeleteLinesContaining.Location = new System.Drawing.Point(9, 89); - this.labelDeleteLinesContaining.Name = "labelDeleteLinesContaining"; - this.labelDeleteLinesContaining.Size = new System.Drawing.Size(114, 13); - this.labelDeleteLinesContaining.TabIndex = 4; - this.labelDeleteLinesContaining.Text = "Delete lines containing"; - // - // numericUpDownDeleteLast - // - this.numericUpDownDeleteLast.BackColor = System.Drawing.SystemColors.Window; - this.numericUpDownDeleteLast.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.numericUpDownDeleteLast.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.numericUpDownDeleteLast.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.numericUpDownDeleteLast.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.numericUpDownDeleteLast.ButtonForeColorDown = System.Drawing.Color.Orange; - this.numericUpDownDeleteLast.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.numericUpDownDeleteLast.DecimalPlaces = 0; - this.numericUpDownDeleteLast.Increment = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numericUpDownDeleteLast.Location = new System.Drawing.Point(92, 45); - this.numericUpDownDeleteLast.Maximum = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.numericUpDownDeleteLast.Minimum = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.numericUpDownDeleteLast.Name = "numericUpDownDeleteLast"; - this.numericUpDownDeleteLast.Size = new System.Drawing.Size(43, 20); - this.numericUpDownDeleteLast.TabIndex = 3; - this.numericUpDownDeleteLast.TabStop = false; - this.numericUpDownDeleteLast.ThousandsSeparator = false; - this.numericUpDownDeleteLast.Value = new decimal(new int[] { - 0, - 0, - 0, - 0}); - // - // labelDeleteLastLines - // - this.labelDeleteLastLines.AutoSize = true; - this.labelDeleteLastLines.Location = new System.Drawing.Point(5, 47); - this.labelDeleteLastLines.Name = "labelDeleteLastLines"; - this.labelDeleteLastLines.Size = new System.Drawing.Size(81, 13); - this.labelDeleteLastLines.TabIndex = 2; - this.labelDeleteLastLines.Text = "Delete last lines"; - // - // numericUpDownDeleteFirst - // - this.numericUpDownDeleteFirst.BackColor = System.Drawing.SystemColors.Window; - this.numericUpDownDeleteFirst.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.numericUpDownDeleteFirst.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.numericUpDownDeleteFirst.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.numericUpDownDeleteFirst.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.numericUpDownDeleteFirst.ButtonForeColorDown = System.Drawing.Color.Orange; - this.numericUpDownDeleteFirst.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.numericUpDownDeleteFirst.DecimalPlaces = 0; - this.numericUpDownDeleteFirst.Increment = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numericUpDownDeleteFirst.Location = new System.Drawing.Point(93, 19); - this.numericUpDownDeleteFirst.Maximum = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.numericUpDownDeleteFirst.Minimum = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.numericUpDownDeleteFirst.Name = "numericUpDownDeleteFirst"; - this.numericUpDownDeleteFirst.Size = new System.Drawing.Size(43, 20); - this.numericUpDownDeleteFirst.TabIndex = 1; - this.numericUpDownDeleteFirst.TabStop = false; - this.numericUpDownDeleteFirst.ThousandsSeparator = false; - this.numericUpDownDeleteFirst.Value = new decimal(new int[] { - 0, - 0, - 0, - 0}); - // - // labelDeleteFirstLines - // - this.labelDeleteFirstLines.AutoSize = true; - this.labelDeleteFirstLines.Location = new System.Drawing.Point(6, 20); - this.labelDeleteFirstLines.Name = "labelDeleteFirstLines"; - this.labelDeleteFirstLines.Size = new System.Drawing.Size(81, 13); - this.labelDeleteFirstLines.TabIndex = 0; - this.labelDeleteFirstLines.Text = "Delete first lines"; - // - // groupBoxRemoveStyle - // - this.groupBoxRemoveStyle.Controls.Add(this.textBoxRemoveStyle); - this.groupBoxRemoveStyle.Controls.Add(this.labelStyleActor); - this.groupBoxRemoveStyle.Location = new System.Drawing.Point(307, 12); - this.groupBoxRemoveStyle.Name = "groupBoxRemoveStyle"; - this.groupBoxRemoveStyle.Size = new System.Drawing.Size(271, 76); - this.groupBoxRemoveStyle.TabIndex = 307; - this.groupBoxRemoveStyle.TabStop = false; - this.groupBoxRemoveStyle.Text = "Remove style/actor"; - this.groupBoxRemoveStyle.Visible = false; - // - // textBoxRemoveStyle - // - this.textBoxRemoveStyle.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.textBoxRemoveStyle.Location = new System.Drawing.Point(6, 35); - this.textBoxRemoveStyle.Name = "textBoxRemoveStyle"; - this.textBoxRemoveStyle.Size = new System.Drawing.Size(257, 20); - this.textBoxRemoveStyle.TabIndex = 8; - // - // labelStyleActor - // - this.labelStyleActor.AutoSize = true; - this.labelStyleActor.Location = new System.Drawing.Point(6, 20); - this.labelStyleActor.Name = "labelStyleActor"; - this.labelStyleActor.Size = new System.Drawing.Size(59, 13); - this.labelStyleActor.TabIndex = 0; - this.labelStyleActor.Text = "Style/actor"; - // - // groupBoxOffsetTimeCodes - // - this.groupBoxOffsetTimeCodes.Controls.Add(this.radioButtonShowLater); - this.groupBoxOffsetTimeCodes.Controls.Add(this.radioButtonShowEarlier); - this.groupBoxOffsetTimeCodes.Controls.Add(this.timeUpDownAdjust); - this.groupBoxOffsetTimeCodes.Controls.Add(this.labelHourMinSecMilliSecond); - this.groupBoxOffsetTimeCodes.Location = new System.Drawing.Point(305, 19); - this.groupBoxOffsetTimeCodes.Name = "groupBoxOffsetTimeCodes"; - this.groupBoxOffsetTimeCodes.Size = new System.Drawing.Size(271, 119); - this.groupBoxOffsetTimeCodes.TabIndex = 306; - this.groupBoxOffsetTimeCodes.TabStop = false; - this.groupBoxOffsetTimeCodes.Text = "Offset time codes"; - this.groupBoxOffsetTimeCodes.Visible = false; - // - // radioButtonShowLater - // - this.radioButtonShowLater.AutoSize = true; - this.radioButtonShowLater.Checked = true; - this.radioButtonShowLater.Location = new System.Drawing.Point(9, 89); - this.radioButtonShowLater.Name = "radioButtonShowLater"; - this.radioButtonShowLater.Size = new System.Drawing.Size(75, 17); - this.radioButtonShowLater.TabIndex = 3; - this.radioButtonShowLater.TabStop = true; - this.radioButtonShowLater.Text = "Show later"; - this.radioButtonShowLater.UseVisualStyleBackColor = true; - // - // radioButtonShowEarlier - // - this.radioButtonShowEarlier.AutoSize = true; - this.radioButtonShowEarlier.Location = new System.Drawing.Point(9, 66); - this.radioButtonShowEarlier.Name = "radioButtonShowEarlier"; - this.radioButtonShowEarlier.Size = new System.Drawing.Size(83, 17); - this.radioButtonShowEarlier.TabIndex = 2; - this.radioButtonShowEarlier.Text = "Show earlier"; - this.radioButtonShowEarlier.UseVisualStyleBackColor = true; - // - // timeUpDownAdjust - // - this.timeUpDownAdjust.BackColor = System.Drawing.SystemColors.Window; - this.timeUpDownAdjust.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.timeUpDownAdjust.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.timeUpDownAdjust.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.timeUpDownAdjust.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.timeUpDownAdjust.ButtonForeColorDown = System.Drawing.Color.Orange; - this.timeUpDownAdjust.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.timeUpDownAdjust.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - this.timeUpDownAdjust.Increment = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.timeUpDownAdjust.Location = new System.Drawing.Point(7, 37); - this.timeUpDownAdjust.Margin = new System.Windows.Forms.Padding(4); - this.timeUpDownAdjust.Name = "timeUpDownAdjust"; - this.timeUpDownAdjust.Size = new System.Drawing.Size(113, 23); - this.timeUpDownAdjust.TabIndex = 1; - this.timeUpDownAdjust.TabStop = false; - timeCode1.Hours = 0; - timeCode1.Milliseconds = 0; - timeCode1.Minutes = 0; - timeCode1.Seconds = 0; - timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00"); - timeCode1.TotalMilliseconds = 0D; - timeCode1.TotalSeconds = 0D; - this.timeUpDownAdjust.TimeCode = timeCode1; - this.timeUpDownAdjust.UseVideoOffset = false; - // - // labelHourMinSecMilliSecond - // - this.labelHourMinSecMilliSecond.AutoSize = true; - this.labelHourMinSecMilliSecond.Location = new System.Drawing.Point(6, 20); - this.labelHourMinSecMilliSecond.Name = "labelHourMinSecMilliSecond"; - this.labelHourMinSecMilliSecond.Size = new System.Drawing.Size(90, 13); - this.labelHourMinSecMilliSecond.TabIndex = 0; - this.labelHourMinSecMilliSecond.Text = "Hours:min:sec.ms"; - // - // groupBoxChangeFrameRate - // - this.groupBoxChangeFrameRate.Controls.Add(this.buttonSwapFrameRate); - this.groupBoxChangeFrameRate.Controls.Add(this.comboBoxFrameRateTo); - this.groupBoxChangeFrameRate.Controls.Add(this.labelToFrameRate); - this.groupBoxChangeFrameRate.Controls.Add(this.comboBoxFrameRateFrom); - this.groupBoxChangeFrameRate.Controls.Add(this.labelFromFrameRate); - this.groupBoxChangeFrameRate.Location = new System.Drawing.Point(307, 12); - this.groupBoxChangeFrameRate.Name = "groupBoxChangeFrameRate"; - this.groupBoxChangeFrameRate.Size = new System.Drawing.Size(269, 90); - this.groupBoxChangeFrameRate.TabIndex = 305; - this.groupBoxChangeFrameRate.TabStop = false; - this.groupBoxChangeFrameRate.Text = "Change frame rate"; - this.groupBoxChangeFrameRate.Visible = false; - // - // buttonSwapFrameRate - // - this.buttonSwapFrameRate.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonSwapFrameRate.Location = new System.Drawing.Point(207, 28); - this.buttonSwapFrameRate.Name = "buttonSwapFrameRate"; - this.buttonSwapFrameRate.Size = new System.Drawing.Size(27, 28); - this.buttonSwapFrameRate.TabIndex = 9; - this.buttonSwapFrameRate.Text = "<->"; - this.buttonSwapFrameRate.UseVisualStyleBackColor = true; - this.buttonSwapFrameRate.Click += new System.EventHandler(this.buttonSwapFrameRate_Click); - // - // comboBoxFrameRateTo - // - this.comboBoxFrameRateTo.BackColor = System.Drawing.SystemColors.Window; - this.comboBoxFrameRateTo.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.comboBoxFrameRateTo.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.comboBoxFrameRateTo.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.comboBoxFrameRateTo.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.comboBoxFrameRateTo.ButtonForeColorDown = System.Drawing.Color.Orange; - this.comboBoxFrameRateTo.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.comboBoxFrameRateTo.DropDownHeight = 400; - this.comboBoxFrameRateTo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; - this.comboBoxFrameRateTo.DropDownWidth = 71; - this.comboBoxFrameRateTo.FormattingEnabled = true; - this.comboBoxFrameRateTo.Location = new System.Drawing.Point(130, 46); - this.comboBoxFrameRateTo.MaxLength = 32767; - this.comboBoxFrameRateTo.Name = "comboBoxFrameRateTo"; - this.comboBoxFrameRateTo.SelectedIndex = -1; - this.comboBoxFrameRateTo.SelectedItem = null; - this.comboBoxFrameRateTo.SelectedText = ""; - this.comboBoxFrameRateTo.Size = new System.Drawing.Size(71, 21); - this.comboBoxFrameRateTo.TabIndex = 3; - this.comboBoxFrameRateTo.TabStop = false; - this.comboBoxFrameRateTo.UsePopupWindow = false; - // - // labelToFrameRate - // - this.labelToFrameRate.AutoSize = true; - this.labelToFrameRate.Location = new System.Drawing.Point(6, 50); - this.labelToFrameRate.Name = "labelToFrameRate"; - this.labelToFrameRate.Size = new System.Drawing.Size(70, 13); - this.labelToFrameRate.TabIndex = 2; - this.labelToFrameRate.Text = "To frame rate"; - // - // comboBoxFrameRateFrom - // - this.comboBoxFrameRateFrom.BackColor = System.Drawing.SystemColors.Window; - this.comboBoxFrameRateFrom.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.comboBoxFrameRateFrom.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.comboBoxFrameRateFrom.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.comboBoxFrameRateFrom.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.comboBoxFrameRateFrom.ButtonForeColorDown = System.Drawing.Color.Orange; - this.comboBoxFrameRateFrom.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.comboBoxFrameRateFrom.DropDownHeight = 400; - this.comboBoxFrameRateFrom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; - this.comboBoxFrameRateFrom.DropDownWidth = 71; - this.comboBoxFrameRateFrom.FormattingEnabled = true; - this.comboBoxFrameRateFrom.Location = new System.Drawing.Point(130, 17); - this.comboBoxFrameRateFrom.MaxLength = 32767; - this.comboBoxFrameRateFrom.Name = "comboBoxFrameRateFrom"; - this.comboBoxFrameRateFrom.SelectedIndex = -1; - this.comboBoxFrameRateFrom.SelectedItem = null; - this.comboBoxFrameRateFrom.SelectedText = ""; - this.comboBoxFrameRateFrom.Size = new System.Drawing.Size(71, 21); - this.comboBoxFrameRateFrom.TabIndex = 1; - this.comboBoxFrameRateFrom.TabStop = false; - this.comboBoxFrameRateFrom.UsePopupWindow = false; - // - // labelFromFrameRate - // - this.labelFromFrameRate.AutoSize = true; - this.labelFromFrameRate.Location = new System.Drawing.Point(6, 21); - this.labelFromFrameRate.Name = "labelFromFrameRate"; - this.labelFromFrameRate.Size = new System.Drawing.Size(80, 13); - this.labelFromFrameRate.TabIndex = 0; - this.labelFromFrameRate.Text = "From frame rate"; - // - // groupBoxFixRtl - // - this.groupBoxFixRtl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxFixRtl.Controls.Add(this.radioButtonReverseStartEnd); - this.groupBoxFixRtl.Controls.Add(this.radioButtonRemoveUnicode); - this.groupBoxFixRtl.Controls.Add(this.radioButtonAddUnicode); - this.groupBoxFixRtl.Location = new System.Drawing.Point(305, 17); - this.groupBoxFixRtl.Name = "groupBoxFixRtl"; - this.groupBoxFixRtl.Size = new System.Drawing.Size(271, 115); - this.groupBoxFixRtl.TabIndex = 303; - this.groupBoxFixRtl.TabStop = false; - this.groupBoxFixRtl.Text = "Settings"; - this.groupBoxFixRtl.Visible = false; - // - // radioButtonReverseStartEnd - // - this.radioButtonReverseStartEnd.AutoSize = true; - this.radioButtonReverseStartEnd.Location = new System.Drawing.Point(19, 77); - this.radioButtonReverseStartEnd.Name = "radioButtonReverseStartEnd"; - this.radioButtonReverseStartEnd.Size = new System.Drawing.Size(135, 17); - this.radioButtonReverseStartEnd.TabIndex = 2; - this.radioButtonReverseStartEnd.TabStop = true; - this.radioButtonReverseStartEnd.Text = "Reverse RTL start/end"; - this.radioButtonReverseStartEnd.UseVisualStyleBackColor = true; - // - // radioButtonRemoveUnicode - // - this.radioButtonRemoveUnicode.AutoSize = true; - this.radioButtonRemoveUnicode.Location = new System.Drawing.Point(19, 54); - this.radioButtonRemoveUnicode.Name = "radioButtonRemoveUnicode"; - this.radioButtonRemoveUnicode.Size = new System.Drawing.Size(153, 17); - this.radioButtonRemoveUnicode.TabIndex = 1; - this.radioButtonRemoveUnicode.TabStop = true; - this.radioButtonRemoveUnicode.Text = "Remove RTL unicode tags"; - this.radioButtonRemoveUnicode.UseVisualStyleBackColor = true; - // - // radioButtonAddUnicode - // - this.radioButtonAddUnicode.AutoSize = true; - this.radioButtonAddUnicode.Location = new System.Drawing.Point(19, 31); - this.radioButtonAddUnicode.Name = "radioButtonAddUnicode"; - this.radioButtonAddUnicode.Size = new System.Drawing.Size(145, 17); - this.radioButtonAddUnicode.TabIndex = 0; - this.radioButtonAddUnicode.TabStop = true; - this.radioButtonAddUnicode.Text = "Fix RTL via Unicode tags"; - this.radioButtonAddUnicode.UseVisualStyleBackColor = true; - // - // groupBoxSpeed - // - this.groupBoxSpeed.Controls.Add(this.radioButtonToDropFrame); - this.groupBoxSpeed.Controls.Add(this.radioButtonSpeedFromDropFrame); - this.groupBoxSpeed.Controls.Add(this.radioButtonSpeedCustom); - this.groupBoxSpeed.Controls.Add(this.numericUpDownPercent); - this.groupBoxSpeed.Controls.Add(this.labelPercent); - this.groupBoxSpeed.Location = new System.Drawing.Point(305, 17); - this.groupBoxSpeed.Name = "groupBoxSpeed"; - this.groupBoxSpeed.Size = new System.Drawing.Size(271, 129); - this.groupBoxSpeed.TabIndex = 307; - this.groupBoxSpeed.TabStop = false; - this.groupBoxSpeed.Text = "Change speed"; - this.groupBoxSpeed.Visible = false; - // - // radioButtonToDropFrame - // - this.radioButtonToDropFrame.AutoSize = true; - this.radioButtonToDropFrame.Location = new System.Drawing.Point(6, 91); - this.radioButtonToDropFrame.Name = "radioButtonToDropFrame"; - this.radioButtonToDropFrame.Size = new System.Drawing.Size(91, 17); - this.radioButtonToDropFrame.TabIndex = 3; - this.radioButtonToDropFrame.Text = "To drop frame"; - this.radioButtonToDropFrame.UseVisualStyleBackColor = true; - this.radioButtonToDropFrame.CheckedChanged += new System.EventHandler(this.radioButtonToDropFrame_CheckedChanged); - // - // radioButtonSpeedFromDropFrame - // - this.radioButtonSpeedFromDropFrame.AutoSize = true; - this.radioButtonSpeedFromDropFrame.Location = new System.Drawing.Point(6, 68); - this.radioButtonSpeedFromDropFrame.Name = "radioButtonSpeedFromDropFrame"; - this.radioButtonSpeedFromDropFrame.Size = new System.Drawing.Size(101, 17); - this.radioButtonSpeedFromDropFrame.TabIndex = 2; - this.radioButtonSpeedFromDropFrame.Text = "From drop frame"; - this.radioButtonSpeedFromDropFrame.UseVisualStyleBackColor = true; - this.radioButtonSpeedFromDropFrame.CheckedChanged += new System.EventHandler(this.radioButtonSpeedFromDropFrame_CheckedChanged); - // - // radioButtonSpeedCustom - // - this.radioButtonSpeedCustom.AutoSize = true; - this.radioButtonSpeedCustom.Checked = true; - this.radioButtonSpeedCustom.Location = new System.Drawing.Point(6, 45); - this.radioButtonSpeedCustom.Name = "radioButtonSpeedCustom"; - this.radioButtonSpeedCustom.Size = new System.Drawing.Size(60, 17); - this.radioButtonSpeedCustom.TabIndex = 1; - this.radioButtonSpeedCustom.TabStop = true; - this.radioButtonSpeedCustom.Text = "Custom"; - this.radioButtonSpeedCustom.UseVisualStyleBackColor = true; - this.radioButtonSpeedCustom.CheckedChanged += new System.EventHandler(this.radioButtonSpeedCustom_CheckedChanged); - // - // numericUpDownPercent - // - this.numericUpDownPercent.BackColor = System.Drawing.SystemColors.Window; - this.numericUpDownPercent.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.numericUpDownPercent.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.numericUpDownPercent.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.numericUpDownPercent.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.numericUpDownPercent.ButtonForeColorDown = System.Drawing.Color.Orange; - this.numericUpDownPercent.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.numericUpDownPercent.DecimalPlaces = 4; - this.numericUpDownPercent.Increment = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numericUpDownPercent.Location = new System.Drawing.Point(6, 19); - this.numericUpDownPercent.Maximum = new decimal(new int[] { - 200, - 0, - 0, - 0}); - this.numericUpDownPercent.Minimum = new decimal(new int[] { - 50, - 0, - 0, - 0}); - this.numericUpDownPercent.Name = "numericUpDownPercent"; - this.numericUpDownPercent.Size = new System.Drawing.Size(81, 20); - this.numericUpDownPercent.TabIndex = 0; - this.numericUpDownPercent.TabStop = false; - this.numericUpDownPercent.ThousandsSeparator = false; - this.numericUpDownPercent.Value = new decimal(new int[] { - 100, - 0, - 0, - 0}); - // - // labelPercent - // - this.labelPercent.AutoSize = true; - this.labelPercent.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelPercent.Location = new System.Drawing.Point(87, 22); - this.labelPercent.Name = "labelPercent"; - this.labelPercent.Size = new System.Drawing.Size(15, 13); - this.labelPercent.TabIndex = 12; - this.labelPercent.Text = "%"; - // // groupBoxOutput // this.groupBoxOutput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) @@ -2475,6 +2599,21 @@ namespace Nikse.SubtitleEdit.Forms this.ResizeEnd += new System.EventHandler(this.BatchConvert_ResizeEnd); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BatchConvert_KeyDown); this.groupBoxConvertOptions.ResumeLayout(false); + this.groupBoxAutoTranslate.ResumeLayout(false); + this.groupBoxAutoTranslate.PerformLayout(); + this.contextMenuStripOptions.ResumeLayout(false); + this.groupBoxDeleteLines.ResumeLayout(false); + this.groupBoxDeleteLines.PerformLayout(); + this.groupBoxRemoveStyle.ResumeLayout(false); + this.groupBoxRemoveStyle.PerformLayout(); + this.groupBoxOffsetTimeCodes.ResumeLayout(false); + this.groupBoxOffsetTimeCodes.PerformLayout(); + this.groupBoxChangeFrameRate.ResumeLayout(false); + this.groupBoxChangeFrameRate.PerformLayout(); + this.groupBoxFixRtl.ResumeLayout(false); + this.groupBoxFixRtl.PerformLayout(); + this.groupBoxSpeed.ResumeLayout(false); + this.groupBoxSpeed.PerformLayout(); this.groupBoxRemoveFormatting.ResumeLayout(false); this.groupBoxRemoveFormatting.PerformLayout(); this.groupBoxApplyDurationLimits.ResumeLayout(false); @@ -2491,7 +2630,6 @@ namespace Nikse.SubtitleEdit.Forms this.panelAdjustDurationRecalc.PerformLayout(); this.groupBoxBeautifyTimeCodes.ResumeLayout(false); this.groupBoxBeautifyTimeCodes.PerformLayout(); - this.contextMenuStripOptions.ResumeLayout(false); this.groupBoxChangeCasing.ResumeLayout(false); this.groupBoxChangeCasing.PerformLayout(); this.groupBoxMergeShortLines.ResumeLayout(false); @@ -2503,18 +2641,6 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxMergeSameTimeCodes.PerformLayout(); this.groupBoxConvertColorsToDialog.ResumeLayout(false); this.groupBoxConvertColorsToDialog.PerformLayout(); - this.groupBoxDeleteLines.ResumeLayout(false); - this.groupBoxDeleteLines.PerformLayout(); - this.groupBoxRemoveStyle.ResumeLayout(false); - this.groupBoxRemoveStyle.PerformLayout(); - this.groupBoxOffsetTimeCodes.ResumeLayout(false); - this.groupBoxOffsetTimeCodes.PerformLayout(); - this.groupBoxChangeFrameRate.ResumeLayout(false); - this.groupBoxChangeFrameRate.PerformLayout(); - this.groupBoxFixRtl.ResumeLayout(false); - this.groupBoxFixRtl.PerformLayout(); - this.groupBoxSpeed.ResumeLayout(false); - this.groupBoxSpeed.PerformLayout(); this.groupBoxOutput.ResumeLayout(false); this.groupBoxOutput.PerformLayout(); this.groupBoxInput.ResumeLayout(false); @@ -2688,5 +2814,12 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.CheckBox checkBoxRemoveAllFormatting; private Controls.NikseTextBox textBoxFilter; private Controls.NikseTextBox textBoxRemoveStyle; + private System.Windows.Forms.GroupBox groupBoxAutoTranslate; + private System.Windows.Forms.LinkLabel linkLabelPoweredBy; + private Controls.NikseComboBox nikseComboBoxEngine; + private System.Windows.Forms.Label labelTarget; + private Controls.NikseComboBox comboBoxTarget; + private System.Windows.Forms.Label labelSource; + private Controls.NikseComboBox comboBoxSource; } } \ No newline at end of file diff --git a/src/ui/Forms/BatchConvert.cs b/src/ui/Forms/BatchConvert.cs index 4bf90f1cb..14f7c965a 100644 --- a/src/ui/Forms/BatchConvert.cs +++ b/src/ui/Forms/BatchConvert.cs @@ -23,6 +23,9 @@ using System.Linq; using System.Text; using System.Threading; using System.Windows.Forms; +using Nikse.SubtitleEdit.Controls; +using Nikse.SubtitleEdit.Core.AutoTranslate; +using Nikse.SubtitleEdit.Core.Translate; using MessageBox = Nikse.SubtitleEdit.Forms.SeMsgBox.MessageBox; namespace Nikse.SubtitleEdit.Forms @@ -114,6 +117,9 @@ namespace Nikse.SubtitleEdit.Forms private Dictionary> _binaryParagraphLookup = new Dictionary>(); private RemoveTextForHISettings _removeTextForHiSettings; private PreprocessingSettings _preprocessingSettings; + private IAutoTranslator _autoTranslator; + private List _autoTranslatorEngines; + private string _ocrEngine = "Tesseract"; private string _ocrLanguage = "en"; @@ -677,6 +683,13 @@ namespace Nikse.SubtitleEdit.Forms Action = CommandLineConverter.BatchAction.BeautifyTimeCodes, Control = groupBoxBeautifyTimeCodes, }, + new FixActionItem + { + Text = LanguageSettings.Current.GoogleTranslate.Title, + Checked = Configuration.Settings.Tools.BatchConvertBeautifyTimeCodes, + Action = CommandLineConverter.BatchAction.AutoTranslate, + Control = groupBoxAutoTranslate, + }, }; foreach (var fixItem in fixItems) { @@ -701,6 +714,15 @@ namespace Nikse.SubtitleEdit.Forms SetMkvLanguageMenuItem(); alsoScanVideoFilesInSearchFolderslowToolStripMenuItem.Checked = Configuration.Settings.Tools.BatchConvertScanFolderIncludeVideo; + + _autoTranslatorEngines = new List + { // only add local APIs + new LibreTranslate(), + new NoLanguageLeftBehindServe(), + new NoLanguageLeftBehindApi(), + }; + nikseComboBoxEngine.Items.Clear(); + nikseComboBoxEngine.Items.AddRange(_autoTranslatorEngines.Select(p => p.Name).ToArray()); } private void SetMkvLanguageMenuItem() @@ -3986,5 +4008,46 @@ namespace Nikse.SubtitleEdit.Forms checkBoxRemoveFontName.Enabled = enabled; checkBoxRemoveAlignment.Enabled = enabled; } + + private void linkLabelPoweredBy_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + var engine = _autoTranslatorEngines.First(p => p.Name == nikseComboBoxEngine.Text); + UiUtil.OpenUrl(engine.Url); + } + + private void SetupLanguageSettings() + { + FillComboWithLanguages(comboBoxSource, _autoTranslator.GetSupportedSourceLanguages()); + comboBoxSource.Items.Insert(0, LanguageSettings.Current.Settings.Automatic); + comboBoxSource.SelectedIndex = 0; + + FillComboWithLanguages(comboBoxTarget, _autoTranslator.GetSupportedTargetLanguages()); + } + + public static void FillComboWithLanguages(NikseComboBox comboBox, IEnumerable languages) + { + comboBox.Items.Clear(); + foreach (var language in languages) + { + comboBox.Items.Add(language); + } + } + + private void nikseComboBoxEngine_SelectedIndexChanged(object sender, EventArgs e) + { + SetAutoTranslatorEngine(); + SetupLanguageSettings(); + } + + private void SetAutoTranslatorEngine() + { + _autoTranslator = GetCurrentEngine(); + linkLabelPoweredBy.Text = string.Format(LanguageSettings.Current.GoogleTranslate.PoweredByX, _autoTranslator.Name); + } + + private IAutoTranslator GetCurrentEngine() + { + return _autoTranslatorEngines.First(p => p.Name == nikseComboBoxEngine.Text); + } } } diff --git a/src/ui/Forms/Options/Settings.Designer.cs b/src/ui/Forms/Options/Settings.Designer.cs index 951d3e123..074b8cb1e 100644 --- a/src/ui/Forms/Options/Settings.Designer.cs +++ b/src/ui/Forms/Options/Settings.Designer.cs @@ -454,6 +454,18 @@ this.imageListFileTypeAssociations = new System.Windows.Forms.ImageList(this.components); this.toolTipDialogStylePreview = new System.Windows.Forms.ToolTip(this.components); this.panelAutoTranslate = new System.Windows.Forms.Panel(); + this.groupBoxDeepL = new System.Windows.Forms.GroupBox(); + this.nikseTextBoxDeepLApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.labelDeepLApiKey = new System.Windows.Forms.Label(); + this.nikseTextBoxDeepLUrl = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.labelDeepLUrl = new System.Windows.Forms.Label(); + this.linkLabelMoreInfoDeepl = new System.Windows.Forms.LinkLabel(); + this.label9 = new System.Windows.Forms.Label(); + this.groupBoxMyMemory = new System.Windows.Forms.GroupBox(); + this.nikseTextBoxMyMemoryApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.labelMyMemoryApiKey = new System.Windows.Forms.Label(); + this.linkLabelMyMemoryTranslate = new System.Windows.Forms.LinkLabel(); + this.label8 = new System.Windows.Forms.Label(); this.groupBoxLibreTranslate = new System.Windows.Forms.GroupBox(); this.nikseTextBoxLibreTranslateApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox(); this.labelLibreApiKey = new System.Windows.Forms.Label(); @@ -473,11 +485,6 @@ this.labelNllbApiUrl = new System.Windows.Forms.Label(); this.linkLabelNllbApi = new System.Windows.Forms.LinkLabel(); this.label5 = new System.Windows.Forms.Label(); - this.groupBoxMyMemory = new System.Windows.Forms.GroupBox(); - this.nikseTextBoxMyMemoryApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox(); - this.labelMyMemoryApiKey = new System.Windows.Forms.Label(); - this.linkLabelMyMemoryTranslate = new System.Windows.Forms.LinkLabel(); - this.label8 = new System.Windows.Forms.Label(); this.panelGeneral.SuspendLayout(); this.groupBoxMiscellaneous.SuspendLayout(); this.groupBoxGeneralRules.SuspendLayout(); @@ -554,10 +561,11 @@ this.groupBoxProxyAuthentication.SuspendLayout(); this.panelFileTypeAssociations.SuspendLayout(); this.panelAutoTranslate.SuspendLayout(); + this.groupBoxDeepL.SuspendLayout(); + this.groupBoxMyMemory.SuspendLayout(); this.groupBoxLibreTranslate.SuspendLayout(); this.groupBoxNllbServe.SuspendLayout(); this.groupBoxNllbApi.SuspendLayout(); - this.groupBoxMyMemory.SuspendLayout(); this.SuspendLayout(); // // buttonOK @@ -6417,6 +6425,7 @@ // // panelAutoTranslate // + this.panelAutoTranslate.Controls.Add(this.groupBoxDeepL); this.panelAutoTranslate.Controls.Add(this.groupBoxMyMemory); this.panelAutoTranslate.Controls.Add(this.groupBoxLibreTranslate); this.panelAutoTranslate.Controls.Add(this.groupBoxNllbServe); @@ -6430,6 +6439,129 @@ this.panelAutoTranslate.TabIndex = 33; this.panelAutoTranslate.Text = "Tools"; // + // groupBoxDeepL + // + this.groupBoxDeepL.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxDeepL.Controls.Add(this.nikseTextBoxDeepLApiKey); + this.groupBoxDeepL.Controls.Add(this.labelDeepLApiKey); + this.groupBoxDeepL.Controls.Add(this.nikseTextBoxDeepLUrl); + this.groupBoxDeepL.Controls.Add(this.labelDeepLUrl); + this.groupBoxDeepL.Controls.Add(this.linkLabelMoreInfoDeepl); + this.groupBoxDeepL.Controls.Add(this.label9); + this.groupBoxDeepL.Location = new System.Drawing.Point(430, 9); + this.groupBoxDeepL.Name = "groupBoxDeepL"; + this.groupBoxDeepL.Size = new System.Drawing.Size(413, 198); + this.groupBoxDeepL.TabIndex = 37; + this.groupBoxDeepL.TabStop = false; + this.groupBoxDeepL.Text = "DeepL"; + // + // nikseTextBoxDeepLApiKey + // + this.nikseTextBoxDeepLApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseTextBoxDeepLApiKey.Location = new System.Drawing.Point(8, 102); + this.nikseTextBoxDeepLApiKey.Name = "nikseTextBoxDeepLApiKey"; + this.nikseTextBoxDeepLApiKey.Size = new System.Drawing.Size(376, 21); + this.nikseTextBoxDeepLApiKey.TabIndex = 36; + // + // labelDeepLApiKey + // + this.labelDeepLApiKey.AutoSize = true; + this.labelDeepLApiKey.Location = new System.Drawing.Point(6, 84); + this.labelDeepLApiKey.Name = "labelDeepLApiKey"; + this.labelDeepLApiKey.Size = new System.Drawing.Size(44, 13); + this.labelDeepLApiKey.TabIndex = 35; + this.labelDeepLApiKey.Text = "API key"; + // + // nikseTextBoxDeepLUrl + // + this.nikseTextBoxDeepLUrl.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseTextBoxDeepLUrl.Location = new System.Drawing.Point(8, 45); + this.nikseTextBoxDeepLUrl.Name = "nikseTextBoxDeepLUrl"; + this.nikseTextBoxDeepLUrl.Size = new System.Drawing.Size(376, 21); + this.nikseTextBoxDeepLUrl.TabIndex = 34; + // + // labelDeepLUrl + // + this.labelDeepLUrl.AutoSize = true; + this.labelDeepLUrl.Location = new System.Drawing.Point(6, 27); + this.labelDeepLUrl.Name = "labelDeepLUrl"; + this.labelDeepLUrl.Size = new System.Drawing.Size(20, 13); + this.labelDeepLUrl.TabIndex = 30; + this.labelDeepLUrl.Text = "Url"; + // + // linkLabelMoreInfoDeepl + // + this.linkLabelMoreInfoDeepl.AutoSize = true; + this.linkLabelMoreInfoDeepl.Location = new System.Drawing.Point(332, 16); + this.linkLabelMoreInfoDeepl.Name = "linkLabelMoreInfoDeepl"; + this.linkLabelMoreInfoDeepl.Size = new System.Drawing.Size(52, 13); + this.linkLabelMoreInfoDeepl.TabIndex = 24; + this.linkLabelMoreInfoDeepl.TabStop = true; + this.linkLabelMoreInfoDeepl.Text = "More info"; + this.linkLabelMoreInfoDeepl.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelMoreInfoDeepLLinkClicked); + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(16, 106); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(0, 13); + this.label9.TabIndex = 25; + // + // groupBoxMyMemory + // + this.groupBoxMyMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxMyMemory.Controls.Add(this.nikseTextBoxMyMemoryApiKey); + this.groupBoxMyMemory.Controls.Add(this.labelMyMemoryApiKey); + this.groupBoxMyMemory.Controls.Add(this.linkLabelMyMemoryTranslate); + this.groupBoxMyMemory.Controls.Add(this.label8); + this.groupBoxMyMemory.Location = new System.Drawing.Point(429, 389); + this.groupBoxMyMemory.Name = "groupBoxMyMemory"; + this.groupBoxMyMemory.Size = new System.Drawing.Size(412, 95); + this.groupBoxMyMemory.TabIndex = 45; + this.groupBoxMyMemory.TabStop = false; + this.groupBoxMyMemory.Text = "MyMemory API"; + // + // nikseTextBoxMyMemoryApiKey + // + this.nikseTextBoxMyMemoryApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseTextBoxMyMemoryApiKey.Location = new System.Drawing.Point(8, 55); + this.nikseTextBoxMyMemoryApiKey.Name = "nikseTextBoxMyMemoryApiKey"; + this.nikseTextBoxMyMemoryApiKey.Size = new System.Drawing.Size(376, 21); + this.nikseTextBoxMyMemoryApiKey.TabIndex = 36; + // + // labelMyMemoryApiKey + // + this.labelMyMemoryApiKey.AutoSize = true; + this.labelMyMemoryApiKey.Location = new System.Drawing.Point(6, 37); + this.labelMyMemoryApiKey.Name = "labelMyMemoryApiKey"; + this.labelMyMemoryApiKey.Size = new System.Drawing.Size(44, 13); + this.labelMyMemoryApiKey.TabIndex = 35; + this.labelMyMemoryApiKey.Text = "API key"; + // + // linkLabelMyMemoryTranslate + // + this.linkLabelMyMemoryTranslate.AutoSize = true; + this.linkLabelMyMemoryTranslate.Location = new System.Drawing.Point(332, 16); + this.linkLabelMyMemoryTranslate.Name = "linkLabelMyMemoryTranslate"; + this.linkLabelMyMemoryTranslate.Size = new System.Drawing.Size(52, 13); + this.linkLabelMyMemoryTranslate.TabIndex = 24; + this.linkLabelMyMemoryTranslate.TabStop = true; + this.linkLabelMyMemoryTranslate.Text = "More info"; + this.linkLabelMyMemoryTranslate.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelMyMemoryTranslate_LinkClicked); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(16, 106); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(0, 13); + this.label8.TabIndex = 25; + // // groupBoxLibreTranslate // this.groupBoxLibreTranslate.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -6441,10 +6573,10 @@ this.groupBoxLibreTranslate.Controls.Add(this.labelLibreUrl); this.groupBoxLibreTranslate.Controls.Add(this.linkLabelLibreTranslateApi); this.groupBoxLibreTranslate.Controls.Add(this.label7); - this.groupBoxLibreTranslate.Location = new System.Drawing.Point(429, 9); + this.groupBoxLibreTranslate.Location = new System.Drawing.Point(430, 224); this.groupBoxLibreTranslate.Name = "groupBoxLibreTranslate"; - this.groupBoxLibreTranslate.Size = new System.Drawing.Size(408, 155); - this.groupBoxLibreTranslate.TabIndex = 37; + this.groupBoxLibreTranslate.Size = new System.Drawing.Size(411, 155); + this.groupBoxLibreTranslate.TabIndex = 40; this.groupBoxLibreTranslate.TabStop = false; this.groupBoxLibreTranslate.Text = "LibreTranslate API"; // @@ -6583,7 +6715,7 @@ this.groupBoxNllbApi.Controls.Add(this.label5); this.groupBoxNllbApi.Location = new System.Drawing.Point(11, 396); this.groupBoxNllbApi.Name = "groupBoxNllbApi"; - this.groupBoxNllbApi.Size = new System.Drawing.Size(408, 84); + this.groupBoxNllbApi.Size = new System.Drawing.Size(408, 87); this.groupBoxNllbApi.TabIndex = 36; this.groupBoxNllbApi.TabStop = false; this.groupBoxNllbApi.Text = "NLLM API"; @@ -6624,66 +6756,14 @@ this.label5.Size = new System.Drawing.Size(0, 13); this.label5.TabIndex = 25; // - // groupBoxMyMemory - // - this.groupBoxMyMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxMyMemory.Controls.Add(this.nikseTextBoxMyMemoryApiKey); - this.groupBoxMyMemory.Controls.Add(this.labelMyMemoryApiKey); - this.groupBoxMyMemory.Controls.Add(this.linkLabelMyMemoryTranslate); - this.groupBoxMyMemory.Controls.Add(this.label8); - this.groupBoxMyMemory.Location = new System.Drawing.Point(431, 174); - this.groupBoxMyMemory.Name = "groupBoxMyMemory"; - this.groupBoxMyMemory.Size = new System.Drawing.Size(408, 95); - this.groupBoxMyMemory.TabIndex = 38; - this.groupBoxMyMemory.TabStop = false; - this.groupBoxMyMemory.Text = "MyMemory API"; - // - // nikseTextBoxMyMemoryApiKey - // - this.nikseTextBoxMyMemoryApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseTextBoxMyMemoryApiKey.Location = new System.Drawing.Point(8, 55); - this.nikseTextBoxMyMemoryApiKey.Name = "nikseTextBoxMyMemoryApiKey"; - this.nikseTextBoxMyMemoryApiKey.Size = new System.Drawing.Size(376, 21); - this.nikseTextBoxMyMemoryApiKey.TabIndex = 36; - // - // labelMyMemoryApiKey - // - this.labelMyMemoryApiKey.AutoSize = true; - this.labelMyMemoryApiKey.Location = new System.Drawing.Point(6, 37); - this.labelMyMemoryApiKey.Name = "labelMyMemoryApiKey"; - this.labelMyMemoryApiKey.Size = new System.Drawing.Size(44, 13); - this.labelMyMemoryApiKey.TabIndex = 35; - this.labelMyMemoryApiKey.Text = "API key"; - // - // linkLabelMyMemoryTranslate - // - this.linkLabelMyMemoryTranslate.AutoSize = true; - this.linkLabelMyMemoryTranslate.Location = new System.Drawing.Point(332, 16); - this.linkLabelMyMemoryTranslate.Name = "linkLabelMyMemoryTranslate"; - this.linkLabelMyMemoryTranslate.Size = new System.Drawing.Size(52, 13); - this.linkLabelMyMemoryTranslate.TabIndex = 24; - this.linkLabelMyMemoryTranslate.TabStop = true; - this.linkLabelMyMemoryTranslate.Text = "More info"; - this.linkLabelMyMemoryTranslate.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelMyMemoryTranslate_LinkClicked); - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(16, 106); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(0, 13); - this.label8.TabIndex = 25; - // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1092, 574); this.Controls.Add(this.labelUpdateFileTypeAssociationsStatus); - this.Controls.Add(this.panelGeneral); this.Controls.Add(this.panelAutoTranslate); + this.Controls.Add(this.panelGeneral); this.Controls.Add(this.panelTools); this.Controls.Add(this.panelShortcuts); this.Controls.Add(this.panelFont); @@ -6817,14 +6897,16 @@ this.groupBoxProxyAuthentication.PerformLayout(); this.panelFileTypeAssociations.ResumeLayout(false); this.panelAutoTranslate.ResumeLayout(false); + this.groupBoxDeepL.ResumeLayout(false); + this.groupBoxDeepL.PerformLayout(); + this.groupBoxMyMemory.ResumeLayout(false); + this.groupBoxMyMemory.PerformLayout(); this.groupBoxLibreTranslate.ResumeLayout(false); this.groupBoxLibreTranslate.PerformLayout(); this.groupBoxNllbServe.ResumeLayout(false); this.groupBoxNllbServe.PerformLayout(); this.groupBoxNllbApi.ResumeLayout(false); this.groupBoxNllbApi.PerformLayout(); - this.groupBoxMyMemory.ResumeLayout(false); - this.groupBoxMyMemory.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -7281,5 +7363,12 @@ private System.Windows.Forms.Label labelMyMemoryApiKey; private System.Windows.Forms.LinkLabel linkLabelMyMemoryTranslate; private System.Windows.Forms.Label label8; + private System.Windows.Forms.GroupBox groupBoxDeepL; + private Controls.NikseTextBox nikseTextBoxDeepLApiKey; + private System.Windows.Forms.Label labelDeepLApiKey; + private Controls.NikseTextBox nikseTextBoxDeepLUrl; + private System.Windows.Forms.Label labelDeepLUrl; + private System.Windows.Forms.LinkLabel linkLabelMoreInfoDeepl; + private System.Windows.Forms.Label label9; } } \ No newline at end of file diff --git a/src/ui/Forms/Options/Settings.cs b/src/ui/Forms/Options/Settings.cs index 1cf3b097e..320ccd2db 100644 --- a/src/ui/Forms/Options/Settings.cs +++ b/src/ui/Forms/Options/Settings.cs @@ -909,6 +909,8 @@ namespace Nikse.SubtitleEdit.Forms.Options labelNllbApiUrl.Text = LanguageSettings.Current.Main.Url; labelNllbServeUrl.Text = LanguageSettings.Current.Main.Url; labelMyMemoryApiKey.Text = language.GoogleTranslateApiKey; + labelDeepLUrl.Text = LanguageSettings.Current.Main.Url; + labelDeepLApiKey.Text = language.GoogleTranslateApiKey; groupBoxBing.Text = language.MicrosoftBingTranslator; labelBingApiKey.Text = language.MicrosoftTranslateApiKey; @@ -1125,6 +1127,8 @@ namespace Nikse.SubtitleEdit.Forms.Options nikseTextBoxLibreTranslateUrl.Text = Configuration.Settings.Tools.AutoTranslateLibreUrl; nikseTextBoxLibreTranslateApiKey.Text = Configuration.Settings.Tools.AutoTranslateLibreApiKey; nikseTextBoxMyMemoryApiKey.Text = Configuration.Settings.Tools.AutoTranslateMyMemoryApiKey; + nikseTextBoxDeepLUrl.Text = Configuration.Settings.Tools.AutoTranslateDeepLUrl; + nikseTextBoxDeepLApiKey.Text = Configuration.Settings.Tools.AutoTranslateDeepLApiKey; buttonReset.Text = LanguageSettings.Current.Settings.RestoreDefaultSettings; buttonOK.Text = LanguageSettings.Current.General.Ok; @@ -2291,6 +2295,8 @@ namespace Nikse.SubtitleEdit.Forms.Options toolsSettings.AutoTranslateLibreUrl = nikseTextBoxLibreTranslateUrl.Text; toolsSettings.AutoTranslateLibreApiKey = nikseTextBoxLibreTranslateApiKey.Text.Trim(); toolsSettings.AutoTranslateMyMemoryApiKey = nikseTextBoxMyMemoryApiKey.Text; + toolsSettings.AutoTranslateDeepLUrl = nikseTextBoxDeepLUrl.Text; + toolsSettings.AutoTranslateDeepLApiKey = nikseTextBoxDeepLApiKey.Text; var proxy = Configuration.Settings.Proxy; proxy.ProxyAddress = textBoxProxyAddress.Text; @@ -3955,5 +3961,10 @@ namespace Nikse.SubtitleEdit.Forms.Options { UiUtil.OpenUrl(new MyMemoryApi().Url); } + + private void LinkLabelMoreInfoDeepLLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + UiUtil.OpenUrl(new DeepLTranslate().Url); + } } } diff --git a/src/ui/Forms/Translate/AutoTranslate.Designer.cs b/src/ui/Forms/Translate/AutoTranslate.Designer.cs index b63d36c34..50bcecfeb 100644 --- a/src/ui/Forms/Translate/AutoTranslate.Designer.cs +++ b/src/ui/Forms/Translate/AutoTranslate.Designer.cs @@ -38,20 +38,22 @@ this.labelSource = new System.Windows.Forms.Label(); this.labelUrl = new System.Windows.Forms.Label(); this.linkLabelPoweredBy = new System.Windows.Forms.LinkLabel(); + this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.toolStripMenuItemStartLibre = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemStartNLLBServe = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemStartNLLBApi = new System.Windows.Forms.ToolStripMenuItem(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.startLibreTranslateServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.startNLLBServeServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.startNLLBAPIServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.nikseTextBoxApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox(); this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.nikseComboBoxUrl = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.comboBoxSource = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.comboBoxTarget = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.subtitleListViewTarget = new Nikse.SubtitleEdit.Controls.SubtitleListView(); - this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.toolStripMenuItemStartLibre = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItemStartNLLBServe = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItemStartNLLBApi = new System.Windows.Forms.ToolStripMenuItem(); this.subtitleListViewSource = new Nikse.SubtitleEdit.Controls.SubtitleListView(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.startLibreTranslateServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.startNLLBServeServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.startNLLBAPIServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.labelApiKey = new System.Windows.Forms.Label(); this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); @@ -127,7 +129,7 @@ // this.labelUrl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.labelUrl.AutoSize = true; - this.labelUrl.Location = new System.Drawing.Point(14, 532); + this.labelUrl.Location = new System.Drawing.Point(14, 533); this.labelUrl.Name = "labelUrl"; this.labelUrl.Size = new System.Drawing.Size(23, 13); this.labelUrl.TabIndex = 106; @@ -136,7 +138,7 @@ // linkLabelPoweredBy // this.linkLabelPoweredBy.AutoSize = true; - this.linkLabelPoweredBy.Location = new System.Drawing.Point(14, 5); + this.linkLabelPoweredBy.Location = new System.Drawing.Point(14, 4); this.linkLabelPoweredBy.Name = "linkLabelPoweredBy"; this.linkLabelPoweredBy.Size = new System.Drawing.Size(73, 13); this.linkLabelPoweredBy.TabIndex = 109; @@ -144,126 +146,6 @@ this.linkLabelPoweredBy.Text = "Powered by X"; this.linkLabelPoweredBy.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelPoweredBy_LinkClicked); // - // nikseComboBoxEngine - // - this.nikseComboBoxEngine.BackColor = System.Drawing.SystemColors.Window; - this.nikseComboBoxEngine.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.nikseComboBoxEngine.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.nikseComboBoxEngine.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.nikseComboBoxEngine.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.nikseComboBoxEngine.ButtonForeColorDown = System.Drawing.Color.Orange; - this.nikseComboBoxEngine.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseComboBoxEngine.DropDownHeight = 400; - this.nikseComboBoxEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.nikseComboBoxEngine.DropDownWidth = 221; - this.nikseComboBoxEngine.FormattingEnabled = true; - this.nikseComboBoxEngine.Location = new System.Drawing.Point(12, 24); - this.nikseComboBoxEngine.MaxLength = 32767; - this.nikseComboBoxEngine.Name = "nikseComboBoxEngine"; - this.nikseComboBoxEngine.SelectedIndex = -1; - this.nikseComboBoxEngine.SelectedItem = null; - this.nikseComboBoxEngine.SelectedText = ""; - this.nikseComboBoxEngine.Size = new System.Drawing.Size(221, 21); - this.nikseComboBoxEngine.TabIndex = 107; - this.nikseComboBoxEngine.UsePopupWindow = false; - this.nikseComboBoxEngine.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxEngine_SelectedIndexChanged); - // - // nikseComboBoxUrl - // - this.nikseComboBoxUrl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.nikseComboBoxUrl.BackColor = System.Drawing.SystemColors.Window; - this.nikseComboBoxUrl.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.nikseComboBoxUrl.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.nikseComboBoxUrl.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.nikseComboBoxUrl.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.nikseComboBoxUrl.ButtonForeColorDown = System.Drawing.Color.Orange; - this.nikseComboBoxUrl.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseComboBoxUrl.DropDownHeight = 400; - this.nikseComboBoxUrl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; - this.nikseComboBoxUrl.DropDownWidth = 280; - this.nikseComboBoxUrl.FormattingEnabled = true; - this.nikseComboBoxUrl.Location = new System.Drawing.Point(56, 528); - this.nikseComboBoxUrl.MaxLength = 32767; - this.nikseComboBoxUrl.Name = "nikseComboBoxUrl"; - this.nikseComboBoxUrl.SelectedIndex = -1; - this.nikseComboBoxUrl.SelectedItem = null; - this.nikseComboBoxUrl.SelectedText = ""; - this.nikseComboBoxUrl.Size = new System.Drawing.Size(280, 21); - this.nikseComboBoxUrl.TabIndex = 105; - this.nikseComboBoxUrl.TabStop = false; - this.nikseComboBoxUrl.UsePopupWindow = false; - this.nikseComboBoxUrl.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxUrl_SelectedIndexChanged); - // - // comboBoxSource - // - this.comboBoxSource.BackColor = System.Drawing.SystemColors.Window; - this.comboBoxSource.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.comboBoxSource.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.comboBoxSource.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.comboBoxSource.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.comboBoxSource.ButtonForeColorDown = System.Drawing.Color.Orange; - this.comboBoxSource.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.comboBoxSource.DropDownHeight = 400; - this.comboBoxSource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxSource.DropDownWidth = 140; - this.comboBoxSource.FormattingEnabled = true; - this.comboBoxSource.Location = new System.Drawing.Point(321, 25); - this.comboBoxSource.MaxLength = 32767; - this.comboBoxSource.Name = "comboBoxSource"; - this.comboBoxSource.SelectedIndex = -1; - this.comboBoxSource.SelectedItem = null; - this.comboBoxSource.SelectedText = ""; - this.comboBoxSource.Size = new System.Drawing.Size(121, 21); - this.comboBoxSource.TabIndex = 94; - this.comboBoxSource.UsePopupWindow = false; - // - // comboBoxTarget - // - this.comboBoxTarget.BackColor = System.Drawing.SystemColors.Window; - this.comboBoxTarget.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.comboBoxTarget.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.comboBoxTarget.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.comboBoxTarget.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.comboBoxTarget.ButtonForeColorDown = System.Drawing.Color.Orange; - this.comboBoxTarget.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.comboBoxTarget.DropDownHeight = 400; - this.comboBoxTarget.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxTarget.DropDownWidth = 140; - this.comboBoxTarget.FormattingEnabled = true; - this.comboBoxTarget.Location = new System.Drawing.Point(491, 25); - this.comboBoxTarget.MaxLength = 32767; - this.comboBoxTarget.Name = "comboBoxTarget"; - this.comboBoxTarget.SelectedIndex = -1; - this.comboBoxTarget.SelectedItem = null; - this.comboBoxTarget.SelectedText = ""; - this.comboBoxTarget.Size = new System.Drawing.Size(121, 21); - this.comboBoxTarget.TabIndex = 95; - this.comboBoxTarget.UsePopupWindow = false; - // - // subtitleListViewTarget - // - this.subtitleListViewTarget.AllowColumnReorder = true; - this.subtitleListViewTarget.ContextMenuStrip = this.contextMenuStrip2; - this.subtitleListViewTarget.FirstVisibleIndex = -1; - this.subtitleListViewTarget.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.subtitleListViewTarget.FullRowSelect = true; - this.subtitleListViewTarget.GridLines = true; - this.subtitleListViewTarget.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.subtitleListViewTarget.HideSelection = false; - this.subtitleListViewTarget.Location = new System.Drawing.Point(465, 53); - this.subtitleListViewTarget.Name = "subtitleListViewTarget"; - this.subtitleListViewTarget.OwnerDraw = true; - this.subtitleListViewTarget.Size = new System.Drawing.Size(428, 458); - this.subtitleListViewTarget.SubtitleFontBold = false; - this.subtitleListViewTarget.SubtitleFontName = "Tahoma"; - this.subtitleListViewTarget.SubtitleFontSize = 8; - this.subtitleListViewTarget.TabIndex = 98; - this.subtitleListViewTarget.UseCompatibleStateImageBehavior = false; - this.subtitleListViewTarget.UseSyntaxColoring = true; - this.subtitleListViewTarget.View = System.Windows.Forms.View.Details; - this.subtitleListViewTarget.Click += new System.EventHandler(this.subtitleListViewTarget_Click); - this.subtitleListViewTarget.DoubleClick += new System.EventHandler(this.subtitleListViewTarget_DoubleClick); - // // contextMenuStrip2 // this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -295,27 +177,6 @@ this.toolStripMenuItemStartNLLBApi.Text = "Start NLLB API server"; this.toolStripMenuItemStartNLLBApi.Click += new System.EventHandler(this.StartNllbApiServerToolStripMenuItem_Click); // - // subtitleListViewSource - // - this.subtitleListViewSource.AllowColumnReorder = true; - this.subtitleListViewSource.FirstVisibleIndex = -1; - this.subtitleListViewSource.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.subtitleListViewSource.FullRowSelect = true; - this.subtitleListViewSource.GridLines = true; - this.subtitleListViewSource.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.subtitleListViewSource.HideSelection = false; - this.subtitleListViewSource.Location = new System.Drawing.Point(12, 53); - this.subtitleListViewSource.Name = "subtitleListViewSource"; - this.subtitleListViewSource.OwnerDraw = true; - this.subtitleListViewSource.Size = new System.Drawing.Size(430, 458); - this.subtitleListViewSource.SubtitleFontBold = false; - this.subtitleListViewSource.SubtitleFontName = "Tahoma"; - this.subtitleListViewSource.SubtitleFontSize = 8; - this.subtitleListViewSource.TabIndex = 97; - this.subtitleListViewSource.UseCompatibleStateImageBehavior = false; - this.subtitleListViewSource.UseSyntaxColoring = true; - this.subtitleListViewSource.View = System.Windows.Forms.View.Details; - // // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -347,12 +208,174 @@ this.startNLLBAPIServerToolStripMenuItem.Text = "Start NLLB API server"; this.startNLLBAPIServerToolStripMenuItem.Click += new System.EventHandler(this.StartNllbApiServerToolStripMenuItem_Click); // + // nikseTextBoxApiKey + // + this.nikseTextBoxApiKey.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.nikseTextBoxApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseTextBoxApiKey.Location = new System.Drawing.Point(409, 532); + this.nikseTextBoxApiKey.Name = "nikseTextBoxApiKey"; + this.nikseTextBoxApiKey.Size = new System.Drawing.Size(360, 20); + this.nikseTextBoxApiKey.TabIndex = 110; + // + // nikseComboBoxEngine + // + this.nikseComboBoxEngine.BackColor = System.Drawing.SystemColors.Window; + this.nikseComboBoxEngine.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseComboBoxEngine.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseComboBoxEngine.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseComboBoxEngine.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseComboBoxEngine.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseComboBoxEngine.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseComboBoxEngine.DropDownHeight = 400; + this.nikseComboBoxEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.nikseComboBoxEngine.DropDownWidth = 221; + this.nikseComboBoxEngine.FormattingEnabled = true; + this.nikseComboBoxEngine.Location = new System.Drawing.Point(12, 24); + this.nikseComboBoxEngine.MaxLength = 32767; + this.nikseComboBoxEngine.Name = "nikseComboBoxEngine"; + this.nikseComboBoxEngine.SelectedIndex = -1; + this.nikseComboBoxEngine.SelectedItem = null; + this.nikseComboBoxEngine.SelectedText = ""; + this.nikseComboBoxEngine.Size = new System.Drawing.Size(221, 23); + this.nikseComboBoxEngine.TabIndex = 107; + this.nikseComboBoxEngine.UsePopupWindow = false; + this.nikseComboBoxEngine.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxEngine_SelectedIndexChanged); + // + // nikseComboBoxUrl + // + this.nikseComboBoxUrl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.nikseComboBoxUrl.BackColor = System.Drawing.SystemColors.Window; + this.nikseComboBoxUrl.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseComboBoxUrl.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseComboBoxUrl.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseComboBoxUrl.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseComboBoxUrl.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseComboBoxUrl.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseComboBoxUrl.DropDownHeight = 400; + this.nikseComboBoxUrl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; + this.nikseComboBoxUrl.DropDownWidth = 280; + this.nikseComboBoxUrl.FormattingEnabled = true; + this.nikseComboBoxUrl.Location = new System.Drawing.Point(56, 528); + this.nikseComboBoxUrl.MaxLength = 32767; + this.nikseComboBoxUrl.Name = "nikseComboBoxUrl"; + this.nikseComboBoxUrl.SelectedIndex = -1; + this.nikseComboBoxUrl.SelectedItem = null; + this.nikseComboBoxUrl.SelectedText = ""; + this.nikseComboBoxUrl.Size = new System.Drawing.Size(280, 23); + this.nikseComboBoxUrl.TabIndex = 105; + this.nikseComboBoxUrl.TabStop = false; + this.nikseComboBoxUrl.UsePopupWindow = false; + this.nikseComboBoxUrl.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxUrl_SelectedIndexChanged); + // + // comboBoxSource + // + this.comboBoxSource.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxSource.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.comboBoxSource.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.comboBoxSource.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.comboBoxSource.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.comboBoxSource.ButtonForeColorDown = System.Drawing.Color.Orange; + this.comboBoxSource.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.comboBoxSource.DropDownHeight = 400; + this.comboBoxSource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxSource.DropDownWidth = 140; + this.comboBoxSource.FormattingEnabled = true; + this.comboBoxSource.Location = new System.Drawing.Point(321, 25); + this.comboBoxSource.MaxLength = 32767; + this.comboBoxSource.Name = "comboBoxSource"; + this.comboBoxSource.SelectedIndex = -1; + this.comboBoxSource.SelectedItem = null; + this.comboBoxSource.SelectedText = ""; + this.comboBoxSource.Size = new System.Drawing.Size(121, 23); + this.comboBoxSource.TabIndex = 94; + this.comboBoxSource.UsePopupWindow = false; + // + // comboBoxTarget + // + this.comboBoxTarget.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxTarget.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.comboBoxTarget.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.comboBoxTarget.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.comboBoxTarget.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.comboBoxTarget.ButtonForeColorDown = System.Drawing.Color.Orange; + this.comboBoxTarget.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.comboBoxTarget.DropDownHeight = 400; + this.comboBoxTarget.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxTarget.DropDownWidth = 140; + this.comboBoxTarget.FormattingEnabled = true; + this.comboBoxTarget.Location = new System.Drawing.Point(491, 25); + this.comboBoxTarget.MaxLength = 32767; + this.comboBoxTarget.Name = "comboBoxTarget"; + this.comboBoxTarget.SelectedIndex = -1; + this.comboBoxTarget.SelectedItem = null; + this.comboBoxTarget.SelectedText = ""; + this.comboBoxTarget.Size = new System.Drawing.Size(121, 23); + this.comboBoxTarget.TabIndex = 95; + this.comboBoxTarget.UsePopupWindow = false; + // + // subtitleListViewTarget + // + this.subtitleListViewTarget.AllowColumnReorder = true; + this.subtitleListViewTarget.ContextMenuStrip = this.contextMenuStrip2; + this.subtitleListViewTarget.FirstVisibleIndex = -1; + this.subtitleListViewTarget.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.subtitleListViewTarget.FullRowSelect = true; + this.subtitleListViewTarget.GridLines = true; + this.subtitleListViewTarget.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.subtitleListViewTarget.HideSelection = false; + this.subtitleListViewTarget.Location = new System.Drawing.Point(465, 53); + this.subtitleListViewTarget.Name = "subtitleListViewTarget"; + this.subtitleListViewTarget.OwnerDraw = true; + this.subtitleListViewTarget.Size = new System.Drawing.Size(428, 458); + this.subtitleListViewTarget.SubtitleFontBold = false; + this.subtitleListViewTarget.SubtitleFontName = "Tahoma"; + this.subtitleListViewTarget.SubtitleFontSize = 8; + this.subtitleListViewTarget.TabIndex = 98; + this.subtitleListViewTarget.UseCompatibleStateImageBehavior = false; + this.subtitleListViewTarget.UseSyntaxColoring = true; + this.subtitleListViewTarget.View = System.Windows.Forms.View.Details; + this.subtitleListViewTarget.Click += new System.EventHandler(this.subtitleListViewTarget_Click); + this.subtitleListViewTarget.DoubleClick += new System.EventHandler(this.subtitleListViewTarget_DoubleClick); + // + // subtitleListViewSource + // + this.subtitleListViewSource.AllowColumnReorder = true; + this.subtitleListViewSource.FirstVisibleIndex = -1; + this.subtitleListViewSource.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.subtitleListViewSource.FullRowSelect = true; + this.subtitleListViewSource.GridLines = true; + this.subtitleListViewSource.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.subtitleListViewSource.HideSelection = false; + this.subtitleListViewSource.Location = new System.Drawing.Point(12, 53); + this.subtitleListViewSource.Name = "subtitleListViewSource"; + this.subtitleListViewSource.OwnerDraw = true; + this.subtitleListViewSource.Size = new System.Drawing.Size(430, 458); + this.subtitleListViewSource.SubtitleFontBold = false; + this.subtitleListViewSource.SubtitleFontName = "Tahoma"; + this.subtitleListViewSource.SubtitleFontSize = 8; + this.subtitleListViewSource.TabIndex = 97; + this.subtitleListViewSource.UseCompatibleStateImageBehavior = false; + this.subtitleListViewSource.UseSyntaxColoring = true; + this.subtitleListViewSource.View = System.Windows.Forms.View.Details; + // + // labelApiKey + // + this.labelApiKey.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.labelApiKey.AutoSize = true; + this.labelApiKey.Location = new System.Drawing.Point(360, 533); + this.labelApiKey.Name = "labelApiKey"; + this.labelApiKey.Size = new System.Drawing.Size(47, 13); + this.labelApiKey.TabIndex = 111; + this.labelApiKey.Text = "API key:"; + // // AutoTranslate // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1058, 563); this.ContextMenuStrip = this.contextMenuStrip1; + this.Controls.Add(this.labelApiKey); + this.Controls.Add(this.nikseTextBoxApiKey); this.Controls.Add(this.linkLabelPoweredBy); this.Controls.Add(this.nikseComboBoxEngine); this.Controls.Add(this.labelUrl); @@ -411,5 +434,7 @@ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemStartLibre; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemStartNLLBServe; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemStartNLLBApi; + private Controls.NikseTextBox nikseTextBoxApiKey; + private System.Windows.Forms.Label labelApiKey; } } \ No newline at end of file diff --git a/src/ui/Forms/Translate/AutoTranslate.cs b/src/ui/Forms/Translate/AutoTranslate.cs index 1cc732948..60bc5cff0 100644 --- a/src/ui/Forms/Translate/AutoTranslate.cs +++ b/src/ui/Forms/Translate/AutoTranslate.cs @@ -38,6 +38,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate buttonOK.Text = LanguageSettings.Current.General.Ok; buttonCancel.Text = LanguageSettings.Current.General.Cancel; labelUrl.Text = LanguageSettings.Current.Main.Url; + labelApiKey.Text = LanguageSettings.Current.Settings.GoogleTranslateApiKey; nikseComboBoxUrl.Left = labelUrl.Right + 5; startLibreTranslateServerToolStripMenuItem.Text = string.Format(LanguageSettings.Current.GoogleTranslate.StartWebServerX, new LibreTranslate().Name); startNLLBServeServerToolStripMenuItem.Text = string.Format(LanguageSettings.Current.GoogleTranslate.StartWebServerX, new NoLanguageLeftBehindServe().Name); @@ -104,6 +105,9 @@ namespace Nikse.SubtitleEdit.Forms.Translate _autoTranslatorEngines = new List { new GoogleTranslateV1(), + new GoogleTranslateV2(), + new MicrosoftTranslator(), + new DeepLTranslate(), new LibreTranslate(), new NoLanguageLeftBehindServe(), new NoLanguageLeftBehindApi(), @@ -111,12 +115,6 @@ namespace Nikse.SubtitleEdit.Forms.Translate //new SeamlessM4TTranslate(), }; - if (!string.IsNullOrEmpty(Configuration.Settings.Tools.MicrosoftTranslatorApiKey) && - !string.IsNullOrEmpty(Configuration.Settings.Tools.MicrosoftTranslatorTokenEndpoint)) - { - _autoTranslatorEngines.Insert(1, new MicrosoftTranslator()); - } - nikseComboBoxEngine.Items.Clear(); nikseComboBoxEngine.Items.AddRange(_autoTranslatorEngines.Select(p => p.Name).ToArray()); @@ -146,19 +144,45 @@ namespace Nikse.SubtitleEdit.Forms.Translate { _autoTranslator = GetCurrentEngine(); linkLabelPoweredBy.Text = string.Format(LanguageSettings.Current.GoogleTranslate.PoweredByX, _autoTranslator.Name); + nikseTextBoxApiKey.Visible = false; + labelUrl.Visible = false; + labelApiKey.Visible = false; + nikseComboBoxUrl.Visible = false; + nikseTextBoxApiKey.Top = nikseComboBoxUrl.Top; var engineType = _autoTranslator.GetType(); if (engineType == typeof(GoogleTranslateV1)) { - labelUrl.Visible = false; - nikseComboBoxUrl.Visible = false; + return; + } + + if (engineType == typeof(GoogleTranslateV2)) + { + labelApiKey.Left = labelUrl.Left; + nikseTextBoxApiKey.Text = Configuration.Settings.Tools.GoogleApiV2Key; + nikseTextBoxApiKey.Left = labelApiKey.Right + 3; + labelApiKey.Visible = true; + nikseTextBoxApiKey.Visible = true; return; } if (engineType == typeof(MicrosoftTranslator)) { - labelUrl.Visible = false; - nikseComboBoxUrl.Visible = false; + labelApiKey.Left = labelUrl.Left; + nikseTextBoxApiKey.Text = Configuration.Settings.Tools.MicrosoftTranslatorApiKey; + nikseTextBoxApiKey.Left = labelApiKey.Right + 3; + labelApiKey.Visible = true; + nikseTextBoxApiKey.Visible = true; + return; + } + + if (engineType == typeof(DeepLTranslate)) + { + labelApiKey.Left = labelUrl.Left; + nikseTextBoxApiKey.Text = Configuration.Settings.Tools.AutoTranslateDeepLApiKey; + nikseTextBoxApiKey.Left = labelApiKey.Right + 3; + labelApiKey.Visible = true; + nikseTextBoxApiKey.Visible = true; return; } @@ -182,6 +206,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate "http://localhost:7860/api/v2/", "https://winstxnhdw-nllb-api.hf.space/api/v2/", }); + return; } @@ -201,15 +226,17 @@ namespace Nikse.SubtitleEdit.Forms.Translate if (engineType == typeof(MyMemoryApi)) { - labelUrl.Visible = false; - nikseComboBoxUrl.Visible = false; + labelApiKey.Left = labelUrl.Left; + nikseTextBoxApiKey.Text = Configuration.Settings.Tools.AutoTranslateMyMemoryApiKey; + nikseTextBoxApiKey.Left = labelApiKey.Right + 3; + labelApiKey.Visible = true; + nikseTextBoxApiKey.Visible = true; + return; } if (engineType == typeof(SeamlessM4TTranslate)) { - labelUrl.Visible = false; - nikseComboBoxUrl.Visible = false; return; } @@ -227,6 +254,8 @@ namespace Nikse.SubtitleEdit.Forms.Translate } } + labelUrl.Text = LanguageSettings.Current.Main.Url; + nikseComboBoxUrl.Left = labelUrl.Right + 3; nikseComboBoxUrl.SelectedIndex = 0; nikseComboBoxUrl.Visible = true; labelUrl.Visible = true; @@ -252,7 +281,20 @@ namespace Nikse.SubtitleEdit.Forms.Translate if (engineType == typeof(LibreTranslate)) { Configuration.Settings.Tools.AutoTranslateLibreUrl = url; - return; + + if (url.Contains("https://libretranslate.com", StringComparison.OrdinalIgnoreCase)) + { + labelApiKey.Left = nikseComboBoxUrl.Right + 9; + nikseTextBoxApiKey.Left = labelApiKey.Right + 3; + nikseTextBoxApiKey.Text = Configuration.Settings.Tools.AutoTranslateLibreApiKey; + labelApiKey.Visible = true; + nikseTextBoxApiKey.Visible = true; + } + else + { + labelApiKey.Visible = false; + nikseTextBoxApiKey.Visible = false; + } } } @@ -454,6 +496,33 @@ namespace Nikse.SubtitleEdit.Forms.Translate _autoTranslator = GetCurrentEngine(); var engineType = _autoTranslator.GetType(); + if (nikseTextBoxApiKey.Visible && string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text) && engineType != typeof(MyMemoryApi)) + { + MessageBox.Show(this, string.Format("{0} requires an API key", _autoTranslator.Name), Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + nikseTextBoxApiKey.Focus(); + return; + } + + if (engineType == typeof(MicrosoftTranslator) && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.MicrosoftTranslatorApiKey = nikseTextBoxApiKey.Text.Trim(); + } + + if (engineType == typeof(DeepLTranslate) && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.AutoTranslateDeepLApiKey = nikseTextBoxApiKey.Text.Trim(); + } + + if (engineType == typeof(LibreTranslate) && nikseTextBoxApiKey.Visible && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.AutoTranslateLibreApiKey = nikseTextBoxApiKey.Text.Trim(); + } + + if (engineType == typeof(MyMemoryApi) && nikseTextBoxApiKey.Visible && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.AutoTranslateMyMemoryApiKey = nikseTextBoxApiKey.Text.Trim(); + } + buttonOK.Enabled = false; buttonCancel.Enabled = false; _breakTranslation = false; @@ -1012,6 +1081,32 @@ namespace Nikse.SubtitleEdit.Forms.Translate private void buttonOK_Click(object sender, EventArgs e) { + var engineType = GetCurrentEngine().GetType(); + if (engineType == typeof(GoogleTranslateV2) && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.GoogleApiV2Key = nikseTextBoxApiKey.Text.Trim(); + } + + if (engineType == typeof(MicrosoftTranslator) && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.MicrosoftTranslatorApiKey = nikseTextBoxApiKey.Text.Trim(); + } + + if (engineType == typeof(DeepLTranslate) && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.AutoTranslateDeepLApiKey = nikseTextBoxApiKey.Text.Trim(); + } + + if (engineType == typeof(LibreTranslate) && nikseTextBoxApiKey.Visible && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.AutoTranslateLibreApiKey = nikseTextBoxApiKey.Text.Trim(); + } + + if (engineType == typeof(MyMemoryApi) && nikseTextBoxApiKey.Visible && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.AutoTranslateMyMemoryApiKey = nikseTextBoxApiKey.Text.Trim(); + } + var isEmpty = TranslatedSubtitle == null || TranslatedSubtitle.Paragraphs.All(p => string.IsNullOrEmpty(p.Text)); DialogResult = isEmpty ? DialogResult.Cancel : DialogResult.OK; } diff --git a/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs b/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs index 08f961ca5..3246aca26 100644 --- a/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs +++ b/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs @@ -61,6 +61,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert AssaChangeRes, SortBy, BeautifyTimeCodes, + AutoTranslate, } internal static void ConvertOrReturn(string productIdentifier, string[] commandLineArguments)