Work on layout

This commit is contained in:
niksedk 2023-09-16 23:55:32 +02:00
parent e4989b6260
commit 15e5aa2d35
6 changed files with 63 additions and 20 deletions

View File

@ -31,4 +31,5 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Matroska/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nikse/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Purfview/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tahoma/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tahoma/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Undocked/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -350,6 +350,34 @@ namespace Nikse.SubtitleEdit.Forms
private void LayoutPicker_Shown(object sender, EventArgs e)
{
switch (_layout)
{
case 0:
button1.Focus();
break;
case 1:
button2.Focus();
break;
case 2:
button3.Focus();
break;
case 3:
button4.Focus();
break;
case 4:
button5.Focus();
break;
case 5:
button6.Focus();
break;
case 6:
button7.Focus();
break;
case 7:
button8.Focus();
break;
}
_loading = false;
SelectLayout(_layout);
}

View File

@ -74,7 +74,7 @@ namespace Nikse.SubtitleEdit.Forms
private int MinGapBetweenLines => Configuration.Settings.General.MinimumMillisecondsBetweenLines;
private bool _isOriginalActive;
private bool IsOriginalEditable => _isOriginalActive && Configuration.Settings.General.AllowEditOfOriginalSubtitle;
private bool IsVideoVisible => _layout != 7;
private bool IsVideoVisible => _layout != LayoutManager.LayoutNoVideo;
private Subtitle _subtitle = new Subtitle();
private Subtitle _subtitleOriginal = new Subtitle();
@ -20527,12 +20527,22 @@ namespace Nikse.SubtitleEdit.Forms
if (_videoPlayerUndocked == null || _videoPlayerUndocked.IsDisposed)
{
UndockVideoControlsToolStripMenuItemClick(null, null);
Configuration.Settings.General.Undocked = true;
if (!_loading)
{
Configuration.Settings.General.SplitContainerMainSplitterDistance = splitContainerMain.SplitterDistance;
Configuration.Settings.General.SplitContainer1SplitterDistance = splitContainer1.SplitterDistance;
Configuration.Settings.General.SplitContainerListViewAndTextSplitterDistance = splitContainerListViewAndText.SplitterDistance;
}
UnDockVideoPlayer();
setRedockOnFullscreenEnd = true;
}
if (_videoPlayerUndocked != null && !_videoPlayerUndocked.IsDisposed)
{
_videoPlayerUndocked.Show(this);
_videoPlayerUndocked.Focus();
_videoPlayerUndocked.GoFullscreen();
if (setRedockOnFullscreenEnd)
@ -23572,7 +23582,7 @@ namespace Nikse.SubtitleEdit.Forms
}
_waveformUndocked.Visible = false;
if (toolStripButtonLayout.Checked)
if (IsVideoVisible)
{
_waveformUndocked.Show(this);
if (_waveformUndocked.WindowState == FormWindowState.Minimized)
@ -24939,7 +24949,7 @@ namespace Nikse.SubtitleEdit.Forms
if (!_isVideoControlsUndocked)
{
if (toolStripButtonLayout.Checked)
if (IsVideoVisible)
{
audioVisualizer.Left = tabControlModes.Left + tabControlModes.Width + 5;
}
@ -28666,7 +28676,7 @@ namespace Nikse.SubtitleEdit.Forms
}
UnDockWaveform();
if (toolStripButtonLayout.Checked)
if (IsVideoVisible)
{
_waveformUndocked.Show(this);
if (_waveformUndocked.Top < 0 || _waveformUndocked.Left < 0)
@ -28698,6 +28708,8 @@ namespace Nikse.SubtitleEdit.Forms
TabControlModes_SelectedIndexChanged(null, null);
_videoControlsUndocked.Refresh();
LayoutManager.SetLayout(LayoutManager.LayoutNoVideo, Controls, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit);
}
public void RedockVideoControlsToolStripMenuItemClick(object sender, EventArgs e)
@ -28752,13 +28764,7 @@ namespace Nikse.SubtitleEdit.Forms
_videoControlsUndocked = null;
ShowVideoPlayer();
audioVisualizer.Visible = toolStripButtonLayout.Checked;
trackBarWaveformPosition.Visible = toolStripButtonLayout.Checked;
panelWaveformControls.Visible = toolStripButtonLayout.Checked;
if (!IsVideoVisible)
{
HideVideoPlayer();
}
LayoutManager.SetLayout(_layout, Controls, panelVideoPlayer, SubtitleListview1, groupBoxVideo, groupBoxEdit);
mediaPlayer.Invalidate();
Refresh();
@ -28771,11 +28777,6 @@ namespace Nikse.SubtitleEdit.Forms
Main_ResizeEnd(null, null);
}
internal void SetWaveformToggleOff()
{
toolStripButtonLayout.Checked = false;
}
private void ToolStripMenuItemInsertSubtitleClick(object sender, EventArgs e)
{
openFileDialog1.Title = _languageGeneral.OpenSubtitle;
@ -35766,5 +35767,17 @@ namespace Nikse.SubtitleEdit.Forms
{
_contextMenuStripPlayRate.Show(MousePosition.X, MousePosition.Y);
}
public void RedockFromFullscreen()
{
if (_videoPlayerUndocked != null && !_videoPlayerUndocked.IsDisposed)
{
var control = _videoPlayerUndocked.PanelContainer.Controls[0];
control.Parent.Controls.Remove(control);
ReDockVideoPlayer(control);
_videoPlayerUndocked = null;
mediaPlayer.ShowFullscreenButton = Configuration.Settings.General.VideoPlayerShowFullscreenButton;
}
}
}
}

View File

@ -52,7 +52,7 @@ namespace Nikse.SubtitleEdit.Forms
_videoPlayerContainer.ShowCursor();
if (RedockOnFullscreenEnd)
{
_mainForm.RedockVideoControlsToolStripMenuItemClick(null, null);
_mainForm.RedockFromFullscreen();
}
else if (e.CloseReason == CloseReason.UserClosing && panelContainer.Controls.Count > 0)
{

View File

@ -35,7 +35,6 @@ namespace Nikse.SubtitleEdit.Forms
var controlTrackBar = panelContainer.Controls[2];
panelContainer.Controls.Clear();
_mainForm.ReDockWaveform(controlWaveform, controlButtons, controlTrackBar);
_mainForm.SetWaveformToggleOff();
}
}

View File

@ -6,6 +6,8 @@ namespace Nikse.SubtitleEdit.Logic
{
public static class LayoutManager
{
public const int LayoutNoVideo = 7;
public static int ToggleLayout(int layout, Control.ControlCollection controls, Control videoPlayer, SubtitleListView subtitleListView, GroupBox groupBoxWaveform, GroupBox groupBoxEdit)
{
layout++;