summaryrefslogtreecommitdiffstats
path: root/win/C#/Controls
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-07-08 17:38:25 +0000
committersr55 <[email protected]>2009-07-08 17:38:25 +0000
commit0094c6a4bf133bd7e066dbdcf87814770a4f369d (patch)
treee0d45ec9a810e2678c8a45fb9d5f30508f6c4bc2 /win/C#/Controls
parentc5764aa0319f44b7604f916158329c0a20d30e29 (diff)
WinGui:
- Implemented the new External SRTs feature. Added a sub tab set on the subtitles tab. - Few UI tweaks to keep things in-line with the MacGui: git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2672 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Controls')
-rw-r--r--win/C#/Controls/Subtitles.Designer.cs289
-rw-r--r--win/C#/Controls/Subtitles.cs149
-rw-r--r--win/C#/Controls/Subtitles.resx3
3 files changed, 382 insertions, 59 deletions
diff --git a/win/C#/Controls/Subtitles.Designer.cs b/win/C#/Controls/Subtitles.Designer.cs
index bb04f06de..bbef36333 100644
--- a/win/C#/Controls/Subtitles.Designer.cs
+++ b/win/C#/Controls/Subtitles.Designer.cs
@@ -30,7 +30,7 @@
{
this.components = new System.ComponentModel.Container();
this.drp_subtitleTracks = new System.Windows.Forms.ComboBox();
- this.AudioTrackGroup = new System.Windows.Forms.GroupBox();
+ 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();
@@ -43,14 +43,35 @@
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.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.AudioTrackGroup.SuspendLayout();
+ 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.srt_offset = new System.Windows.Forms.NumericUpDown();
+ this.label5 = new System.Windows.Forms.Label();
+ this.srt_browse = new System.Windows.Forms.Button();
+ this.label4 = 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.btn_srtAdd = new System.Windows.Forms.Button();
+ this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
+ this.SubTitlesGroup.SuspendLayout();
this.subMenu.SuspendLayout();
+ this.tabControl1.SuspendLayout();
+ this.tabPage1.SuspendLayout();
+ this.tabPage2.SuspendLayout();
+ this.SRTGroup.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.srt_offset)).BeginInit();
this.SuspendLayout();
//
// drp_subtitleTracks
@@ -63,21 +84,21 @@
this.drp_subtitleTracks.TabIndex = 50;
this.drp_subtitleTracks.SelectedIndexChanged += new System.EventHandler(this.drp_subtitleTracks_SelectedIndexChanged);
//
- // AudioTrackGroup
- //
- this.AudioTrackGroup.BackColor = System.Drawing.Color.Transparent;
- this.AudioTrackGroup.Controls.Add(this.label1);
- this.AudioTrackGroup.Controls.Add(this.check_default);
- this.AudioTrackGroup.Controls.Add(this.check_burned);
- this.AudioTrackGroup.Controls.Add(this.check_forced);
- this.AudioTrackGroup.Controls.Add(this.drp_subtitleTracks);
- 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, 50);
- this.AudioTrackGroup.TabIndex = 71;
- this.AudioTrackGroup.TabStop = false;
- this.AudioTrackGroup.Text = "Selected Track: New Track";
+ // 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.ForeColor = System.Drawing.Color.Black;
+ 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
//
@@ -139,7 +160,7 @@
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(133, 274);
+ this.btn_RemoveSubTrack.Location = new System.Drawing.Point(263, 274);
this.btn_RemoveSubTrack.Name = "btn_RemoveSubTrack";
this.btn_RemoveSubTrack.Size = new System.Drawing.Size(111, 23);
this.btn_RemoveSubTrack.TabIndex = 69;
@@ -154,16 +175,18 @@
this.col_Source,
this.forced,
this.burned,
- this.defaultTrack});
+ this.defaultTrack,
+ this.type,
+ this.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(17, 88);
+ this.lv_subList.Location = new System.Drawing.Point(17, 137);
this.lv_subList.MultiSelect = false;
this.lv_subList.Name = "lv_subList";
- this.lv_subList.Size = new System.Drawing.Size(688, 180);
+ this.lv_subList.Size = new System.Drawing.Size(688, 131);
this.lv_subList.TabIndex = 70;
this.lv_subList.UseCompatibleStateImageBehavior = false;
this.lv_subList.View = System.Windows.Forms.View.Details;
@@ -172,12 +195,12 @@
// id
//
this.id.Text = "Track ID";
- this.id.Width = 70;
+ this.id.Width = 65;
//
// col_Source
//
this.col_Source.Text = "Track";
- this.col_Source.Width = 250;
+ this.col_Source.Width = 150;
//
// forced
//
@@ -194,6 +217,16 @@
this.defaultTrack.Text = "Default";
this.defaultTrack.Width = 100;
//
+ // type
+ //
+ this.type.Text = "Type";
+ this.type.Width = 110;
+ //
+ // srtOffset
+ //
+ this.srtOffset.Text = "Srt Offset";
+ this.srtOffset.Width = 70;
+ //
// subMenu
//
this.subMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -242,11 +275,191 @@
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(16, 39);
+ 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.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.ForeColor = System.Drawing.Color.Black;
+ 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";
+ //
+ // srt_offset
+ //
+ this.srt_offset.Location = new System.Drawing.Point(402, 20);
+ this.srt_offset.Name = "srt_offset";
+ this.srt_offset.Size = new System.Drawing.Size(58, 21);
+ 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(486, 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(519, 18);
+ this.srt_browse.Name = "srt_browse";
+ this.srt_browse.Size = new System.Drawing.Size(111, 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
+ //
+ 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:";
+ //
+ // label3
+ //
+ 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:";
+ //
+ // srt_charcode
+ //
+ this.srt_charcode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.srt_charcode.FormattingEnabled = true;
+ this.srt_charcode.Items.AddRange(new object[] {
+ "ANSI_X3.4-1968",
+ "ANSI_X3.4-1986",
+ "ANSI_X3.4",
+ "ANSI_X3.110-1983",
+ "ANSI_X3.110",
+ "ASCII",
+ "ECMA-114",
+ "ECMA-118",
+ "ECMA-128",
+ "ECMA-CYRILLIC",
+ "IEC_P27-1",
+ "ISO-8859-1",
+ "ISO-8859-2",
+ "ISO-8859-3",
+ "ISO-8859-4",
+ "ISO-8859-5",
+ "ISO-8859-6",
+ "ISO-8859-7",
+ "ISO-8859-8",
+ "ISO-8859-9",
+ "ISO-8859-9E",
+ "ISO-8859-10",
+ "ISO-8859-11",
+ "ISO-8859-13",
+ "ISO-8859-14",
+ "ISO-8859-15",
+ "ISO-8859-16",
+ "UTF-7",
+ "UTF-8",
+ "UTF-16",
+ "UTF-32"});
+ this.srt_charcode.Location = new System.Drawing.Point(270, 20);
+ 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
+ //
+ 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:";
+ //
+ // srt_lang
+ //
+ 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);
+ //
+ // 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(133, 274);
+ this.btn_srtAdd.Name = "btn_srtAdd";
+ this.btn_srtAdd.Size = new System.Drawing.Size(124, 23);
+ this.btn_srtAdd.TabIndex = 73;
+ this.btn_srtAdd.Text = "Add External SRT";
+ this.btn_srtAdd.UseVisualStyleBackColor = false;
+ this.btn_srtAdd.Click += new System.EventHandler(this.btn_srtAdd_Click);
+ //
+ // openFileDialog
+ //
+ this.openFileDialog.DefaultExt = "srt";
+ this.openFileDialog.Filter = "SRT Files |*.srt";
+ //
// Subtitles
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent;
- this.Controls.Add(this.AudioTrackGroup);
+ this.Controls.Add(this.btn_srtAdd);
+ this.Controls.Add(this.tabControl1);
this.Controls.Add(this.btn_RemoveSubTrack);
this.Controls.Add(this.lv_subList);
this.Controls.Add(this.label68);
@@ -254,9 +467,15 @@
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.AudioTrackGroup.ResumeLayout(false);
- this.AudioTrackGroup.PerformLayout();
+ 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();
+ ((System.ComponentModel.ISupportInitialize)(this.srt_offset)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -265,7 +484,7 @@
#endregion
internal System.Windows.Forms.ComboBox drp_subtitleTracks;
- private System.Windows.Forms.GroupBox AudioTrackGroup;
+ private System.Windows.Forms.GroupBox SubTitlesGroup;
private System.Windows.Forms.Button btn_RemoveSubTrack;
private System.Windows.Forms.Button btn_addSubTrack;
internal System.Windows.Forms.ListView lv_subList;
@@ -284,5 +503,21 @@
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.Label label4;
+ private System.Windows.Forms.Label label3;
+ internal System.Windows.Forms.ComboBox srt_charcode;
+ private System.Windows.Forms.Label label2;
+ internal System.Windows.Forms.ComboBox srt_lang;
+ private System.Windows.Forms.NumericUpDown srt_offset;
+ private System.Windows.Forms.OpenFileDialog openFileDialog;
}
}
diff --git a/win/C#/Controls/Subtitles.cs b/win/C#/Controls/Subtitles.cs
index 9358a7942..c4068fa3d 100644
--- a/win/C#/Controls/Subtitles.cs
+++ b/win/C#/Controls/Subtitles.cs
@@ -1,15 +1,26 @@
using System;
+using System.Collections.Generic;
using System.Windows.Forms;
+using Handbrake.Functions;
+using System.IO;
namespace Handbrake.Controls
{
public partial class Subtitles : UserControl
{
+ IDictionary<string, string> LangMap = new Dictionary<string, string>();
+
public Subtitles()
{
InitializeComponent();
+ LangMap = Main.mapLanguages();
+ foreach (string key in LangMap.Keys)
+ srt_lang.Items.Add(key);
+
+ srt_charcode.SelectedIndex = 28;
+ srt_lang.SelectedIndex = 40;
}
private int fileContainer;
@@ -55,22 +66,28 @@ namespace Handbrake.Controls
}
Boolean addTrack = true;
- if (fileContainer == 0 || fileContainer == 1)
+ if (fileContainer == 0)
{
burnedVal = "Yes"; // MP4 must have bitmap subs burned in.
// Make sure we only have 1 bitmap track.
- if (drp_subtitleTracks.SelectedItem.ToString().Contains("Bitmap"))
- foreach (ListViewItem item in lv_subList.Items)
- {
- if (item.SubItems[1].Text.Contains("Bitmap"))
+ if (drp_subtitleTracks.SelectedItem != null)
+ {
+ if (drp_subtitleTracks.SelectedItem.ToString().Contains("Bitmap"))
+ foreach (ListViewItem item in lv_subList.Items)
{
- 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;
+ 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;
+ }
}
- }
+ }
+ else
+ addTrack = false;
+
}
// Add the track if allowed.
@@ -86,6 +103,23 @@ namespace Handbrake.Controls
lv_subList.Items.Add(newTrack);
}
}
+ private void btn_srtAdd_Click(object sender, EventArgs e)
+ {
+ 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("No");
+ if (openFileDialog.FileName != null)
+ newTrack.SubItems.Add(openFileDialog.FileName);
+ else
+ newTrack.SubItems.Add("None");
+
+ newTrack.SubItems.Add(srt_offset.Value.ToString());
+
+ lv_subList.Items.Add(newTrack);
+ }
private void btn_RemoveSubTrack_Click(object sender, EventArgs e)
{
removeTrack();
@@ -95,36 +129,48 @@ namespace Handbrake.Controls
// Set the dropdown controls based on the selected item in the List.
if (lv_subList.Items.Count != 0 && lv_subList.SelectedIndices.Count != 0)
{
- // Reset the checkboxes
- check_forced.CheckState = CheckState.Unchecked;
- check_burned.CheckState = CheckState.Unchecked;
- check_default.CheckState = CheckState.Unchecked;
-
- // Setup the controls
- int c = 0;
- foreach (var item in drp_subtitleTracks.Items)
+ if (lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems.Count != 5) // We have an SRT
{
- if (item.ToString() == lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text)
- drp_subtitleTracks.SelectedIndex = c;
- c++;
- }
- drp_subtitleTracks.SelectedItem = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1];
+ 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();
- if (lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[2].Text == "Yes")
- check_forced.CheckState = CheckState.Checked;
+ int offsetVal;
+ int.TryParse(lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[6].Text, out offsetVal);
+ srt_offset.Value = offsetVal;
- if (lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[3].Text == "Yes")
- check_burned.CheckState = CheckState.Checked;
+ SRTGroup.Text = "Selected Track: " + lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text;
+ SubTitlesGroup.Text = "Selected Track: None";
+ }
+ 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)
+ drp_subtitleTracks.SelectedIndex = c;
+ c++;
+ }
+ drp_subtitleTracks.SelectedItem = lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1];
- if (lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[4].Text == "Yes")
- check_default.CheckState = CheckState.Checked;
+ 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;
- AudioTrackGroup.Text = "Selected Track: " + lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text;
+ SubTitlesGroup.Text = "Selected Track: " + lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text;
+ SRTGroup.Text = "Selected Track: None";
+ }
}
else
- AudioTrackGroup.Text = "Selected Track: None (Click \"Add Track\" to add)";
+ {
+ SubTitlesGroup.Text = "Selected Track: None (Click \"Add Track\" to add)";
+ SRTGroup.Text = "Selected Track: None (Click \"Add External SRT\" to add) ";
+ }
}
+ // Bitmap / CC Controls
private void drp_subtitleTracks_SelectedIndexChanged(object sender, EventArgs e)
{
// Update an item in the list if required.
@@ -167,7 +213,45 @@ namespace Handbrake.Controls
lv_subList.Select();
}
}
-
+
+ // SRT Controls
+ 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();
+ }
+ }
+ 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(',');
+
+ lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[1].Text = trackData[0].Trim() + ", (" + srt_charcode.SelectedItem + ")";
+ lv_subList.Select();
+ }
+ }
+ 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();
+
+ 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();
+ }
+
// Right Click Menu
private void mnu_moveup_Click(object sender, EventArgs e)
{
@@ -265,5 +349,6 @@ namespace Handbrake.Controls
i++;
}
}
+
}
}
diff --git a/win/C#/Controls/Subtitles.resx b/win/C#/Controls/Subtitles.resx
index 4a57b1229..a13cf9f6f 100644
--- a/win/C#/Controls/Subtitles.resx
+++ b/win/C#/Controls/Subtitles.resx
@@ -120,4 +120,7 @@
<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="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>113, 17</value>
+ </metadata>
</root> \ No newline at end of file