From ad8da730acfe0f93356ed1b2aa43771786b49cf4 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 17 Feb 2020 23:09:35 +0100 Subject: [PATCH] Add "Collapse" context menu for "shortcuts treeview" --- LanguageMaster.xml | 1 + libse/Language.cs | 3 ++- libse/LanguageDeserializer.cs | 3 +++ libse/LanguageStructure.cs | 1 + src/Forms/Settings.Designer.cs | 22 ++++++++++++++++++++++ src/Forms/Settings.cs | 7 ++++++- src/Forms/Settings.resx | 3 +++ 7 files changed, 38 insertions(+), 2 deletions(-) diff --git a/LanguageMaster.xml b/LanguageMaster.xml index 031bf6d1a..2f2205fa2 100644 --- a/LanguageMaster.xml +++ b/LanguageMaster.xml @@ -81,6 +81,7 @@ Delete current line Width Height + Collapse About Subtitle Edit diff --git a/libse/Language.cs b/libse/Language.cs index cfaed72b7..81d28444a 100644 --- a/libse/Language.cs +++ b/libse/Language.cs @@ -198,7 +198,8 @@ namespace Nikse.SubtitleEdit.Core Search = "Search", DeleteCurrentLine = "Delete current line", Width = "Width", - Height = "Height" + Height = "Height", + Collapse = "Collapse" }; About = new LanguageStructure.About diff --git a/libse/LanguageDeserializer.cs b/libse/LanguageDeserializer.cs index b5039b52a..74dcd0e8d 100644 --- a/libse/LanguageDeserializer.cs +++ b/libse/LanguageDeserializer.cs @@ -298,6 +298,9 @@ namespace Nikse.SubtitleEdit.Core case "General/Height": language.General.Height = reader.Value; break; + case "General/Collapse": + language.General.Collapse = reader.Value; + break; case "About/Title": language.About.Title = reader.Value; break; diff --git a/libse/LanguageStructure.cs b/libse/LanguageStructure.cs index 4cb01cbb5..5e8516c54 100644 --- a/libse/LanguageStructure.cs +++ b/libse/LanguageStructure.cs @@ -85,6 +85,7 @@ public string DeleteCurrentLine { get; set; } public string Width { get; set; } public string Height { get; set; } + public string Collapse { get; set; } } public class About diff --git a/src/Forms/Settings.Designer.cs b/src/Forms/Settings.Designer.cs index bdea7c237..be958da7e 100644 --- a/src/Forms/Settings.Designer.cs +++ b/src/Forms/Settings.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.buttonOK = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.tabControlSettings = new System.Windows.Forms.TabControl(); @@ -367,6 +368,8 @@ this.labelStatus = new System.Windows.Forms.Label(); this.openFileDialogFFmpeg = new System.Windows.Forms.OpenFileDialog(); this.buttonReset = new System.Windows.Forms.Button(); + this.contextMenuStripShortcuts = new System.Windows.Forms.ContextMenuStrip(this.components); + this.toolStripMenuItemShortcutsCollapse = new System.Windows.Forms.ToolStripMenuItem(); this.tabControlSettings.SuspendLayout(); this.tabPageGeneral.SuspendLayout(); this.groupBoxMiscellaneous.SuspendLayout(); @@ -445,6 +448,7 @@ this.groupBoxNetworkSession.SuspendLayout(); this.groupBoxProxySettings.SuspendLayout(); this.groupBoxProxyAuthentication.SuspendLayout(); + this.contextMenuStripShortcuts.SuspendLayout(); this.SuspendLayout(); // // buttonOK @@ -1497,6 +1501,7 @@ this.treeViewShortcuts.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.treeViewShortcuts.ContextMenuStrip = this.contextMenuStripShortcuts; this.treeViewShortcuts.HideSelection = false; this.treeViewShortcuts.Location = new System.Drawing.Point(16, 47); this.treeViewShortcuts.Name = "treeViewShortcuts"; @@ -4454,6 +4459,20 @@ this.buttonReset.UseVisualStyleBackColor = true; this.buttonReset.Click += new System.EventHandler(this.buttonReset_Click); // + // contextMenuStripShortcuts + // + this.contextMenuStripShortcuts.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItemShortcutsCollapse}); + this.contextMenuStripShortcuts.Name = "contextMenuStripShortcuts"; + this.contextMenuStripShortcuts.Size = new System.Drawing.Size(120, 26); + // + // toolStripMenuItemShortcutsCollapse + // + this.toolStripMenuItemShortcutsCollapse.Name = "toolStripMenuItemShortcutsCollapse"; + this.toolStripMenuItemShortcutsCollapse.Size = new System.Drawing.Size(119, 22); + this.toolStripMenuItemShortcutsCollapse.Text = "Collapse"; + this.toolStripMenuItemShortcutsCollapse.Click += new System.EventHandler(this.toolStripMenuItemShortcutsCollapse_Click); + // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -4586,6 +4605,7 @@ this.groupBoxProxySettings.PerformLayout(); this.groupBoxProxyAuthentication.ResumeLayout(false); this.groupBoxProxyAuthentication.PerformLayout(); + this.contextMenuStripShortcuts.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -4932,5 +4952,7 @@ private System.Windows.Forms.Label labelToolsBreakBottomHeavyPercent; private System.Windows.Forms.CheckBox checkBoxSyntaxColorGapTooSmall; private System.Windows.Forms.Button buttonReset; + private System.Windows.Forms.ContextMenuStrip contextMenuStripShortcuts; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemShortcutsCollapse; } } \ No newline at end of file diff --git a/src/Forms/Settings.cs b/src/Forms/Settings.cs index b9c078d65..fb682af10 100644 --- a/src/Forms/Settings.cs +++ b/src/Forms/Settings.cs @@ -891,7 +891,7 @@ namespace Nikse.SubtitleEdit.Forms MakeShortcutsTreeview(language); ShowShortcutsTreeview(); - + toolStripMenuItemShortcutsCollapse.Text = Configuration.Settings.Language.General.Collapse; labelShortcutsSearch.Text = Configuration.Settings.Language.General.Search; buttonShortcutsClear.Text = Configuration.Settings.Language.DvdSubRip.Clear; textBoxShortcutSearch.Left = labelShortcutsSearch.Left + labelShortcutsSearch.Width + 5; @@ -3151,5 +3151,10 @@ namespace Nikse.SubtitleEdit.Forms Init(); } } + + private void toolStripMenuItemShortcutsCollapse_Click(object sender, EventArgs e) + { + treeViewShortcuts.CollapseAll(); + } } } diff --git a/src/Forms/Settings.resx b/src/Forms/Settings.resx index acbb9591a..5250ab685 100644 --- a/src/Forms/Settings.resx +++ b/src/Forms/Settings.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 464, 17 + 17, 17