mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Fix #1768 + reset file name when importing plain text + save last format when changing format
This commit is contained in:
parent
307a6f9e66
commit
d3387de958
@ -14,6 +14,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private Dictionary<string, string> _dic;
|
||||
private readonly Timer _refreshTimer = new Timer();
|
||||
public Subtitle FixedSubtitle { get { return _fixedSubtitle; } }
|
||||
public int FixedCount { get; private set; }
|
||||
|
||||
public DurationsBridgeGaps(Subtitle subtitle)
|
||||
{
|
||||
@ -64,7 +65,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
GeneratePreviewReal();
|
||||
}
|
||||
|
||||
public override sealed string Text
|
||||
public sealed override string Text
|
||||
{
|
||||
get { return base.Text; }
|
||||
set { base.Text = value; }
|
||||
@ -102,7 +103,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Cursor = Cursors.WaitCursor;
|
||||
SubtitleListview1.Items.Clear();
|
||||
SubtitleListview1.BeginUpdate();
|
||||
int count = 0;
|
||||
FixedCount = 0;
|
||||
_fixedSubtitle = new Subtitle(_subtitle);
|
||||
_dic = new Dictionary<string, string>();
|
||||
var fixedIndexes = new List<int>(_fixedSubtitle.Paragraphs.Count);
|
||||
@ -125,7 +126,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
cur.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - minMsBetweenLines;
|
||||
fixedIndexes.Add(i);
|
||||
fixedIndexes.Add(i + 1);
|
||||
count++;
|
||||
FixedCount++;
|
||||
}
|
||||
var msToNext = next.StartTime.TotalMilliseconds - cur.EndTime.TotalMilliseconds;
|
||||
if (msToNext < 2000)
|
||||
@ -151,7 +152,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
foreach (var index in fixedIndexes)
|
||||
SubtitleListview1.SetBackgroundColor(index, Color.Green);
|
||||
SubtitleListview1.EndUpdate();
|
||||
groupBoxLinesFound.Text = string.Format(Configuration.Settings.Language.DurationsBridgeGaps.GapsBridgedX, count);
|
||||
groupBoxLinesFound.Text = string.Format(Configuration.Settings.Language.DurationsBridgeGaps.GapsBridgedX, FixedCount);
|
||||
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
@ -3523,6 +3523,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
ShowStatus(string.Format(_language.ConvertedToX, format.FriendlyName));
|
||||
_oldSubtitleFormat = format;
|
||||
Configuration.Settings.General.LastSaveAsFormat = format.Name;
|
||||
|
||||
if (format.HasStyleSupport && _networkSession == null)
|
||||
{
|
||||
@ -12488,8 +12489,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (ContinueNewOrExit())
|
||||
{
|
||||
MakeHistoryForUndo(_language.BeforeImportText);
|
||||
|
||||
ResetSubtitle();
|
||||
if (!string.IsNullOrEmpty(importText.VideoFileName))
|
||||
{
|
||||
OpenVideo(importText.VideoFileName);
|
||||
_fileName = importText.VideoFileName;
|
||||
_converted = true;
|
||||
}
|
||||
|
||||
_subtitleListViewIndex = -1;
|
||||
_subtitle = importText.FixedSubtitle;
|
||||
@ -19504,7 +19511,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
using (var form = new DurationsBridgeGaps(_subtitle))
|
||||
{
|
||||
if (form.ShowDialog(this) == DialogResult.OK)
|
||||
if (form.ShowDialog(this) == DialogResult.OK && form.FixedCount > 0)
|
||||
{
|
||||
int index = FirstSelectedIndex;
|
||||
if (index < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user