Add two new shortcuts for go to next/prev and focus waveform - thx cyzs233 :)

Fix #5884
This commit is contained in:
niksedk 2022-07-19 13:06:29 +02:00
parent b82f341698
commit 493e1f74f6
8 changed files with 64 additions and 0 deletions

View File

@ -2385,6 +2385,8 @@ can edit in same subtitle file (collaboration)</Information>
<GoToNextSubtitleAndFocusVideo>Go to next line and set video position</GoToNextSubtitleAndFocusVideo>
<GoToPrevSubtitleAndPlay>Go to previous line and play</GoToPrevSubtitleAndPlay>
<GoToNextSubtitleAndPlay>Go to next line and play</GoToNextSubtitleAndPlay>
<GoToPreviousSubtitleAndFocusWaveform>Go to previous line and focus waveform</GoToPreviousSubtitleAndFocusWaveform>
<GoToNextSubtitleAndFocusWaveform>Go to next line and focus waveform</GoToNextSubtitleAndFocusWaveform>
<ToggleFocus>Toggle focus between list view and subtitle text box</ToggleFocus>
<ToggleFocusWaveform>Toggle focus between list view and waveform/spectrogram</ToggleFocusWaveform>
<ToggleFocusWaveformTextBox>Toggle focus between text box and waveform/spectrogram</ToggleFocusWaveformTextBox>

View File

