Added shortcut for 'go to next syntax colored error' in main list view

This commit is contained in:
niksedk 2014-04-08 18:28:37 +02:00
parent fd48fdd476
commit f1ecb26698
5 changed files with 43 additions and 0 deletions

View File

@ -155,6 +155,7 @@ namespace Nikse.SubtitleEdit.Forms
Keys _mainListViewToggleDashes = Keys.None;
Keys _mainListViewAutoDuration = Keys.None;
Keys _mainListViewFocusWaveform = Keys.None;
Keys _mainListViewGoToNextError = Keys.None;
Keys _mainListViewCopyText = Keys.None;
Keys _mainEditReverseStartAndEndingForRTL = Keys.None;
Keys _waveformVerticalZoom = Keys.None;
@ -7205,6 +7206,10 @@ namespace Nikse.SubtitleEdit.Forms
}
e.SuppressKeyPress = true;
}
else if (e.KeyData == _mainListViewGoToNextError)
{
GoToNextSynaxError();
}
// last key down in text
_lastTextKeyDownTicks = DateTime.Now.Ticks;
@ -11500,6 +11505,10 @@ namespace Nikse.SubtitleEdit.Forms
e.SuppressKeyPress = true;
}
}
else if (e.KeyData == _mainListViewGoToNextError)
{
GoToNextSynaxError();
}
else if (e.KeyCode == Keys.V && e.Modifiers == Keys.Control) //Ctrl+vPaste from clipboard
{
if (Clipboard.ContainsText())
@ -11624,6 +11633,28 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void GoToNextSynaxError()
{
int idx = FirstSelectedIndex + 1;
try
{
for (int i = idx; i < _subtitle.Paragraphs.Count - 1; i++)
{
ListViewItem item = SubtitleListview1.Items[i];
if (item.SubItems[SubtitleListView.ColumnIndexDuration].BackColor == Configuration.Settings.Tools.ListViewSyntaxErrorColor ||
item.SubItems[SubtitleListView.ColumnIndexText].BackColor == Configuration.Settings.Tools.ListViewSyntaxErrorColor ||
item.SubItems[SubtitleListView.ColumnIndexStart].BackColor == Configuration.Settings.Tools.ListViewSyntaxErrorColor)
{
SubtitleListview1.SelectIndexAndEnsureVisible(i, true);
return;
}
}
}
catch
{
}
}
private void RestartHistory()
{
_listViewTextUndoLast = null;
@ -14308,6 +14339,7 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemAlignment.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewAlignment);
_mainListViewAutoDuration = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewAutoDuration);
_mainListViewFocusWaveform = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewFocusWaveform);
_mainListViewGoToNextError = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewGoToNextError);
_mainEditReverseStartAndEndingForRTL = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditReverseStartAndEndingForRTL);
_mainListViewCopyText = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewCopyText);
toolStripMenuItemColumnDeleteText.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewColumnDeleteText);

View File

@ -702,6 +702,8 @@ namespace Nikse.SubtitleEdit.Forms
listViewNode.Nodes.Add(Configuration.Settings.Language.Settings.ListViewColumnPaste + GetShortcutText(Configuration.Settings.Shortcuts.MainListViewColumnPaste));
if (!string.IsNullOrEmpty(Configuration.Settings.Language.Settings.ListViewFocusWaveform))
listViewNode.Nodes.Add(Configuration.Settings.Language.Settings.ListViewFocusWaveform + GetShortcutText(Configuration.Settings.Shortcuts.MainListViewFocusWaveform));
if (!string.IsNullOrEmpty(Configuration.Settings.Language.Settings.ListViewGoToNextError))
listViewNode.Nodes.Add(Configuration.Settings.Language.Settings.ListViewGoToNextError + GetShortcutText(Configuration.Settings.Shortcuts.MainListViewGoToNextError));
treeViewShortcuts.Nodes.Add(listViewNode);
var textBoxNode = new TreeNode(Configuration.Settings.Language.Settings.TextBox);
@ -1381,6 +1383,8 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.Shortcuts.MainListViewColumnPaste = GetShortcut(node.Text);
else if (Configuration.Settings.Language.Settings.ListViewFocusWaveform != null && text == Configuration.Settings.Language.Settings.ListViewFocusWaveform.Replace("&", string.Empty))
Configuration.Settings.Shortcuts.MainListViewFocusWaveform = GetShortcut(node.Text);
else if (Configuration.Settings.Language.Settings.ListViewGoToNextError != null && text == Configuration.Settings.Language.Settings.ListViewGoToNextError.Replace("&", string.Empty))
Configuration.Settings.Shortcuts.MainListViewGoToNextError = GetShortcut(node.Text);
}
}

View File

@ -1860,6 +1860,7 @@ can edit in same subtitle file (collaboration)",
ListViewColumnInsert = "Column, insert text",
ListViewColumnPaste = "Column, paste",
ListViewFocusWaveform = "Focus waveform/spectrogram",
ListViewGoToNextError = "Go to next error",
ShowBeamer = "Start subtitle fullscreen beamer",
MainTextBoxMoveLastWordDown = "Move last word down to next subtitle line",
MainTextBoxMoveFirstWordFromNextUp = "Move first word from next subtitle line up",

View File

@ -1755,6 +1755,7 @@
public string ListViewColumnInsert { get; set; }
public string ListViewColumnPaste { get; set; }
public string ListViewFocusWaveform { get; set; }
public string ListViewGoToNextError { get; set; }
public string ShowBeamer { get; set; }
public string MainTextBoxMoveLastWordDown { get; set; }
public string MainTextBoxMoveFirstWordFromNextUp { get; set; }

View File

@ -788,6 +788,7 @@ namespace Nikse.SubtitleEdit.Logic
public string MainListViewColumnInsertText { get; set; }
public string MainListViewColumnPaste { get; set; }
public string MainListViewFocusWaveform { get; set; }
public string MainListViewGoToNextError { get; set; }
public string MainTextBoxItalic { get; set; }
public string MainTextBoxSplitAtCursor { get; set; }
public string MainTextBoxMoveLastWordDown { get; set; }
@ -2264,6 +2265,9 @@ namespace Nikse.SubtitleEdit.Logic
subNode = node.SelectSingleNode("MainListViewFocusWaveform");
if (subNode != null)
settings.Shortcuts.MainListViewFocusWaveform = subNode.InnerText;
subNode = node.SelectSingleNode("MainListViewGoToNextError");
if (subNode != null)
settings.Shortcuts.MainListViewGoToNextError = subNode.InnerText;
subNode = node.SelectSingleNode("MainEditReverseStartAndEndingForRTL");
if (subNode != null)
settings.Shortcuts.MainEditReverseStartAndEndingForRTL = subNode.InnerText;
@ -2909,6 +2913,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("MainListViewColumnInsertText", settings.Shortcuts.MainListViewColumnInsertText);
textWriter.WriteElementString("MainListViewColumnPaste", settings.Shortcuts.MainListViewColumnPaste);
textWriter.WriteElementString("MainListViewFocusWaveform", settings.Shortcuts.MainListViewFocusWaveform);
textWriter.WriteElementString("MainListViewGoToNextError", settings.Shortcuts.MainListViewGoToNextError);
textWriter.WriteElementString("MainEditReverseStartAndEndingForRTL", settings.Shortcuts.MainEditReverseStartAndEndingForRTL);
textWriter.WriteElementString("MainTextBoxItalic", settings.Shortcuts.MainTextBoxItalic);
textWriter.WriteElementString("MainTextBoxSplitAtCursor", settings.Shortcuts.MainTextBoxSplitAtCursor);