From 0762ced18168df111984a66c5f48d6ab663104d6 Mon Sep 17 00:00:00 2001 From: sr55 Date: Tue, 9 Jun 2009 16:49:10 +0000 Subject: [PATCH] WinGui: - 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://svn.handbrake.fr/HandBrake/trunk@2507 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/PictureSettings.cs | 53 +++++----- win/C#/frmMain.Designer.cs | 155 +++++++++++++++-------------- win/C#/frmMain.cs | 8 +- win/C#/frmMain.resx | 6 ++ 4 files changed, 116 insertions(+), 106 deletions(-) diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs index 49ab799dd..e642eaf2a 100644 --- a/win/C#/Controls/PictureSettings.cs +++ b/win/C#/Controls/PictureSettings.cs @@ -5,15 +5,13 @@ using Handbrake.Parsing; namespace Handbrake.Controls { - /* - * ***** WARNING ***** - * This file is incomplete. - * - Custom Anamorphic mode does not work. - * - Several Out of bound exceptions on the numeric up down width/height inputs need fixed. - * - Code needs cleaned up and a ton of bugs probably need fixed. - */ - - /* + // TODO + + // - Fix MAX Width / Height Code. + // - Tie in the cropping controls. + + /* Custom Anamorphic Mode + * * DISPLAY WIDTH STORAGE WIDTH PIXEL WIDTH * HEIGHT KEEP ASPECT PIXEL HEIGHT * @@ -76,7 +74,21 @@ namespace Handbrake.Controls // Set the Resolution Boxes text_width.Value = selectedTitle.Resolution.Width; - text_height.Value = cacluateHeight(selectedTitle.Resolution.Width); + + if (drp_anamorphic.SelectedIndex == 0) + text_height.Value = cacluateHeight(selectedTitle.Resolution.Width); + else if (drp_anamorphic.SelectedIndex == 1 || drp_anamorphic.SelectedIndex == 3) + { + heightModJumpGaurd = true; + text_height.Value = selectedTitle.Resolution.Height - (int) crop_top.Value - (int) crop_bottom.Value; + } + else if (drp_anamorphic.SelectedIndex == 2) + { + heightModJumpGaurd = false; + text_height.Value = selectedTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; + } + + if (drp_anamorphic.SelectedIndex == 3) { @@ -390,6 +402,7 @@ namespace Handbrake.Controls case "txt_displayWidth": heightChangeGuard = true; text_height.Value = (decimal)getHeightKeepDar(); //Changes HEIGHT to keep DAR + //darValue = calculateDar(); // Cache the dar value txt_parWidth.Text = txt_displayWidth.Text; txt_parHeight.Text = cropped_width.ToString(); break; @@ -398,7 +411,7 @@ namespace Handbrake.Controls txt_displayWidth.Text = getDisplayWidthKeepDar().ToString(); //Changes DISPLAY WIDTH to keep DAR txt_parWidth.Text = txt_displayWidth.Text; txt_parHeight.Text = cropped_width.ToString(); - break; + break; case "text_width": txt_parWidth.Text = txt_displayWidth.Text; txt_parHeight.Text = cropped_width.ToString(); @@ -433,8 +446,7 @@ namespace Handbrake.Controls } } - darValue = calculateDar(); // Cache the dar value - return newDwValue; + return Math.Round(newDwValue, 2); } private double getHeightKeepDar() { @@ -463,33 +475,24 @@ namespace Handbrake.Controls } } - darValue = calculateDar(); // Cache the dar value return newHeightVal; } private double calculateDar() { // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification) - int cropTop = (int)crop_top.Value; - int cropBottom = (int)crop_bottom.Value; - int croppedHeight = (int)text_height.Value - cropTop - cropBottom; - double displayWidth; double.TryParse(txt_displayWidth.Text, out displayWidth); - double calculatedDar = displayWidth / croppedHeight; + double calculatedDar = displayWidth / (int)text_height.Value; return calculatedDar; } - private double calculateDarByVal(decimal height, double displayWidth) + private double calculateDarByVal(decimal croppedHeight, double displayWidth) { // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification) - int cropTop = (int)crop_top.Value; - int cropBottom = (int)crop_bottom.Value; - int croppedHeight = (int)height - cropTop - cropBottom; - double calculatedDar = darValue; if (croppedHeight > 0) - calculatedDar = displayWidth / croppedHeight; + calculatedDar = displayWidth / (double)croppedHeight; return calculatedDar; } diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 729bf142f..dfa44a473 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -40,7 +40,7 @@ namespace Handbrake this.components = new System.ComponentModel.Container(); System.Windows.Forms.ContextMenuStrip notifyIconMenu; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.btn_restore = new System.Windows.Forms.ToolStripMenuItem(); this.DVD_Save = new System.Windows.Forms.SaveFileDialog(); this.File_Save = new System.Windows.Forms.SaveFileDialog(); @@ -110,6 +110,7 @@ namespace Handbrake this.Label47 = new System.Windows.Forms.Label(); this.Label3 = new System.Windows.Forms.Label(); this.tab_audio = new System.Windows.Forms.TabPage(); + this.audioPanel = new Handbrake.Controls.AudioPanel(); this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components); this.check_forced = new System.Windows.Forms.CheckBox(); this.Label19 = new System.Windows.Forms.Label(); @@ -125,6 +126,7 @@ namespace Handbrake this.Label46 = new System.Windows.Forms.Label(); this.check_grayscale = new System.Windows.Forms.CheckBox(); this.tab_picture = new System.Windows.Forms.TabPage(); + this.pictureSettings = new Handbrake.Controls.PictureSettings(); this.slider_deblock = new System.Windows.Forms.TrackBar(); this.label8 = new System.Windows.Forms.Label(); this.lbl_deblockVal = new System.Windows.Forms.Label(); @@ -132,10 +134,15 @@ namespace Handbrake this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox(); this.tabs_panel = new System.Windows.Forms.TabControl(); this.tab_filters = new System.Windows.Forms.TabPage(); + this.ctl_deinterlace = new Handbrake.Deinterlace(); + this.ctl_denoise = new Handbrake.Denoise(); + this.ctl_decomb = new Handbrake.Decomb(); + this.ctl_detelecine = new Handbrake.Detelecine(); this.tab_subtitles = new System.Windows.Forms.TabPage(); this.tab_chapters = new System.Windows.Forms.TabPage(); this.label31 = new System.Windows.Forms.Label(); this.tab_advanced = new System.Windows.Forms.TabPage(); + this.x264Panel = new Handbrake.Controls.x264Panel(); this.tab_query = new System.Windows.Forms.TabPage(); this.btn_clear = new System.Windows.Forms.Button(); this.label34 = new System.Windows.Forms.Label(); @@ -170,13 +177,6 @@ namespace Handbrake this.StatusStrip = new System.Windows.Forms.StatusStrip(); this.lbl_encode = new System.Windows.Forms.ToolStripStatusLabel(); this.hbproc = new System.Diagnostics.Process(); - this.pictureSettings = new Handbrake.Controls.PictureSettings(); - this.ctl_deinterlace = new Handbrake.Deinterlace(); - this.ctl_denoise = new Handbrake.Denoise(); - this.ctl_decomb = new Handbrake.Decomb(); - this.ctl_detelecine = new Handbrake.Detelecine(); - this.audioPanel = new Handbrake.Controls.AudioPanel(); - this.x264Panel = new Handbrake.Controls.x264Panel(); notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components); notifyIconMenu.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit(); @@ -462,9 +462,9 @@ namespace Handbrake // // number // - dataGridViewCellStyle1.Format = "N0"; - dataGridViewCellStyle1.NullValue = null; - this.number.DefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle2.Format = "N0"; + dataGridViewCellStyle2.NullValue = null; + this.number.DefaultCellStyle = dataGridViewCellStyle2; this.number.Frozen = true; this.number.HeaderText = "Chapter Number"; this.number.MaxInputLength = 3; @@ -787,6 +787,7 @@ namespace Handbrake this.debugToolStripMenuItem.Name = "debugToolStripMenuItem"; this.debugToolStripMenuItem.Size = new System.Drawing.Size(56, 20); this.debugToolStripMenuItem.Text = "Debug"; + this.debugToolStripMenuItem.Visible = false; // // mnu_qptest // @@ -933,6 +934,14 @@ namespace Handbrake this.tab_audio.Text = "Audio"; this.tab_audio.UseVisualStyleBackColor = true; // + // audioPanel + // + this.audioPanel.BackColor = System.Drawing.Color.Transparent; + this.audioPanel.Location = new System.Drawing.Point(0, 0); + this.audioPanel.Name = "audioPanel"; + this.audioPanel.Size = new System.Drawing.Size(715, 310); + this.audioPanel.TabIndex = 0; + // // AudioMenuRowHeightHack // this.AudioMenuRowHeightHack.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; @@ -1115,6 +1124,14 @@ namespace Handbrake this.tab_picture.Text = "Picture Settings"; this.tab_picture.UseVisualStyleBackColor = true; // + // pictureSettings + // + this.pictureSettings.Location = new System.Drawing.Point(-1, 0); + this.pictureSettings.Name = "pictureSettings"; + this.pictureSettings.selectedTitle = null; + this.pictureSettings.Size = new System.Drawing.Size(705, 302); + this.pictureSettings.TabIndex = 0; + // // slider_deblock // this.slider_deblock.Location = new System.Drawing.Point(118, 162); @@ -1208,6 +1225,48 @@ namespace Handbrake this.tab_filters.Text = "Video Filters"; this.tab_filters.UseVisualStyleBackColor = true; // + // ctl_deinterlace + // + this.ctl_deinterlace.AutoSize = true; + this.ctl_deinterlace.Location = new System.Drawing.Point(19, 95); + this.ctl_deinterlace.Margin = new System.Windows.Forms.Padding(0); + this.ctl_deinterlace.MaximumSize = new System.Drawing.Size(400, 30); + this.ctl_deinterlace.Name = "ctl_deinterlace"; + this.ctl_deinterlace.Size = new System.Drawing.Size(275, 28); + this.ctl_deinterlace.TabIndex = 41; + this.ctl_deinterlace.onChange += new System.EventHandler(this.ctl_deinterlace_changed); + // + // ctl_denoise + // + this.ctl_denoise.AutoSize = true; + this.ctl_denoise.Location = new System.Drawing.Point(19, 123); + this.ctl_denoise.Margin = new System.Windows.Forms.Padding(0); + this.ctl_denoise.MaximumSize = new System.Drawing.Size(400, 30); + this.ctl_denoise.Name = "ctl_denoise"; + this.ctl_denoise.Size = new System.Drawing.Size(275, 28); + this.ctl_denoise.TabIndex = 40; + // + // ctl_decomb + // + this.ctl_decomb.AutoSize = true; + this.ctl_decomb.Location = new System.Drawing.Point(19, 66); + this.ctl_decomb.Margin = new System.Windows.Forms.Padding(0); + this.ctl_decomb.MaximumSize = new System.Drawing.Size(400, 30); + this.ctl_decomb.Name = "ctl_decomb"; + this.ctl_decomb.Size = new System.Drawing.Size(275, 28); + this.ctl_decomb.TabIndex = 39; + this.ctl_decomb.onChange += new System.EventHandler(this.ctl_decomb_changed); + // + // ctl_detelecine + // + this.ctl_detelecine.AutoSize = true; + this.ctl_detelecine.Location = new System.Drawing.Point(19, 38); + this.ctl_detelecine.Margin = new System.Windows.Forms.Padding(0); + this.ctl_detelecine.MaximumSize = new System.Drawing.Size(400, 30); + this.ctl_detelecine.Name = "ctl_detelecine"; + this.ctl_detelecine.Size = new System.Drawing.Size(275, 28); + this.ctl_detelecine.TabIndex = 38; + // // tab_subtitles // this.tab_subtitles.Controls.Add(this.drp_subtitle); @@ -1259,6 +1318,14 @@ namespace Handbrake this.tab_advanced.Text = "Advanced"; this.tab_advanced.UseVisualStyleBackColor = true; // + // x264Panel + // + this.x264Panel.Location = new System.Drawing.Point(0, 0); + this.x264Panel.Name = "x264Panel"; + this.x264Panel.Size = new System.Drawing.Size(720, 306); + this.x264Panel.TabIndex = 0; + this.x264Panel.x264Query = ""; + // // tab_query // this.tab_query.Controls.Add(this.btn_clear); @@ -1618,72 +1685,6 @@ namespace Handbrake this.hbproc.StartInfo.UserName = ""; this.hbproc.SynchronizingObject = this; // - // pictureSettings - // - this.pictureSettings.Location = new System.Drawing.Point(-1, 0); - this.pictureSettings.Name = "pictureSettings"; - this.pictureSettings.selectedTitle = null; - this.pictureSettings.Size = new System.Drawing.Size(705, 302); - this.pictureSettings.TabIndex = 0; - // - // ctl_deinterlace - // - this.ctl_deinterlace.AutoSize = true; - this.ctl_deinterlace.Location = new System.Drawing.Point(19, 95); - this.ctl_deinterlace.Margin = new System.Windows.Forms.Padding(0); - this.ctl_deinterlace.MaximumSize = new System.Drawing.Size(400, 30); - this.ctl_deinterlace.Name = "ctl_deinterlace"; - this.ctl_deinterlace.Size = new System.Drawing.Size(275, 28); - this.ctl_deinterlace.TabIndex = 41; - this.ctl_deinterlace.onChange += new System.EventHandler(this.ctl_deinterlace_changed); - // - // ctl_denoise - // - this.ctl_denoise.AutoSize = true; - this.ctl_denoise.Location = new System.Drawing.Point(19, 123); - this.ctl_denoise.Margin = new System.Windows.Forms.Padding(0); - this.ctl_denoise.MaximumSize = new System.Drawing.Size(400, 30); - this.ctl_denoise.Name = "ctl_denoise"; - this.ctl_denoise.Size = new System.Drawing.Size(275, 28); - this.ctl_denoise.TabIndex = 40; - // - // ctl_decomb - // - this.ctl_decomb.AutoSize = true; - this.ctl_decomb.Location = new System.Drawing.Point(19, 66); - this.ctl_decomb.Margin = new System.Windows.Forms.Padding(0); - this.ctl_decomb.MaximumSize = new System.Drawing.Size(400, 30); - this.ctl_decomb.Name = "ctl_decomb"; - this.ctl_decomb.Size = new System.Drawing.Size(275, 28); - this.ctl_decomb.TabIndex = 39; - this.ctl_decomb.onChange += new System.EventHandler(this.ctl_decomb_changed); - // - // ctl_detelecine - // - this.ctl_detelecine.AutoSize = true; - this.ctl_detelecine.Location = new System.Drawing.Point(19, 38); - this.ctl_detelecine.Margin = new System.Windows.Forms.Padding(0); - this.ctl_detelecine.MaximumSize = new System.Drawing.Size(400, 30); - this.ctl_detelecine.Name = "ctl_detelecine"; - this.ctl_detelecine.Size = new System.Drawing.Size(275, 28); - this.ctl_detelecine.TabIndex = 38; - // - // audioPanel - // - this.audioPanel.BackColor = System.Drawing.Color.Transparent; - this.audioPanel.Location = new System.Drawing.Point(0, 0); - this.audioPanel.Name = "audioPanel"; - this.audioPanel.Size = new System.Drawing.Size(715, 310); - this.audioPanel.TabIndex = 0; - // - // x264Panel - // - this.x264Panel.Location = new System.Drawing.Point(0, 0); - this.x264Panel.Name = "x264Panel"; - this.x264Panel.Size = new System.Drawing.Size(720, 306); - this.x264Panel.TabIndex = 0; - this.x264Panel.x264Query = ""; - // // frmMain // this.AllowDrop = true; diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 02582923b..4a57fe2b8 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -20,12 +20,12 @@ namespace Handbrake { public partial class frmMain : Form { - // Objects which may be used by one or more other objects + // Objects which may be used by one or more other objects ************* QueueHandler encodeQueue = new QueueHandler(); PresetsHandler presetHandler = new PresetsHandler(); QueryGenerator queryGen = new QueryGenerator(); - // Globals: Mainly used for tracking. + // Globals: Mainly used for tracking. ********************************* Title selectedTitle; DVD thisDVD; private frmQueue queueWindow; @@ -34,7 +34,7 @@ namespace Handbrake public int maxWidth; public int maxHeight; - // Delegates + // Delegates ********************************************************** private delegate void UpdateWindowHandler(); private delegate void UpdateStatusChanger(); @@ -1614,7 +1614,7 @@ namespace Handbrake public string lastAction { get; set; } #endregion - #region overrides + #region Overrides /// /// If the queue is being processed, prompt the user to confirm application close. /// diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx index a76ccfd0f..65dfea0c5 100644 --- a/win/C#/frmMain.resx +++ b/win/C#/frmMain.resx @@ -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. Note: Do not change any of the chapter numbers! + + True + + + True + 232, 15 -- 2.40.0