OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 10 Nov 2007 17:37:22 +0000 (17:37 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 10 Nov 2007 17:37:22 +0000 (17:37 +0000)
- New PresetLoader function / Query parser completed.
- Splash screen now has text status label ( Thanks to xGraphite)
- Fixed a localisation issue. (thanks sun)
- Removed a bit of redundant code in Functions.CLI
- Fixed small issue with presets not setting mp4 extension when required.
- Misc other small changes.

git-svn-id: svn://localhost/HandBrake/trunk@1054 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Functions/CLI.cs
win/C#/Functions/QueryParser.cs
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs

index b3ba601..5481485 100644 (file)
@@ -29,34 +29,7 @@ namespace Handbrake.Functions
                 hbProc.StartInfo.RedirectStandardError = stderr;\r
                 hbProc.StartInfo.UseShellExecute = useShellExec;\r
                 hbProc.StartInfo.CreateNoWindow = noWindow;\r
-                hbProc.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; // Why doesn't this work??\r
-                hbProc.Start();\r
-                \r
-\r
-                // Set the process Priority\r
-                switch (Properties.Settings.Default.processPriority)\r
-                {\r
-                    case "Realtime":\r
-                        hbProc.PriorityClass = ProcessPriorityClass.RealTime;\r
-                        break;\r
-                    case "High":\r
-                        hbProc.PriorityClass = ProcessPriorityClass.High;\r
-                        break;\r
-                    case "Above Normal":\r
-                        hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;\r
-                        break;\r
-                    case "Normal":\r
-                        hbProc.PriorityClass = ProcessPriorityClass.Normal;\r
-                        break;\r
-                    case "Low":\r
-                        hbProc.PriorityClass = ProcessPriorityClass.Idle;\r
-                        break;\r
-                    default:\r
-                        hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;\r
-                        break;\r
-                }\r
-\r
-                \r
+                hbProc.Start();   \r
             }\r
             catch\r
             {\r
index 8e4469b..a6044b2 100644 (file)
@@ -51,12 +51,12 @@ namespace Handbrake.Functions
             }\r
         }\r
 \r
-        private string q_chaptersStart;\r
+        private int q_chaptersStart;\r
         /// <summary>\r
-        /// Returns an String\r
+        /// Returns an Int\r
         /// DVD Chapter number or chapter range.\r
         /// </summary>\r
-        public string DVDChapterStart\r
+        public int DVDChapterStart\r
         {\r
             get\r
             {\r
@@ -64,12 +64,12 @@ namespace Handbrake.Functions
             }\r
         }\r
 \r
-        private string q_chaptersFinish;\r
+        private int q_chaptersFinish;\r
         /// <summary>\r
-        /// Returns an String\r
+        /// Returns an Int\r
         /// DVD Chapter number or chapter range.\r
         /// </summary>\r
-        public string DVDChapterFinish\r
+        public int DVDChapterFinish\r
         {\r
             get\r
             {\r
@@ -105,7 +105,7 @@ namespace Handbrake.Functions
 \r
         private int q_videoWidth;\r
         /// <summary>\r
-        /// Returns an Integer\r
+        /// Returns an Int\r
         /// The selected Width for the encoding.\r
         /// </summary>\r
         public int Width\r
@@ -118,7 +118,7 @@ namespace Handbrake.Functions
 \r
         private int q_videoHeight;\r
         /// <summary>\r
-        /// Returns an Integer\r
+        /// Returns an Int\r
         /// The selected Height for the encoding.\r
         /// </summary>\r
         public int Height\r
@@ -463,14 +463,13 @@ namespace Handbrake.Functions
         {\r
             QueryParser thisQuery = new QueryParser();\r
 \r
+            #region reg exp \r
             //Source\r
             Regex r1 = new Regex(@"(-i)(?:\s\"")([a-zA-Z0-9:\\\s\.]+)(?:\"")");\r
             Match source = r1.Match(input.Replace('"', '\"'));\r
             Match title = Regex.Match(input, @"-t ([0-9]*)");\r
             Match chapters = Regex.Match(input, @"-c ([0-9-]*)");\r
 \r
-           \r
-\r
             //Destination\r
             Regex r2 = new Regex(@"(-o)(?:\s\"")([a-zA-Z0-9:\\\s\.]+)(?:\"")");\r
             Match destination = r2.Match(input.Replace('"', '\"'));\r
@@ -480,8 +479,8 @@ namespace Handbrake.Functions
             Match audioEncoder = Regex.Match(input, @"-E ([a-zA-Z0-9]*)");\r
 \r
             //Picture Settings Tab\r
-            Match deinterlace = Regex.Match(input, @"--deinterlace=([0-9:-]*)");  // DOES NOT WORK. Needs Fixed\r
-            Match denoise = Regex.Match(input, @"--denoise=([0-9:]*)");\r
+            Match deinterlace = Regex.Match(input, @"--deinterlace=([a-z]*)");\r
+            Match denoise = Regex.Match(input, @"--denoise=([a-z]*)");\r
             Match deblock = Regex.Match(input, @"--deblock");\r
             Match detelecine = Regex.Match(input, @"--detelecine");\r
             Match anamorphic = Regex.Match(input, @"-p ");\r
@@ -503,7 +502,7 @@ namespace Handbrake.Functions
             Match subtitles = Regex.Match(input, @"-s ([0-9]*)");\r
             Match audioBitrate = Regex.Match(input, @"-B ([0-9]*)");\r
             Match audioSampleRate = Regex.Match(input, @"-R ([0-9.]*)");\r
-            Match audioChannelsMix = Regex.Match(input, @"-6 ([a-zA-Z0-9]*)");\r
+            Match audioChannelsMix = Regex.Match(input, @"-6 ([0-9a-z0-9]*)");  // 1 -6 dpl2 // Broken\r
             Match audioChannel = Regex.Match(input, @"-a ([0-9]*)");\r
 \r
             //H264 Tab\r
@@ -511,80 +510,247 @@ namespace Handbrake.Functions
             \r
             //Program Options\r
             Match verbose = Regex.Match(input, @"-v");\r
-             \r
-            \r
-            // ### NOTES ###\r
-            // May be an idea to add additional options such as CPU etc later.\r
-            // Need to remove all the tags e.g -x -w etc\r
-            // Need to split up crop options + chapters into seperate items\r
+            #endregion\r
 \r
             try\r
             {\r
-\r
+                //\r
+                // Source\r
+                //\r
+                #region Source Tab\r
+   \r
                 thisQuery.q_source = source.ToString().Replace("-i ", "").Replace("\"", "");\r
-                if (title.ToString() != "")\r
-                         thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", ""));\r
-                \r
-                string[] actTitles = new string[2];\r
-                actTitles = chapters.ToString().Replace("-c ", "").Split('-');\r
-\r
-                thisQuery.q_chaptersStart = actTitles[0];\r
-                thisQuery.q_chaptersFinish = actTitles[1];\r
-\r
-                //Destination\r
-                thisQuery.q_destination = destination.ToString().Replace("-o ","").Replace("\"", "");\r
-                thisQuery.q_videoEncoder = videoEncoder.ToString().Replace("-e ", "");\r
-                thisQuery.q_audioEncoder = audioEncoder.ToString().Replace("-E ", "");\r
-                if (width.ToString() != "")\r
+                if (title.Success != false)\r
+                {\r
+                    thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", ""));\r
+                }\r
+\r
+                if (chapters.Success != false)\r
+                {\r
+                     string[] actTitles = new string[2];\r
+                     actTitles = chapters.ToString().Replace("-c ", "").Split('-');\r
+                     thisQuery.q_chaptersStart = int.Parse(actTitles[0]);\r
+                     thisQuery.q_chaptersFinish = int.Parse(actTitles[1]);\r
+                 }\r
+                #endregion\r
+\r
+                //\r
+                // Destination\r
+                //\r
+                #region Destination\r
+                 thisQuery.q_destination = destination.ToString().Replace("-o ","").Replace("\"", "");\r
+\r
+                 string videoEncoderConvertion;\r
+                 string audioEncoderConvertion;\r
+\r
+                 videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");\r
+                 switch (videoEncoderConvertion)\r
+                 {\r
+                    case "ffmpeg":\r
+                        videoEncoderConvertion = "Mpeg 4";\r
+                        break;\r
+                    case "xvid":\r
+                        videoEncoderConvertion = "Xvid";\r
+                        break;\r
+                    case "x264":\r
+                        videoEncoderConvertion = "H.264";\r
+                        break;\r
+                    case "x264b13":\r
+                        videoEncoderConvertion = "H.264 Baseline 1.3";\r
+                        break;\r
+                    case "x264b30":\r
+                        videoEncoderConvertion = "H.264 (iPod)";\r
+                        break;\r
+                    default:\r
+                        videoEncoderConvertion = "H.264";\r
+                        break;\r
+                 }\r
+                 thisQuery.q_videoEncoder = videoEncoderConvertion;\r
+\r
+                 audioEncoderConvertion = audioEncoder.ToString().Replace("-E ", "");\r
+                 switch (audioEncoderConvertion)\r
+                 {\r
+                    case "faac":\r
+                        audioEncoderConvertion = "AAC";\r
+                        break;\r
+                    case "lame":\r
+                        audioEncoderConvertion = "MP3";\r
+                        break;\r
+                    case "vorbis":\r
+                        audioEncoderConvertion = "Vorbis";\r
+                        break;\r
+                    case "ac3":\r
+                        audioEncoderConvertion = "AC3";\r
+                        break;\r
+                    default:\r
+                        audioEncoderConvertion = "AAC";\r
+                        break;\r
+                 }\r
+                 thisQuery.q_audioEncoder =audioEncoderConvertion;\r
+\r
+\r
+                 if (width.Success != false)\r
+                 {\r
                     thisQuery.q_videoWidth = int.Parse(width.ToString().Replace("-w ", ""));\r
-                if (height.ToString() != "")\r
+                 }\r
+                 if (height.Success != false)\r
+                 {\r
                     thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", ""));\r
+                 }\r
+                 #endregion\r
 \r
+                //\r
                 //Picture Settings Tab\r
-                thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");\r
-                string[] actCropValues = new string[3];\r
-                actCropValues = thisQuery.q_cropValues.Split(':');\r
-                thisQuery.q_croptop = actCropValues[0];\r
-                thisQuery.q_cropbottom = actCropValues[3];\r
-                thisQuery.q_cropLeft = actCropValues[2];\r
-                thisQuery.q_cropRight = actCropValues[1];\r
-\r
-\r
-                thisQuery.q_detelecine = detelecine.Success;\r
-                thisQuery.q_deBlock = deblock.Success;\r
-                thisQuery.q_deinterlace = deinterlace.ToString().Replace("--deinterlace=","").Replace("\"", "");\r
-                thisQuery.q_denoise = denoise.ToString().Replace("--denoise=","");\r
-                thisQuery.q_anamorphic = anamorphic.Success;\r
-                thisQuery.q_chapterMarkers = chapterMarkers.Success;\r
-\r
+                //\r
+                #region Picture Tab\r
+                 if (crop.Success != false)\r
+                 {\r
+                    thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");\r
+                    string[] actCropValues = new string[3];\r
+                    actCropValues = thisQuery.q_cropValues.Split(':');\r
+                    thisQuery.q_croptop = actCropValues[0];\r
+                    thisQuery.q_cropbottom = actCropValues[1];\r
+                    thisQuery.q_cropLeft = actCropValues[2];\r
+                    thisQuery.q_cropRight = actCropValues[3];\r
+                 }\r
+\r
+                 thisQuery.q_detelecine = detelecine.Success;\r
+                 thisQuery.q_deBlock = deblock.Success;\r
+\r
+                 if (deinterlace.Success != false)\r
+                 {\r
+                     switch (deinterlace.ToString().Replace("--deinterlace=", ""))\r
+                     {\r
+                         case "fast":\r
+                             thisQuery.q_deinterlace = "Original (Fast)";\r
+                             break;\r
+                         case "slow":\r
+                             thisQuery.q_deinterlace = "yadif (Slow)";\r
+                             break;\r
+                         case "slower":\r
+                             thisQuery.q_deinterlace = "yadif + mcdeint (Slower)";\r
+                             break;\r
+                         case "slowest":\r
+                             thisQuery.q_deinterlace = "yadif + mcdeint (Slowest)";\r
+                             break;\r
+                         default:\r
+                             thisQuery.q_deinterlace = "None";\r
+                             break;\r
+                     }\r
+                 }\r
+                 \r
+                 if (denoise.Success != false)\r
+                 {\r
+                     switch (denoise.ToString().Replace("--denoise=", ""))\r
+                     {\r
+                         case "weak":\r
+                             thisQuery.q_denoise = "Weak";\r
+                             break;\r
+                         case "medium":\r
+                             thisQuery.q_denoise = "Medium";\r
+                             break;\r
+                         case "strong":\r
+                             thisQuery.q_denoise = "Strong";\r
+                             break;\r
+                         default:\r
+                             thisQuery.q_denoise = "None";\r
+                             break;\r
+                     }\r
+                    \r
+                 }\r
+                 thisQuery.q_anamorphic = anamorphic.Success;\r
+                 thisQuery.q_chapterMarkers = chapterMarkers.Success;\r
+                 #endregion\r
+\r
+                //\r
                 //Video Settings Tab\r
+                //\r
+                #region Video\r
                 thisQuery.q_grayscale = grayscale.Success;\r
                 thisQuery.q_twoPass = twoPass.Success;\r
                 thisQuery.q_turboFirst = turboFirstPass.Success;\r
                 thisQuery.q_largeMp4 = largerMp4.Success;\r
-                thisQuery.q_videoFramerate = videoFramerate.ToString().Replace("-r ","");\r
-                thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ","");\r
-                thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ","");\r
+                if (videoFramerate.Success != false)\r
+                {\r
+                    thisQuery.q_videoFramerate = videoFramerate.ToString().Replace("-r ", "");\r
+                }\r
+                if (videoBitrate.Success != false)\r
+                {\r
+                    thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ", "");\r
+                }\r
+                if (videoFilesize.Success != false)\r
+                {\r
+                    thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ", "");\r
+                }\r
 \r
                 double qConvert = 0;\r
-                if (videoQuality.ToString().Replace("-q ", "") != null)\r
+                if (videoQuality.Success != false)\r
                 {\r
                     qConvert = double.Parse(videoQuality.ToString().Replace("-q ", "")) * 100;\r
                     thisQuery.q_videoQuality = int.Parse(qConvert.ToString());\r
                 }\r
                 thisQuery.q_crf = CRF.Success;\r
+                #endregion\r
 \r
+                //\r
                 //Audio Settings Tab\r
-                thisQuery.q_audioBitrate = audioBitrate.ToString().Replace("-B ", "");\r
-                thisQuery.q_audioSamplerate = audioSampleRate.ToString().Replace("-R ","");\r
-                thisQuery.q_audioTrack1 = audioChannel.ToString().Replace("-a ", "");\r
-                thisQuery.q_audioTrackMix = audioChannelsMix.ToString().Replace("-6 ", "");\r
-                thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");\r
+                //\r
+                #region Audio\r
+                if (audioBitrate.Success != false)\r
+                {\r
+                    thisQuery.q_audioBitrate = audioBitrate.ToString().Replace("-B ", "");\r
+                }\r
+                if (audioSampleRate.Success != false)\r
+                {\r
+                    thisQuery.q_audioSamplerate = audioSampleRate.ToString().Replace("-R ", "");\r
+                }\r
+                if (audioChannel.Success != false)\r
+                {\r
+                    thisQuery.q_audioTrack1 = audioChannel.ToString().Replace("-a ", "");\r
+                }\r
+     \r
+                if (audioChannelsMix.Success != false)\r
+                {\r
+                    switch (audioChannelsMix.ToString().Replace("-6 ", "").Replace(" ",""))\r
+                    {\r
+                        case "mono":\r
+                            thisQuery.q_audioTrackMix = "Mono";\r
+                            break;\r
+                        case "stereo":\r
+                            thisQuery.q_audioTrackMix = "Stereo";\r
+                            break;\r
+                        case "dpl1":\r
+                            thisQuery.q_audioTrackMix = "Dolby Surround";\r
+                            break;\r
+                        case "dpl2":\r
+                            thisQuery.q_audioTrackMix = "Dolby Pro Logic II";\r
+                            break;\r
+                        case "6ch":\r
+                            thisQuery.q_audioTrackMix = "6 Channel Discrete";\r
+                            break;\r
+                        default:\r
+                            thisQuery.q_audioTrackMix = "Automatic2";\r
+                            break;\r
+                    }\r
+                   \r
+                }\r
+                if (subtitles.Success != false)\r
+                {\r
+                    thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");\r
+                }\r
+                #endregion\r
 \r
+                //\r
                 //H264 Tab\r
-                thisQuery.q_h264 = x264.ToString().Replace("-x ", "");\r
+                //\r
+                if (x264.Success != false)\r
+                {\r
+                    thisQuery.q_h264 = x264.ToString().Replace("-x ", "");\r
+                }\r
 \r
+                //\r
                 //Progam Options\r
+                //\r
                 thisQuery.q_verbose = verbose.Success;\r
             }\r
             catch (Exception exc)\r
index de110b9..08201d0 100644 (file)
@@ -60,7 +60,6 @@ namespace Handbrake
             this.drp_subtitle = new System.Windows.Forms.ComboBox();\r
             this.btn_presets = new System.Windows.Forms.Button();\r
             this.btn_setDefault = new System.Windows.Forms.Button();\r
-            this.button1 = new System.Windows.Forms.Button();\r
             this.DVD_Open = new System.Windows.Forms.FolderBrowserDialog();\r
             this.File_Open = new System.Windows.Forms.OpenFileDialog();\r
             this.ISO_Open = new System.Windows.Forms.OpenFileDialog();\r
@@ -176,9 +175,6 @@ namespace Handbrake
             this.text_right = new System.Windows.Forms.TextBox();\r
             this.text_left = new System.Windows.Forms.TextBox();\r
             this.advancedOptions = new System.Windows.Forms.TabControl();\r
-            this.tabPage4 = new System.Windows.Forms.TabPage();\r
-            this.label26 = new System.Windows.Forms.Label();\r
-            this.label25 = new System.Windows.Forms.Label();\r
             this.groupBox_dest = new System.Windows.Forms.GroupBox();\r
             this.groupBox2 = new System.Windows.Forms.GroupBox();\r
             this.listview_presets = new System.Windows.Forms.ListView();\r
@@ -194,7 +190,6 @@ namespace Handbrake
             this.TabPage3.SuspendLayout();\r
             this.TabPage1.SuspendLayout();\r
             this.advancedOptions.SuspendLayout();\r
-            this.tabPage4.SuspendLayout();\r
             this.groupBox_dest.SuspendLayout();\r
             this.groupBox2.SuspendLayout();\r
             this.SuspendLayout();\r
@@ -202,6 +197,7 @@ namespace Handbrake
             // Label38\r
             // \r
             Label38.AutoSize = true;\r
+            Label38.BackColor = System.Drawing.Color.Transparent;\r
             Label38.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             Label38.Location = new System.Drawing.Point(304, 67);\r
             Label38.Name = "Label38";\r
@@ -392,6 +388,7 @@ namespace Handbrake
             // CheckCRF\r
             // \r
             this.CheckCRF.AutoSize = true;\r
+            this.CheckCRF.BackColor = System.Drawing.Color.Transparent;\r
             this.CheckCRF.Enabled = false;\r
             this.CheckCRF.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.CheckCRF.Location = new System.Drawing.Point(446, 133);\r
@@ -400,7 +397,7 @@ namespace Handbrake
             this.CheckCRF.TabIndex = 67;\r
             this.CheckCRF.Text = "Constant Rate Factor";\r
             this.ToolTip.SetToolTip(this.CheckCRF, "Constant Rate Factor");\r
-            this.CheckCRF.UseVisualStyleBackColor = true;\r
+            this.CheckCRF.UseVisualStyleBackColor = false;\r
             // \r
             // QueryEditorText\r
             // \r
@@ -466,6 +463,7 @@ namespace Handbrake
             // check_largeFile\r
             // \r
             this.check_largeFile.AutoSize = true;\r
+            this.check_largeFile.BackColor = System.Drawing.Color.Transparent;\r
             this.check_largeFile.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.check_largeFile.Location = new System.Drawing.Point(16, 107);\r
             this.check_largeFile.Name = "check_largeFile";\r
@@ -473,12 +471,13 @@ namespace Handbrake
             this.check_largeFile.TabIndex = 56;\r
             this.check_largeFile.Text = "Larger mp4 Files (> 4GB)";\r
             this.ToolTip.SetToolTip(this.check_largeFile, "Allows creation of mp4 files greater than 4GB.");\r
-            this.check_largeFile.UseVisualStyleBackColor = true;\r
+            this.check_largeFile.UseVisualStyleBackColor = false;\r
             this.check_largeFile.CheckedChanged += new System.EventHandler(this.check_largeFile_CheckedChanged);\r
             // \r
             // check_turbo\r
             // \r
             this.check_turbo.AutoSize = true;\r
+            this.check_turbo.BackColor = System.Drawing.Color.Transparent;\r
             this.check_turbo.Enabled = false;\r
             this.check_turbo.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.check_turbo.Location = new System.Drawing.Point(37, 84);\r
@@ -487,7 +486,7 @@ namespace Handbrake
             this.check_turbo.TabIndex = 55;\r
             this.check_turbo.Text = "Turbo 1st Pass";\r
             this.ToolTip.SetToolTip(this.check_turbo, "Makes the first pass of a 2 pass encode faster.");\r
-            this.check_turbo.UseVisualStyleBackColor = true;\r
+            this.check_turbo.UseVisualStyleBackColor = false;\r
             // \r
             // drp_videoFramerate\r
             // \r
@@ -590,23 +589,6 @@ namespace Handbrake
             this.btn_setDefault.UseVisualStyleBackColor = false;\r
             this.btn_setDefault.Click += new System.EventHandler(this.btn_setDefault_Click);\r
             // \r
-            // button1\r
-            // \r
-            this.button1.BackColor = System.Drawing.SystemColors.ControlLight;\r
-            this.button1.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
-            this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
-            this.button1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.button1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
-            this.button1.Location = new System.Drawing.Point(16, 78);\r
-            this.button1.Name = "button1";\r
-            this.button1.Size = new System.Drawing.Size(114, 22);\r
-            this.button1.TabIndex = 112;\r
-            this.button1.TabStop = false;\r
-            this.button1.Text = "Test Query Parser";\r
-            this.ToolTip.SetToolTip(this.button1, "Open a preset which you have saved.");\r
-            this.button1.UseVisualStyleBackColor = false;\r
-            this.button1.Click += new System.EventHandler(this.button1_Click);\r
-            // \r
             // DVD_Open\r
             // \r
             this.DVD_Open.Description = "Select the \"VIDEO_TS\" folder from your DVD Drvie.";\r
@@ -1138,10 +1120,10 @@ namespace Handbrake
             this.TabPage6.Size = new System.Drawing.Size(639, 215);\r
             this.TabPage6.TabIndex = 6;\r
             this.TabPage6.Text = "Query Editor";\r
-            this.TabPage6.UseVisualStyleBackColor = true;\r
             // \r
             // btn_copy\r
             // \r
+            this.btn_copy.BackColor = System.Drawing.SystemColors.ControlLight;\r
             this.btn_copy.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
             this.btn_copy.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
             this.btn_copy.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
@@ -1151,12 +1133,13 @@ namespace Handbrake
             this.btn_copy.Size = new System.Drawing.Size(134, 23);\r
             this.btn_copy.TabIndex = 92;\r
             this.btn_copy.Text = "Copy to Clipboard";\r
-            this.btn_copy.UseVisualStyleBackColor = true;\r
+            this.btn_copy.UseVisualStyleBackColor = false;\r
             this.btn_copy.Click += new System.EventHandler(this.btn_copy_Click);\r
             // \r
             // label23\r
             // \r
             this.label23.AutoSize = true;\r
+            this.label23.BackColor = System.Drawing.Color.Transparent;\r
             this.label23.Location = new System.Drawing.Point(13, 186);\r
             this.label23.Name = "label23";\r
             this.label23.Size = new System.Drawing.Size(403, 13);\r
@@ -1166,6 +1149,7 @@ namespace Handbrake
             // Label7\r
             // \r
             this.Label7.AutoSize = true;\r
+            this.Label7.BackColor = System.Drawing.Color.Transparent;\r
             this.Label7.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label7.Location = new System.Drawing.Point(13, 13);\r
             this.Label7.Name = "Label7";\r
@@ -1176,6 +1160,7 @@ namespace Handbrake
             // Label39\r
             // \r
             this.Label39.AutoSize = true;\r
+            this.Label39.BackColor = System.Drawing.Color.Transparent;\r
             this.Label39.Location = new System.Drawing.Point(13, 34);\r
             this.Label39.Name = "Label39";\r
             this.Label39.Size = new System.Drawing.Size(331, 13);\r
@@ -1184,6 +1169,7 @@ namespace Handbrake
             // \r
             // btn_ClearQuery\r
             // \r
+            this.btn_ClearQuery.BackColor = System.Drawing.SystemColors.ControlLight;\r
             this.btn_ClearQuery.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
             this.btn_ClearQuery.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
             this.btn_ClearQuery.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
@@ -1193,11 +1179,12 @@ namespace Handbrake
             this.btn_ClearQuery.Size = new System.Drawing.Size(79, 23);\r
             this.btn_ClearQuery.TabIndex = 95;\r
             this.btn_ClearQuery.Text = "Clear";\r
-            this.btn_ClearQuery.UseVisualStyleBackColor = true;\r
+            this.btn_ClearQuery.UseVisualStyleBackColor = false;\r
             this.btn_ClearQuery.Click += new System.EventHandler(this.btn_ClearQuery_Click);\r
             // \r
             // GenerateQuery\r
             // \r
+            this.GenerateQuery.BackColor = System.Drawing.SystemColors.ControlLight;\r
             this.GenerateQuery.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
             this.GenerateQuery.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
             this.GenerateQuery.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
@@ -1207,7 +1194,7 @@ namespace Handbrake
             this.GenerateQuery.Size = new System.Drawing.Size(154, 23);\r
             this.GenerateQuery.TabIndex = 91;\r
             this.GenerateQuery.Text = "Generate Query Now";\r
-            this.GenerateQuery.UseVisualStyleBackColor = true;\r
+            this.GenerateQuery.UseVisualStyleBackColor = false;\r
             this.GenerateQuery.Click += new System.EventHandler(this.GenerateQuery_Click);\r
             // \r
             // h264Tab\r
@@ -1226,11 +1213,11 @@ namespace Handbrake
             this.h264Tab.Size = new System.Drawing.Size(639, 215);\r
             this.h264Tab.TabIndex = 5;\r
             this.h264Tab.Text = "H.264";\r
-            this.h264Tab.UseVisualStyleBackColor = true;\r
             // \r
             // Label43\r
             // \r
             this.Label43.AutoSize = true;\r
+            this.Label43.BackColor = System.Drawing.Color.Transparent;\r
             this.Label43.Location = new System.Drawing.Point(78, 187);\r
             this.Label43.Name = "Label43";\r
             this.Label43.Size = new System.Drawing.Size(158, 13);\r
@@ -1251,6 +1238,7 @@ namespace Handbrake
             // Label95\r
             // \r
             this.Label95.AutoSize = true;\r
+            this.Label95.BackColor = System.Drawing.Color.Transparent;\r
             this.Label95.Location = new System.Drawing.Point(13, 168);\r
             this.Label95.Name = "Label95";\r
             this.Label95.Size = new System.Drawing.Size(387, 13);\r
@@ -1259,6 +1247,7 @@ namespace Handbrake
             // \r
             // btn_h264Clear\r
             // \r
+            this.btn_h264Clear.BackColor = System.Drawing.SystemColors.ControlLight;\r
             this.btn_h264Clear.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
             this.btn_h264Clear.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
             this.btn_h264Clear.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
@@ -1268,12 +1257,13 @@ namespace Handbrake
             this.btn_h264Clear.Size = new System.Drawing.Size(79, 23);\r
             this.btn_h264Clear.TabIndex = 88;\r
             this.btn_h264Clear.Text = "Clear";\r
-            this.btn_h264Clear.UseVisualStyleBackColor = true;\r
+            this.btn_h264Clear.UseVisualStyleBackColor = false;\r
             this.btn_h264Clear.Click += new System.EventHandler(this.btn_h264Clear_Click);\r
             // \r
             // Label90\r
             // \r
             this.Label90.AutoSize = true;\r
+            this.Label90.BackColor = System.Drawing.Color.Transparent;\r
             this.Label90.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label90.Location = new System.Drawing.Point(13, 13);\r
             this.Label90.Name = "Label90";\r
@@ -1284,6 +1274,7 @@ namespace Handbrake
             // Label92\r
             // \r
             this.Label92.AutoSize = true;\r
+            this.Label92.BackColor = System.Drawing.Color.Transparent;\r
             this.Label92.Location = new System.Drawing.Point(13, 41);\r
             this.Label92.Name = "Label92";\r
             this.Label92.Size = new System.Drawing.Size(370, 26);\r
@@ -1315,11 +1306,11 @@ namespace Handbrake
             this.TabPage2.Size = new System.Drawing.Size(639, 215);\r
             this.TabPage2.TabIndex = 3;\r
             this.TabPage2.Text = "Audio && Subtitles";\r
-            this.TabPage2.UseVisualStyleBackColor = true;\r
             // \r
             // Label19\r
             // \r
             this.Label19.AutoSize = true;\r
+            this.Label19.BackColor = System.Drawing.Color.Transparent;\r
             this.Label19.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label19.Location = new System.Drawing.Point(339, 13);\r
             this.Label19.Name = "Label19";\r
@@ -1330,6 +1321,7 @@ namespace Handbrake
             // Label21\r
             // \r
             this.Label21.AutoSize = true;\r
+            this.Label21.BackColor = System.Drawing.Color.Transparent;\r
             this.Label21.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label21.Location = new System.Drawing.Point(403, 63);\r
             this.Label21.Name = "Label21";\r
@@ -1340,6 +1332,7 @@ namespace Handbrake
             // Label20\r
             // \r
             this.Label20.AutoSize = true;\r
+            this.Label20.BackColor = System.Drawing.Color.Transparent;\r
             this.Label20.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label20.Location = new System.Drawing.Point(339, 39);\r
             this.Label20.Name = "Label20";\r
@@ -1350,6 +1343,7 @@ namespace Handbrake
             // Label29\r
             // \r
             this.Label29.AutoSize = true;\r
+            this.Label29.BackColor = System.Drawing.Color.Transparent;\r
             this.Label29.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label29.Location = new System.Drawing.Point(135, 151);\r
             this.Label29.Name = "Label29";\r
@@ -1390,6 +1384,7 @@ namespace Handbrake
             // Label14\r
             // \r
             this.Label14.AutoSize = true;\r
+            this.Label14.BackColor = System.Drawing.Color.Transparent;\r
             this.Label14.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label14.Location = new System.Drawing.Point(13, 130);\r
             this.Label14.Name = "Label14";\r
@@ -1400,6 +1395,7 @@ namespace Handbrake
             // Label5\r
             // \r
             this.Label5.AutoSize = true;\r
+            this.Label5.BackColor = System.Drawing.Color.Transparent;\r
             this.Label5.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label5.Location = new System.Drawing.Point(13, 13);\r
             this.Label5.Name = "Label5";\r
@@ -1418,6 +1414,7 @@ namespace Handbrake
             // Label16\r
             // \r
             this.Label16.AutoSize = true;\r
+            this.Label16.BackColor = System.Drawing.Color.Transparent;\r
             this.Label16.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label16.Location = new System.Drawing.Point(13, 40);\r
             this.Label16.Name = "Label16";\r
@@ -1428,6 +1425,7 @@ namespace Handbrake
             // Label32\r
             // \r
             this.Label32.AutoSize = true;\r
+            this.Label32.BackColor = System.Drawing.Color.Transparent;\r
             this.Label32.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label32.Location = new System.Drawing.Point(13, 100);\r
             this.Label32.Name = "Label32";\r
@@ -1438,6 +1436,7 @@ namespace Handbrake
             // Label18\r
             // \r
             this.Label18.AutoSize = true;\r
+            this.Label18.BackColor = System.Drawing.Color.Transparent;\r
             this.Label18.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label18.Location = new System.Drawing.Point(13, 70);\r
             this.Label18.Name = "Label18";\r
@@ -1471,22 +1470,23 @@ namespace Handbrake
             this.TabPage3.Size = new System.Drawing.Size(639, 215);\r
             this.TabPage3.TabIndex = 2;\r
             this.TabPage3.Text = "Video Settings";\r
-            this.TabPage3.UseVisualStyleBackColor = true;\r
             // \r
             // check_grayscale\r
             // \r
             this.check_grayscale.AutoSize = true;\r
+            this.check_grayscale.BackColor = System.Drawing.Color.Transparent;\r
             this.check_grayscale.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.check_grayscale.Location = new System.Drawing.Point(16, 38);\r
             this.check_grayscale.Name = "check_grayscale";\r
             this.check_grayscale.Size = new System.Drawing.Size(138, 17);\r
             this.check_grayscale.TabIndex = 53;\r
             this.check_grayscale.Text = "Grayscale Encoding";\r
-            this.check_grayscale.UseVisualStyleBackColor = true;\r
+            this.check_grayscale.UseVisualStyleBackColor = false;\r
             // \r
             // lbl_largeMp4Warning\r
             // \r
             this.lbl_largeMp4Warning.AutoSize = true;\r
+            this.lbl_largeMp4Warning.BackColor = System.Drawing.Color.Transparent;\r
             this.lbl_largeMp4Warning.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.lbl_largeMp4Warning.Location = new System.Drawing.Point(35, 127);\r
             this.lbl_largeMp4Warning.Name = "lbl_largeMp4Warning";\r
@@ -1497,6 +1497,7 @@ namespace Handbrake
             // Label22\r
             // \r
             this.Label22.AutoSize = true;\r
+            this.Label22.BackColor = System.Drawing.Color.Transparent;\r
             this.Label22.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label22.Location = new System.Drawing.Point(13, 13);\r
             this.Label22.Name = "Label22";\r
@@ -1507,18 +1508,20 @@ namespace Handbrake
             // check_2PassEncode\r
             // \r
             this.check_2PassEncode.AutoSize = true;\r
+            this.check_2PassEncode.BackColor = System.Drawing.Color.Transparent;\r
             this.check_2PassEncode.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.check_2PassEncode.Location = new System.Drawing.Point(16, 61);\r
             this.check_2PassEncode.Name = "check_2PassEncode";\r
             this.check_2PassEncode.Size = new System.Drawing.Size(119, 17);\r
             this.check_2PassEncode.TabIndex = 54;\r
             this.check_2PassEncode.Text = "2-Pass Encoding";\r
-            this.check_2PassEncode.UseVisualStyleBackColor = true;\r
+            this.check_2PassEncode.UseVisualStyleBackColor = false;\r
             this.check_2PassEncode.CheckedChanged += new System.EventHandler(this.check_2PassEncode_CheckedChanged);\r
             // \r
             // Label2\r
             // \r
             this.Label2.AutoSize = true;\r
+            this.Label2.BackColor = System.Drawing.Color.Transparent;\r
             this.Label2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label2.Location = new System.Drawing.Point(304, 13);\r
             this.Label2.Name = "Label2";\r
@@ -1529,6 +1532,7 @@ namespace Handbrake
             // Label42\r
             // \r
             this.Label42.AutoSize = true;\r
+            this.Label42.BackColor = System.Drawing.Color.Transparent;\r
             this.Label42.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label42.Location = new System.Drawing.Point(304, 38);\r
             this.Label42.Name = "Label42";\r
@@ -1549,6 +1553,7 @@ namespace Handbrake
             // Label46\r
             // \r
             this.Label46.AutoSize = true;\r
+            this.Label46.BackColor = System.Drawing.Color.Transparent;\r
             this.Label46.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label46.Location = new System.Drawing.Point(13, 152);\r
             this.Label46.Name = "Label46";\r
@@ -1559,6 +1564,7 @@ namespace Handbrake
             // Label40\r
             // \r
             this.Label40.AutoSize = true;\r
+            this.Label40.BackColor = System.Drawing.Color.Transparent;\r
             this.Label40.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Label40.Location = new System.Drawing.Point(304, 96);\r
             this.Label40.Name = "Label40";\r
@@ -1876,7 +1882,6 @@ namespace Handbrake
             this.advancedOptions.Controls.Add(this.TabPage2);\r
             this.advancedOptions.Controls.Add(this.h264Tab);\r
             this.advancedOptions.Controls.Add(this.TabPage6);\r
-            this.advancedOptions.Controls.Add(this.tabPage4);\r
             this.advancedOptions.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.advancedOptions.Location = new System.Drawing.Point(14, 276);\r
             this.advancedOptions.Name = "advancedOptions";\r
@@ -1885,40 +1890,6 @@ namespace Handbrake
             this.advancedOptions.TabIndex = 27;\r
             this.advancedOptions.TabStop = false;\r
             // \r
-            // tabPage4\r
-            // \r
-            this.tabPage4.BackColor = System.Drawing.SystemColors.ControlLight;\r
-            this.tabPage4.Controls.Add(this.label26);\r
-            this.tabPage4.Controls.Add(this.label25);\r
-            this.tabPage4.Controls.Add(this.button1);\r
-            this.tabPage4.Location = new System.Drawing.Point(4, 22);\r
-            this.tabPage4.Name = "tabPage4";\r
-            this.tabPage4.Size = new System.Drawing.Size(639, 215);\r
-            this.tabPage4.TabIndex = 7;\r
-            this.tabPage4.Text = "Development";\r
-            this.tabPage4.UseVisualStyleBackColor = true;\r
-            // \r
-            // label26\r
-            // \r
-            this.label26.AutoSize = true;\r
-            this.label26.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label26.Location = new System.Drawing.Point(13, 35);\r
-            this.label26.Name = "label26";\r
-            this.label26.Size = new System.Drawing.Size(372, 26);\r
-            this.label26.TabIndex = 111;\r
-            this.label26.Text = "This tab is used for testing of new features. You can ignore this.\r\nIt will not b" +\r
-                "e a user visible tab on release.";\r
-            // \r
-            // label25\r
-            // \r
-            this.label25.AutoSize = true;\r
-            this.label25.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label25.Location = new System.Drawing.Point(13, 13);\r
-            this.label25.Name = "label25";\r
-            this.label25.Size = new System.Drawing.Size(93, 13);\r
-            this.label25.TabIndex = 110;\r
-            this.label25.Text = "Development";\r
-            // \r
             // groupBox_dest\r
             // \r
             this.groupBox_dest.Controls.Add(this.Label3);\r
@@ -2017,8 +1988,6 @@ namespace Handbrake
             this.TabPage1.ResumeLayout(false);\r
             this.TabPage1.PerformLayout();\r
             this.advancedOptions.ResumeLayout(false);\r
-            this.tabPage4.ResumeLayout(false);\r
-            this.tabPage4.PerformLayout();\r
             this.groupBox_dest.ResumeLayout(false);\r
             this.groupBox_dest.PerformLayout();\r
             this.groupBox2.ResumeLayout(false);\r
@@ -2168,10 +2137,6 @@ namespace Handbrake
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;\r
         private System.Windows.Forms.ToolStripMenuItem mnu_quickStart;\r
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;\r
-        internal System.Windows.Forms.Button button1;\r
-        private System.Windows.Forms.TabPage tabPage4;\r
-        internal System.Windows.Forms.Label label26;\r
-        internal System.Windows.Forms.Label label25;\r
         private System.Windows.Forms.SaveFileDialog DVD_Save;\r
         private System.Windows.Forms.OpenFileDialog File_Open;\r
         private System.Windows.Forms.OpenFileDialog ISO_Open;\r
index 3a58827..8f0374a 100644 (file)
@@ -11,11 +11,11 @@ using System.IO;
 using System.Diagnostics;\r
 using System.Threading;\r
 using System.Runtime.InteropServices;\r
+using System.Globalization;\r
 \r
 \r
 namespace Handbrake\r
 {\r
-\r
     public partial class frmMain : Form\r
     {\r
         // -------------------------------------------------------------- \r
@@ -26,53 +26,95 @@ namespace Handbrake
 \r
         // Some stuff that needs to be Initialized. \r
         private Process hbProc;\r
-        private Parsing.DVD thisDVD;        \r
-        private frmQueue queueWindow = new frmQueue();  \r
+        private Parsing.DVD thisDVD;\r
+        private frmQueue queueWindow = new frmQueue();\r
 \r
         // The main window beings here...\r
         public frmMain()\r
         {\r
+            // Load the splash screen in this thread\r
+            Form splash = new frmSplashScreen();\r
+            splash.Show();\r
+\r
+            //Create a label that can be updated from the parent thread.\r
+            Label lblStatus = new Label();\r
+\r
+            //Size the label\r
+            lblStatus.Size = new Size(250, 20);\r
+\r
+            //Position the label\r
+            lblStatus.Location = new Point(10, 280);\r
+\r
+            //Put the label on the splash form\r
+            splash.Controls.Add(lblStatus);\r
 \r
-            // Load the splash screen on another thread. Once completed wait for 1 second.\r
-            ThreadPool.QueueUserWorkItem(showSplash); \r
-            Thread.Sleep(1000);\r
+            //Fire a thread to wait for 2 seconds.  The splash screen will exit when the time expires\r
+            Thread timer = new Thread(splashTimer);\r
+            timer.Start();\r
 \r
             InitializeComponent();\r
 \r
-            // This is a quick Hack fix for the cross-thread problem with frmDvdIndo ************************\r
-            //dvdInfoWindow.Show();\r
-            //dvdInfoWindow.Hide();\r
-            // **********************************************************************************************\r
+            // show the form, but leave disabled until preloading is complete\r
+            this.Enabled = false;\r
+\r
+            // Show the main form\r
+            this.Show();\r
+\r
+            // Forces frmMain to draw\r
+            Application.DoEvents();\r
 \r
             // Set the Version number lable to the corect version.\r
             Version.Text = "Version " + Properties.Settings.Default.CliVersion;\r
 \r
+            // update the status\r
+            lblStatus.Text = "Checking for updates ...";\r
+            // redraw the splash screen\r
+            Application.DoEvents();\r
             // Run the update checker.\r
             updateCheck();\r
+            Thread.Sleep(300);\r
 \r
             // Now load the users default if required. (Will overide the above setting)\r
+            lblStatus.Text = "Loading User Default Settings...";\r
+            Application.DoEvents();\r
             loadUserDefaults();\r
+            Thread.Sleep(300);\r
 \r
             // Enable or disable tooltips\r
+            lblStatus.Text = "Loading Tooltips ...";\r
+            Application.DoEvents();\r
             tooltip();\r
+            Thread.Sleep(300);\r
+\r
+            // Update the presets\r
+            lblStatus.Text = "Updaing Presets ...";\r
+            Application.DoEvents();\r
+            updatePresets();\r
+            Thread.Sleep(300);\r
 \r
-            // Hide the preset bar should the user have the option enabled.\r
+            // Hide the preset bar if required.\r
             hidePresetBar();\r
 \r
-            // Load in all the presets\r
-            updatePresets();\r
+            //Finished Loading\r
+            lblStatus.Text = "Loading Complete!";\r
+            Application.DoEvents();\r
+            Thread.Sleep(300);\r
+\r
+            // Wait until splash screen is done\r
+            while (timer.IsAlive)\r
+            { Thread.Sleep(100); }\r
 \r
-            /*\r
-             * This code can be used for storing preset and preset name information in future versions.\r
-             * Please ignore it for the moment.\r
-            // Create and initialize a new StringCollection.\r
-            StringCollection myCol = new StringCollection();\r
-            // Add a range of elements from an array to the end of the StringCollection.\r
-            String[] myArr = new String[] { "RED", "orange", "yellow", "RED", "green", "blue", "RED", "indigo", "violet", "RED" };\r
-            myCol.AddRange(myArr);\r
-            Properties.Settings.Default.BuiltInPresets = myCol;\r
-            MessageBox.Show(Properties.Settings.Default.BuiltInPresets.ToString());\r
-            */\r
+            //Close the splash screen\r
+            splash.Close();\r
+            splash.Dispose();\r
+\r
+            // Turn the interface back to the user\r
+            this.Enabled = true;\r
+        }\r
+\r
+        private void splashTimer(object sender)\r
+        {\r
+            Thread.Sleep(2000);  //sit for 2 seconds then exit\r
         }\r
 \r
         private void showSplash(object sender)\r
@@ -80,12 +122,12 @@ namespace Handbrake
             // Display splash screen for 1.5 Seconds\r
             Form splash = new frmSplashScreen();\r
             splash.Show();\r
-            Thread.Sleep(1500);  \r
+            Thread.Sleep(1500);\r
             splash.Close(); // Then close.\r
         }\r
 \r
         private void loadUserDefaults()\r
-        { \r
+        {\r
             try\r
             {\r
                 // Load the users default settings or if the user has not got this option enabled, load the normal preset.\r
@@ -160,7 +202,7 @@ namespace Handbrake
                     {\r
                         Check_ChapterMarkers.CheckState = CheckState.Checked;\r
                     }\r
-                   \r
+\r
                     // Audio Settings Tab\r
                     drp_audioBitrate.Text = Properties.Settings.Default.AudioBitrate;\r
                     drp_audioSampleRate.Text = Properties.Settings.Default.AudioSampleRate;\r
@@ -209,10 +251,10 @@ namespace Handbrake
                     int cliversion = int.Parse(Properties.Settings.Default.CliVersion.Replace(".", ""));\r
 \r
                     Boolean update = ((verdata > vergui) || (verd1 > cliversion));\r
-   \r
+\r
                     lbl_update.Visible = update;\r
 \r
-                    return update;   \r
+                    return update;\r
                 }\r
                 else\r
                 {\r
@@ -251,105 +293,39 @@ namespace Handbrake
         // -------------------------------------------------------------- \r
 \r
         #region File Menu\r
-\r
-\r
-\r
         private void mnu_open_Click(object sender, EventArgs e)\r
         {\r
             string filename;\r
             File_Open.ShowDialog();\r
             filename = File_Open.FileName;\r
+\r
             if (filename != "")\r
             {\r
                 try\r
                 {\r
-                    // Create StreamReader & open file\r
-                    StreamReader line = new StreamReader(filename);\r
-                    string temporyLine; // Used for reading the line into a varible before processing on the checkState items below.\r
-\r
-                    // Read in the data and set the correct GUI component with the setting.\r
-                    text_source.Text = line.ReadLine();\r
-                    drp_dvdtitle.Text = line.ReadLine();\r
-                    drop_chapterStart.Text = line.ReadLine();\r
-                    drop_chapterFinish.Text = line.ReadLine();\r
-                    text_destination.Text = line.ReadLine();\r
-                    drp_videoEncoder.Text = line.ReadLine();\r
-                    drp_audioCodec.Text = line.ReadLine();\r
-                    text_width.Text = line.ReadLine();\r
-                    text_height.Text = line.ReadLine();\r
-                    text_top.Text = line.ReadLine();\r
-                    text_bottom.Text = line.ReadLine();\r
-                    text_left.Text = line.ReadLine();\r
-                    text_right.Text = line.ReadLine();\r
-                    drp_subtitle.Text = line.ReadLine();\r
-                    text_bitrate.Text = line.ReadLine();\r
-                    text_filesize.Text = line.ReadLine();\r
-                    slider_videoQuality.Value = int.Parse(line.ReadLine());\r
-\r
-                    temporyLine = line.ReadLine();\r
-                    if (temporyLine == "Checked")\r
-                    {\r
-                        check_2PassEncode.CheckState = CheckState.Checked;\r
-                    }\r
-\r
-                    drp_deInterlace_option.Text = line.ReadLine();\r
-\r
-                    temporyLine = line.ReadLine();\r
-                    if (temporyLine == "Checked")\r
-                    {\r
-                        check_grayscale.CheckState = CheckState.Checked;\r
-                    }\r
-\r
-                    drp_videoFramerate.Text = line.ReadLine();\r
-\r
-                    temporyLine = line.ReadLine();\r
-                    if (temporyLine == "Checked")\r
-                    {\r
-                        Check_ChapterMarkers.CheckState = CheckState.Checked;\r
-                    }\r
-\r
-                    temporyLine = line.ReadLine();\r
-                    if (temporyLine == "Checked")\r
-                    {\r
-                        CheckPixelRatio.CheckState = CheckState.Checked;\r
-                    }\r
+                    // Some things that need to be done to reset some gui components:\r
+                    CheckPixelRatio.CheckState = CheckState.Unchecked;\r
 \r
-                    temporyLine = line.ReadLine();\r
-                    if (temporyLine == "Checked")\r
-                    {\r
-                        check_turbo.CheckState = CheckState.Checked;\r
-                    }\r
+                    //---------------------------\r
+                    // Get the Preset\r
+                    // ---------------------------\r
 \r
-                    temporyLine = line.ReadLine();\r
-                    if (temporyLine == "Checked")\r
-                    {\r
-                        check_largeFile.CheckState = CheckState.Checked;\r
-                    }\r
+                    // Create StreamReader & open file\r
+                    StreamReader line = new StreamReader(filename);\r
 \r
-                    drp_audioBitrate.Text = line.ReadLine();\r
-                    drp_audioSampleRate.Text = line.ReadLine();\r
-                    drp_audioChannels.Text = line.ReadLine();\r
-                    drp_audioMixDown.Text = line.ReadLine();\r
+                    // Send the query from the file to the Query Parser class\r
+                    Functions.QueryParser presetQuery = Functions.QueryParser.Parse(line.ReadLine());\r
 \r
-                    // Advanced H264 Options\r
-                    temporyLine = line.ReadLine();\r
-                    if (temporyLine == "Checked")\r
-                    {\r
-                        CheckCRF.CheckState = CheckState.Checked;\r
-                    }\r
-                    rtf_h264advanced.Text = line.ReadLine();\r
+                    // Now load the preset\r
+                    presetLoader(presetQuery, filename);\r
 \r
                     // Close the stream\r
                     line.Close();\r
-\r
-\r
-                    // Fix for SliderValue not appearing when Opening saved file\r
-                    SliderValue.Text = slider_videoQuality.Value + "%";\r
-\r
                 }\r
-                catch (Exception)\r
+                catch (Exception exc)\r
                 {\r
                     MessageBox.Show("Unable to load profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
+                    MessageBox.Show(exc.ToString());\r
                 }\r
             }\r
         }\r
@@ -366,43 +342,10 @@ namespace Handbrake
                     // Create a StreamWriter and open the file\r
                     StreamWriter line = new StreamWriter(filename);\r
 \r
-                    //Source\r
-                    line.WriteLine(text_source.Text);\r
-                    line.WriteLine(drp_dvdtitle.Text);\r
-                    line.WriteLine(drop_chapterStart.Text);\r
-                    line.WriteLine(drop_chapterFinish.Text);\r
-                    //Destination\r
-                    line.WriteLine(text_destination.Text);\r
-                    line.WriteLine(drp_videoEncoder.Text);\r
-                    line.WriteLine(drp_audioCodec.Text);\r
-                    line.WriteLine(text_width.Text);\r
-                    line.WriteLine(text_height.Text);\r
-                    //Picture Settings Tab\r
-                    line.WriteLine(text_top.Text);\r
-                    line.WriteLine(text_bottom.Text);\r
-                    line.WriteLine(text_left.Text);\r
-                    line.WriteLine(text_right.Text);\r
-                    line.WriteLine(drp_subtitle.Text);\r
-                    //Video Settings Tab\r
-                    line.WriteLine(text_bitrate.Text);\r
-                    line.WriteLine(text_filesize.Text);\r
-                    line.WriteLine(slider_videoQuality.Value.ToString());\r
-                    line.WriteLine(check_2PassEncode.CheckState.ToString());\r
-                    line.WriteLine(drp_deInterlace_option.Text);\r
-                    line.WriteLine(check_grayscale.CheckState.ToString());\r
-                    line.WriteLine(drp_videoFramerate.Text);\r
-                    line.WriteLine(Check_ChapterMarkers.CheckState.ToString());\r
-                    line.WriteLine(CheckPixelRatio.CheckState.ToString());\r
-                    line.WriteLine(check_turbo.CheckState.ToString());\r
-                    line.WriteLine(check_largeFile.CheckState.ToString());\r
-                    //Audio Settings Tab\r
-                    line.WriteLine(drp_audioBitrate.Text);\r
-                    line.WriteLine(drp_audioSampleRate.Text);\r
-                    line.WriteLine(drp_audioChannels.Text);\r
-                    line.WriteLine(drp_audioMixDown.Text);\r
-                    //H264 Tab\r
-                    line.WriteLine(CheckCRF.CheckState.ToString());\r
-                    line.WriteLine(rtf_h264advanced.Text);\r
+                    // Generate and write the query string to the file\r
+                    String query = GenerateTheQuery();\r
+                    line.WriteLine(query);\r
+\r
                     // close the stream\r
                     line.Close();\r
                     MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
@@ -428,7 +371,7 @@ namespace Handbrake
         {\r
             showQueue();\r
         }\r
-   \r
+\r
         private void mnu_viewDVDdata_Click(object sender, EventArgs e)\r
         {\r
             frmDvdInfo dvdInfoWindow = new frmDvdInfo();\r
@@ -483,7 +426,7 @@ namespace Handbrake
 \r
         private void mnu_wiki_Click(object sender, EventArgs e)\r
         {\r
-           Process.Start("http://handbrake.m0k.org/trac");\r
+            Process.Start("http://handbrake.m0k.org/trac");\r
         }\r
 \r
         private void mnu_faq_Click(object sender, EventArgs e)\r
@@ -498,7 +441,7 @@ namespace Handbrake
 \r
         private void mnu_homepage_Click(object sender, EventArgs e)\r
         {\r
-           Process.Start("http://handbrake.m0k.org");\r
+            Process.Start("http://handbrake.m0k.org");\r
         }\r
 \r
         private void mnu_forum_Click(object sender, EventArgs e)\r
@@ -521,7 +464,7 @@ namespace Handbrake
 \r
         private void mnu_about_Click(object sender, EventArgs e)\r
         {\r
-                       Form About = new frmAbout();\r
+            Form About = new frmAbout();\r
             About.ShowDialog();\r
         }\r
 \r
@@ -535,44 +478,44 @@ namespace Handbrake
 \r
         private void btn_Browse_Click(object sender, EventArgs e)\r
         {\r
-            String filename = ""; \r
-                   text_source.Text = "";\r
+            String filename = "";\r
+            text_source.Text = "";\r
             frmDvdInfo dvdInfoWindow = new frmDvdInfo();\r
-        \r
-                   if (RadioDVD.Checked) \r
-                   { \r
-                       DVD_Open.ShowDialog(); \r
-                       filename = DVD_Open.SelectedPath; \r
-                       if (filename != "") \r
-                       { \r
-                           Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow); \r
-                           text_source.Text = filename; \r
-                           frmRD.ShowDialog(); \r
-                       } \r
-                    } \r
-                    else \r
-                    { \r
-                       ISO_Open.ShowDialog(); \r
-                       filename = ISO_Open.FileName; \r
-                       if (filename != "") \r
-                       { \r
-                           Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow); \r
-                           text_source.Text = filename; \r
-                           frmRD.ShowDialog(); \r
-                       } \r
-                    }   \r
-                \r
-                    // Check if there was titles in the dvd title dropdown \r
-                    if (filename == "") \r
-                    { \r
-                       text_source.Text = "Click 'Browse' to continue"; \r
-                    } \r
-                   \r
-             // If there are no titles in the dropdown menu then the scan has obviously failed. Display an error message explaining to the user.\r
-                    if (drp_dvdtitle.Items.Count == 0) \r
-                    { \r
-                       MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source. Please refer to the FAQ (see Help Menu).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); \r
-                    }                  \r
+\r
+            if (RadioDVD.Checked)\r
+            {\r
+                DVD_Open.ShowDialog();\r
+                filename = DVD_Open.SelectedPath;\r
+                if (filename != "")\r
+                {\r
+                    Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);\r
+                    text_source.Text = filename;\r
+                    frmRD.ShowDialog();\r
+                }\r
+            }\r
+            else\r
+            {\r
+                ISO_Open.ShowDialog();\r
+                filename = ISO_Open.FileName;\r
+                if (filename != "")\r
+                {\r
+                    Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);\r
+                    text_source.Text = filename;\r
+                    frmRD.ShowDialog();\r
+                }\r
+            }\r
+\r
+            // Check if there was titles in the dvd title dropdown \r
+            if (filename == "")\r
+            {\r
+                text_source.Text = "Click 'Browse' to continue";\r
+            }\r
+\r
+            // If there are no titles in the dropdown menu then the scan has obviously failed. Display an error message explaining to the user.\r
+            if (drp_dvdtitle.Items.Count == 0)\r
+            {\r
+                MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source. Please refer to the FAQ (see Help Menu).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
+            }\r
         }\r
 \r
         private void btn_destBrowse_Click(object sender, EventArgs e)\r
@@ -581,7 +524,7 @@ namespace Handbrake
             // It's daft but some users don't realise that typing an extension overrides the dropdown extension selected.\r
             // Should be a nicer way to do this.\r
             DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", "").Replace(".m4v", "").Replace(".mkv", "").Replace(".ogm", "").Replace(".avi", "");\r
-           \r
+\r
             // Show the dialog and set the main form file path\r
             DVD_Save.ShowDialog();\r
             text_destination.Text = DVD_Save.FileName;\r
@@ -613,7 +556,7 @@ namespace Handbrake
 \r
         private void btn_queue_Click(object sender, EventArgs e)\r
         {\r
-          \r
+\r
             if (text_source.Text == "" || text_source.Text == "Click 'Browse' to continue" || text_destination.Text == "")\r
                 MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
             else\r
@@ -629,9 +572,9 @@ namespace Handbrake
                 }\r
                 queueWindow.list_queue.Items.Add(query);\r
                 queueWindow.Show();\r
-            } \r
+            }\r
         }\r
\r
+\r
         private void btn_copy_Click(object sender, EventArgs e)\r
         {\r
             if (QueryEditorText.Text != "")\r
@@ -682,7 +625,7 @@ namespace Handbrake
                 preset_listview = new ListViewItem(presetList);\r
 \r
                 // Now Fill Out List View with Items\r
-                listview_presets.Items.Add(preset_listview);      \r
+                listview_presets.Items.Add(preset_listview);\r
             }\r
         }\r
 \r
@@ -775,24 +718,30 @@ namespace Handbrake
                     break;\r
 \r
                 case "AppleTV":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Checked, "", "", "H.264", "2500", "", 0, "0%", "160", CheckState.Checked, "48", "bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:trellis=2:cabac=0", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: Apple TV)");\r
                     break;\r
 \r
                 case "Bedlam":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Checked, "", "", "H.264", "1800", "", 0, "0%", "160", CheckState.Checked, "48", "ref=16:mixed-refs:bframes=6:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=7:me-range=64:analyse=all:8x8dct:trellis=2:no-fast-pskip:no-dct-decimate:filter=-2,-1", "None", CheckState.Checked, "No Crop", CheckState.Checked, "AC3", "Output Settings (Preset: Bedlam)");\r
-                    setMkv();\r
                     break;\r
 \r
                 case "Blind":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Unchecked, "512", "", "Mpeg 4", "512", "", 0, "0%", "128", CheckState.Checked, "48", "", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: Blind)");\r
                     break;\r
 \r
                 case "Broke":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Unchecked, "640", "", "H.264", "", "695", 0, "0%", "128", CheckState.Checked, "48", "ref=3:mixed-refs:bframes=6:bime:weightb:b-rdo:b-pyramid::direct=auto:me=umh:subme=6:trellis=1:analyse=all:8x8dct:no-fast-pskip", "None", CheckState.Checked, "No Crop", CheckState.Checked, "AAC", "Output Settings (Preset: Broke)");\r
                     break;\r
 \r
+\r
                 case "Classic":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Unchecked, "", "", "Mpeg 4", "1000", "", 0, "0%", "160", CheckState.Unchecked, "48", "", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: Classic)");\r
+\r
                     break;\r
 \r
                 case "Constant Quality Rate":\r
@@ -811,30 +760,37 @@ namespace Handbrake
                     break;\r
 \r
                 case "iPhone / iPod Touch":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Unchecked, "480", "", "H.264 (iPod)", "960", "", 0, "0%", "128", CheckState.Checked, "48", "cabac=0:ref=1:analyse=all:me=umh:subme=6:no-fast-pskip=1:trellis=1", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: iPhone)");\r
                     break;\r
 \r
                 case "iPod High-Rez":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Unchecked, "640", "", "H.264 (iPod)", "1500", "", 0, "0%", "160", CheckState.Checked, "48", "keyint=300:keyint-min=30:bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: iPod High Rez)");\r
                     break;\r
 \r
                 case "iPod Low-Rez":\r
                     setGuiSetttings(CheckState.Unchecked, "320", "", "H.264 (iPod)", "700", "", 0, "0%", "160", CheckState.Checked, "48", "keyint=300:keyint-min=30:bframes=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: iPod Low Rez)");\r
+                    setmp4();\r
                     break;\r
 \r
                 case "Normal":\r
                     setGuiSetttings(CheckState.Checked, "", "", "H.264", "1500", "", 0, "0%", "160", CheckState.Checked, "48", "ref=2:bframes=2:subme=5:me=umh", "None", CheckState.Checked, "No Crop", CheckState.Checked, "AAC", "Output Settings (Preset: Normal)");\r
+                    setmp4();\r
                     break;\r
 \r
                 case "PS3":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Checked, "", "", "H.264", "2500", "", 0, "0%", "160", CheckState.Checked, "48", "level=41:subme=5:me=umh", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: PS3)");\r
                     break;\r
 \r
                 case "PSP":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Unchecked, "368", "208", "Mpeg 4", "1024", "", 0, "0%", "160", CheckState.Checked, "48", "", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: PSP)");\r
                     break;\r
 \r
                 case "QuickTime":\r
+                    setmp4();\r
                     setGuiSetttings(CheckState.Checked, "", "", "H.264", "2000", "", 0, "0%", "160", CheckState.Checked, "48", "ref=3:mixed-refs:bframes=3:bime:weightb:b-rdo:direct=auto:me=umh:subme=5:analyse=all:8x8dct:trellis=1:no-fast-pskip", "None", CheckState.Checked, "No Crop", CheckState.Checked, "AAC", "Output Settings (Preset: Quicktime)");\r
                     break;\r
 \r
@@ -883,6 +839,16 @@ namespace Handbrake
             destination = destination.Replace(".ogm", ".mkv");\r
             text_destination.Text = destination;\r
         }\r
+        private void setmp4()\r
+        {\r
+            // Set file extension to MKV\r
+            string destination = text_destination.Text;\r
+            destination = destination.Replace(".m4v", ".mp4");\r
+            destination = destination.Replace(".avi", ".mp4");\r
+            destination = destination.Replace(".mkv", ".mp4");\r
+            destination = destination.Replace(".ogm", ".mp4");\r
+            text_destination.Text = destination;\r
+        }\r
 \r
         #endregion\r
 \r
@@ -928,7 +894,7 @@ namespace Handbrake
         [DllImport("user32.dll")]\r
         public static extern void LockWorkStation();\r
         [DllImport("user32.dll")]\r
-        public static extern int ExitWindowsEx(int uFlags, int dwReason); \r
+        public static extern int ExitWindowsEx(int uFlags, int dwReason);\r
 \r
         private void procMonitor(object state)\r
         {\r
@@ -963,7 +929,7 @@ namespace Handbrake
                     hbProc.WaitForExit();\r
                     process.closeCLI();\r
                      */\r
-                    \r
+\r
                 }\r
                 catch (Exception exc)\r
                 {\r
@@ -982,7 +948,7 @@ namespace Handbrake
                         System.Diagnostics.Process.Start("Shutdown", "-s -t 60");\r
                         break;\r
                     case "Log Off":\r
-                        ExitWindowsEx(0, 0); \r
+                        ExitWindowsEx(0, 0);\r
                         break;\r
                     case "Suspend":\r
                         Application.SetSuspendState(PowerState.Suspend, true, true);\r
@@ -1016,7 +982,7 @@ namespace Handbrake
 \r
         private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)\r
         {\r
-            \r
+\r
             if (this.InvokeRequired)\r
             {\r
                 this.BeginInvoke(new Parsing.EncodeProgressEventHandler(encode_OnEncodeProgress),\r
@@ -1056,7 +1022,7 @@ namespace Handbrake
                 }\r
             }\r
 \r
-            \r
+\r
         }\r
 \r
         private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)\r
@@ -1122,7 +1088,7 @@ namespace Handbrake
                     text_width.Text = "";\r
                     text_width.BackColor = Color.LightCoral;\r
                     CheckPixelRatio.BackColor = Color.LightCoral;\r
-                    \r
+\r
                 }\r
                 else\r
                 {\r
@@ -1151,15 +1117,15 @@ namespace Handbrake
                     {\r
                         text_height.Text = height.ToString();\r
                     }\r
-                }                   \r
+                }\r
             }\r
             catch (Exception)\r
             {\r
                 // No need to throw an error here.\r
                 // Note on non english systems, this will throw an error because of double.Parse(lbl_Aspect.Text); not working.\r
             }\r
-               \r
-          \r
+\r
+\r
         }\r
 \r
         private void text_height_TextChanged(object sender, EventArgs e)\r
@@ -1167,24 +1133,26 @@ namespace Handbrake
             try\r
             {\r
                 if (CheckPixelRatio.Checked)\r
-                    {\r
-                        text_height.Text = "";\r
-                        text_height.BackColor = Color.LightCoral;\r
-                        CheckPixelRatio.BackColor = Color.LightCoral;\r
+                {\r
+                    text_height.Text = "";\r
+                    text_height.BackColor = Color.LightCoral;\r
+                    CheckPixelRatio.BackColor = Color.LightCoral;\r
                 }\r
                 else\r
                 {\r
                     if ((int.Parse(text_height.Text) % 16) != 0)\r
                     {\r
-                            text_height.BackColor = Color.LightCoral;\r
+                        text_height.BackColor = Color.LightCoral;\r
                     }\r
                     else\r
                     {\r
-                            text_height.BackColor = Color.LightGreen;\r
+                        text_height.BackColor = Color.LightGreen;\r
                     }\r
                 }\r
 \r
-            } catch(Exception){\r
+            }\r
+            catch (Exception)\r
+            {\r
                 // No need to alert the user.\r
             }\r
         }\r
@@ -1193,10 +1161,10 @@ namespace Handbrake
         {\r
             if ((string)drp_crop.SelectedItem == "Manual")\r
             {\r
-            text_left.Enabled = true;\r
-            text_right.Enabled = true;\r
-            text_top.Enabled = true;\r
-            text_bottom.Enabled = true;\r
+                text_left.Enabled = true;\r
+                text_right.Enabled = true;\r
+                text_top.Enabled = true;\r
+                text_bottom.Enabled = true;\r
             }\r
 \r
             if ((string)drp_crop.SelectedItem == "Auto Crop")\r
@@ -1234,7 +1202,7 @@ namespace Handbrake
 \r
             }\r
         }\r
-        \r
+\r
         private void CheckPixelRatio_CheckedChanged(object sender, EventArgs e)\r
         {\r
             text_width.Text = "";\r
@@ -1298,7 +1266,7 @@ namespace Handbrake
                 drp_audioMixDown.Items.Add("Dolby Surround");\r
                 drp_audioMixDown.Items.Add("Dolby Pro Logic II");\r
                 drp_audioMixDown.Items.Add("6 Channel Discrete");\r
-                \r
+\r
                 drp_audioBitrate.Items.Clear();\r
                 drp_audioBitrate.Items.Add("32");\r
                 drp_audioBitrate.Items.Add("40");\r
@@ -1380,8 +1348,6 @@ namespace Handbrake
             }\r
         }\r
 \r
-\r
-\r
         private void drp_videoEncoder_SelectedIndexChanged(object sender, EventArgs e)\r
         {\r
             //Turn off some options which are H.264 only when the user selects a non h.264 encoder\r
@@ -1431,7 +1397,7 @@ namespace Handbrake
 \r
                 // Set the Recommended Cropping values\r
                 lbl_RecomendedCrop.Text = string.Format("{0}/{1}/{2}/{3}", selectedTitle.AutoCropDimensions[0], selectedTitle.AutoCropDimensions[1], selectedTitle.AutoCropDimensions[2], selectedTitle.AutoCropDimensions[3]);\r
-                \r
+\r
                 // Populate the Start chapter Dropdown\r
                 drop_chapterStart.Items.Clear();\r
                 drop_chapterStart.Items.AddRange(selectedTitle.Chapters.ToArray());\r
@@ -1477,6 +1443,7 @@ namespace Handbrake
 \r
         #region Program Functions\r
 \r
+        // Generate a CLI Query String\r
         public string GenerateTheQuery()\r
         {\r
             string source = text_source.Text;\r
@@ -1486,14 +1453,14 @@ namespace Handbrake
             int totalChapters = drop_chapterFinish.Items.Count - 1;\r
             string dvdChapter = "";\r
 \r
-            source = " -i " + '"' + source+ '"';\r
+            source = " -i " + '"' + source + '"';\r
 \r
-            if (dvdTitle ==  "Automatic")\r
+            if (dvdTitle == "Automatic")\r
                 dvdTitle = "";\r
             else\r
             {\r
                 string[] titleInfo = dvdTitle.Split(' ');\r
-                dvdTitle = " -t "+ titleInfo[0];\r
+                dvdTitle = " -t " + titleInfo[0];\r
             }\r
 \r
             if (chapterFinish.Equals("Auto") && chapterStart.Equals("Auto"))\r
@@ -1503,7 +1470,7 @@ namespace Handbrake
             else\r
                 dvdChapter = " -c " + chapterStart + "-" + chapterFinish;\r
 \r
-            string querySource = source+ dvdTitle+ dvdChapter;\r
+            string querySource = source + dvdTitle + dvdChapter;\r
             // ----------------------------------------------------------------------\r
 \r
             // Destination\r
@@ -1514,7 +1481,7 @@ namespace Handbrake
             string width = text_width.Text;\r
             string height = text_height.Text;\r
 \r
-            if (destination ==  "")\r
+            if (destination == "")\r
                 MessageBox.Show("No destination has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
             else\r
                 destination = " -o " + '"' + destination + '"'; //'"'+ \r
@@ -1541,7 +1508,7 @@ namespace Handbrake
                     videoEncoder = " -e x264";\r
                     break;\r
             }\r
-           \r
+\r
             switch (audioEncoder)\r
             {\r
                 case "AAC":\r
@@ -1561,8 +1528,8 @@ namespace Handbrake
                     break;\r
             }\r
 \r
-            if (width !=  "")\r
-                width = " -w "+ width;\r
+            if (width != "")\r
+                width = " -w " + width;\r
 \r
 \r
             if (height == "Auto")\r
@@ -1573,9 +1540,9 @@ namespace Handbrake
             {\r
                 height = " -l " + height;\r
             }\r
-            \r
 \r
-            string queryDestination = destination+ videoEncoder+ audioEncoder+ width+ height;\r
+\r
+            string queryDestination = destination + videoEncoder + audioEncoder + width + height;\r
             // ----------------------------------------------------------------------\r
 \r
             // Picture Settings Tab\r
@@ -1612,15 +1579,15 @@ namespace Handbrake
                 cropOut = " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;\r
             }\r
 \r
-            if (subtitles ==  "None")\r
+            if (subtitles == "None")\r
                 subtitles = "";\r
-            else if (subtitles ==  "")\r
+            else if (subtitles == "")\r
                 subtitles = "";\r
             else\r
             {\r
                 string[] tempSub;\r
                 tempSub = subtitles.Split(' ');\r
-                subtitles = " -s "+ tempSub[0];\r
+                subtitles = " -s " + tempSub[0];\r
             }\r
 \r
             switch (deInterlace_Option)\r
@@ -1629,16 +1596,16 @@ namespace Handbrake
                     deinterlace = "";\r
                     break;\r
                 case "Original (Fast)":\r
-                    deinterlace = " --deinterlace=" + '"' + "-1" + '"';\r
+                    deinterlace = " --deinterlace=fast";\r
                     break;\r
                 case "yadif (Slow)":\r
-                    deinterlace = " --deinterlace=" + '"' + "0" + '"';\r
+                    deinterlace = " --deinterlace=slow";\r
                     break;\r
                 case "yadif + mcdeint (Slower)":\r
-                    deinterlace = " --deinterlace=" + '"' + "2:-1:1" + '"';\r
+                    deinterlace = " --deinterlace=slower";\r
                     break;\r
                 case "yadif + mcdeint (Slowest)":\r
-                    deinterlace = " --deinterlace=" + '"' + "1:-1:1" + '"';\r
+                    deinterlace = " --deinterlace=slowest";\r
                     break;\r
                 default:\r
                     deinterlace = "";\r
@@ -1677,34 +1644,33 @@ namespace Handbrake
             else\r
                 CRF = "";\r
 \r
-            if (videoBitrate !=  "")\r
-                videoBitrate = " -b "+ videoBitrate;\r
+            if (videoBitrate != "")\r
+                videoBitrate = " -b " + videoBitrate;\r
 \r
-            if (videoFilesize !=  "")\r
-                videoFilesize = " -S "+ videoFilesize;\r
+            if (videoFilesize != "")\r
+                videoFilesize = " -S " + videoFilesize;\r
 \r
             // Video Quality Setting\r
 \r
-            if ((videoQuality ==  0))\r
+            if ((videoQuality == 0))\r
                 vidQSetting = "";\r
             else\r
             {\r
                 videoQuality = videoQuality / 100;\r
-                if (videoQuality ==  1)\r
+                if (videoQuality == 1)\r
                 {\r
                     vidQSetting = "1.0";\r
                 }\r
-\r
-                vidQSetting = " -q " + videoQuality.ToString();\r
+                vidQSetting = " -q " + videoQuality.ToString(new CultureInfo("en-US")); \r
             }\r
 \r
             if (check_2PassEncode.Checked)\r
                 twoPassEncoding = " -2 ";\r
 \r
-            if (videoFramerate ==  "Automatic")\r
+            if (videoFramerate == "Automatic")\r
                 videoFramerate = "";\r
             else\r
-                videoFramerate = " -r "+ videoFramerate;\r
+                videoFramerate = " -r " + videoFramerate;\r
 \r
             if (check_turbo.Checked)\r
                 turboH264 = " -T ";\r
@@ -1724,13 +1690,13 @@ namespace Handbrake
                     denoise = "";\r
                     break;\r
                 case "Weak":\r
-                    denoise = " --denoise=2:1:2:3";\r
+                    denoise = " --denoise=weak";\r
                     break;\r
                 case "Medium":\r
-                    denoise = " --denoise=3:2:2:3";\r
+                    denoise = " --denoise=medium";\r
                     break;\r
                 case "Strong":\r
-                    denoise = " --denoise=7:7:5:5";\r
+                    denoise = " --denoise=strong";\r
                     break;\r
                 default:\r
                     denoise = "";\r
@@ -1748,21 +1714,21 @@ namespace Handbrake
             string Mixdown = drp_audioMixDown.Text;\r
             string SixChannelAudio = "";\r
 \r
-            if (audioBitrate !=  "")\r
-                audioBitrate = " -B "+ audioBitrate;\r
+            if (audioBitrate != "")\r
+                audioBitrate = " -B " + audioBitrate;\r
 \r
-            if (audioSampleRate !=  "")\r
-                audioSampleRate = " -R "+ audioSampleRate;\r
+            if (audioSampleRate != "")\r
+                audioSampleRate = " -R " + audioSampleRate;\r
 \r
-            if (audioChannels ==  "Automatic")\r
+            if (audioChannels == "Automatic")\r
                 audioChannels = "";\r
-            else if (audioChannels ==  "")\r
+            else if (audioChannels == "")\r
                 audioChannels = "";\r
             else\r
             {\r
                 string[] tempSub;\r
                 tempSub = audioChannels.Split(' ');\r
-                audioChannels = " -a "+ tempSub[0];\r
+                audioChannels = " -a " + tempSub[0];\r
             }\r
 \r
             switch (Mixdown)\r
@@ -1790,24 +1756,24 @@ namespace Handbrake
                     break;\r
             }\r
 \r
-            if (Mixdown !=  "")\r
-                SixChannelAudio = " -6 "+ Mixdown;\r
+            if (Mixdown != "")\r
+                SixChannelAudio = " -6 " + Mixdown;\r
             else\r
                 SixChannelAudio = "";\r
 \r
-            string queryAudioSettings = audioBitrate+ audioSampleRate+ audioChannels+ SixChannelAudio;\r
+            string queryAudioSettings = audioBitrate + audioSampleRate + audioChannels + SixChannelAudio;\r
             // ----------------------------------------------------------------------\r
 \r
             //  H.264 Tab\r
 \r
-            \r
+\r
             string h264Advanced = rtf_h264advanced.Text;\r
-            \r
-            if ((h264Advanced ==  ""))\r
+\r
+            if ((h264Advanced == ""))\r
                 h264Advanced = "";\r
             else\r
-                h264Advanced = " -x "+ h264Advanced;\r
-    \r
+                h264Advanced = " -x " + h264Advanced;\r
+\r
 \r
             string h264Settings = h264Advanced;\r
             // ----------------------------------------------------------------------\r
@@ -1817,10 +1783,10 @@ namespace Handbrake
             string processors = Properties.Settings.Default.Processors;\r
             //  Number of Processors Handler\r
 \r
-            if (processors ==  "Automatic")\r
+            if (processors == "Automatic")\r
                 processors = "";\r
             else\r
-                processors = " -C "+ processors+ " ";\r
+                processors = " -C " + processors + " ";\r
 \r
 \r
             string queryAdvancedSettings = processors;\r
@@ -1829,35 +1795,188 @@ namespace Handbrake
             //  Verbose option (Program Settings)\r
 \r
             string verbose = "";\r
-            if (Properties.Settings.Default.verbose ==  "Checked")\r
+            if (Properties.Settings.Default.verbose == "Checked")\r
                 verbose = " -v ";\r
 \r
             // ----------------------------------------------------------------------\r
 \r
-            return querySource+ queryDestination+ queryPictureSettings+ queryVideoSettings+ h264Settings+ queryAudioSettings+ queryAdvancedSettings+ verbose;\r
+            return querySource + queryDestination + queryPictureSettings + queryVideoSettings + h264Settings + queryAudioSettings + queryAdvancedSettings + verbose;\r
         }\r
 \r
-        #endregion\r
+        // Load a Preset\r
+        private void presetLoader(Functions.QueryParser presetQuery, string name)\r
+        {\r
+            // ---------------------------\r
+            // Setup the GUI\r
+            // ---------------------------\r
+\r
+            // Source tab\r
+            #region source\r
+            text_source.Text = presetQuery.Source;\r
+            if (presetQuery.DVDTitle != 0)\r
+                drp_dvdtitle.Text = presetQuery.DVDTitle.ToString();\r
+\r
+            if (presetQuery.DVDChapterStart != 0)\r
+                drop_chapterStart.Text = presetQuery.DVDChapterStart.ToString();\r
+\r
+            if (presetQuery.DVDChapterFinish != 0)\r
+                drop_chapterFinish.Text = presetQuery.DVDChapterFinish.ToString();\r
+            #endregion\r
+\r
+            // Destination tab\r
+            #region destination\r
+\r
+            text_destination.Text = presetQuery.Destination;\r
+            drp_videoEncoder.Text = presetQuery.VideoEncoder;\r
+            drp_audioCodec.Text = presetQuery.AudioEncoder;\r
+            if (presetQuery.Width != 0)\r
+            {\r
+                text_width.Text = presetQuery.Width.ToString();\r
+            }\r
+            else\r
+            {\r
+                text_width.Text = "";\r
+                text_width.BackColor = Color.White;\r
+            }\r
+            if (presetQuery.Height != 0)\r
+            {\r
+                text_height.Text = presetQuery.Height.ToString();\r
+            }\r
+            else\r
+            {\r
+                text_height.Text = "";\r
+                text_width.BackColor = Color.White;\r
+            }\r
+            #endregion\r
 \r
+            // Picture Settings Tab\r
+            #region Picture\r
+            drp_crop.Text = "Manual";\r
+            text_top.Text = presetQuery.CropTop;\r
+            text_bottom.Text = presetQuery.CropBottom;\r
+            text_left.Text = presetQuery.CropLeft;\r
+            text_right.Text = presetQuery.CropRight;\r
 \r
+            drp_deInterlace_option.Text = presetQuery.DeInterlace;\r
+            drp_deNoise.Text = presetQuery.DeNoise;\r
 \r
-        private Functions.QueryParser thisQuery;\r
-        private void button1_Click(object sender, EventArgs e)\r
-        {\r
-            String query = "";\r
-            if (QueryEditorText.Text == "")\r
+            if (presetQuery.DeTelecine == true)\r
+            {\r
+                check_detelecine.CheckState = CheckState.Checked;\r
+            }\r
+            else\r
+            {\r
+                check_detelecine.CheckState = CheckState.Unchecked;\r
+            }\r
+\r
+\r
+            if (presetQuery.DeBlock == true)\r
+            {\r
+                check_deblock.CheckState = CheckState.Checked;\r
+            }\r
+            else\r
+            {\r
+                check_deblock.CheckState = CheckState.Unchecked;\r
+            }\r
+\r
+            if (presetQuery.ChapterMarkers == true)\r
             {\r
-                query = GenerateTheQuery();\r
+                Check_ChapterMarkers.CheckState = CheckState.Checked;\r
             }\r
             else\r
             {\r
-                query = QueryEditorText.Text;\r
+                Check_ChapterMarkers.CheckState = CheckState.Unchecked;\r
             }\r
-            thisQuery = Functions.QueryParser.Parse(query);\r
-            MessageBox.Show(thisQuery.Source.ToString());\r
-            MessageBox.Show(thisQuery.Destination.ToString());\r
+\r
+            if (presetQuery.Anamorphic == true)\r
+            {\r
+                CheckPixelRatio.CheckState = CheckState.Checked;\r
+            }\r
+            else\r
+            {\r
+                CheckPixelRatio.CheckState = CheckState.Unchecked;\r
+            }\r
+            #endregion\r
+\r
+            // Video Settings Tab\r
+            #region video\r
+            text_bitrate.Text = presetQuery.AverageVideoBitrate;\r
+            text_filesize.Text = presetQuery.VideoTargetSize;\r
+            slider_videoQuality.Value = presetQuery.VideoQuality;\r
+            if (slider_videoQuality.Value != 0)\r
+            {\r
+                CheckCRF.Enabled = true;\r
+                int ql = presetQuery.VideoQuality;\r
+                SliderValue.Text = ql.ToString() + "%";\r
+            }\r
+\r
+            if (presetQuery.TwoPass == true)\r
+            {\r
+                check_2PassEncode.CheckState = CheckState.Checked;\r
+            }\r
+            else\r
+            {\r
+                check_2PassEncode.CheckState = CheckState.Unchecked;\r
+            }\r
+\r
+            if (presetQuery.Grayscale == true)\r
+            {\r
+                check_grayscale.CheckState = CheckState.Checked;\r
+            }\r
+            else\r
+            {\r
+                check_grayscale.CheckState = CheckState.Unchecked;\r
+            }\r
+\r
+            drp_videoFramerate.Text = presetQuery.VideoFramerate;\r
+\r
+            if (presetQuery.TurboFirstPass == true)\r
+            {\r
+                check_turbo.CheckState = CheckState.Checked;\r
+            }\r
+            else\r
+            {\r
+                check_turbo.CheckState = CheckState.Unchecked;\r
+            }\r
+\r
+            if (presetQuery.LargeMP4 == true)\r
+            {\r
+                check_largeFile.CheckState = CheckState.Checked;\r
+            }\r
+            else\r
+            {\r
+                check_largeFile.CheckState = CheckState.Unchecked;\r
+            }\r
+            if (presetQuery.CRF == true)\r
+            {\r
+                CheckCRF.CheckState = CheckState.Checked;\r
+            }\r
+            else\r
+            {\r
+                CheckCRF.CheckState = CheckState.Unchecked;\r
+            }\r
+            #endregion\r
+\r
+            // Audio Settings Tab\r
+            #region audio\r
+            drp_audioBitrate.Text = presetQuery.AudioBitrate;\r
+            drp_audioSampleRate.Text = presetQuery.AudioSampleBitrate;\r
+            drp_audioChannels.Text = presetQuery.AudioTrack1;\r
+            drp_audioMixDown.Text = presetQuery.AudioTrackMix;\r
+            drp_subtitle.Text = presetQuery.Subtitles;\r
+            #endregion\r
+\r
+            // H264 Tab & Preset Name\r
+            #region other\r
+            rtf_h264advanced.Text = presetQuery.H264Query;\r
+\r
+            // Set the preset name\r
+            groupBox_output.Text = "Output Settings (Preset: " + name + ")";\r
+            #endregion\r
         }\r
 \r
+        #endregion\r
+\r
         // This is the END of the road ------------------------------------------------------------------------------\r
     }\r
-}\r
+}
\ No newline at end of file