Ext properties for "iTunesTimedText" - thx Moisés :)

This commit is contained in:
niksedk 2021-10-27 17:38:36 +02:00
parent 3d65ff0e01
commit b9df7bd4d2
8 changed files with 1045 additions and 16 deletions

View File

@ -618,6 +618,10 @@ namespace Nikse.SubtitleEdit.Core.Common
public string TimedText10TimeCodeFormatSource { get; set; } public string TimedText10TimeCodeFormatSource { get; set; }
public bool TimedText10ShowStyleAndLanguage { get; set; } public bool TimedText10ShowStyleAndLanguage { get; set; }
public string TimedText10FileExtension { get; set; } public string TimedText10FileExtension { get; set; }
public string TimedTextItunesTopOrigin { get; set; }
public string TimedTextItunesTopExtent { get; set; }
public string TimedTextItunesBottomOrigin { get; set; }
public string TimedTextItunesBottomExtent { get; set; }
public int FcpFontSize { get; set; } public int FcpFontSize { get; set; }
public string FcpFontName { get; set; } public string FcpFontName { get; set; }
@ -692,6 +696,11 @@ $HorzAlign = Center
TimedText10ShowStyleAndLanguage = true; TimedText10ShowStyleAndLanguage = true;
TimedText10FileExtension = ".xml"; TimedText10FileExtension = ".xml";
TimedTextItunesTopOrigin = "0% 0%";
TimedTextItunesTopExtent = "100% 15%";
TimedTextItunesBottomOrigin = "0% 85%";
TimedTextItunesBottomExtent = "100% 15%";
FcpFontSize = 18; FcpFontSize = 18;
FcpFontName = "Lucida Grande"; FcpFontName = "Lucida Grande";
@ -5650,6 +5659,30 @@ $HorzAlign = Center
settings.SubtitleSettings.TimedText10FileExtension = subNode.InnerText; settings.SubtitleSettings.TimedText10FileExtension = subNode.InnerText;
} }
subNode = node.SelectSingleNode("TimedTextItunesTopOrigin");
if (subNode != null)
{
settings.SubtitleSettings.TimedTextItunesTopOrigin = subNode.InnerText;
}
subNode = node.SelectSingleNode("TimedTextItunesTopExtent");
if (subNode != null)
{
settings.SubtitleSettings.TimedTextItunesTopExtent = subNode.InnerText;
}
subNode = node.SelectSingleNode("TimedTextItunesBottomOrigin");
if (subNode != null)
{
settings.SubtitleSettings.TimedTextItunesBottomOrigin = subNode.InnerText;
}
subNode = node.SelectSingleNode("TimedTextItunesBottomExtent");
if (subNode != null)
{
settings.SubtitleSettings.TimedTextItunesBottomExtent = subNode.InnerText;
}
subNode = node.SelectSingleNode("FcpFontSize"); subNode = node.SelectSingleNode("FcpFontSize");
if (subNode != null) if (subNode != null)
{ {
@ -9252,6 +9285,10 @@ $HorzAlign = Center
textWriter.WriteElementString("TimedText10TimeCodeFormat", settings.SubtitleSettings.TimedText10TimeCodeFormat); textWriter.WriteElementString("TimedText10TimeCodeFormat", settings.SubtitleSettings.TimedText10TimeCodeFormat);
textWriter.WriteElementString("TimedText10ShowStyleAndLanguage", settings.SubtitleSettings.TimedText10ShowStyleAndLanguage.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("TimedText10ShowStyleAndLanguage", settings.SubtitleSettings.TimedText10ShowStyleAndLanguage.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("TimedText10FileExtension", settings.SubtitleSettings.TimedText10FileExtension); textWriter.WriteElementString("TimedText10FileExtension", settings.SubtitleSettings.TimedText10FileExtension);
textWriter.WriteElementString("TimedTextItunesTopOrigin", settings.SubtitleSettings.TimedTextItunesTopOrigin);
textWriter.WriteElementString("TimedTextItunesTopExtent", settings.SubtitleSettings.TimedTextItunesTopExtent);
textWriter.WriteElementString("TimedTextItunesBottomOrigin", settings.SubtitleSettings.TimedTextItunesBottomOrigin);
textWriter.WriteElementString("TimedTextItunesBottomExtent", settings.SubtitleSettings.TimedTextItunesBottomExtent);
textWriter.WriteElementString("FcpFontSize", settings.SubtitleSettings.FcpFontSize.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("FcpFontSize", settings.SubtitleSettings.FcpFontSize.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("FcpFontName", settings.SubtitleSettings.FcpFontName); textWriter.WriteElementString("FcpFontName", settings.SubtitleSettings.FcpFontName);
textWriter.WriteElementString("Cavena890StartOfMessage", settings.SubtitleSettings.Cavena890StartOfMessage); textWriter.WriteElementString("Cavena890StartOfMessage", settings.SubtitleSettings.Cavena890StartOfMessage);

View File

@ -108,7 +108,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
} }
const string language = "en-US"; const string language = "en-US";
string xmlStructure = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + Environment.NewLine + var xmlStructure = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + Environment.NewLine +
"<tt xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.w3.org/ns/ttml\" xmlns:tt=\"http://www.w3.org/ns/ttml\" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\" xmlns:ttp=\"http://www.w3.org/ns/ttml#parameter\" xml:lang=\"" + language + "\" ttp:timeBase=\"smpte\" ttp:frameRate=\"" + frameRate + "\" ttp:frameRateMultiplier=\"" + frameRateMultiplier + "\" ttp:dropMode=\"" + dropMode + "\">" + Environment.NewLine + "<tt xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.w3.org/ns/ttml\" xmlns:tt=\"http://www.w3.org/ns/ttml\" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\" xmlns:ttp=\"http://www.w3.org/ns/ttml#parameter\" xml:lang=\"" + language + "\" ttp:timeBase=\"smpte\" ttp:frameRate=\"" + frameRate + "\" ttp:frameRateMultiplier=\"" + frameRateMultiplier + "\" ttp:dropMode=\"" + dropMode + "\">" + Environment.NewLine +
" <head>" + Environment.NewLine + " <head>" + Environment.NewLine +
" <styling>" + Environment.NewLine + " <styling>" + Environment.NewLine +
@ -117,14 +117,15 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
" <style tts:fontSize=\"100%\" tts:color=\"white\" tts:fontStyle=\"italic\" tts:fontWeight=\"normal\" tts:fontFamily=\"sansSerif\" xml:id=\"italic\"/>" + Environment.NewLine + " <style tts:fontSize=\"100%\" tts:color=\"white\" tts:fontStyle=\"italic\" tts:fontWeight=\"normal\" tts:fontFamily=\"sansSerif\" xml:id=\"italic\"/>" + Environment.NewLine +
" </styling>" + Environment.NewLine + " </styling>" + Environment.NewLine +
" <layout>" + Environment.NewLine + " <layout>" + Environment.NewLine +
" <region xml:id=\"top\" tts:origin=\"0% 0%\" tts:extent=\"100% 15%\" tts:textAlign=\"center\" tts:displayAlign=\"before\"/>" + Environment.NewLine + " <region xml:id=\"top\" tts:origin=\"" + Configuration.Settings.SubtitleSettings.TimedTextItunesTopOrigin + "\" tts:extent=\"" + Configuration.Settings.SubtitleSettings.TimedTextItunesTopExtent + "]\" tts:textAlign=\"center\" tts:displayAlign=\"before\"/>" + Environment.NewLine +
" <region xml:id=\"bottom\" tts:origin=\"0% 85%\" tts:extent=\"100% 15%\" tts:textAlign=\"center\" tts:displayAlign=\"after\"/>" + Environment.NewLine + " <region xml:id=\"bottom\" tts:origin=\"" + Configuration.Settings.SubtitleSettings.TimedTextItunesBottomOrigin + "\" tts:extent=\"" + Configuration.Settings.SubtitleSettings.TimedTextItunesBottomExtent + "\" tts:textAlign=\"center\" tts:displayAlign=\"after\"/>" + Environment.NewLine +
" </layout>" + Environment.NewLine + " </layout>" + Environment.NewLine +
" </head>" + Environment.NewLine + " </head>" + Environment.NewLine +
" <body>" + Environment.NewLine + " <body>" + Environment.NewLine +
" <div />" + Environment.NewLine + " <div />" + Environment.NewLine +
" </body>" + Environment.NewLine + " </body>" + Environment.NewLine +
"</tt>"; "</tt>";
if (styleHead == null) if (styleHead == null)
{ {
xml.LoadXml(xmlStructure); xml.LoadXml(xmlStructure);
@ -152,6 +153,39 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{ {
divNode.RemoveChild(child); divNode.RemoveChild(child);
} }
foreach (XmlNode child in xml.DocumentElement.SelectNodes("//ttml:region", nsmgr))
{
var id = child.Attributes["xml:id"];
if (id?.Value == "top")
{
var originAttr = child.Attributes["tts:origin"];
if (originAttr != null && !string.IsNullOrEmpty(Configuration.Settings.SubtitleSettings.TimedTextItunesTopOrigin))
{
originAttr.Value = Configuration.Settings.SubtitleSettings.TimedTextItunesTopOrigin;
}
var extentAttr = child.Attributes["tts:extent"];
if (extentAttr != null && !string.IsNullOrEmpty(Configuration.Settings.SubtitleSettings.TimedTextItunesTopExtent))
{
extentAttr.Value = Configuration.Settings.SubtitleSettings.TimedTextItunesTopExtent;
}
}
else if (id?.Value == "bottom")
{
var originAttr = child.Attributes["tts:origin"];
if (originAttr != null && !string.IsNullOrEmpty(Configuration.Settings.SubtitleSettings.TimedTextItunesBottomOrigin))
{
originAttr.Value = Configuration.Settings.SubtitleSettings.TimedTextItunesBottomOrigin;
}
var extentAttr = child.Attributes["tts:extent"];
if (extentAttr != null && !string.IsNullOrEmpty(Configuration.Settings.SubtitleSettings.TimedTextItunesBottomExtent))
{
extentAttr.Value = Configuration.Settings.SubtitleSettings.TimedTextItunesBottomExtent;
}
}
}
} }
else else
{ {

View File

@ -28923,7 +28923,7 @@ namespace Nikse.SubtitleEdit.Forms
return; return;
} }
if (ft == typeof(TimedText10) || ft == typeof(ItunesTimedText)) if (ft == typeof(TimedText10))
{ {
using (var properties = new TimedTextProperties(_subtitle)) using (var properties = new TimedTextProperties(_subtitle))
{ {
@ -28933,6 +28933,16 @@ namespace Nikse.SubtitleEdit.Forms
return; return;
} }
if (ft == typeof(ItunesTimedText))
{
using (var properties = new TimedTextPropertiesItunes(_subtitle))
{
properties.ShowDialog(this);
}
return;
}
if (ft == typeof(WebVTT) || ft == typeof(WebVTTFileWithLineNumber)) if (ft == typeof(WebVTT) || ft == typeof(WebVTTFileWithLineNumber))
{ {
using (var properties = new WebVttProperties()) using (var properties = new WebVttProperties())

View File

@ -538,17 +538,17 @@
<data name="toolStripButtonAssaDraw.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="toolStripButtonAssaDraw.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIvSURBVFhH1ZZNSxtRFIaH4qYFXUjtQqNW3YkbP0D0P/gz YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIwSURBVFhH1ZZNSxtRFIaH0o2FdiFmY2P92pVu+gGl/Q/+
6qbY2Nj8DBeSxExCNi6E+BE3/oguFBS6sV22UbBdVOiqhDB9z8k98XZyTObOqOgDDzN3Jve+79yEId6z jLqRGE2bn9FFSdJMQjYuhPgRN/0RXVSI4EZdahTUhYWuSgjT95zck9xOTpK5M1XqAw8zdyb3vu/chCHe
w/f9oFQqOWmmJqdcLgdxuLcStBCzOh9dkKiAbGMul2MZLeguQawC7afthhYYFjgXsMM9nHbom5uEFmoL vcP3/aBSqThppianWq0GcfhnJWghZvl1dEGiArKNhUKBZbSgYYJYBXpPOwotMCxwLmCHezgd0Dc3CS3U
nArQr1xQwy3baMEicCrQbDZ5khaoyVz/0MNJELmAbD1tsRamus1T9HASuBcIh/SQ0cJJELuA4OVvr2ky FjgVoF+5oIZb9tCCReBUoNPp8CQtUJO5PNPDSRC5gGw9bbEWpvqVp+jhJHAvEA4ZI6OFkyB2AcEr9q9p
WjgJYhXY/canwfHXTT6GQ20ZLZwEsQoQ/sm7oHS6yuff/3QGi4wWToLIBSqVCk8QKFwktPDxXb7VlcgF Mlo4CWIV2Dzh0+Db8Wc+hkNtGS2cBLEKEP6PD0Flf5nPT38NBouMFk6CyAVqtRpPEChcJLTw2U2+NZLI
iFqt1ppkhUsBIlyAqFarHHKXZuneFIvF360lOwtIiXA4gZ27MUsko1Ao8IJaOClkP5sTYD/h4dTb4DKz BYhGo9GdZIVLASJcgKjX6xwyTLP0eMrl8k13ycECUiIcTmDnfpolklEqlXhBLZwU8t/NCbCfcHdxLjjP
zppL0aGFiJ2zjBouCvl8nsK/mOmMXeD6U8athFlXDbXdOdtofS703R4hnAocTI6774I8vRaoSTQajf8C rbHmUnRoIWKjmVPDRaFYLFL4oZnO2AUuP+XcSph11VDbjebH7udC3+0ewqnAzsKs+y7I02uBmkS73f4r
KJzcS6VeSoF6Op01t7sjBVwx0739idSWFKBxPfPhPNYuuIj/h7/M1PbTH0yOXphLnnOBJNhPL9Q/pt1/ gMLJrXR6Qgq0stm8uT0aKeCKme5tz6e/SAEat3KrB7F2wUX8P7w2U3tPv7Mwc2Quec4FkmA/vdBaz7r/
C3GQcPbN0F/bxy8QUgo8WAkt1HZ/YuxxCpihihT4mXV8MfXiCC+cKAWu1t8vPMguSLg/OryC4QAchK/h FuIg4Wwq9dv27guElAK3VkILtd2ef3Y3BcxQRQpc5R1fTOPYwwsnSoGLtZU3t7ILEu7PTC9h+AROwimY
kDnSuB/evpjW1pYxTkwffAUpYAROwRk4CxfhkjnOwWlI94chfZ7mvYBPBc/7B98YfDIEc675AAAAAElF MkcaP4b9F1Mm8x7jxDyEjyAFPIWL8AV8Cd/Cd+b4Cj6HdH8a0udp3gP4v+B5fwDQSHwuTdPangAAAABJ
TkSuQmCC RU5ErkJggg==
</value> </value>
</data> </data>
<data name="toolStripButtonNetflixQualityCheck.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="toolStripButtonNetflixQualityCheck.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -791,7 +791,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAfwBKwH8ASsBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo CAAAAk1TRnQBSQFMAgEBAgEAAQwBLAEMASwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -0,0 +1,490 @@
namespace Nikse.SubtitleEdit.Forms
{
partial class TimedTextPropertiesItunes
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxOptions = new System.Windows.Forms.GroupBox();
this.groupBoxAlignment = new System.Windows.Forms.GroupBox();
this.textBoxTopExtent = new System.Windows.Forms.TextBox();
this.labelTopExtent = new System.Windows.Forms.Label();
this.textBoxTopOrigin = new System.Windows.Forms.TextBox();
this.labelTopOrigin = new System.Windows.Forms.Label();
this.comboBoxFileExtensions = new System.Windows.Forms.ComboBox();
this.labelFileExtension = new System.Windows.Forms.Label();
this.comboBoxTimeCodeFormat = new System.Windows.Forms.ComboBox();
this.labelTimeCode = new System.Windows.Forms.Label();
this.comboBoxFrameRateMultiplier = new System.Windows.Forms.ComboBox();
this.textBoxDescription = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.textBoxTitle = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.comboBoxDefaultRegion = new System.Windows.Forms.ComboBox();
this.labelDefaultRegion = new System.Windows.Forms.Label();
this.comboBoxDropMode = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.comboBoxFrameRate = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.comboBoxTimeBase = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.comboBoxLanguage = new System.Windows.Forms.ComboBox();
this.labelCollision = new System.Windows.Forms.Label();
this.comboBoxDefaultStyle = new System.Windows.Forms.ComboBox();
this.labelWrapStyle = new System.Windows.Forms.Label();
this.textBoxBottomExtent = new System.Windows.Forms.TextBox();
this.labelBottomExtent = new System.Windows.Forms.Label();
this.textBoxBottomOrigin = new System.Windows.Forms.TextBox();
this.labelBottomOrigin = new System.Windows.Forms.Label();
this.groupBoxOptions.SuspendLayout();
this.groupBoxAlignment.SuspendLayout();
this.SuspendLayout();
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.Location = new System.Drawing.Point(745, 401);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 1;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(826, 401);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 2;
this.buttonCancel.Text = "C&ancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// groupBoxOptions
//
this.groupBoxOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxOptions.Controls.Add(this.groupBoxAlignment);
this.groupBoxOptions.Controls.Add(this.comboBoxFileExtensions);
this.groupBoxOptions.Controls.Add(this.labelFileExtension);
this.groupBoxOptions.Controls.Add(this.comboBoxTimeCodeFormat);
this.groupBoxOptions.Controls.Add(this.labelTimeCode);
this.groupBoxOptions.Controls.Add(this.comboBoxFrameRateMultiplier);
this.groupBoxOptions.Controls.Add(this.textBoxDescription);
this.groupBoxOptions.Controls.Add(this.label7);
this.groupBoxOptions.Controls.Add(this.textBoxTitle);
this.groupBoxOptions.Controls.Add(this.label6);
this.groupBoxOptions.Controls.Add(this.comboBoxDefaultRegion);
this.groupBoxOptions.Controls.Add(this.labelDefaultRegion);
this.groupBoxOptions.Controls.Add(this.comboBoxDropMode);
this.groupBoxOptions.Controls.Add(this.label4);
this.groupBoxOptions.Controls.Add(this.label3);
this.groupBoxOptions.Controls.Add(this.comboBoxFrameRate);
this.groupBoxOptions.Controls.Add(this.label2);
this.groupBoxOptions.Controls.Add(this.comboBoxTimeBase);
this.groupBoxOptions.Controls.Add(this.label1);
this.groupBoxOptions.Controls.Add(this.comboBoxLanguage);
this.groupBoxOptions.Controls.Add(this.labelCollision);
this.groupBoxOptions.Controls.Add(this.comboBoxDefaultStyle);
this.groupBoxOptions.Controls.Add(this.labelWrapStyle);
this.groupBoxOptions.Location = new System.Drawing.Point(12, 12);
this.groupBoxOptions.Name = "groupBoxOptions";
this.groupBoxOptions.Size = new System.Drawing.Size(889, 383);
this.groupBoxOptions.TabIndex = 0;
this.groupBoxOptions.TabStop = false;
//
// groupBoxAlignment
//
this.groupBoxAlignment.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxAlignment.Controls.Add(this.textBoxBottomExtent);
this.groupBoxAlignment.Controls.Add(this.labelBottomExtent);
this.groupBoxAlignment.Controls.Add(this.textBoxBottomOrigin);
this.groupBoxAlignment.Controls.Add(this.labelBottomOrigin);
this.groupBoxAlignment.Controls.Add(this.textBoxTopExtent);
this.groupBoxAlignment.Controls.Add(this.labelTopExtent);
this.groupBoxAlignment.Controls.Add(this.textBoxTopOrigin);
this.groupBoxAlignment.Controls.Add(this.labelTopOrigin);
this.groupBoxAlignment.Location = new System.Drawing.Point(485, 30);
this.groupBoxAlignment.Name = "groupBoxAlignment";
this.groupBoxAlignment.Size = new System.Drawing.Size(398, 337);
this.groupBoxAlignment.TabIndex = 23;
this.groupBoxAlignment.TabStop = false;
this.groupBoxAlignment.Text = "Alignment";
//
// textBoxTopExtent
//
this.textBoxTopExtent.Location = new System.Drawing.Point(135, 65);
this.textBoxTopExtent.Name = "textBoxTopExtent";
this.textBoxTopExtent.Size = new System.Drawing.Size(263, 20);
this.textBoxTopExtent.TabIndex = 19;
//
// labelTopExtent
//
this.labelTopExtent.AutoSize = true;
this.labelTopExtent.Location = new System.Drawing.Point(14, 68);
this.labelTopExtent.Name = "labelTopExtent";
this.labelTopExtent.Size = new System.Drawing.Size(58, 13);
this.labelTopExtent.TabIndex = 21;
this.labelTopExtent.Text = "Top extent";
//
// textBoxTopOrigin
//
this.textBoxTopOrigin.Location = new System.Drawing.Point(135, 39);
this.textBoxTopOrigin.Name = "textBoxTopOrigin";
this.textBoxTopOrigin.Size = new System.Drawing.Size(263, 20);
this.textBoxTopOrigin.TabIndex = 18;
//
// labelTopOrigin
//
this.labelTopOrigin.AutoSize = true;
this.labelTopOrigin.Location = new System.Drawing.Point(14, 42);
this.labelTopOrigin.Name = "labelTopOrigin";
this.labelTopOrigin.Size = new System.Drawing.Size(54, 13);
this.labelTopOrigin.TabIndex = 20;
this.labelTopOrigin.Text = "Top origin";
//
// comboBoxFileExtensions
//
this.comboBoxFileExtensions.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxFileExtensions.FormattingEnabled = true;
this.comboBoxFileExtensions.Items.AddRange(new object[] {
".xml",
".ttml",
".dfxp"});
this.comboBoxFileExtensions.Location = new System.Drawing.Point(191, 346);
this.comboBoxFileExtensions.Name = "comboBoxFileExtensions";
this.comboBoxFileExtensions.Size = new System.Drawing.Size(263, 21);
this.comboBoxFileExtensions.TabIndex = 21;
//
// labelFileExtension
//
this.labelFileExtension.AutoSize = true;
this.labelFileExtension.Location = new System.Drawing.Point(6, 349);
this.labelFileExtension.Name = "labelFileExtension";
this.labelFileExtension.Size = new System.Drawing.Size(71, 13);
this.labelFileExtension.TabIndex = 22;
this.labelFileExtension.Text = "File extension";
//
// comboBoxTimeCodeFormat
//
this.comboBoxTimeCodeFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxTimeCodeFormat.FormattingEnabled = true;
this.comboBoxTimeCodeFormat.Items.AddRange(new object[] {
"Source",
"Seconds",
"Milliseconds",
"Ticks",
"hh:mm:ss:ff",
"hh:mm:ss.ms",
"hh:mm:ss.ms-two-digits",
"hh:mm:ss,ms"});
this.comboBoxTimeCodeFormat.Location = new System.Drawing.Point(191, 309);
this.comboBoxTimeCodeFormat.Name = "comboBoxTimeCodeFormat";
this.comboBoxTimeCodeFormat.Size = new System.Drawing.Size(263, 21);
this.comboBoxTimeCodeFormat.TabIndex = 19;
//
// labelTimeCode
//
this.labelTimeCode.AutoSize = true;
this.labelTimeCode.Location = new System.Drawing.Point(6, 312);
this.labelTimeCode.Name = "labelTimeCode";
this.labelTimeCode.Size = new System.Drawing.Size(89, 13);
this.labelTimeCode.TabIndex = 20;
this.labelTimeCode.Text = "Time code format";
//
// comboBoxFrameRateMultiplier
//
this.comboBoxFrameRateMultiplier.FormattingEnabled = true;
this.comboBoxFrameRateMultiplier.Items.AddRange(new object[] {
"999 1000",
"1 1",
"1000 1001"});
this.comboBoxFrameRateMultiplier.Location = new System.Drawing.Point(191, 176);
this.comboBoxFrameRateMultiplier.Name = "comboBoxFrameRateMultiplier";
this.comboBoxFrameRateMultiplier.Size = new System.Drawing.Size(263, 21);
this.comboBoxFrameRateMultiplier.TabIndex = 18;
//
// textBoxDescription
//
this.textBoxDescription.Location = new System.Drawing.Point(191, 56);
this.textBoxDescription.Name = "textBoxDescription";
this.textBoxDescription.Size = new System.Drawing.Size(263, 20);
this.textBoxDescription.TabIndex = 1;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(6, 58);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(60, 13);
this.label7.TabIndex = 17;
this.label7.Text = "Description";
//
// textBoxTitle
//
this.textBoxTitle.Location = new System.Drawing.Point(191, 30);
this.textBoxTitle.Name = "textBoxTitle";
this.textBoxTitle.Size = new System.Drawing.Size(263, 20);
this.textBoxTitle.TabIndex = 0;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 32);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(27, 13);
this.label6.TabIndex = 15;
this.label6.Text = "Title";
//
// comboBoxDefaultRegion
//
this.comboBoxDefaultRegion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxDefaultRegion.FormattingEnabled = true;
this.comboBoxDefaultRegion.Location = new System.Drawing.Point(191, 270);
this.comboBoxDefaultRegion.Name = "comboBoxDefaultRegion";
this.comboBoxDefaultRegion.Size = new System.Drawing.Size(263, 21);
this.comboBoxDefaultRegion.TabIndex = 8;
//
// labelDefaultRegion
//
this.labelDefaultRegion.AutoSize = true;
this.labelDefaultRegion.Location = new System.Drawing.Point(6, 273);
this.labelDefaultRegion.Name = "labelDefaultRegion";
this.labelDefaultRegion.Size = new System.Drawing.Size(73, 13);
this.labelDefaultRegion.TabIndex = 12;
this.labelDefaultRegion.Text = "Default region";
//
// comboBoxDropMode
//
this.comboBoxDropMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxDropMode.FormattingEnabled = true;
this.comboBoxDropMode.Items.AddRange(new object[] {
"[N/A]",
"dropNTSC",
"dropPAL",
"nonDrop"});
this.comboBoxDropMode.Location = new System.Drawing.Point(191, 203);
this.comboBoxDropMode.Name = "comboBoxDropMode";
this.comboBoxDropMode.Size = new System.Drawing.Size(263, 21);
this.comboBoxDropMode.TabIndex = 6;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 206);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(59, 13);
this.label4.TabIndex = 10;
this.label4.Text = "Drop mode";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 179);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(100, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Frame rate multiplier";
//
// comboBoxFrameRate
//
this.comboBoxFrameRate.FormattingEnabled = true;
this.comboBoxFrameRate.Location = new System.Drawing.Point(191, 149);
this.comboBoxFrameRate.Name = "comboBoxFrameRate";
this.comboBoxFrameRate.Size = new System.Drawing.Size(263, 21);
this.comboBoxFrameRate.TabIndex = 4;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 152);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(57, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Frame rate";
//
// comboBoxTimeBase
//
this.comboBoxTimeBase.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxTimeBase.FormattingEnabled = true;
this.comboBoxTimeBase.Items.AddRange(new object[] {
"[N/A]",
"media",
"smpte",
"clock"});
this.comboBoxTimeBase.Location = new System.Drawing.Point(191, 122);
this.comboBoxTimeBase.Name = "comboBoxTimeBase";
this.comboBoxTimeBase.Size = new System.Drawing.Size(263, 21);
this.comboBoxTimeBase.TabIndex = 3;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 125);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 13);
this.label1.TabIndex = 4;
this.label1.Text = "Time base";
//
// comboBoxLanguage
//
this.comboBoxLanguage.FormattingEnabled = true;
this.comboBoxLanguage.Location = new System.Drawing.Point(191, 95);
this.comboBoxLanguage.Name = "comboBoxLanguage";
this.comboBoxLanguage.Size = new System.Drawing.Size(263, 21);
this.comboBoxLanguage.TabIndex = 2;
//
// labelCollision
//
this.labelCollision.AutoSize = true;
this.labelCollision.Location = new System.Drawing.Point(6, 98);
this.labelCollision.Name = "labelCollision";
this.labelCollision.Size = new System.Drawing.Size(55, 13);
this.labelCollision.TabIndex = 3;
this.labelCollision.Text = "Language";
//
// comboBoxDefaultStyle
//
this.comboBoxDefaultStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxDefaultStyle.FormattingEnabled = true;
this.comboBoxDefaultStyle.Location = new System.Drawing.Point(191, 243);
this.comboBoxDefaultStyle.Name = "comboBoxDefaultStyle";
this.comboBoxDefaultStyle.Size = new System.Drawing.Size(263, 21);
this.comboBoxDefaultStyle.TabIndex = 7;
//
// labelWrapStyle
//
this.labelWrapStyle.AutoSize = true;
this.labelWrapStyle.Location = new System.Drawing.Point(6, 246);
this.labelWrapStyle.Name = "labelWrapStyle";
this.labelWrapStyle.Size = new System.Drawing.Size(65, 13);
this.labelWrapStyle.TabIndex = 1;
this.labelWrapStyle.Text = "Default style";
//
// textBoxBottomExtent
//
this.textBoxBottomExtent.Location = new System.Drawing.Point(135, 141);
this.textBoxBottomExtent.Name = "textBoxBottomExtent";
this.textBoxBottomExtent.Size = new System.Drawing.Size(263, 20);
this.textBoxBottomExtent.TabIndex = 23;
//
// labelBottomExtent
//
this.labelBottomExtent.AutoSize = true;
this.labelBottomExtent.Location = new System.Drawing.Point(14, 144);
this.labelBottomExtent.Name = "labelBottomExtent";
this.labelBottomExtent.Size = new System.Drawing.Size(72, 13);
this.labelBottomExtent.TabIndex = 25;
this.labelBottomExtent.Text = "Bottom extent";
//
// textBoxBottomOrigin
//
this.textBoxBottomOrigin.Location = new System.Drawing.Point(135, 115);
this.textBoxBottomOrigin.Name = "textBoxBottomOrigin";
this.textBoxBottomOrigin.Size = new System.Drawing.Size(263, 20);
this.textBoxBottomOrigin.TabIndex = 22;
//
// labelBottomOrigin
//
this.labelBottomOrigin.AutoSize = true;
this.labelBottomOrigin.Location = new System.Drawing.Point(14, 118);
this.labelBottomOrigin.Name = "labelBottomOrigin";
this.labelBottomOrigin.Size = new System.Drawing.Size(68, 13);
this.labelBottomOrigin.TabIndex = 24;
this.labelBottomOrigin.Text = "Bottom origin";
//
// TimedTextPropertiesItunes
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(913, 434);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.groupBoxOptions);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TimedTextPropertiesItunes";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Timed Text properties";
this.groupBoxOptions.ResumeLayout(false);
this.groupBoxOptions.PerformLayout();
this.groupBoxAlignment.ResumeLayout(false);
this.groupBoxAlignment.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.GroupBox groupBoxOptions;
private System.Windows.Forms.ComboBox comboBoxDropMode;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox comboBoxFrameRate;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comboBoxTimeBase;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBoxLanguage;
private System.Windows.Forms.Label labelCollision;
private System.Windows.Forms.ComboBox comboBoxDefaultStyle;
private System.Windows.Forms.Label labelWrapStyle;
private System.Windows.Forms.ComboBox comboBoxDefaultRegion;
private System.Windows.Forms.Label labelDefaultRegion;
private System.Windows.Forms.TextBox textBoxDescription;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textBoxTitle;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ComboBox comboBoxFrameRateMultiplier;
private System.Windows.Forms.ComboBox comboBoxTimeCodeFormat;
private System.Windows.Forms.Label labelTimeCode;
private System.Windows.Forms.ComboBox comboBoxFileExtensions;
private System.Windows.Forms.Label labelFileExtension;
private System.Windows.Forms.GroupBox groupBoxAlignment;
private System.Windows.Forms.TextBox textBoxTopExtent;
private System.Windows.Forms.Label labelTopExtent;
private System.Windows.Forms.TextBox textBoxTopOrigin;
private System.Windows.Forms.Label labelTopOrigin;
private System.Windows.Forms.TextBox textBoxBottomExtent;
private System.Windows.Forms.Label labelBottomExtent;
private System.Windows.Forms.TextBox textBoxBottomOrigin;
private System.Windows.Forms.Label labelBottomOrigin;
}
}

View File

@ -0,0 +1,329 @@
using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Core.SubtitleFormats;
using Nikse.SubtitleEdit.Logic;
using System;
using System.Globalization;
using System.Windows.Forms;
using System.Xml;
namespace Nikse.SubtitleEdit.Forms
{
public partial class TimedTextPropertiesItunes : PositionAndSizeForm
{
private Subtitle _subtitle;
private XmlDocument _xml;
private XmlNamespaceManager _nsmgr;
private string _NA;
public TimedTextPropertiesItunes(Subtitle subtitle)
{
UiUtil.PreInitialize(this);
InitializeComponent();
UiUtil.FixFonts(this);
Application.DoEvents();
_subtitle = subtitle;
_NA = "[" + LanguageSettings.Current.General.NotAvailable + "]";
comboBoxDropMode.Items[0] = _NA;
comboBoxTimeBase.Items[0] = _NA;
comboBoxDefaultStyle.Items.Add(_NA);
comboBoxDefaultRegion.Items.Add(_NA);
_xml = new XmlDocument();
try
{
_xml.LoadXml(subtitle.Header);
}
catch
{
subtitle.Header = new TimedText10().ToText(new Subtitle(), "tt");
_xml.LoadXml(subtitle.Header); // load default xml
}
_nsmgr = new XmlNamespaceManager(_xml.NameTable);
_nsmgr.AddNamespace("ttml", "http://www.w3.org/ns/ttml");
XmlNode node = _xml.DocumentElement.SelectSingleNode("ttml:head/ttml:metadata/ttml:title", _nsmgr);
if (node != null)
{
textBoxTitle.Text = node.InnerText;
}
node = _xml.DocumentElement.SelectSingleNode("ttml:head/ttml:metadata/ttml:desc", _nsmgr);
if (node != null)
{
textBoxDescription.Text = node.InnerText;
}
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
comboBoxLanguage.Items.Add(ci.Name);
}
XmlAttribute attr = _xml.DocumentElement.Attributes["xml:lang"];
if (attr != null)
{
comboBoxLanguage.Text = attr.InnerText;
}
attr = _xml.DocumentElement.Attributes["ttp:timeBase"];
if (attr != null)
{
comboBoxTimeBase.Text = attr.InnerText;
}
comboBoxFrameRate.Items.Add("23.976");
comboBoxFrameRate.Items.Add("24.0");
comboBoxFrameRate.Items.Add("25.0");
comboBoxFrameRate.Items.Add("29.97");
comboBoxFrameRate.Items.Add("30.0");
attr = _xml.DocumentElement.Attributes["ttp:frameRate"];
if (attr != null)
{
comboBoxFrameRate.Text = attr.InnerText;
}
attr = _xml.DocumentElement.Attributes["ttp:frameRateMultiplier"];
if (attr != null)
{
comboBoxFrameRateMultiplier.Text = attr.InnerText;
}
attr = _xml.DocumentElement.Attributes["ttp:dropMode"];
if (attr != null)
{
comboBoxDropMode.Text = attr.InnerText;
}
foreach (string style in TimedText10.GetStylesFromHeader(_subtitle.Header))
{
comboBoxDefaultStyle.Items.Add(style);
node = _xml.DocumentElement.SelectSingleNode("ttml:body", _nsmgr);
if (node?.Attributes?["style"] != null && style == node.Attributes["style"].Value)
{
comboBoxDefaultStyle.SelectedIndex = comboBoxDefaultStyle.Items.Count - 1;
}
}
foreach (string region in TimedText10.GetRegionsFromHeader(_subtitle.Header))
{
comboBoxDefaultRegion.Items.Add(region);
node = _xml.DocumentElement.SelectSingleNode("ttml:body", _nsmgr);
if (node?.Attributes?["region"] != null && region == node.Attributes["region"].Value)
{
comboBoxDefaultRegion.SelectedIndex = comboBoxDefaultRegion.Items.Count - 1;
}
}
var timeCodeFormat = Configuration.Settings.SubtitleSettings.TimedText10TimeCodeFormat.Trim().ToLowerInvariant();
comboBoxTimeCodeFormat.SelectedIndex = 0;
for (int index = 0; index < comboBoxTimeCodeFormat.Items.Count; index++)
{
var item = comboBoxTimeCodeFormat.Items[index];
if (item.ToString().ToLowerInvariant() == timeCodeFormat)
{
comboBoxTimeCodeFormat.SelectedIndex = index;
break;
}
}
var ext = Configuration.Settings.SubtitleSettings.TimedText10FileExtension;
comboBoxFileExtensions.SelectedIndex = 0;
for (var index = 0; index < comboBoxFileExtensions.Items.Count; index++)
{
var item = comboBoxFileExtensions.Items[index];
if (item.ToString() == ext)
{
comboBoxFileExtensions.SelectedIndex = index;
break;
}
}
textBoxTopOrigin.Text = Configuration.Settings.SubtitleSettings.TimedTextItunesTopOrigin;
textBoxTopExtent.Text = Configuration.Settings.SubtitleSettings.TimedTextItunesTopExtent;
textBoxBottomOrigin.Text = Configuration.Settings.SubtitleSettings.TimedTextItunesBottomOrigin;
textBoxBottomExtent.Text = Configuration.Settings.SubtitleSettings.TimedTextItunesBottomExtent;
}
private void buttonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void buttonOK_Click(object sender, EventArgs e)
{
XmlNode node = _xml.DocumentElement.SelectSingleNode("ttml:head/ttml:metadata/ttml:title", _nsmgr);
if (node != null)
{
if (string.IsNullOrWhiteSpace(textBoxTitle.Text) && string.IsNullOrWhiteSpace(textBoxDescription.Text))
{
_xml.DocumentElement.SelectSingleNode("ttml:head", _nsmgr).RemoveChild(_xml.DocumentElement.SelectSingleNode("ttml:head/ttml:metadata", _nsmgr));
}
else
{
node.InnerText = textBoxTitle.Text;
}
}
else if (!string.IsNullOrWhiteSpace(textBoxTitle.Text))
{
var head = _xml.DocumentElement.SelectSingleNode("ttml:head", _nsmgr);
if (head == null)
{
head = _xml.CreateElement("ttml", "head", _nsmgr.LookupNamespace("ttml"));
_xml.DocumentElement.PrependChild(head);
}
var metadata = _xml.DocumentElement.SelectSingleNode("ttml:head/ttml:metadata", _nsmgr);
if (metadata == null)
{
metadata = _xml.CreateElement("ttml", "metadata", _nsmgr.LookupNamespace("ttml"));
head.PrependChild(metadata);
}
var title = _xml.CreateElement("ttml", "title", _nsmgr.LookupNamespace("ttml"));
metadata.InnerText = textBoxTitle.Text;
metadata.AppendChild(title);
}
node = _xml.DocumentElement.SelectSingleNode("ttml:head/ttml:metadata/ttml:desc", _nsmgr);
if (node != null)
{
node.InnerText = textBoxDescription.Text;
}
else if (!string.IsNullOrWhiteSpace(textBoxDescription.Text))
{
var head = _xml.DocumentElement.SelectSingleNode("ttml:head", _nsmgr);
if (head == null)
{
head = _xml.CreateElement("ttml", "head", _nsmgr.LookupNamespace("ttml"));
_xml.DocumentElement.PrependChild(head);
}
var metadata = _xml.DocumentElement.SelectSingleNode("ttml:head/ttml:metadata", _nsmgr);
if (metadata == null)
{
metadata = _xml.CreateElement("ttml", "metadata", _nsmgr.LookupNamespace("ttml"));
head.PrependChild(metadata);
}
var desc = _xml.CreateElement("ttml", "desc", _nsmgr.LookupNamespace("ttml"));
desc.InnerText = textBoxDescription.Text;
metadata.AppendChild(desc);
}
XmlAttribute attr = _xml.DocumentElement.Attributes["xml:lang"];
if (attr != null)
{
attr.Value = comboBoxLanguage.Text;
if (attr.Value.Length == 0)
{
_xml.DocumentElement.Attributes.Remove(attr);
}
}
else if (comboBoxLanguage.Text.Length > 0)
{
attr = _xml.CreateAttribute("xml", "lang", _nsmgr.LookupNamespace("xml"));
attr.Value = comboBoxLanguage.Text;
_xml.DocumentElement.Attributes.Prepend(attr);
}
attr = _xml.DocumentElement.Attributes["ttp:timeBase"];
if (attr != null)
{
attr.InnerText = comboBoxTimeBase.Text;
if (attr.Value.Length == 0)
{
_xml.DocumentElement.Attributes.Remove(attr);
}
}
else if (comboBoxTimeBase.Text.Length > 0)
{
attr = _xml.CreateAttribute("ttp", "timeBase", _nsmgr.LookupNamespace("ttp"));
attr.Value = comboBoxTimeBase.Text;
_xml.DocumentElement.Attributes.Append(attr);
}
attr = _xml.DocumentElement.Attributes["ttp:frameRate"];
if (attr != null)
{
attr.InnerText = comboBoxFrameRate.Text;
if (attr.Value.Length == 0)
{
_xml.DocumentElement.Attributes.Remove(attr);
}
}
else if (comboBoxFrameRate.Text.Length > 0)
{
attr = _xml.CreateAttribute("ttp", "frameRate", _nsmgr.LookupNamespace("ttp"));
attr.Value = comboBoxFrameRate.Text;
_xml.DocumentElement.Attributes.Append(attr);
}
attr = _xml.DocumentElement.Attributes["ttp:frameRateMultiplier"];
if (attr != null)
{
attr.InnerText = comboBoxFrameRateMultiplier.Text;
if (attr.Value.Length == 0)
{
_xml.DocumentElement.Attributes.Remove(attr);
}
}
else if (comboBoxFrameRateMultiplier.Text.Length > 0)
{
attr = _xml.CreateAttribute("ttp", "frameRateMultiplier", _nsmgr.LookupNamespace("ttp"));
attr.Value = comboBoxFrameRateMultiplier.Text;
_xml.DocumentElement.Attributes.Append(attr);
}
attr = _xml.DocumentElement.Attributes["ttp:dropMode"];
if (attr != null)
{
attr.InnerText = comboBoxDropMode.Text;
if (attr.Value.Length == 0)
{
_xml.DocumentElement.Attributes.Remove(attr);
}
}
else if (comboBoxDropMode.Text.Length > 0)
{
attr = _xml.CreateAttribute("ttp", "dropMode", _nsmgr.LookupNamespace("ttp"));
attr.Value = comboBoxDropMode.Text;
_xml.DocumentElement.Attributes.Append(attr);
}
node = _xml.DocumentElement.SelectSingleNode("ttml:body", _nsmgr);
if (node != null && node.Attributes["style"] != null)
{
node.Attributes["style"].Value = comboBoxDefaultStyle.Text;
}
else if (comboBoxDefaultStyle.Text.Length > 0 && node != null)
{
attr = _xml.CreateAttribute("style");
attr.Value = comboBoxDefaultStyle.Text;
node.Attributes.Append(attr);
}
node = _xml.DocumentElement.SelectSingleNode("ttml:body", _nsmgr);
if (node != null && node.Attributes["region"] != null)
{
node.Attributes["region"].Value = comboBoxDefaultRegion.Text;
}
else if (comboBoxDefaultRegion.Text.Length > 0 && node != null)
{
attr = _xml.CreateAttribute("region");
attr.Value = comboBoxDefaultRegion.Text;
node.Attributes.Append(attr);
}
_subtitle.Header = _xml.OuterXml;
Configuration.Settings.SubtitleSettings.TimedText10TimeCodeFormat = comboBoxTimeCodeFormat.SelectedItem.ToString();
Configuration.Settings.SubtitleSettings.TimedText10FileExtension= comboBoxFileExtensions.SelectedItem.ToString();
Configuration.Settings.SubtitleSettings.TimedTextItunesTopOrigin = textBoxTopOrigin.Text;
Configuration.Settings.SubtitleSettings.TimedTextItunesTopExtent = textBoxTopExtent.Text;
Configuration.Settings.SubtitleSettings.TimedTextItunesBottomOrigin = textBoxBottomOrigin.Text;
Configuration.Settings.SubtitleSettings.TimedTextItunesBottomExtent = textBoxBottomExtent.Text;
DialogResult = DialogResult.OK;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -367,6 +367,12 @@
<Compile Include="Forms\Styles\SubStationAlphaStylesCategoriesManager.Designer.cs"> <Compile Include="Forms\Styles\SubStationAlphaStylesCategoriesManager.Designer.cs">
<DependentUpon>SubStationAlphaStylesCategoriesManager.cs</DependentUpon> <DependentUpon>SubStationAlphaStylesCategoriesManager.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Forms\TimedTextPropertiesItunes.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\TimedTextPropertiesItunes.Designer.cs">
<DependentUpon>TimedTextPropertiesItunes.cs</DependentUpon>
</Compile>
<Compile Include="Forms\TimedTextSmpteTiming.cs"> <Compile Include="Forms\TimedTextSmpteTiming.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -1428,6 +1434,9 @@
<EmbeddedResource Include="Forms\Styles\SubStationAlphaStylesCategoriesManager.resx"> <EmbeddedResource Include="Forms\Styles\SubStationAlphaStylesCategoriesManager.resx">
<DependentUpon>SubStationAlphaStylesCategoriesManager.cs</DependentUpon> <DependentUpon>SubStationAlphaStylesCategoriesManager.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Forms\TimedTextPropertiesItunes.resx">
<DependentUpon>TimedTextPropertiesItunes.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\TimedTextSmpteTiming.resx"> <EmbeddedResource Include="Forms\TimedTextSmpteTiming.resx">
<DependentUpon>TimedTextSmpteTiming.cs</DependentUpon> <DependentUpon>TimedTextSmpteTiming.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>