diff options
-rw-r--r-- | win/C#/Controls/Subtitles.Designer.cs | 44 | ||||
-rw-r--r-- | win/C#/Functions/Main.cs | 34 | ||||
-rw-r--r-- | win/C#/frmMain.Designer.cs | 47 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 12 | ||||
-rw-r--r-- | win/C#/frmMain.resx | 18 |
5 files changed, 123 insertions, 32 deletions
diff --git a/win/C#/Controls/Subtitles.Designer.cs b/win/C#/Controls/Subtitles.Designer.cs index 0ea0875ae..6e3be689b 100644 --- a/win/C#/Controls/Subtitles.Designer.cs +++ b/win/C#/Controls/Subtitles.Designer.cs @@ -55,6 +55,7 @@ this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.SRTGroup = new System.Windows.Forms.GroupBox();
+ this.check_default_srt = new System.Windows.Forms.CheckBox();
this.srt_offset = new System.Windows.Forms.NumericUpDown();
this.label5 = new System.Windows.Forms.Label();
this.srt_browse = new System.Windows.Forms.Button();
@@ -65,7 +66,7 @@ this.srt_lang = new System.Windows.Forms.ComboBox();
this.btn_srtAdd = new System.Windows.Forms.Button();
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
- this.check_default_srt = new System.Windows.Forms.CheckBox();
+ this.label6 = new System.Windows.Forms.Label();
this.SubTitlesGroup.SuspendLayout();
this.subMenu.SuspendLayout();
this.tabControl1.SuspendLayout();
@@ -189,7 +190,7 @@ this.lv_subList.Name = "lv_subList";
this.lv_subList.Size = new System.Drawing.Size(688, 131);
this.lv_subList.TabIndex = 70;
- //this.lv_subList.UseCompatibleStateImageBehavior = false;
+ 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);
//
@@ -312,6 +313,7 @@ // 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);
@@ -329,9 +331,30 @@ this.SRTGroup.TabStop = false;
this.SRTGroup.Text = "Selected Track: New Track";
//
+ // 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);
+ //
// srt_offset
//
+ 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.Maximum = new decimal(new int[] {
+ 1000000000,
+ 0,
+ 0,
+ 0});
this.srt_offset.Name = "srt_offset";
this.srt_offset.Size = new System.Drawing.Size(58, 21);
this.srt_offset.TabIndex = 79;
@@ -456,16 +479,14 @@ this.openFileDialog.DefaultExt = "srt";
this.openFileDialog.Filter = "SRT Files |*.srt";
//
- // check_default_srt
+ // label6
//
- this.check_default_srt.AutoSize = true;
- this.check_default_srt.Location = new System.Drawing.Point(470, 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);
+ 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";
//
// Subtitles
//
@@ -533,5 +554,6 @@ 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;
}
}
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index 987876e56..9a8b9a02f 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -80,6 +80,40 @@ namespace Handbrake.Functions return dataChpt;
}
+ public static DataGridView importChapterNames(DataGridView dataChpt, string filename)
+ {
+ IDictionary<int, string> chapterMap = new Dictionary<int, string>();
+ try
+ {
+ StreamReader sr = new StreamReader(filename);
+ string csv = sr.ReadLine();
+ while (csv != null)
+ {
+ if (csv.Trim() != "")
+ {
+ string[] contents = csv.Split(',');
+ int chapter;
+ int.TryParse(contents[0], out chapter);
+ chapterMap.Add(chapter, contents[1]);
+ }
+ csv = sr.ReadLine();
+ }
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+
+ foreach (DataGridViewRow item in dataChpt.Rows)
+ {
+ string name;
+ chapterMap.TryGetValue((int)item.Cells[0].Value, out name);
+ item.Cells[1].Value = name ?? "Chapter " + item.Cells[0].Value;
+ }
+
+ return dataChpt;
+ }
+
/// <summary>
/// Function which generates the filename and path automatically based on
/// the Source Name, DVD title and DVD Chapters
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index c5d09ae24..0ecb055ca 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -40,7 +40,7 @@ namespace Handbrake this.components = new System.ComponentModel.Container();
System.Windows.Forms.ContextMenuStrip notifyIconMenu;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.btn_restore = new System.Windows.Forms.ToolStripMenuItem();
this.DVD_Save = new System.Windows.Forms.SaveFileDialog();
this.ToolTip = new System.Windows.Forms.ToolTip(this.components);
@@ -82,6 +82,7 @@ namespace Handbrake this.mnu_delete_preset = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
this.btn_new_preset = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnu_importMacPreset = new System.Windows.Forms.ToolStripMenuItem();
this.mnu_SelectDefault = new System.Windows.Forms.ToolStripMenuItem();
this.HelpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnu_user_guide = new System.Windows.Forms.ToolStripMenuItem();
@@ -163,13 +164,14 @@ namespace Handbrake this.labelSource = new System.Windows.Forms.Label();
this.labelStaticSource = new System.Windows.Forms.Label();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
- this.mnu_importMacPreset = new System.Windows.Forms.ToolStripMenuItem();
this.openPreset = new System.Windows.Forms.OpenFileDialog();
+ this.btn_importChapters = new System.Windows.Forms.Button();
this.PictureSettings = new Handbrake.Controls.PictureSettings();
this.Filters = new Handbrake.Controls.Filters();
this.AudioSettings = new Handbrake.Controls.AudioPanel();
this.Subtitles = new Handbrake.Controls.Subtitles();
this.x264Panel = new Handbrake.Controls.x264Panel();
+ this.File_ChapterImport = new System.Windows.Forms.OpenFileDialog();
notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
notifyIconMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();
@@ -392,9 +394,9 @@ namespace Handbrake //
// number
//
- dataGridViewCellStyle3.Format = "N0";
- dataGridViewCellStyle3.NullValue = null;
- this.number.DefaultCellStyle = dataGridViewCellStyle3;
+ dataGridViewCellStyle1.Format = "N0";
+ dataGridViewCellStyle1.NullValue = null;
+ this.number.DefaultCellStyle = dataGridViewCellStyle1;
this.number.Frozen = true;
this.number.HeaderText = "Chapter Number";
this.number.MaxInputLength = 3;
@@ -625,6 +627,13 @@ namespace Handbrake this.btn_new_preset.Text = "New Preset";
this.btn_new_preset.Click += new System.EventHandler(this.btn_new_preset_Click);
//
+ // mnu_importMacPreset
+ //
+ this.mnu_importMacPreset.Name = "mnu_importMacPreset";
+ this.mnu_importMacPreset.Size = new System.Drawing.Size(194, 22);
+ this.mnu_importMacPreset.Text = "Import";
+ this.mnu_importMacPreset.Click += new System.EventHandler(this.mnu_importMacPreset_Click);
+ //
// mnu_SelectDefault
//
this.mnu_SelectDefault.Name = "mnu_SelectDefault";
@@ -943,6 +952,7 @@ namespace Handbrake // tab_chapters
//
this.tab_chapters.BackColor = System.Drawing.Color.Transparent;
+ this.tab_chapters.Controls.Add(this.btn_importChapters);
this.tab_chapters.Controls.Add(this.label31);
this.tab_chapters.Controls.Add(this.data_chpt);
this.tab_chapters.Controls.Add(this.Check_ChapterMarkers);
@@ -1340,6 +1350,7 @@ namespace Handbrake this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 29F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(723, 29);
this.tableLayoutPanel2.TabIndex = 50;
//
@@ -1525,18 +1536,24 @@ namespace Handbrake this.flowLayoutPanel1.Size = new System.Drawing.Size(195, 13);
this.flowLayoutPanel1.TabIndex = 55;
//
- // mnu_importMacPreset
- //
- this.mnu_importMacPreset.Name = "mnu_importMacPreset";
- this.mnu_importMacPreset.Size = new System.Drawing.Size(194, 22);
- this.mnu_importMacPreset.Text = "Import";
- this.mnu_importMacPreset.Click += new System.EventHandler(this.mnu_importMacPreset_Click);
- //
// openPreset
//
this.openPreset.DefaultExt = "plist";
this.openPreset.Filter = "Plist Files|*.plist";
//
+ // btn_importChapters
+ //
+ this.btn_importChapters.AutoSize = true;
+ this.btn_importChapters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn_importChapters.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.btn_importChapters.Location = new System.Drawing.Point(625, 26);
+ this.btn_importChapters.Name = "btn_importChapters";
+ this.btn_importChapters.Size = new System.Drawing.Size(75, 23);
+ this.btn_importChapters.TabIndex = 14;
+ this.btn_importChapters.Text = "Import";
+ this.btn_importChapters.UseVisualStyleBackColor = true;
+ this.btn_importChapters.Click += new System.EventHandler(this.btn_importChapters_Click);
+ //
// PictureSettings
//
this.PictureSettings.BackColor = System.Drawing.Color.Transparent;
@@ -1584,6 +1601,10 @@ namespace Handbrake this.x264Panel.TabIndex = 0;
this.x264Panel.x264Query = "";
//
+ // File_ChapterImport
+ //
+ this.File_ChapterImport.Filter = "CSV Files|*.csv";
+ //
// frmMain
//
this.AllowDrop = true;
@@ -1777,5 +1798,7 @@ namespace Handbrake private FlowLayoutPanel flowLayoutPanel1;
private ToolStripMenuItem mnu_importMacPreset;
private OpenFileDialog openPreset;
+ private Button btn_importChapters;
+ private OpenFileDialog File_ChapterImport;
}
}
\ No newline at end of file diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 97f2cb500..a28597c55 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -1341,6 +1341,7 @@ namespace Handbrake setExtension(".m4v");
data_chpt.Rows.Clear();
data_chpt.Enabled = true;
+ btn_importChapters.Enabled = true;
DataGridView chapterGridView = Main.chapterNaming(data_chpt, drop_chapterFinish.Text);
if (chapterGridView != null)
data_chpt = chapterGridView;
@@ -1351,6 +1352,17 @@ namespace Handbrake setExtension(".mp4");
data_chpt.Rows.Clear();
data_chpt.Enabled = false;
+ btn_importChapters.Enabled = false;
+ }
+ }
+ private void btn_importChapters_Click(object sender, EventArgs e)
+ {
+ if (File_ChapterImport.ShowDialog() == DialogResult.OK)
+ {
+ String filename = File_ChapterImport.FileName;
+ DataGridView imported = Main.importChapterNames(data_chpt, filename);
+ if (imported != null)
+ data_chpt = imported;
}
}
diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx index 0a115b4ea..00495e0fd 100644 --- a/win/C#/frmMain.resx +++ b/win/C#/frmMain.resx @@ -571,15 +571,6 @@ Note: Do not change any of the chapter numbers!</value> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>98</value>
</metadata>
- <metadata name="File_Save.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>664, 15</value>
- </metadata>
- <metadata name="openPreset.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>680, 54</value>
- </metadata>
- <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>98</value>
- </metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAYAMDAAAAEACACoDgAAZgAAACAgAAABAAgAqAgAAA4PAAAQEAAAAQAIAGgFAAC2FwAAMDAAAAEA
@@ -959,4 +950,13 @@ Note: Do not change any of the chapter numbers!</value> AAD6AQAA4AEAAMABAACAAQAAgAEAAMBBAADAYQAAjGEAAIRhAADc+wAA3/8AAA==
</value>
</data>
+ <metadata name="File_Save.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>664, 15</value>
+ </metadata>
+ <metadata name="openPreset.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>680, 54</value>
+ </metadata>
+ <metadata name="File_ChapterImport.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>787, 54</value>
+ </metadata>
</root>
\ No newline at end of file |