Add new shortcut "Go to next line and play"

This commit is contained in:
Nikolaj Olsson 2020-06-07 19:15:08 +02:00
parent 1b6557f646
commit 0d9bdb7ae6
8 changed files with 35 additions and 0 deletions

View File

@ -2035,6 +2035,7 @@ can edit in same subtitle file (collaboration)</Information>
<GoToCurrentSubtitleEnd>Go to current line end</GoToCurrentSubtitleEnd>
<GoToPreviousSubtitleAndFocusVideo>Go to previous line and set video position</GoToPreviousSubtitleAndFocusVideo>
<GoToNextSubtitleAndFocusVideo>Go to next line and set video position</GoToNextSubtitleAndFocusVideo>
<GoToNextSubtitleAndPlay>Go to next line and play</GoToNextSubtitleAndPlay>
<ToggleFocus>Toggle focus between list view and subtitle text box</ToggleFocus>
<ToggleDialogDashes>Toggle dialog dashes</ToggleDialogDashes>
<ToggleMusicSymbols>Toggle music symbols</ToggleMusicSymbols>

View File

@ -2329,6 +2329,7 @@ can edit in same subtitle file (collaboration)",
GoToCurrentSubtitleEnd = "Go to current line end",
GoToPreviousSubtitleAndFocusVideo = "Go to previous line and set video position",
GoToNextSubtitleAndFocusVideo = "Go to next line and set video position",
GoToNextSubtitleAndPlay = "Go to next line and play",
ToggleFocus = "Toggle focus between list view and subtitle text box",
ToggleDialogDashes = "Toggle dialog dashes",
ToggleMusicSymbols = "Toggle music symbols",

View File

@ -5527,6 +5527,9 @@ namespace Nikse.SubtitleEdit.Core
case "Settings/GoToNextSubtitleAndFocusVideo":
language.Settings.GoToNextSubtitleAndFocusVideo = reader.Value;
break;
case "Settings/GoToNextSubtitleAndPlay":
language.Settings.GoToNextSubtitleAndPlay = reader.Value;
break;
case "Settings/ToggleFocus":
language.Settings.ToggleFocus = reader.Value;
break;

View File

@ -2200,6 +2200,7 @@
public string GoToCurrentSubtitleEnd { get; set; }
public string GoToPreviousSubtitleAndFocusVideo { get; set; }
public string GoToNextSubtitleAndFocusVideo { get; set; }
public string GoToNextSubtitleAndPlay { get; set; }
public string ToggleFocus { get; set; }
public string ToggleDialogDashes { get; set; }
public string ToggleMusicSymbols { get; set; }

View File

