Added waveform shortcut for go to next sub - thx GeorgeM :)

This commit is contained in:
Nikolaj Olsson 2017-05-02 04:37:06 +02:00
parent bd732f1579
commit 0e82b68f8f
7 changed files with 33 additions and 1 deletions

View File

@ -1736,7 +1736,7 @@ can edit in same subtitle file (collaboration)</Information>
<AutoBackupEveryMinute>Every minute</AutoBackupEveryMinute>
<AutoBackupEveryFiveMinutes>Every 5th minute</AutoBackupEveryFiveMinutes>
<AutoBackupEveryFifteenMinutes>Every 15th minute</AutoBackupEveryFifteenMinutes>
<AutoBackupDeleteAfter>Delete after</AutoBackupDeleteAfter>
<AutoBackupDeleteAfter>Delete backup after</AutoBackupDeleteAfter>
<AutoBackupDeleteAfterOneMonth>1 month</AutoBackupDeleteAfterOneMonth>
<AutoBackupDeleteAfterThreeMonths>3 months</AutoBackupDeleteAfterThreeMonths>
<AutoBackupDeleteAfterSixMonths>6 months</AutoBackupDeleteAfterSixMonths>
@ -1880,6 +1880,7 @@ can edit in same subtitle file (collaboration)</Information>
<WaveformPlayNewSelectionEnd>Play end of selection</WaveformPlayNewSelectionEnd>
<WaveformPlayFirstSelectedSubtitle>Play first selected subtitle</WaveformPlayFirstSelectedSubtitle>
<WaveformFocusListView>Focus list view</WaveformFocusListView>
<WaveformGoToNextSubtitle>Go to next subtitle (from video position)</WaveformGoToNextSubtitle>
<WaveformGoToNextSceneChange>Go to next scene change</WaveformGoToNextSceneChange>
<WaveformToggleSceneChange>Toggle scene change</WaveformToggleSceneChange>
<GoBack1Frame>One frame back</GoBack1Frame>

View File

@ -2163,6 +2163,7 @@ can edit in same subtitle file (collaboration)",
WaveformPlayNewSelectionEnd = "Play end of selection",
WaveformPlayFirstSelectedSubtitle = "Play first selected subtitle",
WaveformFocusListView = "Focus list view",
WaveformGoToNextSubtitle = "Go to next subtitle (from video position)",
WaveformGoToNextSceneChange = "Go to next scene change",
WaveformToggleSceneChange = "Toggle scene change",
GoBack1Frame = "One frame back",

View File

@ -5095,6 +5095,9 @@ namespace Nikse.SubtitleEdit.Core
case "Settings/WaveformFocusListView":
language.Settings.WaveformFocusListView = reader.Value;
break;
case "Settings/WaveformGoToNextSubtitle":
language.Settings.WaveformGoToNextSubtitle = reader.Value;
break;
case "Settings/WaveformGoToNextSceneChange":
language.Settings.WaveformGoToNextSceneChange = reader.Value;
break;

View File

@ -2045,6 +2045,7 @@
public string WaveformPlayNewSelectionEnd { get; set; }
public string WaveformPlayFirstSelectedSubtitle { get; set; }
public string WaveformFocusListView { get; set; }
public string WaveformGoToNextSubtitle { get; set; }
public string WaveformGoToNextSceneChange { get; set; }
public string WaveformToggleSceneChange { get; set; }
public string GoBack1Frame { get; set; }

View File

