Add shortcuts for layouts

Related to #7482
This commit is contained in:
niksedk 2023-10-20 10:17:39 +02:00
parent 5662382449
commit f2a6196656
6 changed files with 194 additions and 0 deletions

View File

@ -2343,6 +2343,18 @@ $HorzAlign = Center
public string GeneralSwitchOriginalAndTranslation { get; set; }
public string GeneralSwitchOriginalAndTranslationTextBoxes { get; set; }
public string GeneralLayoutChoose { get; set; }
public string GeneralLayoutChoose1 { get; set; }
public string GeneralLayoutChoose2 { get; set; }
public string GeneralLayoutChoose3 { get; set; }
public string GeneralLayoutChoose4 { get; set; }
public string GeneralLayoutChoose5 { get; set; }
public string GeneralLayoutChoose6 { get; set; }
public string GeneralLayoutChoose7 { get; set; }
public string GeneralLayoutChoose8 { get; set; }
public string GeneralLayoutChoose9 { get; set; }
public string GeneralLayoutChoose10 { get; set; }
public string GeneralLayoutChoose11 { get; set; }
public string GeneralLayoutChoose12 { get; set; }
public string GeneralPlayFirstSelected { get; set; }
public string GeneralGoToFirstSelectedLine { get; set; }
public string GeneralGoToNextEmptyLine { get; set; }
@ -8975,6 +8987,78 @@ $HorzAlign = Center
shortcuts.GeneralLayoutChoose = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose1");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose1 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose2");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose2 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose3");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose3 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose4");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose4 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose5");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose5 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose6");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose6 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose7");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose7 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose8");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose8 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose9");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose9 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose10");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose10 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose11");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose11 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralLayoutChoose12");
if (subNode != null)
{
shortcuts.GeneralLayoutChoose12 = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralMergeOriginalAndTranslation");
if (subNode != null)
{
@ -12251,6 +12335,18 @@ $HorzAlign = Center
textWriter.WriteElementString("GeneralSwitchOriginalAndTranslation", shortcuts.GeneralSwitchOriginalAndTranslation);
textWriter.WriteElementString("GeneralSwitchOriginalAndTranslationTextBoxes", shortcuts.GeneralSwitchOriginalAndTranslationTextBoxes);
textWriter.WriteElementString("GeneralLayoutChoose", shortcuts.GeneralLayoutChoose);
textWriter.WriteElementString("GeneralLayoutChoose1", shortcuts.GeneralLayoutChoose1);
textWriter.WriteElementString("GeneralLayoutChoose2", shortcuts.GeneralLayoutChoose2);
textWriter.WriteElementString("GeneralLayoutChoose3", shortcuts.GeneralLayoutChoose3);
textWriter.WriteElementString("GeneralLayoutChoose4", shortcuts.GeneralLayoutChoose4);
textWriter.WriteElementString("GeneralLayoutChoose5", shortcuts.GeneralLayoutChoose5);
textWriter.WriteElementString("GeneralLayoutChoose6", shortcuts.GeneralLayoutChoose6);
textWriter.WriteElementString("GeneralLayoutChoose7", shortcuts.GeneralLayoutChoose7);
textWriter.WriteElementString("GeneralLayoutChoose8", shortcuts.GeneralLayoutChoose8);
textWriter.WriteElementString("GeneralLayoutChoose9", shortcuts.GeneralLayoutChoose9);
textWriter.WriteElementString("GeneralLayoutChoose10", shortcuts.GeneralLayoutChoose10);
textWriter.WriteElementString("GeneralLayoutChoose11", shortcuts.GeneralLayoutChoose11);
textWriter.WriteElementString("GeneralLayoutChoose12", shortcuts.GeneralLayoutChoose12);
textWriter.WriteElementString("GeneralMergeOriginalAndTranslation", shortcuts.GeneralMergeOriginalAndTranslation);
textWriter.WriteElementString("GeneralGoToNextSubtitle", shortcuts.GeneralGoToNextSubtitle);
textWriter.WriteElementString("GeneralGoToNextSubtitlePlayTranslate", shortcuts.GeneralGoToNextSubtitlePlayTranslate);

View File

@ -17755,6 +17755,66 @@ namespace Nikse.SubtitleEdit.Forms
TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(25), () => ToolStripButtonLayoutChooseClick(null, null));
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose1 == e.KeyData)
{
SetLayout(0);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose2 == e.KeyData)
{
SetLayout(1);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose3 == e.KeyData)
{
SetLayout(2);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose4 == e.KeyData)
{
SetLayout(3);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose5 == e.KeyData)
{
SetLayout(4);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose6 == e.KeyData)
{
SetLayout(5);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose7 == e.KeyData)
{
SetLayout(6);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose8 == e.KeyData)
{
SetLayout(7);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose9 == e.KeyData)
{
SetLayout(8);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose10 == e.KeyData)
{
SetLayout(9);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose11 == e.KeyData)
{
SetLayout(10);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralLayoutChoose12 == e.KeyData)
{
SetLayout(11);
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGeneralMergeTranslationAndOriginal == e.KeyData) // Merge translation and original
{
if (_subtitleOriginal != null && _subtitleOriginal.Paragraphs.Count > 0 && _networkSession == null)

View File

@ -1487,6 +1487,18 @@ namespace Nikse.SubtitleEdit.Forms.Options
AddNode(generalNode, language.SwitchOriginalAndTranslation, nameof(Configuration.Settings.Shortcuts.GeneralSwitchOriginalAndTranslation));
AddNode(generalNode, language.SwitchOriginalAndTranslationTextBoxes, nameof(Configuration.Settings.Shortcuts.GeneralSwitchOriginalAndTranslationTextBoxes));
AddNode(generalNode, LanguageSettings.Current.Main.ChooseLayout, nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 1), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose1));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 2), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose2));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 3), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose3));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 4), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose4));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 5), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose5));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 6), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose6));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 7), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose7));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 8), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose8));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 9), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose9));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 10), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose10));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 11), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose11));
AddNode(generalNode, string.Format(language.ChooseLayoutX, 12), nameof(Configuration.Settings.Shortcuts.GeneralLayoutChoose12));
AddNode(generalNode, language.WaveformPlayFirstSelectedSubtitle, nameof(Configuration.Settings.Shortcuts.GeneralPlayFirstSelected));
AddNode(generalNode, language.GoToFirstSelectedLine, nameof(Configuration.Settings.Shortcuts.GeneralGoToFirstSelectedLine));
AddNode(generalNode, language.GoToNextEmptyLine, nameof(Configuration.Settings.Shortcuts.GeneralGoToNextEmptyLine));

