From 1a1cbcaef77ae0e1bc654a105d23774015724f6d Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 22 May 2009 00:08:58 +0000 Subject: [PATCH] WinGui: - Should probably have included the new audio panel files with that last check-in. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2436 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/AudioPanel.Designer.cs | 467 +++++++++++++++++++++++++ win/C#/Controls/AudioPanel.cs | 389 ++++++++++++++++++++ win/C#/Controls/AudioPanel.resx | 126 +++++++ 3 files changed, 982 insertions(+) create mode 100644 win/C#/Controls/AudioPanel.Designer.cs create mode 100644 win/C#/Controls/AudioPanel.cs create mode 100644 win/C#/Controls/AudioPanel.resx diff --git a/win/C#/Controls/AudioPanel.Designer.cs b/win/C#/Controls/AudioPanel.Designer.cs new file mode 100644 index 000000000..e067aa579 --- /dev/null +++ b/win/C#/Controls/AudioPanel.Designer.cs @@ -0,0 +1,467 @@ +/* AudioPanel.Designer.cs $ + + This file is part of the HandBrake source code. + Homepage: . + It may be used under the terms of the GNU General Public License. */ + +namespace Handbrake.Controls +{ + partial class AudioPanel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.lv_audioList = new System.Windows.Forms.ListView(); + this.col_id = new System.Windows.Forms.ColumnHeader(); + this.col_Source = new System.Windows.Forms.ColumnHeader(); + this.col_codec = new System.Windows.Forms.ColumnHeader(); + this.col_mixdown = new System.Windows.Forms.ColumnHeader(); + this.col_samplerate = new System.Windows.Forms.ColumnHeader(); + this.col_bitrate = new System.Windows.Forms.ColumnHeader(); + this.col_drc = new System.Windows.Forms.ColumnHeader(); + this.audioMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.audioList_moveup = new System.Windows.Forms.ToolStripMenuItem(); + this.audioList_movedown = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.audioList_remove = new System.Windows.Forms.ToolStripMenuItem(); + this.btn_RemoveAudioTrack = new System.Windows.Forms.Button(); + this.btn_addAudioTrack = new System.Windows.Forms.Button(); + this.lbl_drc = new System.Windows.Forms.Label(); + this.label16 = new System.Windows.Forms.Label(); + this.tb_drc = new System.Windows.Forms.TrackBar(); + this.label68 = new System.Windows.Forms.Label(); + this.label67 = new System.Windows.Forms.Label(); + this.label66 = new System.Windows.Forms.Label(); + this.label65 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.drp_audenc_1 = new System.Windows.Forms.ComboBox(); + this.label27 = new System.Windows.Forms.Label(); + this.drp_audmix_1 = new System.Windows.Forms.ComboBox(); + this.drp_track1Audio = new System.Windows.Forms.ComboBox(); + this.drp_audbit_1 = new System.Windows.Forms.ComboBox(); + this.drp_audsr_1 = new System.Windows.Forms.ComboBox(); + this.AudioTrackGroup = new System.Windows.Forms.GroupBox(); + this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components); + this.audioMenu.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tb_drc)).BeginInit(); + this.AudioTrackGroup.SuspendLayout(); + this.SuspendLayout(); + // + // lv_audioList + // + this.lv_audioList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.col_id, + this.col_Source, + this.col_codec, + this.col_mixdown, + this.col_samplerate, + this.col_bitrate, + this.col_drc}); + this.lv_audioList.ContextMenuStrip = this.audioMenu; + this.lv_audioList.FullRowSelect = true; + this.lv_audioList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.lv_audioList.HideSelection = false; + this.lv_audioList.LabelWrap = false; + this.lv_audioList.Location = new System.Drawing.Point(16, 115); + this.lv_audioList.MultiSelect = false; + this.lv_audioList.Name = "lv_audioList"; + this.lv_audioList.Size = new System.Drawing.Size(689, 147); + this.lv_audioList.TabIndex = 65; + this.lv_audioList.UseCompatibleStateImageBehavior = false; + this.lv_audioList.View = System.Windows.Forms.View.Details; + this.lv_audioList.SelectedIndexChanged += new System.EventHandler(this.lv_audioList_SelectedIndexChanged); + // + // col_id + // + this.col_id.Text = "Track"; + this.col_id.Width = 47; + // + // col_Source + // + this.col_Source.Text = "Source"; + this.col_Source.Width = 170; + // + // col_codec + // + this.col_codec.Text = "Audio Codec"; + this.col_codec.Width = 88; + // + // col_mixdown + // + this.col_mixdown.Text = "Mixdown"; + this.col_mixdown.Width = 127; + // + // col_samplerate + // + this.col_samplerate.Text = "Samplerate (kHz)"; + this.col_samplerate.Width = 101; + // + // col_bitrate + // + this.col_bitrate.Text = "Bitrate (Kbps)"; + this.col_bitrate.Width = 95; + // + // col_drc + // + this.col_drc.Text = "DRC"; + // + // audioMenu + // + this.audioMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.audioList_moveup, + this.audioList_movedown, + this.toolStripSeparator2, + this.audioList_remove}); + this.audioMenu.Name = "audioMenu"; + this.audioMenu.Size = new System.Drawing.Size(142, 76); + // + // audioList_moveup + // + this.audioList_moveup.Name = "audioList_moveup"; + this.audioList_moveup.Size = new System.Drawing.Size(141, 22); + this.audioList_moveup.Text = "Move Up"; + this.audioList_moveup.Click += new System.EventHandler(this.audioList_moveup_Click); + // + // audioList_movedown + // + this.audioList_movedown.Name = "audioList_movedown"; + this.audioList_movedown.Size = new System.Drawing.Size(141, 22); + this.audioList_movedown.Text = "Move Down"; + this.audioList_movedown.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.audioList_movedown.Click += new System.EventHandler(this.audioList_movedown_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(138, 6); + // + // audioList_remove + // + this.audioList_remove.Name = "audioList_remove"; + this.audioList_remove.Size = new System.Drawing.Size(141, 22); + this.audioList_remove.Text = "Remove"; + this.audioList_remove.Click += new System.EventHandler(this.audioList_remove_Click); + // + // btn_RemoveAudioTrack + // + this.btn_RemoveAudioTrack.BackColor = System.Drawing.Color.Transparent; + this.btn_RemoveAudioTrack.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btn_RemoveAudioTrack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); + this.btn_RemoveAudioTrack.Location = new System.Drawing.Point(133, 268); + this.btn_RemoveAudioTrack.Name = "btn_RemoveAudioTrack"; + this.btn_RemoveAudioTrack.Size = new System.Drawing.Size(111, 23); + this.btn_RemoveAudioTrack.TabIndex = 64; + this.btn_RemoveAudioTrack.Text = "Remove"; + this.btn_RemoveAudioTrack.UseVisualStyleBackColor = false; + this.btn_RemoveAudioTrack.Click += new System.EventHandler(this.btn_RemoveAudioTrack_Click); + // + // btn_addAudioTrack + // + this.btn_addAudioTrack.BackColor = System.Drawing.Color.Transparent; + this.btn_addAudioTrack.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btn_addAudioTrack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); + this.btn_addAudioTrack.Location = new System.Drawing.Point(16, 268); + this.btn_addAudioTrack.Name = "btn_addAudioTrack"; + this.btn_addAudioTrack.Size = new System.Drawing.Size(111, 23); + this.btn_addAudioTrack.TabIndex = 63; + this.btn_addAudioTrack.Text = "Add Track"; + this.btn_addAudioTrack.UseVisualStyleBackColor = false; + this.btn_addAudioTrack.Click += new System.EventHandler(this.btn_addAudioTrack_Click); + // + // lbl_drc + // + this.lbl_drc.AutoSize = true; + this.lbl_drc.BackColor = System.Drawing.Color.Transparent; + 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(658, 37); + this.lbl_drc.Name = "lbl_drc"; + this.lbl_drc.Size = new System.Drawing.Size(14, 13); + this.lbl_drc.TabIndex = 62; + this.lbl_drc.Text = "0"; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.BackColor = System.Drawing.Color.Transparent; + this.label16.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label16.Location = new System.Drawing.Point(607, 17); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(28, 12); + this.label16.TabIndex = 61; + this.label16.Text = "DRC"; + // + // tb_drc + // + this.tb_drc.LargeChange = 0; + this.tb_drc.Location = new System.Drawing.Point(598, 29); + this.tb_drc.Margin = new System.Windows.Forms.Padding(0); + this.tb_drc.Maximum = 31; + this.tb_drc.Name = "tb_drc"; + this.tb_drc.Size = new System.Drawing.Size(57, 45); + this.tb_drc.TabIndex = 60; + this.tb_drc.TickFrequency = 10; + this.tb_drc.Scroll += new System.EventHandler(this.tb_drc_Scroll); + // + // label68 + // + this.label68.AutoSize = true; + this.label68.BackColor = System.Drawing.Color.Transparent; + this.label68.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label68.Location = new System.Drawing.Point(13, 13); + this.label68.Name = "label68"; + this.label68.Size = new System.Drawing.Size(92, 13); + this.label68.TabIndex = 49; + this.label68.Text = "Audio Tracks"; + // + // label67 + // + this.label67.AutoSize = true; + this.label67.BackColor = System.Drawing.Color.Transparent; + this.label67.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label67.Location = new System.Drawing.Point(463, 17); + this.label67.Name = "label67"; + this.label67.Size = new System.Drawing.Size(62, 12); + this.label67.TabIndex = 57; + this.label67.Text = "Samplerate"; + // + // label66 + // + this.label66.AutoSize = true; + this.label66.BackColor = System.Drawing.Color.Transparent; + this.label66.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label66.Location = new System.Drawing.Point(538, 17); + this.label66.Name = "label66"; + this.label66.Size = new System.Drawing.Size(39, 12); + this.label66.TabIndex = 59; + this.label66.Text = "Bitrate"; + // + // label65 + // + this.label65.AutoSize = true; + this.label65.BackColor = System.Drawing.Color.Transparent; + this.label65.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label65.Location = new System.Drawing.Point(234, 17); + this.label65.Name = "label65"; + this.label65.Size = new System.Drawing.Size(69, 12); + this.label65.TabIndex = 53; + this.label65.Text = "Audio Codec"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.BackColor = System.Drawing.Color.Transparent; + this.label14.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label14.Location = new System.Drawing.Point(368, 17); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(48, 12); + this.label14.TabIndex = 55; + this.label14.Text = "Mixdown"; + // + // drp_audenc_1 + // + this.drp_audenc_1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.drp_audenc_1.FormattingEnabled = true; + this.drp_audenc_1.Items.AddRange(new object[] { + "AAC (faac)", + "MP3 (lame)", + "Vorbis (vorbis)", + "AC3 Passthru"}); + this.drp_audenc_1.Location = new System.Drawing.Point(215, 34); + this.drp_audenc_1.Name = "drp_audenc_1"; + this.drp_audenc_1.Size = new System.Drawing.Size(111, 20); + this.drp_audenc_1.TabIndex = 52; + this.drp_audenc_1.Text = "AAC (faac)"; + this.drp_audenc_1.SelectedIndexChanged += new System.EventHandler(this.drp_audenc_1_SelectedIndexChanged); + // + // label27 + // + this.label27.AutoSize = true; + this.label27.BackColor = System.Drawing.Color.Transparent; + this.label27.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label27.Location = new System.Drawing.Point(86, 17); + this.label27.Name = "label27"; + this.label27.Size = new System.Drawing.Size(40, 12); + this.label27.TabIndex = 51; + this.label27.Text = "Source"; + // + // drp_audmix_1 + // + this.drp_audmix_1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.drp_audmix_1.FormattingEnabled = true; + this.drp_audmix_1.Items.AddRange(new object[] { + "Automatic", + "Mono", + "Stereo", + "Dolby Surround", + "Dolby Pro Logic II", + "6 Channel Discrete"}); + this.drp_audmix_1.Location = new System.Drawing.Point(332, 34); + this.drp_audmix_1.Name = "drp_audmix_1"; + this.drp_audmix_1.Size = new System.Drawing.Size(129, 20); + this.drp_audmix_1.TabIndex = 54; + this.drp_audmix_1.Text = "Automatic"; + this.drp_audmix_1.SelectedIndexChanged += new System.EventHandler(this.drp_audmix_1_SelectedIndexChanged); + // + // drp_track1Audio + // + this.drp_track1Audio.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.drp_track1Audio.FormattingEnabled = true; + this.drp_track1Audio.Items.AddRange(new object[] { + "Automatic"}); + this.drp_track1Audio.Location = new System.Drawing.Point(15, 35); + this.drp_track1Audio.Name = "drp_track1Audio"; + this.drp_track1Audio.Size = new System.Drawing.Size(194, 20); + this.drp_track1Audio.TabIndex = 50; + this.drp_track1Audio.Text = "Automatic"; + this.drp_track1Audio.SelectedIndexChanged += new System.EventHandler(this.drp_track1Audio_SelectedIndexChanged); + // + // drp_audbit_1 + // + this.drp_audbit_1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.drp_audbit_1.FormattingEnabled = true; + this.drp_audbit_1.Items.AddRange(new object[] { + "32", + "40", + "48", + "56", + "64", + "80", + "86", + "112", + "128", + "160"}); + this.drp_audbit_1.Location = new System.Drawing.Point(525, 34); + this.drp_audbit_1.Name = "drp_audbit_1"; + this.drp_audbit_1.Size = new System.Drawing.Size(70, 20); + this.drp_audbit_1.TabIndex = 58; + this.drp_audbit_1.Text = "160"; + this.drp_audbit_1.SelectedIndexChanged += new System.EventHandler(this.drp_audbit_1_SelectedIndexChanged); + // + // drp_audsr_1 + // + this.drp_audsr_1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.drp_audsr_1.FormattingEnabled = true; + this.drp_audsr_1.Items.AddRange(new object[] { + "Auto", + "48", + "44.1", + "32", + "24", + "22.05"}); + this.drp_audsr_1.Location = new System.Drawing.Point(467, 34); + this.drp_audsr_1.Name = "drp_audsr_1"; + this.drp_audsr_1.Size = new System.Drawing.Size(55, 20); + this.drp_audsr_1.TabIndex = 56; + this.drp_audsr_1.Text = "Auto"; + this.drp_audsr_1.SelectedIndexChanged += new System.EventHandler(this.drp_audsr_1_SelectedIndexChanged); + // + // AudioTrackGroup + // + this.AudioTrackGroup.BackColor = System.Drawing.Color.Transparent; + this.AudioTrackGroup.Controls.Add(this.drp_track1Audio); + this.AudioTrackGroup.Controls.Add(this.drp_audsr_1); + this.AudioTrackGroup.Controls.Add(this.drp_audbit_1); + this.AudioTrackGroup.Controls.Add(this.drp_audmix_1); + this.AudioTrackGroup.Controls.Add(this.lbl_drc); + this.AudioTrackGroup.Controls.Add(this.label27); + this.AudioTrackGroup.Controls.Add(this.label16); + this.AudioTrackGroup.Controls.Add(this.drp_audenc_1); + this.AudioTrackGroup.Controls.Add(this.tb_drc); + this.AudioTrackGroup.Controls.Add(this.label14); + this.AudioTrackGroup.Controls.Add(this.label65); + this.AudioTrackGroup.Controls.Add(this.label67); + this.AudioTrackGroup.Controls.Add(this.label66); + this.AudioTrackGroup.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.AudioTrackGroup.ForeColor = System.Drawing.Color.Black; + this.AudioTrackGroup.Location = new System.Drawing.Point(16, 32); + this.AudioTrackGroup.Name = "AudioTrackGroup"; + this.AudioTrackGroup.Size = new System.Drawing.Size(689, 77); + this.AudioTrackGroup.TabIndex = 66; + this.AudioTrackGroup.TabStop = false; + this.AudioTrackGroup.Text = "Selected Track: New Track"; + // + // AudioMenuRowHeightHack + // + this.AudioMenuRowHeightHack.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; + this.AudioMenuRowHeightHack.ImageSize = new System.Drawing.Size(1, 18); + this.AudioMenuRowHeightHack.TransparentColor = System.Drawing.Color.Transparent; + // + // AudioPanel + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.Color.Transparent; + this.Controls.Add(this.AudioTrackGroup); + this.Controls.Add(this.lv_audioList); + this.Controls.Add(this.btn_RemoveAudioTrack); + this.Controls.Add(this.btn_addAudioTrack); + this.Controls.Add(this.label68); + this.Name = "AudioPanel"; + this.Size = new System.Drawing.Size(720, 310); + this.audioMenu.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.tb_drc)).EndInit(); + this.AudioTrackGroup.ResumeLayout(false); + this.AudioTrackGroup.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + internal System.Windows.Forms.ListView lv_audioList; + private System.Windows.Forms.ColumnHeader col_Source; + private System.Windows.Forms.ColumnHeader col_codec; + private System.Windows.Forms.ColumnHeader col_mixdown; + private System.Windows.Forms.ColumnHeader col_samplerate; + private System.Windows.Forms.ColumnHeader col_bitrate; + private System.Windows.Forms.ColumnHeader col_drc; + private System.Windows.Forms.Button btn_RemoveAudioTrack; + private System.Windows.Forms.Button btn_addAudioTrack; + internal System.Windows.Forms.Label lbl_drc; + internal System.Windows.Forms.Label label16; + internal System.Windows.Forms.TrackBar tb_drc; + internal System.Windows.Forms.Label label68; + internal System.Windows.Forms.Label label67; + internal System.Windows.Forms.Label label66; + internal System.Windows.Forms.Label label65; + internal System.Windows.Forms.Label label14; + internal System.Windows.Forms.ComboBox drp_audenc_1; + internal System.Windows.Forms.Label label27; + internal System.Windows.Forms.ComboBox drp_audmix_1; + internal System.Windows.Forms.ComboBox drp_track1Audio; + internal System.Windows.Forms.ComboBox drp_audbit_1; + internal System.Windows.Forms.ComboBox drp_audsr_1; + private System.Windows.Forms.ColumnHeader col_id; + private System.Windows.Forms.GroupBox AudioTrackGroup; + private System.Windows.Forms.ImageList AudioMenuRowHeightHack; + private System.Windows.Forms.ContextMenuStrip audioMenu; + private System.Windows.Forms.ToolStripMenuItem audioList_moveup; + private System.Windows.Forms.ToolStripMenuItem audioList_movedown; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem audioList_remove; + } +} diff --git a/win/C#/Controls/AudioPanel.cs b/win/C#/Controls/AudioPanel.cs new file mode 100644 index 000000000..4b44cffed --- /dev/null +++ b/win/C#/Controls/AudioPanel.cs @@ -0,0 +1,389 @@ +/* AudioPanel.cs $ + + This file is part of the HandBrake source code. + Homepage: . + It may be used under the terms of the GNU General Public License. */ + +using System; +using System.Windows.Forms; + +namespace Handbrake.Controls +{ + public partial class AudioPanel : UserControl + { + public AudioPanel() + { + InitializeComponent(); + } + + // Audio Track Options + 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]].SubItems[1].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[2].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[3].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[4].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[5].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[6].Text = lbl_drc.Text; + lv_audioList.Select(); + } + } + + // Track Controls + 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(getNewID().ToString()); + newTrack.SubItems.Add(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); + lv_audioList.Items.Add(newTrack); + + // Select the newly added track and select the control + lv_audioList.Items[lv_audioList.Items.Count - 1].Selected = true; + lv_audioList.Select(); + } + private void btn_RemoveAudioTrack_Click(object sender, EventArgs e) + { + // 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(); + } + // Regenerate the ID numers + reGenerateListIDs(); + } + } + + // Audio List Menu + 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(); + } + } + } + + // Public Functions + public void setTrackList(Parsing.Title selectedTitle) + { + 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; + } + public ListView getAudioPanel() + { + return lv_audioList; + } + public 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[2].Text)) + row.SubItems[2].Text = drp_audenc_1.Items[0].ToString(); + } + } + public void addTrackForPreset(ListViewItem item) + { + lv_audioList.Items.Add(item); + } + public void clearAudioList() + { + lv_audioList.Items.Clear(); + } + public int getNewID() + { + return lv_audioList.Items.Count + 1; + } + + // Helper Functions + private void reGenerateListIDs() + { + int i = 1; + foreach (ListViewItem item in lv_audioList.Items) + { + item.SubItems[0].Text = i.ToString(); + i++; + } + } + 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"); + } + 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]].SubItems[1].Text; + drp_audenc_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text; + drp_audmix_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text; + drp_audsr_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text; + drp_audbit_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text; + double drcValue; int drcCalculated; + double.TryParse(lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text, out drcValue); + if (drcValue == 0) drcCalculated = 0; + else + drcValue = ((drcValue * 10) + 1) - 10; + int.TryParse(drcValue.ToString(), out drcCalculated); + tb_drc.Value = drcCalculated; + + AudioTrackGroup.Text = "Selected Track: " + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[0].Text; + } + else + AudioTrackGroup.Text = "Selected Track: None (Click \"Add Track\" to add)"; + } + + + + } +} diff --git a/win/C#/Controls/AudioPanel.resx b/win/C#/Controls/AudioPanel.resx new file mode 100644 index 000000000..07fd5e25d --- /dev/null +++ b/win/C#/Controls/AudioPanel.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 216, 16 + + + 35, 17 + + \ No newline at end of file -- 2.40.0