OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 9 Jun 2009 16:49:10 +0000 (16:49 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 9 Jun 2009 16:49:10 +0000 (16:49 +0000)
- Custom Anamorphic with Keep AR should be mostly working now.
- Fixed another few bugs. (Incorrect DAR values and caching, Height value after scan incorrect for anamorphic modes)

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

win/C#/Controls/PictureSettings.cs
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs
win/C#/frmMain.resx

index 49ab799..e642eaf 100644 (file)
@@ -5,15 +5,13 @@ using Handbrake.Parsing;
 \r
 namespace Handbrake.Controls\r
 {\r
-    /*\r
-     *  ***** WARNING *****\r
-     *  This file is incomplete.\r
-     *  - Custom Anamorphic mode does not work.\r
-     *  - Several Out of bound exceptions on the numeric up down width/height inputs need fixed.\r
-     *  - Code needs cleaned up and a ton of bugs probably need fixed.\r
-     */ \r
-\r
-    /*\r
+    // TODO\r
+\r
+    // - Fix MAX Width / Height Code.\r
+    // - Tie in the cropping controls.\r
+    \r
+    /* Custom Anamorphic Mode \r
+     * \r
      * DISPLAY WIDTH       STORAGE WIDTH   PIXEL WIDTH\r
      * HEIGHT              KEEP ASPECT     PIXEL HEIGHT\r
      *\r
@@ -76,7 +74,21 @@ namespace Handbrake.Controls
 \r
             // Set the Resolution Boxes\r
             text_width.Value = selectedTitle.Resolution.Width;\r
-            text_height.Value = cacluateHeight(selectedTitle.Resolution.Width);\r
+\r
+            if (drp_anamorphic.SelectedIndex == 0)\r
+                text_height.Value = cacluateHeight(selectedTitle.Resolution.Width);\r
+            else if (drp_anamorphic.SelectedIndex == 1 || drp_anamorphic.SelectedIndex == 3)\r
+            {\r
+                heightModJumpGaurd = true;\r
+                text_height.Value = selectedTitle.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value;\r
+            }\r
+            else if (drp_anamorphic.SelectedIndex == 2)\r
+            {\r
+                heightModJumpGaurd = false;\r
+                text_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value;\r
+            }\r
+\r
+\r
 \r
             if (drp_anamorphic.SelectedIndex == 3)\r
             {\r
@@ -390,6 +402,7 @@ namespace Handbrake.Controls
                     case "txt_displayWidth":\r
                         heightChangeGuard = true;\r
                         text_height.Value = (decimal)getHeightKeepDar();  //Changes HEIGHT to keep DAR\r
+                        //darValue = calculateDar(); // Cache the dar value\r
                         txt_parWidth.Text = txt_displayWidth.Text;\r
                         txt_parHeight.Text = cropped_width.ToString();\r
                         break;\r
@@ -398,7 +411,7 @@ namespace Handbrake.Controls
                         txt_displayWidth.Text = getDisplayWidthKeepDar().ToString();  //Changes DISPLAY WIDTH to keep DAR\r
                         txt_parWidth.Text = txt_displayWidth.Text;\r
                         txt_parHeight.Text = cropped_width.ToString();\r
-                        break;\r
+                        break; \r
                     case "text_width":\r
                         txt_parWidth.Text = txt_displayWidth.Text;\r
                         txt_parHeight.Text = cropped_width.ToString();\r
@@ -433,8 +446,7 @@ namespace Handbrake.Controls
                 }\r
             }\r
 \r
-            darValue = calculateDar(); // Cache the dar value\r
-            return newDwValue;\r
+            return Math.Round(newDwValue, 2);\r
         }\r
         private double getHeightKeepDar()\r
         {\r
@@ -463,33 +475,24 @@ namespace Handbrake.Controls
                 }\r
             }\r
 \r
-            darValue = calculateDar(); // Cache the dar value\r
             return newHeightVal;\r
         }\r
         private double calculateDar()\r
         {\r
             // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)\r
-            int cropTop = (int)crop_top.Value;\r
-            int cropBottom = (int)crop_bottom.Value;\r
-            int croppedHeight = (int)text_height.Value - cropTop - cropBottom;\r
-\r
             double displayWidth;\r
             double.TryParse(txt_displayWidth.Text, out displayWidth);\r
 \r
-            double calculatedDar = displayWidth / croppedHeight;\r
+            double calculatedDar = displayWidth / (int)text_height.Value;\r
 \r
             return calculatedDar;\r
         }\r
-        private double calculateDarByVal(decimal height, double displayWidth)\r
+        private double calculateDarByVal(decimal croppedHeight, double displayWidth)\r
         {\r
             // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification)\r
-            int cropTop = (int)crop_top.Value;\r
-            int cropBottom = (int)crop_bottom.Value;\r
-            int croppedHeight = (int)height - cropTop - cropBottom;\r
-\r
             double calculatedDar = darValue;\r
             if (croppedHeight > 0)\r
-                 calculatedDar = displayWidth / croppedHeight;\r
+                calculatedDar = displayWidth / (double)croppedHeight;\r
 \r
             return calculatedDar;\r
         }\r
index 729bf14..dfa44a4 100644 (file)
@@ -40,7 +40,7 @@ namespace Handbrake
             this.components = new System.ComponentModel.Container();\r
             System.Windows.Forms.ContextMenuStrip notifyIconMenu;\r
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));\r
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();\r
             this.btn_restore = new System.Windows.Forms.ToolStripMenuItem();\r
             this.DVD_Save = new System.Windows.Forms.SaveFileDialog();\r
             this.File_Save = new System.Windows.Forms.SaveFileDialog();\r
@@ -110,6 +110,7 @@ namespace Handbrake
             this.Label47 = new System.Windows.Forms.Label();\r
             this.Label3 = new System.Windows.Forms.Label();\r
             this.tab_audio = new System.Windows.Forms.TabPage();\r
+            this.audioPanel = new Handbrake.Controls.AudioPanel();\r
             this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);\r
             this.check_forced = new System.Windows.Forms.CheckBox();\r
             this.Label19 = new System.Windows.Forms.Label();\r
@@ -125,6 +126,7 @@ namespace Handbrake
             this.Label46 = new System.Windows.Forms.Label();\r
             this.check_grayscale = new System.Windows.Forms.CheckBox();\r
             this.tab_picture = new System.Windows.Forms.TabPage();\r
+            this.pictureSettings = new Handbrake.Controls.PictureSettings();\r
             this.slider_deblock = new System.Windows.Forms.TrackBar();\r
             this.label8 = new System.Windows.Forms.Label();\r
             this.lbl_deblockVal = new System.Windows.Forms.Label();\r
@@ -132,10 +134,15 @@ namespace Handbrake
             this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox();\r
             this.tabs_panel = new System.Windows.Forms.TabControl();\r
             this.tab_filters = new System.Windows.Forms.TabPage();\r
+            this.ctl_deinterlace = new Handbrake.Deinterlace();\r
+            this.ctl_denoise = new Handbrake.Denoise();\r
+            this.ctl_decomb = new Handbrake.Decomb();\r
+            this.ctl_detelecine = new Handbrake.Detelecine();\r
             this.tab_subtitles = new System.Windows.Forms.TabPage();\r
             this.tab_chapters = new System.Windows.Forms.TabPage();\r
             this.label31 = new System.Windows.Forms.Label();\r
             this.tab_advanced = new System.Windows.Forms.TabPage();\r
+            this.x264Panel = new Handbrake.Controls.x264Panel();\r
             this.tab_query = new System.Windows.Forms.TabPage();\r
             this.btn_clear = new System.Windows.Forms.Button();\r
             this.label34 = new System.Windows.Forms.Label();\r
@@ -170,13 +177,6 @@ namespace Handbrake
             this.StatusStrip = new System.Windows.Forms.StatusStrip();\r
             this.lbl_encode = new System.Windows.Forms.ToolStripStatusLabel();\r
             this.hbproc = new System.Diagnostics.Process();\r
-            this.pictureSettings = new Handbrake.Controls.PictureSettings();\r
-            this.ctl_deinterlace = new Handbrake.Deinterlace();\r
-            this.ctl_denoise = new Handbrake.Denoise();\r
-            this.ctl_decomb = new Handbrake.Decomb();\r
-            this.ctl_detelecine = new Handbrake.Detelecine();\r
-            this.audioPanel = new Handbrake.Controls.AudioPanel();\r
-            this.x264Panel = new Handbrake.Controls.x264Panel();\r
             notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
             notifyIconMenu.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();\r
@@ -462,9 +462,9 @@ namespace Handbrake
             // \r
             // number\r
             // \r
-            dataGridViewCellStyle1.Format = "N0";\r
-            dataGridViewCellStyle1.NullValue = null;\r
-            this.number.DefaultCellStyle = dataGridViewCellStyle1;\r
+            dataGridViewCellStyle2.Format = "N0";\r
+            dataGridViewCellStyle2.NullValue = null;\r
+            this.number.DefaultCellStyle = dataGridViewCellStyle2;\r
             this.number.Frozen = true;\r
             this.number.HeaderText = "Chapter Number";\r
             this.number.MaxInputLength = 3;\r
@@ -787,6 +787,7 @@ namespace Handbrake
             this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";\r
             this.debugToolStripMenuItem.Size = new System.Drawing.Size(56, 20);\r
             this.debugToolStripMenuItem.Text = "Debug";\r
+            this.debugToolStripMenuItem.Visible = false;\r
             // \r
             // mnu_qptest\r
             // \r
@@ -933,6 +934,14 @@ namespace Handbrake
             this.tab_audio.Text = "Audio";\r
             this.tab_audio.UseVisualStyleBackColor = true;\r
             // \r
+            // audioPanel\r
+            // \r
+            this.audioPanel.BackColor = System.Drawing.Color.Transparent;\r
+            this.audioPanel.Location = new System.Drawing.Point(0, 0);\r
+            this.audioPanel.Name = "audioPanel";\r
+            this.audioPanel.Size = new System.Drawing.Size(715, 310);\r
+            this.audioPanel.TabIndex = 0;\r
+            // \r
             // AudioMenuRowHeightHack\r
             // \r
             this.AudioMenuRowHeightHack.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;\r
@@ -1115,6 +1124,14 @@ namespace Handbrake
             this.tab_picture.Text = "Picture Settings";\r
             this.tab_picture.UseVisualStyleBackColor = true;\r
             // \r
+            // pictureSettings\r
+            // \r
+            this.pictureSettings.Location = new System.Drawing.Point(-1, 0);\r
+            this.pictureSettings.Name = "pictureSettings";\r
+            this.pictureSettings.selectedTitle = null;\r
+            this.pictureSettings.Size = new System.Drawing.Size(705, 302);\r
+            this.pictureSettings.TabIndex = 0;\r
+            // \r
             // slider_deblock\r
             // \r
             this.slider_deblock.Location = new System.Drawing.Point(118, 162);\r
@@ -1208,6 +1225,48 @@ namespace Handbrake
             this.tab_filters.Text = "Video Filters";\r
             this.tab_filters.UseVisualStyleBackColor = true;\r
             // \r
+            // ctl_deinterlace\r
+            // \r
+            this.ctl_deinterlace.AutoSize = true;\r
+            this.ctl_deinterlace.Location = new System.Drawing.Point(19, 95);\r
+            this.ctl_deinterlace.Margin = new System.Windows.Forms.Padding(0);\r
+            this.ctl_deinterlace.MaximumSize = new System.Drawing.Size(400, 30);\r
+            this.ctl_deinterlace.Name = "ctl_deinterlace";\r
+            this.ctl_deinterlace.Size = new System.Drawing.Size(275, 28);\r
+            this.ctl_deinterlace.TabIndex = 41;\r
+            this.ctl_deinterlace.onChange += new System.EventHandler(this.ctl_deinterlace_changed);\r
+            // \r
+            // ctl_denoise\r
+            // \r
+            this.ctl_denoise.AutoSize = true;\r
+            this.ctl_denoise.Location = new System.Drawing.Point(19, 123);\r
+            this.ctl_denoise.Margin = new System.Windows.Forms.Padding(0);\r
+            this.ctl_denoise.MaximumSize = new System.Drawing.Size(400, 30);\r
+            this.ctl_denoise.Name = "ctl_denoise";\r
+            this.ctl_denoise.Size = new System.Drawing.Size(275, 28);\r
+            this.ctl_denoise.TabIndex = 40;\r
+            // \r
+            // ctl_decomb\r
+            // \r
+            this.ctl_decomb.AutoSize = true;\r
+            this.ctl_decomb.Location = new System.Drawing.Point(19, 66);\r
+            this.ctl_decomb.Margin = new System.Windows.Forms.Padding(0);\r
+            this.ctl_decomb.MaximumSize = new System.Drawing.Size(400, 30);\r
+            this.ctl_decomb.Name = "ctl_decomb";\r
+            this.ctl_decomb.Size = new System.Drawing.Size(275, 28);\r
+            this.ctl_decomb.TabIndex = 39;\r
+            this.ctl_decomb.onChange += new System.EventHandler(this.ctl_decomb_changed);\r
+            // \r
+            // ctl_detelecine\r
+            // \r
+            this.ctl_detelecine.AutoSize = true;\r
+            this.ctl_detelecine.Location = new System.Drawing.Point(19, 38);\r
+            this.ctl_detelecine.Margin = new System.Windows.Forms.Padding(0);\r
+            this.ctl_detelecine.MaximumSize = new System.Drawing.Size(400, 30);\r
+            this.ctl_detelecine.Name = "ctl_detelecine";\r
+            this.ctl_detelecine.Size = new System.Drawing.Size(275, 28);\r
+            this.ctl_detelecine.TabIndex = 38;\r
+            // \r
             // tab_subtitles\r
             // \r
             this.tab_subtitles.Controls.Add(this.drp_subtitle);\r
@@ -1259,6 +1318,14 @@ namespace Handbrake
             this.tab_advanced.Text = "Advanced";\r
             this.tab_advanced.UseVisualStyleBackColor = true;\r
             // \r
+            // x264Panel\r
+            // \r
+            this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
+            this.x264Panel.Name = "x264Panel";\r
+            this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
+            this.x264Panel.TabIndex = 0;\r
+            this.x264Panel.x264Query = "";\r
+            // \r
             // tab_query\r
             // \r
             this.tab_query.Controls.Add(this.btn_clear);\r
@@ -1618,72 +1685,6 @@ namespace Handbrake
             this.hbproc.StartInfo.UserName = "";\r
             this.hbproc.SynchronizingObject = this;\r
             // \r
-            // pictureSettings\r
-            // \r
-            this.pictureSettings.Location = new System.Drawing.Point(-1, 0);\r
-            this.pictureSettings.Name = "pictureSettings";\r
-            this.pictureSettings.selectedTitle = null;\r
-            this.pictureSettings.Size = new System.Drawing.Size(705, 302);\r
-            this.pictureSettings.TabIndex = 0;\r
-            // \r
-            // ctl_deinterlace\r
-            // \r
-            this.ctl_deinterlace.AutoSize = true;\r
-            this.ctl_deinterlace.Location = new System.Drawing.Point(19, 95);\r
-            this.ctl_deinterlace.Margin = new System.Windows.Forms.Padding(0);\r
-            this.ctl_deinterlace.MaximumSize = new System.Drawing.Size(400, 30);\r
-            this.ctl_deinterlace.Name = "ctl_deinterlace";\r
-            this.ctl_deinterlace.Size = new System.Drawing.Size(275, 28);\r
-            this.ctl_deinterlace.TabIndex = 41;\r
-            this.ctl_deinterlace.onChange += new System.EventHandler(this.ctl_deinterlace_changed);\r
-            // \r
-            // ctl_denoise\r
-            // \r
-            this.ctl_denoise.AutoSize = true;\r
-            this.ctl_denoise.Location = new System.Drawing.Point(19, 123);\r
-            this.ctl_denoise.Margin = new System.Windows.Forms.Padding(0);\r
-            this.ctl_denoise.MaximumSize = new System.Drawing.Size(400, 30);\r
-            this.ctl_denoise.Name = "ctl_denoise";\r
-            this.ctl_denoise.Size = new System.Drawing.Size(275, 28);\r
-            this.ctl_denoise.TabIndex = 40;\r
-            // \r
-            // ctl_decomb\r
-            // \r
-            this.ctl_decomb.AutoSize = true;\r
-            this.ctl_decomb.Location = new System.Drawing.Point(19, 66);\r
-            this.ctl_decomb.Margin = new System.Windows.Forms.Padding(0);\r
-            this.ctl_decomb.MaximumSize = new System.Drawing.Size(400, 30);\r
-            this.ctl_decomb.Name = "ctl_decomb";\r
-            this.ctl_decomb.Size = new System.Drawing.Size(275, 28);\r
-            this.ctl_decomb.TabIndex = 39;\r
-            this.ctl_decomb.onChange += new System.EventHandler(this.ctl_decomb_changed);\r
-            // \r
-            // ctl_detelecine\r
-            // \r
-            this.ctl_detelecine.AutoSize = true;\r
-            this.ctl_detelecine.Location = new System.Drawing.Point(19, 38);\r
-            this.ctl_detelecine.Margin = new System.Windows.Forms.Padding(0);\r
-            this.ctl_detelecine.MaximumSize = new System.Drawing.Size(400, 30);\r
-            this.ctl_detelecine.Name = "ctl_detelecine";\r
-            this.ctl_detelecine.Size = new System.Drawing.Size(275, 28);\r
-            this.ctl_detelecine.TabIndex = 38;\r
-            // \r
-            // audioPanel\r
-            // \r
-            this.audioPanel.BackColor = System.Drawing.Color.Transparent;\r
-            this.audioPanel.Location = new System.Drawing.Point(0, 0);\r
-            this.audioPanel.Name = "audioPanel";\r
-            this.audioPanel.Size = new System.Drawing.Size(715, 310);\r
-            this.audioPanel.TabIndex = 0;\r
-            // \r
-            // x264Panel\r
-            // \r
-            this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
-            this.x264Panel.Name = "x264Panel";\r
-            this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
-            this.x264Panel.TabIndex = 0;\r
-            this.x264Panel.x264Query = "";\r
-            // \r
             // frmMain\r
             // \r
             this.AllowDrop = true;\r
index 0258292..4a57fe2 100644 (file)
@@ -20,12 +20,12 @@ namespace Handbrake
 {\r
     public partial class frmMain : Form\r
     {\r
-        // Objects which may be used by one or more other objects\r
+        // Objects which may be used by one or more other objects *************\r
         QueueHandler encodeQueue = new QueueHandler();\r
         PresetsHandler presetHandler = new PresetsHandler();\r
         QueryGenerator queryGen = new QueryGenerator();\r
 \r
-        // Globals: Mainly used for tracking.\r
+        // Globals: Mainly used for tracking. *********************************\r
         Title selectedTitle;\r
         DVD thisDVD;\r
         private frmQueue queueWindow;\r
@@ -34,7 +34,7 @@ namespace Handbrake
         public int maxWidth;\r
         public int maxHeight;\r
 \r
-        // Delegates\r
+        // Delegates **********************************************************\r
         private delegate void UpdateWindowHandler();\r
         private delegate void UpdateStatusChanger();\r
 \r
@@ -1614,7 +1614,7 @@ namespace Handbrake
         public string lastAction { get; set; }\r
         #endregion\r
 \r
-        #region overrides\r
+        #region Overrides\r
         /// <summary>\r
         /// If the queue is being processed, prompt the user to confirm application close.\r
         /// </summary>\r
index a76ccfd..65dfea0 100644 (file)
@@ -152,6 +152,12 @@ Make sure you have selected a "Title" from the "Source" box above otherwise
 the list will not be populated with the correct amount of chapters.\r
 Note: Do not change any of the chapter numbers!</value>\r
   </data>\r
+  <metadata name="number.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+    <value>True</value>\r
+  </metadata>\r
+  <metadata name="name.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+    <value>True</value>\r
+  </metadata>\r
   <metadata name="DVD_Open.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>232, 15</value>\r
   </metadata>\r