-fixed namespace for id attribute

-fixed style editing for the new subtitle
-fixed fontWeight namespace and editing
-fixed creation of subtitles with negative timing
This commit is contained in:
askolesov 2017-02-28 14:47:38 +03:00
parent a8444f7c0e
commit b6074eebc3
3 changed files with 6 additions and 16 deletions

View File

@ -198,7 +198,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
" <ttm:title></ttm:title>" + Environment.NewLine +
" </metadata>" + Environment.NewLine +
" <styling>" + Environment.NewLine +
" <style id=\"s0\" tts:backgroundColor=\"black\" tts:fontStyle=\"normal\" tts:fontSize=\"16\" tts:fontFamily=\"sansSerif\" tts:color=\"white\" />" + Environment.NewLine +
" <style xml:id=\"s0\" tts:backgroundColor=\"black\" tts:fontStyle=\"normal\" tts:fontSize=\"16px\" tts:fontFamily=\"sansSerif\" tts:color=\"white\" />" + Environment.NewLine +
" </styling>" + Environment.NewLine +
" </head>" + Environment.NewLine +
" <body style=\"s0\">" + Environment.NewLine +
@ -307,11 +307,6 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
}
}
}
if (divParentNode != null && divParentNode.HasChildNodes && !divParentNode.FirstChild.HasChildNodes)
{
divParentNode.RemoveChild(divParentNode.FirstChild);
}
}
else
{
@ -333,11 +328,6 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
div.AppendChild(paragraph);
no++;
}
if (divParentNode != null && divParentNode.HasChildNodes && !divParentNode.FirstChild.HasChildNodes)
{
divParentNode.RemoveChild(divParentNode.FirstChild);
}
}
return ToUtf8XmlString(xml).Replace(" xmlns=\"\"", string.Empty).Replace(" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\">", ">");
@ -484,7 +474,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
start.InnerText = ConvertToTimeString(p.StartTime);
paragraph.Attributes.Append(start);
XmlAttribute id = xml.CreateAttribute("id");
XmlAttribute id = xml.CreateAttribute("xml:id");
id.InnerText = "p" + no;
paragraph.Attributes.Append(id);

View File

@ -14117,7 +14117,7 @@ namespace Nikse.SubtitleEdit.Forms
{
// current movie Position
double videoPositionInMilliseconds = mediaPlayer.CurrentPosition * TimeCode.BaseUnit;
if (!mediaPlayer.IsPaused)
if (!mediaPlayer.IsPaused && videoPositionInMilliseconds > Configuration.Settings.General.SetStartEndHumanDelay)
videoPositionInMilliseconds -= Configuration.Settings.General.SetStartEndHumanDelay;
var tc = new TimeCode(videoPositionInMilliseconds);

View File

@ -321,8 +321,8 @@ namespace Nikse.SubtitleEdit.Forms.Styles
// normal | bold
comboBoxFontWeight.SelectedIndex = 0;
if (fontStyle.Equals("bold", StringComparison.OrdinalIgnoreCase))
comboBoxFontStyle.SelectedIndex = 1;
if (fontWeight.Equals("bold", StringComparison.OrdinalIgnoreCase))
comboBoxFontWeight.SelectedIndex = 1;
Color color = Color.White;
try
@ -458,7 +458,7 @@ namespace Nikse.SubtitleEdit.Forms.Styles
if (attrToChange == null)
{
attrToChange = _xml.CreateAttribute(tag);
attrToChange = _xml.CreateAttribute(tag, TimedText10.TTMLStylingNamespace);
style.Attributes.Append(attrToChange);
}