Add extra move shortcuts to waveform - thx Shaddy :)

Arrow left = 1 sec left, arrow right = 1 sec right + 100ms shortcuts too
This commit is contained in:
Nikolaj Olsson 2020-05-06 20:35:29 +02:00
parent aca00fedd0
commit 1ef81526cf
4 changed files with 101 additions and 2 deletions

View File

@ -1660,6 +1660,10 @@ $HorzAlign = Center
public string WaveformGoToNextSceneChange { get; set; } public string WaveformGoToNextSceneChange { get; set; }
public string WaveformToggleSceneChange { get; set; } public string WaveformToggleSceneChange { get; set; }
public string WaveformGuessStart { get; set; } public string WaveformGuessStart { get; set; }
public string Waveform100MsLeft { get; set; }
public string Waveform100MsRight { get; set; }
public string Waveform1000MsLeft { get; set; }
public string Waveform1000MsRight { get; set; }
public string MainTranslateGoogleIt { get; set; } public string MainTranslateGoogleIt { get; set; }
public string MainTranslateGoogleTranslate { get; set; } public string MainTranslateGoogleTranslate { get; set; }
public string MainTranslateCustomSearch1 { get; set; } public string MainTranslateCustomSearch1 { get; set; }
@ -1777,6 +1781,10 @@ $HorzAlign = Center
WaveformSearchSilenceForward = string.Empty; WaveformSearchSilenceForward = string.Empty;
WaveformSearchSilenceBack = string.Empty; WaveformSearchSilenceBack = string.Empty;
WaveformAddTextHere = "Return"; WaveformAddTextHere = "Return";
Waveform100MsLeft = "Shift+Left";
Waveform100MsRight = "Shift+Right";
Waveform1000MsLeft = "Left";
Waveform1000MsRight = "Right";
MainAdjustExtendToNextSceneChange = string.Empty; MainAdjustExtendToNextSceneChange = string.Empty;
MainAdjustExtendToPreviousSceneChange = string.Empty; MainAdjustExtendToPreviousSceneChange = string.Empty;
MainAdjustExtendToNextSubtitle = "Control+Shift+E"; MainAdjustExtendToNextSubtitle = "Control+Shift+E";
@ -6568,6 +6576,30 @@ $HorzAlign = Center
settings.Shortcuts.WaveformGuessStart = subNode.InnerText; settings.Shortcuts.WaveformGuessStart = subNode.InnerText;
} }
subNode = node.SelectSingleNode("Waveform100MsLeft");
if (subNode != null)
{
settings.Shortcuts.Waveform100MsLeft = subNode.InnerText;
}
subNode = node.SelectSingleNode("Waveform100MsRight");
if (subNode != null)
{
settings.Shortcuts.Waveform100MsRight = subNode.InnerText;
}
subNode = node.SelectSingleNode("Waveform1000MsLeft");
if (subNode != null)
{
settings.Shortcuts.Waveform1000MsLeft = subNode.InnerText;
}
subNode = node.SelectSingleNode("Waveform1000MsRight");
if (subNode != null)
{
settings.Shortcuts.Waveform1000MsRight = subNode.InnerText;
}
subNode = node.SelectSingleNode("MainTranslateGoogleIt"); subNode = node.SelectSingleNode("MainTranslateGoogleIt");
if (subNode != null) if (subNode != null)
{ {
@ -7621,6 +7653,10 @@ $HorzAlign = Center
textWriter.WriteElementString("WaveformGoToNextSceneChange", settings.Shortcuts.WaveformGoToNextSceneChange); textWriter.WriteElementString("WaveformGoToNextSceneChange", settings.Shortcuts.WaveformGoToNextSceneChange);
textWriter.WriteElementString("WaveformToggleSceneChange", settings.Shortcuts.WaveformToggleSceneChange); textWriter.WriteElementString("WaveformToggleSceneChange", settings.Shortcuts.WaveformToggleSceneChange);
textWriter.WriteElementString("WaveformGuessStart", settings.Shortcuts.WaveformGuessStart); textWriter.WriteElementString("WaveformGuessStart", settings.Shortcuts.WaveformGuessStart);
textWriter.WriteElementString("Waveform100MsLeft", settings.Shortcuts.Waveform100MsLeft);
textWriter.WriteElementString("Waveform100MsRight", settings.Shortcuts.Waveform100MsRight);
textWriter.WriteElementString("Waveform1000MsLeft", settings.Shortcuts.Waveform1000MsLeft);
textWriter.WriteElementString("Waveform1000MsRight", settings.Shortcuts.Waveform1000MsRight);
textWriter.WriteElementString("MainTranslateGoogleIt", settings.Shortcuts.MainTranslateGoogleIt); textWriter.WriteElementString("MainTranslateGoogleIt", settings.Shortcuts.MainTranslateGoogleIt);
textWriter.WriteElementString("MainTranslateGoogleTranslate", settings.Shortcuts.MainTranslateGoogleTranslate); textWriter.WriteElementString("MainTranslateGoogleTranslate", settings.Shortcuts.MainTranslateGoogleTranslate);
textWriter.WriteElementString("MainTranslateCustomSearch1", settings.Shortcuts.MainTranslateCustomSearch1); textWriter.WriteElementString("MainTranslateCustomSearch1", settings.Shortcuts.MainTranslateCustomSearch1);

View File

@ -115,6 +115,10 @@ namespace Nikse.SubtitleEdit.Controls
private double _wholeParagraphMinMilliseconds; private double _wholeParagraphMinMilliseconds;
private double _wholeParagraphMaxMilliseconds = double.MaxValue; private double _wholeParagraphMaxMilliseconds = double.MaxValue;
public Keys InsertAtVideoPositionShortcut { get; set; } public Keys InsertAtVideoPositionShortcut { get; set; }
public Keys Move100MsLeft { get; set; }
public Keys Move100MsRight { get; set; }
public Keys MoveOneSecondLeft { get; set; }
public Keys MoveOneSecondRight { get; set; }
public bool MouseWheelScrollUpIsForward { get; set; } = true; public bool MouseWheelScrollUpIsForward { get; set; } = true;
public const double ZoomMinimum = 0.1; public const double ZoomMinimum = 0.1;
@ -350,6 +354,23 @@ namespace Nikse.SubtitleEdit.Controls
InsertAtVideoPositionShortcut = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition); InsertAtVideoPositionShortcut = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition);
} }
protected override bool IsInputKey(Keys keyData)
{
Keys key = keyData & Keys.KeyCode;
switch (key)
{
case Keys.Up:
case Keys.Down:
case Keys.Right:
case Keys.Left:
return true;
default:
return base.IsInputKey(keyData);
}
}
private void LoadParagraphs(Subtitle subtitle, int primarySelectedIndex, ListView.SelectedIndexCollection selectedIndexes) private void LoadParagraphs(Subtitle subtitle, int primarySelectedIndex, ListView.SelectedIndexCollection selectedIndexes)
{ {
_subtitle.Paragraphs.Clear(); _subtitle.Paragraphs.Clear();
@ -1958,6 +1979,38 @@ namespace Nikse.SubtitleEdit.Controls
e.Handled = true; e.Handled = true;
} }
} }
else if (e.KeyData == Move100MsLeft)
{
var pos = Math.Max(0, _currentVideoPositionSeconds - 0.1);
OnPositionSelected?.Invoke(this, new ParagraphEventArgs(pos, null));
Invalidate();
e.SuppressKeyPress = true;
e.Handled = true;
}
else if (e.KeyData == Move100MsRight)
{
var pos = _currentVideoPositionSeconds + 0.1;
OnPositionSelected?.Invoke(this, new ParagraphEventArgs(pos, null));
Invalidate();
e.SuppressKeyPress = true;
e.Handled = true;
}
else if (e.KeyData == MoveOneSecondLeft)
{
var pos = Math.Max(0, _currentVideoPositionSeconds - 1);
OnPositionSelected?.Invoke(this, new ParagraphEventArgs(pos, null));
Invalidate();
e.SuppressKeyPress = true;
e.Handled = true;
}
else if (e.KeyData == MoveOneSecondRight)
{
var pos = _currentVideoPositionSeconds + 1;
OnPositionSelected?.Invoke(this, new ParagraphEventArgs(pos, null));
Invalidate();
e.SuppressKeyPress = true;
e.Handled = true;
}
} }
public void ZoomIn() public void ZoomIn()

