]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Sat, 16 Apr 2011 18:36:23 +0000 (18:36 +0000)
committersr55 <sr55.hb@outlook.com>
Sat, 16 Apr 2011 18:36:23 +0000 (18:36 +0000)
- Switching Audio Selection dropdown to be databound. Added The scanned source track to the Audio Track model.
- Added new Move to Top / Bottom options on the right click.
- Further UI tweaks and fixes.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3935 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/Controls/AudioPanel.Designer.cs
win/CS/Controls/AudioPanel.cs
win/CS/Functions/Main.cs
win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs
win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs [moved from win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs with 77% similarity]
win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs

index dbc1e84c97180d2952883178a3f81e5b7ff7ddf9..13a5c48ef1c354f275a4dbd330651235ddbef535 100644 (file)
@@ -49,8 +49,6 @@ namespace Handbrake.Controls
             this.drp_audioBitrate = new System.Windows.Forms.ComboBox();\r
             this.drp_audioSample = new System.Windows.Forms.ComboBox();\r
             this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);\r
-            this.label1 = new System.Windows.Forms.Label();\r
-            this.lbl_audioTrack = new System.Windows.Forms.Label();\r
             this.audioList = new System.Windows.Forms.DataGridView();\r
             this.ToolTips = new System.Windows.Forms.ToolTip(this.components);\r
             this.btn_AdvancedAudio = new System.Windows.Forms.Button();\r
@@ -61,6 +59,8 @@ namespace Handbrake.Controls
             this.Bitrate = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
             this.DRC = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
             this.Gain = new System.Windows.Forms.DataGridViewTextBoxColumn();\r
+            this.audioList_MoveToBottom = new System.Windows.Forms.ToolStripMenuItem();\r
+            this.audioList_MoveToTop = new System.Windows.Forms.ToolStripMenuItem();\r
             this.audioMenu.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.audioList)).BeginInit();\r
             this.SuspendLayout();\r
@@ -68,24 +68,26 @@ namespace Handbrake.Controls
             // audioMenu\r
             // \r
             this.audioMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
+            this.audioList_MoveToTop,\r
             this.audioList_moveup,\r
             this.audioList_movedown,\r
+            this.audioList_MoveToBottom,\r
             this.toolStripSeparator2,\r
             this.audioList_remove});\r
             this.audioMenu.Name = "audioMenu";\r
-            this.audioMenu.Size = new System.Drawing.Size(139, 76);\r
+            this.audioMenu.Size = new System.Drawing.Size(165, 142);\r
             // \r
             // audioList_moveup\r
             // \r
             this.audioList_moveup.Name = "audioList_moveup";\r
-            this.audioList_moveup.Size = new System.Drawing.Size(138, 22);\r
+            this.audioList_moveup.Size = new System.Drawing.Size(164, 22);\r
             this.audioList_moveup.Text = "Move Up";\r
             this.audioList_moveup.Click += new System.EventHandler(this.AudioList_moveup_Click);\r
             // \r
             // audioList_movedown\r
             // \r
             this.audioList_movedown.Name = "audioList_movedown";\r
-            this.audioList_movedown.Size = new System.Drawing.Size(138, 22);\r
+            this.audioList_movedown.Size = new System.Drawing.Size(164, 22);\r
             this.audioList_movedown.Text = "Move Down";\r
             this.audioList_movedown.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
             this.audioList_movedown.Click += new System.EventHandler(this.AudioList_movedown_Click);\r
@@ -93,12 +95,12 @@ namespace Handbrake.Controls
             // toolStripSeparator2\r
             // \r
             this.toolStripSeparator2.Name = "toolStripSeparator2";\r
-            this.toolStripSeparator2.Size = new System.Drawing.Size(135, 6);\r
+            this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6);\r
             // \r
             // audioList_remove\r
             // \r
             this.audioList_remove.Name = "audioList_remove";\r
-            this.audioList_remove.Size = new System.Drawing.Size(138, 22);\r
+            this.audioList_remove.Size = new System.Drawing.Size(164, 22);\r
             this.audioList_remove.Text = "Remove";\r
             this.audioList_remove.Click += new System.EventHandler(this.AudioList_remove_Click);\r
             // \r
@@ -150,7 +152,7 @@ namespace Handbrake.Controls
             "AC3 Passthru",\r
             "AC3 (ffmpeg)",\r
             "DTS Passthru"});\r
-            this.drp_audioEncoder.Location = new System.Drawing.Point(191, 87);\r
+            this.drp_audioEncoder.Location = new System.Drawing.Point(191, 66);\r
             this.drp_audioEncoder.Name = "drp_audioEncoder";\r
             this.drp_audioEncoder.Size = new System.Drawing.Size(111, 21);\r
             this.drp_audioEncoder.TabIndex = 52;\r
@@ -168,7 +170,7 @@ namespace Handbrake.Controls
             "Dolby Surround",\r
             "Dolby Pro Logic II",\r
             "6 Channel Discrete"});\r
-            this.drp_audioMix.Location = new System.Drawing.Point(309, 87);\r
+            this.drp_audioMix.Location = new System.Drawing.Point(309, 66);\r
             this.drp_audioMix.Name = "drp_audioMix";\r
             this.drp_audioMix.Size = new System.Drawing.Size(147, 21);\r
             this.drp_audioMix.TabIndex = 54;\r
@@ -181,7 +183,7 @@ namespace Handbrake.Controls
             this.drp_audioTrack.FormattingEnabled = true;\r
             this.drp_audioTrack.Items.AddRange(new object[] {\r
             "Automatic"});\r
-            this.drp_audioTrack.Location = new System.Drawing.Point(16, 87);\r
+            this.drp_audioTrack.Location = new System.Drawing.Point(16, 66);\r
             this.drp_audioTrack.Name = "drp_audioTrack";\r
             this.drp_audioTrack.Size = new System.Drawing.Size(170, 21);\r
             this.drp_audioTrack.TabIndex = 50;\r
@@ -203,7 +205,7 @@ namespace Handbrake.Controls
             "112",\r
             "128",\r
             "160"});\r
-            this.drp_audioBitrate.Location = new System.Drawing.Point(534, 87);\r
+            this.drp_audioBitrate.Location = new System.Drawing.Point(534, 66);\r
             this.drp_audioBitrate.Name = "drp_audioBitrate";\r
             this.drp_audioBitrate.Size = new System.Drawing.Size(67, 21);\r
             this.drp_audioBitrate.TabIndex = 58;\r
@@ -221,7 +223,7 @@ namespace Handbrake.Controls
             "32",\r
             "24",\r
             "22.05"});\r
-            this.drp_audioSample.Location = new System.Drawing.Point(461, 87);\r
+            this.drp_audioSample.Location = new System.Drawing.Point(461, 66);\r
             this.drp_audioSample.Name = "drp_audioSample";\r
             this.drp_audioSample.Size = new System.Drawing.Size(67, 21);\r
             this.drp_audioSample.TabIndex = 56;\r
@@ -234,27 +236,6 @@ namespace Handbrake.Controls
             this.AudioMenuRowHeightHack.ImageSize = new System.Drawing.Size(1, 18);\r
             this.AudioMenuRowHeightHack.TransparentColor = System.Drawing.Color.Transparent;\r
             // \r
-            // label1\r
-            // \r
-            this.label1.AutoSize = true;\r
-            this.label1.BackColor = System.Drawing.Color.Transparent;\r
-            this.label1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label1.Location = new System.Drawing.Point(13, 66);\r
-            this.label1.Name = "label1";\r
-            this.label1.Size = new System.Drawing.Size(94, 13);\r
-            this.label1.TabIndex = 68;\r
-            this.label1.Text = "Selected Track:";\r
-            // \r
-            // lbl_audioTrack\r
-            // \r
-            this.lbl_audioTrack.AutoSize = true;\r
-            this.lbl_audioTrack.BackColor = System.Drawing.Color.Transparent;\r
-            this.lbl_audioTrack.Location = new System.Drawing.Point(113, 66);\r
-            this.lbl_audioTrack.Name = "lbl_audioTrack";\r
-            this.lbl_audioTrack.Size = new System.Drawing.Size(32, 13);\r
-            this.lbl_audioTrack.TabIndex = 69;\r
-            this.lbl_audioTrack.Text = "None";\r
-            // \r
             // audioList\r
             // \r
             this.audioList.AllowUserToAddRows = false;\r
@@ -273,7 +254,7 @@ namespace Handbrake.Controls
             this.Gain});\r
             this.audioList.ContextMenuStrip = this.audioMenu;\r
             this.audioList.GridColor = System.Drawing.Color.White;\r
-            this.audioList.Location = new System.Drawing.Point(16, 114);\r
+            this.audioList.Location = new System.Drawing.Point(16, 94);\r
             this.audioList.Name = "audioList";\r
             this.audioList.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;\r
             this.audioList.RowHeadersVisible = false;\r
@@ -283,7 +264,7 @@ namespace Handbrake.Controls
             this.audioList.ShowCellToolTips = false;\r
             this.audioList.ShowEditingIcon = false;\r
             this.audioList.ShowRowErrors = false;\r
-            this.audioList.Size = new System.Drawing.Size(685, 180);\r
+            this.audioList.Size = new System.Drawing.Size(685, 200);\r
             this.audioList.TabIndex = 67;\r
             this.ToolTips.SetToolTip(this.audioList, "The audio tracks to be encoded into the output file.");\r
             this.audioList.SelectionChanged += new System.EventHandler(this.audioList_SelectionChanged);\r
@@ -293,7 +274,7 @@ namespace Handbrake.Controls
             this.btn_AdvancedAudio.BackColor = System.Drawing.Color.Transparent;\r
             this.btn_AdvancedAudio.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.btn_AdvancedAudio.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
-            this.btn_AdvancedAudio.Location = new System.Drawing.Point(607, 86);\r
+            this.btn_AdvancedAudio.Location = new System.Drawing.Point(607, 65);\r
             this.btn_AdvancedAudio.Name = "btn_AdvancedAudio";\r
             this.btn_AdvancedAudio.Size = new System.Drawing.Size(94, 23);\r
             this.btn_AdvancedAudio.TabIndex = 70;\r
@@ -303,7 +284,7 @@ namespace Handbrake.Controls
             // \r
             // Source\r
             // \r
-            this.Source.DataPropertyName = "SourceTrack";\r
+            this.Source.DataPropertyName = "TrackDisplay";\r
             this.Source.FillWeight = 49.69727F;\r
             this.Source.HeaderText = "Source";\r
             this.Source.Name = "Source";\r
@@ -369,12 +350,24 @@ namespace Handbrake.Controls
             this.Gain.ReadOnly = true;\r
             this.Gain.Width = 60;\r
             // \r
+            // audioList_MoveToBottom\r
+            // \r
+            this.audioList_MoveToBottom.Name = "audioList_MoveToBottom";\r
+            this.audioList_MoveToBottom.Size = new System.Drawing.Size(164, 22);\r
+            this.audioList_MoveToBottom.Text = "Move To Bottom";\r
+            this.audioList_MoveToBottom.Click += new System.EventHandler(this.audioList_MoveToBottom_Click);\r
+            // \r
+            // audioList_MoveToTop\r
+            // \r
+            this.audioList_MoveToTop.Name = "audioList_MoveToTop";\r
+            this.audioList_MoveToTop.Size = new System.Drawing.Size(164, 22);\r
+            this.audioList_MoveToTop.Text = "Move to Top";\r
+            this.audioList_MoveToTop.Click += new System.EventHandler(this.audioList_MoveToTop_Click);\r
+            // \r
             // AudioPanel\r
             // \r
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;\r
             this.BackColor = System.Drawing.Color.Transparent;\r
-            this.Controls.Add(this.label1);\r
-            this.Controls.Add(this.lbl_audioTrack);\r
             this.Controls.Add(this.drp_audioTrack);\r
             this.Controls.Add(this.btn_AdvancedAudio);\r
             this.Controls.Add(this.drp_audioSample);\r
@@ -411,8 +404,6 @@ namespace Handbrake.Controls
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;\r
         private System.Windows.Forms.ToolStripMenuItem audioList_remove;\r
         internal System.Windows.Forms.ComboBox drp_audioBitrate;\r
-        internal System.Windows.Forms.Label label1;\r
-        internal System.Windows.Forms.Label lbl_audioTrack;\r
         private System.Windows.Forms.DataGridView audioList;\r
         private System.Windows.Forms.ToolTip ToolTips;\r
         private System.Windows.Forms.Button btn_AdvancedAudio;\r
@@ -423,5 +414,7 @@ namespace Handbrake.Controls
         private System.Windows.Forms.DataGridViewTextBoxColumn Bitrate;\r
         private System.Windows.Forms.DataGridViewTextBoxColumn DRC;\r
         private System.Windows.Forms.DataGridViewTextBoxColumn Gain;\r
+        private System.Windows.Forms.ToolStripMenuItem audioList_MoveToTop;\r
+        private System.Windows.Forms.ToolStripMenuItem audioList_MoveToBottom;\r
     }\r
 }\r
index ed38c368f1ea7734abf56d4a8bc0f89aaedbadcc..471ac9d2f7cad96aad5a77a3d6b78d460b4c2868 100644 (file)
@@ -8,7 +8,6 @@ namespace Handbrake.Controls
     using System;\r
     using System.Collections.Generic;\r
     using System.ComponentModel;\r
-    using System.Globalization;\r
     using System.Linq;\r
     using System.Windows.Forms;\r
 \r
@@ -20,24 +19,17 @@ namespace Handbrake.Controls
 \r
     using Handbrake.ToolWindows;\r
 \r
-    using AudioTrack = HandBrake.ApplicationServices.Model.Encoding.AudioTrack;\r
-\r
     /// <summary>\r
     /// The AudioPanel Control\r
     /// </summary>\r
     public partial class AudioPanel : UserControl\r
     {\r
-        /**\r
-         * TODO - There is a lot of old code in here that access the datagrid that can be refactored to work with \r
-         *        the new AudioTrack BindingList.\r
-         */\r
-\r
-        private static readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
+        #region Private Variables\r
+        private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();\r
         private const string AC3Passthru = "AC3 Passthru";\r
         private const string DTSPassthru = "DTS Passthru";\r
-        AdvancedAudio advancedAudio = new AdvancedAudio();\r
-\r
-        private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();\r
+        private AdvancedAudio advancedAudio = new AdvancedAudio();\r
+        #endregion\r
 \r
         #region Constructor and Events\r
 \r
@@ -48,13 +40,18 @@ namespace Handbrake.Controls
         {\r
             InitializeComponent();\r
 \r
+            this.ScannedTracks = new BindingList<Audio>\r
+                {\r
+                    Audio.NoneFound \r
+                };\r
+\r
             this.audioList.AutoGenerateColumns = false;\r
             this.audioList.DataSource = audioTracks;\r
 \r
             drp_audioMix.SelectedItem = "Dolby Pro Logic II";\r
             drp_audioSample.SelectedIndex = 1;\r
 \r
-           \r
+            drp_audioTrack.DataSource = this.ScannedTracks;\r
         }\r
 \r
         /// <summary>\r
@@ -66,10 +63,12 @@ namespace Handbrake.Controls
 \r
         #region Properties\r
 \r
+        public BindingList<Audio> ScannedTracks { get; set; }\r
+\r
         /// <summary>\r
         /// Gets the AudioTracks Collection\r
         /// </summary>\r
-        public IEnumerable<AudioTrack> AudioTracks\r
+        public BindingList<AudioTrack> AudioTracks\r
         {\r
             get\r
             {\r
@@ -115,21 +114,21 @@ namespace Handbrake.Controls
         /// <returns>True if m4v is required</returns>\r
         public bool RequiresM4V()\r
         {\r
-            return true;\r
+            return this.AudioTracks.Any(item => item.Encoder == AudioEncoder.Ac3Passthrough || item.Encoder == AudioEncoder.DtsPassthrough || item.Encoder == AudioEncoder.Ac3);\r
         }\r
 \r
         /// <summary>\r
         /// Load an arraylist of AudioTrack items into the list.\r
         /// </summary>\r
-        /// <param name="audioTracks">List of audio tracks</param>\r
-        public void LoadTracks(List<AudioTrack> audioTracks)\r
+        /// <param name="tracks">List of audio tracks</param>\r
+        public void LoadTracks(List<AudioTrack> tracks)\r
         {\r
             ClearAudioList();\r
 \r
-            if (audioTracks == null)\r
+            if (tracks == null)\r
                 return;\r
 \r
-            foreach (AudioTrack track in audioTracks)\r
+            foreach (AudioTrack track in tracks)\r
             {\r
                 this.audioTracks.Add(track);\r
             }\r
@@ -150,15 +149,21 @@ namespace Handbrake.Controls
             if (selectedTitle.AudioTracks.Count == 0)\r
             {\r
                 audioList.Rows.Clear();\r
-                drp_audioTrack.Items.Clear();\r
-                drp_audioTrack.Items.Add("None Found");\r
+                this.ScannedTracks.Clear();\r
+                this.ScannedTracks.Add(Audio.NoneFound);\r
+                this.drp_audioTrack.Refresh();\r
                 drp_audioTrack.SelectedIndex = 0;\r
                 return;\r
             }\r
 \r
             // Setup the Audio track source dropdown with the new audio tracks.\r
-            drp_audioTrack.Items.Clear();\r
-            drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray());\r
+            this.ScannedTracks.Clear();\r
+            foreach (var item in selectedTitle.AudioTracks)\r
+            {\r
+                this.ScannedTracks.Add(item);\r
+            }\r
+            this.drp_audioTrack.Refresh();\r
+            drp_audioTrack.SelectedIndex = 0;\r
 \r
             // Add any tracks the preset has, if there is a preset and no audio tracks in the list currently\r
             if (audioList.Rows.Count == 0 && preset != null)\r
@@ -206,17 +211,17 @@ namespace Handbrake.Controls
                 case "drp_audioTrack":\r
                     if (audioList.Rows.Count != 0 && audioList.SelectedRows.Count != 0)\r
                     {\r
-                        track.SourceTrack = drp_audioTrack.Text;\r
+                        track.ScannedTrack = drp_audioTrack.SelectedItem as Audio;\r
 \r
                         // If the track isn't AC3, and the encoder is, change it.\r
-                        if (track.Encoder == AudioEncoder.Ac3Passthrough && !track.SourceTrack.Contains("(AC3)"))\r
+                        if (track.Encoder == AudioEncoder.Ac3Passthrough && !track.ScannedTrack.Format.Contains("AC3"))\r
                         {\r
                             // Switch to AAC\r
                             drp_audioEncoder.SelectedIndex = 0;\r
                         }\r
 \r
                         // If the track isn't DTS, and the encoder is, change it.\r
-                        if (track.Encoder == AudioEncoder.DtsPassthrough && !track.SourceTrack.Contains("DTS"))\r
+                        if (track.Encoder == AudioEncoder.DtsPassthrough && !track.ScannedTrack.Format.Contains("DTS"))\r
                         {\r
                             // Switch to AAC\r
                             drp_audioEncoder.SelectedIndex = 0;\r
@@ -264,12 +269,6 @@ namespace Handbrake.Controls
             }\r
 \r
             audioList.Refresh();\r
-\r
-            if (audioList.SelectedRows.Count == 1)\r
-            {\r
-                AudioTrack item = audioList.SelectedRows[0].DataBoundItem as AudioTrack;\r
-                if (item != null) lbl_audioTrack.Text = track.SourceTrack;\r
-            }\r
         }\r
 \r
         /// <summary>\r
@@ -289,21 +288,17 @@ namespace Handbrake.Controls
                 AudioTrack track = audioList.SelectedRows[0].DataBoundItem as AudioTrack;\r
                 if (track != null)\r
                 {\r
-                    drp_audioTrack.SelectedItem = track.SourceTrack;\r
+                    drp_audioTrack.SelectedItem = track.ScannedTrack;\r
                     drp_audioEncoder.SelectedItem = EnumHelper<AudioEncoder>.GetDescription(track.Encoder);\r
                     drp_audioMix.SelectedItem = EnumHelper<Mixdown>.GetDescription(track.MixDown);\r
                     drp_audioSample.SelectedItem = track.SampleRate;\r
                     drp_audioBitrate.SelectedItem = track.Bitrate;\r
-                    lbl_audioTrack.Text = track.SourceTrack;\r
 \r
                     // Set the Advanced Control.\r
                     if (!advancedAudio.IsDisposed)\r
                         advancedAudio.Track = track;\r
                 }\r
             }\r
-            else\r
-                lbl_audioTrack.Text = "(Click \"Add Track\" to add)";\r
-\r
         }\r
 \r
         #endregion\r
@@ -341,7 +336,7 @@ namespace Handbrake.Controls
             // Create the Model\r
             AudioTrack track = new AudioTrack\r
                 {\r
-                    SourceTrack = this.drp_audioTrack.Text,\r
+                    ScannedTrack = this.drp_audioTrack.SelectedItem as Audio,\r
                     Encoder = EnumHelper<AudioEncoder>.GetValue(this.drp_audioEncoder.Text),\r
                     MixDown = EnumHelper<Mixdown>.GetValue(this.drp_audioMix.Text),\r
                     SampleRate = samplerate,\r
@@ -422,6 +417,26 @@ namespace Handbrake.Controls
             RemoveTrack();\r
         }\r
 \r
+        /// <summary>\r
+        /// Move to Top\r
+        /// </summary>\r
+        /// <param name="sender">The Sender</param>\r
+        /// <param name="e">The Event Args</param>\r
+        private void audioList_MoveToTop_Click(object sender, EventArgs e)\r
+        {\r
+            MoveTo(true);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Move to Bottom\r
+        /// </summary>\r
+        /// <param name="sender">The Sender</param>\r
+        /// <param name="e">The Event Args</param>\r
+        private void audioList_MoveToBottom_Click(object sender, EventArgs e)\r
+        {\r
+            this.MoveTo(false);\r
+        }\r
+\r
         #endregion\r
 \r
         #region Private Functions\r
@@ -431,6 +446,12 @@ namespace Handbrake.Controls
         /// </summary>\r
         private void AutomaticTrackSelection()\r
         {\r
+            if (drp_audioTrack.SelectedItem.ToString() == Audio.NoneFound.Description)\r
+            {\r
+                this.AudioTracks.Clear();\r
+                return;\r
+            }\r
+\r
             // Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options\r
             if (Properties.Settings.Default.NativeLanguage == "Any")\r
             {\r
@@ -439,7 +460,7 @@ namespace Handbrake.Controls
                 {\r
                     if (this.drp_audioTrack.SelectedItem != null)\r
                     {\r
-                        track.SourceTrack = this.drp_audioTrack.SelectedItem.ToString();\r
+                        track.ScannedTrack = this.drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;\r
                     }\r
                 }\r
             }\r
@@ -466,13 +487,14 @@ namespace Handbrake.Controls
 \r
                         if (drp_audioTrack.SelectedItem != null)\r
                             foreach (AudioTrack track in this.audioTracks)\r
-                                track.SourceTrack = drp_audioTrack.SelectedItem.ToString();\r
+                                track.ScannedTrack =\r
+                                    drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;\r
                         else\r
                         {\r
                             drp_audioTrack.SelectedIndex = 0;\r
                             if (drp_audioTrack.SelectedItem != null)\r
                                 foreach (AudioTrack track in this.audioTracks)\r
-                                    track.SourceTrack = drp_audioTrack.SelectedItem.ToString();\r
+                                    track.ScannedTrack = drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;\r
                         }\r
 \r
                         break;\r
@@ -483,7 +505,7 @@ namespace Handbrake.Controls
 \r
                         if (drp_audioTrack.SelectedItem != null)\r
                             foreach (AudioTrack track in this.audioTracks)\r
-                                track.SourceTrack = drp_audioTrack.SelectedItem.ToString();\r
+                                track.ScannedTrack = drp_audioTrack.SelectedItem as HandBrake.ApplicationServices.Parsing.Audio;\r
                         break;\r
                 }\r
             }\r
@@ -542,6 +564,7 @@ namespace Handbrake.Controls
             if (audioList.SelectedRows.Count == 0) return;\r
 \r
             DataGridViewRow item = audioList.SelectedRows[0];\r
+            AudioTrack track = item.DataBoundItem as AudioTrack;\r
             int index = item.Index;\r
 \r
             if (up) index--;\r
@@ -549,10 +572,30 @@ namespace Handbrake.Controls
 \r
             if (index < audioList.Rows.Count || (audioList.Rows.Count > index && index >= 0))\r
             {\r
-                audioList.Rows.Remove(item);\r
-                audioList.Rows.Insert(index, item);\r
-                audioList.ClearSelection();\r
-                item.Selected = true;\r
+                this.AudioTracks.Remove(track);\r
+                this.audioTracks.Insert(index, track);\r
+                this.audioList.ClearSelection();\r
+                this.audioList.Rows[index].Selected = true;\r
+            }\r
+        }\r
+\r
+        private void MoveTo(bool top)\r
+        {\r
+            if (audioList.SelectedRows.Count == 0) return;\r
+\r
+            DataGridViewRow item = audioList.SelectedRows[0];\r
+            AudioTrack track = item.DataBoundItem as AudioTrack;\r
+            int index = item.Index;\r
+\r
+            if (top) index = 0;\r
+            else index = this.audioList.Rows.Count - 1;\r
+\r
+            if (index < audioList.Rows.Count || (audioList.Rows.Count > index && index >= 0))\r
+            {\r
+                this.AudioTracks.Remove(track);\r
+                this.audioTracks.Insert(index, track);\r
+                this.audioList.ClearSelection();\r
+                this.audioList.Rows[index].Selected = true;\r
             }\r
         }\r
 \r
