diff --git a/Icons/Black/VideoToggle.png b/Icons/Black/VideoToggle.png deleted file mode 100644 index 6ab17cd8e..000000000 Binary files a/Icons/Black/VideoToggle.png and /dev/null differ diff --git a/Icons/Black/WaveformToggle.png b/Icons/Black/WaveformToggle.png deleted file mode 100644 index 8c4af4a27..000000000 Binary files a/Icons/Black/WaveformToggle.png and /dev/null differ diff --git a/Icons/DarkTheme/VideoToggle.png b/Icons/DarkTheme/VideoToggle.png deleted file mode 100644 index df80697dd..000000000 Binary files a/Icons/DarkTheme/VideoToggle.png and /dev/null differ diff --git a/Icons/DarkTheme/WaveformToggle.png b/Icons/DarkTheme/WaveformToggle.png deleted file mode 100644 index c631f19ee..000000000 Binary files a/Icons/DarkTheme/WaveformToggle.png and /dev/null differ diff --git a/Icons/DefaultTheme/VideoToggle.png b/Icons/DefaultTheme/VideoToggle.png deleted file mode 100644 index 48f075b1b..000000000 Binary files a/Icons/DefaultTheme/VideoToggle.png and /dev/null differ diff --git a/Icons/DefaultTheme/WaveformToggle.png b/Icons/DefaultTheme/WaveformToggle.png deleted file mode 100644 index e2861d65a..000000000 Binary files a/Icons/DefaultTheme/WaveformToggle.png and /dev/null differ diff --git a/Icons/Legacy/VideoToggle.png b/Icons/Legacy/VideoToggle.png deleted file mode 100644 index 436d7fb27..000000000 Binary files a/Icons/Legacy/VideoToggle.png and /dev/null differ diff --git a/Icons/Legacy/WaveformToggle.png b/Icons/Legacy/WaveformToggle.png deleted file mode 100644 index 5b0fee4f4..000000000 Binary files a/Icons/Legacy/WaveformToggle.png and /dev/null differ diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index f7fcb9f66..9f5b65e0d 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -18687,7 +18687,7 @@ namespace Nikse.SubtitleEdit.Forms { SuspendLayout(); splitContainerMain.Hide(); - _layout = LayoutManager.ToggleLayout(_layout, Controls, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); + _layout = LayoutManager.ToggleLayout(_layout, this, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); ResumeLayout(); } } @@ -18790,6 +18790,8 @@ namespace Nikse.SubtitleEdit.Forms return; } + Configuration.Settings.General.ShowVideoControls = on; + groupBoxVideo.SuspendLayout(); tabControlModes.Visible = on; var left = 5; @@ -24448,7 +24450,7 @@ namespace Nikse.SubtitleEdit.Forms if (!IsVideoVisible) { _layout = 0; - LayoutManager.SetLayout(_layout, Controls, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); + LayoutManager.SetLayout(_layout, this, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); } OpenVideo(openFileDialog1.FileName); @@ -24462,19 +24464,21 @@ namespace Nikse.SubtitleEdit.Forms { using (var form = new LayoutPicker(_layout, Configuration.Settings.General.ShowVideoControls)) { - if (form.ShowDialog(this) == DialogResult.OK) + if (form.ShowDialog(this) != DialogResult.OK) { - var oldLayout = _layout; - _layout = form.GetLayout(); - if (_layout != oldLayout) - { - LayoutManager.SetLayout(_layout, Controls, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); - } + return; + } - if (Configuration.Settings.General.ShowVideoControls != form.ShowVideoControls) - { - ToggleVideoControlsOnOff(form.ShowVideoControls); - } + var oldLayout = _layout; + _layout = form.GetLayout(); + if (_layout != oldLayout) + { + LayoutManager.SetLayout(_layout, this, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); + } + + if (Configuration.Settings.General.ShowVideoControls != form.ShowVideoControls) + { + ToggleVideoControlsOnOff(form.ShowVideoControls); } } } @@ -25300,7 +25304,7 @@ namespace Nikse.SubtitleEdit.Forms _layout = Configuration.Settings.General.LayoutNumber; if (_layout != 0) { - LayoutManager.SetLayout(_layout, Controls, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); + LayoutManager.SetLayout(_layout, this, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); } OpenVideo(_videoFileName, VideoAudioTrackNumber); @@ -28718,7 +28722,7 @@ namespace Nikse.SubtitleEdit.Forms TabControlModes_SelectedIndexChanged(null, null); _videoControlsUndocked.Refresh(); - LayoutManager.SetLayout(LayoutManager.LayoutNoVideo, Controls, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); + LayoutManager.SetLayout(LayoutManager.LayoutNoVideo, this, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); } public void RedockVideoControlsToolStripMenuItemClick(object sender, EventArgs e) @@ -28773,7 +28777,7 @@ namespace Nikse.SubtitleEdit.Forms _videoControlsUndocked = null; ShowVideoPlayer(); - LayoutManager.SetLayout(_layout, Controls, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); + LayoutManager.SetLayout(_layout, this, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); mediaPlayer.Invalidate(); Refresh(); @@ -33692,7 +33696,7 @@ namespace Nikse.SubtitleEdit.Forms if (!IsVideoVisible) { _layout = 0; - LayoutManager.SetLayout(_layout, Controls, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); + LayoutManager.SetLayout(_layout, this, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit); } OpenVideoFromUrl(url); diff --git a/src/ui/Logic/LayoutManager.cs b/src/ui/Logic/LayoutManager.cs index e2615825f..0bb9636e8 100644 --- a/src/ui/Logic/LayoutManager.cs +++ b/src/ui/Logic/LayoutManager.cs @@ -8,7 +8,7 @@ namespace Nikse.SubtitleEdit.Logic { public const int LayoutNoVideo = 7; - public static int ToggleLayout(int layout, Control.ControlCollection controls, Control videoPlayer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + public static int ToggleLayout(int layout, Form form, Control videoPlayer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { layout++; if (layout > LayoutNoVideo || layout < 0) @@ -16,11 +16,11 @@ namespace Nikse.SubtitleEdit.Logic layout = 0; } - SetLayout(layout, controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); + SetLayout(layout, form, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); return layout; } - public static void SetLayout(int layout, Control.ControlCollection controls, Control videoPlayer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + public static void SetLayout(int layout, Form form, Control videoPlayer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { if (layout > LayoutNoVideo || layout < 0) { @@ -30,38 +30,38 @@ namespace Nikse.SubtitleEdit.Logic switch (layout) { case 0: - SetLayout0(controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); + SetLayout0(form.Controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); break; case 1: - SetLayout1(controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); + SetLayout1(form.Controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); break; case 2: - SetLayout2(controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); + SetLayout2(form.Controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); break; case 3: - SetLayout3(controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); + SetLayout3(form.Controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); break; case 4: - SetLayout4(controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); + SetLayout4(form.Controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); break; case 5: - SetLayout5(controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); + SetLayout5(form.Controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); break; case 6: - SetLayout6(controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); + SetLayout6(form.Controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); break; case 7: - SetLayout7(controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); + SetLayout7(form.Controls, videoPlayer, subtitleListView, groupBoxWaveform, groupBoxEdit); break; } } - public static void SetLayout0(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + private static void SetLayout0(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { var spMain = new SplitContainer(); spMain.Orientation = Orientation.Horizontal; - groupBoxWaveform.Parent.Controls.Remove(groupBoxWaveform); + groupBoxWaveform.Parent?.Controls.Remove(groupBoxWaveform); spMain.Panel2.Controls.Add(groupBoxWaveform); groupBoxWaveform.Dock = DockStyle.Fill; @@ -70,7 +70,7 @@ namespace Nikse.SubtitleEdit.Logic spMain.Panel1.Controls.Add(spLeftTop); spLeftTop.Dock = DockStyle.Fill; - videoPlayerContainer.Parent.Controls.Remove(videoPlayerContainer); + videoPlayerContainer.Parent?.Controls.Remove(videoPlayerContainer); spLeftTop.Panel2.Controls.Add(videoPlayerContainer); videoPlayerContainer.Dock = DockStyle.Fill; @@ -79,11 +79,11 @@ namespace Nikse.SubtitleEdit.Logic spLeftTop.Panel1.Controls.Add(spLeftBottom); spLeftBottom.Dock = DockStyle.Fill; - subtitleListView.Parent.Controls.Remove(subtitleListView); + subtitleListView.Parent?.Controls.Remove(subtitleListView); spLeftBottom.Panel1.Controls.Add(subtitleListView); subtitleListView.Dock = DockStyle.Fill; - groupBoxEdit.Parent.Controls.Remove(groupBoxEdit); + groupBoxEdit.Parent?.Controls.Remove(groupBoxEdit); spLeftBottom.Panel2.Controls.Add(groupBoxEdit); groupBoxEdit.Dock = DockStyle.Fill; @@ -92,12 +92,12 @@ namespace Nikse.SubtitleEdit.Logic spMain.BringToFront(); } - public static void SetLayout1(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + private static void SetLayout1(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { var spMain = new SplitContainer(); spMain.Orientation = Orientation.Horizontal; - groupBoxWaveform.Parent.Controls.Remove(groupBoxWaveform); + groupBoxWaveform.Parent?.Controls.Remove(groupBoxWaveform); spMain.Panel2.Controls.Add(groupBoxWaveform); groupBoxWaveform.Dock = DockStyle.Fill; @@ -106,7 +106,7 @@ namespace Nikse.SubtitleEdit.Logic spMain.Panel1.Controls.Add(spLeftTop); spLeftTop.Dock = DockStyle.Fill; - videoPlayerContainer.Parent.Controls.Remove(videoPlayerContainer); + videoPlayerContainer.Parent?.Controls.Remove(videoPlayerContainer); spLeftTop.Panel1.Controls.Add(videoPlayerContainer); videoPlayerContainer.Dock = DockStyle.Fill; @@ -115,11 +115,11 @@ namespace Nikse.SubtitleEdit.Logic spLeftTop.Panel2.Controls.Add(spLeftBottom); spLeftBottom.Dock = DockStyle.Fill; - subtitleListView.Parent.Controls.Remove(subtitleListView); + subtitleListView.Parent?.Controls.Remove(subtitleListView); spLeftBottom.Panel1.Controls.Add(subtitleListView); subtitleListView.Dock = DockStyle.Fill; - groupBoxEdit.Parent.Controls.Remove(groupBoxEdit); + groupBoxEdit.Parent?.Controls.Remove(groupBoxEdit); spLeftBottom.Panel2.Controls.Add(groupBoxEdit); groupBoxEdit.Dock = DockStyle.Fill; @@ -128,12 +128,12 @@ namespace Nikse.SubtitleEdit.Logic spMain.BringToFront(); } - public static void SetLayout2(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + private static void SetLayout2(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { var spMain = new SplitContainer(); spMain.Orientation = Orientation.Vertical; - videoPlayerContainer.Parent.Controls.Remove(videoPlayerContainer); + videoPlayerContainer.Parent?.Controls.Remove(videoPlayerContainer); spMain.Panel2.Controls.Add(videoPlayerContainer); videoPlayerContainer.Dock = DockStyle.Fill; @@ -142,7 +142,7 @@ namespace Nikse.SubtitleEdit.Logic spMain.Panel1.Controls.Add(spLeftTop); spLeftTop.Dock = DockStyle.Fill; var lv = subtitleListView; - lv.Parent.Controls.Remove(lv); + lv.Parent?.Controls.Remove(lv); spLeftTop.Panel1.Controls.Add(lv); lv.Dock = DockStyle.Fill; @@ -152,12 +152,12 @@ namespace Nikse.SubtitleEdit.Logic spLeftBottom.Dock = DockStyle.Fill; var ge = groupBoxEdit; - ge.Parent.Controls.Remove(ge); + ge.Parent?.Controls.Remove(ge); spLeftBottom.Panel1.Controls.Add(ge); ge.Dock = DockStyle.Fill; var gv = groupBoxWaveform; - gv.Parent.Controls.Remove(gv); + gv.Parent?.Controls.Remove(gv); spLeftBottom.Panel2.Controls.Add(gv); gv.Dock = DockStyle.Fill; @@ -166,12 +166,12 @@ namespace Nikse.SubtitleEdit.Logic spMain.BringToFront(); } - public static void SetLayout3(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + private static void SetLayout3(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { var spMain = new SplitContainer(); spMain.Orientation = Orientation.Vertical; - videoPlayerContainer.Parent.Controls.Remove(videoPlayerContainer); + videoPlayerContainer.Parent?.Controls.Remove(videoPlayerContainer); spMain.Panel1.Controls.Add(videoPlayerContainer); videoPlayerContainer.Dock = DockStyle.Fill; @@ -180,7 +180,7 @@ namespace Nikse.SubtitleEdit.Logic spMain.Panel2.Controls.Add(spLeftTop); spLeftTop.Dock = DockStyle.Fill; var lv = subtitleListView; - lv.Parent.Controls.Remove(lv); + lv.Parent?.Controls.Remove(lv); spLeftTop.Panel1.Controls.Add(lv); lv.Dock = DockStyle.Fill; @@ -190,12 +190,12 @@ namespace Nikse.SubtitleEdit.Logic spLeftBottom.Dock = DockStyle.Fill; var ge = groupBoxEdit; - ge.Parent.Controls.Remove(ge); + ge.Parent?.Controls.Remove(ge); spLeftBottom.Panel1.Controls.Add(ge); ge.Dock = DockStyle.Fill; var gv = groupBoxWaveform; - gv.Parent.Controls.Remove(gv); + gv.Parent?.Controls.Remove(gv); spLeftBottom.Panel2.Controls.Add(gv); gv.Dock = DockStyle.Fill; @@ -204,12 +204,12 @@ namespace Nikse.SubtitleEdit.Logic spMain.BringToFront(); } - public static void SetLayout4(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + private static void SetLayout4(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { var spMain = new SplitContainer(); spMain.Orientation = Orientation.Horizontal; - videoPlayerContainer.Parent.Controls.Remove(videoPlayerContainer); + videoPlayerContainer.Parent?.Controls.Remove(videoPlayerContainer); spMain.Panel1.Controls.Add(videoPlayerContainer); videoPlayerContainer.Dock = DockStyle.Fill; spMain.SplitterDistance = 20; @@ -220,7 +220,7 @@ namespace Nikse.SubtitleEdit.Logic spLeftTop.MinimumSize = new Size(0, 0); spLeftTop.Dock = DockStyle.Fill; var lv = subtitleListView; - lv.Parent.Controls.Remove(lv); + lv.Parent?.Controls.Remove(lv); spLeftTop.Panel1.Controls.Add(lv); lv.Dock = DockStyle.Fill; @@ -231,12 +231,12 @@ namespace Nikse.SubtitleEdit.Logic spLeftBottom.Dock = DockStyle.Fill; var ge = groupBoxEdit; - ge.Parent.Controls.Remove(ge); + ge.Parent?.Controls.Remove(ge); spLeftBottom.Panel1.Controls.Add(ge); ge.Dock = DockStyle.Fill; var gv = groupBoxWaveform; - gv.Parent.Controls.Remove(gv); + gv.Parent?.Controls.Remove(gv); spLeftBottom.Panel2.Controls.Add(gv); gv.Dock = DockStyle.Fill; @@ -246,12 +246,12 @@ namespace Nikse.SubtitleEdit.Logic } // no video player - public static void SetLayout5(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + private static void SetLayout5(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { var spMain = new SplitContainer(); spMain.Orientation = Orientation.Horizontal; - subtitleListView.Parent.Controls.Remove(subtitleListView); + subtitleListView.Parent?.Controls.Remove(subtitleListView); spMain.Panel1.Controls.Add(subtitleListView); subtitleListView.Dock = DockStyle.Fill; spMain.SplitterDistance = 20; @@ -262,11 +262,11 @@ namespace Nikse.SubtitleEdit.Logic spLeftTop.MinimumSize = new Size(0, 0); spLeftTop.Dock = DockStyle.Fill; - groupBoxEdit.Parent.Controls.Remove(groupBoxEdit); + groupBoxEdit.Parent?.Controls.Remove(groupBoxEdit); spLeftTop.Panel1.Controls.Add(groupBoxEdit); groupBoxEdit.Dock = DockStyle.Fill; - groupBoxWaveform.Parent.Controls.Remove(groupBoxWaveform); + groupBoxWaveform.Parent?.Controls.Remove(groupBoxWaveform); spLeftTop.Panel2.Controls.Add(groupBoxWaveform); groupBoxWaveform.Dock = DockStyle.Fill; @@ -276,12 +276,12 @@ namespace Nikse.SubtitleEdit.Logic } // no waveform - public static void SetLayout6(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + private static void SetLayout6(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { var spMain = new SplitContainer(); spMain.Orientation = Orientation.Vertical; - videoPlayerContainer.Parent.Controls.Remove(videoPlayerContainer); + videoPlayerContainer.Parent?.Controls.Remove(videoPlayerContainer); spMain.Panel2.Controls.Add(videoPlayerContainer); videoPlayerContainer.Dock = DockStyle.Fill; @@ -290,11 +290,11 @@ namespace Nikse.SubtitleEdit.Logic spMain.Panel1.Controls.Add(spLeftTop); spLeftTop.Dock = DockStyle.Fill; - subtitleListView.Parent.Controls.Remove(subtitleListView); + subtitleListView.Parent?.Controls.Remove(subtitleListView); spLeftTop.Panel1.Controls.Add(subtitleListView); subtitleListView.Dock = DockStyle.Fill; - groupBoxEdit.Parent.Controls.Remove(groupBoxEdit); + groupBoxEdit.Parent?.Controls.Remove(groupBoxEdit); spLeftTop.Panel2.Controls.Add(groupBoxEdit); groupBoxEdit.Dock = DockStyle.Fill; @@ -304,16 +304,16 @@ namespace Nikse.SubtitleEdit.Logic } // no video or waveform - public static void SetLayout7(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) + private static void SetLayout7(Control.ControlCollection controls, Control videoPlayerContainer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit) { var spMain = new SplitContainer(); spMain.Orientation = Orientation.Horizontal; - subtitleListView.Parent.Controls.Remove(subtitleListView); + subtitleListView.Parent?.Controls.Remove(subtitleListView); spMain.Panel1.Controls.Add(subtitleListView); subtitleListView.Dock = DockStyle.Fill; - groupBoxEdit.Parent.Controls.Remove(groupBoxEdit); + groupBoxEdit.Parent?.Controls.Remove(groupBoxEdit); spMain.Panel2.Controls.Add(groupBoxEdit); groupBoxEdit.Dock = DockStyle.Fill;