View File

@ -20085,6 +20085,10 @@ namespace Nikse.SubtitleEdit.Forms
italicToolStripMenuItem1.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxItalic); italicToolStripMenuItem1.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxItalic);
audioVisualizer.InsertAtVideoPositionShortcut = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition); audioVisualizer.InsertAtVideoPositionShortcut = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition);
audioVisualizer.Move100MsLeft = UiUtil.GetKeys(Configuration.Settings.Shortcuts.Waveform100MsLeft);
audioVisualizer.Move100MsRight = UiUtil.GetKeys(Configuration.Settings.Shortcuts.Waveform100MsRight);
audioVisualizer.MoveOneSecondLeft = UiUtil.GetKeys(Configuration.Settings.Shortcuts.Waveform1000MsLeft);
audioVisualizer.MoveOneSecondRight = UiUtil.GetKeys(Configuration.Settings.Shortcuts.Waveform1000MsRight);
UiUtil.HelpKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralHelp); UiUtil.HelpKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralHelp);
helpToolStripMenuItem1.ShortcutKeys = UiUtil.HelpKeys; helpToolStripMenuItem1.ShortcutKeys = UiUtil.HelpKeys;

View File

@ -1372,6 +1372,10 @@ namespace Nikse.SubtitleEdit.Forms
AddNode(audioVisualizerNode, language.WaveformGoToNextSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange)); AddNode(audioVisualizerNode, language.WaveformGoToNextSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformGoToNextSceneChange));
AddNode(audioVisualizerNode, language.WaveformToggleSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformToggleSceneChange)); AddNode(audioVisualizerNode, language.WaveformToggleSceneChange, nameof(Configuration.Settings.Shortcuts.WaveformToggleSceneChange));
AddNode(audioVisualizerNode, language.WaveformGuessStart, nameof(Configuration.Settings.Shortcuts.WaveformGuessStart)); AddNode(audioVisualizerNode, language.WaveformGuessStart, nameof(Configuration.Settings.Shortcuts.WaveformGuessStart));
AddNode(audioVisualizerNode, language.GoBack100Milliseconds, nameof(Configuration.Settings.Shortcuts.Waveform100MsLeft));
AddNode(audioVisualizerNode, language.GoForward100Milliseconds, nameof(Configuration.Settings.Shortcuts.Waveform100MsRight));
AddNode(audioVisualizerNode, language.GoBack1Second, nameof(Configuration.Settings.Shortcuts.Waveform1000MsLeft));
AddNode(audioVisualizerNode, language.GoForward1Second, nameof(Configuration.Settings.Shortcuts.Waveform1000MsRight));
if (audioVisualizerNode.Nodes.Count > 0) if (audioVisualizerNode.Nodes.Count > 0)
{ {
_shortcuts.Nodes.Add(audioVisualizerNode); _shortcuts.Nodes.Add(audioVisualizerNode);
@ -2851,8 +2855,10 @@ namespace Nikse.SubtitleEdit.Forms
} }
if (existsIn.Length > 0 && comboBoxShortcutKey.SelectedIndex > 0) if (existsIn.Length > 0 && comboBoxShortcutKey.SelectedIndex > 0)
{ {
MessageBox.Show(existsIn.ToString(), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning); if (MessageBox.Show(existsIn.ToString(), string.Empty, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel)
return; {
return;
}
} }
treeViewShortcuts.SelectedNode.Text = text + " " + shortcutText; treeViewShortcuts.SelectedNode.Text = text + " " + shortcutText;
AddToSaveList((ShortcutHelper)treeViewShortcuts.SelectedNode.Tag, shortcutText); AddToSaveList((ShortcutHelper)treeViewShortcuts.SelectedNode.Tag, shortcutText);