summaryrefslogtreecommitdiffstats
path: root/win/C#/frmMain.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/C#/frmMain.cs')
-rw-r--r--win/C#/frmMain.cs318
1 files changed, 8 insertions, 310 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index fa004ea4c..7ed6d0f48 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -80,7 +80,7 @@ namespace Handbrake
lbl_max.Text = "";
queueWindow = new frmQueue(encodeQueue); // Prepare the Queue
if (Properties.Settings.Default.QueryEditorTab != "Checked")
- tabs_panel.TabPages.RemoveAt(6); // Remove the query editor tab if the user does not want it enabled.
+ tabs_panel.TabPages.RemoveAt(7); // Remove the query editor tab if the user does not want it enabled.
// Load the user's default settings or Normal Preset
if (Properties.Settings.Default.defaultSettings == "Checked" && Properties.Settings.Default.defaultPreset != "")
@@ -873,11 +873,7 @@ namespace Handbrake
drop_chapterFinish.Text = drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString();
// Populate the Audio Channels Dropdown
- drp_track1Audio.Items.Clear();
- drp_track1Audio.Items.Add("Automatic");
- drp_track1Audio.Items.Add("None");
- drp_track1Audio.Items.AddRange(selectedTitle.AudioTracks.ToArray());
- drp_track1Audio.SelectedIndex = 0;
+ audioPanel.setTrackList(selectedTitle);
// Populate the Subtitles dropdown
drp_subtitle.Items.Clear();
@@ -1070,7 +1066,7 @@ namespace Handbrake
else if (drop_format.SelectedIndex == 2)
setExtension(".mkv");
- setAudioByContainer(drop_format.Text);
+ audioPanel.setAudioByContainer(drop_format.Text);
setVideoByContainer(drop_format.Text);
}
private void setExtension(string newExtension)
@@ -1091,7 +1087,7 @@ namespace Handbrake
if (check_2PassEncode.CheckState == CheckState.Checked)
check_turbo.Enabled = true;
- h264Tab.Enabled = true;
+ tab_advanced.Enabled = true;
if ((drop_format.Text.Contains("MP4")) || (drop_format.Text.Contains("M4V")))
check_iPodAtom.Enabled = true;
else
@@ -1101,7 +1097,7 @@ namespace Handbrake
{
check_turbo.CheckState = CheckState.Unchecked;
check_turbo.Enabled = false;
- h264Tab.Enabled = false;
+ tab_advanced.Enabled = false;
x264Panel.x264Query = "";
check_iPodAtom.Enabled = false;
check_iPodAtom.Checked = false;
@@ -1363,206 +1359,7 @@ namespace Handbrake
lbl_deblockVal.Text = slider_deblock.Value == 4 ? "Off" : slider_deblock.Value.ToString();
}
- //Audio Tab
- private void drp_track1Audio_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)
- {
- lv_audioList.Items[lv_audioList.SelectedIndices[0]].Text = drp_track1Audio.Text;
- lv_audioList.Select();
- }
- }
- private void drp_audenc_1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (drp_audenc_1.Text.Contains("AC3") || drp_audenc_1.Text.Contains("DTS"))
- {
- drp_audmix_1.Enabled = false;
- drp_audbit_1.Enabled = false;
- drp_audsr_1.Enabled = false;
-
- drp_audmix_1.SelectedIndex = 0;
- drp_audbit_1.SelectedIndex = 0;
- drp_audsr_1.SelectedIndex = 0;
- }
- else
- {
- drp_audmix_1.Enabled = true;
- drp_audbit_1.Enabled = true;
- drp_audsr_1.Enabled = true;
-
- drp_audmix_1.Text = "Automatic";
- drp_audbit_1.Text = "160";
- drp_audsr_1.Text = "Auto";
- }
-
- if (drp_audenc_1.Text.Contains("AAC"))
- {
- setMixDownAllOptions(drp_audmix_1);
- setBitrateSelections160(drp_audbit_1);
- }
- else
- {
- setMixDownNotAAC(drp_audmix_1);
- setBitrateSelections320(drp_audbit_1);
- }
-
- // Update an item in the Audio list if required.
- if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)
- {
- lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text = drp_audenc_1.Text;
- lv_audioList.Select();
- }
- }
- private void drp_audmix_1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if ((drp_audenc_1.Text.Contains("AAC")) && (drp_audmix_1.Text == "6 Channel Discrete"))
- setBitrateSelections384(drp_audbit_1);
- else if ((drp_audenc_1.Text.Contains("AAC")) && (drp_audmix_1.Text != "6 Channel Discrete"))
- setBitrateSelections160(drp_audbit_1); drp_audbit_1.Text = "160";
-
- // Update an item in the Audio list if required.
- if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)
- {
- lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text = drp_audmix_1.Text;
- lv_audioList.Select();
- }
- }
- private void drp_audsr_1_SelectedIndexChanged(object sender, EventArgs e)
- {
- // Update an item in the Audio list if required.
- if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)
- {
- lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text = drp_audsr_1.Text;
- lv_audioList.Select();
- }
- }
- private void drp_audbit_1_SelectedIndexChanged(object sender, EventArgs e)
- {
- // Update an item in the Audio list if required.
- if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)
- {
- if (drp_audenc_1.Text.Contains("AC3"))
- drp_audbit_1.Text = "Auto";
- lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text = drp_audbit_1.Text;
- lv_audioList.Select();
- }
- }
- private void tb_drc_Scroll(object sender, EventArgs e)
- {
- double value;
- if (tb_drc.Value == 0) value = 0;
- else
- value = ((tb_drc.Value - 1) / 10.0) + 1;
-
- lbl_drc.Text = value.ToString();
-
- // Update an item in the Audio list if required.
- if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)
- {
- lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text = lbl_drc.Text;
- lv_audioList.Select();
- }
- }
-
- private void btn_addAudioTrack_Click(object sender, EventArgs e)
- {
- // Create a new row for the Audio list based on the currently selected items in the dropdown.
- ListViewItem newTrack = new ListViewItem(drp_track1Audio.Text);
- newTrack.SubItems.Add(drp_audenc_1.Text);
- newTrack.SubItems.Add(drp_audmix_1.Text);
- newTrack.SubItems.Add(drp_audsr_1.Text);
- newTrack.SubItems.Add(drp_audbit_1.Text);
- newTrack.SubItems.Add(lbl_drc.Text);
-
- // Select the newly added track and select the control
- lv_audioList.Items.Add(newTrack);
- lv_audioList.Items[lv_audioList.Items.Count - 1].Selected = true;
- lv_audioList.Select();
- }
- private void btn_RemoveAudioTrack_Click(object sender, EventArgs e)
- {
- removeAudioTrack();
- }
- private void audioList_moveup_Click(object sender, EventArgs e)
- {
- if (lv_audioList.SelectedIndices.Count != 0)
- {
- ListViewItem item = lv_audioList.SelectedItems[0];
- int index = item.Index;
- index--;
-
- if (lv_audioList.Items.Count > index && index >= 0)
- {
- lv_audioList.Items.Remove(item);
- lv_audioList.Items.Insert(index, item);
- item.Selected = true;
- lv_audioList.Focus();
- }
- }
- }
- private void audioList_movedown_Click(object sender, EventArgs e)
- {
- if (lv_audioList.SelectedIndices.Count != 0)
- {
- ListViewItem item = lv_audioList.SelectedItems[0];
- int index = item.Index;
- index++;
-
- if (index < lv_audioList.Items.Count)
- {
- lv_audioList.Items.Remove(item);
- lv_audioList.Items.Insert(index, item);
- item.Selected = true;
- lv_audioList.Focus();
- }
- }
-
- }
- private void audioList_remove_Click(object sender, EventArgs e)
- {
- removeAudioTrack();
- }
- private void removeAudioTrack()
- {
- // Remove the Item and reselect the control if the following conditions are met.
- if (lv_audioList.SelectedItems.Count != 0)
- {
- // Record the current selected index.
- int currentPosition = lv_audioList.SelectedIndices[0];
-
- lv_audioList.Items.RemoveAt(lv_audioList.SelectedIndices[0]);
-
- // Now reslect the correct item and give focus to the audio list.
- if (lv_audioList.Items.Count != 0)
- {
- if (currentPosition <= (lv_audioList.Items.Count - 1))
- lv_audioList.Items[currentPosition].Selected = true;
- else if (currentPosition > (lv_audioList.Items.Count - 1))
- lv_audioList.Items[lv_audioList.Items.Count - 1].Selected = true;
-
- lv_audioList.Select();
- }
- }
- }
- private void lv_audioList_SelectedIndexChanged(object sender, EventArgs e)
- {
- // Set the dropdown controls based on the selected item in the Audio List.
- if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0)
- {
- drp_track1Audio.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].Text;
- drp_audenc_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text;
- drp_audmix_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text;
- drp_audsr_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text;
- drp_audbit_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text;
- double drcValue; int drcCalculated;
- double.TryParse(lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text, out drcValue);
- if (drcValue == 0) drcCalculated = 0;
- else
- drcValue = ((drcValue * 10) + 1) - 10;
- int.TryParse(drcValue.ToString(), out drcCalculated);
- tb_drc.Value = drcCalculated;
- }
- }
+ //Subtitles Tab
private void drp_subtitle_SelectedIndexChanged(object sender, EventArgs e)
{
@@ -1904,38 +1701,7 @@ namespace Handbrake
#endregion
#region Audio Panel Code Helpers
- private void setAudioByContainer(String path)
- {
- if ((path.Contains("MP4")) || (path.Contains("M4V")))
- {
- string oldval = drp_audenc_1.Text;
- drp_audenc_1.Items.Clear();
- drp_audenc_1.Items.Add("AAC (faac)");
- drp_audenc_1.Items.Add("AC3 Passthru");
- if ((oldval != "AAC (faac)") && (oldval != "AC3 Passthru"))
- drp_audenc_1.SelectedIndex = 0;
-
- }
- else if (path.Contains("MKV"))
- {
- drp_audenc_1.Items.Clear();
- drp_audenc_1.Items.Add("AAC (faac)");
- drp_audenc_1.Items.Add("MP3 (lame)");
- drp_audenc_1.Items.Add("AC3 Passthru");
- drp_audenc_1.Items.Add("DTS Passthru");
- drp_audenc_1.Items.Add("Vorbis (vorbis)");
-
- if (drp_audenc_1.Text == string.Empty)
- drp_audenc_1.SelectedIndex = 0;
- }
-
- // Make sure the table is updated with new audio codecs
- foreach (ListViewItem row in lv_audioList.Items)
- {
- if (!drp_audenc_1.Items.Contains(row.SubItems[1].Text))
- row.SubItems[1].Text = drp_audenc_1.Items[0].ToString();
- }
- }
+
private void setVideoByContainer(String path)
{
string oldval;
@@ -1962,75 +1728,6 @@ namespace Handbrake
drp_videoEncoder.Text = oldval;
}
}
- private static void setBitrateSelections384(ComboBox dropDown)
- {
- dropDown.Items.Clear();
- dropDown.Items.Add("32");
- dropDown.Items.Add("40");
- dropDown.Items.Add("48");
- dropDown.Items.Add("56");
- dropDown.Items.Add("64");
- dropDown.Items.Add("80");
- dropDown.Items.Add("86");
- dropDown.Items.Add("112");
- dropDown.Items.Add("128");
- dropDown.Items.Add("160");
- dropDown.Items.Add("192");
- dropDown.Items.Add("224");
- dropDown.Items.Add("256");
- dropDown.Items.Add("320");
- dropDown.Items.Add("384");
- }
- private static void setBitrateSelections320(ComboBox dropDown)
- {
- dropDown.Items.Clear();
- dropDown.Items.Add("32");
- dropDown.Items.Add("40");
- dropDown.Items.Add("48");
- dropDown.Items.Add("56");
- dropDown.Items.Add("64");
- dropDown.Items.Add("80");
- dropDown.Items.Add("86");
- dropDown.Items.Add("112");
- dropDown.Items.Add("128");
- dropDown.Items.Add("160");
- dropDown.Items.Add("192");
- dropDown.Items.Add("224");
- dropDown.Items.Add("256");
- dropDown.Items.Add("320");
- }
- private static void setBitrateSelections160(ComboBox dropDown)
- {
- dropDown.Items.Clear();
- dropDown.Items.Add("32");
- dropDown.Items.Add("40");
- dropDown.Items.Add("48");
- dropDown.Items.Add("56");
- dropDown.Items.Add("64");
- dropDown.Items.Add("80");
- dropDown.Items.Add("86");
- dropDown.Items.Add("112");
- dropDown.Items.Add("128");
- dropDown.Items.Add("160");
- }
- private static void setMixDownAllOptions(ComboBox dropdown)
- {
- dropdown.Items.Clear();
- dropdown.Items.Add("Automatic");
- dropdown.Items.Add("Mono");
- dropdown.Items.Add("Stereo");
- dropdown.Items.Add("Dolby Surround");
- dropdown.Items.Add("Dolby Pro Logic II");
- dropdown.Items.Add("6 Channel Discrete");
- }
- private static void setMixDownNotAAC(ComboBox dropdown)
- {
- dropdown.Items.Clear();
- dropdown.Items.Add("Automatic");
- dropdown.Items.Add("Stereo");
- dropdown.Items.Add("Dolby Surround");
- dropdown.Items.Add("Dolby Pro Logic II");
- }
#endregion
#region Public Methods
@@ -2107,6 +1804,7 @@ namespace Handbrake
#endregion
+
// This is the END of the road ****************************************
}
} \ No newline at end of file