@ -2154,6 +2154,8 @@ $HorzAlign = Center
public string GeneralGoToEndOfCurrentSubtitle { get; set; }
public string GeneralGoToPreviousSubtitleAndFocusVideo { get; set; }
public string GeneralGoToNextSubtitleAndFocusVideo { get; set; }
public string GeneralGoToPreviousSubtitleAndFocusWaveform { get; set; }
public string GeneralGoToNextSubtitleAndFocusWaveform { get; set; }
public string GeneralGoToPrevSubtitleAndPlay { get; set; }
public string GeneralGoToNextSubtitleAndPlay { get; set; }
public string GeneralToggleBookmarks { get; set; }
@ -7741,6 +7743,18 @@ $HorzAlign = Center
shortcuts.GeneralGoToPreviousSubtitleAndFocusVideo = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralGoToPreviousSubtitleAndFocusWaveform");
if (subNode != null)
{
shortcuts.GeneralGoToPreviousSubtitleAndFocusWaveform = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralGoToNextSubtitleAndFocusWaveform");
if (subNode != null)
{
shortcuts.GeneralGoToNextSubtitleAndFocusWaveform = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralAutoCalcCurrentDuration");
if (subNode != null)
{
@ -10535,6 +10549,8 @@ $HorzAlign = Center
textWriter.WriteElementString("GeneralGoToStartOfCurrentSubtitle", shortcuts.GeneralGoToStartOfCurrentSubtitle);
textWriter.WriteElementString("GeneralGoToPreviousSubtitleAndFocusVideo", shortcuts.GeneralGoToPreviousSubtitleAndFocusVideo);
textWriter.WriteElementString("GeneralGoToNextSubtitleAndFocusVideo", shortcuts.GeneralGoToNextSubtitleAndFocusVideo);
textWriter.WriteElementString("GeneralGoToPreviousSubtitleAndFocusWaveform", shortcuts.GeneralGoToPreviousSubtitleAndFocusWaveform);
textWriter.WriteElementString("GeneralGoToNextSubtitleAndFocusWaveform", shortcuts.GeneralGoToNextSubtitleAndFocusWaveform);
textWriter.WriteElementString("GeneralGoToPrevSubtitleAndPlay", shortcuts.GeneralGoToPrevSubtitleAndPlay);
textWriter.WriteElementString("GeneralGoToNextSubtitleAndPlay", shortcuts.GeneralGoToNextSubtitleAndPlay);
textWriter.WriteElementString("GeneralAutoCalcCurrentDuration", shortcuts.GeneralAutoCalcCurrentDuration);

View File

@ -16148,6 +16148,36 @@ namespace Nikse.SubtitleEdit.Forms
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGoToPreviousSubtitleAndFocusWaveform == e.KeyData)
{
int newIndex = _subtitleListViewIndex - 1;
if (newIndex >= 0)
{
_subtitleListViewIndex = -1;
SelectListViewIndexAndEnsureVisible(newIndex);
_subtitleListViewIndex = newIndex;
audioVisualizer.Focus();
GotoSubtitleIndex(newIndex);
ShowSubtitle();
}
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGoToNextSubtitleAndFocusWaveform == e.KeyData)
{
int newIndex = _subtitleListViewIndex + 1;
if (newIndex < _subtitle.Paragraphs.Count)
{
_subtitleListViewIndex = -1;
SelectListViewIndexAndEnsureVisible(newIndex);
_subtitleListViewIndex = newIndex;
audioVisualizer.Focus();
GotoSubtitleIndex(newIndex);
ShowSubtitle();
}
e.SuppressKeyPress = true;
}
else if (_shortcuts.MainGoToNextSubtitleAndPlay == e.KeyData && mediaPlayer != null)
{
int newIndex = _subtitleListViewIndex + 1;

View File

@ -1285,6 +1285,8 @@ namespace Nikse.SubtitleEdit.Forms.Options
AddNode(generalNode, language.GoToNextSubtitleAndFocusVideo, nameof(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndFocusVideo));
AddNode(generalNode, language.GoToPrevSubtitleAndPlay, nameof(Configuration.Settings.Shortcuts.GeneralGoToPrevSubtitleAndPlay));
AddNode(generalNode, language.GoToNextSubtitleAndPlay, nameof(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndPlay));
AddNode(generalNode, language.GoToPreviousSubtitleAndFocusWaveform, nameof(Configuration.Settings.Shortcuts.GeneralGoToPreviousSubtitleAndFocusWaveform));
AddNode(generalNode, language.GoToNextSubtitleAndFocusWaveform, nameof(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndFocusWaveform));
AddNode(generalNode, language.ToggleBookmarks, nameof(Configuration.Settings.Shortcuts.GeneralToggleBookmarks));
AddNode(generalNode, language.ToggleBookmarksWithComment, nameof(Configuration.Settings.Shortcuts.GeneralToggleBookmarksWithText), true);
AddNode(generalNode, LanguageSettings.Current.Bookmarks.EditBookmark, nameof(Configuration.Settings.Shortcuts.GeneralEditBookmarks), true);

View File

@ -2715,6 +2715,8 @@ can edit in same subtitle file (collaboration)",
GoToNextSubtitleAndFocusVideo = "Go to next line and set video position",
GoToPrevSubtitleAndPlay = "Go to previous line and play",
GoToNextSubtitleAndPlay = "Go to next line and play",
GoToPreviousSubtitleAndFocusWaveform = "Go to previous line and focus waveform",
GoToNextSubtitleAndFocusWaveform = "Go to next line and focus waveform",
ToggleFocus = "Toggle focus between list view and subtitle text box",
ToggleFocusWaveform = "Toggle focus between list view and waveform/spectrogram",
ToggleFocusWaveformTextBox = "Toggle focus between text box and waveform/spectrogram",

View File

@ -6526,6 +6526,12 @@ namespace Nikse.SubtitleEdit.Logic
case "Settings/GoToNextSubtitleAndPlay":
language.Settings.GoToNextSubtitleAndPlay = reader.Value;
break;
case "Settings/GoToPreviousSubtitleAndFocusWaveform":
language.Settings.GoToPreviousSubtitleAndFocusWaveform = reader.Value;
break;
case "Settings/GoToNextSubtitleAndFocusWaveform":
language.Settings.GoToNextSubtitleAndFocusWaveform = reader.Value;
break;
case "Settings/ToggleFocus":
language.Settings.ToggleFocus = reader.Value;
break;

View File

@ -2568,6 +2568,8 @@
public string GoToNextSubtitleAndFocusVideo { get; set; }
public string GoToPrevSubtitleAndPlay { get; set; }
public string GoToNextSubtitleAndPlay { get; set; }
public string GoToPreviousSubtitleAndFocusWaveform { get; set; }
public string GoToNextSubtitleAndFocusWaveform { get; set; }
public string ToggleFocus { get; set; }
public string ToggleFocusWaveform { get; set; }
public string ToggleFocusWaveformTextBox { get; set; }

View File

@ -76,6 +76,8 @@ namespace Nikse.SubtitleEdit.Logic
public Keys MainVideoToggleContrast { get; set; }
public Keys MainGoToPreviousSubtitleAndFocusVideo { get; set; }
public Keys MainGoToNextSubtitleAndFocusVideo { get; set; }
public Keys MainGoToPreviousSubtitleAndFocusWaveform { get; set; }
public Keys MainGoToNextSubtitleAndFocusWaveform { get; set; }
public Keys MainGoToPrevSubtitleAndPlay { get; set; }
public Keys MainGoToNextSubtitleAndPlay { get; set; }
public Keys MainAutoCalcCurrentDuration { get; set; }
@ -296,6 +298,8 @@ namespace Nikse.SubtitleEdit.Logic
VideoPlayFirstSelected = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralPlayFirstSelected);
MainGoToPreviousSubtitleAndFocusVideo = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToPreviousSubtitleAndFocusVideo);
MainGoToNextSubtitleAndFocusVideo = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndFocusVideo);
MainGoToPreviousSubtitleAndFocusWaveform = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToPreviousSubtitleAndFocusWaveform);
MainGoToNextSubtitleAndFocusWaveform = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndFocusWaveform);
MainGoToPrevSubtitleAndPlay = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToPrevSubtitleAndPlay);
MainGoToNextSubtitleAndPlay = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndPlay);
MainAutoCalcCurrentDuration = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralAutoCalcCurrentDuration);