Drag'n'drop sub on main window - only hide prev sub just before loading - thx Jamakmake :)

This commit is contained in:
Nikolaj Olsson 2020-05-05 12:22:22 +02:00
parent 01f65e13e4
commit 9cb7869fb5

View File

@ -2940,6 +2940,9 @@ namespace Nikse.SubtitleEdit.Forms
if (format != null) if (format != null)
{ {
RemoveAlternate(true, false);
SubtitleListview1.HideColumn(SubtitleListView.SubtitleColumn.Extra);
new BookmarkPersistence(_subtitle, fileName).Load(); new BookmarkPersistence(_subtitle, fileName).Load();
if (Configuration.Settings.General.RemoveBlankLinesWhenOpening) if (Configuration.Settings.General.RemoveBlankLinesWhenOpening)
@ -12886,12 +12889,12 @@ namespace Nikse.SubtitleEdit.Forms
} }
else if (subtitleList.Count > 1) else if (subtitleList.Count > 1)
{ {
ResetSubtitle();
using (var subtitleChooser = new MatroskaSubtitleChooser("mkv")) using (var subtitleChooser = new MatroskaSubtitleChooser("mkv"))
{ {
subtitleChooser.Initialize(subtitleList); subtitleChooser.Initialize(subtitleList);
if (subtitleChooser.ShowDialog(this) == DialogResult.OK) if (subtitleChooser.ShowDialog(this) == DialogResult.OK)
{ {
ResetSubtitle();
if (LoadMatroskaSubtitle(subtitleList[subtitleChooser.SelectedIndex], matroska, false) && if (LoadMatroskaSubtitle(subtitleList[subtitleChooser.SelectedIndex], matroska, false) &&
(ext.Equals(".mkv", StringComparison.Ordinal) || ext.Equals(".mks", StringComparison.Ordinal)) && (ext.Equals(".mkv", StringComparison.Ordinal) || ext.Equals(".mks", StringComparison.Ordinal)) &&
!Configuration.Settings.General.DisableVideoAutoLoading) !Configuration.Settings.General.DisableVideoAutoLoading)
@ -12922,14 +12925,12 @@ namespace Nikse.SubtitleEdit.Forms
var mp4SubtitleTracks = mp4Parser.GetSubtitleTracks(); var mp4SubtitleTracks = mp4Parser.GetSubtitleTracks();
if (mp4SubtitleTracks.Count > 0) if (mp4SubtitleTracks.Count > 0)
{ {
ResetSubtitle();
ImportSubtitleFromMp4(fileName); ImportSubtitleFromMp4(fileName);
return; return;
} }
} }
else if (ext == ".vob" || ext == ".ifo") else if (ext == ".vob" || ext == ".ifo")
{ {
ResetSubtitle();
ImportDvdSubtitle(fileName); ImportDvdSubtitle(fileName);
return; return;
} }
@ -12938,7 +12939,6 @@ namespace Nikse.SubtitleEdit.Forms
var subFileName = fileName.Substring(0, fileName.Length - 3) + "sub"; var subFileName = fileName.Substring(0, fileName.Length - 3) + "sub";
if (File.Exists(subFileName) && FileUtil.IsVobSub(subFileName)) if (File.Exists(subFileName) && FileUtil.IsVobSub(subFileName))
{ {
ResetSubtitle();
ImportAndOcrVobSubSubtitleNew(subFileName, _loading); ImportAndOcrVobSubSubtitleNew(subFileName, _loading);
return; return;
} }
@ -12949,7 +12949,6 @@ namespace Nikse.SubtitleEdit.Forms
if (file.Length < Subtitle.MaxFileSize) if (file.Length < Subtitle.MaxFileSize)
{ {
ResetSubtitle();
if (!OpenFromRecentFiles(fileName)) if (!OpenFromRecentFiles(fileName))
{ {
OpenSubtitle(fileName, null); OpenSubtitle(fileName, null);
@ -12957,22 +12956,18 @@ namespace Nikse.SubtitleEdit.Forms
} }
else if (file.Length < 150000000 && ext == ".sub" && IsVobSubFile(fileName, true)) // max 150 mb else if (file.Length < 150000000 && ext == ".sub" && IsVobSubFile(fileName, true)) // max 150 mb
{ {
ResetSubtitle();
OpenSubtitle(fileName, null); OpenSubtitle(fileName, null);
} }
else if (file.Length < 250000000 && ext == ".sup" && FileUtil.IsBluRaySup(fileName)) // max 250 mb else if (file.Length < 250000000 && ext == ".sup" && FileUtil.IsBluRaySup(fileName)) // max 250 mb
{ {
ResetSubtitle();
OpenSubtitle(fileName, null); OpenSubtitle(fileName, null);
} }
else if ((ext == ".ts" || ext == ".rec" || ext == ".mpg" || ext == ".mpeg") && FileUtil.IsTransportStream(fileName)) else if ((ext == ".ts" || ext == ".rec" || ext == ".mpg" || ext == ".mpeg") && FileUtil.IsTransportStream(fileName))
{ {
ResetSubtitle();
OpenSubtitle(fileName, null); OpenSubtitle(fileName, null);
} }
else if ((ext == ".m2ts" || ext == ".ts" || ext == ".mts") && FileUtil.IsM2TransportStream(fileName)) else if ((ext == ".m2ts" || ext == ".ts" || ext == ".mts") && FileUtil.IsM2TransportStream(fileName))
{ {
ResetSubtitle();
OpenSubtitle(fileName, null); OpenSubtitle(fileName, null);
} }
else else