diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs index 26b69b436..52eddc642 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs @@ -87,6 +87,8 @@ namespace Nikse.SubtitleEdit.Forms this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x272ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.buttonMode = new System.Windows.Forms.Button(); + this.removeSubtitleFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.labelPreviewPleaseWait = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.videoPlayerContainer1 = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); this.numericUpDownCutToSeconds = new Nikse.SubtitleEdit.Controls.NikseUpDown(); @@ -493,6 +495,7 @@ namespace Nikse.SubtitleEdit.Forms this.columnHeaderSubtitleFile, this.columnHeaderStatus}); this.listViewBatch.ContextMenuStrip = this.contextMenuStripBatch; + this.listViewBatch.FullRowSelect = true; this.listViewBatch.HideSelection = false; this.listViewBatch.Location = new System.Drawing.Point(6, 316); this.listViewBatch.Name = "listViewBatch"; @@ -502,6 +505,7 @@ namespace Nikse.SubtitleEdit.Forms this.listViewBatch.View = System.Windows.Forms.View.Details; this.listViewBatch.DragDrop += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragDrop); this.listViewBatch.DragEnter += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragEnter); + this.listViewBatch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewBatch_KeyDown); // // columnHeaderVideoFile // @@ -527,44 +531,46 @@ namespace Nikse.SubtitleEdit.Forms // this.contextMenuStripBatch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addFilesToolStripMenuItem, + this.toolStripSeparator2, this.pickSubtitleFileToolStripMenuItem, + this.removeSubtitleFileToolStripMenuItem, this.toolStripSeparator1, this.deleteToolStripMenuItem, this.clearToolStripMenuItem}); this.contextMenuStripBatch.Name = "contextMenuStripBatch"; - this.contextMenuStripBatch.Size = new System.Drawing.Size(167, 98); + this.contextMenuStripBatch.Size = new System.Drawing.Size(179, 126); this.contextMenuStripBatch.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripBatch_Opening); // // addFilesToolStripMenuItem // this.addFilesToolStripMenuItem.Name = "addFilesToolStripMenuItem"; - this.addFilesToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.addFilesToolStripMenuItem.Size = new System.Drawing.Size(178, 22); this.addFilesToolStripMenuItem.Text = "Add video files..."; this.addFilesToolStripMenuItem.Click += new System.EventHandler(this.addFilesToolStripMenuItem_Click); // // pickSubtitleFileToolStripMenuItem // this.pickSubtitleFileToolStripMenuItem.Name = "pickSubtitleFileToolStripMenuItem"; - this.pickSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.pickSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); this.pickSubtitleFileToolStripMenuItem.Text = "Pick subtitle file..."; this.pickSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.pickSubtitleFileToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(163, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(175, 6); // // deleteToolStripMenuItem // this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(178, 22); this.deleteToolStripMenuItem.Text = "Delete"; this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); // // clearToolStripMenuItem // this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; - this.clearToolStripMenuItem.Size = new System.Drawing.Size(166, 22); + this.clearToolStripMenuItem.Size = new System.Drawing.Size(178, 22); this.clearToolStripMenuItem.Text = "Clear"; this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click); // @@ -721,6 +727,18 @@ namespace Nikse.SubtitleEdit.Forms this.buttonMode.UseVisualStyleBackColor = true; this.buttonMode.Click += new System.EventHandler(this.buttonMode_Click); // + // removeSubtitleFileToolStripMenuItem + // + this.removeSubtitleFileToolStripMenuItem.Name = "removeSubtitleFileToolStripMenuItem"; + this.removeSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.removeSubtitleFileToolStripMenuItem.Text = "Remove subtitle file"; + this.removeSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.removeSubtitleFileToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(175, 6); + // // labelPreviewPleaseWait // this.labelPreviewPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -1602,6 +1620,7 @@ namespace Nikse.SubtitleEdit.Forms this.Shown += new System.EventHandler(this.GenerateVideoWithHardSubs_Shown); this.ResizeEnd += new System.EventHandler(this.GenerateVideoWithHardSubs_ResizeEnd); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GenerateVideoWithHardSubs_KeyDown); + this.Resize += new System.EventHandler(this.GenerateVideoWithHardSubs_Resize); this.contextMenuStripGenerate.ResumeLayout(false); this.groupBoxSettings.ResumeLayout(false); this.groupBoxSettings.PerformLayout(); @@ -1719,5 +1738,7 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.Button buttonAddFile; private System.Windows.Forms.ListView listViewAudioTracks; private System.Windows.Forms.ColumnHeader columnHeaderAudioTrack; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem removeSubtitleFileToolStripMenuItem; } } \ No newline at end of file diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index 297466e62..2487a02f0 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -1925,6 +1925,8 @@ namespace Nikse.SubtitleEdit.Forms private void contextMenuStripBatch_Opening(object sender, System.ComponentModel.CancelEventArgs e) { pickSubtitleFileToolStripMenuItem.Visible = listViewBatch.SelectedItems.Count == 1; + removeSubtitleFileToolStripMenuItem.Visible = listViewBatch.SelectedItems.Count >= 1; + toolStripSeparator2.Visible = listViewBatch.SelectedItems.Count >= 1; if (listViewBatch.Items.Count == 0) { @@ -1998,16 +2000,16 @@ namespace Nikse.SubtitleEdit.Forms var path = Path.GetDirectoryName(fileName); var fileNameNoExt = Path.GetFileNameWithoutExtension(fileName); - var subFileName = Path.ChangeExtension(fileName, ".srt"); + var subFileName = Path.ChangeExtension(fileName, ".ass"); if (!File.Exists(subFileName)) { - subFileName = Path.ChangeExtension(fileName, ".ass"); + subFileName = Path.ChangeExtension(fileName, ".srt"); } if (!File.Exists(subFileName)) { - var files = Directory.GetFiles(path, fileNameNoExt + "*.srt"); + var files = Directory.GetFiles(path, fileNameNoExt + "*.ass"); if (files.Length > 0) { subFileName = files[0]; @@ -2016,7 +2018,7 @@ namespace Nikse.SubtitleEdit.Forms if (!File.Exists(subFileName)) { - var files = Directory.GetFiles(path, fileNameNoExt + "*.ass"); + var files = Directory.GetFiles(path, fileNameNoExt + "*.srt"); if (files.Length > 0) { subFileName = files[0]; @@ -2042,10 +2044,17 @@ namespace Nikse.SubtitleEdit.Forms private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { - for (var i = listViewBatch.SelectedIndices.Count - 1; i >= 0; i--) + var indices = new List(); + foreach (int i in listViewBatch.SelectedIndices) { - listViewBatch.Items.RemoveAt(listViewBatch.SelectedIndices[i]); - _batchVideoAndSubList.RemoveAt(listViewBatch.SelectedIndices[i]); + indices.Add(i); + } + + indices = indices.OrderBy(p => p).ToList(); + for (var i = indices.Count - 1; i >= 0; i--) + { + listViewBatch.Items.RemoveAt(i); + _batchVideoAndSubList.RemoveAt(i); } } @@ -2061,6 +2070,11 @@ namespace Nikse.SubtitleEdit.Forms listViewAudioTracks.AutoSizeLastColumn(); } + private void GenerateVideoWithHardSubs_Resize(object sender, EventArgs e) + { + GenerateVideoWithHardSubs_ResizeEnd(null, null); + } + private void listViewBatch_DragEnter(object sender, DragEventArgs e) { if (_converting) @@ -2101,7 +2115,6 @@ namespace Nikse.SubtitleEdit.Forms } } }); - } finally { @@ -2151,5 +2164,23 @@ namespace Nikse.SubtitleEdit.Forms listViewBatch.Items[idx].SubItems[2].Text = Path.GetFileName(openFileDialog1.FileName); } } + + private void listViewBatch_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Delete) + { + deleteToolStripMenuItem_Click(null, null); + e.SuppressKeyPress = true; + } + } + + private void removeSubtitleFileToolStripMenuItem_Click(object sender, EventArgs e) + { + foreach (int i in listViewBatch.SelectedIndices) + { + listViewBatch.Items[i].SubItems[2].Text = string.Empty; + _batchVideoAndSubList[i].SubtitleFileName = null; + } + } } }