mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
Merge pull request #543 from xylographe/vmro
Removed always-false tests + other minor refact
This commit is contained in:
commit
63e536fd2a
@ -60,7 +60,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
}
|
||||
|
||||
public int ClosenessForBorderSelection = 15;
|
||||
private const int MininumSelectionMilliseconds = 100;
|
||||
private const int MinimumSelectionMilliseconds = 100;
|
||||
|
||||
private long _buttonDownTimeTicks;
|
||||
private int _mouseMoveLastX = -1;
|
||||
@ -111,8 +111,8 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
private System.ComponentModel.BackgroundWorker _spectrogramBackgroundWorker;
|
||||
public Keys InsertAtVideoPositionShortcut = Keys.None;
|
||||
public bool MouseWheelScrollUpIsForward = true;
|
||||
public const double ZoomMininum = 0.1;
|
||||
public const double ZoomMaxinum = 2.5;
|
||||
public const double ZoomMinimum = 0.1;
|
||||
public const double ZoomMaximum = 2.5;
|
||||
private double _zoomFactor = 1.0; // 1.0=no zoom
|
||||
public double ZoomFactor
|
||||
{
|
||||
@ -122,10 +122,10 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < ZoomMininum)
|
||||
_zoomFactor = ZoomMininum;
|
||||
else if (value > ZoomMaxinum)
|
||||
_zoomFactor = ZoomMaxinum;
|
||||
if (value < ZoomMinimum)
|
||||
_zoomFactor = ZoomMinimum;
|
||||
else if (value > ZoomMaximum)
|
||||
_zoomFactor = ZoomMaximum;
|
||||
else
|
||||
_zoomFactor = value;
|
||||
Invalidate();
|
||||
@ -878,7 +878,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
if (curIdx > 0)
|
||||
{
|
||||
var prev = _subtitle.Paragraphs[curIdx - 1];
|
||||
if (prev.EndTime.TotalMilliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines < milliseconds)
|
||||
if (prev.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines < milliseconds)
|
||||
_mouseDownParagraph.StartTime.TotalMilliseconds = milliseconds;
|
||||
}
|
||||
else
|
||||
@ -891,7 +891,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
if (curIdx < _subtitle.Paragraphs.Count - 1)
|
||||
{
|
||||
var next = _subtitle.Paragraphs[curIdx + 1];
|
||||
if (milliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines < next.StartTime.TotalMilliseconds)
|
||||
if (milliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines < next.StartTime.TotalMilliseconds)
|
||||
_mouseDownParagraph.EndTime.TotalMilliseconds = milliseconds;
|
||||
}
|
||||
else
|
||||
@ -1029,9 +1029,9 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
}
|
||||
}
|
||||
if (prev != null)
|
||||
_wholeParagraphMinMilliseconds = prev.EndTime.TotalMilliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
_wholeParagraphMinMilliseconds = prev.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
if (next != null)
|
||||
_wholeParagraphMaxMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
_wholeParagraphMaxMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1046,11 +1046,11 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
{
|
||||
if (curIdx > 0)
|
||||
{
|
||||
_wholeParagraphMinMilliseconds = _subtitle.Paragraphs[curIdx - 1].EndTime.TotalMilliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
_wholeParagraphMinMilliseconds = _subtitle.Paragraphs[curIdx - 1].EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
if (curIdx < _subtitle.Paragraphs.Count - 1)
|
||||
{
|
||||
_wholeParagraphMaxMilliseconds = _subtitle.Paragraphs[curIdx + 1].StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
_wholeParagraphMaxMilliseconds = _subtitle.Paragraphs[curIdx + 1].StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1240,7 +1240,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
_prevParagraph = _subtitle.GetParagraphOrDefault(subtitleIndex - 1);
|
||||
_nextParagraph = _subtitle.GetParagraphOrDefault(subtitleIndex + 1);
|
||||
|
||||
if (_firstMove && Math.Abs(oldMouseMoveLastX - e.X) < Configuration.Settings.General.MininumMillisecondsBetweenLines && GetParagraphAtMilliseconds(milliseconds) == null)
|
||||
if (_firstMove && Math.Abs(oldMouseMoveLastX - e.X) < Configuration.Settings.General.MinimumMillisecondsBetweenLines && GetParagraphAtMilliseconds(milliseconds) == null)
|
||||
{
|
||||
if (_mouseDownParagraphType == MouseDownParagraphType.Start && _prevParagraph != null && Math.Abs(_mouseDownParagraph.StartTime.TotalMilliseconds - _prevParagraph.EndTime.TotalMilliseconds) <= ClosenessForBorderSelection + 15)
|
||||
return; // do not decide which paragraph to move yet
|
||||
@ -1272,7 +1272,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
|
||||
if (_mouseDownParagraphType == MouseDownParagraphType.Start)
|
||||
{
|
||||
if (_mouseDownParagraph.EndTime.TotalMilliseconds - milliseconds > MininumSelectionMilliseconds)
|
||||
if (_mouseDownParagraph.EndTime.TotalMilliseconds - milliseconds > MinimumSelectionMilliseconds)
|
||||
{
|
||||
if (AllowMovePrevOrNext)
|
||||
SetMinAndMaxMoveStart();
|
||||
@ -1304,7 +1304,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
}
|
||||
else if (_mouseDownParagraphType == MouseDownParagraphType.End)
|
||||
{
|
||||
if (milliseconds - _mouseDownParagraph.StartTime.TotalMilliseconds > MininumSelectionMilliseconds)
|
||||
if (milliseconds - _mouseDownParagraph.StartTime.TotalMilliseconds > MinimumSelectionMilliseconds)
|
||||
{
|
||||
if (AllowMovePrevOrNext)
|
||||
SetMinAndMaxMoveEnd();
|
||||
@ -1892,7 +1892,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
return v / count;
|
||||
}
|
||||
|
||||
internal void GenerateTimeCodes(double startFromSeconds, int mininumVolumePercent, int maximumVolumePercent, int defaultMilliseconds)
|
||||
internal void GenerateTimeCodes(double startFromSeconds, int minimumVolumePercent, int maximumVolumePercent, int defaultMilliseconds)
|
||||
{
|
||||
int begin = SecondsToXPosition(startFromSeconds);
|
||||
|
||||
@ -1902,11 +1902,11 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
average = average / (_wavePeaks.AllSamples.Count - begin);
|
||||
|
||||
var maxThreshold = (int)(_wavePeaks.DataMaxValue * (maximumVolumePercent / 100.0));
|
||||
var silenceThreshold = (int)(average * (mininumVolumePercent / 100.0));
|
||||
var silenceThreshold = (int)(average * (minimumVolumePercent / 100.0));
|
||||
|
||||
int length50Ms = SecondsToXPosition(0.050);
|
||||
double secondsPerParagraph = defaultMilliseconds / 1000.0;
|
||||
int minBetween = SecondsToXPosition(Configuration.Settings.General.MininumMillisecondsBetweenLines / 1000.0);
|
||||
int minBetween = SecondsToXPosition(Configuration.Settings.General.MinimumMillisecondsBetweenLines / 1000.0);
|
||||
bool subtitleOn = false;
|
||||
int i = begin;
|
||||
while (i < _wavePeaks.AllSamples.Count)
|
||||
|
@ -227,7 +227,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
var waveFile = new WavePeakGenerator(targetFile);
|
||||
|
||||
int sampleRate = Configuration.Settings.VideoControls.WaveformMininumSampleRate; // Normally 128
|
||||
int sampleRate = Configuration.Settings.VideoControls.WaveformMinimumSampleRate; // Normally 128
|
||||
while (waveFile.Header.SampleRate % sampleRate != 0 && sampleRate < 5000)
|
||||
sampleRate++; // old sample-rate / new sample-rate must have rest = 0
|
||||
|
||||
|
@ -317,7 +317,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
var waveFile = new WavePeakGenerator(targetFile);
|
||||
|
||||
int sampleRate = Configuration.Settings.VideoControls.WaveformMininumSampleRate; // Normally 128
|
||||
int sampleRate = Configuration.Settings.VideoControls.WaveformMinimumSampleRate; // Normally 128
|
||||
while (waveFile.Header.SampleRate % sampleRate != 0 && sampleRate < 5000)
|
||||
sampleRate++; // old sample-rate / new sample-rate must have rest = 0
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public int MininumLength
|
||||
public int MinimumLength
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -100,15 +100,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Configuration.Settings.Tools.MergeLinesShorterThan > MininumLength)
|
||||
return MininumLength - 1;
|
||||
if (Configuration.Settings.Tools.MergeLinesShorterThan > MinimumLength)
|
||||
return MinimumLength - 1;
|
||||
return Configuration.Settings.Tools.MergeLinesShorterThan;
|
||||
}
|
||||
}
|
||||
|
||||
private void AutoBalance()
|
||||
{
|
||||
int minLength = MininumLength;
|
||||
int minLength = MinimumLength;
|
||||
Text = Configuration.Settings.Language.AutoBreakUnbreakLines.TitleAutoBreak;
|
||||
|
||||
Subtitle sub = new Subtitle();
|
||||
|
@ -940,7 +940,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
if (p.SetMinDisplayTimeBetweenSubtitles)
|
||||
{
|
||||
double minumumMillisecondsBetweenLines = Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
double minumumMillisecondsBetweenLines = Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
for (int i = 0; i < p.Subtitle.Paragraphs.Count - 1; i++)
|
||||
{
|
||||
Paragraph current = p.Subtitle.GetParagraphOrDefault(i);
|
||||
|
@ -46,8 +46,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
numericUpDownMaxMs.Value = 100;
|
||||
}
|
||||
if (Configuration.Settings.General.MininumMillisecondsBetweenLines >= 1 && Configuration.Settings.General.MininumMillisecondsBetweenLines <= numericUpDownMinMsBetweenLines.Maximum)
|
||||
numericUpDownMinMsBetweenLines.Value = Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
if (Configuration.Settings.General.MinimumMillisecondsBetweenLines >= 1 && Configuration.Settings.General.MinimumMillisecondsBetweenLines <= numericUpDownMinMsBetweenLines.Maximum)
|
||||
numericUpDownMinMsBetweenLines.Value = Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
|
||||
GeneratePreview();
|
||||
}
|
||||
|
@ -922,8 +922,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (AllowFix(p, fixAction))
|
||||
{
|
||||
string oldCurrent = p.ToString();
|
||||
if (next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines > p.EndTime.TotalMilliseconds)
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
if (next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines > p.EndTime.TotalMilliseconds)
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds;
|
||||
noOfShortDisplayTimes++;
|
||||
AddFixToListView(p, fixAction, oldCurrent, p.ToString());
|
||||
@ -963,7 +963,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
// Start current subtitle earlier (max 50 ms)
|
||||
else if (Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && p.StartTime.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds &&
|
||||
diffMs < 50 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines))
|
||||
diffMs < 50 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines))
|
||||
{
|
||||
noOfShortDisplayTimes = MoveStartTime(fixAction, noOfShortDisplayTimes, p, temp, next);
|
||||
}
|
||||
@ -971,14 +971,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else if (diffMs < 1000 &&
|
||||
Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime &&
|
||||
p.StartTime.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds &&
|
||||
(nextNext == null || next.EndTime.TotalMilliseconds + diffMs + Configuration.Settings.General.MininumMillisecondsBetweenLines * 2 < nextNext.StartTime.TotalMilliseconds))
|
||||
(nextNext == null || next.EndTime.TotalMilliseconds + diffMs + Configuration.Settings.General.MinimumMillisecondsBetweenLines * 2 < nextNext.StartTime.TotalMilliseconds))
|
||||
{
|
||||
if (AllowFix(p, fixAction))
|
||||
{
|
||||
string oldCurrent = p.ToString();
|
||||
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds;
|
||||
var nextDurationMs = next.Duration.TotalMilliseconds;
|
||||
next.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
next.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
next.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds + nextDurationMs;
|
||||
noOfShortDisplayTimes++;
|
||||
AddFixToListView(p, fixAction, oldCurrent, p.ToString());
|
||||
@ -986,13 +986,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
// Make next subtitle duration shorter + make current subtitle duration longer
|
||||
else if (diffMs < 1000 &&
|
||||
Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && Utilities.GetCharactersPerSecond(new Paragraph(next.Text, p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines, next.EndTime.TotalMilliseconds)) < Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds)
|
||||
Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && Utilities.GetCharactersPerSecond(new Paragraph(next.Text, p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines, next.EndTime.TotalMilliseconds)) < Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds)
|
||||
{
|
||||
if (AllowFix(p, fixAction))
|
||||
{
|
||||
string oldCurrent = p.ToString();
|
||||
next.StartTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
next.StartTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
noOfShortDisplayTimes++;
|
||||
AddFixToListView(p, fixAction, oldCurrent, p.ToString());
|
||||
}
|
||||
@ -1000,7 +1000,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// Make next-next subtitle duration shorter + move next + make current subtitle duration longer
|
||||
else if (diffMs < 500 &&
|
||||
Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && nextNext != null &&
|
||||
Utilities.GetCharactersPerSecond(new Paragraph(nextNext.Text, nextNext.StartTime.TotalMilliseconds + diffMs + Configuration.Settings.General.MininumMillisecondsBetweenLines, nextNext.EndTime.TotalMilliseconds - (diffMs))) < Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds)
|
||||
Utilities.GetCharactersPerSecond(new Paragraph(nextNext.Text, nextNext.StartTime.TotalMilliseconds + diffMs + Configuration.Settings.General.MinimumMillisecondsBetweenLines, nextNext.EndTime.TotalMilliseconds - (diffMs))) < Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds)
|
||||
{
|
||||
if (AllowFix(p, fixAction))
|
||||
{
|
||||
@ -1015,7 +1015,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
// Start current subtitle earlier (max 200 ms)
|
||||
else if (Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && p.StartTime.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds &&
|
||||
diffMs < 200 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines))
|
||||
diffMs < 200 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines))
|
||||
{
|
||||
noOfShortDisplayTimes = MoveStartTime(fixAction, noOfShortDisplayTimes, p, temp, next);
|
||||
}
|
||||
@ -1038,8 +1038,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (AllowFix(p, fixAction))
|
||||
{
|
||||
string oldCurrent = p.ToString();
|
||||
if (next != null && next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines > p.EndTime.TotalMilliseconds)
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
if (next != null && next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines > p.EndTime.TotalMilliseconds)
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds;
|
||||
noOfShortDisplayTimes++;
|
||||
AddFixToListView(p, fixAction, oldCurrent, p.ToString());
|
||||
|
@ -301,7 +301,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
comboBoxEncoding.Items.Add(Encoding.UTF8.EncodingName);
|
||||
foreach (EncodingInfo ei in Encoding.GetEncodings())
|
||||
{
|
||||
if (ei.Name != Encoding.UTF8.BodyName && ei.CodePage >= 949 && !ei.DisplayName.Contains("EBCDIC") && ei.CodePage != 1047) //Configuration.Settings.General.EncodingMininumCodePage)
|
||||
if (ei.Name != Encoding.UTF8.BodyName && ei.CodePage >= 949 && !ei.DisplayName.Contains("EBCDIC") && ei.CodePage != 1047) //Configuration.Settings.General.EncodingMinimumCodePage)
|
||||
comboBoxEncoding.Items.Add(ei.CodePage + ": " + ei.DisplayName);
|
||||
}
|
||||
SetEncoding(Configuration.Settings.General.DefaultEncoding);
|
||||
@ -479,7 +479,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
audioVisualizer.AllowOverlap = Configuration.Settings.VideoControls.WaveformAllowOverlap;
|
||||
audioVisualizer.ClosenessForBorderSelection = Configuration.Settings.VideoControls.WaveformBorderHitMs;
|
||||
|
||||
for (double zoomCounter = AudioVisualizer.ZoomMininum; zoomCounter <= AudioVisualizer.ZoomMaxinum + (0.001); zoomCounter += 0.1)
|
||||
for (double zoomCounter = AudioVisualizer.ZoomMinimum; zoomCounter <= AudioVisualizer.ZoomMaximum + (0.001); zoomCounter += 0.1)
|
||||
{
|
||||
int percent = (int)Math.Round((zoomCounter * 100));
|
||||
ComboBoxZoomItem item = new ComboBoxZoomItem { Text = percent + "%", ZoomFactor = zoomCounter };
|
||||
@ -6096,7 +6096,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (SubtitleListview1.SelectedItems.Count > 0)
|
||||
firstSelectedIndex = SubtitleListview1.SelectedItems[0].Index;
|
||||
|
||||
int addMilliseconds = Configuration.Settings.General.MininumMillisecondsBetweenLines + 1;
|
||||
int addMilliseconds = Configuration.Settings.General.MinimumMillisecondsBetweenLines + 1;
|
||||
if (addMilliseconds < 1)
|
||||
addMilliseconds = 1;
|
||||
|
||||
@ -6223,7 +6223,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Paragraph next = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
|
||||
if (prev != null)
|
||||
{
|
||||
int addMilliseconds = Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
int addMilliseconds = Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
if (addMilliseconds < 1)
|
||||
addMilliseconds = 1;
|
||||
|
||||
@ -7051,9 +7051,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
double duration = Utilities.GetOptimalDisplayMilliseconds(textBoxListViewText.Text);
|
||||
Paragraph next = _subtitle.GetParagraphOrDefault(index + 1);
|
||||
if (next != null && p.StartTime.TotalMilliseconds + duration + Configuration.Settings.General.MininumMillisecondsBetweenLines > next.StartTime.TotalMilliseconds)
|
||||
if (next != null && p.StartTime.TotalMilliseconds + duration + Configuration.Settings.General.MinimumMillisecondsBetweenLines > next.StartTime.TotalMilliseconds)
|
||||
{
|
||||
duration = next.StartTime.TotalMilliseconds - p.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
duration = next.StartTime.TotalMilliseconds - p.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
if (duration > 500)
|
||||
{
|
||||
@ -7076,9 +7076,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
double duration = Utilities.GetOptimalDisplayMilliseconds(textBoxListViewText.Text);
|
||||
Paragraph next = _subtitle.GetParagraphOrDefault(i + 1);
|
||||
if (next != null && p.StartTime.TotalMilliseconds + duration + Configuration.Settings.General.MininumMillisecondsBetweenLines > next.StartTime.TotalMilliseconds)
|
||||
if (next != null && p.StartTime.TotalMilliseconds + duration + Configuration.Settings.General.MinimumMillisecondsBetweenLines > next.StartTime.TotalMilliseconds)
|
||||
{
|
||||
duration = next.StartTime.TotalMilliseconds - p.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
duration = next.StartTime.TotalMilliseconds - p.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
if (duration < 400)
|
||||
return;
|
||||
}
|
||||
@ -7330,17 +7330,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
newParagraph.EndTime.TotalMilliseconds = currentParagraph.EndTime.TotalMilliseconds;
|
||||
currentParagraph.EndTime.TotalMilliseconds = middle;
|
||||
newParagraph.StartTime.TotalMilliseconds = currentParagraph.EndTime.TotalMilliseconds + 1;
|
||||
if (Configuration.Settings.General.MininumMillisecondsBetweenLines > 0)
|
||||
if (Configuration.Settings.General.MinimumMillisecondsBetweenLines > 0)
|
||||
{
|
||||
Paragraph next = _subtitle.GetParagraphOrDefault(firstSelectedIndex + 1);
|
||||
if (next == null || next.StartTime.TotalMilliseconds > newParagraph.EndTime.TotalMilliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines + Configuration.Settings.General.MininumMillisecondsBetweenLines)
|
||||
if (next == null || next.StartTime.TotalMilliseconds > newParagraph.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines + Configuration.Settings.General.MinimumMillisecondsBetweenLines)
|
||||
{
|
||||
newParagraph.StartTime.TotalMilliseconds += Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
newParagraph.EndTime.TotalMilliseconds += Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
newParagraph.StartTime.TotalMilliseconds += Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
newParagraph.EndTime.TotalMilliseconds += Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
else
|
||||
{
|
||||
newParagraph.StartTime.TotalMilliseconds += Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
newParagraph.StartTime.TotalMilliseconds += Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16767,7 +16767,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_subtitle.Paragraphs[index].StartTime.TotalMilliseconds = TimeSpan.FromSeconds(videoPosition).TotalMilliseconds;
|
||||
if (prev != null && prev.EndTime.TotalMilliseconds > _subtitle.Paragraphs[index].StartTime.TotalMilliseconds)
|
||||
{
|
||||
int minDiff = Configuration.Settings.General.MininumMillisecondsBetweenLines + 1;
|
||||
int minDiff = Configuration.Settings.General.MinimumMillisecondsBetweenLines + 1;
|
||||
if (minDiff < 1)
|
||||
minDiff = 1;
|
||||
prev.EndTime.TotalMilliseconds = _subtitle.Paragraphs[index].StartTime.TotalMilliseconds - minDiff;
|
||||
@ -16821,7 +16821,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SetDurationInSeconds(_subtitle.Paragraphs[index].Duration.TotalSeconds + 0.001);
|
||||
if (next != null)
|
||||
{
|
||||
int addMilliseconds = Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
int addMilliseconds = Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
if (addMilliseconds < 1 || addMilliseconds > 500)
|
||||
addMilliseconds = 1;
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
||||
this.labelMaxMillisecondsBetweenLines.Name = "labelMaxMillisecondsBetweenLines";
|
||||
this.labelMaxMillisecondsBetweenLines.Size = new System.Drawing.Size(172, 13);
|
||||
this.labelMaxMillisecondsBetweenLines.TabIndex = 0;
|
||||
this.labelMaxMillisecondsBetweenLines.Text = "Mininum milliseconds between lines";
|
||||
this.labelMaxMillisecondsBetweenLines.Text = "Minimum milliseconds between lines";
|
||||
//
|
||||
// buttonOK
|
||||
//
|
||||
|
@ -48,8 +48,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
comboBoxFrameRate.SelectedIndex = 5;
|
||||
else
|
||||
comboBoxFrameRate.SelectedIndex = 3;
|
||||
if (string.IsNullOrEmpty(Configuration.Settings.Language.SetMinimumDisplayTimeBetweenParagraphs.OneFrameXisYMilliseconds))
|
||||
groupBoxFrameInfo.Visible = false;
|
||||
}
|
||||
|
||||
private void FixLargeFonts()
|
||||
@ -72,8 +70,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public void Initialize(Subtitle subtitle)
|
||||
{
|
||||
_subtitle = subtitle;
|
||||
numericUpDownMinMillisecondsBetweenLines.Value = Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
// GeneratePreview();
|
||||
numericUpDownMinMillisecondsBetweenLines.Value = Configuration.Settings.General.MinimumMillisecondsBetweenLines != 0
|
||||
? Configuration.Settings.General.MinimumMillisecondsBetweenLines
|
||||
: 1;
|
||||
//GeneratePreview();
|
||||
}
|
||||
|
||||
private void GeneratePreview()
|
||||
@ -136,7 +136,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void numericUpDownMinMillisecondsBetweenLines_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
GeneratePreview();
|
||||
Configuration.Settings.General.MininumMillisecondsBetweenLines = (int)numericUpDownMinMillisecondsBetweenLines.Value;
|
||||
Configuration.Settings.General.MinimumMillisecondsBetweenLines = (int)numericUpDownMinMillisecondsBetweenLines.Value;
|
||||
}
|
||||
|
||||
private void checkBoxShowOnlyChangedLines_CheckedChanged(object sender, EventArgs e)
|
||||
@ -149,20 +149,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
numericUpDownMinMillisecondsBetweenLines.ValueChanged -= numericUpDownMinMillisecondsBetweenLines_ValueChanged;
|
||||
GeneratePreview();
|
||||
numericUpDownMinMillisecondsBetweenLines.ValueChanged += numericUpDownMinMillisecondsBetweenLines_ValueChanged;
|
||||
Configuration.Settings.General.MininumMillisecondsBetweenLines = (int)numericUpDownMinMillisecondsBetweenLines.Value;
|
||||
Configuration.Settings.General.MinimumMillisecondsBetweenLines = (int)numericUpDownMinMillisecondsBetweenLines.Value;
|
||||
}
|
||||
|
||||
private void comboBoxFrameRate_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Configuration.Settings.Language.SetMinimumDisplayTimeBetweenParagraphs.OneFrameXisYMilliseconds))
|
||||
return;
|
||||
|
||||
double frameRate = 25.0;
|
||||
string s = comboBoxFrameRate.Text;
|
||||
s = s.Replace(",", ".").Trim();
|
||||
double d;
|
||||
if (double.TryParse(s, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d))
|
||||
frameRate = d;
|
||||
double frameRate;
|
||||
if (!double.TryParse(comboBoxFrameRate.Text.Trim().Replace(',', '.'),
|
||||
NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out frameRate))
|
||||
frameRate = 25.0;
|
||||
|
||||
long ms = (long)Math.Round(1000 / frameRate);
|
||||
labelOneFrameIsXMS.Text = string.Format(Configuration.Settings.Language.SetMinimumDisplayTimeBetweenParagraphs.OneFrameXisYMilliseconds, frameRate, ms);
|
||||
|
@ -115,9 +115,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
numericUpDownDurationMin.Value = gs.SubtitleMinimumDisplayMilliseconds;
|
||||
numericUpDownDurationMax.Value = gs.SubtitleMaximumDisplayMilliseconds;
|
||||
|
||||
if (gs.MininumMillisecondsBetweenLines >= numericUpDownMinGapMs.Minimum &&
|
||||
gs.MininumMillisecondsBetweenLines <= numericUpDownMinGapMs.Maximum)
|
||||
numericUpDownMinGapMs.Value = gs.MininumMillisecondsBetweenLines;
|
||||
if (gs.MinimumMillisecondsBetweenLines >= numericUpDownMinGapMs.Minimum &&
|
||||
gs.MinimumMillisecondsBetweenLines <= numericUpDownMinGapMs.Maximum)
|
||||
numericUpDownMinGapMs.Value = gs.MinimumMillisecondsBetweenLines;
|
||||
|
||||
if (gs.VideoPlayer.Trim().Equals("VLC", StringComparison.OrdinalIgnoreCase) && LibVlcDynamic.IsInstalled)
|
||||
radioButtonVideoPlayerVLC.Checked = true;
|
||||
@ -1048,7 +1048,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
gs.SubtitleMinimumDisplayMilliseconds = (int)numericUpDownDurationMin.Value;
|
||||
gs.SubtitleMaximumDisplayMilliseconds = (int)numericUpDownDurationMax.Value;
|
||||
gs.MininumMillisecondsBetweenLines = (int)numericUpDownMinGapMs.Value;
|
||||
gs.MinimumMillisecondsBetweenLines = (int)numericUpDownMinGapMs.Value;
|
||||
|
||||
if (comboBoxAutoBackup.SelectedIndex == 1)
|
||||
gs.AutoBackupSeconds = 60;
|
||||
|
@ -219,9 +219,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var arr = text.SplitToLines();
|
||||
if (arr.Length == 2)
|
||||
{
|
||||
int spacing1 = Configuration.Settings.General.MininumMillisecondsBetweenLines / 2;
|
||||
int spacing2 = Configuration.Settings.General.MininumMillisecondsBetweenLines / 2;
|
||||
if (Configuration.Settings.General.MininumMillisecondsBetweenLines % 2 == 1)
|
||||
int spacing1 = Configuration.Settings.General.MinimumMillisecondsBetweenLines / 2;
|
||||
int spacing2 = Configuration.Settings.General.MinimumMillisecondsBetweenLines / 2;
|
||||
if (Configuration.Settings.General.MinimumMillisecondsBetweenLines % 2 == 1)
|
||||
spacing2++;
|
||||
|
||||
var newParagraph1 = new Paragraph(p);
|
||||
|
@ -28,7 +28,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
text = text.TrimStart('.').TrimStart();
|
||||
}
|
||||
|
||||
// "...foobar" / "... foobar" / ". .. foobar"
|
||||
// "...foobar" / "... foobar" / ". .. foobar"
|
||||
if (text.StartsWith("\"") && (text.StartsWith("\"..") || text.StartsWith("\". .") || text.StartsWith("\" ..") || text.StartsWith("\" . .")))
|
||||
{
|
||||
int removeLength = 0;
|
||||
|
@ -72,9 +72,9 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
var arr = text.SplitToLines();
|
||||
if (arr.Length == 2)
|
||||
{
|
||||
int spacing1 = Configuration.Settings.General.MininumMillisecondsBetweenLines / 2;
|
||||
int spacing2 = Configuration.Settings.General.MininumMillisecondsBetweenLines / 2;
|
||||
if (Configuration.Settings.General.MininumMillisecondsBetweenLines % 2 == 1)
|
||||
int spacing1 = Configuration.Settings.General.MinimumMillisecondsBetweenLines / 2;
|
||||
int spacing2 = Configuration.Settings.General.MinimumMillisecondsBetweenLines / 2;
|
||||
if (Configuration.Settings.General.MinimumMillisecondsBetweenLines % 2 == 1)
|
||||
spacing2++;
|
||||
|
||||
double duration = p.Duration.TotalMilliseconds / 2.0;
|
||||
|
@ -467,7 +467,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public int SubtitleLineMaximumLength { get; set; }
|
||||
public int SubtitleMinimumDisplayMilliseconds { get; set; }
|
||||
public int SubtitleMaximumDisplayMilliseconds { get; set; }
|
||||
public int MininumMillisecondsBetweenLines { get; set; }
|
||||
public int MinimumMillisecondsBetweenLines { get; set; }
|
||||
public int SetStartEndHumanDelay { get; set; }
|
||||
public bool AutoWrapLineWhileTyping { get; set; }
|
||||
public double SubtitleMaximumCharactersPerSeconds { get; set; }
|
||||
@ -567,7 +567,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
SubtitleLineMaximumLength = 43;
|
||||
SubtitleMinimumDisplayMilliseconds = 1000;
|
||||
SubtitleMaximumDisplayMilliseconds = 8 * 1000;
|
||||
MininumMillisecondsBetweenLines = 24;
|
||||
MinimumMillisecondsBetweenLines = 24;
|
||||
SetStartEndHumanDelay = 100;
|
||||
AutoWrapLineWhileTyping = false;
|
||||
SubtitleMaximumCharactersPerSeconds = 25.0;
|
||||
@ -647,7 +647,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public bool WaveformMouseWheelScrollUpIsForward { get; set; }
|
||||
public bool GenerateSpectrogram { get; set; }
|
||||
public string SpectrogramAppearance { get; set; }
|
||||
public int WaveformMininumSampleRate { get; set; }
|
||||
public int WaveformMinimumSampleRate { get; set; }
|
||||
public double WaveformSeeksSilenceDurationSeconds { get; set; }
|
||||
public int WaveformSeeksSilenceMaxVolume { get; set; }
|
||||
|
||||
@ -673,7 +673,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
WaveformDoubleClickOnNonParagraphAction = string.Empty;
|
||||
WaveformMouseWheelScrollUpIsForward = true;
|
||||
SpectrogramAppearance = "OneColorGradient";
|
||||
WaveformMininumSampleRate = 126;
|
||||
WaveformMinimumSampleRate = 126;
|
||||
WaveformSeeksSilenceDurationSeconds = 0.3;
|
||||
WaveformSeeksSilenceMaxVolume = 10;
|
||||
}
|
||||
@ -1316,9 +1316,11 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
subNode = node.SelectSingleNode("SubtitleMaximumDisplayMilliseconds");
|
||||
if (subNode != null)
|
||||
settings.General.SubtitleMaximumDisplayMilliseconds = Convert.ToInt32(subNode.InnerText);
|
||||
subNode = node.SelectSingleNode("MininumMillisecondsBetweenLines");
|
||||
subNode = node.SelectSingleNode("MinimumMillisecondsBetweenLines");
|
||||
if (subNode == null) // TODO: Remove in 3.5
|
||||
subNode = node.SelectSingleNode("MininumMillisecondsBetweenLines");
|
||||
if (subNode != null)
|
||||
settings.General.MininumMillisecondsBetweenLines = Convert.ToInt32(subNode.InnerText);
|
||||
settings.General.MinimumMillisecondsBetweenLines = Convert.ToInt32(subNode.InnerText);
|
||||
subNode = node.SelectSingleNode("SetStartEndHumanDelay");
|
||||
if (subNode != null)
|
||||
settings.General.SetStartEndHumanDelay = Convert.ToInt32(subNode.InnerText);
|
||||
@ -2051,9 +2053,11 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
subNode = node.SelectSingleNode("SpectrogramAppearance");
|
||||
if (subNode != null)
|
||||
settings.VideoControls.SpectrogramAppearance = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("WaveformMininumSampleRate");
|
||||
subNode = node.SelectSingleNode("WaveformMinimumSampleRate");
|
||||
if (subNode == null) // TODO: Remove in 3.5
|
||||
subNode = node.SelectSingleNode("WaveformMininumSampleRate");
|
||||
if (subNode != null)
|
||||
settings.VideoControls.WaveformMininumSampleRate = Convert.ToInt32(subNode.InnerText);
|
||||
settings.VideoControls.WaveformMinimumSampleRate = Convert.ToInt32(subNode.InnerText);
|
||||
subNode = node.SelectSingleNode("WaveformSeeksSilenceDurationSeconds");
|
||||
if (subNode != null)
|
||||
settings.VideoControls.WaveformSeeksSilenceDurationSeconds = Convert.ToDouble(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||
@ -2690,7 +2694,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
textWriter.WriteElementString("SubtitleLineMaximumLength", settings.General.SubtitleLineMaximumLength.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("SubtitleMinimumDisplayMilliseconds", settings.General.SubtitleMinimumDisplayMilliseconds.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("SubtitleMaximumDisplayMilliseconds", settings.General.SubtitleMaximumDisplayMilliseconds.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("MininumMillisecondsBetweenLines", settings.General.MininumMillisecondsBetweenLines.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("MinimumMillisecondsBetweenLines", settings.General.MinimumMillisecondsBetweenLines.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("SetStartEndHumanDelay", settings.General.SetStartEndHumanDelay.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("AutoWrapLineWhileTyping", settings.General.AutoWrapLineWhileTyping.ToString());
|
||||
textWriter.WriteElementString("SubtitleMaximumCharactersPerSeconds", settings.General.SubtitleMaximumCharactersPerSeconds.ToString(CultureInfo.InvariantCulture));
|
||||
@ -2947,7 +2951,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
textWriter.WriteElementString("WaveformMouseWheelScrollUpIsForward", settings.VideoControls.WaveformMouseWheelScrollUpIsForward.ToString());
|
||||
textWriter.WriteElementString("GenerateSpectrogram", settings.VideoControls.GenerateSpectrogram.ToString());
|
||||
textWriter.WriteElementString("SpectrogramAppearance", settings.VideoControls.SpectrogramAppearance);
|
||||
textWriter.WriteElementString("WaveformMininumSampleRate", settings.VideoControls.WaveformMininumSampleRate.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("WaveformMinimumSampleRate", settings.VideoControls.WaveformMinimumSampleRate.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("WaveformSeeksSilenceDurationSeconds", settings.VideoControls.WaveformSeeksSilenceDurationSeconds.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("WaveformSeeksSilenceMaxVolume", settings.VideoControls.WaveformSeeksSilenceMaxVolume.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteEndElement();
|
||||
|
@ -385,9 +385,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
|
||||
Paragraph next = GetParagraphOrDefault(i + 1);
|
||||
if (next != null && p.StartTime.TotalMilliseconds + duration + Configuration.Settings.General.MininumMillisecondsBetweenLines > next.StartTime.TotalMilliseconds)
|
||||
if (next != null && p.StartTime.TotalMilliseconds + duration + Configuration.Settings.General.MinimumMillisecondsBetweenLines > next.StartTime.TotalMilliseconds)
|
||||
{
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
if (p.Duration.TotalMilliseconds <= 0)
|
||||
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + 1;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
p.StartTime = DecodeTimestamp(buffer, i + 2);
|
||||
|
||||
if (last != null && last.EndTime.TotalMilliseconds > p.StartTime.TotalMilliseconds)
|
||||
last.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
last.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
|
||||
p.EndTime = DecodeTimestamp(buffer, i + 6);
|
||||
|
||||
|
@ -146,7 +146,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
Paragraph next = subtitle.Paragraphs[i + 1];
|
||||
if (p.EndTime.TotalMilliseconds > next.StartTime.TotalMilliseconds)
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
p = subtitle.Paragraphs[j];
|
||||
Paragraph next = subtitle.Paragraphs[j + 1];
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
if (subtitle.Paragraphs.Count > 0)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
else
|
||||
{
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
if (p.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds)
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
var p2 = subtitle.Paragraphs[i];
|
||||
var next = subtitle.Paragraphs[i + 1];
|
||||
p2.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p2.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
if (subtitle.Paragraphs.Count > 0)
|
||||
subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].EndTime.TotalMilliseconds = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].StartTime.TotalMilliseconds +
|
||||
|
@ -12,7 +12,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
/// <summary>
|
||||
/// http://www.theneitherworld.com/mcpoodle/SCC_TOOLS/DOCS/SCC_FORMAT.HTML
|
||||
/// § 15.119 47 CFR Ch. I (10–1–10 Edition) (pdf)
|
||||
/// Maxinum four lines + max 32 characters on each line
|
||||
/// Maximum four lines + max 32 characters on each line
|
||||
/// </summary>
|
||||
public class ScenaristClosedCaptions : SubtitleFormat
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
p = subtitle.Paragraphs[j];
|
||||
Paragraph next = subtitle.Paragraphs[j + 1];
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
if (subtitle.Paragraphs.Count > 0)
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
Paragraph current = subtitle.Paragraphs[i];
|
||||
Paragraph next = subtitle.GetParagraphOrDefault(i + 1);
|
||||
if (next != null)
|
||||
current.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
current.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
else
|
||||
current.EndTime.TotalMilliseconds = current.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(current.Text);
|
||||
|
||||
|
@ -127,7 +127,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
Paragraph current = subtitle.Paragraphs[i];
|
||||
Paragraph next = subtitle.GetParagraphOrDefault(i + 1);
|
||||
if (next != null)
|
||||
current.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
current.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
else
|
||||
current.EndTime.TotalMilliseconds = current.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(current.Text);
|
||||
|
||||
|
@ -139,7 +139,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(p.Text);
|
||||
if (i < subtitle.Paragraphs.Count - 2 && p.EndTime.TotalMilliseconds >= subtitle.Paragraphs[i + 1].StartTime.TotalMilliseconds)
|
||||
p.EndTime.TotalMilliseconds = subtitle.Paragraphs[i + 1].StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = subtitle.Paragraphs[i + 1].StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
if (!allNullEndTime)
|
||||
subtitle.Paragraphs.Clear();
|
||||
|
@ -132,7 +132,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(p.Text);
|
||||
if (i < subtitle.Paragraphs.Count - 2 && p.EndTime.TotalMilliseconds >= subtitle.Paragraphs[i + 1].StartTime.TotalMilliseconds)
|
||||
p.EndTime.TotalMilliseconds = subtitle.Paragraphs[i + 1].StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = subtitle.Paragraphs[i + 1].StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
if (!allNullEndTime)
|
||||
subtitle.Paragraphs.Clear();
|
||||
|
@ -107,7 +107,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
Paragraph next = subtitle.Paragraphs[i + 1];
|
||||
if (p.EndTime.TotalMilliseconds > next.StartTime.TotalMilliseconds)
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
subtitle.Renumber(1);
|
||||
|
@ -120,7 +120,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
TimeCode start = DecodeTimeCode(timeParts[0]);
|
||||
if (p != null && p.EndTime.TotalMilliseconds == 0)
|
||||
p.EndTime.TotalMilliseconds = start.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = start.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
TimeCode end = new TimeCode(0, 0, 0, 0);
|
||||
p = MakeTextParagraph(text, p, start, end);
|
||||
subtitle.Paragraphs.Add(p);
|
||||
@ -137,7 +137,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
TimeCode start = DecodeTimeCode(timeParts[0]);
|
||||
if (p != null && p.EndTime.TotalMilliseconds == 0)
|
||||
p.EndTime.TotalMilliseconds = start.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.EndTime.TotalMilliseconds = start.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
TimeCode end = DecodeTimeCode(timeParts[1]);
|
||||
p = MakeTextParagraph(text, p, start, end);
|
||||
subtitle.Paragraphs.Add(p);
|
||||
|
@ -556,7 +556,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
var next = subtitle.GetParagraphOrDefault(i);
|
||||
if (next != null && a.EndTime.TotalMilliseconds >= next.StartTime.TotalMilliseconds)
|
||||
{
|
||||
a.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
a.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
return subtitle;
|
||||
|
@ -1265,7 +1265,7 @@ namespace Test
|
||||
const string input = "- I...";
|
||||
string actual = FixCommonErrorsHelper.FixEllipsesStartHelper(input);
|
||||
Assert.AreEqual(actual, input);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Ellipses start
|
||||
|
||||
|
@ -84,7 +84,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
if (fieldInfo.FieldType.Name == "String")
|
||||
{
|
||||
sb.AppendLine("\t\t\t\tcase \"" + (xmlPath + "/" + fieldInfo.Name).TrimStart('/') + "\":");
|
||||
sb.AppendLine("\t\t\t\t\tlanguage." + (xmlPath.Replace("/", ".") + "." + fieldInfo.Name).TrimStart('.') + " = reader.Value;");
|
||||
sb.AppendLine("\t\t\t\t\tlanguage." + (xmlPath.Replace('/', '.') + "." + fieldInfo.Name).TrimStart('.') + " = reader.Value;");
|
||||
sb.AppendLine("\t\t\t\t\tbreak;");
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
if (prp.PropertyType.Name == "String")
|
||||
{
|
||||
sb.AppendLine("\t\t\t\tcase \"" + (xmlPath + "/" + prp.Name).TrimStart('/') + "\":");
|
||||
sb.AppendLine("\t\t\t\t\tlanguage." + (xmlPath.Replace("/", ".") + "." + prp.Name).TrimStart('.') + " = reader.Value;");
|
||||
sb.AppendLine("\t\t\t\t\tlanguage." + (xmlPath.Replace('/', '.') + "." + prp.Name).TrimStart('.') + " = reader.Value;");
|
||||
sb.AppendLine("\t\t\t\t\tbreak;");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user