Add "Go to list view" in a new source view context menu

This commit is contained in:
OmrSi 2020-12-15 19:29:19 +02:00
parent 5c07599141
commit 9cb1885dad
6 changed files with 89 additions and 7 deletions

View File

@ -1252,6 +1252,7 @@ Go to "Options -> Settings -> Tools" to enter your Google translate API ke
<EditBookmark>Edit bookmark</EditBookmark>
<RemoveBookmark>Remove bookmark</RemoveBookmark>
<GoToSourceView>Go to source view</GoToSourceView>
<GoToListView>Go to list view</GoToListView>
</ContextMenu>
</Menu>
<Controls>

View File

@ -1767,6 +1767,7 @@ namespace Nikse.SubtitleEdit.Core
EditBookmark = "Edit bookmark",
RemoveBookmark = "Remove bookmark",
GoToSourceView = "Go to source view",
GoToListView = "Go to list view"
}
},

View File

@ -4144,6 +4144,9 @@ namespace Nikse.SubtitleEdit.Core
case "Main/Menu/ContextMenu/GoToSourceView":
language.Main.Menu.ContextMenu.GoToSourceView = reader.Value;
break;
case "Main/Menu/ContextMenu/GoToListView":
language.Main.Menu.ContextMenu.GoToListView = reader.Value;
break;
case "Main/Controls/SubtitleFormat":
language.Main.Controls.SubtitleFormat = reader.Value;
break;

View File

@ -1621,6 +1621,7 @@
public string EditBookmark { get; set; }
public string RemoveBookmark { get; set; }
public string GoToSourceView { get; set; }
public string GoToListView { get; set; }
}
public FileMenu File { get; set; }

View File

@ -523,6 +523,8 @@ namespace Nikse.SubtitleEdit.Forms
this.labelAutoDuration = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.textBoxSource = new System.Windows.Forms.TextBox();
this.contextMenuStripTextBoxSourceView = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItemGoToListView = new System.Windows.Forms.ToolStripMenuItem();
this.panelVideoPlayer = new System.Windows.Forms.Panel();
this.mediaPlayer = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer();
this.contextMenuStripEmpty = new System.Windows.Forms.ContextMenuStrip(this.components);
@ -571,6 +573,7 @@ namespace Nikse.SubtitleEdit.Forms
this.contextMenuStripTextBoxListView.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDuration)).BeginInit();
this.tabPage2.SuspendLayout();
this.contextMenuStripTextBoxSourceView.SuspendLayout();
this.panelVideoPlayer.SuspendLayout();
this.contextMenuStripEmpty.SuspendLayout();
this.SuspendLayout();
@ -5050,6 +5053,7 @@ namespace Nikse.SubtitleEdit.Forms
// textBoxSource
//
this.textBoxSource.AllowDrop = true;
this.textBoxSource.ContextMenuStrip = this.contextMenuStripTextBoxSourceView;
this.textBoxSource.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBoxSource.HideSelection = false;
this.textBoxSource.Location = new System.Drawing.Point(3, 3);
@ -5065,8 +5069,35 @@ namespace Nikse.SubtitleEdit.Forms
this.textBoxSource.DragDrop += new System.Windows.Forms.DragEventHandler(this.TextBoxSourceDragDrop);
this.textBoxSource.DragEnter += new System.Windows.Forms.DragEventHandler(this.TextBoxSourceDragEnter);
this.textBoxSource.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxSourceKeyDown);
this.textBoxSource.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxSource_KeyUp);
this.textBoxSource.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TextBoxSource_KeyUp);
this.textBoxSource.Leave += new System.EventHandler(this.TextBoxSourceLeave);
//
// contextMenuStripTextBoxSourceView
//
this.contextMenuStripTextBoxSourceView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItemGoToListView,
this.toolStripSeparator18,
this.cutToolStripMenuItem,
this.copyToolStripMenuItem,
this.pasteToolStripMenuItem,
this.deleteToolStripMenuItem,
this.toolStripSeparator17,
this.selectAllToolStripMenuItem,
this.toolStripSeparator25,
this.toolStripMenuItemInsertUnicodeSymbol,
this.toolStripMenuItemInsertUnicodeControlCharacters});
this.contextMenuStripTextBoxSourceView.Name = "contextMenuStripTextBoxSourceView";
this.contextMenuStripTextBoxSourceView.Size = new System.Drawing.Size(274, 512);
this.contextMenuStripTextBoxSourceView.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.MenuClosed);
this.contextMenuStripTextBoxSourceView.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripTextBoxListViewOpening);
this.contextMenuStripTextBoxSourceView.Opened += new System.EventHandler(this.MenuOpened);
//
// toolStripMenuItemGoToListView
//
this.toolStripMenuItemGoToListView.Name = "toolStripMenuItemGoToListView";
this.toolStripMenuItemGoToListView.Size = new System.Drawing.Size(284, 22);
this.toolStripMenuItemGoToListView.Text = "Go to list view";
this.toolStripMenuItemGoToListView.Click += new System.EventHandler(this.toolStripMenuItemGoToListView_Click);
//
// panelVideoPlayer
//
@ -5232,6 +5263,7 @@ namespace Nikse.SubtitleEdit.Forms
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDuration)).EndInit();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.contextMenuStripTextBoxSourceView.ResumeLayout(false);
this.panelVideoPlayer.ResumeLayout(false);
this.contextMenuStripEmpty.ResumeLayout(false);
this.ResumeLayout(false);
@ -5268,6 +5300,8 @@ namespace Nikse.SubtitleEdit.Forms
private Nikse.SubtitleEdit.Controls.SubtitleListView SubtitleListview1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TextBox textBoxSource;
private System.Windows.Forms.ContextMenuStrip contextMenuStripTextBoxSourceView;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemGoToListView;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.ToolStripButton toolStripButtonFileOpen;

