summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/C#/Controls/Subtitles.Designer.cs519
-rw-r--r--win/C#/Controls/Subtitles.cs485
-rw-r--r--win/C#/Controls/Subtitles.resx6
-rw-r--r--win/C#/Functions/QueryGenerator.cs36
-rw-r--r--win/C#/frmMain.cs5
5 files changed, 490 insertions, 561 deletions
diff --git a/win/C#/Controls/Subtitles.Designer.cs b/win/C#/Controls/Subtitles.Designer.cs
index e10020559..5f1eaa14d 100644
--- a/win/C#/Controls/Subtitles.Designer.cs
+++ b/win/C#/Controls/Subtitles.Designer.cs
@@ -29,139 +29,65 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- this.drp_subtitleTracks = new System.Windows.Forms.ComboBox();
- this.SubTitlesGroup = new System.Windows.Forms.GroupBox();
- this.label1 = new System.Windows.Forms.Label();
- this.check_default = new System.Windows.Forms.CheckBox();
- this.check_burned = new System.Windows.Forms.CheckBox();
- this.check_forced = new System.Windows.Forms.CheckBox();
- this.btn_addSubTrack = new System.Windows.Forms.Button();
+ this.btn_addTrack = new System.Windows.Forms.Button();
this.btn_RemoveSubTrack = new System.Windows.Forms.Button();
this.lv_subList = new System.Windows.Forms.ListView();
- this.id = new System.Windows.Forms.ColumnHeader();
this.col_Source = new System.Windows.Forms.ColumnHeader();
- this.forced = new System.Windows.Forms.ColumnHeader();
- this.burned = new System.Windows.Forms.ColumnHeader();
- this.defaultTrack = new System.Windows.Forms.ColumnHeader();
- this.type = new System.Windows.Forms.ColumnHeader();
- this.srtOffset = new System.Windows.Forms.ColumnHeader();
+ this.col_forced = new System.Windows.Forms.ColumnHeader();
+ this.col_burned = new System.Windows.Forms.ColumnHeader();
+ this.col_defaultTrack = new System.Windows.Forms.ColumnHeader();
+ this.col_srtLang = new System.Windows.Forms.ColumnHeader();
+ this.col_srtChar = new System.Windows.Forms.ColumnHeader();
+ this.col_srtOffset = new System.Windows.Forms.ColumnHeader();
this.subMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnu_moveup = new System.Windows.Forms.ToolStripMenuItem();
this.mnu_movedown = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.mnu_remove = new System.Windows.Forms.ToolStripMenuItem();
this.label68 = new System.Windows.Forms.Label();
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.tabPage2 = new System.Windows.Forms.TabPage();
- this.SRTGroup = new System.Windows.Forms.GroupBox();
- this.label6 = new System.Windows.Forms.Label();
- this.check_default_srt = new System.Windows.Forms.CheckBox();
+ this.SubGroupBox = new System.Windows.Forms.GroupBox();
+ this.drp_subtitleTracks = new System.Windows.Forms.ComboBox();
+ this.label10 = new System.Windows.Forms.Label();
+ this.label9 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
this.srt_offset = new System.Windows.Forms.NumericUpDown();
- this.label5 = new System.Windows.Forms.Label();
- this.srt_browse = new System.Windows.Forms.Button();
+ this.srt_lang = new System.Windows.Forms.ComboBox();
+ this.label8 = new System.Windows.Forms.Label();
+ this.srt_charcode = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
+ this.check_forced = new System.Windows.Forms.CheckBox();
+ this.label7 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
- this.srt_charcode = new System.Windows.Forms.ComboBox();
- this.label2 = new System.Windows.Forms.Label();
- this.srt_lang = new System.Windows.Forms.ComboBox();
+ this.check_default = new System.Windows.Forms.CheckBox();
+ this.check_burned = new System.Windows.Forms.CheckBox();
this.btn_srtAdd = new System.Windows.Forms.Button();
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
- this.SubTitlesGroup.SuspendLayout();
+ this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.subMenu.SuspendLayout();
- this.tabControl1.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.tabPage2.SuspendLayout();
- this.SRTGroup.SuspendLayout();
+ this.SubGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.srt_offset)).BeginInit();
this.SuspendLayout();
//
- // drp_subtitleTracks
- //
- this.drp_subtitleTracks.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.drp_subtitleTracks.FormattingEnabled = true;
- this.drp_subtitleTracks.Location = new System.Drawing.Point(57, 20);
- this.drp_subtitleTracks.Name = "drp_subtitleTracks";
- this.drp_subtitleTracks.Size = new System.Drawing.Size(194, 21);
- this.drp_subtitleTracks.TabIndex = 50;
- this.drp_subtitleTracks.SelectedIndexChanged += new System.EventHandler(this.drp_subtitleTracks_SelectedIndexChanged);
- //
- // SubTitlesGroup
- //
- this.SubTitlesGroup.BackColor = System.Drawing.Color.Transparent;
- this.SubTitlesGroup.Controls.Add(this.label1);
- this.SubTitlesGroup.Controls.Add(this.check_default);
- this.SubTitlesGroup.Controls.Add(this.check_burned);
- this.SubTitlesGroup.Controls.Add(this.check_forced);
- this.SubTitlesGroup.Controls.Add(this.drp_subtitleTracks);
- this.SubTitlesGroup.Location = new System.Drawing.Point(6, 6);
- this.SubTitlesGroup.Name = "SubTitlesGroup";
- this.SubTitlesGroup.Size = new System.Drawing.Size(669, 50);
- this.SubTitlesGroup.TabIndex = 71;
- this.SubTitlesGroup.TabStop = false;
- this.SubTitlesGroup.Text = "Selected Track: New Track";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(6, 23);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(37, 13);
- this.label1.TabIndex = 72;
- this.label1.Text = "Track:";
- //
- // check_default
- //
- this.check_default.AutoSize = true;
- this.check_default.Location = new System.Drawing.Point(426, 22);
- this.check_default.Name = "check_default";
- this.check_default.Size = new System.Drawing.Size(61, 17);
- this.check_default.TabIndex = 71;
- this.check_default.Text = "Default";
- this.check_default.UseVisualStyleBackColor = true;
- this.check_default.CheckedChanged += new System.EventHandler(this.check_default_CheckedChanged);
- //
- // check_burned
- //
- this.check_burned.AutoSize = true;
- this.check_burned.Location = new System.Drawing.Point(347, 22);
- this.check_burned.Name = "check_burned";
- this.check_burned.Size = new System.Drawing.Size(73, 17);
- this.check_burned.TabIndex = 70;
- this.check_burned.Text = "Burned In";
- this.check_burned.UseVisualStyleBackColor = true;
- this.check_burned.CheckedChanged += new System.EventHandler(this.check_burned_CheckedChanged);
- //
- // check_forced
- //
- this.check_forced.AutoSize = true;
- this.check_forced.Location = new System.Drawing.Point(257, 22);
- this.check_forced.Name = "check_forced";
- this.check_forced.Size = new System.Drawing.Size(84, 17);
- this.check_forced.TabIndex = 69;
- this.check_forced.Text = "Forced Only";
- this.check_forced.UseVisualStyleBackColor = true;
- this.check_forced.CheckedChanged += new System.EventHandler(this.check_forced_CheckedChanged);
- //
- // btn_addSubTrack
+ // btn_addTrack
//
- this.btn_addSubTrack.BackColor = System.Drawing.Color.Transparent;
- this.btn_addSubTrack.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.btn_addSubTrack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_addSubTrack.Location = new System.Drawing.Point(16, 38);
- this.btn_addSubTrack.Name = "btn_addSubTrack";
- this.btn_addSubTrack.Size = new System.Drawing.Size(78, 23);
- this.btn_addSubTrack.TabIndex = 68;
- this.btn_addSubTrack.Text = "Add Track";
- this.btn_addSubTrack.UseVisualStyleBackColor = false;
- this.btn_addSubTrack.Click += new System.EventHandler(this.btn_addSubTrack_Click);
+ this.btn_addTrack.BackColor = System.Drawing.Color.Transparent;
+ this.btn_addTrack.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn_addTrack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.btn_addTrack.Location = new System.Drawing.Point(16, 38);
+ this.btn_addTrack.Name = "btn_addTrack";
+ this.btn_addTrack.Size = new System.Drawing.Size(57, 23);
+ this.btn_addTrack.TabIndex = 68;
+ this.btn_addTrack.Text = "Add";
+ this.toolTip.SetToolTip(this.btn_addTrack, "Add a new subtitle track to the list below");
+ this.btn_addTrack.UseVisualStyleBackColor = false;
+ this.btn_addTrack.Click += new System.EventHandler(this.btn_addSubTrack_Click);
//
// btn_RemoveSubTrack
//
this.btn_RemoveSubTrack.BackColor = System.Drawing.Color.Transparent;
this.btn_RemoveSubTrack.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_RemoveSubTrack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_RemoveSubTrack.Location = new System.Drawing.Point(230, 38);
+ this.btn_RemoveSubTrack.Location = new System.Drawing.Point(79, 38);
this.btn_RemoveSubTrack.Name = "btn_RemoveSubTrack";
this.btn_RemoveSubTrack.Size = new System.Drawing.Size(73, 23);
this.btn_RemoveSubTrack.TabIndex = 69;
@@ -172,61 +98,60 @@
// lv_subList
//
this.lv_subList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.id,
this.col_Source,
- this.forced,
- this.burned,
- this.defaultTrack,
- this.type,
- this.srtOffset});
+ this.col_forced,
+ this.col_burned,
+ this.col_defaultTrack,
+ this.col_srtLang,
+ this.col_srtChar,
+ this.col_srtOffset});
this.lv_subList.ContextMenuStrip = this.subMenu;
this.lv_subList.FullRowSelect = true;
this.lv_subList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.lv_subList.HideSelection = false;
this.lv_subList.LabelWrap = false;
- this.lv_subList.Location = new System.Drawing.Point(16, 169);
+ this.lv_subList.Location = new System.Drawing.Point(16, 146);
this.lv_subList.MultiSelect = false;
this.lv_subList.Name = "lv_subList";
- this.lv_subList.Size = new System.Drawing.Size(688, 114);
+ this.lv_subList.Size = new System.Drawing.Size(688, 137);
this.lv_subList.TabIndex = 70;
this.lv_subList.UseCompatibleStateImageBehavior = false;
this.lv_subList.View = System.Windows.Forms.View.Details;
this.lv_subList.SelectedIndexChanged += new System.EventHandler(this.lb_subList_SelectedIndexChanged);
//
- // id
- //
- this.id.Text = "Track ID";
- this.id.Width = 65;
- //
// col_Source
//
this.col_Source.Text = "Track";
- this.col_Source.Width = 150;
+ this.col_Source.Width = 139;
+ //
+ // col_forced
+ //
+ this.col_forced.Text = "Forced Only";
+ this.col_forced.Width = 74;
//
- // forced
+ // col_burned
//
- this.forced.Text = "Forced Only";
- this.forced.Width = 88;
+ this.col_burned.Text = "Burned In";
+ this.col_burned.Width = 64;
//
- // burned
+ // col_defaultTrack
//
- this.burned.Text = "Burned In";
- this.burned.Width = 100;
+ this.col_defaultTrack.Text = "Default";
+ this.col_defaultTrack.Width = 56;
//
- // defaultTrack
+ // col_srtLang
//
- this.defaultTrack.Text = "Default";
- this.defaultTrack.Width = 100;
+ this.col_srtLang.Text = "Srt Lang";
//
- // type
+ // col_srtChar
//
- this.type.Text = "Type";
- this.type.Width = 110;
+ this.col_srtChar.Text = "Srt CharCode";
+ this.col_srtChar.Width = 110;
//
- // srtOffset
+ // col_srtOffset
//
- this.srtOffset.Text = "Srt Offset";
- this.srtOffset.Width = 70;
+ this.col_srtOffset.Text = "Srt Offset";
+ this.col_srtOffset.Width = 70;
//
// subMenu
//
@@ -276,87 +201,76 @@
this.label68.TabIndex = 67;
this.label68.Text = "Subtitles";
//
- // tabControl1
- //
- this.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Controls.Add(this.tabPage2);
- this.tabControl1.Location = new System.Drawing.Point(15, 71);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(689, 92);
- this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
- this.tabControl1.TabIndex = 72;
- //
- // tabPage1
- //
- this.tabPage1.Controls.Add(this.SubTitlesGroup);
- this.tabPage1.Location = new System.Drawing.Point(4, 22);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(681, 66);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "Subtitles";
- this.tabPage1.UseVisualStyleBackColor = true;
- //
- // tabPage2
- //
- this.tabPage2.Controls.Add(this.SRTGroup);
- this.tabPage2.Location = new System.Drawing.Point(4, 22);
- this.tabPage2.Name = "tabPage2";
- this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage2.Size = new System.Drawing.Size(681, 66);
- this.tabPage2.TabIndex = 1;
- this.tabPage2.Text = "External SRT";
- this.tabPage2.UseVisualStyleBackColor = true;
- //
- // SRTGroup
- //
- this.SRTGroup.BackColor = System.Drawing.Color.Transparent;
- this.SRTGroup.Controls.Add(this.label6);
- this.SRTGroup.Controls.Add(this.check_default_srt);
- this.SRTGroup.Controls.Add(this.srt_offset);
- this.SRTGroup.Controls.Add(this.label5);
- this.SRTGroup.Controls.Add(this.srt_browse);
- this.SRTGroup.Controls.Add(this.label4);
- this.SRTGroup.Controls.Add(this.label3);
- this.SRTGroup.Controls.Add(this.srt_charcode);
- this.SRTGroup.Controls.Add(this.label2);
- this.SRTGroup.Controls.Add(this.srt_lang);
- this.SRTGroup.Location = new System.Drawing.Point(6, 6);
- this.SRTGroup.Name = "SRTGroup";
- this.SRTGroup.Size = new System.Drawing.Size(669, 50);
- this.SRTGroup.TabIndex = 72;
- this.SRTGroup.TabStop = false;
- this.SRTGroup.Text = "Selected Track: New Track";
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(466, 23);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(20, 13);
- this.label6.TabIndex = 81;
- this.label6.Text = "ms";
- //
- // check_default_srt
- //
- this.check_default_srt.AutoSize = true;
- this.check_default_srt.Location = new System.Drawing.Point(491, 22);
- this.check_default_srt.Name = "check_default_srt";
- this.check_default_srt.Size = new System.Drawing.Size(61, 17);
- this.check_default_srt.TabIndex = 80;
- this.check_default_srt.Text = "Default";
- this.check_default_srt.UseVisualStyleBackColor = true;
- this.check_default_srt.CheckedChanged += new System.EventHandler(this.check_default_srt_CheckedChanged);
+ // SubGroupBox
+ //
+ this.SubGroupBox.BackColor = System.Drawing.Color.Transparent;
+ this.SubGroupBox.Controls.Add(this.drp_subtitleTracks);
+ this.SubGroupBox.Controls.Add(this.label10);
+ this.SubGroupBox.Controls.Add(this.label9);
+ this.SubGroupBox.Controls.Add(this.label2);
+ this.SubGroupBox.Controls.Add(this.srt_offset);
+ this.SubGroupBox.Controls.Add(this.srt_lang);
+ this.SubGroupBox.Controls.Add(this.label8);
+ this.SubGroupBox.Controls.Add(this.srt_charcode);
+ this.SubGroupBox.Controls.Add(this.label4);
+ this.SubGroupBox.Controls.Add(this.check_forced);
+ this.SubGroupBox.Controls.Add(this.label7);
+ this.SubGroupBox.Controls.Add(this.label3);
+ this.SubGroupBox.Controls.Add(this.check_default);
+ this.SubGroupBox.Controls.Add(this.check_burned);
+ this.SubGroupBox.Location = new System.Drawing.Point(16, 67);
+ this.SubGroupBox.Name = "SubGroupBox";
+ this.SubGroupBox.Size = new System.Drawing.Size(688, 73);
+ this.SubGroupBox.TabIndex = 72;
+ this.SubGroupBox.TabStop = false;
+ this.SubGroupBox.Text = "Selected Track: New Track";
+ //
+ // drp_subtitleTracks
+ //
+ this.drp_subtitleTracks.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.drp_subtitleTracks.FormattingEnabled = true;
+ this.drp_subtitleTracks.Location = new System.Drawing.Point(6, 35);
+ this.drp_subtitleTracks.Name = "drp_subtitleTracks";
+ this.drp_subtitleTracks.Size = new System.Drawing.Size(164, 21);
+ this.drp_subtitleTracks.TabIndex = 74;
+ this.drp_subtitleTracks.SelectedIndexChanged += new System.EventHandler(this.drp_subtitleTracks_SelectedIndexChanged);
+ //
+ // label10
+ //
+ this.label10.AutoSize = true;
+ this.label10.Location = new System.Drawing.Point(308, 19);
+ this.label10.Name = "label10";
+ this.label10.Size = new System.Drawing.Size(42, 13);
+ this.label10.TabIndex = 81;
+ this.label10.Text = "Default";
+ //
+ // label9
+ //
+ this.label9.AutoSize = true;
+ this.label9.Location = new System.Drawing.Point(248, 19);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(54, 13);
+ this.label9.TabIndex = 80;
+ this.label9.Text = "Burned In";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(371, 19);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(71, 13);
+ this.label2.TabIndex = 72;
+ this.label2.Text = "Srt Language";
//
// srt_offset
//
+ this.srt_offset.Enabled = false;
this.srt_offset.Increment = new decimal(new int[] {
10,
0,
0,
0});
- this.srt_offset.Location = new System.Drawing.Point(402, 20);
+ this.srt_offset.Location = new System.Drawing.Point(549, 35);
this.srt_offset.Maximum = new decimal(new int[] {
1000000000,
0,
@@ -367,49 +281,30 @@
this.srt_offset.TabIndex = 79;
this.srt_offset.ValueChanged += new System.EventHandler(this.srt_offset_ValueChanged);
//
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(555, 23);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(27, 13);
- this.label5.TabIndex = 78;
- this.label5.Text = "File:";
- //
- // srt_browse
- //
- this.srt_browse.BackColor = System.Drawing.Color.Transparent;
- this.srt_browse.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.srt_browse.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.srt_browse.Location = new System.Drawing.Point(588, 18);
- this.srt_browse.Name = "srt_browse";
- this.srt_browse.Size = new System.Drawing.Size(67, 23);
- this.srt_browse.TabIndex = 77;
- this.srt_browse.Text = "Browse";
- this.srt_browse.UseVisualStyleBackColor = false;
- this.srt_browse.Click += new System.EventHandler(this.srt_browse_Click);
- //
- // label4
+ // srt_lang
//
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(354, 23);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(42, 13);
- this.label4.TabIndex = 76;
- this.label4.Text = "Offset:";
+ this.srt_lang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.srt_lang.Enabled = false;
+ this.srt_lang.FormattingEnabled = true;
+ this.srt_lang.Location = new System.Drawing.Point(356, 35);
+ this.srt_lang.Name = "srt_lang";
+ this.srt_lang.Size = new System.Drawing.Size(103, 21);
+ this.srt_lang.TabIndex = 50;
+ this.srt_lang.SelectedIndexChanged += new System.EventHandler(this.srt_lang_SelectedIndexChanged);
//
- // label3
+ // label8
//
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(202, 23);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(62, 13);
- this.label3.TabIndex = 74;
- this.label3.Text = "Char Code:";
+ this.label8.AutoSize = true;
+ this.label8.Location = new System.Drawing.Point(177, 19);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(65, 13);
+ this.label8.TabIndex = 79;
+ this.label8.Text = "Forced Only";
//
// srt_charcode
//
this.srt_charcode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.srt_charcode.Enabled = false;
this.srt_charcode.FormattingEnabled = true;
this.srt_charcode.Items.AddRange(new object[] {
"ANSI_X3.4-1968",
@@ -443,41 +338,80 @@
"UTF-8",
"UTF-16",
"UTF-32"});
- this.srt_charcode.Location = new System.Drawing.Point(270, 20);
+ this.srt_charcode.Location = new System.Drawing.Point(465, 35);
this.srt_charcode.Name = "srt_charcode";
this.srt_charcode.Size = new System.Drawing.Size(78, 21);
this.srt_charcode.TabIndex = 73;
this.srt_charcode.SelectedIndexChanged += new System.EventHandler(this.srt_charcode_SelectedIndexChanged);
//
- // label2
+ // label4
//
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(6, 23);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(58, 13);
- this.label2.TabIndex = 72;
- this.label2.Text = "Language:";
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(548, 19);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(62, 13);
+ this.label4.TabIndex = 76;
+ this.label4.Text = "Offset (ms)";
//
- // srt_lang
+ // check_forced
//
- this.srt_lang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.srt_lang.FormattingEnabled = true;
- this.srt_lang.Location = new System.Drawing.Point(70, 20);
- this.srt_lang.Name = "srt_lang";
- this.srt_lang.Size = new System.Drawing.Size(126, 21);
- this.srt_lang.TabIndex = 50;
- this.srt_lang.SelectedIndexChanged += new System.EventHandler(this.srt_lang_SelectedIndexChanged);
+ this.check_forced.AutoSize = true;
+ this.check_forced.Location = new System.Drawing.Point(199, 38);
+ this.check_forced.Name = "check_forced";
+ this.check_forced.Size = new System.Drawing.Size(15, 14);
+ this.check_forced.TabIndex = 75;
+ this.check_forced.UseVisualStyleBackColor = true;
+ this.check_forced.CheckedChanged += new System.EventHandler(this.check_forced_CheckedChanged);
+ //
+ // label7
+ //
+ this.label7.AutoSize = true;
+ this.label7.Location = new System.Drawing.Point(69, 19);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(37, 13);
+ this.label7.TabIndex = 78;
+ this.label7.Text = "Track:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(471, 19);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(58, 13);
+ this.label3.TabIndex = 74;
+ this.label3.Text = "Char Code";
+ //
+ // check_default
+ //
+ this.check_default.AutoSize = true;
+ this.check_default.Location = new System.Drawing.Point(320, 38);
+ this.check_default.Name = "check_default";
+ this.check_default.Size = new System.Drawing.Size(15, 14);
+ this.check_default.TabIndex = 77;
+ this.check_default.UseVisualStyleBackColor = true;
+ this.check_default.CheckedChanged += new System.EventHandler(this.check_default_CheckedChanged);
+ //
+ // check_burned
+ //
+ this.check_burned.AutoSize = true;
+ this.check_burned.Location = new System.Drawing.Point(260, 38);
+ this.check_burned.Name = "check_burned";
+ this.check_burned.Size = new System.Drawing.Size(15, 14);
+ this.check_burned.TabIndex = 76;
+ this.check_burned.UseVisualStyleBackColor = true;
+ this.check_burned.CheckedChanged += new System.EventHandler(this.check_burned_CheckedChanged);
//
// btn_srtAdd
//
this.btn_srtAdd.BackColor = System.Drawing.Color.Transparent;
this.btn_srtAdd.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_srtAdd.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_srtAdd.Location = new System.Drawing.Point(100, 38);
+ this.btn_srtAdd.Location = new System.Drawing.Point(158, 38);
this.btn_srtAdd.Name = "btn_srtAdd";
- this.btn_srtAdd.Size = new System.Drawing.Size(124, 23);
+ this.btn_srtAdd.Size = new System.Drawing.Size(88, 23);
this.btn_srtAdd.TabIndex = 73;
- this.btn_srtAdd.Text = "Add External SRT";
+ this.btn_srtAdd.Text = "Import SRT";
+ this.toolTip.SetToolTip(this.btn_srtAdd, "Add a new SRT file to the \"track\" dropdown menu.");
this.btn_srtAdd.UseVisualStyleBackColor = false;
this.btn_srtAdd.Click += new System.EventHandler(this.btn_srtAdd_Click);
//
@@ -490,23 +424,18 @@
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.BackColor = System.Drawing.Color.Transparent;
- this.Controls.Add(this.btn_srtAdd);
- this.Controls.Add(this.btn_RemoveSubTrack);
+ this.Controls.Add(this.SubGroupBox);
+ this.Controls.Add(this.btn_addTrack);
this.Controls.Add(this.label68);
- this.Controls.Add(this.tabControl1);
+ this.Controls.Add(this.btn_RemoveSubTrack);
this.Controls.Add(this.lv_subList);
- this.Controls.Add(this.btn_addSubTrack);
+ this.Controls.Add(this.btn_srtAdd);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Name = "Subtitles";
this.Size = new System.Drawing.Size(719, 300);
- this.SubTitlesGroup.ResumeLayout(false);
- this.SubTitlesGroup.PerformLayout();
this.subMenu.ResumeLayout(false);
- this.tabControl1.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.tabPage2.ResumeLayout(false);
- this.SRTGroup.ResumeLayout(false);
- this.SRTGroup.PerformLayout();
+ this.SubGroupBox.ResumeLayout(false);
+ this.SubGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.srt_offset)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -515,35 +444,23 @@
#endregion
- internal System.Windows.Forms.ComboBox drp_subtitleTracks;
- private System.Windows.Forms.GroupBox SubTitlesGroup;
private System.Windows.Forms.Button btn_RemoveSubTrack;
- private System.Windows.Forms.Button btn_addSubTrack;
+ private System.Windows.Forms.Button btn_addTrack;
internal System.Windows.Forms.ListView lv_subList;
- private System.Windows.Forms.ColumnHeader id;
private System.Windows.Forms.ColumnHeader col_Source;
- private System.Windows.Forms.ColumnHeader forced;
- private System.Windows.Forms.ColumnHeader burned;
+ private System.Windows.Forms.ColumnHeader col_forced;
+ private System.Windows.Forms.ColumnHeader col_burned;
internal System.Windows.Forms.Label label68;
- private System.Windows.Forms.ColumnHeader defaultTrack;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.CheckBox check_default;
- private System.Windows.Forms.CheckBox check_burned;
- private System.Windows.Forms.CheckBox check_forced;
+ private System.Windows.Forms.ColumnHeader col_defaultTrack;
private System.Windows.Forms.ContextMenuStrip subMenu;
private System.Windows.Forms.ToolStripMenuItem mnu_moveup;
private System.Windows.Forms.ToolStripMenuItem mnu_movedown;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem mnu_remove;
- internal System.Windows.Forms.TabControl tabControl1;
- private System.Windows.Forms.TabPage tabPage1;
- private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Button btn_srtAdd;
- private System.Windows.Forms.ColumnHeader type;
- private System.Windows.Forms.ColumnHeader srtOffset;
- private System.Windows.Forms.GroupBox SRTGroup;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Button srt_browse;
+ private System.Windows.Forms.ColumnHeader col_srtChar;
+ private System.Windows.Forms.ColumnHeader col_srtOffset;
+ private System.Windows.Forms.GroupBox SubGroupBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
internal System.Windows.Forms.ComboBox srt_charcode;
@@ -551,7 +468,15 @@
internal System.Windows.Forms.ComboBox srt_lang;
private System.Windows.Forms.NumericUpDown srt_offset;
private System.Windows.Forms.OpenFileDialog openFileDialog;
- private System.Windows.Forms.CheckBox check_default_srt;
- private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.CheckBox check_default;
+ private System.Windows.Forms.CheckBox check_burned;
+ private System.Windows.Forms.CheckBox check_forced;
+ internal System.Windows.Forms.ComboBox drp_subtitleTracks;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.Label label9;
+ private System.Windows.Forms.Label label10;
+ private System.Windows.Forms.ColumnHeader col_srtLang;
+ private System.Windows.Forms.ToolTip toolTip;
}
}
diff --git a/win/C#/Controls/Subtitles.cs b/win/C#/Controls/Subtitles.cs
index 14e7bab1d..f5fbb33a6 100644
--- a/win/C#/Controls/Subtitles.cs
+++ b/win/C#/Controls/Subtitles.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Windows.Forms;
using Handbrake.Functions;
@@ -8,6 +9,8 @@ namespace Handbrake.Controls
public partial class Subtitles : UserControl
{
readonly IDictionary<string, string> LangMap = new Dictionary<string, string>();
+ List<SubtitleInfo> SubList = new List<SubtitleInfo>();
+ private int _fileContainer;
public Subtitles()
{
@@ -21,299 +24,213 @@ namespace Handbrake.Controls
srt_lang.SelectedIndex = 40;
}
- private int FileContainer;
-
- // Public Functions
- public void Clear()
- {
- lv_subList.Items.Clear();
- }
- public void setSubtitleTrackAuto()
- {
- // Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options
- if (Properties.Settings.Default.NativeLanguage != "Any")
- {
- if (!Properties.Settings.Default.DubAudio) // We need to add a subtitle track if this is false.
- {
- int i = 0;
- foreach (object item in drp_subtitleTracks.Items)
- {
- if (item.ToString().Contains(Properties.Settings.Default.NativeLanguage))
- drp_subtitleTracks.SelectedIndex = i;
-
- i++;
- }
-
- btn_addSubTrack_Click(this, new EventArgs());
- }
- }
- }
- public void setContainer(int value)
- {
- FileContainer = value;
- Boolean trigger = false;
- if (FileContainer != 1)
- foreach (ListViewItem item in lv_subList.Items)
- {
- if (item.SubItems[1].Text.Contains("Bitmap"))
- {
- if (trigger)
- lv_subList.Items.Remove(item);
- trigger = true;
- }
- }
- }
- public Boolean RequiresM4V()
- {
- foreach (ListViewItem item in lv_subList.Items)
- {
- if (item.SubItems.Count != 5)
- return true;
-
- if (item.SubItems[1].Text.Contains("(Text)"))
- return true;
- }
- return false;
- }
-
- // Controls
+ // Primary Controls
private void btn_addSubTrack_Click(object sender, EventArgs e)
{
- string forcedVal = "No";
- string burnedVal = "No";
- string defaultSub = "No";
-
- if (check_forced.Checked)
- forcedVal = "Yes";
-
- if (check_burned.Checked)
- {
- if (!drp_subtitleTracks.Text.Contains("Text"))
- {
- burnedVal = "Yes";
- setNoBurned();
- }
- }
-
- if (check_default.Checked)
+ // 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("Text")) ? "Yes" : "No";
+ string srtCode = "-", srtLangVal = "-", srtPath = "-", srtFile = "-";
+ int srtOffsetMs = 0;
+
+ if (drp_subtitleTracks.SelectedItem.ToString().Contains(".srt"))
{
- defaultSub = "Yes";
- setNoDefault();
+ burnedVal = "No";
+ forcedVal = "No";
+ srtPath = openFileDialog.FileName;
+ srtFile = Path.GetFileName(openFileDialog.FileName);
+ srtLangVal = srt_lang.SelectedItem.ToString();
+ srtCode = srt_charcode.SelectedItem.ToString();
+ srtOffsetMs = (int)srt_offset.Value;
}
- Boolean addTrack = true;
- if (FileContainer == 0)
+ if (_fileContainer == 0) // MP4 and M4V file extension
{
- burnedVal = "Yes"; // MP4 must have bitmap subs burned in.
-
// Make sure we only have 1 bitmap track.
- if (drp_subtitleTracks.SelectedItem != null)
+ if (drp_subtitleTracks.SelectedItem != null && drp_subtitleTracks.SelectedItem.ToString().Contains("Bitmap"))
{
- if (drp_subtitleTracks.SelectedItem.ToString().Contains("Bitmap"))
- foreach (ListViewItem item in lv_subList.Items)
+ foreach (ListViewItem item in lv_subList.Items)
+ {
+ if (item.SubItems[0].Text.Contains("Bitmap"))
{
- if (item.SubItems[1].Text.Contains("Bitmap"))
- {
- MessageBox.Show(this,
- "More than one vobsub is not supported in mp4... Your first vobsub track will now be used.",
- "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- addTrack = false;
- }
+ MessageBox.Show(this, "More than one vobsub is not supported in mp4... Your first vobsub track will now be used.",
+ "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
}
+ }
}
- else
- addTrack = false;
-
}
- // Add the track if allowed.
- if (addTrack)
- {
- ListViewItem newTrack = new ListViewItem(getNewID().ToString());
+ if (defaultSub == "Yes") SetNoDefault();
+ if (burnedVal == "Yes") SetNoBurned();
- newTrack.SubItems.Add(drp_subtitleTracks.SelectedItem.ToString());
- newTrack.SubItems.Add(forcedVal);
- newTrack.SubItems.Add(burnedVal);
- newTrack.SubItems.Add(defaultSub);
+ if (_fileContainer == 0 && !drp_subtitleTracks.SelectedItem.ToString().Contains(".srt"))
+ burnedVal = "Yes"; // MP4 must have bitmap subs burned in.
- lv_subList.Items.Add(newTrack);
- }
- }
- private void btn_srtAdd_Click(object sender, EventArgs e)
- {
- string defaultSub = "No";
- if (check_default_srt.Checked)
- {
- defaultSub = "Yes";
- setNoDefault();
- }
+ string trackName = (drp_subtitleTracks.SelectedItem.ToString().Contains(".srt"))
+ ? srtLangVal + " (" + srtFile + ")"
+ : drp_subtitleTracks.SelectedItem.ToString();
- ListViewItem newTrack = new ListViewItem(getNewID().ToString());
- newTrack.SubItems.Add(srt_lang.SelectedItem + ", (" + srt_charcode.SelectedItem + ")");
- newTrack.SubItems.Add("No");
- newTrack.SubItems.Add("No");
- newTrack.SubItems.Add(defaultSub);
- if (openFileDialog.FileName != null)
- newTrack.SubItems.Add(openFileDialog.FileName);
- else
- newTrack.SubItems.Add("None");
+ SubtitleInfo track = new SubtitleInfo
+ {
+ Track = trackName,
+ Forced = forcedVal,
+ Burned = burnedVal,
+ Default = defaultSub,
+ SrtLang = srtLangVal,
+ SrtCharCode = srtCode,
+ SrtOffset = srtOffsetMs,
+ SrtPath = srtPath,
+ SrtFileName = srtFile
+ };
- newTrack.SubItems.Add(srt_offset.Value.ToString());
+ lv_subList.Items.Add(track.ListView);
+ SubList.Add(track);
- lv_subList.Items.Add(newTrack);
+ }
+ private void btn_srtAdd_Click(object sender, EventArgs e)
+ {
+ if (openFileDialog.ShowDialog() != DialogResult.OK)
+ return;
+ drp_subtitleTracks.Items.Add(Path.GetFileName(openFileDialog.FileName));
+ drp_subtitleTracks.SelectedItem = Path.GetFileName(openFileDialog.FileName);
}
private void btn_RemoveSubTrack_Click(object sender, EventArgs e)
{
- removeTrack();
+ RemoveTrack();
}
+
+ // Secondary Controls
private void lb_subList_SelectedIndexChanged(object sender, EventArgs e)
{
// Set the dropdown controls based on the selected item in the List.
if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
{
- if (lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems.Count != 5) // We have an SRT
- {
- string[] trackData = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text.Split(',');
- string charCode = trackData[1].Replace("(", "").Replace(")", "");
- srt_lang.SelectedItem = trackData[0];
- srt_charcode.SelectedItem = charCode.Trim();
-
- int offsetVal;
- int.TryParse(lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[6].Text, out offsetVal);
- srt_offset.Value = offsetVal;
+ SubtitleInfo track = SubList[lv_subList.SelectedIndices[0]];
- check_default_srt.CheckState = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[4].Text == "Yes" ? CheckState.Checked : CheckState.Unchecked;
-
- SRTGroup.Text = "Selected Track: " + lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text;
- SubTitlesGroup.Text = "Selected Track: None";
+ int c = 0;
+ if (lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text.ToLower().Contains(".srt")) // We have an SRT
+ {
+ foreach (var item in drp_subtitleTracks.Items)
+ {
+ if (item.ToString() == track.SrtFileName)
+ drp_subtitleTracks.SelectedIndex = c;
+ c++;
+ }
+ srt_lang.SelectedItem = track.SrtLang;
+ srt_offset.Value = track.SrtOffset;
+ srt_charcode.SelectedItem = track.SrtCharCode;
+ check_default.CheckState = track.Default == "Yes" ? CheckState.Checked : CheckState.Unchecked;
+ SubGroupBox.Text = "Selected Track: " + track.Track;
}
else // We have Bitmap/CC
{
- // Setup the controls
- int c = 0;
foreach (var item in drp_subtitleTracks.Items)
{
- if (item.ToString() == lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text)
+ if (item.ToString() == track.Track)
drp_subtitleTracks.SelectedIndex = c;
c++;
}
- drp_subtitleTracks.SelectedItem = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1];
-
- check_forced.CheckState = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[2].Text == "Yes" ? CheckState.Checked : CheckState.Unchecked;
- check_burned.CheckState = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[3].Text == "Yes" ? CheckState.Checked : CheckState.Unchecked;
- check_default.CheckState = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[4].Text == "Yes" ? CheckState.Checked : CheckState.Unchecked;
-
- SubTitlesGroup.Text = "Selected Track: " + lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text;
- SRTGroup.Text = "Selected Track: None";
+ check_forced.CheckState = track.Forced == "Yes" ? CheckState.Checked : CheckState.Unchecked;
+ check_burned.CheckState = track.Burned == "Yes" ? CheckState.Checked : CheckState.Unchecked;
+ check_default.CheckState = track.Default == "Yes" ? CheckState.Checked : CheckState.Unchecked;
+ SubGroupBox.Text = "Selected Track: " + lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text;
}
}
else
- {
- SubTitlesGroup.Text = "Selected Track: None (Click \"Add Track\" to add)";
- SRTGroup.Text = "Selected Track: None (Click \"Add External SRT\" to add) ";
- }
+ SubGroupBox.Text = "Selected Track: None (Click \"Add\" to add another track to the list)";
}
- // Bitmap / CC Controls
+ // Bitmap / CC / SRT Controls
private void drp_subtitleTracks_SelectedIndexChanged(object sender, EventArgs e)
{
- // Update an item in the list if required.
- if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
+ if (drp_subtitleTracks.SelectedItem.ToString().Contains(".srt"))
+ {
+ check_forced.Enabled = false;
+ check_burned.Enabled = false;
+ srt_lang.Enabled = true;
+ srt_charcode.Enabled = true;
+ srt_offset.Enabled = true;
+ }
+ else
{
- lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text = drp_subtitleTracks.SelectedItem.ToString();
- lv_subList.Select();
+ check_forced.Enabled = true;
+ check_burned.Enabled = true;
+ srt_lang.Enabled = false;
+ srt_charcode.Enabled = false;
+ srt_offset.Enabled = false;
}
+ // Update an item in the list if required.
+ if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return;
+
+ lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text = drp_subtitleTracks.SelectedItem.ToString();
+ lv_subList.Select();
+
+ SubList[lv_subList.SelectedIndices[0]].Track = drp_subtitleTracks.SelectedItem.ToString(); // Update SubList List<SubtitleInfo>
}
private void check_forced_CheckedChanged(object sender, EventArgs e)
{
- // Update an item in the list if required.
- if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
- {
- lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[2].Text = check_forced.Checked ? "Yes" : "No";
- lv_subList.Select();
- }
+ if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return;
+
+ lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text = check_forced.Checked ? "Yes" : "No";
+ lv_subList.Select();
+
+ SubList[lv_subList.SelectedIndices[0]].Forced = check_forced.Checked ? "Yes" : "No"; // Update SubList List<SubtitleInfo>
}
private void check_burned_CheckedChanged(object sender, EventArgs e)
{
- // Update an item in the list if required.
- if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
- {
- if (check_burned.Checked) // Make sure we only have 1 burned track
- setNoBurned();
+ if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return;
- lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[3].Text = check_burned.Checked ? "Yes" : "No";
- lv_subList.Select();
- }
+ if (check_burned.Checked) // Make sure we only have 1 burned track
+ SetNoBurned();
+
+ lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[2].Text = check_burned.Checked ? "Yes" : "No";
+ lv_subList.Select();
+
+ SubList[lv_subList.SelectedIndices[0]].Burned = check_burned.Checked ? "Yes" : "No"; // Update SubList List<SubtitleInfo>
}
private void check_default_CheckedChanged(object sender, EventArgs e)
{
- // Update an item in the list if required.
- if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
- {
- if (check_default.Checked) // Make sure we only have 1 default track
- setNoDefault();
+ if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return;
- lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[4].Text = check_default.Checked ? "Yes" : "No";
- lv_subList.Select();
- }
- }
- private void check_default_srt_CheckedChanged(object sender, EventArgs e)
- {
- // Update an item in the list if required.
- if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
- {
- if (check_default_srt.Checked) // Make sure we only have 1 default track
- setNoDefault();
+ if (check_default.Checked) // Make sure we only have 1 default track
+ SetNoDefault();
- lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[4].Text = check_default_srt.Checked ? "Yes" : "No";
- lv_subList.Select();
- }
- }
+ lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[3].Text = check_default.Checked ? "Yes" : "No";
+ lv_subList.Select();
- // SRT Controls
+ SubList[lv_subList.SelectedIndices[0]].Default = check_default.Checked ? "Yes" : "No"; // Update SubList List<SubtitleInfo>
+ }
private void srt_offset_ValueChanged(object sender, EventArgs e)
{
// Update an item in the list if required.
- if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
- {
- lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[6].Text = srt_offset.Value.ToString();
- lv_subList.Select();
- }
+ if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0)
+ return;
+
+ lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[6].Text = srt_offset.Value.ToString();
+ lv_subList.Select();
+
+ SubList[lv_subList.SelectedIndices[0]].SrtOffset = (int)srt_offset.Value; // Update SubList List<SubtitleInfo>
}
private void srt_charcode_SelectedIndexChanged(object sender, EventArgs e)
{
- // Update an item in the list if required.
- if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
- {
- string[] trackData = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text.Split(',');
+ if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return;
- lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text = trackData[0].Trim() + ", (" + srt_charcode.SelectedItem + ")";
- lv_subList.Select();
- }
+ lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[5].Text = srt_charcode.SelectedItem.ToString();
+ lv_subList.Select();
+
+ SubList[lv_subList.SelectedIndices[0]].SrtCharCode = srt_charcode.SelectedItem.ToString(); // Update SubList List<SubtitleInfo>
}
private void srt_lang_SelectedIndexChanged(object sender, EventArgs e)
{
- // Update an item in the list if required.
- if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
- {
- string[] trackData = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text.Split(',');
- string charCode = trackData[1].Replace("(", "").Replace(")", "").Trim();
+ if (lv_subList.Items.Count == 0 || lv_subList.SelectedIndices.Count == 0) return;
- lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text = srt_lang.SelectedItem + ", (" + charCode + ")";
- lv_subList.Select();
- }
- }
- private void srt_browse_Click(object sender, EventArgs e)
- {
- openFileDialog.ShowDialog();
+ lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[4].Text = srt_lang.SelectedItem.ToString();
+ lv_subList.Select();
- // Update an item in the list if required.
- if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
- {
- lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[5].Text = openFileDialog.FileName;
- lv_subList.Select();
- }
+ SubList[lv_subList.SelectedIndices[0]].SrtLang = srt_lang.SelectedItem.ToString(); // Update SubList List<SubtitleInfo>
}
// Right Click Menu
@@ -353,35 +270,47 @@ namespace Handbrake.Controls
}
private void mnu_remove_Click(object sender, EventArgs e)
{
- removeTrack();
+ RemoveTrack();
}
// Functions
- private void setNoDefault()
+ private void SetNoDefault()
{
+ int c = 0;
foreach (ListViewItem item in lv_subList.Items)
{
- if (item.SubItems[4].Text == "Yes")
- item.SubItems[4].Text = "No";
+ if (item.SubItems[3].Text == "Yes")
+ {
+ item.SubItems[3].Text = "No";
+ SubList[c].Default = "No";
+ }
+ c++;
}
}
- private void setNoBurned()
+ private void SetNoBurned()
{
+ int c = 0;
foreach (ListViewItem item in lv_subList.Items)
{
- if (item.SubItems[3].Text == "Yes")
- item.SubItems[3].Text = "No";
+ if (item.SubItems[2].Text == "Yes")
+ {
+ item.SubItems[2].Text = "No";
+ SubList[c].Burned = "No";
+ }
+ c++;
}
}
- private void removeTrack()
+ private void RemoveTrack()
{
// Remove the Item and reselect the control if the following conditions are met.
if (lv_subList.SelectedItems.Count != 0)
{
// Record the current selected index.
int currentPosition = lv_subList.SelectedIndices[0];
+ int selectedInd = lv_subList.SelectedIndices[0];
- lv_subList.Items.RemoveAt(lv_subList.SelectedIndices[0]);
+ lv_subList.Items.RemoveAt(selectedInd);
+ SubList.RemoveAt(selectedInd);
// Now reslect the correct item and give focus to the list.
if (lv_subList.Items.Count != 0)
@@ -393,26 +322,98 @@ namespace Handbrake.Controls
lv_subList.Select();
}
-
- // Regenerate the ID numers
- reGenerateListIDs();
}
}
- // Helper Functions
- private int getNewID()
+ // Public Functions
+ public void Clear()
{
- return lv_subList.Items.Count + 1;
+ lv_subList.Items.Clear();
}
- private void reGenerateListIDs()
+ public void SmartClear()
+ {
+ /* Smart clear will only remove subtitle tracks that do not have an equivlent
+ for the new source / title which the user has selected. */
+ throw new NotImplementedException();
+ }
+ public Boolean RequiresM4V()
{
- int i = 1;
foreach (ListViewItem item in lv_subList.Items)
{
- item.SubItems[0].Text = i.ToString();
- i++;
+ if (item.SubItems.Count != 5)
+ return true;
+
+ if (item.SubItems[1].Text.Contains("(Text)"))
+ return true;
+ }
+ return false;
+ }
+ public void SetSubtitleTrackAuto()
+ {
+ // Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options
+ if (Properties.Settings.Default.NativeLanguage != "Any")
+ {
+ if (!Properties.Settings.Default.DubAudio) // We need to add a subtitle track if this is false.
+ {
+ int i = 0;
+ foreach (object item in drp_subtitleTracks.Items)
+ {
+ if (item.ToString().Contains(Properties.Settings.Default.NativeLanguage))
+ drp_subtitleTracks.SelectedIndex = i;
+
+ i++;
+ }
+
+ btn_addSubTrack_Click(this, new EventArgs());
+ }
}
}
+ public void SetContainer(int value)
+ {
+ _fileContainer = value;
+ Boolean trigger = false;
+ if (_fileContainer != 1)
+ foreach (ListViewItem item in lv_subList.Items)
+ {
+ if (item.SubItems[1].Text.Contains("Bitmap"))
+ {
+ if (trigger)
+ lv_subList.Items.Remove(item);
+ trigger = true;
+ }
+ }
+ }
+ public List<SubtitleInfo> GetSubtitleInfoList()
+ {
+ return SubList;
+ }
+ }
+ public class SubtitleInfo
+ {
+ public string Track { get; set; }
+ public string Forced { get; set; }
+ public string Burned { get; set; }
+ public string Default { get; set; }
+ public string SrtLang { get; set; }
+ public string SrtCharCode { get; set; }
+ public int SrtOffset { get; set; }
+ public string SrtPath { get; set; }
+ public string SrtFileName { get; set; }
+
+ public ListViewItem ListView
+ {
+ get
+ {
+ ListViewItem listTrack = new ListViewItem(Track);
+ listTrack.SubItems.Add(Forced);
+ listTrack.SubItems.Add(Burned);
+ listTrack.SubItems.Add(Default);
+ listTrack.SubItems.Add(SrtLang);
+ listTrack.SubItems.Add(SrtCharCode);
+ listTrack.SubItems.Add(SrtOffset.ToString());
+ return listTrack;
+ }
+ }
}
-}
+} \ No newline at end of file
diff --git a/win/C#/Controls/Subtitles.resx b/win/C#/Controls/Subtitles.resx
index a13cf9f6f..2e6f00c9e 100644
--- a/win/C#/Controls/Subtitles.resx
+++ b/win/C#/Controls/Subtitles.resx
@@ -117,9 +117,15 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>237, 17</value>
+ </metadata>
<metadata name="subMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
+ <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>237, 17</value>
+ </metadata>
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>113, 17</value>
</metadata>
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs
index ed80bdaf6..0ba49171c 100644
--- a/win/C#/Functions/QueryGenerator.cs
+++ b/win/C#/Functions/QueryGenerator.cs
@@ -384,29 +384,26 @@ namespace Handbrake.Functions
string srtDefault = String.Empty;
int srtCount = 0;
- foreach (ListViewItem item in mainWindow.Subtitles.lv_subList.Items)
+ List<Controls.SubtitleInfo> SubList = mainWindow.Subtitles.GetSubtitleInfoList();
+
+ foreach (var item in SubList)
{
string itemToAdd, trackID;
- if (item.SubItems.Count != 5) // We have an SRT file
+ if (item.SrtPath != "-") // We have an SRT file
{
srtCount++; // SRT track id.
- string[] trackData = item.SubItems[1].Text.Split(',');
- if (trackData != null)
- {
- string charCode = trackData[1].Replace("(", "").Replace(")", "").Trim();
- string realLangCode = langMap[trackData[0].Trim()];
- srtLang += srtLang == "" ? realLangCode : "," + realLangCode;
- srtCodeset += srtCodeset == "" ? charCode : "," + charCode;
- }
- if (item.SubItems[4].Text == "Yes") // default
+ srtLang += srtLang == "" ? langMap[item.SrtLang] : "," + langMap[item.SrtLang];
+ srtCodeset += srtCodeset == "" ? item.SrtCharCode : "," + item.SrtCharCode;
+
+ if (item.Default == "Yes") // default
srtDefault = srtCount.ToString();
- itemToAdd = item.SubItems[5].Text;
+ itemToAdd = item.SrtPath;
srtFile += srtFile == "" ? itemToAdd : "," + itemToAdd;
- itemToAdd = item.SubItems[6].Text;
+ itemToAdd = item.SrtOffset.ToString();
srtOffset += srtOffset == "" ? itemToAdd : "," + itemToAdd;
}
else // We have Bitmap or CC
@@ -414,11 +411,11 @@ namespace Handbrake.Functions
string[] tempSub;
// Find --subtitle <string>
- if (item.SubItems[1].Text.Contains("Foreign Audio Search"))
+ if (item.Track.Contains("Foreign Audio Search"))
itemToAdd = "scan";
else
{
- tempSub = item.SubItems[1].Text.Split(' ');
+ tempSub = item.Track.Split(' ');
itemToAdd = tempSub[0];
}
@@ -426,26 +423,25 @@ namespace Handbrake.Functions
// Find --subtitle-forced
itemToAdd = "";
- tempSub = item.SubItems[1].Text.Split(' ');
+ tempSub = item.Track.Split(' ');
trackID = tempSub[0];
- if (item.SubItems[2].Text == "Yes")
+ if (item.Forced == "Yes")
itemToAdd = trackID;
if (itemToAdd != "")
subtitleForced += subtitleForced == "" ? itemToAdd : "," + itemToAdd;
// Find --subtitle-burn and --subtitle-default
- tempSub = item.SubItems[1].Text.Split(' ');
trackID = tempSub[0];
if (trackID.Trim() == "Foreign")
trackID = "scan";
- if (item.SubItems[3].Text == "Yes") // burn
+ if (item.Burned == "Yes") // burn
subtitleBurn = trackID;
- if (item.SubItems[4].Text == "Yes") // default
+ if (item.Default == "Yes") // default
subtitleDefault = trackID;
}
}
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index a377aca69..fccb3abfb 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -950,7 +950,7 @@ namespace Handbrake
Subtitles.drp_subtitleTracks.Items.AddRange(selectedTitle.Subtitles.ToArray());
Subtitles.drp_subtitleTracks.SelectedIndex = 0;
Subtitles.Clear();
- Subtitles.setSubtitleTrackAuto();
+ Subtitles.SetSubtitleTrackAuto();
}
// Run the autoName & chapterNaming functions
@@ -1125,7 +1125,7 @@ namespace Handbrake
}
AudioSettings.SetContainer(drop_format.Text);
- Subtitles.setContainer(drop_format.SelectedIndex);
+ Subtitles.SetContainer(drop_format.SelectedIndex);
if (drop_format.Text.Contains("MP4"))
{
@@ -1773,6 +1773,7 @@ namespace Handbrake
VideoFile
}
#endregion
+
// This is the END of the road ****************************************
}
} \ No newline at end of file