Add more merge and unbreak shortcuts - thx Leon :)

Work on  #5399
This commit is contained in:
niksedk 2021-10-22 13:57:46 +02:00
parent d837890c4f
commit fb54be3c5b
6 changed files with 56 additions and 2 deletions

View File

@ -1963,6 +1963,8 @@ $HorzAlign = Center
public string GeneralMergeSelectedLinesBilingual { get; set; }
public string GeneralMergeWithNext { get; set; }
public string GeneralMergeWithPrevious { get; set; }
public string GeneralMergeWithPreviousAndUnbreak { get; set; }
public string GeneralMergeWithNextAndUnbreak { get; set; }
public string GeneralToggleTranslationMode { get; set; }
public string GeneralSwitchOriginalAndTranslation { get; set; }
public string GeneralMergeOriginalAndTranslation { get; set; }
@ -6944,6 +6946,18 @@ $HorzAlign = Center
shortcuts.GeneralMergeWithPrevious = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralMergeWithPreviousAndUnbreak");
if (subNode != null)
{
shortcuts.GeneralMergeWithPreviousAndUnbreak = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralMergeWithNextAndUnbreak");
if (subNode != null)
{
shortcuts.GeneralMergeWithNextAndUnbreak = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralToggleTranslationMode");
if (subNode != null)
{
@ -9486,6 +9500,8 @@ $HorzAlign = Center
textWriter.WriteElementString("GeneralMergeSelectedLinesBilingual", shortcuts.GeneralMergeSelectedLinesBilingual);
textWriter.WriteElementString("GeneralMergeWithNext", shortcuts.GeneralMergeWithNext);
textWriter.WriteElementString("GeneralMergeWithPrevious", shortcuts.GeneralMergeWithPrevious);
textWriter.WriteElementString("GeneralMergeWithPreviousAndUnbreak", shortcuts.GeneralMergeWithPreviousAndUnbreak);
textWriter.WriteElementString("GeneralMergeWithNextAndUnbreak", shortcuts.GeneralMergeWithNextAndUnbreak);
textWriter.WriteElementString("GeneralToggleTranslationMode", shortcuts.GeneralToggleTranslationMode);
textWriter.WriteElementString("GeneralSwitchOriginalAndTranslation", shortcuts.GeneralSwitchOriginalAndTranslation);
textWriter.WriteElementString("GeneralMergeOriginalAndTranslation", shortcuts.GeneralMergeOriginalAndTranslation);

View File

@ -15763,6 +15763,34 @@ namespace Nikse.SubtitleEdit.Forms
}
}
}
else if (_shortcuts.MainGeneralMergeWithNextAndUnbreak == e.KeyData)
{
if (SubtitleListview1.SelectedItems.Count >= 1)
{
var idx = SubtitleListview1.SelectedItems[0].Index;
if (idx >= 0 && _subtitle.Paragraphs.Count > idx + 1)
{
SubtitleListview1.SelectIndexAndEnsureVisible(idx, true);
MergeAfterToolStripMenuItemClick(null, null);
ButtonUnBreakClick(null, null);
e.SuppressKeyPress = true;
}
}
}
else if (_shortcuts.MainGeneralMergeWithPreviousAndUnbreak == e.KeyData)
{
if (SubtitleListview1.SelectedItems.Count >= 1)
{
var idx = SubtitleListview1.SelectedItems[0].Index;
if (idx > 0)
{
SubtitleListview1.SelectIndexAndEnsureVisible(idx - 1, true);
MergeAfterToolStripMenuItemClick(null, null);
ButtonUnBreakClick(null, null);
e.SuppressKeyPress = true;
}
}
}
else if (_shortcuts.MainGeneralToggleTranslationMode == e.KeyData)
{ // toggle translator mode
EditToolStripMenuItemDropDownOpening(null, null);
@ -26554,7 +26582,7 @@ namespace Nikse.SubtitleEdit.Forms
UpdateOriginalTimeCodes(oldParagraph, oldNextParagraph);
SubtitleListview1.SelectIndexAndEnsureVisible(index + 1, true);
SubtitleListview1.SetStartTimeAndDuration(index, _subtitle.GetParagraphOrDefault(index-1), _subtitle.GetParagraphOrDefault(index - 2), _subtitle.GetParagraphOrDefault(index));
SubtitleListview1.SetStartTimeAndDuration(index, _subtitle.GetParagraphOrDefault(index - 1), _subtitle.GetParagraphOrDefault(index - 2), _subtitle.GetParagraphOrDefault(index));
SubtitleListview1.SetStartTimeAndDuration(index, _subtitle.GetParagraphOrDefault(index), _subtitle.GetParagraphOrDefault(index - 1), _subtitle.GetParagraphOrDefault(index + 1));
RefreshSelectedParagraph();
ShowStatus(string.Format(_language.VideoControls.AdjustedViaEndTime, p.StartTime.ToShortString()));

View File

@ -1246,6 +1246,8 @@ namespace Nikse.SubtitleEdit.Forms.Options
AddNode(generalNode, language.MergeSelectedLines, nameof(Configuration.Settings.Shortcuts.GeneralMergeSelectedLines));
AddNode(generalNode, language.MergeWithPrevious, nameof(Configuration.Settings.Shortcuts.GeneralMergeWithPrevious));
AddNode(generalNode, language.MergeWithNext, nameof(Configuration.Settings.Shortcuts.GeneralMergeWithNext));
AddNode(generalNode, language.MergeWithPreviousAndUnbreak, nameof(Configuration.Settings.Shortcuts.GeneralMergeWithPreviousAndUnbreak));
AddNode(generalNode, language.MergeWithNextAndUnbreak, nameof(Configuration.Settings.Shortcuts.GeneralMergeWithNextAndUnbreak));
AddNode(generalNode, language.MergeSelectedLinesAndAutoBreak, nameof(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesAndAutoBreak));
AddNode(generalNode, language.MergeSelectedLinesAndUnbreak, nameof(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesAndUnbreak));
AddNode(generalNode, language.MergeSelectedLinesAndUnbreakCjk, nameof(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesAndUnbreakCjk));

View File

@ -2753,6 +2753,8 @@ can edit in same subtitle file (collaboration)",
MergeOriginalAndTranslation = "Merge original and translation",
MergeWithNext = "Merge with next",
MergeWithPrevious = "Merge with previous",
MergeWithNextAndUnbreak = "Merge with next and unbreak",
MergeWithPreviousAndUnbreak = "Merge with previous and unbreak",
ShortcutIsAlreadyDefinedX = "Shortcut already defined: {0}",
ToggleTranslationAndOriginalInPreviews = "Toggle translation and original in video/audio preview",
ListViewColumnDelete = "Column, delete text",

View File

@ -2609,6 +2609,8 @@
public string SwitchOriginalAndTranslation { get; set; }
public string MergeOriginalAndTranslation { get; set; }
public string MergeWithNext { get; set; }
public string MergeWithPreviousAndUnbreak { get; set; }
public string MergeWithNextAndUnbreak { get; set; }
public string MergeWithPrevious { get; set; }
public string ShortcutIsAlreadyDefinedX { get; set; }
public string ToggleTranslationAndOriginalInPreviews { get; set; }

View File

@ -18,6 +18,8 @@ namespace Nikse.SubtitleEdit.Logic
public Keys MainGeneralMergeTranslationAndOriginal { get; set; }
public Keys MainGeneralMergeWithNext { get; set; }
public Keys MainGeneralMergeWithPrevious { get; set; }
public Keys MainGeneralMergeWithNextAndUnbreak { get; set; }
public Keys MainGeneralMergeWithPreviousAndUnbreak { get; set; }
public Keys MainGeneralGoToNextSubtitle { get; set; }
public Keys MainGeneralGoToNextSubtitlePlayTranslate { get; set; }
public Keys MainGeneralGoToNextSubtitleCursorAtEnd { get; set; }
@ -225,6 +227,8 @@ namespace Nikse.SubtitleEdit.Logic
MainGeneralMergeTranslationAndOriginal = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeOriginalAndTranslation);
MainGeneralMergeWithNext = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeWithNext);
MainGeneralMergeWithPrevious = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeWithPrevious);
MainGeneralMergeWithPreviousAndUnbreak = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeWithPreviousAndUnbreak);
MainGeneralMergeWithNextAndUnbreak = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeWithNextAndUnbreak);
MainGeneralGoToNextSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitle);
MainGeneralGoToNextSubtitlePlayTranslate = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitlePlayTranslate);
MainGeneralGoToNextSubtitleCursorAtEnd = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleCursorAtEnd);