Skip to content

Commit

Permalink
Merge pull request #6 from pavel-belenko/bugfix/style-editing
Browse files Browse the repository at this point in the history
Bugfixing - styles editing
  • Loading branch information
pavel-belenko authored Jan 12, 2017
2 parents 670711b + c43bc9f commit 5d914a7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
4 changes: 2 additions & 2 deletions libse/Subtitle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class Subtitle
private readonly List<HistoryItem> _history;
private SubtitleFormat _format;
private bool _wasLoadedWithFrameNumbers;
public string Header { get; set; }
public string Footer { get; set; }
public string Header { get; set; } = "";
public string Footer { get; set; } = "";

public string FileName { get; set; }

Expand Down
8 changes: 4 additions & 4 deletions libse/SubtitleFormats/TimedText10.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public override bool IsTimeBased
get { return true; }
}

private static string TTMLNamespace = "http://www.w3.org/ns/ttml";
private static string TTMLParameterNamespace = "http://www.w3.org/ns/ttml#parameter";
private static string TTMLStylingNamespace = "http://www.w3.org/ns/ttml#styling";
private static string TTMLMetadataNamespace = "http://www.w3.org/ns/ttml#metadata";
public static string TTMLNamespace = "http://www.w3.org/ns/ttml";
public static string TTMLParameterNamespace = "http://www.w3.org/ns/ttml#parameter";
public static string TTMLStylingNamespace = "http://www.w3.org/ns/ttml#styling";
public static string TTMLMetadataNamespace = "http://www.w3.org/ns/ttml#metadata";

private bool HasTTMLParagraphs(string xmlAsStr)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20373,7 +20373,7 @@ private void NetflixGlyphCheck(bool showSuccessMessage = true)

if (messages.Count != 0)
{
MessageBox.Show(String.Join("\n\n", messages.ToArray()));
MessageBox.Show(String.Join(Environment.NewLine, messages.ToArray()), Configuration.Settings.Language.Main.Menu.ToolBar.NetflixQualityCheck);
}
}

Expand Down
39 changes: 23 additions & 16 deletions src/Forms/Styles/TimedTextStyles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,27 +435,34 @@ private void textBoxStyleName_TextChanged(object sender, EventArgs e)

private void UpdateHeaderXml(string id, string tag, string value)
{
foreach (XmlNode innerNode in _xmlHead)
XmlNodeList styles = _xml.DocumentElement.SelectNodes("//ttml:head//ttml:styling/ttml:style", _nsmgr);

foreach (XmlNode style in styles)
{
if (innerNode.Name == "styling")
XmlAttribute idAttr = style.Attributes["xml:id"];

if (idAttr == null)
{
foreach (XmlNode innerInnerNode in innerNode)
idAttr = style.Attributes["id"];
}

if (idAttr != null && idAttr.Value == id)
{
if (tag == "id" || tag == "xml:id")
{
if (innerInnerNode.Name == "style")
idAttr.Value = value;
}
else
{
XmlAttribute attrToChange = style.Attributes[tag];

if (attrToChange == null)
{
XmlAttribute idAttr = innerInnerNode.Attributes["xml:id"];
if (idAttr != null && idAttr.InnerText == id)
{
XmlAttribute attr = innerInnerNode.Attributes[tag];
if (attr == null)
{
attr = _xml.CreateAttribute("tts:fontSize", "http://www.w3.org/ns/10/ttml#style");
innerInnerNode.Attributes.Append(attr);
}
attr.InnerText = value;
break;
}
attrToChange = _xml.CreateAttribute(tag);
style.Attributes.Append(attrToChange);
}

attrToChange.Value = value;
}
}
}
Expand Down

0 comments on commit 5d914a7

Please sign in to comment.