Work on layout

This commit is contained in:
niksedk 2023-09-17 07:09:08 +02:00
parent 481f87da33
commit 096d8b7ec6
10 changed files with 68 additions and 64 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -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);

View File

@ -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;