From 09c0bef2eed5ce0079e8f8b6409bc8fb78e3c0fa Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 28 Jun 2009 11:38:35 +0000 Subject: WinGui: - Attempt 2 at fixing culture issues. Thanks to zhango git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2638 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Functions/PresetLoader.cs | 7 +-- win/C#/Functions/QueryGenerator.cs | 6 +-- win/C#/frmMain.Designer.cs | 90 +++++++++++++++++++------------------- win/C#/frmMain.cs | 17 +++---- win/C#/frmOptions.cs | 4 +- 5 files changed, 57 insertions(+), 67 deletions(-) diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs index 6730b8e49..82d96e660 100644 --- a/win/C#/Functions/PresetLoader.cs +++ b/win/C#/Functions/PresetLoader.cs @@ -159,8 +159,6 @@ namespace Handbrake.Functions if (presetQuery.VideoEncoder == "H.264 (x264)") { int value; - System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); - double x264step = Properties.Settings.Default.x264cqstep; double presetValue = presetQuery.VideoQuality; @@ -178,10 +176,7 @@ namespace Handbrake.Functions double val = Math.Round(calculated, 0); int.TryParse(val.ToString(), out value); } - - int safevalue; - int.TryParse(value.ToString(culture), out safevalue); - mainWindow.slider_videoQuality.Value = safevalue; + mainWindow.slider_videoQuality.Value = value; } else { diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs index da44e6076..85e76f57b 100644 --- a/win/C#/Functions/QueryGenerator.cs +++ b/win/C#/Functions/QueryGenerator.cs @@ -222,12 +222,10 @@ namespace Handbrake.Functions query += " -q " + value.ToString(new CultureInfo("en-US")); break; case "H.264 (x264)": - double divided; CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); - double.TryParse(Properties.Settings.Default.x264cqstep.ToString(culture), out divided); - value = 51 - mainWindow.slider_videoQuality.Value * divided; + value = 51 - mainWindow.slider_videoQuality.Value * Properties.Settings.Default.x264cqstep; value = Math.Round(value, 2); - query += " -q " + value.ToString(new CultureInfo("en-US")); + query += " -q " + value.ToString(culture); break; case "VP3 (Theora)": value = mainWindow.slider_videoQuality.Value; diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 83751198e..6d7edb293 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -103,6 +103,7 @@ namespace Handbrake this.Label47 = new System.Windows.Forms.Label(); this.Label3 = new System.Windows.Forms.Label(); this.tab_audio = new System.Windows.Forms.TabPage(); + this.AudioSettings = new Handbrake.Controls.AudioPanel(); this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components); this.tab_video = new System.Windows.Forms.TabPage(); this.radio_cq = new System.Windows.Forms.RadioButton(); @@ -114,13 +115,17 @@ namespace Handbrake this.SliderValue = new System.Windows.Forms.Label(); this.Label46 = new System.Windows.Forms.Label(); this.tab_picture = new System.Windows.Forms.TabPage(); + this.PictureSettings = new Handbrake.Controls.PictureSettings(); this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox(); this.tabs_panel = new System.Windows.Forms.TabControl(); this.tab_filters = new System.Windows.Forms.TabPage(); + this.Filters = new Handbrake.Controls.Filters(); this.tab_subtitles = new System.Windows.Forms.TabPage(); + this.Subtitles = new Handbrake.Controls.Subtitles(); this.tab_chapters = new System.Windows.Forms.TabPage(); this.label31 = new System.Windows.Forms.Label(); this.tab_advanced = new System.Windows.Forms.TabPage(); + this.x264Panel = new Handbrake.Controls.x264Panel(); this.tab_query = new System.Windows.Forms.TabPage(); this.btn_clear = new System.Windows.Forms.Button(); this.label34 = new System.Windows.Forms.Label(); @@ -158,11 +163,6 @@ namespace Handbrake this.lbl_source = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.groupBox_output = new System.Windows.Forms.Label(); - this.PictureSettings = new Handbrake.Controls.PictureSettings(); - this.Filters = new Handbrake.Controls.Filters(); - this.AudioSettings = new Handbrake.Controls.AudioPanel(); - this.Subtitles = new Handbrake.Controls.Subtitles(); - this.x264Panel = new Handbrake.Controls.x264Panel(); notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components); notifyIconMenu.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit(); @@ -824,6 +824,14 @@ namespace Handbrake this.tab_audio.Text = "Audio"; this.tab_audio.UseVisualStyleBackColor = true; // + // AudioSettings + // + this.AudioSettings.BackColor = System.Drawing.Color.Transparent; + this.AudioSettings.Location = new System.Drawing.Point(0, 0); + this.AudioSettings.Name = "AudioSettings"; + this.AudioSettings.Size = new System.Drawing.Size(715, 310); + this.AudioSettings.TabIndex = 0; + // // AudioMenuRowHeightHack // this.AudioMenuRowHeightHack.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; @@ -960,6 +968,14 @@ namespace Handbrake this.tab_picture.Text = "Picture Settings"; this.tab_picture.UseVisualStyleBackColor = true; // + // PictureSettings + // + this.PictureSettings.BackColor = System.Drawing.Color.Transparent; + this.PictureSettings.Location = new System.Drawing.Point(0, 0); + this.PictureSettings.Name = "PictureSettings"; + this.PictureSettings.Size = new System.Drawing.Size(713, 310); + this.PictureSettings.TabIndex = 0; + // // Check_ChapterMarkers // this.Check_ChapterMarkers.AutoSize = true; @@ -1001,6 +1017,14 @@ namespace Handbrake this.tab_filters.Text = "Video Filters"; this.tab_filters.UseVisualStyleBackColor = true; // + // Filters + // + this.Filters.BackColor = System.Drawing.Color.Transparent; + this.Filters.Location = new System.Drawing.Point(0, 0); + this.Filters.Name = "Filters"; + this.Filters.Size = new System.Drawing.Size(713, 310); + this.Filters.TabIndex = 0; + // // tab_subtitles // this.tab_subtitles.Controls.Add(this.Subtitles); @@ -1012,6 +1036,14 @@ namespace Handbrake this.tab_subtitles.Text = "Subtitles"; this.tab_subtitles.UseVisualStyleBackColor = true; // + // Subtitles + // + this.Subtitles.BackColor = System.Drawing.Color.Transparent; + this.Subtitles.Location = new System.Drawing.Point(0, 0); + this.Subtitles.Name = "Subtitles"; + this.Subtitles.Size = new System.Drawing.Size(722, 310); + this.Subtitles.TabIndex = 0; + // // tab_chapters // this.tab_chapters.BackColor = System.Drawing.Color.Transparent; @@ -1049,6 +1081,14 @@ namespace Handbrake this.tab_advanced.Text = "Advanced"; this.tab_advanced.UseVisualStyleBackColor = true; // + // x264Panel + // + this.x264Panel.Location = new System.Drawing.Point(0, 0); + this.x264Panel.Name = "x264Panel"; + this.x264Panel.Size = new System.Drawing.Size(720, 306); + this.x264Panel.TabIndex = 0; + this.x264Panel.x264Query = ""; + // // tab_query // this.tab_query.Controls.Add(this.btn_clear); @@ -1434,46 +1474,6 @@ namespace Handbrake this.groupBox_output.TabIndex = 47; this.groupBox_output.Text = "Output Settings: (Preset: None)"; // - // PictureSettings - // - this.PictureSettings.BackColor = System.Drawing.Color.Transparent; - this.PictureSettings.Location = new System.Drawing.Point(0, 0); - this.PictureSettings.Name = "PictureSettings"; - this.PictureSettings.Size = new System.Drawing.Size(713, 310); - this.PictureSettings.TabIndex = 0; - // - // Filters - // - this.Filters.BackColor = System.Drawing.Color.Transparent; - this.Filters.Location = new System.Drawing.Point(0, 0); - this.Filters.Name = "Filters"; - this.Filters.Size = new System.Drawing.Size(713, 310); - this.Filters.TabIndex = 0; - // - // AudioSettings - // - this.AudioSettings.BackColor = System.Drawing.Color.Transparent; - this.AudioSettings.Location = new System.Drawing.Point(0, 0); - this.AudioSettings.Name = "AudioSettings"; - this.AudioSettings.Size = new System.Drawing.Size(715, 310); - this.AudioSettings.TabIndex = 0; - // - // Subtitles - // - this.Subtitles.BackColor = System.Drawing.Color.Transparent; - this.Subtitles.Location = new System.Drawing.Point(0, 0); - this.Subtitles.Name = "Subtitles"; - this.Subtitles.Size = new System.Drawing.Size(722, 310); - this.Subtitles.TabIndex = 0; - // - // x264Panel - // - this.x264Panel.Location = new System.Drawing.Point(0, 0); - this.x264Panel.Name = "x264Panel"; - this.x264Panel.Size = new System.Drawing.Size(720, 306); - this.x264Panel.TabIndex = 0; - this.x264Panel.x264Query = ""; - // // frmMain // this.AllowDrop = true; diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 0aec0fac2..a8418e002 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -1049,14 +1049,11 @@ namespace Handbrake slider_videoQuality.Minimum = 0; slider_videoQuality.TickFrequency = 1; - double divider; CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); - double.TryParse(Properties.Settings.Default.x264cqstep.ToString(culture), out divider); - - double multiplier = 1.0 / divider; + double multiplier = 1.0 / Properties.Settings.Default.x264cqstep; double value = slider_videoQuality.Value*multiplier; - - switch (Properties.Settings.Default.x264cqstep.ToString()) + + switch (Properties.Settings.Default.x264cqstep.ToString(culture)) { case "0.20": slider_videoQuality.Maximum = 255; @@ -1119,11 +1116,8 @@ namespace Handbrake SliderValue.Text = Math.Round((val * 100), 2) + "% QP:" + (32 - slider_videoQuality.Value); break; case "H.264 (x264)": - double divided; - CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); - double.TryParse(Properties.Settings.Default.x264cqstep.ToString(culture), out divided); - rfValue = 51.0 - slider_videoQuality.Value * divided; - max = slider_videoQuality.Maximum * divided; + rfValue = 51.0 - slider_videoQuality.Value * Properties.Settings.Default.x264cqstep; + max = slider_videoQuality.Maximum * Properties.Settings.Default.x264cqstep; min = slider_videoQuality.Minimum; val = ((max - min) - (rfValue - min)) / (max - min); rfValue = Math.Round(rfValue, 2); @@ -1574,6 +1568,7 @@ namespace Handbrake } #endregion + // This is the END of the road **************************************** } } \ No newline at end of file diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index 3c0a81f89..9aeeb000b 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -5,6 +5,7 @@ It may be used under the terms of the GNU General Public License. */ using System; +using System.Globalization; using System.Windows.Forms; using Handbrake.Functions; @@ -119,7 +120,8 @@ namespace Handbrake numeric_updateCheckDays.Value = Properties.Settings.Default.daysBetweenUpdateCheck; // x264 step - drop_x264step.SelectedItem = Properties.Settings.Default.x264cqstep.ToString(); + CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); + drop_x264step.SelectedItem = Properties.Settings.Default.x264cqstep.ToString(culture); // Use Experimental dvdnav if (Properties.Settings.Default.dvdnav) -- cgit v1.2.3