@ -1000,6 +1000,7 @@ namespace Nikse.SubtitleEdit.Core
public string WaveformAddTextHere { get; set; }
public string WaveformAddTextHereFromClipboard { get; set; }
public string WaveformFocusListView { get; set; }
public string WaveformGoToNextSubtitle { get; set; }
public string WaveformGoToNextSceneChange { get; set; }
public string WaveformToggleSceneChange { get; set; }
public string MainTranslateCustomSearch1 { get; set; }
@ -2993,6 +2994,9 @@ namespace Nikse.SubtitleEdit.Core
subNode = node.SelectSingleNode("WaveformFocusListView");
if (subNode != null)
settings.Shortcuts.WaveformFocusListView = subNode.InnerText;
subNode = node.SelectSingleNode("WaveformGoToNextSubtitle");
if (subNode != null)
settings.Shortcuts.WaveformGoToNextSubtitle = subNode.InnerText;
subNode = node.SelectSingleNode("WaveformGoToNextSceneChange");
if (subNode != null)
settings.Shortcuts.WaveformGoToNextSceneChange = subNode.InnerText;
@ -3695,6 +3699,7 @@ namespace Nikse.SubtitleEdit.Core
textWriter.WriteElementString("WaveformAddTextHere", settings.Shortcuts.WaveformAddTextHere);
textWriter.WriteElementString("WaveformAddTextHereFromClipboard", settings.Shortcuts.WaveformAddTextHereFromClipboard);
textWriter.WriteElementString("WaveformFocusListView", settings.Shortcuts.WaveformFocusListView);
textWriter.WriteElementString("WaveformGoToNextSubtitle", settings.Shortcuts.WaveformGoToNextSubtitle);
textWriter.WriteElementString("WaveformGoToNextSceneChange", settings.Shortcuts.WaveformGoToNextSceneChange);
textWriter.WriteElementString("WaveformToggleSceneChange", settings.Shortcuts.WaveformToggleSceneChange);
textWriter.WriteElementString("MainTranslateCustomSearch1", settings.Shortcuts.MainTranslateCustomSearch1);

View File

@ -207,6 +207,7 @@ namespace Nikse.SubtitleEdit.Forms
private Keys _waveformAddTextAtHere = Keys.None;
private Keys _waveformAddTextAtHereFromClipboard = Keys.None;
private Keys _waveformFocusListView = Keys.None;
private Keys _waveformGoToNextSubtitle = Keys.None;
private Keys _waveformGoToNextSceneChange = Keys.None;
private Keys _waveformToggleSceneChange = Keys.None;
private Keys _mainTranslateCustomSearch1 = Keys.None;
@ -11878,6 +11879,24 @@ namespace Nikse.SubtitleEdit.Forms
SubtitleListview1.Focus();
e.SuppressKeyPress = true;
}
else if (e.KeyData == _waveformGoToNextSubtitle)
{
var cp = mediaPlayer.CurrentPosition * TimeCode.BaseUnit;
foreach (var p in _subtitle.Paragraphs)
{
if (p.StartTime.TotalMilliseconds > cp)
{
mediaPlayer.CurrentPosition = p.StartTime.TotalSeconds;
SubtitleListview1.SelectIndexAndEnsureVisible(_subtitle.Paragraphs.IndexOf(p));
if (p.StartTime.TotalSeconds > audioVisualizer.EndPositionSeconds + 0.2)
{
audioVisualizer.StartPositionSeconds = mediaPlayer.CurrentPosition - 0.2;
}
break;
}
}
e.SuppressKeyPress = true;
}
else if (audioVisualizer.SceneChanges != null && e.KeyData == _waveformGoToNextSceneChange)
{
var cp = mediaPlayer.CurrentPosition + 0.01;
@ -15685,6 +15704,7 @@ namespace Nikse.SubtitleEdit.Forms
_waveformAddTextAtHere = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformAddTextHere);
_waveformAddTextAtHereFromClipboard = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformAddTextHereFromClipboard);
_waveformFocusListView = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformFocusListView);
_waveformGoToNextSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGoToNextSubtitle);
_waveformGoToNextSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange);
_waveformToggleSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformToggleSceneChange);

View File

@ -841,6 +841,7 @@ namespace Nikse.SubtitleEdit.Forms
AddNode(audioVisualizerNode, language.WaveformPlayNewSelectionEnd, nameof(Configuration.Settings.Shortcuts.WaveformPlaySelectionEnd));
AddNode(audioVisualizerNode, Configuration.Settings.Language.Main.VideoControls.InsertNewSubtitleAtVideoPosition, nameof(Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition));
AddNode(audioVisualizerNode, language.WaveformFocusListView, nameof(Configuration.Settings.Shortcuts.WaveformFocusListView));
AddNode(audioVisualizerNode, language.WaveformGoToNextSubtitle, nameof(Configuration.Settings.Shortcuts.WaveformGoToNextSubtitle));
AddNode(audioVisualizerNode, language.WaveformGoToNextSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange));
AddNode(audioVisualizerNode, language.WaveformToggleSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformToggleSceneChange));
treeViewShortcuts.Nodes.Add(audioVisualizerNode);