View File

@ -3006,6 +3006,7 @@ can edit in same subtitle file (collaboration)",
WaveformSeekSilenceBack = "Seek silence back",
WaveformAddTextHere = "Add text here (for new selection)",
WaveformAddTextHereFromClipboard = "Add text here (for new selection from clipboard)",
ChooseLayoutX = "Choose layout {0}",
SetParagraphAsSelection = "Set current as new selection",
WaveformPlayNewSelection = "Play selection",
WaveformPlayNewSelectionEnd = "Play end of selection",

View File

@ -2822,6 +2822,7 @@
public string WaveformSeekSilenceForward { get; set; }
public string WaveformSeekSilenceBack { get; set; }
public string WaveformAddTextHere { get; set; }
public string ChooseLayoutX { get; set; }
public string WaveformAddTextHereFromClipboard { get; set; }
public string SetParagraphAsSelection { get; set; }
public string WaveformPlayNewSelection { get; set; }

View File

@ -19,6 +19,18 @@ namespace Nikse.SubtitleEdit.Logic
public Keys MainGeneralSwitchTranslationAndOriginal { get; set; }
public Keys MainGeneralSwitchTranslationAndOriginalTextBoxes { get; set; }
public Keys MainGeneralLayoutChoose { get; set; }
public Keys MainGeneralLayoutChoose1 { get; set; }
public Keys MainGeneralLayoutChoose2 { get; set; }
public Keys MainGeneralLayoutChoose3 { get; set; }
public Keys MainGeneralLayoutChoose4 { get; set; }
public Keys MainGeneralLayoutChoose5 { get; set; }
public Keys MainGeneralLayoutChoose6 { get; set; }
public Keys MainGeneralLayoutChoose7 { get; set; }
public Keys MainGeneralLayoutChoose8 { get; set; }
public Keys MainGeneralLayoutChoose9 { get; set; }
public Keys MainGeneralLayoutChoose10 { get; set; }
public Keys MainGeneralLayoutChoose11 { get; set; }
public Keys MainGeneralLayoutChoose12 { get; set; }
public Keys MainGeneralMergeTranslationAndOriginal { get; set; }
public Keys MainGeneralMergeWithNext { get; set; }
public Keys MainGeneralMergeWithPrevious { get; set; }
@ -280,6 +292,18 @@ namespace Nikse.SubtitleEdit.Logic
MainGeneralSwitchTranslationAndOriginal = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralSwitchOriginalAndTranslation);
MainGeneralSwitchTranslationAndOriginalTextBoxes = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralSwitchOriginalAndTranslationTextBoxes);
MainGeneralLayoutChoose = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose);
MainGeneralLayoutChoose1 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose1);
MainGeneralLayoutChoose2 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose2);
MainGeneralLayoutChoose3 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose3);
MainGeneralLayoutChoose4 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose4);
MainGeneralLayoutChoose5 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose5);
MainGeneralLayoutChoose6 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose6);
MainGeneralLayoutChoose7 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose7);
MainGeneralLayoutChoose8 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose8);
MainGeneralLayoutChoose9 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose9);
MainGeneralLayoutChoose10 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose10);
MainGeneralLayoutChoose11 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose11);
MainGeneralLayoutChoose12 = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralLayoutChoose12);
MainGeneralMergeTranslationAndOriginal = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeOriginalAndTranslation);
MainGeneralMergeWithNext = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeWithNext);
MainGeneralMergeWithPrevious = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeWithPrevious);