From d8ab2e3386b84d58cb1a033e8656c74e098560ae Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Fri, 8 May 2020 11:45:50 +0200 Subject: [PATCH] Make Google Translate shortcut customizable - thx darnn :) Fix #3706 --- libse/Settings.cs | 7 +++++++ src/Forms/Main.cs | 7 ++----- src/Forms/Settings.cs | 2 +- src/Forms/SettingsGapChoose.cs | 1 + src/Logic/MainShortcuts.cs | 2 -- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libse/Settings.cs b/libse/Settings.cs index 7321f3192..12081f6f0 100644 --- a/libse/Settings.cs +++ b/libse/Settings.cs @@ -1785,6 +1785,7 @@ $HorzAlign = Center Waveform100MsRight = "Shift+Right"; Waveform1000MsLeft = "Left"; Waveform1000MsRight = "Right"; + MainTranslateGoogleTranslate = "Control+Shift+G"; MainAdjustExtendToNextSceneChange = string.Empty; MainAdjustExtendToPreviousSceneChange = string.Empty; MainAdjustExtendToNextSubtitle = "Control+Shift+E"; @@ -1979,6 +1980,12 @@ $HorzAlign = Center settings.Shortcuts.MainVideoGoToStartCurrent = "Shift+F11"; } } + else if (settings.Version.StartsWith("3.5.15", StringComparison.Ordinal) || + settings.Version.StartsWith("3.5.14", StringComparison.Ordinal) || + settings.Version.StartsWith("3.5.13", StringComparison.Ordinal)) + { + settings.Shortcuts.MainTranslateGoogleTranslate = "Control+Shift+G"; + } } catch (Exception exception) { diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index a6915af32..0d1a18b6d 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -14806,11 +14806,6 @@ namespace Nikse.SubtitleEdit.Forms e.SuppressKeyPress = true; buttonGoogleIt_Click(null, null); } - else if (_shortcuts.MainTranslateGoogleTranslate == e.KeyData) - { - e.SuppressKeyPress = true; - buttonGoogleTranslateIt_Click(null, null); - } else if (_shortcuts.MainTranslateCustomSearch1 == e.KeyData) { e.SuppressKeyPress = true; @@ -20061,6 +20056,8 @@ namespace Nikse.SubtitleEdit.Forms findDoubleWordsToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainSpellCheckFindDoubleWords); addWordToNameListToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainSpellCheckAddWordToNames); + translateByGoogleToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateGoogleTranslate); + toolStripMenuItemAdjustAllTimes.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainSynchronizationAdjustTimes); visualSyncToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainSynchronizationVisualSync); toolStripMenuItemPointSync.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainSynchronizationPointSync); diff --git a/src/Forms/Settings.cs b/src/Forms/Settings.cs index 24383236c..8d4b9400a 100644 --- a/src/Forms/Settings.cs +++ b/src/Forms/Settings.cs @@ -1299,7 +1299,7 @@ namespace Nikse.SubtitleEdit.Forms var translateNode = new ShortcutNode(Configuration.Settings.Language.Main.VideoControls.Translate); AddNode(translateNode, Configuration.Settings.Language.Main.VideoControls.GoogleIt, nameof(Configuration.Settings.Shortcuts.MainTranslateGoogleIt)); - AddNode(translateNode, Configuration.Settings.Language.Main.VideoControls.GoogleTranslate, nameof(Configuration.Settings.Shortcuts.MainTranslateGoogleTranslate)); + AddNode(translateNode, Configuration.Settings.Language.Main.VideoControls.GoogleTranslate, nameof(Configuration.Settings.Shortcuts.MainTranslateGoogleTranslate), true); AddNode(translateNode, language.CustomSearch1, nameof(Configuration.Settings.Shortcuts.MainTranslateCustomSearch1)); AddNode(translateNode, language.CustomSearch2, nameof(Configuration.Settings.Shortcuts.MainTranslateCustomSearch2)); AddNode(translateNode, language.CustomSearch3, nameof(Configuration.Settings.Shortcuts.MainTranslateCustomSearch3)); diff --git a/src/Forms/SettingsGapChoose.cs b/src/Forms/SettingsGapChoose.cs index ddfb15c94..4b6a5b323 100644 --- a/src/Forms/SettingsGapChoose.cs +++ b/src/Forms/SettingsGapChoose.cs @@ -36,6 +36,7 @@ namespace Nikse.SubtitleEdit.Forms buttonCancel.Text = Configuration.Settings.Language.General.Cancel; UiUtil.FixLargeFonts(this, buttonOK); + labelUseCalc.Font = new System.Drawing.Font(labelCalcInfo.Font.Name, labelCalcInfo.Font.Size, System.Drawing.FontStyle.Bold); CalcMilliseconds(); } diff --git a/src/Logic/MainShortcuts.cs b/src/Logic/MainShortcuts.cs index b41f98324..64ffbc3cf 100644 --- a/src/Logic/MainShortcuts.cs +++ b/src/Logic/MainShortcuts.cs @@ -153,7 +153,6 @@ namespace Nikse.SubtitleEdit.Logic public Keys WaveformToggleSceneChange { get; set; } public Keys WaveformGuessStart { get; set; } public Keys MainTranslateGoogleIt { get; set; } - public Keys MainTranslateGoogleTranslate { get; set; } public Keys MainTranslateCustomSearch1 { get; set; } public Keys MainTranslateCustomSearch2 { get; set; } public Keys MainTranslateCustomSearch3 { get; set; } @@ -310,7 +309,6 @@ namespace Nikse.SubtitleEdit.Logic WaveformToggleSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformToggleSceneChange); WaveformGuessStart = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGuessStart); MainTranslateGoogleIt = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateGoogleIt); - MainTranslateGoogleTranslate = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateGoogleTranslate); MainTranslateCustomSearch1 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch1); MainTranslateCustomSearch2 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch2); MainTranslateCustomSearch3 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch3);