From: sr55 Date: Sun, 9 Dec 2007 22:16:16 +0000 (+0000) Subject: WinGui: X-Git-Tag: 0.9.2~190 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9fd6a363cd209ea453b650283ef5dc915ab4eba;p=handbrake WinGui: - Removed extra folder.png file from the Resources - Added support for Dynamic Range compression on a scale of 1 to 4. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1113 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index 110294803..c39a6a4e6 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -12,6 +12,7 @@ namespace Handbrake.Functions // All the Main Window GUI options #region Varibles + #region Source private string q_source; /// /// Returns a String @@ -24,69 +25,71 @@ namespace Handbrake.Functions return this.q_source; } } - - private string q_destination; + private int q_dvdTitle; /// - /// Returns a String - /// Full path of the destination. + /// Returns an Integer + /// DVD Title number. /// - public string Destination + public int DVDTitle { get { - return this.q_destination; + return this.q_dvdTitle; } } - private string q_format; + private int q_chaptersStart; /// - /// Returns a String - /// Full path of the destination. + /// Returns an Int + /// DVD Chapter number or chapter range. /// - public string Format + public int DVDChapterStart { get { - return this.q_format; + return this.q_chaptersStart; } } - private int q_dvdTitle; + private int q_chaptersFinish; /// - /// Returns an Integer - /// DVD Title number. + /// Returns an Int + /// DVD Chapter number or chapter range. /// - public int DVDTitle + public int DVDChapterFinish { get { - return this.q_dvdTitle; + return this.q_chaptersFinish; } } +#endregion - private int q_chaptersStart; + #region Destination + + private string q_destination; /// - /// Returns an Int - /// DVD Chapter number or chapter range. + /// Returns a String + /// Full path of the destination. /// - public int DVDChapterStart + public string Destination { get { - return this.q_chaptersStart; + return this.q_destination; } } - private int q_chaptersFinish; + private string q_format; /// - /// Returns an Int - /// DVD Chapter number or chapter range. + /// Returns a String + /// Full path of the destination. /// - public int DVDChapterFinish + public string Format { get { - return this.q_chaptersFinish; + return this.q_format; } } @@ -115,7 +118,9 @@ namespace Handbrake.Functions return this.q_audioEncoder; } } +#endregion + #region Picture Settings private int q_videoWidth; /// /// Returns an Int @@ -302,7 +307,9 @@ namespace Handbrake.Functions return this.q_chapterMarkers; } } + #endregion + #region Video Settings private Boolean q_grayscale; /// /// Returns a boolean to indicate wither Grayscale is on or off. @@ -434,7 +441,9 @@ namespace Handbrake.Functions return this.q_crf; } } + #endregion + #region Audio Settings private string q_audioBitrate; /// /// Returns a string with the audio bitrate @@ -495,6 +504,19 @@ namespace Handbrake.Functions } } + private double q_drc; + /// + /// Returns a string with the selected subtitle track + /// + public double DRC + { + get + { + return this.q_drc; + } + } + + private string q_subtitles; /// /// Returns a string with the selected subtitle track @@ -519,6 +541,9 @@ namespace Handbrake.Functions } } + #endregion + + #region Other private string q_h264; /// /// Returns a string with the Advanced H264 query string @@ -543,6 +568,8 @@ namespace Handbrake.Functions } #endregion + #endregion + // Takes in a query which can be in any order and parses it. All varibles are then set so they can be used elsewhere. public static QueryParser Parse(String input) { @@ -597,6 +624,7 @@ namespace Handbrake.Functions Match audioTrack1 = Regex.Match(input, @"-a ([0-9]*)"); Match audioTrack2 = Regex.Match(input, @"-a ([0-9]*),([0-9]*)"); Match forcedSubtitles = Regex.Match(input, @"-F"); + Match drc = Regex.Match(input, @"-D ([0-9.]*)"); //H264 Tab Match x264 = Regex.Match(input, @"-x ([,a-zA-Z0-9=:-]*)"); @@ -857,6 +885,16 @@ namespace Handbrake.Functions thisQuery.q_subtitles = "None"; } + if (drc.Success != false) + { + string value = drc.ToString().Replace("-D ", ""); + thisQuery.q_drc = double.Parse(value); + } + else + { + thisQuery.q_drc = 0; + } + thisQuery.q_forcedSubs = forcedSubtitles.Success; #endregion diff --git a/win/C#/Properties/Resources.Designer.cs b/win/C#/Properties/Resources.Designer.cs index 40e640bfb..94b7cc47e 100644 --- a/win/C#/Properties/Resources.Designer.cs +++ b/win/C#/Properties/Resources.Designer.cs @@ -88,13 +88,6 @@ namespace Handbrake.Properties { } } - internal static System.Drawing.Bitmap folder { - get { - object obj = ResourceManager.GetObject("folder", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - internal static System.Drawing.Bitmap General_Preferences { get { object obj = ResourceManager.GetObject("General_Preferences", resourceCulture); diff --git a/win/C#/Properties/Resources.resx b/win/C#/Properties/Resources.resx index f75659973..37de7b238 100644 --- a/win/C#/Properties/Resources.resx +++ b/win/C#/Properties/Resources.resx @@ -118,9 +118,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\folder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\General Preferences.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 5e7d93ad0..1aec8c470 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -188,6 +188,9 @@ namespace Handbrake this.groupBox_dest = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.treeView_presets = new System.Windows.Forms.TreeView(); + this.slider_drc = new System.Windows.Forms.TrackBar(); + this.check_drc = new System.Windows.Forms.CheckBox(); + this.lbl_drc = new System.Windows.Forms.Label(); Label38 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit(); this.frmMainMenu.SuspendLayout(); @@ -205,6 +208,7 @@ namespace Handbrake this.advancedOptions.SuspendLayout(); this.groupBox_dest.SuspendLayout(); this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.slider_drc)).BeginInit(); this.SuspendLayout(); // // Label38 @@ -424,7 +428,7 @@ namespace Handbrake "112", "128", "160"}); - this.drp_audioBitrate.Location = new System.Drawing.Point(113, 131); + this.drp_audioBitrate.Location = new System.Drawing.Point(113, 120); this.drp_audioBitrate.Name = "drp_audioBitrate"; this.drp_audioBitrate.Size = new System.Drawing.Size(101, 21); this.drp_audioBitrate.TabIndex = 5; @@ -442,7 +446,7 @@ namespace Handbrake "32", "24", "22.05"}); - this.drp_audioSampleRate.Location = new System.Drawing.Point(366, 131); + this.drp_audioSampleRate.Location = new System.Drawing.Point(366, 120); this.drp_audioSampleRate.Name = "drp_audioSampleRate"; this.drp_audioSampleRate.Size = new System.Drawing.Size(101, 21); this.drp_audioSampleRate.TabIndex = 6; @@ -540,7 +544,7 @@ namespace Handbrake this.drp_subtitle.Items.AddRange(new object[] { "None", "Autoselect"}); - this.drp_subtitle.Location = new System.Drawing.Point(113, 200); + this.drp_subtitle.Location = new System.Drawing.Point(111, 231); this.drp_subtitle.Name = "drp_subtitle"; this.drp_subtitle.Size = new System.Drawing.Size(213, 21); this.drp_subtitle.TabIndex = 12; @@ -1266,6 +1270,9 @@ namespace Handbrake // TabPage2 // this.TabPage2.BackColor = System.Drawing.SystemColors.ControlLight; + this.TabPage2.Controls.Add(this.lbl_drc); + this.TabPage2.Controls.Add(this.check_drc); + this.TabPage2.Controls.Add(this.slider_drc); this.TabPage2.Controls.Add(this.check_forced); this.TabPage2.Controls.Add(this.drp_track2Audio); this.TabPage2.Controls.Add(this.label28); @@ -1293,7 +1300,7 @@ namespace Handbrake // this.check_forced.AutoSize = true; this.check_forced.Enabled = false; - this.check_forced.Location = new System.Drawing.Point(332, 202); + this.check_forced.Location = new System.Drawing.Point(330, 233); this.check_forced.Name = "check_forced"; this.check_forced.Size = new System.Drawing.Size(147, 17); this.check_forced.TabIndex = 17; @@ -1340,7 +1347,7 @@ namespace Handbrake this.Label19.AutoSize = true; this.Label19.BackColor = System.Drawing.Color.Transparent; this.Label19.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label19.Location = new System.Drawing.Point(13, 170); + this.Label19.Location = new System.Drawing.Point(11, 210); this.Label19.Name = "Label19"; this.Label19.Size = new System.Drawing.Size(64, 13); this.Label19.TabIndex = 10; @@ -1351,7 +1358,7 @@ namespace Handbrake this.Label20.AutoSize = true; this.Label20.BackColor = System.Drawing.Color.Transparent; this.Label20.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label20.Location = new System.Drawing.Point(13, 203); + this.Label20.Location = new System.Drawing.Point(11, 234); this.Label20.Name = "Label20"; this.Label20.Size = new System.Drawing.Size(61, 13); this.Label20.TabIndex = 11; @@ -1387,7 +1394,7 @@ namespace Handbrake this.Label5.AutoSize = true; this.Label5.BackColor = System.Drawing.Color.Transparent; this.Label5.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label5.Location = new System.Drawing.Point(13, 105); + this.Label5.Location = new System.Drawing.Point(13, 94); this.Label5.Name = "Label5"; this.Label5.Size = new System.Drawing.Size(94, 13); this.Label5.TabIndex = 0; @@ -1398,7 +1405,7 @@ namespace Handbrake this.Label16.AutoSize = true; this.Label16.BackColor = System.Drawing.Color.Transparent; this.Label16.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label16.Location = new System.Drawing.Point(13, 134); + this.Label16.Location = new System.Drawing.Point(13, 123); this.Label16.Name = "Label16"; this.Label16.Size = new System.Drawing.Size(91, 13); this.Label16.TabIndex = 1; @@ -1420,7 +1427,7 @@ namespace Handbrake this.Label18.AutoSize = true; this.Label18.BackColor = System.Drawing.Color.Transparent; this.Label18.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label18.Location = new System.Drawing.Point(240, 134); + this.Label18.Location = new System.Drawing.Point(240, 123); this.Label18.Name = "Label18"; this.Label18.Size = new System.Drawing.Size(120, 13); this.Label18.TabIndex = 2; @@ -2094,6 +2101,42 @@ namespace Handbrake this.treeView_presets.TabIndex = 2; this.treeView_presets.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_presets_AfterSelect); // + // slider_drc + // + this.slider_drc.Enabled = false; + this.slider_drc.LargeChange = 1; + this.slider_drc.Location = new System.Drawing.Point(259, 159); + this.slider_drc.Maximum = 30; + this.slider_drc.Name = "slider_drc"; + this.slider_drc.Size = new System.Drawing.Size(167, 42); + this.slider_drc.TabIndex = 18; + this.slider_drc.TickFrequency = 2; + this.ToolTip.SetToolTip(this.slider_drc, "Dynamic Range Compression"); + this.slider_drc.Scroll += new System.EventHandler(this.slider_drc_Scroll); + // + // check_drc + // + this.check_drc.AutoSize = true; + this.check_drc.Location = new System.Drawing.Point(16, 163); + this.check_drc.Name = "check_drc"; + this.check_drc.Size = new System.Drawing.Size(237, 17); + this.check_drc.TabIndex = 19; + this.check_drc.Text = "Enable Dynamic Range Compression"; + this.check_drc.UseVisualStyleBackColor = true; + this.check_drc.CheckedChanged += new System.EventHandler(this.check_drc_CheckedChanged); + // + // lbl_drc + // + this.lbl_drc.AutoSize = true; + this.lbl_drc.BackColor = System.Drawing.Color.Transparent; + this.lbl_drc.Enabled = false; + this.lbl_drc.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_drc.Location = new System.Drawing.Point(432, 164); + this.lbl_drc.Name = "lbl_drc"; + this.lbl_drc.Size = new System.Drawing.Size(56, 13); + this.lbl_drc.TabIndex = 20; + this.lbl_drc.Text = "Disabled"; + // // frmMain // this.AllowDrop = true; @@ -2144,6 +2187,7 @@ namespace Handbrake this.groupBox_dest.ResumeLayout(false); this.groupBox_dest.PerformLayout(); this.groupBox2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.slider_drc)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -2308,6 +2352,9 @@ namespace Handbrake private System.Windows.Forms.CheckBox check_forced; internal System.Windows.Forms.ComboBox drp_track2Audio; internal System.Windows.Forms.Label label28; + internal System.Windows.Forms.TrackBar slider_drc; + private System.Windows.Forms.CheckBox check_drc; + internal System.Windows.Forms.Label lbl_drc; } } \ No newline at end of file diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 23bffdba4..786b7ac3c 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -934,6 +934,31 @@ namespace Handbrake } } + private void slider_drc_Scroll(object sender, EventArgs e) + { + double value = slider_drc.Value / 10.0; + value++; + + lbl_drc.Text = value.ToString(); + } + + private void check_drc_CheckedChanged(object sender, EventArgs e) + { + if (check_drc.CheckState == CheckState.Checked) + { + slider_drc.Enabled = true; + lbl_drc.Enabled = true; + lbl_drc.Text = "1"; + } + else + { + slider_drc.Enabled = false; + slider_drc.Value = 0; + lbl_drc.Enabled = false; + lbl_drc.Text = "Disabled"; + } + } + private void drp_subtitle_SelectedIndexChanged(object sender, EventArgs e) { if (drp_subtitle.Text.Contains("None")) @@ -1073,8 +1098,6 @@ namespace Handbrake // Preset Selection private void treeView_presets_AfterSelect(object sender, TreeViewEventArgs e) { - - string selectedPreset = null; selectedPreset = treeView_presets.SelectedNode.Text; @@ -1090,6 +1113,7 @@ namespace Handbrake string preset = presetInput.ReadLine().Replace("+ ", ""); Regex r = new Regex("(: )"); // Split on hyphens. string[] presetName = r.Split(preset); + if (selectedPreset == presetName[0]) { @@ -1576,6 +1600,7 @@ namespace Handbrake string subtitles = drp_subtitle.Text; string subScan = ""; string forced = ""; + string drc = ""; if (audioBitrate != "") audioBitrate = " -B " + audioBitrate; @@ -1666,9 +1691,17 @@ namespace Handbrake } if (check_forced.Checked) - forced = "-F"; + forced = " -F "; - string queryAudioSettings = audioBitrate + audioSampleRate + audioChannels + SixChannelAudio + subScan + subtitles + forced; + if (check_drc.Checked) + { + double value = slider_drc.Value / 10.0; + value++; + + drc = " -D " + value; + } + + string queryAudioSettings = audioBitrate + audioSampleRate + drc + audioChannels + SixChannelAudio + subScan + subtitles + forced; #endregion // H264 Tab @@ -1875,6 +1908,18 @@ namespace Handbrake } else check_forced.CheckState = CheckState.Unchecked; + + if (presetQuery.DRC != 0) + { + check_drc.Checked = true; + double value = presetQuery.DRC * 10; + slider_drc.Value = int.Parse(value.ToString()); + lbl_drc.Text = presetQuery.DRC.ToString(); + + } + else + check_drc.Checked = false; + #endregion // H264 Tab & Preset Name @@ -1980,11 +2025,6 @@ namespace Handbrake #endregion - - - - - // This is the END of the road ------------------------------------------------------------------------------ } } \ No newline at end of file