Add move all shot changes shortcuts - thx acetilo :)

Work on  #8795
This commit is contained in:
Nikolaj Olsson 2024-09-09 18:17:51 +02:00
parent 89cdf24b60
commit d97cefd57b
9 changed files with 56 additions and 0 deletions

View File

@ -2692,6 +2692,8 @@ can edit in same subtitle file (collaboration)</Information>
<WaveformGoToPreviousShotChange>Go to previous shot change</WaveformGoToPreviousShotChange>
<WaveformGoToNextShotChange>Go to next shot change</WaveformGoToNextShotChange>
<WaveformToggleShotChange>Toggle shot change</WaveformToggleShotChange>
<WaveformAllShotChangesOneFrameForward>Move all shot changes one frame forward</WaveformAllShotChangesOneFrameForward>
<WaveformAllShotChangesOneFrameBack>Move all shot changes one frame back</WaveformAllShotChangesOneFrameBack>
<WaveformRemoveOrExportShotChanges>Remove/export shot changes</WaveformRemoveOrExportShotChanges>
<WaveformGuessStart>Auto adjust start via volume/shot change</WaveformGuessStart>
<GoBack1Frame>One frame back</GoBack1Frame>

View File

@ -8466,6 +8466,18 @@ namespace Nikse.SubtitleEdit.Core.Settings
shortcuts.WaveformToggleShotChange = subNode.InnerText;
}
subNode = node.SelectSingleNode("WaveformAllShotChangesOneFrameForward");
if (subNode != null)
{
shortcuts.WaveformAllShotChangesOneFrameForward = subNode.InnerText;
}
subNode = node.SelectSingleNode("WaveformAllShotChangesOneFrameBack");
if (subNode != null)
{
shortcuts.WaveformAllShotChangesOneFrameBack = subNode.InnerText;
}
subNode = node.SelectSingleNode("WaveformListShotChanges");
if (subNode != null)
{
@ -10222,6 +10234,8 @@ namespace Nikse.SubtitleEdit.Core.Settings
textWriter.WriteElementString("WaveformGoToPreviousShotChange", shortcuts.WaveformGoToPreviousShotChange);
textWriter.WriteElementString("WaveformGoToNextShotChange", shortcuts.WaveformGoToNextShotChange);
textWriter.WriteElementString("WaveformToggleShotChange", shortcuts.WaveformToggleShotChange);
textWriter.WriteElementString("WaveformAllShotChangesOneFrameForward", shortcuts.WaveformAllShotChangesOneFrameForward);
textWriter.WriteElementString("WaveformAllShotChangesOneFrameBack", shortcuts.WaveformAllShotChangesOneFrameBack);
textWriter.WriteElementString("WaveformListShotChanges", shortcuts.WaveformListShotChanges);
textWriter.WriteElementString("WaveformGuessStart", shortcuts.WaveformGuessStart);
textWriter.WriteElementString("Waveform100MsLeft", shortcuts.Waveform100MsLeft);

View File

@ -390,6 +390,8 @@ namespace Nikse.SubtitleEdit.Core.Settings
public string WaveformGoToPreviousShotChange { get; set; }
public string WaveformGoToNextShotChange { get; set; }
public string WaveformToggleShotChange { get; set; }
public string WaveformAllShotChangesOneFrameForward { get; set; }
public string WaveformAllShotChangesOneFrameBack { get; set; }
public string WaveformListShotChanges { get; set; }
public string WaveformGuessStart { get; set; }
public string Waveform100MsLeft { get; set; }

View File

@ -18568,6 +18568,28 @@ namespace Nikse.SubtitleEdit.Forms
e.SuppressKeyPress = true;
}
else if (audioVisualizer.ShotChanges != null && mediaPlayer.IsPaused && e.KeyData == _shortcuts.WaveformAllShotChangesOneFrameForward)
{
var frameMs = (double)Math.Round(1000.0 / CurrentFrameRate);
for (var i = 0; i < audioVisualizer.ShotChanges.Count; i++)
{
audioVisualizer.ShotChanges[i] += (frameMs / 1000.0);
}
ShotChangeHelper.SaveShotChanges(_videoFileName, audioVisualizer.ShotChanges);
e.SuppressKeyPress = true;
}
else if (audioVisualizer.ShotChanges != null && mediaPlayer.IsPaused && e.KeyData == _shortcuts.WaveformAllShotChangesOneFrameBack)
{
var frameMs = (double)Math.Round(1000.0 / CurrentFrameRate);
for (var i = 0; i < audioVisualizer.ShotChanges.Count; i++)
{
audioVisualizer.ShotChanges[i] -= (frameMs / 1000.0);
}
ShotChangeHelper.SaveShotChanges(_videoFileName, audioVisualizer.ShotChanges);
e.SuppressKeyPress = true;
}
else if (audioVisualizer.ShotChanges != null && mediaPlayer.IsPaused && e.KeyData == _shortcuts.WaveformGuessStart)
{
AutoGuessStartTime(_subtitleListViewIndex);

View File

@ -1927,6 +1927,8 @@ namespace Nikse.SubtitleEdit.Forms.Options
AddNode(audioVisualizerNode, LanguageSettings.Current.Main.VideoControls.InsertNewSubtitleAtVideoPosition, nameof(Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition));
AddNode(audioVisualizerNode, language.WaveformGoToPreviousShotChange, nameof(Configuration.Settings.Shortcuts.WaveformGoToPreviousShotChange));
AddNode(audioVisualizerNode, language.WaveformGoToNextShotChange, nameof(Configuration.Settings.Shortcuts.WaveformGoToNextShotChange));
AddNode(audioVisualizerNode, language.WaveformAllShotChangesOneFrameBack, nameof(Configuration.Settings.Shortcuts.WaveformAllShotChangesOneFrameBack));
AddNode(audioVisualizerNode, language.WaveformAllShotChangesOneFrameForward, nameof(Configuration.Settings.Shortcuts.WaveformAllShotChangesOneFrameForward));
AddNode(audioVisualizerNode, language.WaveformToggleShotChange, nameof(Configuration.Settings.Shortcuts.WaveformToggleShotChange));
AddNode(audioVisualizerNode, language.WaveformRemoveOrExportShotChanges, nameof(Configuration.Settings.Shortcuts.WaveformListShotChanges), true);
AddNode(audioVisualizerNode, language.WaveformGuessStart, nameof(Configuration.Settings.Shortcuts.WaveformGuessStart));

View File

@ -3062,6 +3062,8 @@ can edit in same subtitle file (collaboration)",
WaveformGoToPreviousShotChange = "Go to previous shot change",
WaveformGoToNextShotChange = "Go to next shot change",
WaveformToggleShotChange = "Toggle shot change",
WaveformAllShotChangesOneFrameForward = "Move all shot changes one frame forward",
WaveformAllShotChangesOneFrameBack = "Move all shot changes one frame back",
WaveformRemoveOrExportShotChanges = "Remove/export shot changes",
WaveformGuessStart = "Auto adjust start via volume/shot change",
GoBack1Frame = "One frame back",

View File

@ -7372,6 +7372,12 @@ namespace Nikse.SubtitleEdit.Logic
case "Settings/WaveformToggleShotChange":
language.Settings.WaveformToggleShotChange = reader.Value;
break;
case "Settings/WaveformAllShotChangesOneFrameForward":
language.Settings.WaveformAllShotChangesOneFrameForward = reader.Value;
break;
case "Settings/WaveformAllShotChangesOneFrameBack":
language.Settings.WaveformAllShotChangesOneFrameBack = reader.Value;
break;
case "Settings/WaveformRemoveOrExportShotChanges":
language.Settings.WaveformRemoveOrExportShotChanges = reader.Value;
break;

View File

@ -2870,6 +2870,8 @@
public string WaveformGoToPreviousShotChange { get; set; }
public string WaveformGoToNextShotChange { get; set; }
public string WaveformToggleShotChange { get; set; }
public string WaveformAllShotChangesOneFrameForward { get; set; }
public string WaveformAllShotChangesOneFrameBack { get; set; }
public string WaveformRemoveOrExportShotChanges { get; set; }
public string WaveformGuessStart { get; set; }
public string GoBack1Frame { get; set; }

View File

@ -270,6 +270,8 @@ namespace Nikse.SubtitleEdit.Logic
public Keys WaveformGoToPreviousShotChange { get; set; }
public Keys WaveformGoToNextShotChange { get; set; }
public Keys WaveformToggleShotChange { get; set; }
public Keys WaveformAllShotChangesOneFrameForward { get; set; }
public Keys WaveformAllShotChangesOneFrameBack { get; set; }
public Keys WaveformListShotChanges { get; set; }
public Keys WaveformGuessStart { get; set; }
public Keys WaveformAudioToTextVosk { get; set; }
@ -549,6 +551,8 @@ namespace Nikse.SubtitleEdit.Logic
WaveformSetParagraphAsNewSelection = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformSetParagraphAsSelection);
WaveformGoToPreviousShotChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGoToPreviousShotChange);
WaveformGoToNextShotChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGoToNextShotChange);
WaveformAllShotChangesOneFrameForward = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformAllShotChangesOneFrameForward);
WaveformAllShotChangesOneFrameBack = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformAllShotChangesOneFrameBack);
WaveformToggleShotChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformToggleShotChange);
WaveformListShotChanges = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformListShotChanges);
WaveformGuessStart = UiUtil.GetKeys(Configuration.Settings.Shortcuts.WaveformGuessStart);