mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Work on #8312
This commit is contained in:
parent
9d7d1be987
commit
31e92dcfbc
@ -32614,9 +32614,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (ft == typeof(TimedTextImsc11))
|
||||
{
|
||||
using (var properties = new TimedTextPropertiesImsc11(_subtitle))
|
||||
var oldFr = Configuration.Settings.General.CurrentFrameRate;
|
||||
using (var properties = new TimedTextPropertiesImsc11(_subtitle, _videoFileName))
|
||||
{
|
||||
properties.ShowDialog(this);
|
||||
|
||||
if (oldFr != Configuration.Settings.General.CurrentFrameRate)
|
||||
{
|
||||
toolStripComboBoxFrameRate.Text = Configuration.Settings.General.DefaultFrameRate.ToString();
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleOriginal);
|
||||
RefreshSelectedParagraph();
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Nikse.SubtitleEdit.Core.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
|
||||
@ -10,10 +11,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public sealed partial class TimedTextPropertiesImsc11 : PositionAndSizeForm
|
||||
{
|
||||
private readonly Subtitle _subtitle;
|
||||
private readonly string _videoFileName;
|
||||
private readonly XmlDocument _xml;
|
||||
private readonly XmlNamespaceManager _namespaceManager;
|
||||
|
||||
public TimedTextPropertiesImsc11(Subtitle subtitle)
|
||||
public TimedTextPropertiesImsc11(Subtitle subtitle, string videoFileName)
|
||||
{
|
||||
UiUtil.PreInitialize(this);
|
||||
InitializeComponent();
|
||||
@ -23,6 +25,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Text = string.Format(LanguageSettings.Current.Main.Menu.File.FormatXProperties, new TimedTextImsc11().Name);
|
||||
|
||||
_subtitle = subtitle;
|
||||
_videoFileName = videoFileName;
|
||||
var notAvailable = "[" + LanguageSettings.Current.General.NotAvailable + "]";
|
||||
comboBoxDropMode.Items[0] = notAvailable;
|
||||
comboBoxTimeBase.Items[0] = notAvailable;
|
||||
@ -126,9 +129,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
comboBoxFrameRate.Enabled = false;
|
||||
comboBoxFrameRateMultiplier.Enabled = false;
|
||||
comboBoxDropMode.Enabled = false;
|
||||
comboBoxFrameRate.Enabled = string.IsNullOrEmpty(_videoFileName);
|
||||
comboBoxFrameRateMultiplier.Enabled = string.IsNullOrEmpty(_videoFileName);
|
||||
comboBoxDropMode.Enabled = string.IsNullOrEmpty(_videoFileName);
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
@ -138,6 +141,36 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void buttonOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_videoFileName))
|
||||
{
|
||||
if (float.TryParse(comboBoxFrameRate.Text.Replace(",", "."), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var fr))
|
||||
{
|
||||
if (comboBoxFrameRateMultiplier.Text == "1 1" || string.IsNullOrEmpty(comboBoxFrameRateMultiplier.Text))
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = fr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Math.Abs(fr - 24) < 0.001)
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = 23.976;
|
||||
}
|
||||
else if (Math.Abs(fr - 30) < 0.001)
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = 29.97;
|
||||
}
|
||||
else if (Math.Abs(fr - 60) < 0.001)
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = 59.94;
|
||||
}
|
||||
else
|
||||
{
|
||||
Configuration.Settings.General.CurrentFrameRate = fr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XmlNode node = _xml.DocumentElement.SelectSingleNode("ttml:head/ttml:metadata/ttml:title", _namespaceManager);
|
||||
if (node != null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user