OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 19 Mar 2008 21:29:22 +0000 (21:29 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 19 Mar 2008 21:29:22 +0000 (21:29 +0000)
- The x264 tab has been replaced by a completely new panel with widgets for many of the available x264 options. It operates in a similar way to the macgui's panel. (It however will not disable widgets based on selections on other widgets yet(like the macgui does) this will come later when the bugs have been worked out.

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

win/C#/Functions/Common.cs
win/C#/Functions/x264Panel.cs [new file with mode: 0644]
win/C#/HandBrakeCS.csproj
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs

index 7100eb5..0541fbb 100644 (file)
@@ -323,7 +323,7 @@ namespace Handbrake.Functions
 \r
             // H264 Tab & Preset Name\r
             #region other\r
-            mainWindow.rtf_h264advanced.Text = presetQuery.H264Query;\r
+            mainWindow.rtf_x264Query.Text = presetQuery.H264Query;\r
 \r
             // Set the preset name\r
             mainWindow.groupBox_output.Text = "Output Settings (Preset: " + name + ")";\r
@@ -782,7 +782,7 @@ namespace Handbrake.Functions
             // H264 Tab\r
             #region  H264 Tab\r
 \r
-            string h264Advanced = mainWindow.rtf_h264advanced.Text;\r
+            string h264Advanced = mainWindow.rtf_x264Query.Text;\r
 \r
             if ((h264Advanced == ""))\r
                 h264Advanced = "";\r
diff --git a/win/C#/Functions/x264Panel.cs b/win/C#/Functions/x264Panel.cs
new file mode 100644 (file)
index 0000000..b781a8a
--- /dev/null
@@ -0,0 +1,1002 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.Text;\r
+using System.Windows.Forms;\r
+\r
+namespace Handbrake.Functions\r
+{\r
+    class x264Panel\r
+    {\r
+        Boolean NoWidgetUpdate = false;\r
+\r
+        /// <summary>\r
+        /// Reset all components to defaults and clears the x264 rtf box\r
+        /// </summary>\r
+        public void reset2Defaults(frmMain mainWindow)\r
+        {\r
+            mainWindow.check_8x8DCT.CheckState = CheckState.Unchecked;\r
+            mainWindow.check_bFrameDistortion.CheckState = CheckState.Unchecked;\r
+            mainWindow.check_BidirectionalRefinement.CheckState = CheckState.Unchecked;\r
+            mainWindow.check_Cabac.CheckState = CheckState.Checked;\r
+            mainWindow.check_mixedReferences.CheckState = CheckState.Unchecked;\r
+            mainWindow.check_noDCTDecimate.CheckState = CheckState.Unchecked;\r
+            mainWindow.check_noFastPSkip.CheckState = CheckState.Unchecked;\r
+            mainWindow.check_pyrmidalBFrames.CheckState = CheckState.Unchecked;\r
+            mainWindow.check_weightedBFrames.CheckState = CheckState.Unchecked;\r
+            mainWindow.drop_analysis.SelectedIndex = 0;\r
+            mainWindow.drop_bFrames.SelectedIndex = 0;\r
+            mainWindow.drop_deblockAlpha.SelectedIndex = 0;\r
+            mainWindow.drop_deblockBeta.SelectedIndex = 0;\r
+            mainWindow.drop_directPrediction.SelectedIndex = 0;\r
+            mainWindow.drop_MotionEstimationMethod.SelectedIndex = 0;\r
+            mainWindow.drop_MotionEstimationRange.SelectedIndex = 0;\r
+            mainWindow.drop_refFrames.SelectedIndex = 0;\r
+            mainWindow.drop_subpixelMotionEstimation.SelectedIndex = 0;\r
+            mainWindow.drop_trellis.SelectedIndex = 0;\r
+\r
+            mainWindow.rtf_x264Query.Text = "";\r
+        }\r
+\r
+        /// <summary>\r
+        /// Update GUI componets from the current x264 rtf string\r
+        /// </summary>\r
+        public void X264_SetCurrentSettingsInPanel(frmMain mainWindow)\r
+        {\r
+            // When the widgets are changed, we don't want them to update the text box again. No Need.\r
+            // This boolean controls the Widget Change function\r
+\r
+\r
+            /* Set widgets depending on the opt string in field */\r
+            String thisOpt; // The separated option such as "bframes=3"\r
+            String optName = ""; // The option name such as "bframes"\r
+            String optValue = "";// The option value such as "3"\r
+            String[] currentOptsArray;\r
+\r
+            //Set currentOptString to the contents of the text box.\r
+            String currentOptString = mainWindow.rtf_x264Query.Text.Replace("\n", "");\r
+\r
+            /*verify there is an opt string to process */\r
+            if (currentOptString.Contains("="))\r
+            {\r
+                /*Put individual options into an array based on the ":" separator for processing, result is "<opt>=<value>"*/\r
+                currentOptsArray = currentOptString.Split(':');\r
+\r
+                /*iterate through the array and get <opts> and <values*/\r
+                int loopcounter;\r
+                int currentOptsArrayCount = currentOptsArray.Length;\r
+         \r
+\r
+                /*iterate through the array and get <opts> and <values*/\r
+                for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++)\r
+                {\r
+     \r
+                    thisOpt = currentOptsArray[loopcounter];\r
+                    String[] splitOptRange = thisOpt.Split('=');\r
+\r
+                    if (thisOpt.Contains("="))\r
+                    {\r
+                        optName = splitOptRange[0];\r
+                        optValue = splitOptRange[1];\r
+\r
+                        /*Run through the available widgets for x264 opts and set them, as you add widgets, \r
+                            they need to be added here. This should be moved to its own method probably*/\r
+\r
+                        /*bframes NSPopUpButton*/\r
+                        if (optName.Equals("bframes"))\r
+                            mainWindow.drop_bFrames.SelectedItem = optValue;\r
+\r
+                        /*ref NSPopUpButton*/\r
+                        else if (optName.Equals("ref"))\r
+                            mainWindow.drop_refFrames.SelectedItem = optValue;\r
+\r
+                        /*No Fast PSkip NSPopUpButton*/\r
+                        else if (optName.Equals("no-fast-pskip"))\r
+                            mainWindow.check_noFastPSkip.CheckState = CheckState.Checked;\r
+\r
+                        /*No Dict Decimate NSPopUpButton*/\r
+                        else if (optName.Equals("no-dct-decimate"))\r
+                            mainWindow.check_noDCTDecimate.CheckState = CheckState.Checked;\r
+\r
+                        /*Sub Me NSPopUpButton*/\r
+                        else if (optName.Equals("subq"))\r
+                            mainWindow.drop_subpixelMotionEstimation.SelectedItem = optValue;\r
+\r
+                        /*Trellis NSPopUpButton*/\r
+                        else if (optName.Equals("trellis"))\r
+                            mainWindow.drop_trellis.SelectedItem = optValue;\r
+\r
+                        /*Mixed Refs NSButton*/\r
+                        else if (optName.Equals("mixed-refs"))\r
+                            mainWindow.check_mixedReferences.CheckState = CheckState.Checked;\r
+\r
+                        /*Motion Estimation NSPopUpButton*/\r
+                        else if (optName.Equals("me"))\r
+                        {\r
+                            if (optValue.Equals("dia"))\r
+                                mainWindow.drop_MotionEstimationMethod.SelectedItem = "Diamond";\r
+                            else if (optValue.Equals("hex"))\r
+                                mainWindow.drop_MotionEstimationMethod.SelectedItem = "Hexagon";\r
+                            else if (optValue.Equals("umh"))\r
+                                mainWindow.drop_MotionEstimationMethod.SelectedItem = "Uneven Multi-Hexagon";\r
+                            else if (optValue.Equals("esa"))\r
+                                mainWindow.drop_MotionEstimationMethod.SelectedItem = "Exhaustive";\r
+\r
+                        }\r
+                        /*ME Range NSPopUpButton*/\r
+                        else if (optName.Equals("merange"))\r
+                            mainWindow.drop_MotionEstimationRange.SelectedItem = optValue;\r
+\r
+                        /*Weighted B-Frames NSPopUpButton*/\r
+                        else if (optName.Equals("weightb"))\r
+                            mainWindow.check_weightedBFrames.CheckState = CheckState.Checked;\r
+\r
+                        /*BRDO NSPopUpButton*/\r
+                        else if (optName.Equals("brdo"))\r
+                            mainWindow.check_bFrameDistortion.CheckState = CheckState.Checked;\r
+\r
+                        /*B Pyramid NSPopUpButton*/\r
+                        else if (optName.Equals("b-pyramid"))\r
+                            mainWindow.check_pyrmidalBFrames.CheckState = CheckState.Checked;\r
+\r
+                        /*Bidirectional Motion Estimation Refinement NSPopUpButton*/\r
+                        else if (optName.Equals("bime"))\r
+                            mainWindow.check_BidirectionalRefinement.CheckState = CheckState.Checked;\r
+\r
+                        /*Direct B-frame Prediction NSPopUpButton*/\r
+                        else if (optName.Equals("direct"))\r
+                        {\r
+                            if (optValue == "auto")\r
+                                optValue = "Automatic";\r
+\r
+                            if (optValue != "")\r
+                            {\r
+                                Char[] letters = optValue.ToCharArray();\r
+                                letters[0] = Char.ToUpper(letters[0]);\r
+                                optValue = new string(letters);\r
+                            }\r
+\r
+                            mainWindow.drop_directPrediction.SelectedItem = optValue;\r
+                        }\r
+\r
+                        /*Deblocking NSPopUpButtons*/\r
+                        else if (optName.Equals("deblock"))\r
+                        {\r
+                            string alphaDeblock = "";\r
+                            string betaDeblock = "";\r
+\r
+                            string[] splitDeblock = optValue.Split(',');\r
+                            alphaDeblock = splitDeblock[0];\r
+                            betaDeblock = splitDeblock[1];\r
+\r
+                            if (alphaDeblock.Equals("0") && betaDeblock.Replace("\n", "").Equals("0"))\r
+                            {\r
+                                mainWindow.drop_deblockAlpha.SelectedItem = "Default (0)";\r
+                                mainWindow.drop_deblockBeta.SelectedItem = "Default (0)";\r
+                            }\r
+                            else\r
+                            {\r
+                                if (!alphaDeblock.Equals("0"))\r
+                                    mainWindow.drop_deblockAlpha.SelectedItem = alphaDeblock;\r
+                                else\r
+                                    mainWindow.drop_deblockAlpha.SelectedItem = "0";\r
+\r
+                                if (!betaDeblock.Replace("\n", "").Equals("0"))\r
+                                    mainWindow.drop_deblockBeta.SelectedItem = betaDeblock.Replace("\n", "");\r
+                                else\r
+                                    mainWindow.drop_deblockBeta.SelectedItem = "0";\r
+                            }\r
+                        }\r
+                        /* Analysis NSPopUpButton */\r
+                        else if (optName.Equals("analyse"))\r
+                        {\r
+\r
+                            if (optValue.Equals("p8x8,b8x8,i8x8,i4x4"))\r
+                                mainWindow.drop_analysis.SelectedItem = "Default (some)";\r
+                            if (optValue.Equals("none"))\r
+                                mainWindow.drop_analysis.SelectedItem = "None";\r
+                            if (optValue.Equals("all"))\r
+                                mainWindow.drop_analysis.SelectedItem = "All";\r
+                        }\r
+                        /* 8x8 DCT NSButton */\r
+                        else if (optName.Equals("8x8dct"))\r
+                            mainWindow.check_8x8DCT.CheckState = CheckState.Checked;\r
+\r
+                        /* CABAC NSButton */\r
+                        else if (optName.Equals("cabac"))\r
+                            mainWindow.check_Cabac.CheckState = CheckState.Unchecked;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Iterate over every x264 option, standardize it, write the full string to the x264 rtf box\r
+        /// </summary>\r
+        public void X264_StandardizeOptString(frmMain mainWindow)\r
+        {\r
+            /* Set widgets depending on the opt string in field */\r
+            String thisOpt; // The separated option such as "bframes=3"\r
+            String optName = ""; // The option name such as "bframes"\r
+            String optValue = "";// The option value such as "3"\r
+            String changedOptString = "";\r
+            String[] currentOptsArray;\r
+\r
+            /*First, we get an opt string to process */\r
+            String currentOptString = mainWindow.rtf_x264Query.Text;\r
+\r
+            /*verify there is an opt string to process */\r
+            if (currentOptString.Contains("="))\r
+            {\r
+                /*Put individual options into an array based on the ":" separator for processing, result is "<opt>=<value>"*/\r
+                currentOptsArray = currentOptString.Split(':');\r
+\r
+                /*iterate through the array and get <opts> and <values*/\r
+                //NSEnumerator * enumerator = [currentOptsArray objectEnumerator];\r
+                int loopcounter;\r
+                int currentOptsArrayCount = currentOptsArray.Length;\r
+                for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++)\r
+                {\r
+                    thisOpt = currentOptsArray[loopcounter];\r
+                    if (currentOptsArray[currentOptsArrayCount - 1] == "")\r
+                        break;\r
+\r
+                    String[] splitOptRange = thisOpt.Split('=');\r
+                    if (thisOpt != "")\r
+                    {\r
+                        if (thisOpt.Contains("="))\r
+                        {\r
+                            optName = splitOptRange[0];\r
+                            optValue = splitOptRange[1];\r
+\r
+                            /* Standardize the names here depending on whats in the string */\r
+                            optName = X264_StandardizeOptNames(optName);\r
+                            thisOpt = optName + "=" + optValue;\r
+                        }\r
+                        else // No value given so we use a default of "1"\r
+                        {\r
+                            optName = thisOpt;\r
+                            /* Standardize the names here depending on whats in the string */\r
+                            optName = X264_StandardizeOptNames(optName);\r
+                            thisOpt = optName + "=1";\r
+                        }\r
+                    }\r
+\r
+                    /* Construct New String for opts here */\r
+                    if (thisOpt == "")\r
+                        changedOptString = changedOptString + thisOpt;\r
+                    else\r
+                    {\r
+                        if (changedOptString == "")\r
+                            changedOptString = thisOpt;\r
+                        else\r
+                            changedOptString = changedOptString + ":" + thisOpt;\r
+                    }\r
+                }\r
+            }\r
+\r
+            /* Change the option string to reflect the new standardized option string */\r
+            if (changedOptString != "")\r
+                mainWindow.rtf_x264Query.Text = changedOptString;\r
+        }\r
+\r
+        /// <summary>\r
+        /// This function will update the X264 Query when one of the GUI widgets changes.\r
+        /// </summary>\r
+        public void on_x264_WidgetChange(string sender, frmMain mainWindow)\r
+        {\r
+            if (NoWidgetUpdate == false)\r
+            {\r
+                String optNameToChange = sender;\r
+                String currentOptString = mainWindow.rtf_x264Query.Text;\r
+\r
+                /*First, we create a pattern to check for ":"optNameToChange"=" to modify the option if the name falls after\r
+                    the first character of the opt string (hence the ":") */\r
+                String checkOptNameToChange = ":" + optNameToChange + "=";\r
+                String checkOptNameToChangeBegin = optNameToChange + "=";\r
+\r
+                // IF the current H264 Option String Contains Multiple Items or Just 1 Item\r
+                if ((currentOptString.Contains(checkOptNameToChange)) || (currentOptString.StartsWith(checkOptNameToChangeBegin)))\r
+                    hasFullOption(currentOptString, optNameToChange, mainWindow);\r
+                else // IF there is no options in the rich text box!\r
+                    hasNoOptions(optNameToChange, mainWindow);\r
+            }\r
+            else\r
+            {\r
+                NoWidgetUpdate = false;\r
+            }\r
+        }\r
+        \r
+\r
+        #region Some Private Functions used by the above Public Functions\r
+        /*\r
+         * Used by on_x264_WidgetChange()\r
+         * Called when the current x264 option string contains multiple (or a single) item(s) in it seperated by :\r
+         * Basically, it updates the current option that the widget corrosponds to, if it is already in thes string\r
+         * otherwise, it adds it to the string.\r
+         */\r
+        private void hasFullOption(string currentOptString, string optNameToChange, frmMain mainWindow)\r
+        {\r
+            String thisOpt;             // The separated option such as "bframes=3"\r
+            String optName = "";        // The option name such as "bframes"\r
+            String optValue = "";       // The option value such as "3"\r
+            String[] currentOptsArray;\r
+\r
+            /* Create new empty opt string*/\r
+            String changedOptString = "";\r
+\r
+            /*Put individual options into an array based on the ":" separator for processing, result is "<opt>=<value>"*/\r
+            currentOptsArray = currentOptString.Split(':');\r
+\r
+            /*iterate through the array and get <opts> and <values*/\r
+            for (int loopcounter = 0; loopcounter < currentOptsArray.Length; loopcounter++)\r
+            {\r
+                thisOpt = currentOptsArray[loopcounter];\r
+\r
+                if (thisOpt.Contains("="))\r
+                {\r
+                    string[] splitOptRange = thisOpt.Split('=');\r
+\r
+                    optName = splitOptRange[0];     // e.g bframes\r
+                    optValue = splitOptRange[1];    // e.g 2\r
+\r
+                    /* \r
+                     * Run through the available widgets for x264 opts and set them, as you add widgets,\r
+                     * they need to be added here. This should be moved to its own method probably\r
+                     * If the optNameToChange is found, appropriately change the value or delete it if\r
+                     * "unspecified" is set.\r
+                     */\r
+                    if (optName.Equals(optNameToChange))\r
+                    {\r
+                        if (optNameToChange.Equals("deblock"))\r
+                        {\r
+                            String da = mainWindow.drop_deblockAlpha.SelectedItem.ToString();\r
+                            String db = mainWindow.drop_deblockBeta.SelectedItem.ToString();\r
+\r
+                            if (((da.Contains("Default")) && (db.Contains("Default"))) || ((da.Contains("0")) && (db.Contains("0"))))\r
+                            {\r
+                                mainWindow.drop_deblockBeta.SelectedItem = "Default (0)";\r
+                                mainWindow.drop_deblockAlpha.SelectedItem = "Default (0)";\r
+                                thisOpt = "";\r
+                            }\r
+                            else if ((!da.Contains("Default")) && (db.Contains("Default")))\r
+                            {\r
+                                mainWindow.drop_deblockBeta.SelectedItem = "0";\r
+                                thisOpt = "deblock=" + da + ",0";\r
+                            }\r
+                            else if ((da.Contains("Default")) && (!db.Contains("Default")))\r
+                            {\r
+                                mainWindow.drop_deblockAlpha.SelectedItem = "0";\r
+                                thisOpt = "deblock=0," + db;\r
+                            }\r
+                            else if ((!da.Contains("Default")) && (!db.Contains("Default")))\r
+                                thisOpt = "deblock=" + da + "," + db;\r
+                        }\r
+\r
+                        else if (optNameToChange.Equals("mixed-refs"))\r
+                        {\r
+                            if (mainWindow.check_mixedReferences.CheckState == CheckState.Checked)\r
+                                thisOpt = "mixed-refs=1";\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("weightb"))\r
+                        {\r
+                            if (mainWindow.check_weightedBFrames.CheckState == CheckState.Checked)\r
+                                thisOpt = "weightb=1";\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("brdo"))\r
+                        {\r
+                            if (mainWindow.check_bFrameDistortion.CheckState == CheckState.Checked)\r
+                                thisOpt = "brdo=1";\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("bime"))\r
+                        {\r
+                            if (mainWindow.check_BidirectionalRefinement.CheckState == CheckState.Checked)\r
+                                thisOpt = "bime=1";\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("b-pyramid"))\r
+                        {\r
+                            if (mainWindow.check_pyrmidalBFrames.CheckState == CheckState.Checked)\r
+                                thisOpt = "b-pyramid=1";\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("no-fast-pskip"))\r
+                        {\r
+                            if (mainWindow.check_noFastPSkip.CheckState == CheckState.Checked)\r
+                                thisOpt = "no-fast-pskip=1";\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("no-dct-decimate"))\r
+                        {\r
+                            if (mainWindow.check_noDCTDecimate.CheckState == CheckState.Checked)\r
+                                thisOpt = "no-dct-decimate=1";\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("8x8dct"))\r
+                        {\r
+                            if (mainWindow.check_8x8DCT.CheckState == CheckState.Checked)\r
+                                thisOpt = "8x8dct=1";\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("cabac"))\r
+                        {\r
+                            if (mainWindow.check_Cabac.CheckState == CheckState.Checked)\r
+                                thisOpt = "";\r
+                            else\r
+                                thisOpt = "cabac=0";\r
+                        }\r
+                        else if (optNameToChange.Equals("me"))\r
+                        {\r
+                            switch (mainWindow.drop_MotionEstimationMethod.SelectedIndex)\r
+                            {\r
+                                case 1:\r
+                                    thisOpt = "me=dia";\r
+                                    break;\r
+\r
+                                case 2:\r
+                                    thisOpt = "me=hex";\r
+                                    break;\r
+\r
+                                case 3:\r
+                                    thisOpt = "me=umh";\r
+                                    break;\r
+\r
+                                case 4:\r
+                                    thisOpt = "me=esa";\r
+                                    break;\r
+\r
+                                default:\r
+                                    thisOpt = "";\r
+                                    break;\r
+                            }\r
+                        }\r
+                        else if (optNameToChange.Equals("direct"))\r
+                        {\r
+                            switch (mainWindow.drop_directPrediction.SelectedIndex)\r
+                            {\r
+                                case 1:\r
+                                    thisOpt = "direct=none";\r
+                                    break;\r
+\r
+                                case 2:\r
+                                    thisOpt = "direct=spatial";\r
+                                    break;\r
+\r
+                                case 3:\r
+                                    thisOpt = "direct=temporal";\r
+                                    break;\r
+\r
+                                case 4:\r
+                                    thisOpt = "direct=auto";\r
+                                    break;\r
+\r
+                                default:\r
+                                    thisOpt = "";\r
+                                    break;\r
+                            }\r
+                        }\r
+                        else if (optNameToChange.Equals("analyse"))\r
+                        {\r
+                            switch (mainWindow.drop_analysis.SelectedIndex)\r
+                            {\r
+                                case 1:\r
+                                    thisOpt = "analyse=none";\r
+                                    break;\r
+\r
+                                case 2:\r
+                                    thisOpt = "analyse=all";\r
+                                    break;\r
+\r
+                                default:\r
+                                    thisOpt = "";\r
+                                    break;\r
+                            }\r
+                        }\r
+                        else if (optNameToChange.Equals("merange"))\r
+                        {\r
+                            if (!mainWindow.drop_MotionEstimationRange.SelectedItem.ToString().Contains("Default"))\r
+                                thisOpt = "merange=" + mainWindow.drop_MotionEstimationRange.SelectedItem.ToString();\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("ref"))\r
+                        {\r
+                            if (!mainWindow.drop_refFrames.SelectedItem.ToString().Contains("Default"))\r
+                                thisOpt = "ref=" + mainWindow.drop_refFrames.SelectedItem.ToString();\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("bframes"))\r
+                        {\r
+                            String value = mainWindow.drop_bFrames.SelectedItem.ToString();\r
+                            if (!mainWindow.drop_bFrames.SelectedItem.ToString().Contains("Default"))\r
+                                thisOpt = "bframes=" + value;\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("subq"))\r
+                        {\r
+                            String value = mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString();\r
+                            if (!mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString().Contains("Default"))\r
+                                thisOpt = "subq=" + value;\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+                        else if (optNameToChange.Equals("trellis"))\r
+                        {\r
+                            String value = mainWindow.drop_trellis.SelectedItem.ToString();\r
+                            if (!mainWindow.drop_trellis.SelectedItem.ToString().Contains("Default"))\r
+                                thisOpt = "trellis=" + value;\r
+                            else\r
+                                thisOpt = "";\r
+                        }\r
+\r
+                    }\r
+                }\r
+\r
+                /* Construct New String for opts here */\r
+                if (!thisOpt.Equals(""))\r
+                {\r
+                    if (changedOptString.Equals(""))\r
+                        changedOptString = thisOpt;\r
+                    else\r
+                        changedOptString = changedOptString + ":" + thisOpt;\r
+                }\r
+            }\r
+\r
+            /* Change the option string to reflect the new mod settings */\r
+            mainWindow.rtf_x264Query.Text = changedOptString;\r
+        }\r
+        /*\r
+         * Used by on_x264_WidgetChange()\r
+         * Called when the current x264 option string contains no options.\r
+         * This simply adds the option to the x264 query in the gui.\r
+         */\r
+        private void hasNoOptions(string optNameToChange, frmMain mainWindow)\r
+        {\r
+            // If the text box is blank\r
+            if (mainWindow.rtf_x264Query.Text == "")\r
+            {\r
+                if (optNameToChange.Equals("me"))\r
+                {\r
+                    switch (mainWindow.drop_MotionEstimationMethod.SelectedIndex)\r
+                    {\r
+                        case 1:\r
+                            mainWindow.rtf_x264Query.Text = "me=dia";\r
+                            break;\r
+\r
+                        case 2:\r
+                            mainWindow.rtf_x264Query.Text = "me=hex";\r
+\r
+                            break;\r
+\r
+                        case 3:\r
+                            mainWindow.rtf_x264Query.Text = "me=umh";\r
+                            break;\r
+\r
+                        case 4:\r
+                            mainWindow.rtf_x264Query.Text = "me=esa";\r
+                            break;\r
+\r
+                        default:\r
+                            break;\r
+                    }\r
+                }\r
+                else if (optNameToChange.Equals("direct"))\r
+                {\r
+                    switch (mainWindow.drop_directPrediction.SelectedIndex)\r
+                    {\r
+                        case 1:\r
+                            mainWindow.rtf_x264Query.Text = "direct=none";\r
+                            break;\r
+\r
+                        case 2:\r
+                            mainWindow.rtf_x264Query.Text = "direct=spatial";\r
+                            break;\r
+\r
+                        case 3:\r
+                            mainWindow.rtf_x264Query.Text = "direct=temporal";\r
+                            break;\r
+\r
+                        case 4:\r
+                            mainWindow.rtf_x264Query.Text = "direct=auto";\r
+                            break;\r
+\r
+                        default:\r
+                            break;\r
+                    }\r
+                }\r
+                else if (optNameToChange.Equals("analyse"))\r
+                {\r
+                    switch (mainWindow.drop_analysis.SelectedIndex)\r
+                    {\r
+                        case 1:\r
+                            mainWindow.rtf_x264Query.Text = "analyse=none";\r
+                            break;\r
+\r
+                        case 2:\r
+                            mainWindow.rtf_x264Query.Text = "analyse=all";\r
+                            break;\r
+\r
+                        default:\r
+                            break;\r
+                    }\r
+                }\r
+\r
+                else if (optNameToChange.Equals("merange"))\r
+                {\r
+                    int value = mainWindow.drop_MotionEstimationRange.SelectedIndex + 3;\r
+                    mainWindow.rtf_x264Query.Text = "merange=" + value.ToString();\r
+                }\r
+                else if (optNameToChange.Equals("deblock"))\r
+                {\r
+                    String da = mainWindow.drop_deblockAlpha.SelectedItem.ToString();\r
+                    String db = mainWindow.drop_deblockBeta.SelectedItem.ToString();\r
+\r
+                    if (((da.Contains("Default")) && (db.Contains("Default"))) || ((da.Contains("0")) && (db.Contains("0"))))\r
+                    {\r
+                        mainWindow.drop_deblockBeta.SelectedItem = "Default (0)";\r
+                        mainWindow.drop_deblockAlpha.SelectedItem = "Default (0)";\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                    }\r
+                    else if ((!da.Contains("Default")) && (db.Contains("Default")))\r
+                    {\r
+                        mainWindow.drop_deblockBeta.SelectedItem = "0";\r
+                        mainWindow.rtf_x264Query.Text = "deblock=" + da + ",0";\r
+                    }\r
+                    else if ((da.Contains("Default")) && (!db.Contains("Default")))\r
+                    {\r
+                        mainWindow.drop_deblockAlpha.SelectedItem = "0";\r
+                        mainWindow.rtf_x264Query.Text = "deblock=0," + db;\r
+                    }\r
+                    else if ((!da.Contains("Default")) && (!db.Contains("Default")))\r
+                    {\r
+                        mainWindow.rtf_x264Query.Text = "deblock=" + da + "," + db;\r
+                    }\r
+                }\r
+                else if (optNameToChange.Equals("mixed-refs"))\r
+                {\r
+                    if (mainWindow.check_mixedReferences.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = "mixed-refs=1";\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                }\r
+                else if (optNameToChange.Equals("weightb"))\r
+                {\r
+                    if (mainWindow.check_weightedBFrames.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = "weightb=1";\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                }\r
+                else if (optNameToChange.Equals("brdo"))\r
+                {\r
+                    if (mainWindow.check_bFrameDistortion.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = "brdo=1";\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                }\r
+                else if (optNameToChange.Equals("bime"))\r
+                {\r
+                    if (mainWindow.check_BidirectionalRefinement.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = "bime=1";\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                }\r
+                else if (optNameToChange.Equals("b-pyramid"))\r
+                {\r
+                    if (mainWindow.check_pyrmidalBFrames.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = "b-pyramid=1";\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                }\r
+                else if (optNameToChange.Equals("no-fast-pskip"))\r
+                {\r
+                    if (mainWindow.check_noFastPSkip.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = "no-fast-pskip=1";\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                }\r
+                else if (optNameToChange.Equals("no-dct-decimate"))\r
+                {\r
+                    if (mainWindow.check_noDCTDecimate.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = "no-dct-decimate=1";\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                }\r
+                else if (optNameToChange.Equals("8x8dct"))\r
+                {\r
+                    if (mainWindow.check_8x8DCT.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = "8x8dct=1";\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                }\r
+                else if (optNameToChange.Equals("cabac"))\r
+                {\r
+                    if (mainWindow.check_Cabac.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = "";\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = "cabac=0";\r
+                }\r
+                else if (optNameToChange.Equals("ref"))\r
+                {\r
+                    string refItem = mainWindow.drop_refFrames.SelectedItem.ToString();\r
+                    if (!refItem.Contains("default"))\r
+                        mainWindow.rtf_x264Query.Text = "ref=" + mainWindow.drop_refFrames.SelectedItem.ToString();\r
+                }\r
+                else if (optNameToChange.Equals("bframes"))\r
+                {\r
+                    String value = mainWindow.drop_bFrames.SelectedItem.ToString();\r
+                    if (!mainWindow.drop_bFrames.SelectedItem.ToString().Contains("Default"))\r
+                        mainWindow.rtf_x264Query.Text = "bframes=" + value;\r
+                }\r
+                else if (optNameToChange.Equals("subq"))\r
+                {\r
+                    String value = mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString();\r
+                    if (!mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString().Contains("Default"))\r
+                        mainWindow.rtf_x264Query.Text = "subq=" + value;\r
+                }\r
+                else if (optNameToChange.Equals("trellis"))\r
+                {\r
+                    String value = mainWindow.drop_trellis.SelectedItem.ToString();\r
+                    if (!mainWindow.drop_trellis.SelectedItem.ToString().Contains("Default"))\r
+                        mainWindow.rtf_x264Query.Text = "trellis=" + value;\r
+                }\r
+\r
+                //*******************************************************\r
+            }\r
+            else // There was some text in the box. This deals with options with no value. e.g "no-fast-pskip"\r
+            {\r
+                //*******************************************************\r
+                if (optNameToChange.Equals("me"))\r
+                {\r
+                    switch (mainWindow.drop_MotionEstimationMethod.SelectedIndex)\r
+                    {\r
+                        case 1:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":me=dia";\r
+                            break;\r
+\r
+                        case 2:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":me=hex";\r
+                            break;\r
+\r
+                        case 3:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":me=umh";\r
+                            break;\r
+\r
+                        case 4:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":me=esa";\r
+                            break;\r
+\r
+                        default:\r
+                            break;\r
+                    }\r
+                }\r
+                else if (optNameToChange.Equals("direct"))\r
+                {\r
+                    switch (mainWindow.drop_directPrediction.SelectedIndex)\r
+                    {\r
+                        case 1:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":direct=none";\r
+                            break;\r
+\r
+                        case 2:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":direct=spatial";\r
+                            break;\r
+\r
+                        case 3:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":direct=temporal";\r
+                            break;\r
+\r
+                        case 4:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":direct=auto";\r
+                            break;\r
+\r
+                        default:\r
+                            break;\r
+                    }\r
+                }\r
+                else if (optNameToChange.Equals("analyse"))\r
+                {\r
+                    switch (mainWindow.drop_analysis.SelectedIndex)\r
+                    {\r
+                        case 1:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":analyse=none";\r
+                            break;\r
+\r
+                        case 2:\r
+                            mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":analyse=all";\r
+                            break;\r
+\r
+                        default:\r
+                            break;\r
+                    }\r
+                }\r
+\r
+                else if (optNameToChange.Equals("merange"))\r
+                {\r
+                    int value = mainWindow.drop_MotionEstimationRange.SelectedIndex + 3;\r
+                    mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":merange=" + value.ToString();\r
+                }\r
+                else if (optNameToChange.Equals("deblock"))\r
+                {\r
+                    String da = mainWindow.drop_deblockAlpha.SelectedItem.ToString();\r
+                    String db = mainWindow.drop_deblockBeta.Text.ToString();\r
+\r
+                    if (((da.Contains("Default")) && (db.Contains("Default"))) || ((da.Contains("0")) && (db.Contains("0"))))\r
+                    {\r
+                        mainWindow.drop_deblockBeta.SelectedItem = "Default (0)";\r
+                        mainWindow.drop_deblockAlpha.SelectedItem = "Default (0)";\r
+                    }\r
+                    else\r
+                    {\r
+                        if (db.Contains("Default"))\r
+                            db = "0";\r
+\r
+                        if (da.Contains("Default"))\r
+                            da = "0";\r
+\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":deblock=" + da + "," + db;\r
+                    }\r
+                }\r
+                else if (optNameToChange.Equals("mixed-refs"))\r
+                {\r
+                    if (mainWindow.check_mixedReferences.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":mixed-refs=1";\r
+                }\r
+                else if (optNameToChange.Equals("weightb"))\r
+                {\r
+                    if (mainWindow.check_weightedBFrames.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":weightb=1";\r
+                }\r
+                else if (optNameToChange.Equals("brdo"))\r
+                {\r
+                    if (mainWindow.check_bFrameDistortion.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":brdo=1";\r
+                }\r
+                else if (optNameToChange.Equals("bime"))\r
+                {\r
+                    if (mainWindow.check_BidirectionalRefinement.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":bime=1";\r
+                }\r
+                else if (optNameToChange.Equals("b-pyramid"))\r
+                {\r
+                    if (mainWindow.check_pyrmidalBFrames.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":b-pyramid=1";\r
+                }\r
+                else if (optNameToChange.Equals("no-fast-pskip"))\r
+                {\r
+                    if (mainWindow.check_noFastPSkip.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":no-fast-pskip=1";\r
+                }\r
+                else if (optNameToChange.Equals("no-dct-decimate"))\r
+                {\r
+                    if (mainWindow.check_noDCTDecimate.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":no-dct-decimate=1";\r
+                }\r
+                else if (optNameToChange.Equals("8x8dct"))\r
+                {\r
+                    if (mainWindow.check_8x8DCT.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":8x8dct=1";\r
+                }\r
+                else if (optNameToChange.Equals("cabac"))\r
+                {\r
+                    if (mainWindow.check_Cabac.CheckState == CheckState.Checked)\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text;\r
+                    else\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":cabac=0";\r
+                }\r
+                else if (optNameToChange.Equals("ref"))\r
+                {\r
+                    if (!mainWindow.drop_refFrames.SelectedItem.ToString().Contains("Default"))\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":ref=" + mainWindow.drop_refFrames.SelectedItem.ToString();\r
+                }\r
+                else if (optNameToChange.Equals("bframes"))\r
+                {\r
+                    int value = mainWindow.drop_bFrames.SelectedIndex;\r
+                    value = value - 1;\r
+                    if (!mainWindow.drop_bFrames.SelectedItem.ToString().Contains("Default"))\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":bframes=" + value.ToString();\r
+                }\r
+                else if (optNameToChange.Equals("subq"))\r
+                {\r
+                    String value = mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString();\r
+                    if (!mainWindow.drop_subpixelMotionEstimation.SelectedItem.ToString().Contains("Default"))\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":subq=" + value;\r
+                }\r
+                else if (optNameToChange.Equals("trellis"))\r
+                {\r
+                    if (!mainWindow.drop_trellis.SelectedItem.ToString().Contains("Default"))\r
+                        mainWindow.rtf_x264Query.Text = mainWindow.rtf_x264Query.Text + ":trellis=" + mainWindow.drop_trellis.SelectedItem.ToString();\r
+                }\r
+            }\r
+        }\r
+\r
+        /*\r
+         * Take a single option and standardize it. Returns as a String\r
+         * Input: String. - Single X264 Option. Name only\r
+         * Output: String - Single X264 Option. Name only. Changed to standard format\r
+         */\r
+        private string X264_StandardizeOptNames(String cleanOptNameString)\r
+        {\r
+            String input = cleanOptNameString;\r
+            if (input.Equals("ref") || input.Equals("frameref"))\r
+            {\r
+                cleanOptNameString = "ref";\r
+            }\r
+\r
+            /*No Fast PSkip nofast_pskip*/\r
+            if (input.Equals("no-fast-pskip") || input.Equals("no_fast_pskip") || input.Equals("nofast_pskip"))\r
+            {\r
+                cleanOptNameString = "no-fast-pskip";\r
+            }\r
+\r
+            /*No Dict Decimate*/\r
+            if (input.Equals("no-dct-decimate") || input.Equals("no_dct_decimate") || input.Equals("nodct_decimate"))\r
+            {\r
+                cleanOptNameString = "no-dct-decimate";\r
+            }\r
+\r
+            /*Subme*/\r
+            if (input.Equals("subme"))\r
+            {\r
+                cleanOptNameString = "subq";\r
+            }\r
+\r
+            /*ME Range*/\r
+            if (input.Equals("me-range") || input.Equals("me_range"))\r
+            {\r
+                cleanOptNameString = "merange";\r
+            }\r
+\r
+            /*WeightB*/\r
+            if (input.Equals("weight-b") || input.Equals("weight_b"))\r
+            {\r
+                cleanOptNameString = "weightb";\r
+            }\r
+\r
+            /*BRDO*/\r
+            if (input.Equals("b-rdo") || input.Equals("b_rdo"))\r
+            {\r
+                cleanOptNameString = "brdo";\r
+            }\r
+\r
+            /*B Pyramid*/\r
+            if (input.Equals("b_pyramid"))\r
+            {\r
+                cleanOptNameString = "b-pyramid";\r
+            }\r
+\r
+            /*Direct Prediction*/\r
+            if (input.Equals("direct-pred") || input.Equals("direct_pred"))\r
+            {\r
+                cleanOptNameString = "direct";\r
+            }\r
+\r
+            /*Deblocking*/\r
+            if (input.Equals("filter"))\r
+            {\r
+                cleanOptNameString = "deblock";\r
+            }\r
+\r
+            /*Analysis*/\r
+            if (input.Equals("partitions"))\r
+            {\r
+                cleanOptNameString = "analyse";\r
+            }\r
+\r
+            return cleanOptNameString;\r
+        }\r
+\r
+        #endregion\r
+    }\r
+}\r
index ed583a8..da343ea 100644 (file)
     <Compile Include="Functions\RssReader.cs" />\r
     <Compile Include="Functions\CLI.cs" />\r
     <Compile Include="Functions\QueryParser.cs" />\r
+    <Compile Include="Functions\x264Panel.cs" />\r
     <Compile Include="Parsing\AudioTrack.cs" />\r
     <Compile Include="Parsing\Chapter.cs" />\r
     <Compile Include="Parsing\DVD.cs" />\r
index f722d18..7a8fb72 100644 (file)
@@ -64,7 +64,6 @@ namespace Handbrake
             this.drp_audioMixDown = new System.Windows.Forms.ComboBox();\r
             this.text_height = new System.Windows.Forms.TextBox();\r
             this.text_width = new System.Windows.Forms.TextBox();\r
-            this.rtf_h264advanced = new System.Windows.Forms.RichTextBox();\r
             this.RadioDVD = new System.Windows.Forms.RadioButton();\r
             this.check_optimiseMP4 = new System.Windows.Forms.CheckBox();\r
             this.check_iPodAtom = new System.Windows.Forms.CheckBox();\r
@@ -178,12 +177,49 @@ namespace Handbrake
             this.lbl_warn_chapt = new System.Windows.Forms.Label();\r
             this.label31 = new System.Windows.Forms.Label();\r
             this.h264Tab = new System.Windows.Forms.TabPage();\r
-            this.Label43 = new System.Windows.Forms.Label();\r
-            this.label_h264 = new System.Windows.Forms.LinkLabel();\r
-            this.Label95 = new System.Windows.Forms.Label();\r
-            this.btn_h264Clear = new System.Windows.Forms.Button();\r
-            this.Label90 = new System.Windows.Forms.Label();\r
-            this.Label92 = new System.Windows.Forms.Label();\r
+            this.label43 = new System.Windows.Forms.Label();\r
+            this.btn_reset = new System.Windows.Forms.Button();\r
+            this.rtf_x264Query = new System.Windows.Forms.RichTextBox();\r
+            this.label35 = new System.Windows.Forms.Label();\r
+            this.check_Cabac = new System.Windows.Forms.CheckBox();\r
+            this.label36 = new System.Windows.Forms.Label();\r
+            this.check_noDCTDecimate = new System.Windows.Forms.CheckBox();\r
+            this.label37 = new System.Windows.Forms.Label();\r
+            this.check_noFastPSkip = new System.Windows.Forms.CheckBox();\r
+            this.label39 = new System.Windows.Forms.Label();\r
+            this.drop_trellis = new System.Windows.Forms.ComboBox();\r
+            this.drop_deblockBeta = new System.Windows.Forms.ComboBox();\r
+            this.label41 = new System.Windows.Forms.Label();\r
+            this.drop_deblockAlpha = new System.Windows.Forms.ComboBox();\r
+            this.panel3 = new System.Windows.Forms.Panel();\r
+            this.panel1 = new System.Windows.Forms.Panel();\r
+            this.panel2 = new System.Windows.Forms.Panel();\r
+            this.label44 = new System.Windows.Forms.Label();\r
+            this.check_8x8DCT = new System.Windows.Forms.CheckBox();\r
+            this.label45 = new System.Windows.Forms.Label();\r
+            this.drop_analysis = new System.Windows.Forms.ComboBox();\r
+            this.label48 = new System.Windows.Forms.Label();\r
+            this.drop_subpixelMotionEstimation = new System.Windows.Forms.ComboBox();\r
+            this.label49 = new System.Windows.Forms.Label();\r
+            this.drop_MotionEstimationRange = new System.Windows.Forms.ComboBox();\r
+            this.label54 = new System.Windows.Forms.Label();\r
+            this.drop_MotionEstimationMethod = new System.Windows.Forms.ComboBox();\r
+            this.label57 = new System.Windows.Forms.Label();\r
+            this.check_pyrmidalBFrames = new System.Windows.Forms.CheckBox();\r
+            this.label58 = new System.Windows.Forms.Label();\r
+            this.check_BidirectionalRefinement = new System.Windows.Forms.CheckBox();\r
+            this.label59 = new System.Windows.Forms.Label();\r
+            this.check_bFrameDistortion = new System.Windows.Forms.CheckBox();\r
+            this.label60 = new System.Windows.Forms.Label();\r
+            this.check_weightedBFrames = new System.Windows.Forms.CheckBox();\r
+            this.label61 = new System.Windows.Forms.Label();\r
+            this.drop_directPrediction = new System.Windows.Forms.ComboBox();\r
+            this.label62 = new System.Windows.Forms.Label();\r
+            this.drop_bFrames = new System.Windows.Forms.ComboBox();\r
+            this.label63 = new System.Windows.Forms.Label();\r
+            this.label64 = new System.Windows.Forms.Label();\r
+            this.drop_refFrames = new System.Windows.Forms.ComboBox();\r
+            this.check_mixedReferences = new System.Windows.Forms.CheckBox();\r
             this.tabPage4 = new System.Windows.Forms.TabPage();\r
             this.btn_clear = new System.Windows.Forms.Button();\r
             this.btn_copy2C = new System.Windows.Forms.Button();\r
@@ -595,16 +631,6 @@ namespace Handbrake
             this.ToolTip.SetToolTip(this.text_width, "Video Resolution (Width)");\r
             this.text_width.TextChanged += new System.EventHandler(this.text_width_TextChanged);\r
             // \r
-            // rtf_h264advanced\r
-            // \r
-            this.rtf_h264advanced.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
-            this.rtf_h264advanced.Location = new System.Drawing.Point(16, 79);\r
-            this.rtf_h264advanced.Name = "rtf_h264advanced";\r
-            this.rtf_h264advanced.Size = new System.Drawing.Size(605, 123);\r
-            this.rtf_h264advanced.TabIndex = 2;\r
-            this.rtf_h264advanced.Text = "";\r
-            this.ToolTip.SetToolTip(this.rtf_h264advanced, "H.264 advanced options can be added here. See link below for details.");\r
-            // \r
             // RadioDVD\r
             // \r
             this.RadioDVD.AutoSize = true;\r
@@ -1114,9 +1140,10 @@ namespace Handbrake
             this.TabPage2.Location = new System.Drawing.Point(4, 22);\r
             this.TabPage2.Name = "TabPage2";\r
             this.TabPage2.Padding = new System.Windows.Forms.Padding(3);\r
-            this.TabPage2.Size = new System.Drawing.Size(649, 283);\r
+            this.TabPage2.Size = new System.Drawing.Size(649, 302);\r
             this.TabPage2.TabIndex = 3;\r
             this.TabPage2.Text = "Audio && Subtitles";\r
+            this.TabPage2.UseVisualStyleBackColor = true;\r
             // \r
             // label30\r
             // \r
@@ -1345,9 +1372,10 @@ namespace Handbrake
             this.TabPage3.Location = new System.Drawing.Point(4, 22);\r
             this.TabPage3.Name = "TabPage3";\r
             this.TabPage3.Padding = new System.Windows.Forms.Padding(3);\r
-            this.TabPage3.Size = new System.Drawing.Size(649, 283);\r
+            this.TabPage3.Size = new System.Drawing.Size(649, 302);\r
             this.TabPage3.TabIndex = 2;\r
             this.TabPage3.Text = "Video";\r
+            this.TabPage3.UseVisualStyleBackColor = true;\r
             // \r
             // label25\r
             // \r
@@ -1499,9 +1527,10 @@ namespace Handbrake
             this.TabPage1.Location = new System.Drawing.Point(4, 22);\r
             this.TabPage1.Name = "TabPage1";\r
             this.TabPage1.Padding = new System.Windows.Forms.Padding(3);\r
-            this.TabPage1.Size = new System.Drawing.Size(649, 283);\r
+            this.TabPage1.Size = new System.Drawing.Size(649, 302);\r
             this.TabPage1.TabIndex = 0;\r
             this.TabPage1.Text = "Picture Settings";\r
+            this.TabPage1.UseVisualStyleBackColor = true;\r
             // \r
             // label6\r
             // \r
@@ -1869,7 +1898,7 @@ namespace Handbrake
             this.advancedOptions.Location = new System.Drawing.Point(14, 281);\r
             this.advancedOptions.Name = "advancedOptions";\r
             this.advancedOptions.SelectedIndex = 0;\r
-            this.advancedOptions.Size = new System.Drawing.Size(657, 309);\r
+            this.advancedOptions.Size = new System.Drawing.Size(657, 328);\r
             this.advancedOptions.TabIndex = 5;\r
             this.advancedOptions.TabStop = false;\r
             // \r
@@ -1882,9 +1911,10 @@ namespace Handbrake
             this.tab_chapters.Controls.Add(this.Check_ChapterMarkers);\r
             this.tab_chapters.Location = new System.Drawing.Point(4, 22);\r
             this.tab_chapters.Name = "tab_chapters";\r
-            this.tab_chapters.Size = new System.Drawing.Size(649, 283);\r
+            this.tab_chapters.Size = new System.Drawing.Size(649, 302);\r
             this.tab_chapters.TabIndex = 6;\r
             this.tab_chapters.Text = "Chapters";\r
+            this.tab_chapters.UseVisualStyleBackColor = true;\r
             // \r
             // lbl_warn_chapt\r
             // \r
@@ -1908,88 +1938,524 @@ namespace Handbrake
             // \r
             // h264Tab\r
             // \r
-            this.h264Tab.BackColor = System.Drawing.SystemColors.ControlLight;\r
-            this.h264Tab.Controls.Add(this.Label43);\r
-            this.h264Tab.Controls.Add(this.label_h264);\r
-            this.h264Tab.Controls.Add(this.Label95);\r
-            this.h264Tab.Controls.Add(this.btn_h264Clear);\r
-            this.h264Tab.Controls.Add(this.Label90);\r
-            this.h264Tab.Controls.Add(this.rtf_h264advanced);\r
-            this.h264Tab.Controls.Add(this.Label92);\r
+            this.h264Tab.Controls.Add(this.label43);\r
+            this.h264Tab.Controls.Add(this.btn_reset);\r
+            this.h264Tab.Controls.Add(this.rtf_x264Query);\r
+            this.h264Tab.Controls.Add(this.label35);\r
+            this.h264Tab.Controls.Add(this.check_Cabac);\r
+            this.h264Tab.Controls.Add(this.label36);\r
+            this.h264Tab.Controls.Add(this.check_noDCTDecimate);\r
+            this.h264Tab.Controls.Add(this.label37);\r
+            this.h264Tab.Controls.Add(this.check_noFastPSkip);\r
+            this.h264Tab.Controls.Add(this.label39);\r
+            this.h264Tab.Controls.Add(this.drop_trellis);\r
+            this.h264Tab.Controls.Add(this.drop_deblockBeta);\r
+            this.h264Tab.Controls.Add(this.label41);\r
+            this.h264Tab.Controls.Add(this.drop_deblockAlpha);\r
+            this.h264Tab.Controls.Add(this.panel3);\r
+            this.h264Tab.Controls.Add(this.panel1);\r
+            this.h264Tab.Controls.Add(this.panel2);\r
+            this.h264Tab.Controls.Add(this.label44);\r
+            this.h264Tab.Controls.Add(this.check_8x8DCT);\r
+            this.h264Tab.Controls.Add(this.label45);\r
+            this.h264Tab.Controls.Add(this.drop_analysis);\r
+            this.h264Tab.Controls.Add(this.label48);\r
+            this.h264Tab.Controls.Add(this.drop_subpixelMotionEstimation);\r
+            this.h264Tab.Controls.Add(this.label49);\r
+            this.h264Tab.Controls.Add(this.drop_MotionEstimationRange);\r
+            this.h264Tab.Controls.Add(this.label54);\r
+            this.h264Tab.Controls.Add(this.drop_MotionEstimationMethod);\r
+            this.h264Tab.Controls.Add(this.label57);\r
+            this.h264Tab.Controls.Add(this.check_pyrmidalBFrames);\r
+            this.h264Tab.Controls.Add(this.label58);\r
+            this.h264Tab.Controls.Add(this.check_BidirectionalRefinement);\r
+            this.h264Tab.Controls.Add(this.label59);\r
+            this.h264Tab.Controls.Add(this.check_bFrameDistortion);\r
+            this.h264Tab.Controls.Add(this.label60);\r
+            this.h264Tab.Controls.Add(this.check_weightedBFrames);\r
+            this.h264Tab.Controls.Add(this.label61);\r
+            this.h264Tab.Controls.Add(this.drop_directPrediction);\r
+            this.h264Tab.Controls.Add(this.label62);\r
+            this.h264Tab.Controls.Add(this.drop_bFrames);\r
+            this.h264Tab.Controls.Add(this.label63);\r
+            this.h264Tab.Controls.Add(this.label64);\r
+            this.h264Tab.Controls.Add(this.drop_refFrames);\r
+            this.h264Tab.Controls.Add(this.check_mixedReferences);\r
+            this.h264Tab.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.h264Tab.Location = new System.Drawing.Point(4, 22);\r
             this.h264Tab.Name = "h264Tab";\r
             this.h264Tab.Padding = new System.Windows.Forms.Padding(3);\r
-            this.h264Tab.Size = new System.Drawing.Size(649, 283);\r
-            this.h264Tab.TabIndex = 5;\r
+            this.h264Tab.Size = new System.Drawing.Size(649, 302);\r
+            this.h264Tab.TabIndex = 8;\r
             this.h264Tab.Text = "Advanced";\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, 236);\r
-            this.Label43.Name = "Label43";\r
-            this.Label43.Size = new System.Drawing.Size(158, 13);\r
-            this.Label43.TabIndex = 6;\r
-            this.Label43.Text = "for help using this feature.";\r
-            // \r
-            // label_h264\r
-            // \r
-            this.label_h264.AutoSize = true;\r
-            this.label_h264.Location = new System.Drawing.Point(13, 236);\r
-            this.label_h264.Name = "label_h264";\r
-            this.label_h264.Size = new System.Drawing.Size(66, 13);\r
-            this.label_h264.TabIndex = 5;\r
-            this.label_h264.TabStop = true;\r
-            this.label_h264.Text = "Click Here";\r
-            this.label_h264.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.label_h264_LinkClicked);\r
-            // \r
-            // Label95\r
-            // \r
-            this.Label95.AutoSize = true;\r
-            this.Label95.BackColor = System.Drawing.Color.Transparent;\r
-            this.Label95.Location = new System.Drawing.Point(13, 217);\r
-            this.Label95.Name = "Label95";\r
-            this.Label95.Size = new System.Drawing.Size(387, 13);\r
-            this.Label95.TabIndex = 4;\r
-            this.Label95.Text = "Note: Incorrect usage of this feature will cause the encoder to fail!";\r
-            // \r
-            // btn_h264Clear\r
-            // \r
-            this.btn_h264Clear.BackColor = System.Drawing.Color.Transparent;\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
-            this.btn_h264Clear.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
-            this.btn_h264Clear.Location = new System.Drawing.Point(542, 50);\r
-            this.btn_h264Clear.Name = "btn_h264Clear";\r
-            this.btn_h264Clear.Size = new System.Drawing.Size(79, 23);\r
-            this.btn_h264Clear.TabIndex = 3;\r
-            this.btn_h264Clear.Text = "Clear";\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
-            this.Label90.Size = new System.Drawing.Size(165, 13);\r
-            this.Label90.TabIndex = 0;\r
-            this.Label90.Text = "Advanced H.264 Options";\r
-            // \r
-            // 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
-            this.Label92.TabIndex = 1;\r
-            this.Label92.Text = "Specify advanced x264 options in the same style as mencoder:\r\noption1=value1:opti" +\r
-                "on2=value2";\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.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label43.Location = new System.Drawing.Point(13, 13);\r
+            this.label43.Name = "label43";\r
+            this.label43.Size = new System.Drawing.Size(165, 13);\r
+            this.label43.TabIndex = 219;\r
+            this.label43.Text = "Advanced H.264 Options";\r
+            // \r
+            // btn_reset\r
+            // \r
+            this.btn_reset.Location = new System.Drawing.Point(13, 226);\r
+            this.btn_reset.Name = "btn_reset";\r
+            this.btn_reset.Size = new System.Drawing.Size(75, 23);\r
+            this.btn_reset.TabIndex = 217;\r
+            this.btn_reset.Text = "Reset All";\r
+            this.btn_reset.UseVisualStyleBackColor = true;\r
+            this.btn_reset.Click += new System.EventHandler(this.btn_reset_Click);\r
+            // \r
+            // rtf_x264Query\r
+            // \r
+            this.rtf_x264Query.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
+            this.rtf_x264Query.Location = new System.Drawing.Point(13, 253);\r
+            this.rtf_x264Query.Name = "rtf_x264Query";\r
+            this.rtf_x264Query.Size = new System.Drawing.Size(606, 43);\r
+            this.rtf_x264Query.TabIndex = 216;\r
+            this.rtf_x264Query.Text = "";\r
+            this.rtf_x264Query.LostFocus += new System.EventHandler(this.rtf_x264Query_TextChanged);\r
+            this.rtf_x264Query.TextChanged += new System.EventHandler(this.rtf_x264Query_TextChanged);\r
+            // \r
+            // label35\r
+            // \r
+            this.label35.AutoSize = true;\r
+            this.label35.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label35.Location = new System.Drawing.Point(476, 213);\r
+            this.label35.Name = "label35";\r
+            this.label35.Size = new System.Drawing.Size(128, 12);\r
+            this.label35.TabIndex = 215;\r
+            this.label35.Text = "CABAC Entropy Coding:";\r
+            // \r
+            // check_Cabac\r
+            // \r
+            this.check_Cabac.AutoSize = true;\r
+            this.check_Cabac.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.check_Cabac.Location = new System.Drawing.Point(610, 214);\r
+            this.check_Cabac.Name = "check_Cabac";\r
+            this.check_Cabac.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
+            this.check_Cabac.Size = new System.Drawing.Size(12, 11);\r
+            this.check_Cabac.TabIndex = 214;\r
+            this.check_Cabac.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+            this.check_Cabac.UseVisualStyleBackColor = true;\r
+            this.check_Cabac.CheckStateChanged += new System.EventHandler(this.check_Cabac_CheckedChanged);\r
+            // \r
+            // label36\r
+            // \r
+            this.label36.AutoSize = true;\r
+            this.label36.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label36.Location = new System.Drawing.Point(503, 194);\r
+            this.label36.Name = "label36";\r
+            this.label36.Size = new System.Drawing.Size(102, 12);\r
+            this.label36.TabIndex = 213;\r
+            this.label36.Text = "No DCT-Decimate:";\r
+            // \r
+            // check_noDCTDecimate\r
+            // \r
+            this.check_noDCTDecimate.AutoSize = true;\r
+            this.check_noDCTDecimate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.check_noDCTDecimate.Location = new System.Drawing.Point(610, 195);\r
+            this.check_noDCTDecimate.Name = "check_noDCTDecimate";\r
+            this.check_noDCTDecimate.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
+            this.check_noDCTDecimate.Size = new System.Drawing.Size(12, 11);\r
+            this.check_noDCTDecimate.TabIndex = 212;\r
+            this.check_noDCTDecimate.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+            this.check_noDCTDecimate.UseVisualStyleBackColor = true;\r
+            this.check_noDCTDecimate.CheckStateChanged += new System.EventHandler(this.check_noDCTDecimate_CheckedChanged);\r
+            // \r
+            // label37\r
+            // \r
+            this.label37.AutoSize = true;\r
+            this.label37.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label37.Location = new System.Drawing.Point(386, 193);\r
+            this.label37.Name = "label37";\r
+            this.label37.Size = new System.Drawing.Size(87, 12);\r
+            this.label37.TabIndex = 211;\r
+            this.label37.Text = "No Fast-P-Skip:";\r
+            // \r
+            // check_noFastPSkip\r
+            // \r
+            this.check_noFastPSkip.AutoSize = true;\r
+            this.check_noFastPSkip.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.check_noFastPSkip.Location = new System.Drawing.Point(479, 194);\r
+            this.check_noFastPSkip.Name = "check_noFastPSkip";\r
+            this.check_noFastPSkip.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
+            this.check_noFastPSkip.Size = new System.Drawing.Size(12, 11);\r
+            this.check_noFastPSkip.TabIndex = 210;\r
+            this.check_noFastPSkip.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+            this.check_noFastPSkip.UseVisualStyleBackColor = true;\r
+            this.check_noFastPSkip.CheckStateChanged += new System.EventHandler(this.check_noFastPSkip_CheckedChanged);\r
+            // \r
+            // label39\r
+            // \r
+            this.label39.AutoSize = true;\r
+            this.label39.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label39.Location = new System.Drawing.Point(432, 169);\r
+            this.label39.Name = "label39";\r
+            this.label39.Size = new System.Drawing.Size(41, 12);\r
+            this.label39.TabIndex = 209;\r
+            this.label39.Text = "Trellis:";\r
+            // \r
+            // drop_trellis\r
+            // \r
+            this.drop_trellis.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_trellis.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_trellis.FormattingEnabled = true;\r
+            this.drop_trellis.Location = new System.Drawing.Point(479, 166);\r
+            this.drop_trellis.Name = "drop_trellis";\r
+            this.drop_trellis.Size = new System.Drawing.Size(139, 20);\r
+            this.drop_trellis.TabIndex = 208;\r
+            this.drop_trellis.SelectedIndexChanged += new System.EventHandler(this.drop_trellis_SelectedIndexChanged);\r
+            // \r
+            // drop_deblockBeta\r
+            // \r
+            this.drop_deblockBeta.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_deblockBeta.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_deblockBeta.FormattingEnabled = true;\r
+            this.drop_deblockBeta.Location = new System.Drawing.Point(553, 139);\r
+            this.drop_deblockBeta.Name = "drop_deblockBeta";\r
+            this.drop_deblockBeta.Size = new System.Drawing.Size(69, 20);\r
+            this.drop_deblockBeta.TabIndex = 207;\r
+            this.drop_deblockBeta.SelectedIndexChanged += new System.EventHandler(this.drop_deblockBeta_SelectedIndexChanged);\r
+            // \r
+            // label41\r
+            // \r
+            this.label41.AutoSize = true;\r
+            this.label41.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label41.Location = new System.Drawing.Point(408, 147);\r
+            this.label41.Name = "label41";\r
+            this.label41.Size = new System.Drawing.Size(65, 12);\r
+            this.label41.TabIndex = 206;\r
+            this.label41.Text = "Deblocking:";\r
+            // \r
+            // drop_deblockAlpha\r
+            // \r
+            this.drop_deblockAlpha.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_deblockAlpha.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_deblockAlpha.FormattingEnabled = true;\r
+            this.drop_deblockAlpha.Location = new System.Drawing.Point(479, 139);\r
+            this.drop_deblockAlpha.Name = "drop_deblockAlpha";\r
+            this.drop_deblockAlpha.Size = new System.Drawing.Size(68, 20);\r
+            this.drop_deblockAlpha.TabIndex = 205;\r
+            this.drop_deblockAlpha.SelectedIndexChanged += new System.EventHandler(this.drop_deblockAlpha_SelectedIndexChanged);\r
+            // \r
+            // panel3\r
+            // \r
+            this.panel3.BackColor = System.Drawing.Color.Black;\r
+            this.panel3.Location = new System.Drawing.Point(338, 131);\r
+            this.panel3.Margin = new System.Windows.Forms.Padding(0);\r
+            this.panel3.Name = "panel3";\r
+            this.panel3.Size = new System.Drawing.Size(284, 1);\r
+            this.panel3.TabIndex = 204;\r
+            // \r
+            // panel1\r
+            // \r
+            this.panel1.BackColor = System.Drawing.Color.Black;\r
+            this.panel1.Location = new System.Drawing.Point(13, 84);\r
+            this.panel1.Margin = new System.Windows.Forms.Padding(0);\r
+            this.panel1.Name = "panel1";\r
+            this.panel1.Size = new System.Drawing.Size(284, 1);\r
+            this.panel1.TabIndex = 203;\r
+            // \r
+            // panel2\r
+            // \r
+            this.panel2.BackColor = System.Drawing.Color.Black;\r
+            this.panel2.Location = new System.Drawing.Point(338, 95);\r
+            this.panel2.Margin = new System.Windows.Forms.Padding(0);\r
+            this.panel2.Name = "panel2";\r
+            this.panel2.Size = new System.Drawing.Size(284, 1);\r
+            this.panel2.TabIndex = 202;\r
+            // \r
+            // label44\r
+            // \r
+            this.label44.AutoSize = true;\r
+            this.label44.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label44.Location = new System.Drawing.Point(532, 108);\r
+            this.label44.Name = "label44";\r
+            this.label44.Size = new System.Drawing.Size(55, 12);\r
+            this.label44.TabIndex = 201;\r
+            this.label44.Text = "8x8 DCT:";\r
+            // \r
+            // check_8x8DCT\r
+            // \r
+            this.check_8x8DCT.AutoSize = true;\r
+            this.check_8x8DCT.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.check_8x8DCT.Location = new System.Drawing.Point(590, 108);\r
+            this.check_8x8DCT.Name = "check_8x8DCT";\r
+            this.check_8x8DCT.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
+            this.check_8x8DCT.Size = new System.Drawing.Size(12, 11);\r
+            this.check_8x8DCT.TabIndex = 200;\r
+            this.check_8x8DCT.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+            this.check_8x8DCT.UseVisualStyleBackColor = true;\r
+            this.check_8x8DCT.CheckStateChanged += new System.EventHandler(this.check_8x8DCT_CheckedChanged);\r
+            // \r
+            // label45\r
+            // \r
+            this.label45.AutoSize = true;\r
+            this.label45.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label45.Location = new System.Drawing.Point(420, 108);\r
+            this.label45.Name = "label45";\r
+            this.label45.Size = new System.Drawing.Size(53, 12);\r
+            this.label45.TabIndex = 199;\r
+            this.label45.Text = "Analysis:";\r
+            // \r
+            // drop_analysis\r
+            // \r
+            this.drop_analysis.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_analysis.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_analysis.FormattingEnabled = true;\r
+            this.drop_analysis.Location = new System.Drawing.Point(479, 105);\r
+            this.drop_analysis.Name = "drop_analysis";\r
+            this.drop_analysis.Size = new System.Drawing.Size(47, 20);\r
+            this.drop_analysis.TabIndex = 198;\r
+            this.drop_analysis.SelectedIndexChanged += new System.EventHandler(this.drop_analysis_SelectedIndexChanged);\r
+            // \r
+            // label48\r
+            // \r
+            this.label48.AutoSize = true;\r
+            this.label48.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label48.Location = new System.Drawing.Point(327, 72);\r
+            this.label48.Name = "label48";\r
+            this.label48.Size = new System.Drawing.Size(146, 12);\r
+            this.label48.TabIndex = 197;\r
+            this.label48.Text = "Subpixel Motion Estimation:";\r
+            // \r
+            // drop_subpixelMotionEstimation\r
+            // \r
+            this.drop_subpixelMotionEstimation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_subpixelMotionEstimation.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_subpixelMotionEstimation.FormattingEnabled = true;\r
+            this.drop_subpixelMotionEstimation.Location = new System.Drawing.Point(479, 69);\r
+            this.drop_subpixelMotionEstimation.Name = "drop_subpixelMotionEstimation";\r
+            this.drop_subpixelMotionEstimation.Size = new System.Drawing.Size(139, 20);\r
+            this.drop_subpixelMotionEstimation.TabIndex = 196;\r
+            this.drop_subpixelMotionEstimation.SelectedIndexChanged += new System.EventHandler(this.drop_subpixelMotionEstimation_SelectedIndexChanged);\r
+            // \r
+            // label49\r
+            // \r
+            this.label49.AutoSize = true;\r
+            this.label49.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label49.Location = new System.Drawing.Point(339, 43);\r
+            this.label49.Name = "label49";\r
+            this.label49.Size = new System.Drawing.Size(134, 12);\r
+            this.label49.TabIndex = 195;\r
+            this.label49.Text = "Motion Estimation Range:";\r
+            // \r
+            // drop_MotionEstimationRange\r
+            // \r
+            this.drop_MotionEstimationRange.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_MotionEstimationRange.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_MotionEstimationRange.FormattingEnabled = true;\r
+            this.drop_MotionEstimationRange.Location = new System.Drawing.Point(479, 40);\r
+            this.drop_MotionEstimationRange.Name = "drop_MotionEstimationRange";\r
+            this.drop_MotionEstimationRange.Size = new System.Drawing.Size(139, 20);\r
+            this.drop_MotionEstimationRange.TabIndex = 194;\r
+            this.drop_MotionEstimationRange.SelectedIndexChanged += new System.EventHandler(this.drop_MotionEstimationRange_SelectedIndexChanged);\r
+            // \r
+            // label54\r
+            // \r
+            this.label54.AutoSize = true;\r
+            this.label54.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label54.Location = new System.Drawing.Point(333, 14);\r
+            this.label54.Name = "label54";\r
+            this.label54.Size = new System.Drawing.Size(140, 12);\r
+            this.label54.TabIndex = 193;\r
+            this.label54.Text = "Motion Estimation Method:";\r
+            // \r
+            // drop_MotionEstimationMethod\r
+            // \r
+            this.drop_MotionEstimationMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_MotionEstimationMethod.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_MotionEstimationMethod.FormattingEnabled = true;\r
+            this.drop_MotionEstimationMethod.ItemHeight = 12;\r
+            this.drop_MotionEstimationMethod.Location = new System.Drawing.Point(479, 11);\r
+            this.drop_MotionEstimationMethod.Name = "drop_MotionEstimationMethod";\r
+            this.drop_MotionEstimationMethod.Size = new System.Drawing.Size(139, 20);\r
+            this.drop_MotionEstimationMethod.TabIndex = 192;\r
+            this.drop_MotionEstimationMethod.SelectedIndexChanged += new System.EventHandler(this.drop_MotionEstimationMethod_SelectedIndexChanged);\r
+            // \r
+            // label57\r
+            // \r
+            this.label57.AutoSize = true;\r
+            this.label57.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label57.Location = new System.Drawing.Point(41, 204);\r
+            this.label57.Name = "label57";\r
+            this.label57.Size = new System.Drawing.Size(105, 12);\r
+            this.label57.TabIndex = 191;\r
+            this.label57.Text = "Pyrmidal B-Frames:";\r
+            // \r
+            // check_pyrmidalBFrames\r
+            // \r
+            this.check_pyrmidalBFrames.AutoSize = true;\r
+            this.check_pyrmidalBFrames.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.check_pyrmidalBFrames.Location = new System.Drawing.Point(157, 205);\r
+            this.check_pyrmidalBFrames.Name = "check_pyrmidalBFrames";\r
+            this.check_pyrmidalBFrames.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
+            this.check_pyrmidalBFrames.Size = new System.Drawing.Size(12, 11);\r
+            this.check_pyrmidalBFrames.TabIndex = 190;\r
+            this.check_pyrmidalBFrames.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+            this.check_pyrmidalBFrames.UseVisualStyleBackColor = true;\r
+            this.check_pyrmidalBFrames.CheckStateChanged += new System.EventHandler(this.check_pyrmidalBFrames_CheckedChanged);\r
+            // \r
+            // label58\r
+            // \r
+            this.label58.AutoSize = true;\r
+            this.label58.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label58.Location = new System.Drawing.Point(15, 184);\r
+            this.label58.Name = "label58";\r
+            this.label58.Size = new System.Drawing.Size(131, 12);\r
+            this.label58.TabIndex = 189;\r
+            this.label58.Text = "Bidirectional Refinement:";\r
+            // \r
+            // check_BidirectionalRefinement\r
+            // \r
+            this.check_BidirectionalRefinement.AutoSize = true;\r
+            this.check_BidirectionalRefinement.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.check_BidirectionalRefinement.Location = new System.Drawing.Point(157, 185);\r
+            this.check_BidirectionalRefinement.Name = "check_BidirectionalRefinement";\r
+            this.check_BidirectionalRefinement.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
+            this.check_BidirectionalRefinement.Size = new System.Drawing.Size(12, 11);\r
+            this.check_BidirectionalRefinement.TabIndex = 188;\r
+            this.check_BidirectionalRefinement.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+            this.check_BidirectionalRefinement.UseVisualStyleBackColor = true;\r
+            this.check_BidirectionalRefinement.CheckStateChanged += new System.EventHandler(this.check_BidirectionalRefinement_CheckedChanged);\r
+            // \r
+            // label59\r
+            // \r
+            this.label59.AutoSize = true;\r
+            this.label59.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label59.Location = new System.Drawing.Point(15, 164);\r
+            this.label59.Name = "label59";\r
+            this.label59.Size = new System.Drawing.Size(131, 12);\r
+            this.label59.TabIndex = 187;\r
+            this.label59.Text = "B-Frame Rate Distortion:";\r
+            // \r
+            // check_bFrameDistortion\r
+            // \r
+            this.check_bFrameDistortion.AutoSize = true;\r
+            this.check_bFrameDistortion.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.check_bFrameDistortion.Location = new System.Drawing.Point(157, 165);\r
+            this.check_bFrameDistortion.Name = "check_bFrameDistortion";\r
+            this.check_bFrameDistortion.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
+            this.check_bFrameDistortion.Size = new System.Drawing.Size(12, 11);\r
+            this.check_bFrameDistortion.TabIndex = 186;\r
+            this.check_bFrameDistortion.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+            this.check_bFrameDistortion.UseVisualStyleBackColor = true;\r
+            this.check_bFrameDistortion.CheckStateChanged += new System.EventHandler(this.check_bFrameDistortion_CheckedChanged);\r
+            // \r
+            // label60\r
+            // \r
+            this.label60.AutoSize = true;\r
+            this.label60.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label60.Location = new System.Drawing.Point(39, 146);\r
+            this.label60.Name = "label60";\r
+            this.label60.Size = new System.Drawing.Size(107, 12);\r
+            this.label60.TabIndex = 185;\r
+            this.label60.Text = "Weighted B-Frames:";\r
+            // \r
+            // check_weightedBFrames\r
+            // \r
+            this.check_weightedBFrames.AutoSize = true;\r
+            this.check_weightedBFrames.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.check_weightedBFrames.Location = new System.Drawing.Point(157, 147);\r
+            this.check_weightedBFrames.Name = "check_weightedBFrames";\r
+            this.check_weightedBFrames.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
+            this.check_weightedBFrames.Size = new System.Drawing.Size(12, 11);\r
+            this.check_weightedBFrames.TabIndex = 184;\r
+            this.check_weightedBFrames.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+            this.check_weightedBFrames.UseVisualStyleBackColor = true;\r
+            this.check_weightedBFrames.CheckStateChanged += new System.EventHandler(this.check_weightedBFrames_CheckedChanged);\r
+            // \r
+            // label61\r
+            // \r
+            this.label61.AutoSize = true;\r
+            this.label61.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label61.Location = new System.Drawing.Point(52, 121);\r
+            this.label61.Name = "label61";\r
+            this.label61.Size = new System.Drawing.Size(94, 12);\r
+            this.label61.TabIndex = 183;\r
+            this.label61.Text = "Direct Prediction:";\r
+            // \r
+            // drop_directPrediction\r
+            // \r
+            this.drop_directPrediction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_directPrediction.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_directPrediction.FormattingEnabled = true;\r
+            this.drop_directPrediction.Location = new System.Drawing.Point(157, 118);\r
+            this.drop_directPrediction.Name = "drop_directPrediction";\r
+            this.drop_directPrediction.Size = new System.Drawing.Size(121, 20);\r
+            this.drop_directPrediction.TabIndex = 182;\r
+            this.drop_directPrediction.SelectedIndexChanged += new System.EventHandler(this.drop_directPrediction_SelectedIndexChanged);\r
+            // \r
+            // label62\r
+            // \r
+            this.label62.AutoSize = true;\r
+            this.label62.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label62.Location = new System.Drawing.Point(88, 94);\r
+            this.label62.Name = "label62";\r
+            this.label62.Size = new System.Drawing.Size(58, 12);\r
+            this.label62.TabIndex = 181;\r
+            this.label62.Text = "B-Frames:";\r
+            // \r
+            // drop_bFrames\r
+            // \r
+            this.drop_bFrames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_bFrames.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_bFrames.FormattingEnabled = true;\r
+            this.drop_bFrames.Location = new System.Drawing.Point(157, 91);\r
+            this.drop_bFrames.Name = "drop_bFrames";\r
+            this.drop_bFrames.Size = new System.Drawing.Size(121, 20);\r
+            this.drop_bFrames.TabIndex = 180;\r
+            this.drop_bFrames.SelectedIndexChanged += new System.EventHandler(this.drop_bFrames_SelectedIndexChanged);\r
+            // \r
+            // label63\r
+            // \r
+            this.label63.AutoSize = true;\r
+            this.label63.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label63.Location = new System.Drawing.Point(48, 64);\r
+            this.label63.Name = "label63";\r
+            this.label63.Size = new System.Drawing.Size(98, 12);\r
+            this.label63.TabIndex = 179;\r
+            this.label63.Text = "Mixed References:";\r
+            // \r
+            // label64\r
+            // \r
+            this.label64.AutoSize = true;\r
+            this.label64.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label64.Location = new System.Drawing.Point(47, 40);\r
+            this.label64.Name = "label64";\r
+            this.label64.Size = new System.Drawing.Size(99, 12);\r
+            this.label64.TabIndex = 178;\r
+            this.label64.Text = "Reference Frames:";\r
+            // \r
+            // drop_refFrames\r
+            // \r
+            this.drop_refFrames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.drop_refFrames.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.drop_refFrames.FormattingEnabled = true;\r
+            this.drop_refFrames.Location = new System.Drawing.Point(157, 37);\r
+            this.drop_refFrames.Name = "drop_refFrames";\r
+            this.drop_refFrames.Size = new System.Drawing.Size(121, 20);\r
+            this.drop_refFrames.TabIndex = 177;\r
+            this.drop_refFrames.SelectedIndexChanged += new System.EventHandler(this.drop_refFrames_SelectedIndexChanged);\r
+            // \r
+            // check_mixedReferences\r
+            // \r
+            this.check_mixedReferences.AutoSize = true;\r
+            this.check_mixedReferences.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.check_mixedReferences.Location = new System.Drawing.Point(157, 65);\r
+            this.check_mixedReferences.Name = "check_mixedReferences";\r
+            this.check_mixedReferences.RightToLeft = System.Windows.Forms.RightToLeft.No;\r
+            this.check_mixedReferences.Size = new System.Drawing.Size(12, 11);\r
+            this.check_mixedReferences.TabIndex = 176;\r
+            this.check_mixedReferences.TextAlign = System.Drawing.ContentAlignment.MiddleRight;\r
+            this.check_mixedReferences.UseVisualStyleBackColor = true;\r
+            this.check_mixedReferences.CheckStateChanged += new System.EventHandler(this.check_mixedReferences_CheckedChanged);\r
             // \r
             // tabPage4\r
             // \r
@@ -2002,9 +2468,10 @@ namespace Handbrake
             this.tabPage4.Controls.Add(this.rtf_query);\r
             this.tabPage4.Location = new System.Drawing.Point(4, 22);\r
             this.tabPage4.Name = "tabPage4";\r
-            this.tabPage4.Size = new System.Drawing.Size(649, 283);\r
+            this.tabPage4.Size = new System.Drawing.Size(649, 302);\r
             this.tabPage4.TabIndex = 7;\r
             this.tabPage4.Text = "Query Editor";\r
+            this.tabPage4.UseVisualStyleBackColor = true;\r
             // \r
             // btn_clear\r
             // \r
@@ -2088,7 +2555,7 @@ namespace Handbrake
             this.groupBox_dest.Controls.Add(this.btn_destBrowse);\r
             this.groupBox_dest.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.groupBox_dest.ForeColor = System.Drawing.Color.Black;\r
-            this.groupBox_dest.Location = new System.Drawing.Point(14, 166);\r
+            this.groupBox_dest.Location = new System.Drawing.Point(14, 163);\r
             this.groupBox_dest.Name = "groupBox_dest";\r
             this.groupBox_dest.Size = new System.Drawing.Size(657, 50);\r
             this.groupBox_dest.TabIndex = 2;\r
@@ -2386,14 +2853,6 @@ namespace Handbrake
         private System.Windows.Forms.Label label23;\r
         private System.Windows.Forms.Label label7;\r
         private System.Windows.Forms.TabPage tab_chapters;\r
-        internal System.Windows.Forms.TabPage h264Tab;\r
-        internal System.Windows.Forms.Label Label43;\r
-        internal System.Windows.Forms.LinkLabel label_h264;\r
-        internal System.Windows.Forms.Label Label95;\r
-        internal System.Windows.Forms.Button btn_h264Clear;\r
-        internal System.Windows.Forms.Label Label90;\r
-        internal System.Windows.Forms.RichTextBox rtf_h264advanced;\r
-        internal System.Windows.Forms.Label Label92;\r
         internal System.Windows.Forms.Label label31;\r
         private System.Windows.Forms.DataGridViewTextBoxColumn number;\r
         private System.Windows.Forms.DataGridViewTextBoxColumn name;\r
@@ -2426,6 +2885,50 @@ namespace Handbrake
         internal System.Windows.Forms.Label label25;\r
         internal System.Windows.Forms.Label label6;\r
         internal System.Windows.Forms.ComboBox drp_anamorphic;\r
+        internal System.Windows.Forms.TabPage h264Tab;\r
+        internal System.Windows.Forms.RichTextBox rtf_x264Query;\r
+        internal System.Windows.Forms.Label label43;\r
+        internal System.Windows.Forms.Button btn_reset;\r
+        internal System.Windows.Forms.Label label35;\r
+        internal System.Windows.Forms.CheckBox check_Cabac;\r
+        internal System.Windows.Forms.Label label36;\r
+        internal System.Windows.Forms.CheckBox check_noDCTDecimate;\r
+        internal System.Windows.Forms.Label label37;\r
+        internal System.Windows.Forms.CheckBox check_noFastPSkip;\r
+        internal System.Windows.Forms.Label label39;\r
+        internal System.Windows.Forms.ComboBox drop_trellis;\r
+        internal System.Windows.Forms.ComboBox drop_deblockBeta;\r
+        internal System.Windows.Forms.Label label41;\r
+        internal System.Windows.Forms.ComboBox drop_deblockAlpha;\r
+        internal System.Windows.Forms.Panel panel3;\r
+        internal System.Windows.Forms.Panel panel1;\r
+        internal System.Windows.Forms.Panel panel2;\r
+        internal System.Windows.Forms.Label label44;\r
+        internal System.Windows.Forms.CheckBox check_8x8DCT;\r
+        internal System.Windows.Forms.Label label45;\r
+        internal System.Windows.Forms.ComboBox drop_analysis;\r
+        internal System.Windows.Forms.Label label48;\r
+        internal System.Windows.Forms.ComboBox drop_subpixelMotionEstimation;\r
+        internal System.Windows.Forms.Label label49;\r
+        internal System.Windows.Forms.ComboBox drop_MotionEstimationRange;\r
+        internal System.Windows.Forms.Label label54;\r
+        internal System.Windows.Forms.ComboBox drop_MotionEstimationMethod;\r
+        internal System.Windows.Forms.Label label57;\r
+        internal System.Windows.Forms.CheckBox check_pyrmidalBFrames;\r
+        internal System.Windows.Forms.Label label58;\r
+        internal System.Windows.Forms.CheckBox check_BidirectionalRefinement;\r
+        internal System.Windows.Forms.Label label59;\r
+        internal System.Windows.Forms.CheckBox check_bFrameDistortion;\r
+        internal System.Windows.Forms.Label label60;\r
+        internal System.Windows.Forms.CheckBox check_weightedBFrames;\r
+        internal System.Windows.Forms.Label label61;\r
+        internal System.Windows.Forms.ComboBox drop_directPrediction;\r
+        internal System.Windows.Forms.Label label62;\r
+        internal System.Windows.Forms.ComboBox drop_bFrames;\r
+        internal System.Windows.Forms.Label label63;\r
+        internal System.Windows.Forms.Label label64;\r
+        internal System.Windows.Forms.ComboBox drop_refFrames;\r
+        internal System.Windows.Forms.CheckBox check_mixedReferences;\r
 \r
     }\r
 }
\ No newline at end of file
index a9ddbbd..03a4cb3 100644 (file)
@@ -35,6 +35,7 @@ namespace Handbrake
         private frmQueue queueWindow = new frmQueue();\r
         private delegate void updateStatusChanger();\r
         Functions.Common hb_common_func = new Functions.Common();\r
+        Functions.x264Panel x264PanelFunctions = new Functions.x264Panel();\r
 \r
         public frmMain()\r
         {\r
@@ -96,6 +97,12 @@ namespace Handbrake
                 Thread.Sleep(100);\r
             }\r
 \r
+            //H264 Panel Loading\r
+            lblStatus.Text = "Loading H264 Panel";\r
+            Application.DoEvents();\r
+            setupH264Panel();\r
+            Thread.Sleep(100);\r
+\r
             //Finished Loading\r
             lblStatus.Text = "Loading Complete!";\r
             Application.DoEvents();\r
@@ -147,6 +154,132 @@ namespace Handbrake
             splash.Show();\r
         }\r
 \r
+        private void setupH264Panel()\r
+        {\r
+            /*Set opt widget values here*/\r
+\r
+            /*B-Frames fX264optBframesPopUp*/\r
+            int i;\r
+            drop_bFrames.Items.Clear();\r
+            drop_bFrames.Items.Add("Default (0)");\r
+            drop_bFrames.Text = "Default (0)";\r
+\r
+            for (i = 0; i < 17; i++)\r
+            {\r
+                drop_bFrames.Items.Add(i.ToString());\r
+            }\r
+\r
+            /*Reference Frames fX264optRefPopUp*/\r
+            drop_refFrames.Items.Clear();\r
+            drop_refFrames.Items.Add("Default (1)");\r
+            drop_refFrames.Text = "Default (1)";\r
+            for (i = 0; i < 17; i++)\r
+            {\r
+                drop_refFrames.Items.Add(i.ToString());\r
+            }\r
+\r
+            /*No Fast P-Skip fX264optNfpskipSwitch BOOLEAN*/\r
+            check_noFastPSkip.CheckState = CheckState.Unchecked;\r
+\r
+            /*No Dict Decimate fX264optNodctdcmtSwitch BOOLEAN*/\r
+            check_noDCTDecimate.CheckState = CheckState.Unchecked;\r
+\r
+\r
+            /*Sub Me fX264optSubmePopUp*/\r
+            drop_subpixelMotionEstimation.Items.Clear();\r
+            drop_subpixelMotionEstimation.Items.Add("Default (4)");\r
+            drop_subpixelMotionEstimation.Text = "Default (4)";\r
+            for (i = 0; i < 8; i++)\r
+            {\r
+                drop_subpixelMotionEstimation.Items.Add(i.ToString());\r
+            }\r
+\r
+            /*Trellis fX264optTrellisPopUp*/\r
+            drop_trellis.Items.Clear();\r
+            drop_trellis.Items.Add("Default (0)");\r
+            drop_trellis.Text = "Default (0)";\r
+            for (i = 0; i < 3; i++)\r
+            {\r
+                drop_trellis.Items.Add(i.ToString());\r
+            }\r
+\r
+            /*Mixed-references fX264optMixedRefsSwitch BOOLEAN*/\r
+            check_mixedReferences.CheckState = CheckState.Unchecked;\r
+\r
+            /*Motion Estimation fX264optMotionEstPopUp*/\r
+            drop_MotionEstimationMethod.Items.Clear();\r
+            drop_MotionEstimationMethod.Items.Add("Default (Hexagon)");\r
+            drop_MotionEstimationMethod.Items.Add("Diamond");\r
+            drop_MotionEstimationMethod.Items.Add("Hexagon");\r
+            drop_MotionEstimationMethod.Items.Add("Uneven Multi-Hexagon");\r
+            drop_MotionEstimationMethod.Items.Add("Exhaustive");\r
+            drop_MotionEstimationMethod.Text = "Default (Hexagon)";\r
+\r
+            /*Motion Estimation range fX264optMERangePopUp*/\r
+            drop_MotionEstimationRange.Items.Clear();\r
+            drop_MotionEstimationRange.Items.Add("Default (16)");\r
+            drop_MotionEstimationRange.Text = "Default (16)";\r
+            for (i = 4; i < 65; i++)\r
+            {\r
+                drop_MotionEstimationRange.Items.Add(i.ToString());\r
+            }\r
+\r
+            /*Weighted B-Frame Prediction fX264optWeightBSwitch BOOLEAN*/\r
+            check_weightedBFrames.CheckState = CheckState.Unchecked;\r
+\r
+            /*B-Frame Rate Distortion Optimization fX264optBRDOSwitch BOOLEAN*/\r
+            check_bFrameDistortion.CheckState = CheckState.Unchecked;\r
+\r
+            /*B-frame Pyramids fX264optBPyramidSwitch BOOLEAN*/\r
+            check_pyrmidalBFrames.CheckState = CheckState.Unchecked;\r
+\r
+            /*Bidirectional Motion Estimation Refinement fX264optBiMESwitch BOOLEAN*/\r
+            check_BidirectionalRefinement.CheckState = CheckState.Unchecked;\r
+\r
+            /*Direct B-Frame Prediction Mode fX264optDirectPredPopUp*/\r
+            drop_directPrediction.Items.Clear();\r
+            drop_directPrediction.Items.Add("Default (Spatial)");\r
+            drop_directPrediction.Items.Add("None");\r
+            drop_directPrediction.Items.Add("Spatial");\r
+            drop_directPrediction.Items.Add("Temporal");\r
+            drop_directPrediction.Items.Add("Automatic");\r
+            drop_directPrediction.Text = "Default (Spatial)";\r
+\r
+            /*Alpha Deblock*/\r
+            drop_deblockAlpha.Items.Clear();\r
+            drop_deblockAlpha.Items.Add("Default (0)");\r
+            drop_deblockAlpha.Text = "Default (0)";\r
+            for (i = -6; i < 7; i++)\r
+            {\r
+                drop_deblockAlpha.Items.Add(i.ToString());\r
+            }\r
+\r
+            /*Beta Deblock*/\r
+            drop_deblockBeta.Items.Clear();\r
+            drop_deblockBeta.Items.Add("Default (0)");\r
+            drop_deblockBeta.Text = "Default (0)";\r
+            for (i = -6; i < 7; i++)\r
+            {\r
+                drop_deblockBeta.Items.Add(i.ToString());\r
+            }\r
+\r
+            /* Analysis fX264optAnalysePopUp */\r
+            drop_analysis.Items.Clear();\r
+            drop_analysis.Items.Add("Default (some)"); /* 0=default */\r
+            drop_analysis.Items.Add("None");  /* 1=none */\r
+            drop_analysis.Items.Add("All"); /* 2=all */\r
+            drop_analysis.Text = "Default (some)";\r
+\r
+            /* 8x8 DCT fX264op8x8dctSwitch */\r
+            check_8x8DCT.CheckState = CheckState.Unchecked;\r
+\r
+            /* CABAC fX264opCabacSwitch */\r
+            check_Cabac.CheckState = CheckState.Checked;\r
+\r
+            /* Standardize the option string */\r
+            rtf_x264Query.Text = "";\r
+        }\r
+\r
         private void loadUserDefaults()\r
         {\r
             string userDefaults = Properties.Settings.Default.defaultUserSettings;\r
@@ -391,11 +524,6 @@ namespace Handbrake
             }\r
         }\r
 \r
-        private void btn_h264Clear_Click(object sender, EventArgs e)\r
-        {\r
-            rtf_h264advanced.Text = "";\r
-        }\r
-\r
         private void btn_ActivityWindow_Click(object sender, EventArgs e)\r
         {\r
             Form ActivityWindow = new frmActivityWindow();\r
@@ -436,7 +564,7 @@ namespace Handbrake
                 drp_audioCodec.Items.Add("AC3");\r
                 drp_audioCodec.Items.Add("Vorbis");\r
                 drp_audioCodec.SelectedIndex = 0;\r
-            }    \r
+            }\r
         }\r
         #endregion\r
 \r
@@ -937,7 +1065,7 @@ namespace Handbrake
                 check_turbo.CheckState = CheckState.Unchecked;\r
                 check_turbo.Enabled = false;\r
                 h264Tab.Enabled = false;\r
-                rtf_h264advanced.Text = "";\r
+                rtf_x264Query.Text = "";\r
                 check_iPodAtom.Enabled = false;\r
                 check_iPodAtom.Checked = false;\r
                 check_optimiseMP4.Enabled = false;\r
@@ -960,6 +1088,133 @@ namespace Handbrake
 \r
         #endregion\r
 \r
+        #region Advanced H264 Options Changed\r
+\r
+        /*\r
+         * x264 widgets\r
+         */\r
+        private void drop_refFrames_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("ref", this);\r
+        }\r
+\r
+        private void check_mixedReferences_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("mixed-refs", this);\r
+        }\r
+\r
+        private void drop_bFrames_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("bframes", this);\r
+        }\r
+\r
+        private void drop_directPrediction_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("direct", this);\r
+        }\r
+\r
+        private void check_weightedBFrames_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("weightb", this);\r
+        }\r
+\r
+        private void check_bFrameDistortion_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("brdo", this);\r
+        }\r
+\r
+        private void check_BidirectionalRefinement_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("bime", this);\r
+        }\r
+\r
+        private void check_pyrmidalBFrames_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("b-pyramid", this);\r
+        }\r
+\r
+        private void drop_MotionEstimationMethod_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("me", this);\r
+        }\r
+\r
+        private void drop_MotionEstimationRange_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("merange", this);\r
+        }\r
+\r
+        private void drop_subpixelMotionEstimation_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("subq", this);\r
+        }\r
+\r
+        private void drop_analysis_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("analyse", this);\r
+        }\r
+\r
+        private void check_8x8DCT_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("8x8dct", this);\r
+        }\r
+\r
+        private void drop_deblockAlpha_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("deblock", this);\r
+\r
+        }\r
+\r
+        private void drop_deblockBeta_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("deblock", this);\r
+\r
+        }\r
+\r
+        private void drop_trellis_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("trellis", this);\r
+        }\r
+\r
+        private void check_noFastPSkip_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("no-fast-pskip", this);\r
+        }\r
+\r
+        private void check_noDCTDecimate_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("no-dct-decimate", this);\r
+\r
+        }\r
+\r
+        private void check_Cabac_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            x264PanelFunctions.on_x264_WidgetChange("cabac", this);\r
+        }\r
+\r
+        /*\r
+         * Buttons and x264 RTF Box\r
+         */\r
+        private void rtf_x264Query_TextChanged(object sender, EventArgs e)\r
+        {\r
+            if (rtf_x264Query.Text.EndsWith("\n"))\r
+            {\r
+                rtf_x264Query.Text = rtf_x264Query.Text.Replace("\n", "");\r
+                x264PanelFunctions.X264_StandardizeOptString(this);\r
+                x264PanelFunctions.X264_SetCurrentSettingsInPanel(this);\r
+\r
+                if (rtf_x264Query.Text == "")\r
+                    x264PanelFunctions.reset2Defaults(this);\r
+            }\r
+        }\r
+\r
+        private void btn_reset_Click(object sender, EventArgs e)\r
+        {\r
+            rtf_x264Query.Text = "";\r
+            x264PanelFunctions.reset2Defaults(this);\r
+        }\r
+\r
+        #endregion\r
+\r
         #region Query Editor Tab\r
 \r
         private void btn_clear_Click(object sender, EventArgs e)\r
@@ -1158,13 +1413,19 @@ namespace Handbrake
 \r
             if ((selectedPreset == (presetName[0])) || (selectedPreset == ("--" + presetName[0])))\r
             {\r
+                //Ok, Reset all the H264 widgets before changing the preset\r
+                x264PanelFunctions.reset2Defaults(this);\r
+\r
                 // Send the query from the file to the Query Parser class\r
                 Functions.QueryParser presetQuery = Functions.QueryParser.Parse(preset);\r
 \r
                 // Now load the preset\r
                 hb_common_func.presetLoader(this, presetQuery, selectedPreset);\r
-            }\r
 \r
+                // The x264 widgets will need updated, so do this now:\r
+                x264PanelFunctions.X264_StandardizeOptString(this);\r
+                x264PanelFunctions.X264_SetCurrentSettingsInPanel(this);\r
+            }\r
         }\r
 \r
         private void btn_addPreset_Click(object sender, EventArgs e)\r
@@ -1344,6 +1605,7 @@ namespace Handbrake
         #endregion\r
 \r
 \r
+\r
         // This is the END of the road ------------------------------------------------------------------------------\r
     }\r
 }
\ No newline at end of file