From bff037fc8a6b429a1d44af6083887656831ee64d Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Tue, 30 Apr 2024 16:43:18 +0200 Subject: [PATCH] Make auto-translate shortcut work in waveform - thx rRobis :) Fix #8280 --- src/ui/Forms/Main.cs | 11 ++++++++++- src/ui/Logic/MainShortcuts.cs | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index dc8307153..3aea5bc00 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -779,6 +779,15 @@ namespace Nikse.SubtitleEdit.Forms SetColor(ColorTranslator.ToHtml(Configuration.Settings.Tools.Color8)); e.SuppressKeyPress = true; } + else if (e.KeyData == _shortcuts.MainAutoTranslateSelectedLines) + { + e.SuppressKeyPress = true; + TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(1), () => + { + var onlySelectedLines = true; + MakeAutoTranslate(onlySelectedLines); + }); + } } private void InitializeWaveformZoomDropdown() @@ -23574,7 +23583,7 @@ namespace Nikse.SubtitleEdit.Forms private void SetAssaResolutionWithChecks() { - if (Configuration.Settings.SubtitleSettings.AssaResolutionAutoNew && + if (Configuration.Settings.SubtitleSettings.AssaResolutionAutoNew && string.IsNullOrEmpty(_subtitle?.Header) && IsAssa() && _videoInfo?.Height > 0) { diff --git a/src/ui/Logic/MainShortcuts.cs b/src/ui/Logic/MainShortcuts.cs index 810a9a602..eded5601d 100644 --- a/src/ui/Logic/MainShortcuts.cs +++ b/src/ui/Logic/MainShortcuts.cs @@ -194,6 +194,7 @@ namespace Nikse.SubtitleEdit.Logic public Keys MainInsertAfter { get; set; } public Keys MainInsertBefore { get; set; } public Keys MainTextBoxAutoBreak { get; set; } + public Keys MainAutoTranslateSelectedLines { get; set; } public Keys MainTextBoxRecord { get; set; } public Keys MainTextBoxUnbreak { get; set; } public Keys MainTextBoxUnbreakNoSpace { get; set; } @@ -513,6 +514,7 @@ namespace Nikse.SubtitleEdit.Logic MainInsertAfter = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainInsertAfter); MainInsertBefore = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainInsertBefore); MainTextBoxAutoBreak = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxAutoBreak); + MainAutoTranslateSelectedLines = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateAutoSelectedLines); MainTextBoxBreakAtCursorPosition = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxBreakAtPosition); MainTextBoxBreakAtCursorPositionAndGoToNext = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxBreakAtPositionAndGoToNext); MainTextBoxRecord = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxRecord);