]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Thu, 6 Nov 2008 21:26:55 +0000 (21:26 +0000)
committersr55 <sr55.hb@outlook.com>
Thu, 6 Nov 2008 21:26:55 +0000 (21:26 +0000)
- Set's DRC to 1 by default.
- Chapter Markers tab only enabled if it's a DVD source or ISO image.
- -X and -Y options now parsed by the query parser.
- Added a small hack to allow built-in presets to use -X and -Y and have the query generator correctly generate the query.

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

win/C#/Functions/QueryParser.cs
win/C#/frmMain.cs
win/C#/frmMain/PresetLoader.cs
win/C#/frmMain/QueryGenerator.cs

index f120f5671db620decdf4b31d62bbed77b7d5ea4b..3e8b18ebe506aa5e1c82a662ae4e24f64103da6c 100644 (file)
@@ -142,6 +142,32 @@ namespace Handbrake.Functions
             }\r
         }\r
 \r
+        private int q_maxWidth;\r
+        /// <summary>\r
+        /// Returns an Int\r
+        /// The selected Width for the encoding.\r
+        /// </summary>\r
+        public int MaxWidth\r
+        {\r
+            get\r
+            {\r
+                return this.q_maxWidth;\r
+            }\r
+        }\r
+\r
+        private int q_maxHeight;\r
+        /// <summary>\r
+        /// Returns an Int\r
+        /// The selected Height for the encoding.\r
+        /// </summary>\r
+        public int MaxHeight\r
+        {\r
+            get\r
+            {\r
+                return this.q_maxHeight;\r
+            }\r
+        }\r
+\r
         private string q_cropValues;\r
         /// <summary>\r
         /// Returns an String\r
@@ -800,6 +826,8 @@ namespace Handbrake.Functions
             //Picture Settings Tab\r
             Match width = Regex.Match(input, @"-w ([0-9]*)");\r
             Match height = Regex.Match(input, @"-l ([0-9]*)");\r
+            Match maxWidth = Regex.Match(input, @"-X ([0-9]*)");\r
+            Match maxHeight = Regex.Match(input, @"-Y ([0-9]*)");\r
             Match deinterlace = Regex.Match(input, @"--deinterlace=\""([a-zA-Z]*)\""");\r
             Match denoise = Regex.Match(input, @"--denoise=\""([a-zA-Z]*)\""");\r
             Match deblock = Regex.Match(input, @"--deblock=([0-9]*)");\r
@@ -930,6 +958,12 @@ namespace Handbrake.Functions
                 if (height.Success != false)\r
                     thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", ""));\r
 \r
+                if (maxWidth.Success != false)\r
+                    thisQuery.q_maxWidth = int.Parse(maxWidth.ToString().Replace("-X ", ""));\r
+\r
+                if (maxHeight.Success != false)\r
+                    thisQuery.q_maxHeight = int.Parse(maxHeight.ToString().Replace("-Y ", ""));\r
+\r
                 if (crop.Success != false)\r
                 {\r
                     thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");\r
@@ -1194,7 +1228,7 @@ namespace Handbrake.Functions
                     thisQuery.q_drc1 = drcValue;\r
                 }\r
                 else\r
-                    thisQuery.q_drc1 = 0;\r
+                    thisQuery.q_drc1 = 10;\r
 \r
                 if (drc2.Success != false)\r
                 {\r
@@ -1205,7 +1239,7 @@ namespace Handbrake.Functions
                     thisQuery.q_drc2 = drcValue;\r
                 }\r
                 else\r
-                    thisQuery.q_drc2 = 0;\r
+                    thisQuery.q_drc2 = 10;\r
 \r
                 if (drc3.Success != false)\r
                 {\r
@@ -1216,7 +1250,7 @@ namespace Handbrake.Functions
                     thisQuery.q_drc3 = drcValue;\r
                 }\r
                 else\r
-                    thisQuery.q_drc3 = 0;\r
+                    thisQuery.q_drc3 = 10;\r
 \r
                 if (drc4.Success != false)\r
                 {\r
@@ -1227,7 +1261,7 @@ namespace Handbrake.Functions
                     thisQuery.q_drc4 = drcValue;\r
                 }\r
                 else\r
-                    thisQuery.q_drc4 = 0;\r
+                    thisQuery.q_drc4 = 10;\r
 \r
 \r
                 // Subtitle Stuff\r
index f7733a15318df9d7df0620d34762be46506bf240..2888dad413af246309876db70b982a10f4b8b7f9 100644 (file)
@@ -39,6 +39,8 @@ namespace Handbrake
         private frmQueue queueWindow;\r
         private delegate void updateStatusChanger();\r
         private string lastAction = null;\r
+        public int maxWidth = 0;\r
+        public int maxHeight = 0;\r
 \r
         // Applicaiton Startup ************************************************\r
 \r
@@ -422,6 +424,9 @@ namespace Handbrake
         //Source\r
         private void btn_dvd_source_Click(object sender, EventArgs e)\r
         {\r
+            // Enable the creation of chapter markers.\r
+            Check_ChapterMarkers.Enabled = true;\r
+\r
             // Set the last action to scan. \r
             // This is used for tracking which file to load in the activity window\r
             lastAction = "scan";\r
@@ -484,10 +489,22 @@ namespace Handbrake
                     MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source.\nYour Source may be copy protected, badly mastered or a format which HandBrake does not support. \nPlease refer to the Documentation and FAQ (see Help Menu).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
 \r
                 lbl_encode.Text = "";\r
+\r
+                // Enable the creation of chapter markers if the file is an image of a dvd.\r
+                if (filename.ToLower().Contains(".iso"))\r
+                    Check_ChapterMarkers.Enabled = true;\r
+                else\r
+                {\r
+                    Check_ChapterMarkers.Enabled = false;\r
+                    data_chpt.Rows.Clear();\r
+                }\r
             }\r
         }\r
         private void mnu_dvd_drive_Click(object sender, EventArgs e)\r
         {\r
+            // Enable the creation of chapter markers.\r
+            Check_ChapterMarkers.Enabled = true;\r
+\r
             // Set the last action to scan. \r
             // This is used for tracking which file to load in the activity window\r
             lastAction = "scan";\r
@@ -779,6 +796,8 @@ namespace Handbrake
         //Picture Tab\r
         private void text_width_TextChanged(object sender, EventArgs e)\r
         {\r
+            maxWidth = 0;  // Reset max width so that it's not using the MaxWidth -X. Quick hack to allow -X for preset usage.\r
+\r
             int width;\r
             Boolean parsed = int.TryParse(text_width.Text, out width);\r
             if (parsed != false)\r
@@ -801,6 +820,8 @@ namespace Handbrake
         }\r
         private void text_height_TextChanged(object sender, EventArgs e)\r
         {\r
+            maxHeight = 0;  // Reset max height so that it's not using the MaxHeight -Y. Quick hack to allow -Y for preset usage.\r
+\r
             int height;\r
             Boolean parsed = int.TryParse(text_height.Text, out height);\r
             if (parsed != false)\r
index c42f8202eec85c82938dedebe2273770b89fb50b..e56ee4cbf456c794627e6391ae3d38c4bd9b4d4a 100644 (file)
@@ -129,6 +129,21 @@ namespace Handbrake
                 mainWindow.text_height.Text = "";\r
             }\r
 \r
+            // Set the public max width and max height varibles in frmMain\r
+            // These are used by the query generator to determine if it should use -X or -w  / -Y or -h\r
+            if (presetQuery.MaxWidth != 0)\r
+            {\r
+                mainWindow.text_width.Text = presetQuery.MaxWidth.ToString();\r
+                mainWindow.maxWidth = presetQuery.MaxWidth;\r
+            }\r
+\r
+            if (presetQuery.MaxHeight != 0)\r
+            {\r
+                mainWindow.text_height.Text = presetQuery.MaxHeight.ToString();\r
+                mainWindow.maxHeight = presetQuery.MaxHeight;\r
+            }\r
+              \r
+\r
             #endregion\r
 \r
             // Video Settings Tab\r
index b66e3f041028ad9f1c9b550c56be90c48b56c570..a2cb50ed022aa0c5aea75c1b4105f42b41a8ba5c 100644 (file)
@@ -101,11 +101,30 @@ namespace Handbrake
             // Picture Settings Tab\r
             #region Picture Settings Tab\r
 \r
-            if (mainWindow.text_width.Text != "")\r
-                query += " -w " + mainWindow.text_width.Text;\r
+            // Use MaxWidth for built-in presets and width for user settings.\r
+            if (mainWindow.maxWidth == 0)\r
+            {\r
+\r
+                if (mainWindow.text_width.Text != "")\r
+                    query += " -w " + mainWindow.text_width.Text;\r
+            }\r
+            else\r
+            {\r
+                if (mainWindow.text_width.Text != "")\r
+                    query += " -X " + mainWindow.text_width.Text;\r
+            }\r
 \r
-            if (mainWindow.text_height.Text != "")\r
-                query += " -l " + mainWindow.text_height.Text;\r
+            // Use MaxHeight for built-in presets and height for user settings.\r
+            if (mainWindow.maxHeight == 0)\r
+            {\r
+                if (mainWindow.text_height.Text != "")\r
+                    query += " -l " + mainWindow.text_height.Text;\r
+            }\r
+            else\r
+            {\r
+                if (mainWindow.text_height.Text != "")\r
+                    query += " -Y " + mainWindow.text_height.Text;\r
+            }\r
 \r
             string cropTop = mainWindow.text_top.Text;\r
             string cropBottom = mainWindow.text_bottom.Text;\r