Work on ttml imsc 1.1 properties

This commit is contained in:
Nikolaj Olsson 2024-03-15 13:51:41 +01:00
parent b7b23d3d86
commit 1dc0706b86
4 changed files with 25 additions and 6 deletions

View File

@ -833,6 +833,7 @@ namespace Nikse.SubtitleEdit.Core.Common
public string TimedTextItunesTimeCodeFormat { get; set; }
public string TimedTextItunesStyleAttribute { get; set; }
public string TimedTextImsc11TimeCodeFormat { get; set; }
public string TimedTextImsc11FileExtension { get; set; }
public int FcpFontSize { get; set; }
@ -921,6 +922,7 @@ $HorzAlign = Center
TimedTextItunesTimeCodeFormat = "Frames";
TimedTextItunesStyleAttribute = "tts:fontStyle";
TimedTextImsc11TimeCodeFormat = "hh:mm:ss.ms";
TimedTextImsc11FileExtension = ".xml";
FcpFontSize = 18;
FcpFontName = "Lucida Grande";
@ -7523,6 +7525,18 @@ $HorzAlign = Center
settings.SubtitleSettings.TimedTextItunesStyleAttribute = subNode.InnerText;
}
subNode = node.SelectSingleNode("TimedTextImsc11TimeCodeFormat");
if (subNode != null)
{
settings.SubtitleSettings.TimedTextImsc11TimeCodeFormat = subNode.InnerText;
}
subNode = node.SelectSingleNode("TimedTextImsc11FileExtension");
if (subNode != null)
{
settings.SubtitleSettings.TimedTextImsc11FileExtension = subNode.InnerText;
}
subNode = node.SelectSingleNode("FcpFontSize");
if (subNode != null)
{
@ -12219,6 +12233,8 @@ $HorzAlign = Center
textWriter.WriteElementString("TimedTextItunesBottomExtent", settings.SubtitleSettings.TimedTextItunesBottomExtent);
textWriter.WriteElementString("TimedTextItunesTimeCodeFormat", settings.SubtitleSettings.TimedTextItunesTimeCodeFormat);
textWriter.WriteElementString("TimedTextItunesStyleAttribute", settings.SubtitleSettings.TimedTextItunesStyleAttribute);
textWriter.WriteElementString("TimedTextImsc11TimeCodeFormat", settings.SubtitleSettings.TimedTextImsc11TimeCodeFormat);
textWriter.WriteElementString("TimedTextImsc11FileExtension", settings.SubtitleSettings.TimedTextImsc11FileExtension);
textWriter.WriteElementString("FcpFontSize", settings.SubtitleSettings.FcpFontSize.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("FcpFontName", settings.SubtitleSettings.FcpFontName);
textWriter.WriteElementString("Cavena890StartOfMessage", settings.SubtitleSettings.Cavena890StartOfMessage);

View File

@ -12,7 +12,6 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
/// </summary>
public class TimedTextImsc11 : SubtitleFormat
{
public override string Extension => ".xml";
public override string Name => "Timed Text IMSC 1.1";
private static string GetXmlStructure()
@ -46,6 +45,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
".Replace('\'', '"');
}
public override string Extension => Configuration.Settings.SubtitleSettings.TimedTextImsc11FileExtension;
public override bool IsMine(List<string> lines, string fileName)
{
if (fileName != null && !(fileName.EndsWith(Extension, StringComparison.OrdinalIgnoreCase) || fileName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase)))

View File

@ -1,6 +1,6 @@
namespace Nikse.SubtitleEdit.Forms
{
partial class TimedTextPropertiesIms11
sealed partial class TimedTextPropertiesIms11
{
/// <summary>
/// Required designer variable.

View File

@ -8,7 +8,7 @@ using System.Xml;
namespace Nikse.SubtitleEdit.Forms
{
public partial class TimedTextPropertiesIms11 : PositionAndSizeForm
public sealed partial class TimedTextPropertiesIms11 : PositionAndSizeForm
{
private readonly Subtitle _subtitle;
private readonly XmlDocument _xml;
@ -21,6 +21,8 @@ namespace Nikse.SubtitleEdit.Forms
UiUtil.FixFonts(this);
Application.DoEvents();
Text = string.Format(LanguageSettings.Current.Main.Menu.File.FormatXProperties, new TimedTextImsc11().Name);
_subtitle = subtitle;
var notAvailable = "[" + LanguageSettings.Current.General.NotAvailable + "]";
comboBoxDropMode.Items[0] = notAvailable;
@ -126,7 +128,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
var ext = Configuration.Settings.SubtitleSettings.TimedText10FileExtension;
var ext = Configuration.Settings.SubtitleSettings.TimedTextImsc11FileExtension;
comboBoxFileExtensions.SelectedIndex = 0;
for (var index = 0; index < comboBoxFileExtensions.Items.Count; index++)
{
@ -313,7 +315,7 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.SubtitleSettings.TimedTextImsc11TimeCodeFormat = comboBoxTimeCodeFormat.SelectedItem.ToString();
var currentTimedTextExt = Configuration.Settings.SubtitleSettings.TimedText10FileExtension;
var currentTimedTextExt = Configuration.Settings.SubtitleSettings.TimedTextImsc11FileExtension;
var newTimedTextExt = comboBoxFileExtensions.SelectedItem.ToString();
if (currentTimedTextExt != newTimedTextExt)
{
@ -325,7 +327,7 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.General.FavoriteSubtitleFormats = favoriteFormats.Replace(currentTimedTextWithExt, newTimedTextWithExt);
}
Configuration.Settings.SubtitleSettings.TimedText10FileExtension = newTimedTextExt;
Configuration.Settings.SubtitleSettings.TimedTextImsc11FileExtension = newTimedTextExt;
}
DialogResult = DialogResult.OK;