From 3ef0219c4c3113616869f9ff2395b65b947aef7a Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 28 Aug 2009 15:04:25 +0000 Subject: WinGui: - Fix issue changing file format causing the audio encoder dropdown to be set to "" - Fixed an issue with autoName function and format dropdown with regards to AC3 in the audio list. Also, CC or SRT - Combined a bunch of functions in x264Panel into one. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2784 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/AudioPanel.cs | 34 +++++--- win/C#/Controls/Subtitles.cs | 14 +++ win/C#/Controls/x264Panel.Designer.cs | 40 ++++----- win/C#/Controls/x264Panel.cs | 158 +++++++++++++++------------------- 4 files changed, 128 insertions(+), 118 deletions(-) (limited to 'win/C#/Controls') diff --git a/win/C#/Controls/AudioPanel.cs b/win/C#/Controls/AudioPanel.cs index 67ee331d9..b394e3ca5 100644 --- a/win/C#/Controls/AudioPanel.cs +++ b/win/C#/Controls/AudioPanel.cs @@ -130,7 +130,7 @@ namespace Handbrake.Controls value = ((tb_drc.Value - 1) / 10.0) + 1; // Create a new row for the Audio list based on the currently selected items in the dropdown. - ListViewItem newTrack = new ListViewItem(getNewID().ToString()); + ListViewItem newTrack = new ListViewItem(GetNewID().ToString()); newTrack.SubItems.Add(drp_audioTrack.Text); newTrack.SubItems.Add(drp_audioEncoder.Text); newTrack.SubItems.Add(drp_audioMix.Text); @@ -149,7 +149,7 @@ namespace Handbrake.Controls } private void btn_RemoveAudioTrack_Click(object sender, EventArgs e) { - removeAudioTrack(); + RemoveAudioTrack(); } // Audio List Menu @@ -189,9 +189,9 @@ namespace Handbrake.Controls } private void audioList_remove_Click(object sender, EventArgs e) { - removeAudioTrack(); + RemoveAudioTrack(); } - private void removeAudioTrack() + private void RemoveAudioTrack() { // Remove the Item and reselect the control if the following conditions are met. if (lv_audioList.SelectedItems.Count != 0) @@ -221,7 +221,7 @@ namespace Handbrake.Controls } // Public Functions - public void setTrackList(Parsing.Title selectedTitle) + public void SetTrackList(Parsing.Title selectedTitle) { drp_audioTrack.Items.Clear(); drp_audioTrack.Items.Add("Automatic"); @@ -263,20 +263,22 @@ namespace Handbrake.Controls } drp_audioMix.SelectedIndex = 0; } - public ListView getAudioPanel() + public ListView GetAudioPanel() { return lv_audioList; } - public void setAudioByContainer(String path) + public void SetContainer(String path) { + string oldval = drp_audioEncoder.Text; if ((path.Contains("MP4")) || (path.Contains("M4V"))) { - string oldval = drp_audioEncoder.Text; drp_audioEncoder.Items.Clear(); drp_audioEncoder.Items.Add("AAC (faac)"); drp_audioEncoder.Items.Add("AC3 Passthru"); if ((oldval != "AAC (faac)") && (oldval != "AC3 Passthru")) drp_audioEncoder.SelectedIndex = 0; + else + drp_audioEncoder.SelectedItem = oldval; } else if (path.Contains("MKV")) @@ -287,6 +289,7 @@ namespace Handbrake.Controls drp_audioEncoder.Items.Add("AC3 Passthru"); drp_audioEncoder.Items.Add("DTS Passthru"); drp_audioEncoder.Items.Add("Vorbis (vorbis)"); + drp_audioEncoder.SelectedItem = oldval; if (drp_audioEncoder.Text == string.Empty) drp_audioEncoder.SelectedIndex = 0; @@ -299,22 +302,31 @@ namespace Handbrake.Controls row.SubItems[2].Text = drp_audioEncoder.Items[0].ToString(); } } - public void addTrackForPreset(ListViewItem item) + public void AddTrackForPreset(ListViewItem item) { lv_audioList.Items.Add(item); if (this.AudioListChanged != null) this.AudioListChanged(this, new EventArgs()); } - public void clearAudioList() + public void ClearAudioList() { lv_audioList.Items.Clear(); if (this.AudioListChanged != null) this.AudioListChanged(this, new EventArgs()); } - public int getNewID() + public int GetNewID() { return lv_audioList.Items.Count + 1; } + public Boolean RequiresM4V() + { + foreach (ListViewItem item in lv_audioList.Items) + { + if (item.SubItems[2].Text.Contains("AC3")) + return true; + } + return false; + } // Helper Functions private void reGenerateListIDs() diff --git a/win/C#/Controls/Subtitles.cs b/win/C#/Controls/Subtitles.cs index e4142bd44..e23718c0a 100644 --- a/win/C#/Controls/Subtitles.cs +++ b/win/C#/Controls/Subtitles.cs @@ -22,6 +22,8 @@ namespace Handbrake.Controls } private int FileContainer; + + // Public Functions public void setSubtitleTrackAuto() { // Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options @@ -57,6 +59,18 @@ namespace Handbrake.Controls } } } + public Boolean RequiresM4V() + { + foreach (ListViewItem item in lv_subList.Items) + { + if (!string.IsNullOrEmpty(item.SubItems[5].Text)) + return true; + + if (item.SubItems[1].Text.Contains("(Text)")) + return true; + } + return false; + } // Controls private void btn_addSubTrack_Click(object sender, EventArgs e) diff --git a/win/C#/Controls/x264Panel.Designer.cs b/win/C#/Controls/x264Panel.Designer.cs index 76a156c61..664586ef5 100644 --- a/win/C#/Controls/x264Panel.Designer.cs +++ b/win/C#/Controls/x264Panel.Designer.cs @@ -88,7 +88,7 @@ namespace Handbrake.Controls this.ToolTip.SetToolTip(this.slider_psytrellis, "Psychovisual Trellis tries to retain more sharpness and detail, but can cause art" + "ifacting. \r\nIt is considered experimental, which is why it\'s off by default. Goo" + "d values are 0.1 to 0.2."); - this.slider_psytrellis.Scroll += new System.EventHandler(this.slider_psytrellis_Scroll); + this.slider_psytrellis.Scroll += new System.EventHandler(this.widgetControlChanged); // // lbl_psytrellis // @@ -115,7 +115,7 @@ namespace Handbrake.Controls this.slider_psyrd.Size = new System.Drawing.Size(131, 45); this.slider_psyrd.TabIndex = 83; this.ToolTip.SetToolTip(this.slider_psyrd, resources.GetString("slider_psyrd.ToolTip")); - this.slider_psyrd.Scroll += new System.EventHandler(this.slider_psyrd_Scroll); + this.slider_psyrd.Scroll += new System.EventHandler(this.widgetControlChanged); // // lbl_adaptBFrames // @@ -140,7 +140,7 @@ namespace Handbrake.Controls this.drop_adaptBFrames.Size = new System.Drawing.Size(121, 21); this.drop_adaptBFrames.TabIndex = 82; this.ToolTip.SetToolTip(this.drop_adaptBFrames, resources.GetString("drop_adaptBFrames.ToolTip")); - this.drop_adaptBFrames.SelectedIndexChanged += new System.EventHandler(this.drop_adaptBFrames_SelectedIndexChanged); + this.drop_adaptBFrames.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // label43 // @@ -190,7 +190,7 @@ namespace Handbrake.Controls this.check_Cabac.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.ToolTip.SetToolTip(this.check_Cabac, resources.GetString("check_Cabac.ToolTip")); this.check_Cabac.UseVisualStyleBackColor = true; - this.check_Cabac.CheckedChanged += new System.EventHandler(this.check_Cabac_CheckedChanged); + this.check_Cabac.CheckedChanged += new System.EventHandler(this.widgetControlChanged); // // check_noDCTDecimate // @@ -205,7 +205,7 @@ namespace Handbrake.Controls this.check_noDCTDecimate.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.ToolTip.SetToolTip(this.check_noDCTDecimate, resources.GetString("check_noDCTDecimate.ToolTip")); this.check_noDCTDecimate.UseVisualStyleBackColor = true; - this.check_noDCTDecimate.CheckedChanged += new System.EventHandler(this.check_noDCTDecimate_CheckedChanged); + this.check_noDCTDecimate.CheckedChanged += new System.EventHandler(this.widgetControlChanged); // // check_noFastPSkip // @@ -221,7 +221,7 @@ namespace Handbrake.Controls this.ToolTip.SetToolTip(this.check_noFastPSkip, "This can help with blocking on solid colors like blue skies, but it also slows do" + "wn the encode."); this.check_noFastPSkip.UseVisualStyleBackColor = true; - this.check_noFastPSkip.CheckedChanged += new System.EventHandler(this.check_noFastPSkip_CheckedChanged); + this.check_noFastPSkip.CheckedChanged += new System.EventHandler(this.widgetControlChanged); // // lbl_trellis // @@ -246,7 +246,7 @@ namespace Handbrake.Controls this.drop_trellis.Size = new System.Drawing.Size(94, 21); this.drop_trellis.TabIndex = 75; this.ToolTip.SetToolTip(this.drop_trellis, resources.GetString("drop_trellis.ToolTip")); - this.drop_trellis.SelectedIndexChanged += new System.EventHandler(this.drop_trellis_SelectedIndexChanged); + this.drop_trellis.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // drop_deblockBeta // @@ -272,7 +272,7 @@ namespace Handbrake.Controls this.drop_deblockBeta.Size = new System.Drawing.Size(68, 21); this.drop_deblockBeta.TabIndex = 74; this.ToolTip.SetToolTip(this.drop_deblockBeta, resources.GetString("drop_deblockBeta.ToolTip")); - this.drop_deblockBeta.SelectedIndexChanged += new System.EventHandler(this.drop_deblockBeta_SelectedIndexChanged); + this.drop_deblockBeta.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // label41 // @@ -307,7 +307,7 @@ namespace Handbrake.Controls this.drop_deblockAlpha.Size = new System.Drawing.Size(68, 21); this.drop_deblockAlpha.TabIndex = 73; this.ToolTip.SetToolTip(this.drop_deblockAlpha, resources.GetString("drop_deblockAlpha.ToolTip")); - this.drop_deblockAlpha.SelectedIndexChanged += new System.EventHandler(this.drop_deblockAlpha_SelectedIndexChanged); + this.drop_deblockAlpha.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // panel3 // @@ -349,7 +349,7 @@ namespace Handbrake.Controls this.check_8x8DCT.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.ToolTip.SetToolTip(this.check_8x8DCT, resources.GetString("check_8x8DCT.ToolTip")); this.check_8x8DCT.UseVisualStyleBackColor = true; - this.check_8x8DCT.CheckedChanged += new System.EventHandler(this.check_8x8DCT_CheckedChanged); + this.check_8x8DCT.CheckedChanged += new System.EventHandler(this.widgetControlChanged); // // label45 // @@ -373,7 +373,7 @@ namespace Handbrake.Controls this.drop_analysis.Size = new System.Drawing.Size(63, 21); this.drop_analysis.TabIndex = 71; this.ToolTip.SetToolTip(this.drop_analysis, resources.GetString("drop_analysis.ToolTip")); - this.drop_analysis.SelectedIndexChanged += new System.EventHandler(this.drop_analysis_SelectedIndexChanged); + this.drop_analysis.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // label48 // @@ -405,7 +405,7 @@ namespace Handbrake.Controls this.drop_subpixelMotionEstimation.Size = new System.Drawing.Size(139, 21); this.drop_subpixelMotionEstimation.TabIndex = 70; this.ToolTip.SetToolTip(this.drop_subpixelMotionEstimation, resources.GetString("drop_subpixelMotionEstimation.ToolTip")); - this.drop_subpixelMotionEstimation.SelectedIndexChanged += new System.EventHandler(this.drop_subpixelMotionEstimation_SelectedIndexChanged); + this.drop_subpixelMotionEstimation.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // lbl_merange // @@ -488,7 +488,7 @@ namespace Handbrake.Controls this.drop_MotionEstimationRange.Size = new System.Drawing.Size(139, 21); this.drop_MotionEstimationRange.TabIndex = 69; this.ToolTip.SetToolTip(this.drop_MotionEstimationRange, resources.GetString("drop_MotionEstimationRange.ToolTip")); - this.drop_MotionEstimationRange.SelectedIndexChanged += new System.EventHandler(this.drop_MotionEstimationRange_SelectedIndexChanged); + this.drop_MotionEstimationRange.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // label54 // @@ -516,7 +516,7 @@ namespace Handbrake.Controls this.drop_MotionEstimationMethod.Size = new System.Drawing.Size(139, 21); this.drop_MotionEstimationMethod.TabIndex = 68; this.ToolTip.SetToolTip(this.drop_MotionEstimationMethod, resources.GetString("drop_MotionEstimationMethod.ToolTip")); - this.drop_MotionEstimationMethod.SelectedIndexChanged += new System.EventHandler(this.drop_MotionEstimationMethod_SelectedIndexChanged); + this.drop_MotionEstimationMethod.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // check_pyrmidalBFrames // @@ -530,7 +530,7 @@ namespace Handbrake.Controls this.check_pyrmidalBFrames.Text = "Pyramidal B-Frames:"; this.ToolTip.SetToolTip(this.check_pyrmidalBFrames, resources.GetString("check_pyrmidalBFrames.ToolTip")); this.check_pyrmidalBFrames.UseVisualStyleBackColor = true; - this.check_pyrmidalBFrames.CheckedChanged += new System.EventHandler(this.check_pyrmidalBFrames_CheckedChanged); + this.check_pyrmidalBFrames.CheckedChanged += new System.EventHandler(this.widgetControlChanged); // // check_weightedBFrames // @@ -544,7 +544,7 @@ namespace Handbrake.Controls this.check_weightedBFrames.Text = "Weighted B-Frames:"; this.ToolTip.SetToolTip(this.check_weightedBFrames, resources.GetString("check_weightedBFrames.ToolTip")); this.check_weightedBFrames.UseVisualStyleBackColor = true; - this.check_weightedBFrames.CheckedChanged += new System.EventHandler(this.check_weightedBFrames_CheckedChanged); + this.check_weightedBFrames.CheckedChanged += new System.EventHandler(this.widgetControlChanged); // // lbl_direct_prediction // @@ -570,7 +570,7 @@ namespace Handbrake.Controls this.drop_directPrediction.Size = new System.Drawing.Size(121, 21); this.drop_directPrediction.TabIndex = 57; this.ToolTip.SetToolTip(this.drop_directPrediction, resources.GetString("drop_directPrediction.ToolTip")); - this.drop_directPrediction.SelectedIndexChanged += new System.EventHandler(this.drop_directPrediction_SelectedIndexChanged); + this.drop_directPrediction.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // label62 // @@ -611,7 +611,7 @@ namespace Handbrake.Controls this.ToolTip.SetToolTip(this.drop_bFrames, "Sane values are 1-6. \r\nB-Frames are smaller than other frames, so they let you pa" + "ck in more quality at the same bitrate. \r\nUse more of them with animated materia" + "l."); - this.drop_bFrames.SelectedIndexChanged += new System.EventHandler(this.drop_bFrames_SelectedIndexChanged); + this.drop_bFrames.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // label64 // @@ -652,7 +652,7 @@ namespace Handbrake.Controls this.ToolTip.SetToolTip(this.drop_refFrames, "Sane values are 1-6. \r\nThe more you add, the higher the quality, but the slower t" + "he encode. Be careful... too many and QuickTime struggles to play the video back" + "."); - this.drop_refFrames.SelectedIndexChanged += new System.EventHandler(this.drop_refFrames_SelectedIndexChanged); + this.drop_refFrames.SelectedIndexChanged += new System.EventHandler(this.widgetControlChanged); // // check_mixedReferences // @@ -668,7 +668,7 @@ namespace Handbrake.Controls this.ToolTip.SetToolTip(this.check_mixedReferences, "With this on, different references can be used for different parts of each 16x16 " + "pixel macroblock, increasing quality."); this.check_mixedReferences.UseVisualStyleBackColor = true; - this.check_mixedReferences.CheckedChanged += new System.EventHandler(this.check_mixedReferences_CheckedChanged); + this.check_mixedReferences.CheckedChanged += new System.EventHandler(this.widgetControlChanged); // // ToolTip // diff --git a/win/C#/Controls/x264Panel.cs b/win/C#/Controls/x264Panel.cs index 67da54485..6df49e744 100644 --- a/win/C#/Controls/x264Panel.cs +++ b/win/C#/Controls/x264Panel.cs @@ -16,7 +16,7 @@ namespace Handbrake.Controls InitializeComponent(); if (Properties.Settings.Default.tooltipEnable) - setToolTipActive(true); + ToolTip.Active = true; reset2Defaults(); } @@ -26,91 +26,76 @@ namespace Handbrake.Controls get { return rtf_x264Query.Text; } set { rtf_x264Query.Text = value; } } - private void setToolTipActive(Boolean active) - { - ToolTip.Active = active; - } - #region Controls Changed - private void drop_refFrames_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("ref"); - } - private void check_mixedReferences_CheckedChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("mixed-refs"); - } - private void drop_bFrames_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("bframes"); - } - private void drop_directPrediction_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("direct"); - } - private void check_weightedBFrames_CheckedChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("weightb"); - } - private void check_pyrmidalBFrames_CheckedChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("b-pyramid"); - } - private void drop_MotionEstimationMethod_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("me"); - } - private void drop_MotionEstimationRange_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("merange"); - } - private void drop_subpixelMotionEstimation_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("subq"); - } - private void drop_analysis_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("analyse"); - } - private void check_8x8DCT_CheckedChanged(object sender, EventArgs e) + private void widgetControlChanged(object sender, EventArgs e) { - on_x264_WidgetChange("8x8dct"); - } - private void drop_deblockAlpha_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("deblock"); - } - private void drop_deblockBeta_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("deblock"); - } - private void drop_trellis_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("trellis"); - } - private void check_noFastPSkip_CheckedChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("no-fast-pskip"); - } - private void check_noDCTDecimate_CheckedChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("no-dct-decimate"); - } - private void check_Cabac_CheckedChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("cabac"); - } - private void slider_psyrd_Scroll(object sender, EventArgs e) - { - on_x264_WidgetChange("psy-rd"); - } - private void slider_psytrellis_Scroll(object sender, EventArgs e) - { - on_x264_WidgetChange("psy-rd"); - } - private void drop_adaptBFrames_SelectedIndexChanged(object sender, EventArgs e) - { - on_x264_WidgetChange("b-adapt"); + Control changedControlName = (Control) sender; + string controlName = ""; + + switch (changedControlName.Name.Trim()) + { + case "drop_refFrames": + controlName = "ref"; + break; + case "check_mixedReferences": + controlName = "mixed-refs"; + break; + case "drop_bFrames": + controlName = "bframes"; + break; + case "drop_directPrediction": + controlName = "direct"; + break; + case "check_weightedBFrames": + controlName = "weightb"; + break; + case "check_pyrmidalBFrames": + controlName = "b-pyramid"; + break; + case "drop_MotionEstimationMethod": + controlName = "me"; + break; + case "drop_MotionEstimationRange": + controlName = "merange"; + break; + case "drop_subpixelMotionEstimation": + controlName = "subq"; + break; + case "drop_analysis": + controlName = "analyse"; + break; + case "check_8x8DCT": + controlName = "8x8dct"; + break; + case "drop_deblockAlpha": + controlName = "deblock"; + break; + case "drop_deblockBeta": + controlName = "deblock"; + break; + case "drop_trellis": + controlName = "trellis"; + break; + case "check_noFastPSkip": + controlName = "no-fast-pskip"; + break; + case "check_noDCTDecimate": + controlName = "no-dct-decimate"; + break; + case "check_Cabac": + controlName = "cabac"; + break; + case "slider_psyrd": + controlName = "psy-rd"; + break; + case "slider_psytrellis": + controlName = "psy-rd"; + break; + case "drop_adaptBFrames": + controlName = "b-adapt"; + break; + } + on_x264_WidgetChange(controlName); } private void rtf_x264Query_TextChanged(object sender, EventArgs e) { @@ -131,8 +116,7 @@ namespace Handbrake.Controls rtf_x264Query.Text = ""; reset2Defaults(); } - #endregion - + /// /// Reset all components to defaults and clears the x264 rtf box /// @@ -1012,4 +996,4 @@ namespace Handbrake.Controls } } } -} +} \ No newline at end of file -- cgit v1.2.3