From 94005e4d2e48f26506c10e4eec3a393c1e1e8b0e Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 17 Nov 2011 22:05:34 +0000 Subject: WinGui: Fixes to the Burned/Default flags being set incorrectly on the subtitle tab when adding multiple items. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4356 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/Controls/Subtitles.cs | 54 ++++++++++---------------------------------- 1 file changed, 12 insertions(+), 42 deletions(-) diff --git a/win/CS/Controls/Subtitles.cs b/win/CS/Controls/Subtitles.cs index 654c99fdc..4a5bc5fd5 100644 --- a/win/CS/Controls/Subtitles.cs +++ b/win/CS/Controls/Subtitles.cs @@ -363,15 +363,17 @@ namespace Handbrake.Controls } // Logic - string forcedVal = check_forced.CheckState == CheckState.Checked ? "Yes" : "No"; - string defaultSub = check_default.CheckState == CheckState.Checked ? "Yes" : "No"; - string burnedVal = check_burned.CheckState == CheckState.Checked && - (drp_subtitleTracks.Text.Contains("(VOBSUB)") || drp_subtitleTracks.Text.Contains("(SSA)")) - ? "Yes" - : "No"; string srtCode = "-", srtLangVal = "-", srtPath = "-", srtFile = "-"; int srtOffsetMs = 0; + // Make sure we only have 1 burned track. We'll always give the latest track added burned in. + if (check_burned.Checked) + this.SetBurnedToOffForAllTracks(); + + // Make sure we only have 1 default track + if (check_default.Checked) + this.SetDefaultToOffForAllTracks(); + if (drp_subtitleTracks.SelectedItem.ToString().Contains(".srt")) { srtFiles.TryGetValue(drp_subtitleTracks.SelectedItem.ToString(), out srtPath); @@ -379,12 +381,6 @@ namespace Handbrake.Controls srtLangVal = srt_lang.SelectedItem.ToString(); srtCode = srt_charcode.SelectedItem.ToString(); srtOffsetMs = (int)srt_offset.Value; - if (defaultSub == "Yes") this.SetDefaultToOffForAllSRTTracks(); - } - else - { - if (defaultSub == "Yes") this.SetDefaultToOffForAllTracks(); - if (burnedVal == "Yes") this.SetBurnedToOffForAllTracks(); } string trackName = (drp_subtitleTracks.SelectedItem.ToString().Contains(".srt")) @@ -666,10 +662,7 @@ namespace Handbrake.Controls if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return; if (check_default.Checked) // Make sure we only have 1 default track - if (lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text.Contains(".srt")) - this.SetDefaultToOffForAllSRTTracks(); - else - this.SetDefaultToOffForAllTracks(); + this.SetDefaultToOffForAllTracks(); lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[3].Text = check_default.Checked ? "Yes" : "No"; lv_subList.Select(); @@ -823,33 +816,10 @@ namespace Handbrake.Controls int c = 0; foreach (ListViewItem item in lv_subList.Items) { - if (subList[c].SrtPath == "-") - { - if (item.SubItems[3].Text == "Yes") - { - item.SubItems[3].Text = "No"; - subList[c].Default = false; - } - } - c++; - } - } - - /// - /// Set all subtitle tracks so that they have no default. - /// - private void SetDefaultToOffForAllSRTTracks() - { - int c = 0; - foreach (ListViewItem item in lv_subList.Items) - { - if (!subList[c].IsSrtSubtitle) + if (item.SubItems[3].Text == "Yes") { - if (item.SubItems[3].Text == "Yes") - { - item.SubItems[3].Text = "No"; - subList[c].Default = false; - } + item.SubItems[3].Text = "No"; + subList[c].Default = false; } c++; } -- cgit v1.2.3