]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Wed, 11 Jul 2007 12:56:13 +0000 (12:56 +0000)
committersr55 <sr55.hb@outlook.com>
Wed, 11 Jul 2007 12:56:13 +0000 (12:56 +0000)
- Couple bug fixes + a bit of code tidy up.

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

win/C#/Parsing/Chapter.cs
win/C#/Parsing/Title.cs
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs
win/C#/frmReadDVD.Designer.cs
win/C#/frmReadDVD.cs

index 630ab090542c55fa49a315c711c1fe80e58311a8..53a6056508a99b630a946e8a44648f6c028ef23a 100644 (file)
@@ -16,7 +16,7 @@ namespace Handbrake.Parsing
             }\r
         }\r
 \r
-        private int[] m_cellRange;\r
+        /*private int[] m_cellRange;\r
         public int[] CellRange\r
         {\r
             get\r
@@ -32,7 +32,7 @@ namespace Handbrake.Parsing
             {\r
                 return this.m_blocks;\r
             }\r
-        }\r
+        }*/\r
 \r
         private TimeSpan m_duration;\r
         public TimeSpan Duration\r
index 99b32cd7062caf9927ee5c3cd1f299c91b5e94a7..39062be6200e10e6b0bcb5e7de5f00fe2aa7dada 100644 (file)
@@ -35,7 +35,7 @@ namespace Handbrake.Parsing
             }\r
         }\r
 \r
-        private int m_vts;\r
+        /*private int m_vts;\r
         public int Vts\r
         {\r
             get\r
@@ -69,7 +69,7 @@ namespace Handbrake.Parsing
             {\r
                 return this.m_blockCount;\r
             }\r
-        }\r
+        }*/\r
 \r
         private int m_titleNumber;\r
         public int TitleNumber\r
@@ -107,14 +107,14 @@ namespace Handbrake.Parsing
             }\r
         }\r
 \r
-        private float m_fps;\r
+        /*private float m_fps;\r
         public float Fps\r
         {\r
             get\r
             {\r
                 return this.m_fps;\r
             }\r
-        }\r
+        }*/\r
 \r
         private int[] m_autoCrop;\r
         public int[] AutoCropDimensions\r
index cf31aecf1c0c30e2afae38c217f331b5e3807e98..67c5e97ed9390d687b86b7685c0927eaba77eaa0 100644 (file)
@@ -1362,6 +1362,12 @@ namespace Handbrake
             this.drp_audioMixDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
             this.drp_audioMixDown.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.drp_audioMixDown.FormattingEnabled = true;\r
+            this.drp_audioMixDown.Items.AddRange(new object[] {\r
+            "Mono",\r
+            "Stereo",\r
+            "Dolby Surround",\r
+            "Dolby Pro Logic II",\r
+            "6 Channel Discrete"});\r
             this.drp_audioMixDown.Location = new System.Drawing.Point(157, 127);\r
             this.drp_audioMixDown.Name = "drp_audioMixDown";\r
             this.drp_audioMixDown.Size = new System.Drawing.Size(173, 21);\r
index 09954b29301715500f2324335e8d6124a2a06d98..78c4a9a2e9c80ec9b918dfdde68c2a8c9d35f244 100644 (file)
@@ -7,6 +7,7 @@ using System.Text;
 using System.Windows.Forms;\r
 using System.Net;\r
 using System.IO;\r
+using System.Diagnostics;\r
 \r
 namespace Handbrake\r
 {\r
@@ -242,46 +243,6 @@ namespace Handbrake
 \r
         private void mnu_save_Click(object sender, EventArgs e)\r
         {\r
-            // Note : All these declarations are not really needed and should be removed at some point.\r
-            // The values can simply be added directly to the WriteLine statments.\r
-                \r
-            //Source\r
-            string source = text_source.Text;\r
-            string dvdTitle = drp_dvdtitle.Text;\r
-            string ChapterStart = drop_chapterStart.Text;\r
-            string ChapterFinish = drop_chapterFinish.Text;\r
-            //Destination\r
-            string destination = text_destination.Text;\r
-            string videoEncoder = drp_videoEncoder.Text;\r
-            string audioEncoder = drp_audioCodec.Text;\r
-            string width = text_width.Text;\r
-            string height = text_height.Text;\r
-            //Picture Settings Tab\r
-            string cropTop = text_top.Text;\r
-            string cropBottom = text_bottom.Text;\r
-            string cropLeft = text_left.Text;\r
-            string cropRight = text_right.Text;\r
-            string subtitles = drp_subtitle.Text;\r
-            //Video Settings Tab\r
-            string videoBitrate = text_bitrate.Text;\r
-            string videoFilesize = text_filesize.Text;\r
-            string videoQuality = slider_videoQuality.Value.ToString();\r
-            string twoPassEncoding = check_2PassEncode.CheckState.ToString();\r
-            string deinterlace = check_DeInterlace.CheckState.ToString();\r
-            string grayscale = check_grayscale.CheckState.ToString();\r
-            string videoFramerate = drp_videoFramerate.Text;\r
-            string pixelRation = CheckPixelRatio.CheckState.ToString();\r
-            string ChapterMarkers = Check_ChapterMarkers.CheckState.ToString();\r
-            string turboH264 = check_turbo.CheckState.ToString();\r
-            string largeFile = check_largeFile.CheckState.ToString();\r
-            //Audio Settings Tab\r
-            string audioBitrate = drp_audioBitrate.Text;\r
-            string audioSampleRate = drp_audioSampleRate.Text;\r
-            string audioChannels = drp_audioChannels.Text;\r
-            string AudioMixDown = drp_audioMixDown.Text;\r
-            //H264 Tab\r
-            string CRF = CheckCRF.CheckState.ToString();\r
-            string advH264 = rtf_h264advanced.Text;\r
 \r
             string filename;\r
             File_Save.ShowDialog();\r
@@ -293,40 +254,46 @@ namespace Handbrake
                     // Create a StreamWriter and open the file\r
                     StreamWriter line = new StreamWriter(filename);\r
 \r
-                   line.WriteLine(source);\r
-                   line.WriteLine(dvdTitle);\r
-                   line.WriteLine(ChapterStart);\r
-                   line.WriteLine(ChapterFinish);\r
-                   line.WriteLine(destination);\r
-                   line.WriteLine(videoEncoder);\r
-                   line.WriteLine(audioEncoder);\r
-                   line.WriteLine(width);\r
-                   line.WriteLine(height);\r
-                   line.WriteLine(cropTop);\r
-                   line.WriteLine(cropBottom);\r
-                   line.WriteLine(cropLeft);\r
-                   line.WriteLine(cropRight);\r
-                   line.WriteLine(subtitles);\r
-                   line.WriteLine(videoBitrate);\r
-                   line.WriteLine(videoFilesize);\r
-                   line.WriteLine(videoQuality);\r
-                   line.WriteLine(twoPassEncoding);\r
-                   line.WriteLine(deinterlace);\r
-                   line.WriteLine(grayscale);\r
-                   line.WriteLine(videoFramerate);\r
-                   line.WriteLine(ChapterMarkers);\r
-                   line.WriteLine(pixelRation);\r
-                   line.WriteLine(turboH264);\r
-                   line.WriteLine(largeFile);\r
-                   line.WriteLine(audioBitrate);\r
-                   line.WriteLine(audioSampleRate);\r
-                   line.WriteLine(audioChannels);\r
-                   line.WriteLine(AudioMixDown);\r
-                   line.WriteLine(CRF);\r
-                   line.WriteLine(advH264);\r
-                   // close the stream\r
-                   line.Close();\r
-                   MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\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(check_DeInterlace.CheckState.ToString());\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
+                    // close the stream\r
+                    line.Close();\r
+                    MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
                 }\r
                 catch(Exception)\r
                 {\r
@@ -490,27 +457,27 @@ namespace Handbrake
         // Help Menu --------------------------------------------------------------\r
         private void mnu_wiki_Click(object sender, EventArgs e)\r
         {\r
-            System.Diagnostics.Process.Start("http://handbrake.m0k.org/trac");\r
+           Process.Start("http://handbrake.m0k.org/trac");\r
         }\r
 \r
         private void mnu_onlineDocs_Click(object sender, EventArgs e)\r
         {\r
-            System.Diagnostics.Process.Start("http://handbrake.m0k.org/?page_id=11");\r
+            Process.Start("http://handbrake.m0k.org/?page_id=11");\r
         }\r
 \r
         private void mnu_faq_Click(object sender, EventArgs e)\r
         {\r
-            System.Diagnostics.Process.Start("http://handbrake.m0k.org/trac/wiki/WindowsGuiFaq");\r
+            Process.Start("http://handbrake.m0k.org/trac/wiki/WindowsGuiFaq");\r
         }\r
 \r
         private void mnu_homepage_Click(object sender, EventArgs e)\r
         {\r
-            System.Diagnostics.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
         {\r
-            System.Diagnostics.Process.Start("http://handbrake.m0k.org/forum");\r
+            Process.Start("http://handbrake.m0k.org/forum");\r
         }\r
 \r
         private void mnu_about_Click(object sender, EventArgs e)\r
@@ -564,7 +531,7 @@ namespace Handbrake
             DVD_Save.ShowDialog();\r
             text_destination.Text = DVD_Save.FileName;\r
 \r
-            if (Check_ChapterMarkers.CheckState.ToString() == "Checked")\r
+            if (Check_ChapterMarkers.Checked)\r
             {\r
                 string destination = text_destination.Text;\r
                 destination = destination.Replace(".mp4", ".m4v");\r
@@ -601,7 +568,6 @@ namespace Handbrake
             if (QueryEditorText.Text == "")\r
             {\r
                 query = GenerateTheQuery();\r
-                MessageBox.Show(query);\r
             }\r
             else\r
             {\r
@@ -631,11 +597,11 @@ namespace Handbrake
             QueryEditorText.Text = "";\r
             if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))\r
             {\r
-                int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
-                int chapterStart = int.Parse(drop_chapterStart.Text);\r
-\r
                 try\r
                 {\r
+                    int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
+                    int chapterStart = int.Parse(drop_chapterStart.Text);\r
+\r
                     if (chapterFinish < chapterStart)\r
                     {\r
                         MessageBox.Show("Invalid Chapter Range! - Final chapter can not be smaller than the starting chapter.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
@@ -655,11 +621,11 @@ namespace Handbrake
             QueryEditorText.Text = "";\r
             if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))\r
             {\r
-                int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
-                int chapterStart = int.Parse(drop_chapterStart.Text);\r
-\r
                 try\r
                 {\r
+                    int chapterFinish = int.Parse(drop_chapterFinish.Text);\r
+                    int chapterStart = int.Parse(drop_chapterStart.Text);\r
+\r
                     if (chapterFinish > chapterStart)\r
                     {\r
                         MessageBox.Show("Invalid Chapter Range! - Start chapter can not be larger than the Final chapter.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
@@ -697,14 +663,14 @@ namespace Handbrake
 \r
         private void label_h264_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)\r
         {\r
-            System.Diagnostics.Process.Start("http://handbrake.m0k.org/trac/wiki/x264Options");\r
+            Process.Start("http://handbrake.m0k.org/trac/wiki/x264Options");\r
         }\r
 \r
         private void text_width_TextChanged(object sender, EventArgs e)\r
         {\r
             try\r
             {\r
-                if (CheckPixelRatio.CheckState.ToString() == "Checked") {\r
+                if (CheckPixelRatio.Checked) {\r
                     text_width.Text = "";\r
                 } else {\r
                     if ((int.Parse(text_width.Text) % 16) != 0){\r
@@ -722,6 +688,7 @@ namespace Handbrake
                 }\r
                \r
             } catch(Exception){\r
+                \r
             }\r
         }\r
 \r
@@ -729,7 +696,7 @@ namespace Handbrake
         {\r
             try\r
             {\r
-                if (CheckPixelRatio.CheckState.ToString() == "Checked")\r
+                if (CheckPixelRatio.Checked)\r
                 {\r
                     text_height.Text = "";\r
                 }\r
@@ -745,6 +712,7 @@ namespace Handbrake
                     }\r
                 }\r
             } catch(Exception){\r
+                // No need to alert the user.\r
             }\r
         }\r
 \r
@@ -819,11 +787,13 @@ namespace Handbrake
 \r
             if (drp_audioCodec.Text == "AAC")\r
             {\r
+                drp_audioMixDown.Items.Clear();\r
                 drp_audioMixDown.Items.Add("Mono");\r
                 drp_audioMixDown.Items.Add("Stereo");\r
                 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
                 drp_audioBitrate.Items.Clear();\r
                 drp_audioBitrate.Items.Add("32");\r
                 drp_audioBitrate.Items.Add("40");\r
@@ -839,6 +809,7 @@ namespace Handbrake
             }\r
             else\r
             {\r
+                drp_audioMixDown.Items.Clear();\r
                 drp_audioMixDown.Items.Add("Stereo");\r
                 drp_audioMixDown.Items.Add("Dolby Surround");\r
                 drp_audioMixDown.Items.Add("Dolby Pro Logic II");\r
@@ -891,7 +862,7 @@ namespace Handbrake
 \r
         private void Check_ChapterMarkers_CheckedChanged(object sender, EventArgs e)\r
         {\r
-            if (Check_ChapterMarkers.CheckState.ToString() == "Checked")\r
+            if (Check_ChapterMarkers.Checked)\r
             {\r
                 string destination = text_destination.Text;\r
                 destination = destination.Replace(".mp4", ".m4v");\r
@@ -998,36 +969,26 @@ namespace Handbrake
             string dvdChapter = "";\r
 \r
             if (source ==  "")\r
-            {\r
                 MessageBox.Show("No Source has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
-            }else{\r
+            else\r
+            {\r
                 source = " -i " + '"' + source+ '"'; //'"'+\r
             }\r
 \r
             if (dvdTitle ==  "Automatic")\r
-            {\r
                 dvdTitle = "";\r
-            }else{\r
+            else\r
+            {\r
                 string[] titleInfo = dvdTitle.Split(' ');\r
                 dvdTitle = " -t "+ titleInfo[0];\r
             }\r
 \r
-\r
-\r
-\r
-            if ((chapterFinish.Equals("Auto") && chapterStart.Equals("Auto")))\r
-            {\r
+            if (chapterFinish.Equals("Auto") && chapterStart.Equals("Auto"))\r
                 dvdChapter = "";\r
-            }\r
             else if (chapterFinish == chapterStart)\r
-            {\r
                 dvdChapter = " -c " + chapterStart;\r
-            }\r
-\r
             else\r
-            {\r
                 dvdChapter = " -c " + chapterStart + "-" + chapterFinish;\r
-            }\r
 \r
             string querySource = source+ dvdTitle+ dvdChapter;\r
             // ----------------------------------------------------------------------\r
@@ -1039,70 +1000,61 @@ namespace Handbrake
             string audioEncoder = drp_audioCodec.Text;\r
             string width = text_width.Text;\r
             string height = text_height.Text;\r
-            if ((destination ==  ""))\r
-            {\r
-                MessageBox.Show("No destination has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
-            }\r
 \r
+            if (destination ==  "")\r
+                MessageBox.Show("No destination has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
             else\r
-            {\r
                 destination = " -o " + '"' + destination + '"'; //'"'+ \r
-            }\r
-\r
-            if ((videoEncoder ==  "Mpeg 4"))\r
-            {\r
-                videoEncoder = " -e ffmpeg";\r
-            }\r
-\r
-            else if ((videoEncoder ==  "Xvid"))\r
-            {\r
-                videoEncoder = " -e xvid";\r
-            }\r
-\r
-            else if ((videoEncoder ==  "H.264"))\r
-            {\r
-                videoEncoder = " -e x264";\r
-            }\r
-\r
-            else if ((videoEncoder ==  "H.264 Baseline 1.3"))\r
-            {\r
-                videoEncoder = " -e x264b13";\r
-            }\r
-\r
-            else if ((videoEncoder ==  "H.264 (iPod)"))\r
-            {\r
-                videoEncoder = " -e x264b30";\r
-            }\r
-\r
-            if ((audioEncoder ==  "AAC"))\r
-            {\r
-                audioEncoder = " -E faac";\r
-            }\r
-\r
-            else if ((audioEncoder ==  "MP3"))\r
-            {\r
-                audioEncoder = " -E lame";\r
-            }\r
 \r
-            else if ((audioEncoder ==  "Vorbis"))\r
-            {\r
-                audioEncoder = " -E vorbis";\r
-            }\r
 \r
-            else if ((audioEncoder ==  "AC3"))\r
-            {\r
-                audioEncoder = " -E ac3";\r
-            }\r
-\r
-            if ((width !=  ""))\r
-            {\r
+            switch (videoEncoder)\r
+            {\r
+                case "Mpeg 4":\r
+                    videoEncoder = " -e ffmpeg";\r
+                    break;\r
+                case "Xvid":\r
+                    videoEncoder = " -e xvid";\r
+                    break;\r
+                case "H.264":\r
+                    videoEncoder = " -e x264";\r
+                    break;\r
+                case "H.264 Baseline 1.3":\r
+                    videoEncoder = " -e x264b13";\r
+                    break;\r
+                case "H.264 (iPod)":\r
+                    videoEncoder = " -e x264b30";\r
+                    break;\r
+                default:\r
+                    Mixdown = " -e x264";\r
+                    break;\r
+            }\r
+           \r
+            switch (audioEncoder)\r
+            {\r
+                case "AAC":\r
+                    audioEncoder = " -E faac";\r
+                    break;\r
+                case "MP3":\r
+                    audioEncoder = " -E lame";\r
+                    break;\r
+                case "Vorbis":\r
+                    audioEncoder = " -E vorbis";\r
+                    break;\r
+                case "AC3":\r
+                    audioEncoder = " -E ac3";\r
+                    break;\r
+                default:\r
+                    Mixdown = " -E faac";\r
+                    break;\r
+            }\r
+\r
+            if (width !=  "")\r
                 width = " -w "+ width;\r
-            }\r
+            \r
 \r
-            if ((height !=  ""))\r
-            {\r
+            if (height !=  "")\r
                 height = " -l "+ height;\r
-            }\r
+            \r
 \r
             string queryDestination = destination+ videoEncoder+ audioEncoder+ width+ height;\r
             // ----------------------------------------------------------------------\r
@@ -1118,31 +1070,17 @@ namespace Handbrake
             string cropOut = "";\r
             // Returns Crop Query\r
 \r
-            if (cropSetting ==  "Auto Crop")\r
-            {\r
+            if (cropSetting == "Auto Crop")\r
                 cropOut = "";\r
-            }\r
-\r
-            else if (cropSetting ==  "No Crop")\r
-            {\r
+            else if (cropSetting == "No Crop")\r
                 cropOut = " --crop 0:0:0:0 ";\r
-            }\r
-\r
             else\r
-            {\r
-                cropOut = " --crop "+ cropTop+ ":"+ cropBottom+ ":"+ cropLeft+ ":"+ cropRight;\r
-            }\r
+                cropOut = " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;\r
 \r
-            if ((subtitles ==  "None"))\r
-            {\r
+            if (subtitles ==  "None")\r
                 subtitles = "";\r
-            }\r
-\r
-            else if ((subtitles ==  ""))\r
-            {\r
+            else if (subtitles ==  "")\r
                 subtitles = "";\r
-            }\r
-\r
             else\r
             {\r
                 string[] tempSub;\r
@@ -1158,33 +1096,26 @@ namespace Handbrake
             string videoBitrate = text_bitrate.Text;\r
             string videoFilesize = text_filesize.Text;\r
             int videoQuality = slider_videoQuality.Value;\r
-            string vidQSetting;\r
-            string twoPassEncoding = check_2PassEncode.CheckState.ToString();\r
-            string deinterlace = check_DeInterlace.CheckState.ToString();\r
-            string grayscale = check_grayscale.CheckState.ToString();\r
+            string vidQSetting = "";\r
+            string twoPassEncoding = "";\r
+            string deinterlace = "";\r
+            string grayscale = "";\r
             string videoFramerate = drp_videoFramerate.Text;\r
-            string pixelRatio = CheckPixelRatio.CheckState.ToString();\r
-            string ChapterMarkers = Check_ChapterMarkers.CheckState.ToString();\r
-            string turboH264 = check_turbo.CheckState.ToString();\r
-            string largeFile = check_largeFile.CheckState.ToString();\r
+            string pixelRatio = "";\r
+            string ChapterMarkers = "";\r
+            string turboH264 = "";\r
+            string largeFile = "";\r
 \r
-            if ((videoBitrate !=  ""))\r
-            {\r
+            if (videoBitrate !=  "")\r
                 videoBitrate = " -b "+ videoBitrate;\r
-            }\r
 \r
-            if ((videoFilesize !=  ""))\r
-            {\r
+            if (videoFilesize !=  "")\r
                 videoFilesize = " -S "+ videoFilesize;\r
-            }\r
 \r
             // Video Quality Setting\r
 \r
             if ((videoQuality ==  0))\r
-            {\r
                 vidQSetting = "";\r
-            }\r
-\r
             else\r
             {\r
                 videoQuality = videoQuality/ 100;\r
@@ -1196,85 +1127,31 @@ namespace Handbrake
                 vidQSetting = " -q " + videoQuality.ToString();\r
             }\r
 \r
-            if ((twoPassEncoding ==  "1"))\r
-            {\r
+            if (check_2PassEncode.Checked)\r
                 twoPassEncoding = " -2 ";\r
-            }\r
 \r
-            else\r
-            {\r
-                twoPassEncoding = "";\r
-            }\r
-\r
-            if ((deinterlace ==  "1"))\r
-            {\r
+            if (check_DeInterlace.Checked)\r
                 deinterlace = " -d ";\r
-            }\r
 \r
-            else\r
-            {\r
-                deinterlace = "";\r
-            }\r
-\r
-            if ((grayscale ==  "1"))\r
-            {\r
+            if (check_grayscale.Checked)\r
                 grayscale = " -g ";\r
-            }\r
 \r
-            else\r
-            {\r
-                grayscale = "";\r
-            }\r
-\r
-            if ((videoFramerate ==  "Automatic"))\r
-            {\r
+            if (videoFramerate ==  "Automatic")\r
                 videoFramerate = "";\r
-            }\r
-\r
             else\r
-            {\r
                 videoFramerate = " -r "+ videoFramerate;\r
-            }\r
 \r
-            if ((pixelRatio ==  "1"))\r
-            {\r
+            if (CheckPixelRatio.Checked)\r
                 pixelRatio = " -p ";\r
-            }\r
-\r
-            else\r
-            {\r
-                pixelRatio = "";\r
-            }\r
 \r
-            if ((ChapterMarkers ==  "1"))\r
-            {\r
+            if (Check_ChapterMarkers.Checked)\r
                 ChapterMarkers = " -m ";\r
-            }\r
 \r
-            else\r
-            {\r
-                ChapterMarkers = "";\r
-            }\r
-\r
-            if ((turboH264 ==  "1"))\r
-            {\r
+            if (check_turbo.Checked)\r
                 turboH264 = " -T ";\r
-            }\r
 \r
-            else\r
-            {\r
-                turboH264 = "";\r
-            }\r
-\r
-            if ((largeFile ==  "1"))\r
-            {\r
+            if (check_largeFile.Checked)\r
                 largeFile = " -4 ";\r
-            }\r
-\r
-            else\r
-            {\r
-                largeFile = "";\r
-            }\r
 \r
             string queryVideoSettings = videoBitrate + videoFilesize + vidQSetting + twoPassEncoding + deinterlace + grayscale + videoFramerate + pixelRatio + ChapterMarkers + turboH264 + largeFile;\r
             // ----------------------------------------------------------------------\r
@@ -1286,26 +1163,17 @@ namespace Handbrake
             string audioChannels = drp_audioChannels.Text;\r
             string Mixdown = drp_audioMixDown.Text;\r
             string SixChannelAudio = "";\r
-            if ((audioBitrate !=  ""))\r
-            {\r
+\r
+            if (audioBitrate !=  "")\r
                 audioBitrate = " -B "+ audioBitrate;\r
-            }\r
 \r
-            if ((audioSampleRate !=  ""))\r
-            {\r
+            if (audioSampleRate !=  "")\r
                 audioSampleRate = " -R "+ audioSampleRate;\r
-            }\r
 \r
-            if ((audioChannels ==  "Automatic"))\r
-            {\r
+            if (audioChannels ==  "Automatic")\r
                 audioChannels = "";\r
-            }\r
-\r
-            else if ((audioChannels ==  ""))\r
-            {\r
+            else if (audioChannels ==  "")\r
                 audioChannels = "";\r
-            }\r
-\r
             else\r
             {\r
                 string[] tempSub;\r
@@ -1313,50 +1181,35 @@ namespace Handbrake
                 audioChannels = " -a "+ tempSub[0];\r
             }\r
 \r
-            if ((Mixdown ==  "Automatic"))\r
-            {\r
-                Mixdown = "";\r
-            }\r
-\r
-            else if (Mixdown ==  "Mono")\r
-            {\r
-                Mixdown = "mono";\r
-            }\r
-\r
-            else if (Mixdown ==  "Stereo")\r
-            {\r
-                Mixdown = "stereo";\r
-            }\r
-\r
-            else if (Mixdown ==  "Dolby Surround")\r
-            {\r
-                Mixdown = "dpl1";\r
-            }\r
-\r
-            else if (Mixdown ==  "Dolby Pro Logic II")\r
-            {\r
-                Mixdown = "dpl2";\r
-            }\r
-\r
-            else if (Mixdown ==  "6 Channel Discrete")\r
-            {\r
-                Mixdown = "6ch";\r
-            }\r
-\r
-            else\r
-            {\r
-                Mixdown = "stero";\r
-            }\r
-\r
-            if ((Mixdown !=  ""))\r
-            {\r
+            switch (Mixdown)\r
+            {\r
+                case "Automatic":\r
+                    Mixdown = "";\r
+                    break;\r
+                case "Mono":\r
+                    Mixdown = "mono";\r
+                    break;\r
+                case "Stereo":\r
+                    Mixdown = "stereo";\r
+                    break;\r
+                case "Dolby Surround":\r
+                    Mixdown = "dpl1";\r
+                    break;\r
+                case "Dolby Pro Logic II":\r
+                    Mixdown = "dpl2";\r
+                    break;\r
+                case "6 Channel Discrete":\r
+                    Mixdown = "6ch";\r
+                    break;\r
+                default:\r
+                    Mixdown = "stero";\r
+                    break;\r
+            }\r
+\r
+            if (Mixdown !=  "")\r
                 SixChannelAudio = " -6 "+ Mixdown;\r
-            }\r
-\r
             else\r
-            {\r
                 SixChannelAudio = "";\r
-            }\r
 \r
             string queryAudioSettings = audioBitrate+ audioSampleRate+ audioChannels+ SixChannelAudio;\r
             // ----------------------------------------------------------------------\r
@@ -1366,24 +1219,15 @@ namespace Handbrake
             string CRF = CheckCRF.CheckState.ToString();\r
             string h264Advanced = rtf_h264advanced.Text;\r
             if ((CRF ==  "1"))\r
-            {\r
                 CRF = " -Q ";\r
-            }\r
-\r
             else\r
-            {\r
                 CRF = "";\r
-            }\r
 \r
             if ((h264Advanced ==  ""))\r
-            {\r
                 h264Advanced = "";\r
-            }\r
-\r
             else\r
-            {\r
                 h264Advanced = " -x "+ h264Advanced;\r
-            }\r
+    \r
 \r
             string h264Settings = CRF+ h264Advanced;\r
             // ----------------------------------------------------------------------\r
@@ -1393,15 +1237,11 @@ namespace Handbrake
             string processors = Properties.Settings.Default.Processors;\r
             //  Number of Processors Handler\r
 \r
-            if ((processors ==  "Automatic"))\r
-            {\r
+            if (processors ==  "Automatic")\r
                 processors = "";\r
-            }\r
-\r
             else\r
-            {\r
                 processors = " -C "+ processors+ " ";\r
-            }\r
+\r
 \r
             string queryAdvancedSettings = processors;\r
             // ----------------------------------------------------------------------\r
@@ -1409,10 +1249,8 @@ namespace Handbrake
             //  Verbose option (Program Settings)\r
 \r
             string verbose = "";\r
-            if ( Properties.Settings.Default.verbose ==  "1")\r
-            {\r
+            if (Properties.Settings.Default.verbose ==  "1")\r
                 verbose = " -v ";\r
-            }\r
 \r
             // ----------------------------------------------------------------------\r
 \r
index 1cb81113368c7751eecb66d382d74dd9739f75e9..8959620e7e337c28191f04c45556c367d2f77aff 100644 (file)
@@ -108,6 +108,7 @@ namespace Handbrake
             this.Name = "frmReadDVD";\r
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;\r
             this.Text = "Reading DVD...";\r
+            this.Load += new System.EventHandler(this.frmReadDVD_Load);\r
             this.ResumeLayout(false);\r
             this.PerformLayout();\r
 \r
index caf9d5853f55416aabe18ba5609150faea23f2d7..a491a3ed7c3d405c1edd1d3f01fd73d34a848461 100644 (file)
@@ -6,6 +6,7 @@ using System.Drawing;
 using System.Text;\r
 using System.Windows.Forms;\r
 using System.IO;\r
+using System.Threading;\r
 \r
 \r
 namespace Handbrake\r
@@ -30,7 +31,7 @@ namespace Handbrake
             btn_ok.Enabled = false;\r
             lbl_pressOk.Visible = false;\r
             // throw cli call and parsing on it's own thread\r
-            System.Threading.ThreadPool.QueueUserWorkItem(startProc);\r
+            ThreadPool.QueueUserWorkItem(startProc);\r
         }\r
 \r
         private void updateUIElements()\r
@@ -69,5 +70,10 @@ namespace Handbrake
 \r
             updateUIElements();\r
         }\r
+\r
+        private void frmReadDVD_Load(object sender, EventArgs e)\r
+        {\r
+\r
+        }\r
     }\r
 }
\ No newline at end of file