summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-05-22 19:06:27 +0000
committersr55 <[email protected]>2011-05-22 19:06:27 +0000
commitd6d3fa12669a9e1bb158ea11435d014289951ed5 (patch)
tree2a3d5ae9d71e9903f91bff549de72e907d83e7dc
parent33e7b795da3d10587d6fa4aa24c0cdfd1820f51c (diff)
WinGui: Add a new option "Add All" to the Audio track which adds any remaining tracks to the audio list, with default audio settings. Also changed the ObservableCollection back to a BindingList as the Track dropdown behaves better with this.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3995 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/Controls/AudioPanel.Designer.cs114
-rw-r--r--win/CS/Controls/AudioPanel.cs67
-rw-r--r--win/CS/Controls/AudioPanel.resx3
-rw-r--r--win/CS/HandBrakeCS.csproj3
-rw-r--r--win/CS/libraries/SplitButton/License.txt22
-rw-r--r--win/CS/libraries/SplitButton/SplitButton.dllbin0 -> 15360 bytes
-rw-r--r--win/CS/libraries/SplitButton/SplitButton.pdbbin0 -> 28160 bytes
7 files changed, 158 insertions, 51 deletions
diff --git a/win/CS/Controls/AudioPanel.Designer.cs b/win/CS/Controls/AudioPanel.Designer.cs
index 13a5c48ef..368cbe679 100644
--- a/win/CS/Controls/AudioPanel.Designer.cs
+++ b/win/CS/Controls/AudioPanel.Designer.cs
@@ -36,12 +36,13 @@ namespace Handbrake.Controls
{
this.components = new System.ComponentModel.Container();
this.audioMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.audioList_MoveToTop = new System.Windows.Forms.ToolStripMenuItem();
this.audioList_moveup = new System.Windows.Forms.ToolStripMenuItem();
this.audioList_movedown = new System.Windows.Forms.ToolStripMenuItem();
+ this.audioList_MoveToBottom = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.audioList_remove = new System.Windows.Forms.ToolStripMenuItem();
this.btn_RemoveAudioTrack = new System.Windows.Forms.Button();
- this.btn_addAudioTrack = new System.Windows.Forms.Button();
this.label68 = new System.Windows.Forms.Label();
this.drp_audioEncoder = new System.Windows.Forms.ComboBox();
this.drp_audioMix = new System.Windows.Forms.ComboBox();
@@ -50,8 +51,6 @@ namespace Handbrake.Controls
this.drp_audioSample = new System.Windows.Forms.ComboBox();
this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);
this.audioList = new System.Windows.Forms.DataGridView();
- this.ToolTips = new System.Windows.Forms.ToolTip(this.components);
- this.btn_AdvancedAudio = new System.Windows.Forms.Button();
this.Source = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.AudioCodec = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Mixdown = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -59,10 +58,14 @@ namespace Handbrake.Controls
this.Bitrate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DRC = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Gain = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.audioList_MoveToBottom = new System.Windows.Forms.ToolStripMenuItem();
- this.audioList_MoveToTop = new System.Windows.Forms.ToolStripMenuItem();
+ this.ToolTips = new System.Windows.Forms.ToolTip(this.components);
+ this.btn_AdvancedAudio = new System.Windows.Forms.Button();
+ this.btn_addAudioTrack = new wyDay.Controls.SplitButton();
+ this.AddTrackMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.mnu_AddAll = new System.Windows.Forms.ToolStripMenuItem();
this.audioMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.audioList)).BeginInit();
+ this.AddTrackMenu.SuspendLayout();
this.SuspendLayout();
//
// audioMenu
@@ -75,7 +78,14 @@ namespace Handbrake.Controls
this.toolStripSeparator2,
this.audioList_remove});
this.audioMenu.Name = "audioMenu";
- this.audioMenu.Size = new System.Drawing.Size(165, 142);
+ this.audioMenu.Size = new System.Drawing.Size(165, 120);
+ //
+ // audioList_MoveToTop
+ //
+ this.audioList_MoveToTop.Name = "audioList_MoveToTop";
+ this.audioList_MoveToTop.Size = new System.Drawing.Size(164, 22);
+ this.audioList_MoveToTop.Text = "Move to Top";
+ this.audioList_MoveToTop.Click += new System.EventHandler(this.audioList_MoveToTop_Click);
//
// audioList_moveup
//
@@ -92,6 +102,13 @@ namespace Handbrake.Controls
this.audioList_movedown.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.audioList_movedown.Click += new System.EventHandler(this.AudioList_movedown_Click);
//
+ // audioList_MoveToBottom
+ //
+ this.audioList_MoveToBottom.Name = "audioList_MoveToBottom";
+ this.audioList_MoveToBottom.Size = new System.Drawing.Size(164, 22);
+ this.audioList_MoveToBottom.Text = "Move To Bottom";
+ this.audioList_MoveToBottom.Click += new System.EventHandler(this.audioList_MoveToBottom_Click);
+ //
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
@@ -109,7 +126,7 @@ namespace Handbrake.Controls
this.btn_RemoveAudioTrack.BackColor = System.Drawing.Color.Transparent;
this.btn_RemoveAudioTrack.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_RemoveAudioTrack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_RemoveAudioTrack.Location = new System.Drawing.Point(99, 38);
+ this.btn_RemoveAudioTrack.Location = new System.Drawing.Point(114, 37);
this.btn_RemoveAudioTrack.Name = "btn_RemoveAudioTrack";
this.btn_RemoveAudioTrack.Size = new System.Drawing.Size(71, 23);
this.btn_RemoveAudioTrack.TabIndex = 64;
@@ -117,19 +134,6 @@ namespace Handbrake.Controls
this.btn_RemoveAudioTrack.UseVisualStyleBackColor = false;
this.btn_RemoveAudioTrack.Click += new System.EventHandler(this.RemoveAudioTrack_Click);
//
- // btn_addAudioTrack
- //
- this.btn_addAudioTrack.BackColor = System.Drawing.Color.Transparent;
- this.btn_addAudioTrack.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.btn_addAudioTrack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_addAudioTrack.Location = new System.Drawing.Point(16, 38);
- this.btn_addAudioTrack.Name = "btn_addAudioTrack";
- this.btn_addAudioTrack.Size = new System.Drawing.Size(77, 23);
- this.btn_addAudioTrack.TabIndex = 63;
- this.btn_addAudioTrack.Text = "Add Track";
- this.btn_addAudioTrack.UseVisualStyleBackColor = false;
- this.btn_addAudioTrack.Click += new System.EventHandler(this.AddAudioTrack_Click);
- //
// label68
//
this.label68.AutoSize = true;
@@ -269,19 +273,6 @@ namespace Handbrake.Controls
this.ToolTips.SetToolTip(this.audioList, "The audio tracks to be encoded into the output file.");
this.audioList.SelectionChanged += new System.EventHandler(this.audioList_SelectionChanged);
//
- // btn_AdvancedAudio
- //
- this.btn_AdvancedAudio.BackColor = System.Drawing.Color.Transparent;
- this.btn_AdvancedAudio.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.btn_AdvancedAudio.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_AdvancedAudio.Location = new System.Drawing.Point(607, 65);
- this.btn_AdvancedAudio.Name = "btn_AdvancedAudio";
- this.btn_AdvancedAudio.Size = new System.Drawing.Size(94, 23);
- this.btn_AdvancedAudio.TabIndex = 70;
- this.btn_AdvancedAudio.Text = "Advanced";
- this.btn_AdvancedAudio.UseVisualStyleBackColor = false;
- this.btn_AdvancedAudio.Click += new System.EventHandler(this.btn_AdvancedAudio_Click);
- //
// Source
//
this.Source.DataPropertyName = "TrackDisplay";
@@ -350,19 +341,47 @@ namespace Handbrake.Controls
this.Gain.ReadOnly = true;
this.Gain.Width = 60;
//
- // audioList_MoveToBottom
+ // btn_AdvancedAudio
//
- this.audioList_MoveToBottom.Name = "audioList_MoveToBottom";
- this.audioList_MoveToBottom.Size = new System.Drawing.Size(164, 22);
- this.audioList_MoveToBottom.Text = "Move To Bottom";
- this.audioList_MoveToBottom.Click += new System.EventHandler(this.audioList_MoveToBottom_Click);
+ this.btn_AdvancedAudio.BackColor = System.Drawing.Color.Transparent;
+ this.btn_AdvancedAudio.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn_AdvancedAudio.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.btn_AdvancedAudio.Location = new System.Drawing.Point(607, 65);
+ this.btn_AdvancedAudio.Name = "btn_AdvancedAudio";
+ this.btn_AdvancedAudio.Size = new System.Drawing.Size(94, 23);
+ this.btn_AdvancedAudio.TabIndex = 70;
+ this.btn_AdvancedAudio.Text = "Advanced";
+ this.btn_AdvancedAudio.UseVisualStyleBackColor = false;
+ this.btn_AdvancedAudio.Click += new System.EventHandler(this.btn_AdvancedAudio_Click);
//
- // audioList_MoveToTop
+ // btn_addAudioTrack
//
- this.audioList_MoveToTop.Name = "audioList_MoveToTop";
- this.audioList_MoveToTop.Size = new System.Drawing.Size(164, 22);
- this.audioList_MoveToTop.Text = "Move to Top";
- this.audioList_MoveToTop.Click += new System.EventHandler(this.audioList_MoveToTop_Click);
+ this.btn_addAudioTrack.AutoSize = true;
+ this.btn_addAudioTrack.ContextMenuStrip = this.AddTrackMenu;
+ this.btn_addAudioTrack.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn_addAudioTrack.ForeColor = System.Drawing.Color.DarkOrange;
+ this.btn_addAudioTrack.Location = new System.Drawing.Point(16, 37);
+ this.btn_addAudioTrack.Name = "btn_addAudioTrack";
+ this.btn_addAudioTrack.Size = new System.Drawing.Size(92, 23);
+ this.btn_addAudioTrack.SplitMenuStrip = this.AddTrackMenu;
+ this.btn_addAudioTrack.TabIndex = 72;
+ this.btn_addAudioTrack.Text = "Add Track";
+ this.btn_addAudioTrack.UseVisualStyleBackColor = true;
+ this.btn_addAudioTrack.Click += new System.EventHandler(this.AddAudioTrack_Click);
+ //
+ // AddTrackMenu
+ //
+ this.AddTrackMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.mnu_AddAll});
+ this.AddTrackMenu.Name = "audioMenu";
+ this.AddTrackMenu.Size = new System.Drawing.Size(114, 26);
+ //
+ // mnu_AddAll
+ //
+ this.mnu_AddAll.Name = "mnu_AddAll";
+ this.mnu_AddAll.Size = new System.Drawing.Size(152, 22);
+ this.mnu_AddAll.Text = "Add All";
+ this.mnu_AddAll.Click += new System.EventHandler(this.mnu_AddAll_Click);
//
// AudioPanel
//
@@ -373,16 +392,17 @@ namespace Handbrake.Controls
this.Controls.Add(this.drp_audioSample);
this.Controls.Add(this.audioList);
this.Controls.Add(this.label68);
+ this.Controls.Add(this.btn_addAudioTrack);
this.Controls.Add(this.drp_audioBitrate);
this.Controls.Add(this.drp_audioMix);
- this.Controls.Add(this.btn_addAudioTrack);
- this.Controls.Add(this.btn_RemoveAudioTrack);
this.Controls.Add(this.drp_audioEncoder);
+ this.Controls.Add(this.btn_RemoveAudioTrack);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Name = "AudioPanel";
this.Size = new System.Drawing.Size(720, 310);
this.audioMenu.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.audioList)).EndInit();
+ this.AddTrackMenu.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -391,7 +411,6 @@ namespace Handbrake.Controls
#endregion
private System.Windows.Forms.Button btn_RemoveAudioTrack;
- private System.Windows.Forms.Button btn_addAudioTrack;
internal System.Windows.Forms.Label label68;
internal System.Windows.Forms.ComboBox drp_audioEncoder;
internal System.Windows.Forms.ComboBox drp_audioMix;
@@ -416,5 +435,8 @@ namespace Handbrake.Controls
private System.Windows.Forms.DataGridViewTextBoxColumn Gain;
private System.Windows.Forms.ToolStripMenuItem audioList_MoveToTop;
private System.Windows.Forms.ToolStripMenuItem audioList_MoveToBottom;
+ private wyDay.Controls.SplitButton btn_addAudioTrack;
+ private System.Windows.Forms.ContextMenuStrip AddTrackMenu;
+ private System.Windows.Forms.ToolStripMenuItem mnu_AddAll;
}
}
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs
index 20f4a0908..8b385d992 100644
--- a/win/CS/Controls/AudioPanel.cs
+++ b/win/CS/Controls/AudioPanel.cs
@@ -42,7 +42,7 @@ namespace Handbrake.Controls
{
InitializeComponent();
- this.ScannedTracks = new ObservableCollection<Audio>
+ this.ScannedTracks = new BindingList<Audio>
{
AudioHelper.NoneFound
};
@@ -54,7 +54,7 @@ namespace Handbrake.Controls
drp_audioSample.SelectedIndex = 1;
drp_audioBitrate.SelectedItem = "160";
drp_audioEncoder.SelectedItem = "AAC (faac)";
-
+
drp_audioTrack.DataSource = this.ScannedTracks;
}
@@ -67,7 +67,7 @@ namespace Handbrake.Controls
#region Properties
- public ObservableCollection<Audio> ScannedTracks { get; set; }
+ public BindingList<Audio> ScannedTracks { get; set; }
/// <summary>
/// Gets the AudioTracks Collection
@@ -201,7 +201,7 @@ namespace Handbrake.Controls
// Setup the Audio track source dropdown with the new audio tracks.
this.ScannedTracks.Clear();
this.drp_audioTrack.SelectedItem = null;
- this.ScannedTracks = new ObservableCollection<Audio>(selectedTitle.AudioTracks);
+ this.ScannedTracks = new BindingList<Audio>(selectedTitle.AudioTracks);
drp_audioTrack.DataSource = this.ScannedTracks;
drp_audioTrack.SelectedItem = this.ScannedTracks.FirstOrDefault();
@@ -404,6 +404,63 @@ namespace Handbrake.Controls
}
/// <summary>
+ /// Add all the Audio Tracks that are not currently on the Lust
+ /// </summary>
+ /// <param name="sender">The Sender</param>
+ /// <param name="e">The EventArgs</param>
+ private void mnu_AddAll_Click(object sender, EventArgs e)
+ {
+ if (drp_audioTrack.Text == "None Found")
+ {
+ MessageBox.Show(
+ "Your source appears to have no audio tracks, or no tracks in a format that HandBrake supports.",
+ "Warning",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Warning);
+ return;
+ }
+
+ bool trackAdded = false;
+ foreach (Audio sourceTrack in this.ScannedTracks)
+ {
+ // Check if the Track already exists on the list. If it does, skip to the next
+ bool foundTrack = false;
+ foreach (AudioTrack currentTrack in this.AudioTracks)
+ {
+ if (currentTrack.Track.HasValue && currentTrack.Track.Value == sourceTrack.TrackNumber)
+ {
+ // Set a flag to indicate we've found a track
+ foundTrack = true;
+ continue;
+ }
+ }
+
+ if (foundTrack)
+ {
+ // Skip to the nxet Source Track, We already have this one in the list.
+ continue;
+ }
+
+ // Create the Model
+ AudioTrack track = new AudioTrack
+ {
+ ScannedTrack = sourceTrack,
+ };
+
+ this.audioTracks.Add(track);
+ trackAdded = true;
+ }
+
+ // If we added a track, then fire the event
+ if (trackAdded)
+ {
+ // The Audio List has changed to raise the event.
+ if (this.AudioListChanged != null)
+ this.AudioListChanged(this, new EventArgs());
+ }
+ }
+
+ /// <summary>
/// The Remove Track button event handler
/// </summary>
/// <param name="sender">
@@ -568,7 +625,7 @@ namespace Handbrake.Controls
/// </summary>
private void ClearAudioList()
{
- this.audioTracks.Clear();
+ this.AudioTracks.Clear();
if (this.AudioListChanged != null)
this.AudioListChanged(this, new EventArgs());
diff --git a/win/CS/Controls/AudioPanel.resx b/win/CS/Controls/AudioPanel.resx
index 6b186fbc0..322973989 100644
--- a/win/CS/Controls/AudioPanel.resx
+++ b/win/CS/Controls/AudioPanel.resx
@@ -150,4 +150,7 @@
<metadata name="ToolTips.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>330, 16</value>
</metadata>
+ <metadata name="AddTrackMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>427, 16</value>
+ </metadata>
</root> \ No newline at end of file
diff --git a/win/CS/HandBrakeCS.csproj b/win/CS/HandBrakeCS.csproj
index 87229cfa6..b728fe77f 100644
--- a/win/CS/HandBrakeCS.csproj
+++ b/win/CS/HandBrakeCS.csproj
@@ -161,6 +161,9 @@
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
+ <Reference Include="SplitButton">
+ <HintPath>libraries\SplitButton\SplitButton.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
diff --git a/win/CS/libraries/SplitButton/License.txt b/win/CS/libraries/SplitButton/License.txt
new file mode 100644
index 000000000..f9f38be11
--- /dev/null
+++ b/win/CS/libraries/SplitButton/License.txt
@@ -0,0 +1,22 @@
+Copyright (c) 2010, wyDay
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/win/CS/libraries/SplitButton/SplitButton.dll b/win/CS/libraries/SplitButton/SplitButton.dll
new file mode 100644
index 000000000..84ff85204
--- /dev/null
+++ b/win/CS/libraries/SplitButton/SplitButton.dll
Binary files differ
diff --git a/win/CS/libraries/SplitButton/SplitButton.pdb b/win/CS/libraries/SplitButton/SplitButton.pdb
new file mode 100644
index 000000000..fffb82e8f
--- /dev/null
+++ b/win/CS/libraries/SplitButton/SplitButton.pdb
Binary files differ