@ -1494,6 +1494,7 @@ $HorzAlign = Center
public string GeneralGoToEndOfCurrentSubtitle { get; set; }
public string GeneralGoToPreviousSubtitleAndFocusVideo { get; set; }
public string GeneralGoToNextSubtitleAndFocusVideo { get; set; }
public string GeneralGoToNextSubtitleAndPlay { get; set; }
public string GeneralExtendCurrentSubtitle { get; set; }
public string GeneralAutoCalcCurrentDuration { get; set; }
public string GeneralPlayFirstSelected { get; set; }
@ -5525,6 +5526,12 @@ $HorzAlign = Center
settings.Shortcuts.GeneralGoToNextSubtitleAndFocusVideo = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralGoToNextSubtitleAndPlay");
if (subNode != null)
{
settings.Shortcuts.GeneralGoToNextSubtitleAndPlay = subNode.InnerText;
}
subNode = node.SelectSingleNode("GeneralGoToPreviousSubtitleAndFocusVideo");
if (subNode != null)
{
@ -7587,6 +7594,7 @@ $HorzAlign = Center
textWriter.WriteElementString("GeneralGoToStartOfCurrentSubtitle", settings.Shortcuts.GeneralGoToStartOfCurrentSubtitle);
textWriter.WriteElementString("GeneralGoToPreviousSubtitleAndFocusVideo", settings.Shortcuts.GeneralGoToPreviousSubtitleAndFocusVideo);
textWriter.WriteElementString("GeneralGoToNextSubtitleAndFocusVideo", settings.Shortcuts.GeneralGoToNextSubtitleAndFocusVideo);
textWriter.WriteElementString("GeneralGoToNextSubtitleAndPlay", settings.Shortcuts.GeneralGoToNextSubtitleAndPlay);
textWriter.WriteElementString("GeneralExtendCurrentSubtitle", settings.Shortcuts.GeneralExtendCurrentSubtitle);
textWriter.WriteElementString("GeneralAutoCalcCurrentDuration", settings.Shortcuts.GeneralAutoCalcCurrentDuration);
textWriter.WriteElementString("GeneralPlayFirstSelected", settings.Shortcuts.GeneralPlayFirstSelected);

View File

@ -13754,6 +13754,22 @@ namespace Nikse.SubtitleEdit.Forms
e.SuppressKeyPress = true;
}
}
else if (_shortcuts.MainGoToNextSubtitleAndPlay == e.KeyData)
{
int newIndex = _subtitleListViewIndex + 1;
if (newIndex < _subtitle.Paragraphs.Count)
{
_subtitleListViewIndex = -1;
SubtitleListview1.SelectIndexAndEnsureVisibleFaster(newIndex);
_subtitleListViewIndex = newIndex;
textBoxListViewText.Focus();
textBoxListViewText.SelectAll();
GotoSubtitleIndex(newIndex);
ShowSubtitle();
mediaPlayer?.Play();
e.SuppressKeyPress = true;
}
}
else if (_shortcuts.MainUnbreakNoSpace == e.KeyData)
{
Unbreak(true);

View File

@ -943,6 +943,7 @@ namespace Nikse.SubtitleEdit.Forms
if (File.Exists(guessPath))
{
textBoxFFmpegPath.Text = guessPath;
checkBoxUseFFmpeg.Checked = true;
}
}
@ -1109,6 +1110,7 @@ namespace Nikse.SubtitleEdit.Forms
AddNode(generalNode, language.GoToCurrentSubtitleEnd, nameof(Configuration.Settings.Shortcuts.GeneralGoToEndOfCurrentSubtitle));
AddNode(generalNode, language.GoToPreviousSubtitleAndFocusVideo, nameof(Configuration.Settings.Shortcuts.GeneralGoToPreviousSubtitleAndFocusVideo));
AddNode(generalNode, language.GoToNextSubtitleAndFocusVideo, nameof(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndFocusVideo));
AddNode(generalNode, language.GoToNextSubtitleAndPlay, nameof(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndPlay));
AddNode(generalNode, language.Help, nameof(Configuration.Settings.Shortcuts.GeneralHelp));
AddNode(generalNode, language.UnbreakNoSpace, nameof(Configuration.Settings.Shortcuts.GeneralUnbrekNoSpace));
AddNode(generalNode, language.ToggleBookmarks, nameof(Configuration.Settings.Shortcuts.GeneralToggleBookmarks));
@ -3306,6 +3308,7 @@ namespace Nikse.SubtitleEdit.Forms
if (result == DialogResult.Yes)
{
Configuration.Settings.Reset();
Configuration.Settings.General.VideoPlayer = "MPV";
Init();
}
}

View File

@ -55,6 +55,7 @@ namespace Nikse.SubtitleEdit.Logic
public Keys MainVideoReset { get; set; }
public Keys MainGoToPreviousSubtitleAndFocusVideo { get; set; }
public Keys MainGoToNextSubtitleAndFocusVideo { get; set; }
public Keys MainGoToNextSubtitleAndPlay { get; set; }
public Keys MainAdjustExtendCurrentSubtitle { get; set; }
public Keys MainAutoCalcCurrentDuration { get; set; }
public Keys MainUnbreakNoSpace { get; set; }
@ -206,6 +207,7 @@ 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);
MainGoToNextSubtitleAndPlay = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndPlay);
MainAdjustExtendCurrentSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralExtendCurrentSubtitle);
MainAutoCalcCurrentDuration = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralAutoCalcCurrentDuration);
MainUnbreakNoSpace = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralUnbrekNoSpace);