diff --git a/LanguageMaster.xml b/LanguageMaster.xml index 2ff36322b..5bddb5103 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 8f05d5d32..6158a1577 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 097a2f3c2..8bcb01301 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 f332a49ef..187a352e7 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/libse/Settings.cs b/libse/Settings.cs index d2e538d8b..17374992b 100644 --- a/libse/Settings.cs +++ b/libse/Settings.cs @@ -41,10 +41,13 @@ namespace Nikse.SubtitleEdit.Core if (string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(originalFileName)) { fileName = originalFileName; + originalFileName = null; } if (string.IsNullOrEmpty(fileName)) { + Files = Files.Where(p => !string.IsNullOrEmpty(p.FileName)).ToList(); + Files.Insert(0, new RecentFileEntry { FileName = string.Empty }); return; } @@ -1789,9 +1792,9 @@ $HorzAlign = Center //too slow... :( - settings = Deserialize(settingsFileName); // 688 msecs settings = CustomDeserialize(settingsFileName); // 15 msecs - if (settings.General.AutoConvertToUtf8 && !settings.General.DefaultEncoding.StartsWith("UTF-8", StringComparison.Ordinal)) + if (settings.General.DefaultEncoding.StartsWith("utf-8", StringComparison.Ordinal)) { - settings.General.DefaultEncoding = "UTF-8 with BOM"; + settings.General.DefaultEncoding = TextEncoding.Utf8WithBom; } } catch (Exception exception) diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 9fa180053..b1a92d5bf 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -2152,11 +2152,7 @@ namespace Nikse.SubtitleEdit.Forms var ext = file.Extension.ToLowerInvariant(); // save last first visible index + first selected index from listview - if (!string.IsNullOrEmpty(_fileName)) - { - Configuration.Settings.RecentFiles.Add(_fileName, FirstVisibleIndex, FirstSelectedIndex, _videoFileName, originalFileName, Configuration.Settings.General.CurrentVideoOffsetInMs); - } - + Configuration.Settings.RecentFiles.Add(_fileName, FirstVisibleIndex, FirstSelectedIndex, _videoFileName, originalFileName, Configuration.Settings.General.CurrentVideoOffsetInMs); Configuration.Settings.General.CurrentVideoOffsetInMs = 0; openFileDialog1.InitialDirectory = file.DirectoryName; @@ -4097,7 +4093,7 @@ namespace Nikse.SubtitleEdit.Forms { if (ContinueNewOrExit()) { - if (Configuration.Settings.General.ShowRecentFiles && !string.IsNullOrEmpty(_fileName)) + if (Configuration.Settings.General.ShowRecentFiles) { Configuration.Settings.RecentFiles.Add(_fileName, FirstVisibleIndex, FirstSelectedIndex, _videoFileName, _subtitleAlternateFileName, Configuration.Settings.General.CurrentVideoOffsetInMs); } diff --git a/src/Forms/Settings.Designer.cs b/src/Forms/Settings.Designer.cs index 18b5326ac..063e3afa6 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(); @@ -369,6 +370,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(); @@ -447,6 +450,7 @@ this.groupBoxNetworkSession.SuspendLayout(); this.groupBoxProxySettings.SuspendLayout(); this.groupBoxProxyAuthentication.SuspendLayout(); + this.contextMenuStripShortcuts.SuspendLayout(); this.SuspendLayout(); // // buttonOK @@ -1525,6 +1529,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"; @@ -4490,6 +4495,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); @@ -4622,6 +4641,7 @@ this.groupBoxProxySettings.PerformLayout(); this.groupBoxProxyAuthentication.ResumeLayout(false); this.groupBoxProxyAuthentication.PerformLayout(); + this.contextMenuStripShortcuts.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -4970,5 +4990,7 @@ private System.Windows.Forms.Button buttonReset; private System.Windows.Forms.Label labelDialogStyle; private System.Windows.Forms.ComboBox comboBoxDialogStyle; + 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 ea6f5d692..5b94af928 100644 --- a/src/Forms/Settings.cs +++ b/src/Forms/Settings.cs @@ -894,7 +894,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; @@ -3203,5 +3203,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 diff --git a/src/Forms/SettingsProfileExport.Designer.cs b/src/Forms/SettingsProfileExport.Designer.cs index 273df2cea..ce8360fbd 100644 --- a/src/Forms/SettingsProfileExport.Designer.cs +++ b/src/Forms/SettingsProfileExport.Designer.cs @@ -28,12 +28,17 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.labelProfiles = new System.Windows.Forms.Label(); this.buttonOK = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.listViewExportStyles = new System.Windows.Forms.ListView(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.saveFileDialogStyle = new System.Windows.Forms.SaveFileDialog(); + this.contextMenuStripSelect = new System.Windows.Forms.ContextMenuStrip(this.components); + this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.inverseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.contextMenuStripSelect.SuspendLayout(); this.SuspendLayout(); // // labelProfiles @@ -49,7 +54,7 @@ // this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonOK.Location = new System.Drawing.Point(186, 200); + this.buttonOK.Location = new System.Drawing.Point(249, 331); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.TabIndex = 8; @@ -62,7 +67,7 @@ this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonCancel.Location = new System.Drawing.Point(267, 200); + this.buttonCancel.Location = new System.Drawing.Point(330, 331); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.TabIndex = 9; @@ -78,11 +83,12 @@ this.listViewExportStyles.CheckBoxes = true; this.listViewExportStyles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1}); + this.listViewExportStyles.ContextMenuStrip = this.contextMenuStripSelect; this.listViewExportStyles.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.listViewExportStyles.HideSelection = false; this.listViewExportStyles.Location = new System.Drawing.Point(12, 34); this.listViewExportStyles.Name = "listViewExportStyles"; - this.listViewExportStyles.Size = new System.Drawing.Size(330, 160); + this.listViewExportStyles.Size = new System.Drawing.Size(393, 291); this.listViewExportStyles.TabIndex = 7; this.listViewExportStyles.UseCompatibleStateImageBehavior = false; this.listViewExportStyles.View = System.Windows.Forms.View.Details; @@ -91,11 +97,33 @@ // this.saveFileDialogStyle.OverwritePrompt = false; // + // contextMenuStripSelect + // + this.contextMenuStripSelect.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.selectAllToolStripMenuItem, + this.inverseSelectionToolStripMenuItem}); + this.contextMenuStripSelect.Name = "contextMenuStripSelect"; + this.contextMenuStripSelect.Size = new System.Drawing.Size(181, 70); + // + // selectAllToolStripMenuItem + // + this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; + this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.selectAllToolStripMenuItem.Text = "Select all"; + this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click); + // + // inverseSelectionToolStripMenuItem + // + this.inverseSelectionToolStripMenuItem.Name = "inverseSelectionToolStripMenuItem"; + this.inverseSelectionToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.inverseSelectionToolStripMenuItem.Text = "Inverse selection"; + this.inverseSelectionToolStripMenuItem.Click += new System.EventHandler(this.inverseSelectionToolStripMenuItem_Click); + // // SettingsProfileExport // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(354, 233); + this.ClientSize = new System.Drawing.Size(417, 364); this.Controls.Add(this.labelProfiles); this.Controls.Add(this.buttonOK); this.Controls.Add(this.buttonCancel); @@ -110,6 +138,7 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "SettingsProfileExport"; this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SettingsProfileExport_KeyDown); + this.contextMenuStripSelect.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -123,5 +152,8 @@ private System.Windows.Forms.ListView listViewExportStyles; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.SaveFileDialog saveFileDialogStyle; + private System.Windows.Forms.ContextMenuStrip contextMenuStripSelect; + private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem inverseSelectionToolStripMenuItem; } } \ No newline at end of file diff --git a/src/Forms/SettingsProfileExport.cs b/src/Forms/SettingsProfileExport.cs index 9e22b5f52..5c9c1756f 100644 --- a/src/Forms/SettingsProfileExport.cs +++ b/src/Forms/SettingsProfileExport.cs @@ -20,6 +20,9 @@ namespace Nikse.SubtitleEdit.Forms listViewExportStyles.Items.Add(new ListViewItem(profile.Name) { Checked = true, Tag = profile }); } + selectAllToolStripMenuItem.Text = Configuration.Settings.Language.FixCommonErrors.SelectAll; + inverseSelectionToolStripMenuItem.Text = Configuration.Settings.Language.FixCommonErrors.InverseSelection; + Text = Configuration.Settings.Language.Settings.ExportProfiles; buttonOK.Text = Configuration.Settings.Language.General.Ok; buttonCancel.Text = Configuration.Settings.Language.General.Cancel; @@ -67,5 +70,21 @@ namespace Nikse.SubtitleEdit.Forms DialogResult = DialogResult.Cancel; } } + + private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in listViewExportStyles.Items) + { + item.Checked = true; + } + } + + private void inverseSelectionToolStripMenuItem_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in listViewExportStyles.Items) + { + item.Checked = !item.Checked; + } + } } } diff --git a/src/Forms/SettingsProfileExport.resx b/src/Forms/SettingsProfileExport.resx index 9332dcf4c..cc57a5a5b 100644 --- a/src/Forms/SettingsProfileExport.resx +++ b/src/Forms/SettingsProfileExport.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 173, 17 + 17, 17