@@ -683,6 +726,13 @@ namespace Handbrake.Controls
 \r
         private void btn_AdvancedAudio_Click(object sender, EventArgs e)\r
         {\r
+            if (audioList.SelectedRows.Count == 0)\r
+            {\r
+                MessageBox.Show(\r
+                    "Please select an audio track.", "No Track Selected", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+                return;\r
+            }\r
+\r
             if (advancedAudio.IsDisposed)\r
             {\r
                 advancedAudio = new AdvancedAudio { Track = this.audioList.SelectedRows[0].DataBoundItem as AudioTrack };\r
@@ -690,7 +740,5 @@ namespace Handbrake.Controls
 \r
             advancedAudio.Show();\r
         }\r
-\r
-       \r
     }\r
 }
\ No newline at end of file
index a4098cad65b237cef1da1a9441ed9597f42696d7..ae13e3f18ee536731a95fea1f50222eb5df43e5b 100644 (file)
@@ -11,9 +11,7 @@ namespace Handbrake.Functions
     using System.IO;\r
     using System.Linq;\r
     using System.Security.Cryptography;\r
-    using System.Text;\r
     using System.Text.RegularExpressions;\r
-    using System.Threading;\r
     using System.Windows.Forms;\r
     using System.Xml.Serialization;\r
 \r
