mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
Minor improvements for "Bridge short gaps"
This commit is contained in:
parent
d5b1b33f98
commit
6455d6eccf
7
src/Forms/DurationsBridgeGaps.Designer.cs
generated
7
src/Forms/DurationsBridgeGaps.Designer.cs
generated
@ -168,9 +168,9 @@
|
||||
this.radioButtonDivideEven.AutoSize = true;
|
||||
this.radioButtonDivideEven.Location = new System.Drawing.Point(586, 40);
|
||||
this.radioButtonDivideEven.Name = "radioButtonDivideEven";
|
||||
this.radioButtonDivideEven.Size = new System.Drawing.Size(130, 17);
|
||||
this.radioButtonDivideEven.Size = new System.Drawing.Size(125, 17);
|
||||
this.radioButtonDivideEven.TabIndex = 6;
|
||||
this.radioButtonDivideEven.Text = "Texts divides gap time";
|
||||
this.radioButtonDivideEven.Text = "Texts divide gap time";
|
||||
this.radioButtonDivideEven.UseVisualStyleBackColor = true;
|
||||
this.radioButtonDivideEven.CheckedChanged += new System.EventHandler(this.numericUpDownMaxMs_ValueChanged);
|
||||
//
|
||||
@ -186,7 +186,7 @@
|
||||
// numericUpDownMinMsBetweenLines
|
||||
//
|
||||
this.numericUpDownMinMsBetweenLines.Increment = new decimal(new int[] {
|
||||
25,
|
||||
5,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
@ -209,6 +209,7 @@
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownMinMsBetweenLines.ValueChanged += new System.EventHandler(this.numericUpDownMinMsBetweenLines_ValueChanged);
|
||||
//
|
||||
// DurationsBridgeGaps
|
||||
//
|
||||
|
@ -8,10 +8,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
public partial class DurationsBridgeGaps : PositionAndSizeForm
|
||||
{
|
||||
private Subtitle _subtitle;
|
||||
private readonly Subtitle _subtitle;
|
||||
private Subtitle _fixedSubtitle;
|
||||
private Dictionary<string, string> _dic;
|
||||
|
||||
private readonly Timer _refreshTimer = new Timer();
|
||||
public Subtitle FixedSubtitle { get { return _fixedSubtitle; } }
|
||||
|
||||
public DurationsBridgeGaps(Subtitle subtitle)
|
||||
@ -49,9 +49,23 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (Configuration.Settings.General.MinimumMillisecondsBetweenLines >= 1 && Configuration.Settings.General.MinimumMillisecondsBetweenLines <= numericUpDownMinMsBetweenLines.Maximum)
|
||||
numericUpDownMinMsBetweenLines.Value = Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
|
||||
_refreshTimer.Interval = 400;
|
||||
_refreshTimer.Tick += RefreshTimerTick;
|
||||
GeneratePreview();
|
||||
}
|
||||
|
||||
private void RefreshTimerTick(object sender, EventArgs e)
|
||||
{
|
||||
_refreshTimer.Stop();
|
||||
GeneratePreviewReal();
|
||||
}
|
||||
|
||||
public override sealed string Text
|
||||
{
|
||||
get { return base.Text; }
|
||||
set { base.Text = value; }
|
||||
}
|
||||
|
||||
private void buttonOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
Configuration.Settings.Tools.BridgeGapMilliseconds = (int)numericUpDownMaxMs.Value;
|
||||
@ -64,10 +78,24 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
private void GeneratePreview()
|
||||
{
|
||||
if (_refreshTimer.Enabled)
|
||||
{
|
||||
_refreshTimer.Stop();
|
||||
_refreshTimer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_refreshTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void GeneratePreviewReal()
|
||||
{
|
||||
if (_subtitle == null)
|
||||
return;
|
||||
|
||||
Cursor = Cursors.WaitCursor;
|
||||
SubtitleListview1.Items.Clear();
|
||||
SubtitleListview1.BeginUpdate();
|
||||
int count = 0;
|
||||
@ -75,7 +103,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_dic = new Dictionary<string, string>();
|
||||
var fixedIndexes = new List<int>(_fixedSubtitle.Paragraphs.Count);
|
||||
|
||||
int minMsBetweenLines = (int)numericUpDownMinMsBetweenLines.Value;
|
||||
var minMsBetweenLines = (int)numericUpDownMinMsBetweenLines.Value;
|
||||
for (int i = 0; i < _fixedSubtitle.Paragraphs.Count - 1; i++)
|
||||
{
|
||||
Paragraph cur = _fixedSubtitle.Paragraphs[i];
|
||||
@ -98,7 +126,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var msToNext = next.StartTime.TotalMilliseconds - cur.EndTime.TotalMilliseconds;
|
||||
if (msToNext < 2000)
|
||||
{
|
||||
string info = string.Empty;
|
||||
string info;
|
||||
if (!string.IsNullOrEmpty(before))
|
||||
info = string.Format("{0} => {1:0.000}", before, msToNext / TimeCode.BaseUnit);
|
||||
else
|
||||
@ -120,13 +148,18 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.SetBackgroundColor(index, Color.Green);
|
||||
SubtitleListview1.EndUpdate();
|
||||
groupBoxLinesFound.Text = string.Format(Configuration.Settings.Language.DurationsBridgeGaps.GapsBridgedX, count);
|
||||
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
private void numericUpDownMaxMs_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
Cursor = Cursors.WaitCursor;
|
||||
{
|
||||
GeneratePreview();
|
||||
}
|
||||
|
||||
private void numericUpDownMinMsBetweenLines_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
GeneratePreview();
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
private void DurationsBridgeGaps_KeyDown(object sender, KeyEventArgs e)
|
||||
|
@ -471,7 +471,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
BridgeGapsSmallerThanXPart2 = "milliseconds",
|
||||
MinMillisecondsBetweenLines = "Min. milliseconds between lines",
|
||||
ProlongEndTime = "Previous text takes all gap time",
|
||||
DivideEven = "Texts divides gap time",
|
||||
DivideEven = "Texts divide gap time",
|
||||
};
|
||||
|
||||
DvdSubRip = new LanguageStructure.DvdSubRip
|
||||
|
Loading…
Reference in New Issue
Block a user