From e7b1cb58bd6939a48469d4c23062cd48d2b82d0b Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 26 Jun 2009 15:23:53 +0000 Subject: WinGui: - Right Click menu for subtitles Panel. Move Up/Down and remove options. - Confirmation dialog for the new clear logs option. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2627 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/Subtitles.Designer.cs | 51 +++++++++++++++++++++++++++++++++++ win/C#/Controls/Subtitles.cs | 45 +++++++++++++++++++++++++++---- win/C#/Controls/Subtitles.resx | 3 +++ win/C#/frmOptions.cs | 11 +++++--- 4 files changed, 102 insertions(+), 8 deletions(-) (limited to 'win/C#') diff --git a/win/C#/Controls/Subtitles.Designer.cs b/win/C#/Controls/Subtitles.Designer.cs index 86e60febb..6a3b122c7 100644 --- a/win/C#/Controls/Subtitles.Designer.cs +++ b/win/C#/Controls/Subtitles.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.drp_subtitleTracks = new System.Windows.Forms.ComboBox(); this.AudioTrackGroup = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); @@ -43,7 +44,13 @@ this.burned = new System.Windows.Forms.ColumnHeader(); this.defaultTrack = new System.Windows.Forms.ColumnHeader(); this.label68 = new System.Windows.Forms.Label(); + this.subMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.mnu_moveup = new System.Windows.Forms.ToolStripMenuItem(); + this.mnu_movedown = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.mnu_remove = new System.Windows.Forms.ToolStripMenuItem(); this.AudioTrackGroup.SuspendLayout(); + this.subMenu.SuspendLayout(); this.SuspendLayout(); // // drp_subtitleTracks @@ -154,6 +161,7 @@ this.forced, this.burned, this.defaultTrack}); + this.lv_subList.ContextMenuStrip = this.subMenu; this.lv_subList.FullRowSelect = true; this.lv_subList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.lv_subList.HideSelection = false; @@ -203,6 +211,43 @@ this.label68.TabIndex = 67; this.label68.Text = "Subtitles"; // + // subMenu + // + this.subMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnu_moveup, + this.mnu_movedown, + this.toolStripSeparator2, + this.mnu_remove}); + this.subMenu.Name = "audioMenu"; + this.subMenu.Size = new System.Drawing.Size(142, 76); + // + // mnu_moveup + // + this.mnu_moveup.Name = "mnu_moveup"; + this.mnu_moveup.Size = new System.Drawing.Size(141, 22); + this.mnu_moveup.Text = "Move Up"; + this.mnu_moveup.Click += new System.EventHandler(this.mnu_moveup_Click); + // + // mnu_movedown + // + this.mnu_movedown.Name = "mnu_movedown"; + this.mnu_movedown.Size = new System.Drawing.Size(141, 22); + this.mnu_movedown.Text = "Move Down"; + this.mnu_movedown.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.mnu_movedown.Click += new System.EventHandler(this.mnu_movedown_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(138, 6); + // + // mnu_remove + // + this.mnu_remove.Name = "mnu_remove"; + this.mnu_remove.Size = new System.Drawing.Size(141, 22); + this.mnu_remove.Text = "Remove"; + this.mnu_remove.Click += new System.EventHandler(this.mnu_remove_Click); + // // Subtitles // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -216,6 +261,7 @@ this.Size = new System.Drawing.Size(719, 300); this.AudioTrackGroup.ResumeLayout(false); this.AudioTrackGroup.PerformLayout(); + this.subMenu.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -238,5 +284,10 @@ private System.Windows.Forms.CheckBox check_default; private System.Windows.Forms.CheckBox check_burned; private System.Windows.Forms.CheckBox check_forced; + private System.Windows.Forms.ContextMenuStrip subMenu; + private System.Windows.Forms.ToolStripMenuItem mnu_moveup; + private System.Windows.Forms.ToolStripMenuItem mnu_movedown; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem mnu_remove; } } diff --git a/win/C#/Controls/Subtitles.cs b/win/C#/Controls/Subtitles.cs index b5dfeef95..47864f2ee 100644 --- a/win/C#/Controls/Subtitles.cs +++ b/win/C#/Controls/Subtitles.cs @@ -6,10 +6,6 @@ namespace Handbrake.Controls public partial class Subtitles : UserControl { - // TODO - // - Right click menu for adding/removal of tracks. - // - Multi-select for removal. - public Subtitles() { InitializeComponent(); @@ -171,6 +167,46 @@ namespace Handbrake.Controls lv_subList.Select(); } } + + // Right Click Menu + private void mnu_moveup_Click(object sender, EventArgs e) + { + if (lv_subList.SelectedIndices.Count != 0) + { + ListViewItem item = lv_subList.SelectedItems[0]; + int index = item.Index; + index--; + + if (lv_subList.Items.Count > index && index >= 0) + { + lv_subList.Items.Remove(item); + lv_subList.Items.Insert(index, item); + item.Selected = true; + lv_subList.Focus(); + } + } + } + private void mnu_movedown_Click(object sender, EventArgs e) + { + if (lv_subList.SelectedIndices.Count != 0) + { + ListViewItem item = lv_subList.SelectedItems[0]; + int index = item.Index; + index++; + + if (index < lv_subList.Items.Count) + { + lv_subList.Items.Remove(item); + lv_subList.Items.Insert(index, item); + item.Selected = true; + lv_subList.Focus(); + } + } + } + private void mnu_remove_Click(object sender, EventArgs e) + { + removeTrack(); + } // Functions private void setNoDefault() @@ -229,6 +265,5 @@ namespace Handbrake.Controls i++; } } - } } diff --git a/win/C#/Controls/Subtitles.resx b/win/C#/Controls/Subtitles.resx index ff31a6db5..4a57b1229 100644 --- a/win/C#/Controls/Subtitles.resx +++ b/win/C#/Controls/Subtitles.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index de739781b..7529291e2 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -212,6 +212,7 @@ namespace Handbrake { Properties.Settings.Default.saveLogWithVideo = check_saveLogWithVideo.Checked; } + private void check_logsInSpecifiedLocation_CheckedChanged(object sender, EventArgs e) { Properties.Settings.Default.saveLogToSpecifiedPath = check_logsInSpecifiedLocation.Checked; @@ -242,9 +243,13 @@ namespace Handbrake private void btn_clearLogs_Click(object sender, EventArgs e) { - Main.clearLogs(); - MessageBox.Show(this, "HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButtons.OK, - MessageBoxIcon.Information); + DialogResult result = MessageBox.Show("Are you sure you wish to clear the log file directory?", "Clear Logs", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + Main.clearLogs(); + MessageBox.Show(this, "HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButtons.OK, + MessageBoxIcon.Information); + } } #endregion -- cgit v1.2.3