index 65a1b3e5f6f4cee171a3def56c31f2e3b84afd5f..dd44f6d9c95294623d5b9d8355f2cfacbafdfedd 100644 (file)
     <Compile Include="Model\Preset.cs" />\r
     <Compile Include="Model\QueueTask.cs" />\r
     <Compile Include="Model\Encoding\SubtitleType.cs" />\r
-    <Compile Include="Parsing\AudioTrack.cs" />\r
+    <Compile Include="Parsing\Audio.cs" />\r
     <Compile Include="Parsing\Chapter.cs" />\r
     <Compile Include="Parsing\Source.cs" />\r
     <Compile Include="Parsing\Parser.cs" />\r
index 159beb8e8c8923ee8a98ed7a0045f8e97c44c059..b9ecca97dd96a744d54422edb0c0f5ac5abefba5 100644 (file)
@@ -5,6 +5,8 @@
 \r
 namespace HandBrake.ApplicationServices.Model.Encoding\r
 {\r
+    using HandBrake.ApplicationServices.Parsing;\r
+\r
     /// <summary>\r
     /// An Audio Track for the Audio Panel\r
     /// </summary>\r
@@ -20,6 +22,11 @@ namespace HandBrake.ApplicationServices.Model.Encoding
         ///  The DRC Value\r
         /// </summary>\r
         private double drc;\r
+\r
+        /// <summary>\r
+        /// The Scanned Audio Track\r
+        /// </summary>\r
+        private Audio scannedTrack;\r
         #endregion\r
 \r
         /// <summary>\r
@@ -33,7 +40,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding
             this.SampleRate = 48;\r
             this.Bitrate = 160;\r
             this.DRC = 1;\r
-            this.SourceTrack = "Automatic";\r
+            this.ScannedTrack = new Audio();\r
         }\r
 \r
         /// <summary>\r
