diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index e6b27fcbe..7325470c4 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -25018,6 +25018,7 @@ namespace Nikse.SubtitleEdit.Forms SubtitleListview1.Items.Clear(); // for performance } + var oldLayout = LayoutManager.LastLayout; LayoutManager.SetLayout(layout, this, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit, SplitContainerListViewAndTextSplitterMoved); if (isLarge) @@ -25034,6 +25035,15 @@ namespace Nikse.SubtitleEdit.Forms { TryToFindAndOpenVideoFile(Utilities.GetPathAndFileNameWithoutExtension(_fileName)); } + + if (_subtitleListViewIndex >= 0) + { + SubtitleListview1.SelectIndexAndEnsureVisible(_subtitleListViewIndex, true); + if (layout != LayoutManager.LayoutNoVideo && oldLayout == LayoutManager.LayoutNoVideo) + { + GotoSubPosAndPause(); + } + } } public void ShowEarlierOrLater(double adjustMilliseconds, SelectionChoice selection) diff --git a/src/ui/Logic/LayoutManager.cs b/src/ui/Logic/LayoutManager.cs index 944d36afb..44c07e6ff 100644 --- a/src/ui/Logic/LayoutManager.cs +++ b/src/ui/Logic/LayoutManager.cs @@ -17,7 +17,7 @@ namespace Nikse.SubtitleEdit.Logic public const int WaveformPanelMinimumHeight = 124; public static SplitContainer MainSplitContainer { get; set; } - private static int _lastLayout = -1; + public static int LastLayout = -1; private static Dictionary LayoutInMemory { get; set; } public static void SetLayout(int layout, Form form, Control videoPlayer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit, SplitterEventHandler splitMoved) @@ -32,14 +32,14 @@ namespace Nikse.SubtitleEdit.Logic LayoutInMemory = new Dictionary(); } - if (_lastLayout >= 0) + if (LastLayout >= 0) { - if (LayoutInMemory.ContainsKey(_lastLayout)) + if (LayoutInMemory.ContainsKey(LastLayout)) { - LayoutInMemory.Remove(_lastLayout); + LayoutInMemory.Remove(LastLayout); } - LayoutInMemory.Add(_lastLayout, SaveLayout()); + LayoutInMemory.Add(LastLayout, SaveLayout()); } switch (layout) @@ -87,7 +87,7 @@ namespace Nikse.SubtitleEdit.Logic RestoreLayout(LayoutInMemory[layout]); } - _lastLayout = layout; + LastLayout = layout; } // default layout (video right)