mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
Fix issue with "Max Time" after "split at cursor" - thx Jüri :)
This commit is contained in:
parent
310c094fe1
commit
66b1e7820c
@ -6,18 +6,11 @@ namespace Nikse.SubtitleEdit.Core
|
||||
{
|
||||
public class TimeCode
|
||||
{
|
||||
public static readonly TimeCode MaxTime = new TimeCode(99, 59, 59, 999);
|
||||
|
||||
public const double BaseUnit = 1000.0; // Base unit of time
|
||||
private double _totalMilliseconds;
|
||||
|
||||
public bool IsMaxTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return Math.Abs(_totalMilliseconds - MaxTime.TotalMilliseconds) < 0.01;
|
||||
}
|
||||
}
|
||||
public bool IsMaxTime => Math.Abs(_totalMilliseconds - MaxTimeTotalMilliseconds) < 0.01;
|
||||
public const double MaxTimeTotalMilliseconds = 359999999; // new TimeCode(99, 59, 59, 999).TotalMilliseconds
|
||||
|
||||
public static TimeCode FromSeconds(double seconds)
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
double? milliseconds = GetTotalMilliseconds();
|
||||
if (milliseconds.HasValue)
|
||||
{
|
||||
if (milliseconds.Value >= TimeCode.MaxTime.TotalMilliseconds - 0.1)
|
||||
if (milliseconds.Value >= TimeCode.MaxTimeTotalMilliseconds - 0.1)
|
||||
milliseconds = 0;
|
||||
|
||||
if (Mode == TimeMode.HHMMSSMS)
|
||||
@ -150,7 +150,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
return new TimeCode();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(maskedTextBox1.Text.RemoveChar('.').Replace(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, string.Empty).RemoveChar(',').RemoveChar(':')))
|
||||
return TimeCode.MaxTime;
|
||||
return new TimeCode(TimeCode.MaxTimeTotalMilliseconds);
|
||||
|
||||
if (!_dirty)
|
||||
return new TimeCode(_initialTotalMilliseconds);
|
||||
@ -243,7 +243,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
_initialTotalMilliseconds = value.TotalMilliseconds;
|
||||
}
|
||||
|
||||
if (value == null || value.TotalMilliseconds >= TimeCode.MaxTime.TotalMilliseconds - 0.1)
|
||||
if (value == null || value.TotalMilliseconds >= TimeCode.MaxTimeTotalMilliseconds - 0.1)
|
||||
{
|
||||
maskedTextBox1.Text = string.Empty;
|
||||
return;
|
||||
|
@ -232,8 +232,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
foreach (Paragraph p in _subtitle.Paragraphs)
|
||||
{
|
||||
p.StartTime.TotalMilliseconds = TimeCode.MaxTime.TotalMilliseconds;
|
||||
p.EndTime.TotalMilliseconds = TimeCode.MaxTime.TotalMilliseconds;
|
||||
p.StartTime.TotalMilliseconds = TimeCode.MaxTimeTotalMilliseconds;
|
||||
p.EndTime.TotalMilliseconds = TimeCode.MaxTimeTotalMilliseconds;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8714,8 +8714,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (currentParagraph.StartTime.IsMaxTime && currentParagraph.EndTime.IsMaxTime)
|
||||
{
|
||||
newParagraph.StartTime = TimeCode.MaxTime;
|
||||
newParagraph.EndTime = TimeCode.MaxTime;
|
||||
newParagraph.StartTime.TotalMilliseconds = TimeCode.MaxTimeTotalMilliseconds;
|
||||
newParagraph.EndTime.TotalMilliseconds = TimeCode.MaxTimeTotalMilliseconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user