@@ -43,16 +50,43 @@ namespace HandBrake.ApplicationServices.Model.Encoding
         {\r
             get\r
             {\r
-                string[] tempSub = SourceTrack.Split(' ');\r
-                int value;\r
-                if (int.TryParse(tempSub[0], out value))\r
+                if (this.ScannedTrack != null)\r
                 {\r
-                    return value;\r
+                    return this.ScannedTrack.TrackNumber;\r
                 }\r
+\r
                 return null;\r
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets or sets the Scanned Audio Tracks\r
+        /// </summary>\r
+        public Audio ScannedTrack\r
+        {\r
+            get\r
+            {\r
+                return this.scannedTrack;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.scannedTrack = value;\r
+                this.OnPropertyChanged("ScannedTrack");\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets the Display Value for this model.\r
+        /// </summary>\r
+        public string TrackDisplay\r
+        {\r
+            get\r
+            {\r
+                return this.ScannedTrack.ToString();\r
+            }\r
+        }\r
+\r
         /// <summary>\r
         /// Gets the The UI display value for sample rate\r
         /// </summary>\r
@@ -60,7 +94,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding
         {\r
             get\r
             {\r
-                return SampleRate == 0 ? "Auto" : SampleRate.ToString();\r
+                return this.SampleRate == 0 ? "Auto" : this.SampleRate.ToString();\r
             }\r
         }\r
 \r
@@ -71,16 +105,10 @@ namespace HandBrake.ApplicationServices.Model.Encoding
         {\r
             get\r
             {\r
-                return Bitrate == 0 ? "Auto" : Bitrate.ToString();\r
+                return this.Bitrate == 0 ? "Auto" : this.Bitrate.ToString();\r
             }\r
         }\r
 \r
-        /// <summary>\r
-        /// Gets or sets the Source Track\r
-        /// Used for display purposes only.\r
-        /// </summary>\r
-        public string SourceTrack { get; set; }\r
-\r
         /// <summary>\r
         /// Gets or sets Audio Mixdown\r
         /// </summary>\r
@@ -110,6 +138,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding
             {\r
                 return this.drc;\r
             }\r
+\r
             set\r
             {\r
                 if (!object.Equals(value, this.drc))\r
@@ -129,6 +158,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding
             {\r
                 return this.gain;\r
             }\r
+\r
             set\r
             {\r
                 if (!object.Equals(value, this.gain))\r
similarity index 77%
rename from win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs
rename to win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs
index 0597f4d1b57014481a1f184db64e2f205b5de2e1..14f807c6cefb6da0bcefac5a22908fb6b34965e6 100644 (file)
@@ -12,17 +12,17 @@ namespace HandBrake.ApplicationServices.Parsing
     /// <summary>\r
     /// An object represending an AudioTrack associated with a Title, in a DVD\r
     /// </summary>\r
-    public class AudioTrack\r
+    public class Audio\r
     {\r
         /// <summary>\r
-        /// Initializes a new instance of the <see cref="AudioTrack"/> class.\r
+        /// Initializes a new instance of the <see cref="Audio"/> class.\r
         /// </summary>\r
-        public AudioTrack()\r
-        {       \r
+        public Audio()\r
+        {\r
         }\r
 \r
         /// <summary>\r
-        /// Initializes a new instance of the <see cref="AudioTrack"/> class.\r
+        /// Initializes a new instance of the <see cref="Audio"/> class.\r
         /// </summary>\r
         /// <param name="trackNumber">\r
         /// The track number.\r
@@ -45,7 +45,7 @@ namespace HandBrake.ApplicationServices.Parsing
         /// <param name="bitrate">\r
         /// The bitrate.\r
         /// </param>\r
-        public AudioTrack(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)\r
+        public Audio(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)\r
         {\r
             this.TrackNumber = trackNumber;\r
             this.Language = language;\r
@@ -56,6 +56,17 @@ namespace HandBrake.ApplicationServices.Parsing
             this.Bitrate = bitrate;\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets A Dummy Not Found Track\r
+        /// </summary>\r
+        public static Audio NoneFound\r
+        {\r
+            get\r
+            {\r
+                return new Audio { Description = "None Found" };\r
+            }\r
+        }\r
+\r
         /// <summary>\r
         /// Gets or sets The track number of this Audio Track\r
         /// </summary>\r
@@ -100,7 +111,7 @@ namespace HandBrake.ApplicationServices.Parsing
         /// <returns>\r
         /// An Audio Track obkect\r
         /// </returns>\r
-        public static AudioTrack Parse(StringReader output)\r
+        public static Audio Parse(StringReader output)\r
         {\r
             string audioTrack = output.ReadLine();\r
             Match m = Regex.Match(audioTrack, @"^    \+ ([0-9]*), ([A-Za-z0-9,\s]*) \((.*)\) \((.*)\)");\r
@@ -115,13 +126,13 @@ namespace HandBrake.ApplicationServices.Parsing
 \r
             if (track.Success)\r
             {\r
-                var thisTrack = new AudioTrack\r
+                var thisTrack = new Audio\r
                                     {\r
-                                        TrackNumber = int.Parse(track.Groups[1].Value.Trim()), \r
-                                        Language = track.Groups[2].Value, \r
+                                        TrackNumber = int.Parse(track.Groups[1].Value.Trim()),\r
+                                        Language = track.Groups[2].Value,\r
                                         Format = m.Groups[3].Value,\r
-                                        Description = subformat, \r
-                                        SampleRate = int.Parse(samplerateVal), \r
+                                        Description = subformat,\r
+                                        SampleRate = int.Parse(samplerateVal),\r
                                         Bitrate = int.Parse(bitrateVal),\r
                                         LanguageCode = iso639_2.Value.Replace("iso639-2: ", string.Empty).Replace(")", string.Empty)\r
                                     };\r
@@ -140,12 +151,12 @@ namespace HandBrake.ApplicationServices.Parsing
         /// <returns>\r
         /// An array of audio tracks\r
         /// </returns>\r
-        public static AudioTrack[] ParseList(StringReader output)\r
+        public static Audio[] ParseList(StringReader output)\r
         {\r
-            var tracks = new List<AudioTrack>();\r
+            var tracks = new List<Audio>();\r
             while (true)\r
             {\r
-                AudioTrack thisTrack = Parse(output);\r
+                Audio thisTrack = Parse(output);\r
                 if (thisTrack != null)\r
                     tracks.Add(thisTrack);\r
                 else\r
@@ -160,10 +171,17 @@ namespace HandBrake.ApplicationServices.Parsing
         /// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>\r
         public override string ToString()\r
         {\r
-            if (Description == null)\r
-                return string.Format("{0} {1} ({2})", TrackNumber, Language, Format);\r
+            if (this.Description == NoneFound.Description)\r
+            {\r
+                return this.Description;\r
+            }\r
+\r
+            if (this.Description == null)\r
+            {\r
+                return string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.Format);\r
+            }\r
 \r
-            return string.Format("{0} {1} ({2}) ({3})", TrackNumber, Language, Format, Description);\r
+            return string.Format("{0} {1} ({2}) ({3})", this.TrackNumber, this.Language, this.Format, this.Description);\r
         }\r
     }\r
 }
\ No newline at end of file
index 2f08eb19e64dff487cbb3581a15c8b53a4ba235f..98c2f02f28d189dfce0918f7f4040bf78f48f0b0 100644 (file)
@@ -30,7 +30,7 @@ namespace HandBrake.ApplicationServices.Parsing
         /// </summary>\r
         public Title()\r
         {\r
-            this.AudioTracks = new List<AudioTrack>();\r
+            this.AudioTracks = new List<Audio>();\r
             this.Chapters = new List<Chapter>();\r
             this.Subtitles = new List<Subtitle>();\r
         }\r
@@ -45,7 +45,7 @@ namespace HandBrake.ApplicationServices.Parsing
         /// <summary>\r
         /// Gets or sets a Collection of audio tracks associated with this Title\r
         /// </summary>\r
-        public List<AudioTrack> AudioTracks { get; set; }\r
+        public List<Audio> AudioTracks { get; set; }\r
 \r
         /// <summary>\r
         /// Gets or sets a Collection of subtitles associated with this Title\r
@@ -193,7 +193,7 @@ namespace HandBrake.ApplicationServices.Parsing
 \r
             thisTitle.Chapters.AddRange(Chapter.ParseList(output));\r
 \r
-            thisTitle.AudioTracks.AddRange(AudioTrack.ParseList(output));\r
+            thisTitle.AudioTracks.AddRange(Audio.ParseList(output));\r
 \r
             thisTitle.Subtitles.AddRange(Subtitle.ParseList(output));\r
 \r
index 6f200e447f9df46ff26dbe34f816d5bc90dcd19d..1d93162a1546c97b8e76d47ff302ccdef7f8b061 100644 (file)
@@ -16,7 +16,7 @@ namespace HandBrake.ApplicationServices.Services
     using HandBrake.ApplicationServices.Services.Interfaces;\r
     using HandBrake.Interop;\r
 \r
-    using AudioTrack = HandBrake.ApplicationServices.Parsing.AudioTrack;\r
+    using AudioTrack = HandBrake.ApplicationServices.Parsing.Audio;\r
     using Cropping = HandBrake.ApplicationServices.Model.Encoding.Cropping;\r
     using ScanProgressEventArgs = HandBrake.Interop.ScanProgressEventArgs;\r
     using Size = System.Drawing.Size;\r
index 752141bf0c5c6442ad71358b1bd6c3cf473aa4ea..86cae01b5ce4bbdd2fe9ecea0cba4d50a33e18ac 100644 (file)
@@ -68,7 +68,7 @@ namespace HandBrake.ApplicationServices.Utilities
                             track.SampleRate = double.Parse(value);\r
                             break;\r
                         case "AudioTrack":\r
-                            track.SourceTrack = value;\r
+                           //track.SourceTrack = value;\r
                             break;\r
                         case "AudioTrackDRCSlider":\r
                             track.DRC = double.Parse(value);\r
index 62de5d6d6b5fa5c01faef7d3e2bd16ac7fbfdeed..ce558107e34baede6ed992a534e201335f4463e5 100644 (file)
@@ -361,9 +361,9 @@ namespace HandBrake.ApplicationServices.Utilities
                 for (int x = 0; x < encoderCount; x++)\r
                 {\r
                     AudioTrack track = new AudioTrack();\r
-                    if (trackData != null)\r
-                        if (trackData.Length >= (x + 1)) // Audio Track\r
-                            track.SourceTrack = trackData[x].Trim();\r
+                    //if (trackData != null)\r
+                    //    if (trackData.Length >= (x + 1)) // Audio Track\r
+                    //        track.ScannedTrack = trackData[x].Trim();\r
 \r
                     if (trackMixes != null)\r
                         if (trackMixes.Length >= (x + 1)) // Audio Mix\r