From 5ac461efefc4220228002fb6d9cc8ecbaf9e8029 Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 19 Feb 2010 20:57:25 +0000 Subject: WinGui: - Some in progress re-factoring. - Enable Modulus for none/loose picture setting modes. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3127 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/Filters.Designer.cs | 10 +- win/C#/Controls/Filters.cs | 12 +- win/C#/Controls/PictureSettings.Designer.cs | 28 +-- win/C#/Controls/PictureSettings.cs | 248 +++++++++++++------------- win/C#/Controls/Subtitles.Designer.cs | 28 +-- win/C#/Controls/Subtitles.cs | 241 ++++++++++++++++++++----- win/C#/Controls/x264Panel.cs | 2 +- win/C#/Functions/QueryGenerator.cs | 141 ++------------- win/C#/HandBrakeCS.csproj | 13 +- win/C#/HandBrakeCS.sln | 4 +- win/C#/Model/Subtitle.cs | 11 ++ win/C#/Properties/Resources.Designer.cs | 4 +- win/C#/Properties/Settings.Designer.cs | 4 +- win/C#/app.config | 266 ++++++++++++++-------------- win/C#/frmMain.Designer.cs | 15 +- win/C#/frmMain.cs | 16 +- win/C#/frmMain.resx | 6 +- win/C#/frmPreview.cs | 4 +- 18 files changed, 554 insertions(+), 499 deletions(-) diff --git a/win/C#/Controls/Filters.Designer.cs b/win/C#/Controls/Filters.Designer.cs index bdcc9c6eb..33531caa1 100644 --- a/win/C#/Controls/Filters.Designer.cs +++ b/win/C#/Controls/Filters.Designer.cs @@ -86,7 +86,7 @@ this.drop_detelecine.Name = "drop_detelecine"; this.drop_detelecine.Size = new System.Drawing.Size(174, 21); this.drop_detelecine.TabIndex = 45; - this.drop_detelecine.SelectedIndexChanged += new System.EventHandler(this.drop_detelecine_SelectedIndexChanged); + this.drop_detelecine.SelectedIndexChanged += new System.EventHandler(this.DropDetelecineSelectedIndexChanged); // // text_customDC // @@ -124,7 +124,7 @@ this.drop_decomb.Name = "drop_decomb"; this.drop_decomb.Size = new System.Drawing.Size(174, 21); this.drop_decomb.TabIndex = 48; - this.drop_decomb.SelectedIndexChanged += new System.EventHandler(this.drop_decomb_SelectedIndexChanged); + this.drop_decomb.SelectedIndexChanged += new System.EventHandler(this.DropDecombSelectedIndexChanged); // // text_customDI // @@ -164,7 +164,7 @@ this.drop_deinterlace.Name = "drop_deinterlace"; this.drop_deinterlace.Size = new System.Drawing.Size(174, 21); this.drop_deinterlace.TabIndex = 51; - this.drop_deinterlace.SelectedIndexChanged += new System.EventHandler(this.drop_deinterlace_SelectedIndexChanged); + this.drop_deinterlace.SelectedIndexChanged += new System.EventHandler(this.DropDeinterlaceSelectedIndexChanged); // // text_customDN // @@ -204,7 +204,7 @@ this.drop_denoise.Name = "drop_denoise"; this.drop_denoise.Size = new System.Drawing.Size(174, 21); this.drop_denoise.TabIndex = 54; - this.drop_denoise.SelectedIndexChanged += new System.EventHandler(this.drop_denoise_SelectedIndexChanged); + this.drop_denoise.SelectedIndexChanged += new System.EventHandler(this.DropDenoiseSelectedIndexChanged); // // slider_deblock // @@ -218,7 +218,7 @@ this.slider_deblock.Size = new System.Drawing.Size(174, 45); this.slider_deblock.TabIndex = 58; this.slider_deblock.Value = 4; - this.slider_deblock.Scroll += new System.EventHandler(this.slider_deblock_Scroll); + this.slider_deblock.Scroll += new System.EventHandler(this.SliderDeblockScroll); // // check_grayscale // diff --git a/win/C#/Controls/Filters.cs b/win/C#/Controls/Filters.cs index 6f8d3afd5..adf7bde16 100644 --- a/win/C#/Controls/Filters.cs +++ b/win/C#/Controls/Filters.cs @@ -31,7 +31,7 @@ namespace Handbrake.Controls /// /// Returns the CLI query for the query generator. /// - public string GetCLIQuery + public string GetCliQuery { get { @@ -262,14 +262,14 @@ namespace Handbrake.Controls } // Controls - private void drop_detelecine_SelectedIndexChanged(object sender, EventArgs e) + private void DropDetelecineSelectedIndexChanged(object sender, EventArgs e) { text_customDT.Visible = drop_detelecine.Text == "Custom"; // A Filter has changed so raise a FilterSettingsChanged event. if (this.FilterSettingsChanged != null) this.FilterSettingsChanged(this, new EventArgs()); } - private void drop_decomb_SelectedIndexChanged(object sender, EventArgs e) + private void DropDecombSelectedIndexChanged(object sender, EventArgs e) { text_customDC.Visible = drop_decomb.Text == "Custom"; if (drop_decomb.SelectedIndex != 0 && drop_deinterlace.SelectedIndex != 0) @@ -279,7 +279,7 @@ namespace Handbrake.Controls if (this.FilterSettingsChanged != null) this.FilterSettingsChanged(this, new EventArgs()); } - private void drop_deinterlace_SelectedIndexChanged(object sender, EventArgs e) + private void DropDeinterlaceSelectedIndexChanged(object sender, EventArgs e) { text_customDI.Visible = drop_deinterlace.Text == "Custom"; if (drop_decomb.SelectedIndex != 0 && drop_deinterlace.SelectedIndex != 0) @@ -289,7 +289,7 @@ namespace Handbrake.Controls if (this.FilterSettingsChanged != null) this.FilterSettingsChanged(this, new EventArgs()); } - private void drop_denoise_SelectedIndexChanged(object sender, EventArgs e) + private void DropDenoiseSelectedIndexChanged(object sender, EventArgs e) { text_customDN.Visible = drop_denoise.Text == "Custom"; @@ -297,7 +297,7 @@ namespace Handbrake.Controls if (this.FilterSettingsChanged != null) this.FilterSettingsChanged(this, new EventArgs()); } - private void slider_deblock_Scroll(object sender, EventArgs e) + private void SliderDeblockScroll(object sender, EventArgs e) { lbl_deblockVal.Text = slider_deblock.Value == 4 ? "Off" : slider_deblock.Value.ToString(); diff --git a/win/C#/Controls/PictureSettings.Designer.cs b/win/C#/Controls/PictureSettings.Designer.cs index 67b427a2e..96953ac53 100644 --- a/win/C#/Controls/PictureSettings.Designer.cs +++ b/win/C#/Controls/PictureSettings.Designer.cs @@ -142,7 +142,7 @@ namespace Handbrake.Controls this.crop_left.Name = "crop_left"; this.crop_left.Size = new System.Drawing.Size(44, 21); this.crop_left.TabIndex = 98; - this.crop_left.ValueChanged += new System.EventHandler(this.crop_ValueChanged); + this.crop_left.ValueChanged += new System.EventHandler(this.CropValueChanged); // // crop_right // @@ -161,7 +161,7 @@ namespace Handbrake.Controls this.crop_right.Name = "crop_right"; this.crop_right.Size = new System.Drawing.Size(44, 21); this.crop_right.TabIndex = 101; - this.crop_right.ValueChanged += new System.EventHandler(this.crop_ValueChanged); + this.crop_right.ValueChanged += new System.EventHandler(this.CropValueChanged); // // check_autoCrop // @@ -177,7 +177,7 @@ namespace Handbrake.Controls this.check_autoCrop.TabStop = true; this.check_autoCrop.Text = "Automatic"; this.check_autoCrop.UseVisualStyleBackColor = true; - this.check_autoCrop.CheckedChanged += new System.EventHandler(this.check_autoCrop_CheckedChanged); + this.check_autoCrop.CheckedChanged += new System.EventHandler(this.CheckAutoCropCheckedChanged); // // Label51 // @@ -209,7 +209,7 @@ namespace Handbrake.Controls this.crop_top.Name = "crop_top"; this.crop_top.Size = new System.Drawing.Size(44, 21); this.crop_top.TabIndex = 100; - this.crop_top.ValueChanged += new System.EventHandler(this.crop_ValueChanged); + this.crop_top.ValueChanged += new System.EventHandler(this.CropValueChanged); // // Label53 // @@ -254,7 +254,7 @@ namespace Handbrake.Controls this.crop_bottom.Name = "crop_bottom"; this.crop_bottom.Size = new System.Drawing.Size(44, 21); this.crop_bottom.TabIndex = 103; - this.crop_bottom.ValueChanged += new System.EventHandler(this.crop_ValueChanged); + this.crop_bottom.ValueChanged += new System.EventHandler(this.CropValueChanged); // // check_customCrop // @@ -374,7 +374,7 @@ namespace Handbrake.Controls this.text_width.Name = "text_width"; this.text_width.Size = new System.Drawing.Size(64, 21); this.text_width.TabIndex = 85; - this.text_width.ValueChanged += new System.EventHandler(this.text_width_ValueChanged); + this.text_width.ValueChanged += new System.EventHandler(this.TextWidthValueChanged); // // lbl_max // @@ -387,7 +387,7 @@ namespace Handbrake.Controls this.lbl_max.Size = new System.Drawing.Size(15, 13); this.lbl_max.TabIndex = 83; this.lbl_max.Text = "--"; - this.lbl_max.DoubleClick += new System.EventHandler(this.lbl_max_DoubleClick); + this.lbl_max.DoubleClick += new System.EventHandler(this.LblMaxDoubleClick); // // label4 // @@ -414,7 +414,7 @@ namespace Handbrake.Controls this.text_height.Name = "text_height"; this.text_height.Size = new System.Drawing.Size(64, 21); this.text_height.TabIndex = 86; - this.text_height.ValueChanged += new System.EventHandler(this.text_height_ValueChanged); + this.text_height.ValueChanged += new System.EventHandler(this.TextHeightValueChanged); // // check_KeepAR // @@ -429,7 +429,7 @@ namespace Handbrake.Controls this.check_KeepAR.TabIndex = 95; this.check_KeepAR.Text = "Keep Aspect Ratio"; this.check_KeepAR.UseVisualStyleBackColor = true; - this.check_KeepAR.CheckedChanged += new System.EventHandler(this.check_KeepAR_CheckedChanged); + this.check_KeepAR.CheckedChanged += new System.EventHandler(this.CheckKeepArCheckedChanged); // // tableLayoutPanel1 // @@ -473,7 +473,7 @@ namespace Handbrake.Controls this.updownParHeight.Name = "updownParHeight"; this.updownParHeight.Size = new System.Drawing.Size(53, 21); this.updownParHeight.TabIndex = 112; - this.updownParHeight.ValueChanged += new System.EventHandler(this.text_width_ValueChanged); + this.updownParHeight.ValueChanged += new System.EventHandler(this.TextWidthValueChanged); // // label6 // @@ -537,7 +537,7 @@ namespace Handbrake.Controls this.updownParWidth.Name = "updownParWidth"; this.updownParWidth.Size = new System.Drawing.Size(53, 21); this.updownParWidth.TabIndex = 111; - this.updownParWidth.ValueChanged += new System.EventHandler(this.text_width_ValueChanged); + this.updownParWidth.ValueChanged += new System.EventHandler(this.TextWidthValueChanged); // // drp_anamorphic // @@ -552,7 +552,7 @@ namespace Handbrake.Controls this.drp_anamorphic.Name = "drp_anamorphic"; this.drp_anamorphic.Size = new System.Drawing.Size(110, 21); this.drp_anamorphic.TabIndex = 82; - this.drp_anamorphic.SelectedIndexChanged += new System.EventHandler(this.drp_anamorphic_SelectedIndexChanged); + this.drp_anamorphic.SelectedIndexChanged += new System.EventHandler(this.DrpAnamorphicSelectedIndexChanged); // // lbl_parWidth // @@ -578,7 +578,7 @@ namespace Handbrake.Controls this.updownDisplayWidth.Name = "updownDisplayWidth"; this.updownDisplayWidth.Size = new System.Drawing.Size(53, 21); this.updownDisplayWidth.TabIndex = 110; - this.updownDisplayWidth.ValueChanged += new System.EventHandler(this.updownDisplayWidth_ValueChanged); + this.updownDisplayWidth.ValueChanged += new System.EventHandler(this.UpdownDisplayWidthValueChanged); // // lbl_modulus // @@ -619,7 +619,7 @@ namespace Handbrake.Controls this.drp_modulus.Name = "drp_modulus"; this.drp_modulus.Size = new System.Drawing.Size(110, 21); this.drp_modulus.TabIndex = 88; - this.drp_modulus.SelectedIndexChanged += new System.EventHandler(this.drp_modulus_SelectedIndexChanged); + this.drp_modulus.SelectedIndexChanged += new System.EventHandler(this.DrpModulusSelectedIndexChanged); // // label8 // diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs index d5d088b47..5eedf24df 100644 --- a/win/C#/Controls/PictureSettings.cs +++ b/win/C#/Controls/PictureSettings.cs @@ -16,14 +16,17 @@ namespace Handbrake.Controls { public partial class PictureSettings : UserControl { - private readonly CultureInfo Culture = new CultureInfo("en-US", false); + private readonly CultureInfo culture = new CultureInfo("en-US", false); public event EventHandler PictureSettingsChanged; - private Boolean _preventChangingWidth, _preventChangingHeight, _preventChangingCustom, _preventChangingDisplayWidth; - private int _presetMaximumWidth, _presetMaximumHeight; - private double _cachedDar; - private Title _sourceTitle; + private Boolean preventChangingWidth, preventChangingHeight, preventChangingCustom, preventChangingDisplayWidth; + private int presetMaximumWidth, presetMaximumHeight; + private double cachedDar; + private Title sourceTitle; + /// + /// Creates a new instance of the Picture Settings Class + /// public PictureSettings() { InitializeComponent(); @@ -35,65 +38,14 @@ namespace Handbrake.Controls /// /// Gets or sets the source media used by this control. /// - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public Title Source { - private get { return _sourceTitle; } + private get { return sourceTitle; } set { - _sourceTitle = value; - Enabled = _sourceTitle != null; - - // Set the Aspect Ratio - lbl_Aspect.Text = _sourceTitle.AspectRatio.ToString(Culture); - lbl_src_res.Text = _sourceTitle.Resolution.Width + " x " + _sourceTitle.Resolution.Height; - - // Set the Recommended Cropping values, but only if a preset doesn't have hard set picture settings. - if (CurrentlySelectedPreset != null && CurrentlySelectedPreset.PictureSettings == false) - { - crop_top.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[0]); - crop_bottom.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[1]); - crop_left.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[2]); - crop_right.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[3]); - } - else if (CurrentlySelectedPreset == null) - { - crop_top.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[0]); - crop_bottom.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[1]); - crop_left.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[2]); - crop_right.Value = GetCropMod2Clean(_sourceTitle.AutoCropDimensions[3]); - } - SetPresetCropWarningLabel(CurrentlySelectedPreset); - - // Set the Resolution Boxes - if (drp_anamorphic.SelectedIndex == 0) - { - if (text_width.Value == 0) // Only update the values if the fields don't already have values. - text_width.Value = _sourceTitle.Resolution.Width; - - check_KeepAR.Checked = true; // Forces Resolution to be correct. - } - else - { - if (text_width.Value == 0 && text_height.Value == 0)// Only update the values if the fields don't already have values. - { - text_width.Value = _sourceTitle.Resolution.Width; - text_height.Value = _sourceTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; - } - - labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height; - } - - //updownDisplayWidth.Value = CalculateAnamorphicSizes().Width; - updownParWidth.Value = _sourceTitle.ParVal.Width; - updownParHeight.Value = _sourceTitle.ParVal.Height; - //_cachedDar = (double)updownDisplayWidth.Value / (double)text_height.Value; - - - Size croppedDar = CalculateAnamorphicSizes(); - _cachedDar = (double)croppedDar.Width / croppedDar.Height; - updownDisplayWidth.Value = croppedDar.Width; + sourceTitle = value; + Enabled = sourceTitle != null; + NewSourceSet(); } } @@ -106,15 +58,13 @@ namespace Handbrake.Controls /// Gets or sets the maximum allowable size for the encoded resolution. Set a value to /// "0" if the maximum does not matter. /// - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public Size PresetMaximumResolution { - get { return new Size(_presetMaximumWidth, _presetMaximumHeight); } + get { return new Size(presetMaximumWidth, presetMaximumHeight); } set { - _presetMaximumWidth = value.Width; - _presetMaximumHeight = value.Height; + presetMaximumWidth = value.Width; + presetMaximumHeight = value.Height; if (value.Width != 0 && value.Height != 0) lbl_max.Text = "Max Width / Height"; @@ -127,6 +77,10 @@ namespace Handbrake.Controls } } + /// + /// Set the Preset Crop Warning Label + /// + /// public void SetPresetCropWarningLabel(Preset selectedPreset) { lbl_presetCropWarning.Visible = true; @@ -136,13 +90,60 @@ namespace Handbrake.Controls lbl_presetCropWarning.Visible = false; } + /// + /// Setup the UI. The Source has just changed. + /// + private void NewSourceSet() + { + // Set the Aspect Ratio + lbl_Aspect.Text = sourceTitle.AspectRatio.ToString(culture); + lbl_src_res.Text = sourceTitle.Resolution.Width + " x " + sourceTitle.Resolution.Height; + + // Set the Recommended Cropping values, but only if a preset doesn't have hard set picture settings. + if ((CurrentlySelectedPreset != null && CurrentlySelectedPreset.PictureSettings == false) || CurrentlySelectedPreset == null) + { + crop_top.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[0]); + crop_bottom.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[1]); + crop_left.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[2]); + crop_right.Value = GetCropMod2Clean(sourceTitle.AutoCropDimensions[3]); + } + + SetPresetCropWarningLabel(CurrentlySelectedPreset); + + // Set the Resolution Boxes + if (drp_anamorphic.SelectedIndex == 0) + { + if (text_width.Value == 0) // Only update the values if the fields don't already have values. + text_width.Value = sourceTitle.Resolution.Width; + + check_KeepAR.Checked = true; // Forces Resolution to be correct. + } + else + { + if (text_width.Value == 0 && text_height.Value == 0)// Only update the values if the fields don't already have values. + { + text_width.Value = sourceTitle.Resolution.Width; + text_height.Value = sourceTitle.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; + } + + labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height; + } + + updownParWidth.Value = sourceTitle.ParVal.Width; + updownParHeight.Value = sourceTitle.ParVal.Height; + + Size croppedDar = CalculateAnamorphicSizes(); + cachedDar = (double)croppedDar.Width / croppedDar.Height; + updownDisplayWidth.Value = croppedDar.Width; + } + // Picture Controls - private void text_width_ValueChanged(object sender, EventArgs e) + private void TextWidthValueChanged(object sender, EventArgs e) { if (Properties.Settings.Default.disableResCalc) return; - if (_preventChangingWidth) + if (preventChangingWidth) return; // Make sure the new value doesn't exceed the maximum @@ -155,7 +156,7 @@ namespace Handbrake.Controls case 0: if (check_KeepAR.Checked && Source != null) { - _preventChangingHeight = true; + preventChangingHeight = true; int width = (int)text_width.Value; @@ -169,18 +170,18 @@ namespace Handbrake.Controls (Source.Resolution.Height * SourceAspect.Width * crop_width); text_height.Value = (decimal)GetModulusValue(newHeight); - _preventChangingHeight = false; + preventChangingHeight = false; } break; case 3: if (check_KeepAR.CheckState == CheckState.Unchecked && Source != null) { - if (_preventChangingCustom) + if (preventChangingCustom) break; - _preventChangingDisplayWidth = true; + preventChangingDisplayWidth = true; updownDisplayWidth.Value = text_width.Value * updownParWidth.Value / updownParHeight.Value; - _preventChangingDisplayWidth = false; + preventChangingDisplayWidth = false; labelDisplaySize.Text = Math.Truncate(updownDisplayWidth.Value) + "x" + text_height.Value; } @@ -196,14 +197,14 @@ namespace Handbrake.Controls break; } - _preventChangingWidth = false; + preventChangingWidth = false; } - private void text_height_ValueChanged(object sender, EventArgs e) + private void TextHeightValueChanged(object sender, EventArgs e) { if (Properties.Settings.Default.disableResCalc) return; - if (_preventChangingHeight) + if (preventChangingHeight) return; if (Source != null) @@ -215,7 +216,7 @@ namespace Handbrake.Controls case 0: if (check_KeepAR.Checked && Source != null) { - _preventChangingWidth = true; + preventChangingWidth = true; double crop_width = Source.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value; double crop_height = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; @@ -225,7 +226,7 @@ namespace Handbrake.Controls text_width.Value = (decimal)GetModulusValue(new_width); - _preventChangingWidth = false; + preventChangingWidth = false; } break; case 3: @@ -238,17 +239,17 @@ namespace Handbrake.Controls // - Changes PIXEL HEIGHT to STORAGE WIDTH // DAR = DISPLAY WIDTH / DISPLAY HEIGHT (cache after every modification) - double rawCalculatedDisplayWidth = (double)text_height.Value * _cachedDar; + double rawCalculatedDisplayWidth = (double)text_height.Value * cachedDar; - _preventChangingDisplayWidth = true; // Start Guards - _preventChangingWidth = true; + preventChangingDisplayWidth = true; // Start Guards + preventChangingWidth = true; updownDisplayWidth.Value = (decimal)rawCalculatedDisplayWidth; updownParWidth.Value = updownDisplayWidth.Value; updownParHeight.Value = text_width.Value; - _preventChangingWidth = false; // Reset Guards - _preventChangingDisplayWidth = false; + preventChangingWidth = false; // Reset Guards + preventChangingDisplayWidth = false; } break; @@ -257,16 +258,16 @@ namespace Handbrake.Controls break; } - _preventChangingHeight = false; + preventChangingHeight = false; } - private void check_KeepAR_CheckedChanged(object sender, EventArgs e) + private void CheckKeepArCheckedChanged(object sender, EventArgs e) { if (Properties.Settings.Default.disableResCalc) return; //Force TextWidth to recalc height if (check_KeepAR.Checked) - text_width_ValueChanged(this, new EventArgs()); + TextWidthValueChanged(this, new EventArgs()); // Disable the Custom Anamorphic Par Controls if checked. if (drp_anamorphic.SelectedIndex == 3) @@ -279,20 +280,20 @@ namespace Handbrake.Controls if (PictureSettingsChanged != null) PictureSettingsChanged(this, new EventArgs()); } - private void updownDisplayWidth_ValueChanged(object sender, EventArgs e) + private void UpdownDisplayWidthValueChanged(object sender, EventArgs e) { if (Properties.Settings.Default.disableResCalc) return; - if (_preventChangingDisplayWidth == false && check_KeepAR.CheckState == CheckState.Unchecked) + if (preventChangingDisplayWidth == false && check_KeepAR.CheckState == CheckState.Unchecked) { - _preventChangingCustom = true; + preventChangingCustom = true; updownParWidth.Value = updownDisplayWidth.Value; updownParHeight.Value = text_width.Value; - _preventChangingCustom = false; + preventChangingCustom = false; } - if (_preventChangingDisplayWidth == false && check_KeepAR.CheckState == CheckState.Checked) + if (preventChangingDisplayWidth == false && check_KeepAR.CheckState == CheckState.Checked) { // - Changes HEIGHT to keep DAR // - Changes PIXEL WIDTH to new DISPLAY WIDTH @@ -304,41 +305,41 @@ namespace Handbrake.Controls if (!int.TryParse(drp_modulus.SelectedItem.ToString(), out modulus)) modulus = 16; - int rawCalculatedHeight = (int)((int)updownDisplayWidth.Value / _cachedDar); + int rawCalculatedHeight = (int)((int)updownDisplayWidth.Value / cachedDar); int modulusHeight = rawCalculatedHeight - (rawCalculatedHeight % modulus); // Update value - _preventChangingHeight = true; + preventChangingHeight = true; text_height.Value = (decimal)modulusHeight; updownParWidth.Value = updownDisplayWidth.Value; updownParHeight.Value = text_width.Value; - _preventChangingHeight = false; + preventChangingHeight = false; } } // Anamorphic Controls - private void drp_anamorphic_SelectedIndexChanged(object sender, EventArgs e) + private void DrpAnamorphicSelectedIndexChanged(object sender, EventArgs e) { switch (drp_anamorphic.SelectedIndex) { - case 0: + case 0: // None text_width.Enabled = true; text_height.Enabled = true; check_KeepAR.Enabled = true; SetCustomAnamorphicOptionsVisible(false); labelStaticDisplaySize.Visible = false; - labelDisplaySize.Visible = false; + labelDisplaySize.Visible = true; + drp_modulus.Visible = true; // check_KeepAR.Checked = true; - drp_modulus.SelectedIndex = 0; if (check_KeepAR.Checked) - text_width_ValueChanged(this, new EventArgs()); + TextWidthValueChanged(this, new EventArgs()); // Don't update display size if we're not using anamorphic return; - case 1: + case 1: // Strict text_width.Enabled = false; text_height.Enabled = false; check_KeepAR.Enabled = false; @@ -346,11 +347,10 @@ namespace Handbrake.Controls SetCustomAnamorphicOptionsVisible(false); labelStaticDisplaySize.Visible = true; labelDisplaySize.Visible = true; - drp_modulus.SelectedIndex = 0; check_KeepAR.Checked = true; break; - case 2: + case 2: // Loose text_width.Enabled = true; text_height.Enabled = false; check_KeepAR.Enabled = false; @@ -358,11 +358,12 @@ namespace Handbrake.Controls SetCustomAnamorphicOptionsVisible(false); labelStaticDisplaySize.Visible = true; labelDisplaySize.Visible = true; - drp_modulus.SelectedIndex = 0; + drp_modulus.Visible = true; + lbl_modulus.Visible = true; check_KeepAR.Checked = true; break; - case 3: + case 3: // Custom text_width.Enabled = true; text_height.Enabled = true; check_KeepAR.Enabled = true; @@ -381,21 +382,21 @@ namespace Handbrake.Controls labelDisplaySize.Text = CalculateAnamorphicSizes().Width + "x" + CalculateAnamorphicSizes().Height; if (check_KeepAR.Checked) - text_width_ValueChanged(this, new EventArgs()); + TextWidthValueChanged(this, new EventArgs()); if (PictureSettingsChanged != null) PictureSettingsChanged(this, new EventArgs()); } - private void drp_modulus_SelectedIndexChanged(object sender, EventArgs e) + private void DrpModulusSelectedIndexChanged(object sender, EventArgs e) { - _preventChangingWidth = true; - _preventChangingHeight = true; + preventChangingWidth = true; + preventChangingHeight = true; text_width.Value = (decimal)GetModulusValue((double)text_width.Value); text_height.Value = (decimal)GetModulusValue((double)text_height.Value); - _preventChangingWidth = false; - _preventChangingHeight = false; + preventChangingWidth = false; + preventChangingHeight = false; text_width.Increment = int.Parse(drp_modulus.SelectedItem.ToString()); text_height.Increment = int.Parse(drp_modulus.SelectedItem.ToString()); @@ -405,7 +406,7 @@ namespace Handbrake.Controls } // Cropping Controls - private void check_autoCrop_CheckedChanged(object sender, EventArgs e) + private void CheckAutoCropCheckedChanged(object sender, EventArgs e) { crop_top.Enabled = check_customCrop.Checked; crop_bottom.Enabled = check_customCrop.Checked; @@ -420,9 +421,9 @@ namespace Handbrake.Controls crop_right.Value = Source.AutoCropDimensions[3]; } } - private void crop_ValueChanged(object sender, EventArgs e) + private void CropValueChanged(object sender, EventArgs e) { - text_width_ValueChanged(this, new EventArgs()); + TextWidthValueChanged(this, new EventArgs()); } // GUI Functions @@ -455,12 +456,12 @@ namespace Handbrake.Controls if (Source != null) { /* Set up some variables to make the math easier to follow. */ - int cropped_width = Source.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value; - int cropped_height = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; - double storage_aspect = (double)cropped_width / cropped_height; + int croppedWidth = Source.Resolution.Width - (int)crop_left.Value - (int)crop_right.Value; + int croppedHeight = Source.Resolution.Height - (int)crop_top.Value - (int)crop_bottom.Value; + double storageAspect = (double)croppedWidth / croppedHeight; /* Figure out what width the source would display at. */ - double source_display_width = (double)cropped_width * Source.ParVal.Width / Source.ParVal.Height; + double sourceDisplayWidth = (double)croppedWidth * Source.ParVal.Width / Source.ParVal.Height; /* 3 different ways of deciding output dimensions: @@ -474,9 +475,9 @@ namespace Handbrake.Controls default: case 1: /* Strict anamorphic */ - double displayWidth = ((double)cropped_width * Source.ParVal.Width / Source.ParVal.Height); + double displayWidth = ((double)croppedWidth * Source.ParVal.Width / Source.ParVal.Height); displayWidth = Math.Round(displayWidth, 0); - Size output = new Size((int)displayWidth, cropped_height); + Size output = new Size((int)displayWidth, croppedHeight); return output; case 2: /* "Loose" anamorphic. @@ -486,16 +487,16 @@ namespace Handbrake.Controls width = (int)text_width.Value; width = GetModulusValue(width); /* Time to get picture width that divide cleanly.*/ - height = (width / storage_aspect) + 0.5; + height = (width / storageAspect) + 0.5; height = GetModulusValue(height); /* Time to get picture height that divide cleanly.*/ /* The film AR is the source's display width / cropped source height. The output display width is the output height * film AR. The output PAR is the output display width / output storage width. */ - double pixel_aspect_width = height * source_display_width / cropped_height; - double pixel_aspect_height = width; + double pixelAspectWidth = height * sourceDisplayWidth / croppedHeight; + double pixelAspectHeight = width; - double disWidthLoose = (width * pixel_aspect_width / pixel_aspect_height); + double disWidthLoose = (width * pixelAspectWidth / pixelAspectHeight); if (double.IsNaN(disWidthLoose)) disWidthLoose = 0; return new Size((int)disWidthLoose, (int)height); @@ -536,12 +537,11 @@ namespace Handbrake.Controls } // Hidden UI feature to drop the MaxWidth / Height with the MaxWidth/Height label is double clicked - private void lbl_max_DoubleClick(object sender, EventArgs e) + private void LblMaxDoubleClick(object sender, EventArgs e) { PresetMaximumResolution = new Size(0, 0); if (PictureSettingsChanged != null) PictureSettingsChanged(this, new EventArgs()); } - } } \ No newline at end of file diff --git a/win/C#/Controls/Subtitles.Designer.cs b/win/C#/Controls/Subtitles.Designer.cs index 6c54c3f7c..b38b6e4d5 100644 --- a/win/C#/Controls/Subtitles.Designer.cs +++ b/win/C#/Controls/Subtitles.Designer.cs @@ -80,7 +80,7 @@ this.btn_addTrack.Text = "Add"; this.toolTip.SetToolTip(this.btn_addTrack, "Add a new subtitle track to the list below"); this.btn_addTrack.UseVisualStyleBackColor = false; - this.btn_addTrack.Click += new System.EventHandler(this.btn_addSubTrack_Click); + this.btn_addTrack.Click += new System.EventHandler(this.BtnAddSubTrackClick); // // btn_RemoveSubTrack // @@ -93,7 +93,7 @@ this.btn_RemoveSubTrack.TabIndex = 69; this.btn_RemoveSubTrack.Text = "Remove"; this.btn_RemoveSubTrack.UseVisualStyleBackColor = false; - this.btn_RemoveSubTrack.Click += new System.EventHandler(this.btn_RemoveSubTrack_Click); + this.btn_RemoveSubTrack.Click += new System.EventHandler(this.BtnRemoveSubTrackClick); // // lv_subList // @@ -117,7 +117,7 @@ this.lv_subList.TabIndex = 70; this.lv_subList.UseCompatibleStateImageBehavior = false; this.lv_subList.View = System.Windows.Forms.View.Details; - this.lv_subList.SelectedIndexChanged += new System.EventHandler(this.lb_subList_SelectedIndexChanged); + this.lv_subList.SelectedIndexChanged += new System.EventHandler(this.LbSubListSelectedIndexChanged); // // col_Source // @@ -168,7 +168,7 @@ this.mnu_moveup.Name = "mnu_moveup"; this.mnu_moveup.Size = new System.Drawing.Size(138, 22); this.mnu_moveup.Text = "Move Up"; - this.mnu_moveup.Click += new System.EventHandler(this.mnu_moveup_Click); + this.mnu_moveup.Click += new System.EventHandler(this.MnuMoveupClick); // // mnu_movedown // @@ -176,7 +176,7 @@ this.mnu_movedown.Size = new System.Drawing.Size(138, 22); this.mnu_movedown.Text = "Move Down"; this.mnu_movedown.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.mnu_movedown.Click += new System.EventHandler(this.mnu_movedown_Click); + this.mnu_movedown.Click += new System.EventHandler(this.MnuMovedownClick); // // toolStripSeparator2 // @@ -188,7 +188,7 @@ this.mnu_remove.Name = "mnu_remove"; this.mnu_remove.Size = new System.Drawing.Size(138, 22); this.mnu_remove.Text = "Remove"; - this.mnu_remove.Click += new System.EventHandler(this.mnu_remove_Click); + this.mnu_remove.Click += new System.EventHandler(this.MnuRemoveClick); // // label68 // @@ -233,7 +233,7 @@ this.drp_subtitleTracks.Name = "drp_subtitleTracks"; this.drp_subtitleTracks.Size = new System.Drawing.Size(164, 21); this.drp_subtitleTracks.TabIndex = 74; - this.drp_subtitleTracks.SelectedIndexChanged += new System.EventHandler(this.drp_subtitleTracks_SelectedIndexChanged); + this.drp_subtitleTracks.SelectedIndexChanged += new System.EventHandler(this.DrpSubtitleTracksSelectedIndexChanged); // // label10 // @@ -284,7 +284,7 @@ this.srt_offset.Name = "srt_offset"; this.srt_offset.Size = new System.Drawing.Size(58, 21); this.srt_offset.TabIndex = 79; - this.srt_offset.ValueChanged += new System.EventHandler(this.srt_offset_ValueChanged); + this.srt_offset.ValueChanged += new System.EventHandler(this.SrtOffsetValueChanged); // // srt_lang // @@ -295,7 +295,7 @@ this.srt_lang.Name = "srt_lang"; this.srt_lang.Size = new System.Drawing.Size(103, 21); this.srt_lang.TabIndex = 50; - this.srt_lang.SelectedIndexChanged += new System.EventHandler(this.srt_lang_SelectedIndexChanged); + this.srt_lang.SelectedIndexChanged += new System.EventHandler(this.SrtLangSelectedIndexChanged); // // label8 // @@ -347,7 +347,7 @@ this.srt_charcode.Name = "srt_charcode"; this.srt_charcode.Size = new System.Drawing.Size(78, 21); this.srt_charcode.TabIndex = 73; - this.srt_charcode.SelectedIndexChanged += new System.EventHandler(this.srt_charcode_SelectedIndexChanged); + this.srt_charcode.SelectedIndexChanged += new System.EventHandler(this.SrtCharcodeSelectedIndexChanged); // // label4 // @@ -366,7 +366,7 @@ this.check_forced.Size = new System.Drawing.Size(15, 14); this.check_forced.TabIndex = 75; this.check_forced.UseVisualStyleBackColor = true; - this.check_forced.CheckedChanged += new System.EventHandler(this.check_forced_CheckedChanged); + this.check_forced.CheckedChanged += new System.EventHandler(this.CheckForcedCheckedChanged); // // label7 // @@ -394,7 +394,7 @@ this.check_default.Size = new System.Drawing.Size(15, 14); this.check_default.TabIndex = 77; this.check_default.UseVisualStyleBackColor = true; - this.check_default.CheckedChanged += new System.EventHandler(this.check_default_CheckedChanged); + this.check_default.CheckedChanged += new System.EventHandler(this.CheckDefaultCheckedChanged); // // check_burned // @@ -404,7 +404,7 @@ this.check_burned.Size = new System.Drawing.Size(15, 14); this.check_burned.TabIndex = 76; this.check_burned.UseVisualStyleBackColor = true; - this.check_burned.CheckedChanged += new System.EventHandler(this.check_burned_CheckedChanged); + this.check_burned.CheckedChanged += new System.EventHandler(this.CheckBurnedCheckedChanged); // // btn_srtAdd // @@ -418,7 +418,7 @@ this.btn_srtAdd.Text = "Import SRT"; this.toolTip.SetToolTip(this.btn_srtAdd, "Add a new SRT file to the \"track\" dropdown menu."); this.btn_srtAdd.UseVisualStyleBackColor = false; - this.btn_srtAdd.Click += new System.EventHandler(this.btn_srtAdd_Click); + this.btn_srtAdd.Click += new System.EventHandler(this.BtnSrtAddClick); // // openFileDialog // diff --git a/win/C#/Controls/Subtitles.cs b/win/C#/Controls/Subtitles.cs index fb179bba2..45a21475f 100644 --- a/win/C#/Controls/Subtitles.cs +++ b/win/C#/Controls/Subtitles.cs @@ -13,18 +13,20 @@ using Handbrake.Model; namespace Handbrake.Controls { + using System.Linq; + public partial class Subtitles : UserControl { - readonly IDictionary LangMap = new Dictionary(); - List SubList = new List(); - private int FileContainer; + readonly IDictionary langMap = new Dictionary(); + readonly List subList = new List(); + private int fileContainer; public Subtitles() { InitializeComponent(); - LangMap = Main.MapLanguages(); - foreach (string key in LangMap.Keys) + langMap = Main.MapLanguages(); + foreach (string key in langMap.Keys) srt_lang.Items.Add(key); srt_charcode.SelectedIndex = 28; @@ -32,7 +34,7 @@ namespace Handbrake.Controls } // Primary Controls - private void btn_addSubTrack_Click(object sender, EventArgs e) + private void BtnAddSubTrackClick(object sender, EventArgs e) { // Logic string forcedVal = check_forced.CheckState == CheckState.Checked ? "Yes" : "No"; @@ -56,23 +58,20 @@ namespace Handbrake.Controls if (defaultSub == "Yes") SetNoDefault(); if (burnedVal == "Yes") SetNoBurned(); - if (FileContainer == 0) + if (fileContainer == 0) burnedVal = "Yes"; // MP4 must have bitmap subs burned in. } - if (FileContainer == 0) // MP4 and M4V file extension + if (fileContainer == 0) // MP4 and M4V file extension { // Make sure we only have 1 bitmap track. if (drp_subtitleTracks.SelectedItem != null && drp_subtitleTracks.SelectedItem.ToString().Contains("Bitmap")) { - foreach (ListViewItem item in lv_subList.Items) + if (lv_subList.Items.Cast().Any(item => item.SubItems[0].Text.Contains("Bitmap"))) { - if (item.SubItems[0].Text.Contains("Bitmap")) - { - MessageBox.Show(this, "More than one vobsub is not supported in mp4... Your first vobsub track will now be used.", - "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; - } + MessageBox.Show(this, "More than one vobsub is not supported in mp4... Your first vobsub track will now be used.", + "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; } } } @@ -96,28 +95,28 @@ namespace Handbrake.Controls }; lv_subList.Items.Add(track.ListView); - SubList.Add(track); + subList.Add(track); } - private void btn_srtAdd_Click(object sender, EventArgs e) + private void BtnSrtAddClick(object sender, EventArgs e) { if (openFileDialog.ShowDialog() != DialogResult.OK) return; drp_subtitleTracks.Items.Add(Path.GetFileName(openFileDialog.FileName)); drp_subtitleTracks.SelectedItem = Path.GetFileName(openFileDialog.FileName); } - private void btn_RemoveSubTrack_Click(object sender, EventArgs e) + private void BtnRemoveSubTrackClick(object sender, EventArgs e) { RemoveTrack(); } // Secondary Controls - private void lb_subList_SelectedIndexChanged(object sender, EventArgs e) + private void LbSubListSelectedIndexChanged(object sender, EventArgs e) { // Set the dropdown controls based on the selected item in the List. if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0) { - SubtitleInfo track = SubList[lv_subList.SelectedIndices[0]]; + SubtitleInfo track = subList[lv_subList.SelectedIndices[0]]; int c = 0; if (lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text.ToLower().Contains(".srt")) // We have an SRT @@ -153,7 +152,7 @@ namespace Handbrake.Controls } // Bitmap / CC / SRT Controls - private void drp_subtitleTracks_SelectedIndexChanged(object sender, EventArgs e) + private void DrpSubtitleTracksSelectedIndexChanged(object sender, EventArgs e) { if (drp_subtitleTracks.SelectedItem.ToString().Contains(".srt")) { @@ -186,18 +185,18 @@ namespace Handbrake.Controls lv_subList.Select(); } - SubList[lv_subList.SelectedIndices[0]].Track = drp_subtitleTracks.SelectedItem.ToString(); // Update SubList List + subList[lv_subList.SelectedIndices[0]].Track = drp_subtitleTracks.SelectedItem.ToString(); // Update SubList List } - private void check_forced_CheckedChanged(object sender, EventArgs e) + private void CheckForcedCheckedChanged(object sender, EventArgs e) { if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return; lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text = check_forced.Checked ? "Yes" : "No"; lv_subList.Select(); - SubList[lv_subList.SelectedIndices[0]].Forced = check_forced.Checked ? "Yes" : "No"; // Update SubList List + subList[lv_subList.SelectedIndices[0]].Forced = check_forced.Checked ? "Yes" : "No"; // Update SubList List } - private void check_burned_CheckedChanged(object sender, EventArgs e) + private void CheckBurnedCheckedChanged(object sender, EventArgs e) { if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return; @@ -207,9 +206,9 @@ namespace Handbrake.Controls lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[2].Text = check_burned.Checked ? "Yes" : "No"; lv_subList.Select(); - SubList[lv_subList.SelectedIndices[0]].Burned = check_burned.Checked ? "Yes" : "No"; // Update SubList List + subList[lv_subList.SelectedIndices[0]].Burned = check_burned.Checked ? "Yes" : "No"; // Update SubList List } - private void check_default_CheckedChanged(object sender, EventArgs e) + private void CheckDefaultCheckedChanged(object sender, EventArgs e) { if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return; @@ -222,9 +221,9 @@ namespace Handbrake.Controls lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[3].Text = check_default.Checked ? "Yes" : "No"; lv_subList.Select(); - SubList[lv_subList.SelectedIndices[0]].Default = check_default.Checked ? "Yes" : "No"; // Update SubList List + subList[lv_subList.SelectedIndices[0]].Default = check_default.Checked ? "Yes" : "No"; // Update SubList List } - private void srt_offset_ValueChanged(object sender, EventArgs e) + private void SrtOffsetValueChanged(object sender, EventArgs e) { // Update an item in the list if required. if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) @@ -233,29 +232,29 @@ namespace Handbrake.Controls lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[6].Text = srt_offset.Value.ToString(); lv_subList.Select(); - SubList[lv_subList.SelectedIndices[0]].SrtOffset = (int)srt_offset.Value; // Update SubList List + subList[lv_subList.SelectedIndices[0]].SrtOffset = (int)srt_offset.Value; // Update SubList List } - private void srt_charcode_SelectedIndexChanged(object sender, EventArgs e) + private void SrtCharcodeSelectedIndexChanged(object sender, EventArgs e) { if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return; lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[5].Text = srt_charcode.SelectedItem.ToString(); lv_subList.Select(); - SubList[lv_subList.SelectedIndices[0]].SrtCharCode = srt_charcode.SelectedItem.ToString(); // Update SubList List + subList[lv_subList.SelectedIndices[0]].SrtCharCode = srt_charcode.SelectedItem.ToString(); // Update SubList List } - private void srt_lang_SelectedIndexChanged(object sender, EventArgs e) + private void SrtLangSelectedIndexChanged(object sender, EventArgs e) { if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return; lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[4].Text = srt_lang.SelectedItem.ToString(); lv_subList.Select(); - SubList[lv_subList.SelectedIndices[0]].SrtLang = srt_lang.SelectedItem.ToString(); // Update SubList List + subList[lv_subList.SelectedIndices[0]].SrtLang = srt_lang.SelectedItem.ToString(); // Update SubList List } // Right Click Menu - private void mnu_moveup_Click(object sender, EventArgs e) + private void MnuMoveupClick(object sender, EventArgs e) { if (lv_subList.SelectedIndices.Count != 0) { @@ -272,7 +271,7 @@ namespace Handbrake.Controls } } } - private void mnu_movedown_Click(object sender, EventArgs e) + private void MnuMovedownClick(object sender, EventArgs e) { if (lv_subList.SelectedIndices.Count != 0) { @@ -289,7 +288,7 @@ namespace Handbrake.Controls } } } - private void mnu_remove_Click(object sender, EventArgs e) + private void MnuRemoveClick(object sender, EventArgs e) { RemoveTrack(); } @@ -300,12 +299,12 @@ namespace Handbrake.Controls int c = 0; foreach (ListViewItem item in lv_subList.Items) { - if (SubList[c].SrtPath == "-") + if (subList[c].SrtPath == "-") { if (item.SubItems[3].Text == "Yes") { item.SubItems[3].Text = "No"; - SubList[c].Default = "No"; + subList[c].Default = "No"; } } c++; @@ -317,12 +316,12 @@ namespace Handbrake.Controls int c = 0; foreach (ListViewItem item in lv_subList.Items) { - if (SubList[c].SrtPath != "-") + if (subList[c].SrtPath != "-") { if (item.SubItems[3].Text == "Yes") { item.SubItems[3].Text = "No"; - SubList[c].Default = "No"; + subList[c].Default = "No"; } } c++; @@ -336,7 +335,7 @@ namespace Handbrake.Controls if (item.SubItems[2].Text == "Yes") { item.SubItems[2].Text = "No"; - SubList[c].Burned = "No"; + subList[c].Burned = "No"; } c++; } @@ -351,7 +350,7 @@ namespace Handbrake.Controls int selectedInd = lv_subList.SelectedIndices[0]; lv_subList.Items.RemoveAt(selectedInd); - SubList.RemoveAt(selectedInd); + subList.RemoveAt(selectedInd); // Now reslect the correct item and give focus to the list. if (lv_subList.Items.Count != 0) @@ -366,18 +365,29 @@ namespace Handbrake.Controls } } - // Public Functions + /// + /// Clear the Subtitle List + /// public void Clear() { lv_subList.Items.Clear(); - SubList.Clear(); + subList.Clear(); } + + /// + /// Cleverly Clear the subtitle list. Only remove tracks that are not available for the current source. + /// public void SmartClear() { /* Smart clear will only remove subtitle tracks that do not have an equivlent for the new source / title which the user has selected. */ throw new NotImplementedException(); } + + /// + /// Checks of the current settings will require the m4v file extension + /// + /// True if Yes public Boolean RequiresM4V() { foreach (ListViewItem item in lv_subList.Items) @@ -390,6 +400,12 @@ namespace Handbrake.Controls } return false; } + + /// + /// Automatically setup the subtitle tracks. + /// This handles the automatic setup of subitles which the user can control from the program options + /// + /// public void SetSubtitleTrackAuto(object[] subs) { drp_subtitleTracks.Items.Clear(); @@ -412,15 +428,20 @@ namespace Handbrake.Controls i++; } - btn_addSubTrack_Click(this, new EventArgs()); + BtnAddSubTrackClick(this, new EventArgs()); } } } + + /// + /// Set the file container which is currently in use. + /// + /// public void SetContainer(int value) { - FileContainer = value; + fileContainer = value; Boolean trigger = false; - if (FileContainer != 1) + if (fileContainer != 1) foreach (ListViewItem item in lv_subList.Items) { if (item.SubItems[1].Text.Contains("Bitmap")) @@ -431,9 +452,131 @@ namespace Handbrake.Controls } } } + + /// + /// Get the list of subtitles. + /// + /// public List GetSubtitleInfoList() { - return SubList; + return subList; + } + + /// + /// Get the CLI Query for this panel + /// + /// + public string GetCliQuery + { + get + { + string query = string.Empty; + if (lv_subList.Items.Count != 0) // If we have subtitle tracks + { + // BitMap and CC's + string subtitleTracks = String.Empty; + string subtitleForced = String.Empty; + string subtitleBurn = String.Empty; + string subtitleDefault = String.Empty; + + // SRT + string srtFile = String.Empty; + string srtCodeset = String.Empty; + string srtOffset = String.Empty; + string srtLang = String.Empty; + string srtDefault = String.Empty; + int srtCount = 0; + + foreach (SubtitleInfo item in subList) + { + string itemToAdd, trackId; + + if (item.IsSrtSubtitle) // We have an SRT file + { + srtCount++; // SRT track id. + + srtLang += srtLang == "" ? langMap[item.SrtLang] : "," + langMap[item.SrtLang]; + srtCodeset += srtCodeset == "" ? item.SrtCharCode : "," + item.SrtCharCode; + + if (item.Default == "Yes") + srtDefault = srtCount.ToString(); + + itemToAdd = item.SrtPath; + srtFile += srtFile == "" ? itemToAdd : "," + itemToAdd; + + itemToAdd = item.SrtOffset.ToString(); + srtOffset += srtOffset == "" ? itemToAdd : "," + itemToAdd; + } + else // We have Bitmap or CC + { + string[] tempSub; + + // Find --subtitle + if (item.Track.Contains("Foreign Audio Search")) + itemToAdd = "scan"; + else + { + tempSub = item.Track.Split(' '); + itemToAdd = tempSub[0]; + } + + subtitleTracks += subtitleTracks == "" ? itemToAdd : "," + itemToAdd; + + // Find --subtitle-forced + itemToAdd = ""; + tempSub = item.Track.Split(' '); + trackId = tempSub[0]; + + if (item.Forced == "Yes") + itemToAdd = "scan"; + + if (itemToAdd != "") + subtitleForced += subtitleForced == "" ? itemToAdd : "," + itemToAdd; + + // Find --subtitle-burn and --subtitle-default + trackId = tempSub[0]; + + if (trackId.Trim() == "Foreign") // foreign audio search + trackId = "scan"; + + if (item.Burned == "Yes") // burn + subtitleBurn = trackId; + + if (item.Default == "Yes") // default + subtitleDefault = trackId; + } + } + + // Build The CLI Subtitles Query + if (subtitleTracks != "") + { + query += " --subtitle " + subtitleTracks; + + if (subtitleForced != "") + query += " --subtitle-forced=" + subtitleForced; + if (subtitleBurn != "") + query += " --subtitle-burn=" + subtitleBurn; + if (subtitleDefault != "") + query += " --subtitle-default=" + subtitleDefault; + } + + if (srtFile != "") // SRTs + { + query += " --srt-file " + "\"" + srtFile + "\""; + + if (srtCodeset != "") + query += " --srt-codeset " + srtCodeset; + if (srtOffset != "") + query += " --srt-offset " + srtOffset; + if (srtLang != "") + query += " --srt-lang " + srtLang; + if (srtDefault != "") + query += " --srt-default=" + srtDefault; + } + + } + return query; + } } } } \ No newline at end of file diff --git a/win/C#/Controls/x264Panel.cs b/win/C#/Controls/x264Panel.cs index 78480b2de..56146a0ae 100644 --- a/win/C#/Controls/x264Panel.cs +++ b/win/C#/Controls/x264Panel.cs @@ -34,7 +34,7 @@ namespace Handbrake.Controls /// public string X264Query { - get { return rtf_x264Query.Text; } + get { return " -x " + rtf_x264Query.Text; } set { rtf_x264Query.Text = value; } } diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs index 499b11d2e..1aaef8f46 100644 --- a/win/C#/Functions/QueryGenerator.cs +++ b/win/C#/Functions/QueryGenerator.cs @@ -23,7 +23,7 @@ namespace Handbrake.Functions /// time in seconds for preview mode /// --start-at-preview (int) /// CLI Query - public static string GenerateCLIQuery(frmMain mainWindow, int mode, int duration, string preview) + public static string GenerateCliQuery(frmMain mainWindow, int mode, int duration, string preview) { string query = ""; @@ -157,11 +157,17 @@ namespace Handbrake.Functions switch (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex) { + case 0: + if (mainWindow.PictureSettings.drp_modulus.SelectedIndex != 0) + query += " --modulus " + mainWindow.PictureSettings.drp_modulus.SelectedItem; + break; case 1: query += " --strict-anamorphic "; break; case 2: query += " --loose-anamorphic "; + if (mainWindow.PictureSettings.drp_modulus.SelectedIndex != 0) + query += " --modulus " + mainWindow.PictureSettings.drp_modulus.SelectedItem; break; case 3: query += " --custom-anamorphic "; @@ -182,9 +188,8 @@ namespace Handbrake.Functions } #endregion - #region Filters - query += mainWindow.Filters.GetCLIQuery; - #endregion + // Filters Panel + query += mainWindow.Filters.GetCliQuery; #region Video Settings Tab @@ -382,116 +387,8 @@ namespace Handbrake.Functions #endregion - #region Subtitles Tab - if (mainWindow.Subtitles.lv_subList.Items.Count != 0) // If we have subtitle tracks - { - IDictionary langMap = Main.MapLanguages(); - - // BitMap and CC's - string subtitleTracks = String.Empty; - string subtitleForced = String.Empty; - string subtitleBurn = String.Empty; - string subtitleDefault = String.Empty; - - // SRT - string srtFile = String.Empty; - string srtCodeset = String.Empty; - string srtOffset = String.Empty; - string srtLang = String.Empty; - string srtDefault = String.Empty; - int srtCount = 0; - - List SubList = mainWindow.Subtitles.GetSubtitleInfoList(); - - foreach (var item in SubList) - { - string itemToAdd, trackID; - - if (item.SrtPath != "-") // We have an SRT file - { - srtCount++; // SRT track id. - - srtLang += srtLang == "" ? langMap[item.SrtLang] : "," + langMap[item.SrtLang]; - srtCodeset += srtCodeset == "" ? item.SrtCharCode : "," + item.SrtCharCode; - - if (item.Default == "Yes") // default - srtDefault = srtCount.ToString(); - - itemToAdd = item.SrtPath; - srtFile += srtFile == "" ? itemToAdd : "," + itemToAdd; - - itemToAdd = item.SrtOffset.ToString(); - srtOffset += srtOffset == "" ? itemToAdd : "," + itemToAdd; - } - else // We have Bitmap or CC - { - string[] tempSub; - - // Find --subtitle - if (item.Track.Contains("Foreign Audio Search")) - itemToAdd = "scan"; - else - { - tempSub = item.Track.Split(' '); - itemToAdd = tempSub[0]; - } - - subtitleTracks += subtitleTracks == "" ? itemToAdd : "," + itemToAdd; - - // Find --subtitle-forced - itemToAdd = ""; - tempSub = item.Track.Split(' '); - trackID = tempSub[0]; - - if (item.Forced == "Yes") - itemToAdd = "scan"; - - if (itemToAdd != "") - subtitleForced += subtitleForced == "" ? itemToAdd : "," + itemToAdd; - - // Find --subtitle-burn and --subtitle-default - trackID = tempSub[0]; - - if (trackID.Trim() == "Foreign") - trackID = "scan"; - - if (item.Burned == "Yes") // burn - subtitleBurn = trackID; - - if (item.Default == "Yes") // default - subtitleDefault = trackID; - } - } - - // Build The CLI Subtitles Query - if (subtitleTracks != "") - { - query += " --subtitle " + subtitleTracks; - - if (subtitleForced != "") - query += " --subtitle-forced=" + subtitleForced; - if (subtitleBurn != "") - query += " --subtitle-burn=" + subtitleBurn; - if (subtitleDefault != "") - query += " --subtitle-default=" + subtitleDefault; - } - - if (srtFile != "") // SRTs - { - query += " --srt-file " + "\"" + srtFile + "\""; - - if (srtCodeset != "") - query += " --srt-codeset " + srtCodeset; - if (srtOffset != "") - query += " --srt-offset " + srtOffset; - if (srtLang != "") - query += " --srt-lang " + srtLang; - if (srtDefault != "") - query += " --srt-default=" + srtDefault; - } - - } - #endregion + // Subtitles Panel + query += mainWindow.Subtitles.GetCliQuery; #region Chapter Markers @@ -502,16 +399,16 @@ namespace Handbrake.Functions dest_name = dest_name.Replace("\"", ""); dest_name = dest_name.Replace(".mp4", "").Replace(".m4v", "").Replace(".mkv", ""); - string source_title = mainWindow.drp_dvdtitle.Text; - string[] titlesplit = source_title.Split(' '); - source_title = titlesplit[0]; + string sourceTitle = mainWindow.drp_dvdtitle.Text; + string[] titlesplit = sourceTitle.Split(' '); + sourceTitle = titlesplit[0]; if (mainWindow.Check_ChapterMarkers.Checked && mainWindow.Check_ChapterMarkers.Enabled) { if (dest_name.Trim() != String.Empty) { - string path = source_title != "Automatic" - ? Path.Combine(Path.GetTempPath(), dest_name + "-" + source_title + "-chapters.csv") + string path = sourceTitle != "Automatic" + ? Path.Combine(Path.GetTempPath(), dest_name + "-" + sourceTitle + "-chapters.csv") : Path.Combine(Path.GetTempPath(), dest_name + "-chapters.csv"); if (ChapterCSVSave(mainWindow, path) == false) @@ -524,10 +421,8 @@ namespace Handbrake.Functions } #endregion - #region H264 Tab - if (mainWindow.x264Panel.X264Query != "") - query += " -x " + mainWindow.x264Panel.X264Query; - #endregion + // X264 Panel + query += " -x " + mainWindow.x264Panel.X264Query; #region Processors / Other string processors = Properties.Settings.Default.Processors; diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index 9ed70f38c..fd71c1161 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -1,4 +1,5 @@ - + + Debug AnyCPU @@ -17,12 +18,10 @@ - 2.0 + 3.5 v3.5 false false - - publish\ true Disk @@ -52,6 +51,7 @@ x86 + AllRules.ruleset full @@ -69,10 +69,12 @@ true 512 x86 + AllRules.ruleset x86 bin\x86\Debug\ + AllRules.ruleset x86 @@ -80,6 +82,7 @@ false TRACE;DEBUG true + AllRules.ruleset bin\Build\ @@ -87,10 +90,12 @@ pdbonly x86 prompt + AllRules.ruleset bin\x86\Build\ x86 + AllRules.ruleset diff --git a/win/C#/HandBrakeCS.sln b/win/C#/HandBrakeCS.sln index 81ce84ca6..34013bf20 100644 --- a/win/C#/HandBrakeCS.sln +++ b/win/C#/HandBrakeCS.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandBrakeCS", "HandBrakeCS.csproj", "{A2923D42-C38B-4B12-8CBA-B8D93D6B13A3}" EndProject Global diff --git a/win/C#/Model/Subtitle.cs b/win/C#/Model/Subtitle.cs index 69ddbbdd7..0eead5908 100644 --- a/win/C#/Model/Subtitle.cs +++ b/win/C#/Model/Subtitle.cs @@ -57,6 +57,17 @@ namespace Handbrake.Model /// public string SrtFileName { get; set; } + /// + /// Returns if this is an SRT subtitle. + /// + public bool IsSrtSubtitle + { + get + { + return SrtFileName != "-"; + } + } + /// /// A ListViewItem Containing information about this subitlte /// diff --git a/win/C#/Properties/Resources.Designer.cs b/win/C#/Properties/Resources.Designer.cs index 36b338870..137e9233a 100644 --- a/win/C#/Properties/Resources.Designer.cs +++ b/win/C#/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.1433 +// Runtime Version:4.0.30128.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace Handbrake.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index 5fb21562f..d5d4173fb 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4927 +// Runtime Version:4.0.30128.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace Handbrake.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/win/C#/app.config b/win/C#/app.config index 4dff91bb1..f52e8f082 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -1,135 +1,135 @@ - - -
- - - - - - Below Normal - - - Automatic - - - True - - - {hb_version} - - - True - - - Do Nothing - - - - - - 0 - - - 0 - - - True - - - - - - http://handbrake.fr/appcast.xml - - - http://handbrake.fr/appcast_unstable.xml - - - False - - - {source}-{title} - - - False - - - - - - False - - - C:\Program Files\VideoLAN\vlc\vlc.exe - - - True - - - False - - - 0.25 - - - 1 - - - False - - - False - - - False - - - True - - - - - - 7 - - - True - - - True - - - Any - - - False - - - - - - False - - - False - - - False - - - - - - 10 - - - False - - - True - - - - + + +
+ + + + + + Below Normal + + + Automatic + + + True + + + {hb_version} + + + True + + + Do Nothing + + + + + + 0 + + + 0 + + + True + + + + + + http://handbrake.fr/appcast.xml + + + http://handbrake.fr/appcast_unstable.xml + + + False + + + {source}-{title} + + + False + + + + + + False + + + C:\Program Files\VideoLAN\vlc\vlc.exe + + + True + + + False + + + 0.25 + + + 1 + + + False + + + False + + + False + + + True + + + + + + 7 + + + True + + + True + + + Any + + + False + + + + + + False + + + False + + + False + + + + + + 10 + + + False + + + True + + + + diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 6da486aa4..e40022c24 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -277,7 +277,7 @@ namespace Handbrake this.check_turbo.Enabled = false; this.check_turbo.Location = new System.Drawing.Point(146, 123); this.check_turbo.Name = "check_turbo"; - this.check_turbo.Size = new System.Drawing.Size(101, 17); + this.check_turbo.Size = new System.Drawing.Size(99, 17); this.check_turbo.TabIndex = 7; this.check_turbo.Text = "Turbo first Pass"; this.ToolTip.SetToolTip(this.check_turbo, "Makes the first pass of a 2 pass encode faster."); @@ -853,7 +853,7 @@ namespace Handbrake this.radio_cq.BackColor = System.Drawing.Color.Transparent; this.radio_cq.Location = new System.Drawing.Point(336, 97); this.radio_cq.Name = "radio_cq"; - this.radio_cq.Size = new System.Drawing.Size(110, 17); + this.radio_cq.Size = new System.Drawing.Size(105, 17); this.radio_cq.TabIndex = 18; this.radio_cq.Text = "Constant Quality:"; this.radio_cq.UseVisualStyleBackColor = false; @@ -866,7 +866,7 @@ namespace Handbrake this.radio_avgBitrate.Checked = true; this.radio_avgBitrate.Location = new System.Drawing.Point(336, 64); this.radio_avgBitrate.Name = "radio_avgBitrate"; - this.radio_avgBitrate.Size = new System.Drawing.Size(116, 17); + this.radio_avgBitrate.Size = new System.Drawing.Size(112, 17); this.radio_avgBitrate.TabIndex = 17; this.radio_avgBitrate.TabStop = true; this.radio_avgBitrate.Text = "Avg Bitrate (kbps):"; @@ -879,7 +879,7 @@ namespace Handbrake this.radio_targetFilesize.BackColor = System.Drawing.Color.Transparent; this.radio_targetFilesize.Location = new System.Drawing.Point(336, 37); this.radio_targetFilesize.Name = "radio_targetFilesize"; - this.radio_targetFilesize.Size = new System.Drawing.Size(108, 17); + this.radio_targetFilesize.Size = new System.Drawing.Size(107, 17); this.radio_targetFilesize.TabIndex = 16; this.radio_targetFilesize.Text = "Target Size (MB):"; this.radio_targetFilesize.UseVisualStyleBackColor = false; @@ -902,7 +902,7 @@ namespace Handbrake this.check_2PassEncode.BackColor = System.Drawing.Color.Transparent; this.check_2PassEncode.Location = new System.Drawing.Point(125, 100); this.check_2PassEncode.Name = "check_2PassEncode"; - this.check_2PassEncode.Size = new System.Drawing.Size(104, 17); + this.check_2PassEncode.Size = new System.Drawing.Size(106, 17); this.check_2PassEncode.TabIndex = 6; this.check_2PassEncode.Text = "2-Pass Encoding"; this.check_2PassEncode.UseVisualStyleBackColor = false; @@ -960,6 +960,7 @@ namespace Handbrake this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.PictureSettings.Location = new System.Drawing.Point(0, 0); this.PictureSettings.Name = "PictureSettings"; + this.PictureSettings.PresetMaximumResolution = new System.Drawing.Size(0, 0); this.PictureSettings.Size = new System.Drawing.Size(666, 279); this.PictureSettings.TabIndex = 0; // @@ -969,7 +970,7 @@ namespace Handbrake this.Check_ChapterMarkers.BackColor = System.Drawing.Color.Transparent; this.Check_ChapterMarkers.Location = new System.Drawing.Point(16, 32); this.Check_ChapterMarkers.Name = "Check_ChapterMarkers"; - this.Check_ChapterMarkers.Size = new System.Drawing.Size(140, 17); + this.Check_ChapterMarkers.Size = new System.Drawing.Size(136, 17); this.Check_ChapterMarkers.TabIndex = 1; this.Check_ChapterMarkers.Text = "Create chapter markers"; this.Check_ChapterMarkers.UseVisualStyleBackColor = false; @@ -1193,9 +1194,9 @@ namespace Handbrake this.treeView_presets.ShowLines = false; this.treeView_presets.Size = new System.Drawing.Size(240, 424); this.treeView_presets.TabIndex = 0; - this.treeView_presets.MouseUp += new System.Windows.Forms.MouseEventHandler(this.treeview_presets_mouseUp); this.treeView_presets.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_presets_AfterSelect); this.treeView_presets.KeyUp += new System.Windows.Forms.KeyEventHandler(this.treeView_presets_deleteKey); + this.treeView_presets.MouseUp += new System.Windows.Forms.MouseEventHandler(this.treeview_presets_mouseUp); // // presets_menu // diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 0d1630934..18e39f7c5 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -397,7 +397,7 @@ namespace Handbrake } private void btn_new_preset_Click(object sender, EventArgs e) { - Form preset = new frmAddPreset(this, QueryGenerator.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null), presetHandler); + Form preset = new frmAddPreset(this, QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null), presetHandler); preset.ShowDialog(); } #endregion @@ -639,16 +639,16 @@ namespace Handbrake if (result == DialogResult.Yes) { PresetLoader.LoadPreset(this, parsed, parsed.PresetName, parsed.UsesPictureSettings); - presetHandler.Update(parsed.PresetName + " (Imported)", QueryGenerator.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null), + presetHandler.Update(parsed.PresetName + " (Imported)", QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null), parsed.UsesPictureSettings); } } else { PresetLoader.LoadPreset(this, parsed, parsed.PresetName, parsed.UsesPictureSettings); - presetHandler.Add(parsed.PresetName, QueryGenerator.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null), parsed.UsesPictureSettings); + presetHandler.Add(parsed.PresetName, QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null), parsed.UsesPictureSettings); - if (presetHandler.Add(parsed.PresetName + " (Imported)", QueryGenerator.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null), parsed.UsesPictureSettings)) + if (presetHandler.Add(parsed.PresetName + " (Imported)", QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null), parsed.UsesPictureSettings)) { TreeNode preset_treeview = new TreeNode(parsed.PresetName + " (Imported)") { ForeColor = Color.Black }; treeView_presets.Nodes.Add(preset_treeview); @@ -706,8 +706,8 @@ namespace Handbrake { if (encodeQueue.Count != 0 || (!string.IsNullOrEmpty(sourcePath) && !string.IsNullOrEmpty(text_destination.Text))) { - string generatedQuery = QueryGenerator.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null); - string specifiedQuery = rtf_query.Text != "" ? rtf_query.Text : QueryGenerator.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null); + string generatedQuery = QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null); + string specifiedQuery = rtf_query.Text != "" ? rtf_query.Text : QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null); string query = string.Empty; // Check to make sure the generated query matches the GUI settings @@ -776,7 +776,7 @@ namespace Handbrake MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); else { - String query = QueryGenerator.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null); + String query = QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null); if (rtf_query.Text != "") query = rtf_query.Text; @@ -1479,7 +1479,7 @@ namespace Handbrake // Query Editor Tab private void btn_generate_Query_Click(object sender, EventArgs e) { - rtf_query.Text = QueryGenerator.GenerateCLIQuery(this, drop_mode.SelectedIndex, 0, null); + rtf_query.Text = QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null); } private void btn_clear_Click(object sender, EventArgs e) { diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx index 057cc5471..a3662bdb2 100644 --- a/win/C#/frmMain.resx +++ b/win/C#/frmMain.resx @@ -117,12 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 54 - False + + 17, 54 + 556, 15 diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs index 840975bb6..0059ede32 100644 --- a/win/C#/frmPreview.cs +++ b/win/C#/frmPreview.cs @@ -62,7 +62,7 @@ namespace Handbrake lbl_status.Text = "Encoding Sample for (VLC) ..."; int duration; int.TryParse(cb_duration.Text, out duration); - String query = QueryGenerator.GenerateCLIQuery(MainWindow, 3, duration, cb_preview.Text); + String query = QueryGenerator.GenerateCliQuery(MainWindow, 3, duration, cb_preview.Text); ThreadPool.QueueUserWorkItem(ProcMonitor, query); } private void btn_playQT_Click(object sender, EventArgs e) @@ -97,7 +97,7 @@ namespace Handbrake lbl_status.Text = "Encoding Sample for (QT) ..."; int duration; int.TryParse(cb_duration.Text, out duration); - String query = QueryGenerator.GenerateCLIQuery(MainWindow, 3, duration, cb_preview.Text); + String query = QueryGenerator.GenerateCliQuery(MainWindow, 3, duration, cb_preview.Text); ThreadPool.QueueUserWorkItem(ProcMonitor, query); } -- cgit v1.2.3