summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-09-18 17:07:40 +0000
committersr55 <[email protected]>2010-09-18 17:07:40 +0000
commit8cac9d8c62ce452ff27a6b70f005056f44b55581 (patch)
treeab712bd4009e8b2026c662981b7b7499e6dd36fa /win
parent7feb31c259d144751ad6003b0544715349c359b0 (diff)
WinGui:
- Some fixes to the AudioPanel. Changing presets now obeys the preferred language when selecting tracks. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3542 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/C#/Controls/AudioPanel.Designer.cs90
-rw-r--r--win/C#/Controls/AudioPanel.cs86
2 files changed, 102 insertions, 74 deletions
diff --git a/win/C#/Controls/AudioPanel.Designer.cs b/win/C#/Controls/AudioPanel.Designer.cs
index 5c6462883..0931d2a3f 100644
--- a/win/C#/Controls/AudioPanel.Designer.cs
+++ b/win/C#/Controls/AudioPanel.Designer.cs
@@ -59,13 +59,13 @@ namespace Handbrake.Controls
this.AudioTrackGroup = new System.Windows.Forms.GroupBox();
this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);
this.audioList = new System.Windows.Forms.DataGridView();
- this.Track = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Source = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.AudioCodec = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Mixdown = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Samplerate = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Bitrate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DRC = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Bitrate = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Samplerate = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Mixdown = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.AudioCodec = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Source = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Track = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.audioMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tb_drc)).BeginInit();
this.AudioTrackGroup.SuspendLayout();
@@ -371,29 +371,32 @@ namespace Handbrake.Controls
this.audioList.TabIndex = 67;
this.audioList.SelectionChanged += new System.EventHandler(this.audioList_SelectionChanged);
//
- // Track
+ // DRC
//
- this.Track.FillWeight = 304.2808F;
- this.Track.HeaderText = "Track";
- this.Track.Name = "Track";
- this.Track.ReadOnly = true;
- this.Track.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.Track.Width = 50;
+ this.DRC.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.DRC.FillWeight = 96.36334F;
+ this.DRC.HeaderText = "DRC";
+ this.DRC.Name = "DRC";
+ this.DRC.ReadOnly = true;
+ this.DRC.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
- // Source
+ // Bitrate
//
- this.Source.FillWeight = 49.69727F;
- this.Source.HeaderText = "Source";
- this.Source.Name = "Source";
- this.Source.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.Source.Width = 150;
+ this.Bitrate.FillWeight = 49.69727F;
+ this.Bitrate.HeaderText = "Bitrate";
+ this.Bitrate.Name = "Bitrate";
+ this.Bitrate.ReadOnly = true;
+ this.Bitrate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ this.Bitrate.Width = 75;
//
- // AudioCodec
+ // Samplerate
//
- this.AudioCodec.HeaderText = "Audio Codec";
- this.AudioCodec.Name = "AudioCodec";
- this.AudioCodec.ReadOnly = true;
- this.AudioCodec.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ this.Samplerate.FillWeight = 49.69727F;
+ this.Samplerate.HeaderText = "Samplerate";
+ this.Samplerate.Name = "Samplerate";
+ this.Samplerate.ReadOnly = true;
+ this.Samplerate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ this.Samplerate.Width = 75;
//
// Mixdown
//
@@ -404,32 +407,29 @@ namespace Handbrake.Controls
this.Mixdown.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Mixdown.Width = 150;
//
- // Samplerate
+ // AudioCodec
//
- this.Samplerate.FillWeight = 49.69727F;
- this.Samplerate.HeaderText = "Samplerate";
- this.Samplerate.Name = "Samplerate";
- this.Samplerate.ReadOnly = true;
- this.Samplerate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.Samplerate.Width = 75;
+ this.AudioCodec.HeaderText = "Audio Codec";
+ this.AudioCodec.Name = "AudioCodec";
+ this.AudioCodec.ReadOnly = true;
+ this.AudioCodec.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
- // Bitrate
+ // Source
//
- this.Bitrate.FillWeight = 49.69727F;
- this.Bitrate.HeaderText = "Bitrate";
- this.Bitrate.Name = "Bitrate";
- this.Bitrate.ReadOnly = true;
- this.Bitrate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.Bitrate.Width = 75;
+ this.Source.FillWeight = 49.69727F;
+ this.Source.HeaderText = "Source";
+ this.Source.Name = "Source";
+ this.Source.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ this.Source.Width = 150;
//
- // DRC
+ // Track
//
- this.DRC.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.DRC.FillWeight = 96.36334F;
- this.DRC.HeaderText = "DRC";
- this.DRC.Name = "DRC";
- this.DRC.ReadOnly = true;
- this.DRC.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ this.Track.FillWeight = 304.2808F;
+ this.Track.HeaderText = "Track";
+ this.Track.Name = "Track";
+ this.Track.ReadOnly = true;
+ this.Track.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ this.Track.Width = 50;
//
// AudioPanel
//
diff --git a/win/C#/Controls/AudioPanel.cs b/win/C#/Controls/AudioPanel.cs
index 9fa9cfde3..3555dcd28 100644
--- a/win/C#/Controls/AudioPanel.cs
+++ b/win/C#/Controls/AudioPanel.cs
@@ -117,10 +117,12 @@ namespace Handbrake.Controls
newTrack.Cells[2].Value = track.Encoder;
newTrack.Cells[3].Value = track.MixDown;
newTrack.Cells[4].Value = track.SampleRate;
- newTrack.Cells[5].Value = track.Encoder.Contains("AC3") ? "Auto" : track.Bitrate;
+ newTrack.Cells[5].Value = track.Encoder.Contains("AC3") || track.Encoder.Contains("DTS") ? "Auto" : track.Bitrate;
newTrack.Cells[6].Value = track.DRC;
AddTrackForPreset(newTrack);
}
+
+ this.AutomaticTrackSelection();
}
/// <summary>
@@ -128,7 +130,7 @@ namespace Handbrake.Controls
/// </summary>
/// <param name="selectedTitle">The selected title</param>
/// <param name="preset">A preset</param>
- public void SetTrackList(Title selectedTitle, Preset preset)
+ public void SetTrackListFromPreset(Title selectedTitle, Preset preset)
{
if (selectedTitle.AudioTracks.Count == 0)
{
@@ -139,18 +141,17 @@ namespace Handbrake.Controls
return;
}
- // The Source Information for the title will have changed, so set all the tracks to Automatic.
+ // Setup the Audio track source dropdown with the new audio tracks.
+ drp_audioTrack.Items.Clear();
+ drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray());
+
+ // Reset the Audio Track Selection to the first audio track of the source, or Audiomatic if that fails
foreach (DataGridViewRow row in this.audioList.Rows)
{
row.Cells[1].Value = "Automatic";
}
- // Setup the Audio track source dropdown with the new audio tracks.
- drp_audioTrack.Items.Clear();
- drp_audioTrack.Items.Add("Automatic");
- drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray());
-
- // Re-add any audio tracks that the preset has.
+ // Add any tracks the preset has, if there is a preset and no audio tracks in the list currently
if (audioList.Rows.Count == 0 && preset != null)
{
QueryParser parsed = QueryParser.Parse(preset.Query);
@@ -169,39 +170,66 @@ namespace Handbrake.Controls
}
}
+ this.AutomaticTrackSelection();
+ }
+
+ private void AutomaticTrackSelection()
+ {
// Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options
if (Properties.Settings.Default.NativeLanguage == "Any")
- drp_audioTrack.SelectedIndex = drp_audioTrack.Items.Count >= 2 ? 1 : 0;
- else
{
- if (Properties.Settings.Default.DubMode > 1) // "Dub Foreign language audio"
+ drp_audioTrack.SelectedIndex = 0;
+ foreach (DataGridViewRow item in audioList.Rows)
{
- int i = 0;
- foreach (object item in drp_audioTrack.Items)
+ if (this.drp_audioTrack.SelectedItem != null)
{
- if (item.ToString().Contains(Properties.Settings.Default.NativeLanguage))
+ item.Cells[1].Value = this.drp_audioTrack.SelectedItem.ToString();
+ }
+ }
+ }
+ else
+ {
+ int mode = Properties.Settings.Default.DubMode;
+ switch (mode)
+ {
+ case 1:
+ case 3:
+ // Dub Foreign Language Audio
+ // Select the prefered language audio, or the first track if it doesn't exist.
+ int i = 0;
+ foreach (object item in drp_audioTrack.Items)
{
- drp_audioTrack.SelectedIndex = i;
- break;
+ if (item.ToString().Contains(Properties.Settings.Default.NativeLanguage))
+ {
+ drp_audioTrack.SelectedIndex = i;
+ break;
+ }
+
+ i++;
}
- i++;
- }
+ if (drp_audioTrack.SelectedItem != null)
+ foreach (DataGridViewRow item in audioList.Rows)
+ item.Cells[1].Value = drp_audioTrack.SelectedItem.ToString();
+ else
+ {
+ drp_audioTrack.SelectedIndex = 0;
+ if (drp_audioTrack.SelectedItem != null)
+ foreach (DataGridViewRow item in audioList.Rows)
+ item.Cells[1].Value = drp_audioTrack.SelectedItem.ToString();
+ }
- if (drp_audioTrack.SelectedItem != null)
- foreach (DataGridViewRow item in audioList.Rows)
- item.Cells[1].Value = drp_audioTrack.SelectedItem.ToString();
- else
- {
+ break;
+ case 2:
+ default:
+ // Select the first track which is hopefully the default and foreign track.
drp_audioTrack.SelectedIndex = 0;
+
if (drp_audioTrack.SelectedItem != null)
foreach (DataGridViewRow item in audioList.Rows)
item.Cells[1].Value = drp_audioTrack.SelectedItem.ToString();
- }
+ break;
}
- else
- drp_audioTrack.SelectedIndex = drp_audioTrack.Items.Count >= 3 ? 2 : 0;
- // "Use Foreign language audio and Subtitles"
}
}
@@ -528,7 +556,7 @@ namespace Handbrake.Controls
if (up) index--;
else index++;
-
+
if (index < audioList.Rows.Count || (audioList.Rows.Count > index && index >= 0))
{
audioList.Rows.Remove(item);