A few minor improvements

This commit is contained in:
Nikolaj Olsson 2019-10-13 20:47:33 +02:00
parent 2eb6e76329
commit a755a9d038
4 changed files with 17 additions and 11 deletions

View File

@ -91,7 +91,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var nsmgr = new XmlNamespaceManager(xml.NameTable);
nsmgr.AddNamespace("ttml", "http://www.w3.org/ns/ttml");
nsmgr.AddNamespace("ttp", "http://www.w3.org/ns/10/ttml#parameter");
nsmgr.AddNamespace("tts", "http://www.w3.org/ns/10/ttml#style");
nsmgr.AddNamespace("tts", "http://www.w3.org/ns/ttml#styling");
nsmgr.AddNamespace("ttm", "http://www.w3.org/ns/10/ttml#metadata");
string frameRate = ((int)Math.Round(Configuration.Settings.General.CurrentFrameRate)).ToString();
@ -275,7 +275,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
styles.Push(currentStyle);
currentStyle = xml.CreateNode(XmlNodeType.Element, "span", null);
paragraph.AppendChild(currentStyle);
XmlAttribute attr = xml.CreateAttribute("tts:fontStyle", "http://www.w3.org/ns/10/ttml#style");
XmlAttribute attr = xml.CreateAttribute("tts:fontStyle", "http://www.w3.org/ns/ttml#styling");
attr.InnerText = "italic";
currentStyle.Attributes.Append(attr);
skipCount = 2;
@ -285,7 +285,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{
currentStyle = xml.CreateNode(XmlNodeType.Element, "span", null);
paragraph.AppendChild(currentStyle);
XmlAttribute attr = xml.CreateAttribute("tts:fontWeight", "http://www.w3.org/ns/10/ttml#style");
XmlAttribute attr = xml.CreateAttribute("tts:fontWeight", "http://www.w3.org/ns/ttml#styling");
attr.InnerText = "bold";
currentStyle.Attributes.Append(attr);
skipCount = 2;
@ -305,7 +305,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
string fontColor = arr[0].Trim('\'').Trim('"').Trim('\'');
currentStyle = xml.CreateNode(XmlNodeType.Element, "span", null);
paragraph.AppendChild(currentStyle);
XmlAttribute attr = xml.CreateAttribute("tts:color", "http://www.w3.org/ns/10/ttml#style");
XmlAttribute attr = xml.CreateAttribute("tts:color", "http://www.w3.org/ns/ttml#styling");
attr.InnerText = fontColor;
currentStyle.Attributes.Append(attr);
}
@ -343,11 +343,11 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
styles.Push(currentStyle);
currentStyle = xml.CreateNode(XmlNodeType.Element, "span", null);
paragraph.AppendChild(currentStyle);
XmlAttribute attr = xml.CreateAttribute("tts:fontStyle", "http://www.w3.org/ns/10/ttml#style");
XmlAttribute attr = xml.CreateAttribute("tts:fontStyle", "http://www.w3.org/ns/ttml#styling");
attr.InnerText = "italic";
currentStyle.Attributes.Append(attr);
}
currentStyle.InnerText = currentStyle.InnerText + line[i];
currentStyle.InnerText += line[i];
}
}
first = false;
@ -363,7 +363,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
div.AppendChild(paragraph);
}
string xmlString = ToUtf8XmlString(xml).Replace(" xmlns=\"\"", string.Empty).Replace(" xmlns:tts=\"http://www.w3.org/ns/10/ttml#style\">", ">").Replace("<br />", "<br/>");
string xmlString = ToUtf8XmlString(xml).Replace(" xmlns=\"\"", string.Empty).Replace("<br />", "<br/>");
if (subtitle.Header == null)
{
subtitle.Header = xmlString;

View File

@ -1508,6 +1508,7 @@ namespace Nikse.SubtitleEdit.Controls
{
Items[index].Focused = true;
}
return;
}
int bottomIndex = TopItem.Index + (Height - 25) / 16;

View File

@ -40,7 +40,6 @@
//
// buttonDownload
//
this.buttonDownload.Location = new System.Drawing.Point(12, 24);
this.buttonDownload.Name = "buttonDownload";
this.buttonDownload.Size = new System.Drawing.Size(186, 23);
@ -48,8 +47,6 @@
this.buttonDownload.Text = "Download mpv dll";
this.buttonDownload.UseVisualStyleBackColor = true;
this.buttonDownload.Click += new System.EventHandler(this.ButtonDownloadClick);
//
// comboBoxVideoOutput
//
@ -60,7 +57,6 @@
"sdl",
"vaapi",
"vdpau"});
this.comboBoxVideoOutput.Location = new System.Drawing.Point(12, 109);
this.comboBoxVideoOutput.Name = "comboBoxVideoOutput";
this.comboBoxVideoOutput.Size = new System.Drawing.Size(186, 21);
@ -129,6 +125,7 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Settings for mpv";
this.Load += new System.EventHandler(this.SettingsMpv_Load);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Logic.VideoPlayers;
namespace Nikse.SubtitleEdit.Forms
{
@ -131,5 +132,12 @@ namespace Nikse.SubtitleEdit.Forms
DialogResult = DialogResult.Cancel;
}
private void SettingsMpv_Load(object sender, EventArgs e)
{
if (Configuration.IsRunningOnWindows && !LibMpvDynamic.IsInstalled)
{
ButtonDownloadClick(null, null);
}
}
}
}