View File

@ -1595,6 +1595,7 @@ namespace Nikse.SubtitleEdit.Forms
copyOriginalTextToCurrentToolStripMenuItem.Text = _language.Menu.ContextMenu.ColumnCopyOriginalTextToCurrent;
toolStripMenuItemBookmark.Text = Configuration.Settings.Language.Settings.ToggleBookmarksWithComment;
toolStripMenuItemGoToSourceView.Text = _language.Menu.ContextMenu.GoToSourceView;
toolStripMenuItemGoToListView.Text = _language.Menu.ContextMenu.GoToListView;
splitLineToolStripMenuItem.Text = _language.Menu.ContextMenu.Split;
toolStripMenuItemMergeLines.Text = _language.Menu.ContextMenu.MergeSelectedLines;
@ -5070,7 +5071,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void textBoxSource_KeyUp(object sender, KeyEventArgs e)
private void TextBoxSource_KeyUp(object sender, KeyEventArgs e)
{
ShowSourceLineNumber();
}
@ -21166,6 +21167,7 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemBookmark.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralToggleBookmarksWithText);
toolStripMenuItemGoToSourceView.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralToggleView);
toolStripMenuItemEmptyGoToSourceView.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralToggleView);
toolStripMenuItemGoToListView.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralToggleView);
spellCheckToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainSpellCheck);
findDoubleWordsToolStripMenuItem.ShortcutKeys = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainSpellCheckFindDoubleWords);
@ -22591,27 +22593,62 @@ namespace Nikse.SubtitleEdit.Forms
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
{
GetFocusedTextBox().SelectAll();
if (tabControlSubtitle.SelectedIndex == TabControlSourceView)
{
textBoxSource.SelectAll();
}
else
{
GetFocusedTextBox().SelectAll();
}
}
private void cutToolStripMenuItem_Click(object sender, EventArgs e)
{
GetFocusedTextBox().Cut();
if (tabControlSubtitle.SelectedIndex == TabControlSourceView)
{
textBoxSource.Cut();
}
else
{
GetFocusedTextBox().Cut();
}
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
GetFocusedTextBox().Copy();
if (tabControlSubtitle.SelectedIndex == TabControlSourceView)
{
textBoxSource.Copy();
}
else
{
GetFocusedTextBox().Copy();
}
}
private void PasteToolStripMenuItemClick(object sender, EventArgs e)
{
GetFocusedTextBox().Paste();
if (tabControlSubtitle.SelectedIndex == TabControlSourceView)
{
textBoxSource.Paste();
}
else
{
GetFocusedTextBox().Paste();
}
}
private void DeleteToolStripMenuItemClick(object sender, EventArgs e)
{
GetFocusedTextBox().SelectedText = string.Empty;
if (tabControlSubtitle.SelectedIndex == TabControlSourceView)
{
textBoxSource.SelectedText = string.Empty;
}
else
{
GetFocusedTextBox().SelectedText = string.Empty;
}
}
private void NormalToolStripMenuItem1Click(object sender, EventArgs e)
@ -28498,6 +28535,11 @@ namespace Nikse.SubtitleEdit.Forms
tabControlSubtitle.SelectedIndex = TabControlSourceView;
}
private void toolStripMenuItemGoToListView_Click(object sender, EventArgs e)
{
tabControlSubtitle.SelectedIndex = TabControlListView;
}
private void RunActionOnAllParagraphs(Func<Paragraph, string> action, string historyMessage)
{
if (_subtitle.Paragraphs.Count <= 0 || SubtitleListview1.SelectedItems.Count <= 0)