Added shortcuts for un-dock/re-dock of video windows

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@442 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-06-02 12:06:42 +00:00
parent 068ca403e9
commit 2cad2ddc4a
8 changed files with 66 additions and 14 deletions

View File

@ -4705,7 +4705,6 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void ButtonUnBreakClick(object sender, EventArgs e)
{
textBoxListViewText.Text = Utilities.UnbreakLine(textBoxListViewText.Text);
@ -8007,6 +8006,7 @@ namespace Nikse.SubtitleEdit.Forms
SetPositionFromXYString(Configuration.Settings.General.UndockedVideoPosition, "VideoPlayerUnDocked");
SetPositionFromXYString(Configuration.Settings.General.UndockedWaveformPosition, "WaveFormUnDocked");
SetPositionFromXYString(Configuration.Settings.General.UndockedVideoControlsPosition, "VideoControlsUndocked");
Configuration.Settings.General.Undocked = false;
undockVideoControlsToolStripMenuItem_Click(null, null);
}
@ -8057,6 +8057,8 @@ namespace Nikse.SubtitleEdit.Forms
fixToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainToolsFixCommonErrors);
showhideVideoToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainVideoShowHideVideo);
undockVideoControlsToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainVideoUndockVideoControls);
redockVideoControlsToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainVideoReDockVideoControls);
toolStripMenuItemAdjustAllTimes.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainSynchronizationAdjustTimes);
italicToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainListViewItalic);
italicToolStripMenuItem1.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainTextBoxItalic);
@ -8187,7 +8189,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private Keys GetKeys(string keysInString)
public Keys GetKeys(string keysInString)
{
if (string.IsNullOrEmpty(keysInString))
return Keys.None;
@ -9412,6 +9414,9 @@ namespace Nikse.SubtitleEdit.Forms
private void undockVideoControlsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (Configuration.Settings.General.Undocked)
return;
Configuration.Settings.General.Undocked = true;
UnDockVideoPlayer();
@ -9431,12 +9436,14 @@ namespace Nikse.SubtitleEdit.Forms
undockVideoControlsToolStripMenuItem.Visible = false;
redockVideoControlsToolStripMenuItem.Visible = true;
tabControl1_SelectedIndexChanged(null, null);
tabControl1_SelectedIndexChanged(null, null);
}
private void redockVideoControlsToolStripMenuItem_Click(object sender, EventArgs e)
public void redockVideoControlsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Configuration.Settings.General.Undocked)
return;
Configuration.Settings.General.Undocked = false;
if (_videoControlsUnDocked != null && !_videoControlsUnDocked.IsDisposed)

View File

@ -684,7 +684,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAdgBBQHYAQUBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAeABBQHgAQUBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -435,6 +435,8 @@ namespace Nikse.SubtitleEdit.Forms
//<MainVideoShowHideVideo>Control+Q</MainVideoShowHideVideo>
TreeNode videoNode = new TreeNode(Configuration.Settings.Language.Main.Menu.Video.Title);
videoNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.Video.ShowHideVideo + GetShortcutText(Configuration.Settings.Shortcuts.MainVideoShowHideVideo));
videoNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.Video.UnDockVideoControls + GetShortcutText(Configuration.Settings.Shortcuts.MainVideoUndockVideoControls));
videoNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.Video.ReDockVideoControls + GetShortcutText(Configuration.Settings.Shortcuts.MainVideoReDockVideoControls));
treeViewShortcuts.Nodes.Add(videoNode);
//<MainSynchronizationAdjustTimes>Control+Shift+A</MainSynchronizationAdjustTimes>
@ -482,6 +484,8 @@ namespace Nikse.SubtitleEdit.Forms
private string GetShortcutText(string shortcut)
{
if (string.IsNullOrEmpty(shortcut))
shortcut = Configuration.Settings.Language.General.None;
return string.Format(" [{0}]", shortcut);
}
@ -793,6 +797,10 @@ namespace Nikse.SubtitleEdit.Forms
string text = node.Text.Substring(0, node.Text.IndexOf("[")).Trim();
if (text == Configuration.Settings.Language.Main.Menu.Video.ShowHideVideo.Replace("&", string.Empty))
Configuration.Settings.Shortcuts.MainVideoShowHideVideo = GetShortcut(node.Text);
else if (text == Configuration.Settings.Language.Main.Menu.Video.UnDockVideoControls.Replace("&", string.Empty))
Configuration.Settings.Shortcuts.MainVideoUndockVideoControls = GetShortcut(node.Text);
else if (text == Configuration.Settings.Language.Main.Menu.Video.ReDockVideoControls.Replace("&", string.Empty))
Configuration.Settings.Shortcuts.MainVideoReDockVideoControls = GetShortcut(node.Text);
}
}

View File

@ -46,9 +46,11 @@
this.ClientSize = new System.Drawing.Size(458, 311);
this.Controls.Add(this.panelContainer);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.KeyPreview = true;
this.Name = "VideoControlsUndocked";
this.Text = "VideoControlsUndocked";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VideoControlsUndocked_FormClosing);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.VideoControlsUndocked_KeyDown);
this.ResumeLayout(false);
}

View File

@ -13,6 +13,7 @@ namespace Nikse.SubtitleEdit.Forms
{
Main _mainForm = null;
PositionsAndSizes _positionsAndSizes = null;
Keys _redockKeys;
public Panel PanelContainer
{
@ -28,6 +29,7 @@ namespace Nikse.SubtitleEdit.Forms
_mainForm = mainForm;
this.Icon = (Icon)mainForm.Icon.Clone();
_positionsAndSizes = positionsAndSizes;
_redockKeys = _mainForm.GetKeys(Configuration.Settings.Shortcuts.MainVideoReDockVideoControls);
}
public VideoControlsUndocked()
@ -39,12 +41,23 @@ namespace Nikse.SubtitleEdit.Forms
{
if (e.CloseReason == CloseReason.UserClosing && panelContainer.Controls.Count > 0)
{
var control = panelContainer.Controls[0];
var controlCheckBox = panelContainer.Controls[1];
panelContainer.Controls.Clear();
_mainForm.ReDockVideoButtons(control, controlCheckBox);
ReDock();
}
_positionsAndSizes.SavePositionAndSize(this);
}
private void ReDock()
{
var control = panelContainer.Controls[0];
var controlCheckBox = panelContainer.Controls[1];
panelContainer.Controls.Clear();
_mainForm.ReDockVideoButtons(control, controlCheckBox);
}
private void VideoControlsUndocked_KeyDown(object sender, KeyEventArgs e)
{
if (_redockKeys == e.KeyData)
_mainForm.redockVideoControlsToolStripMenuItem_Click(null, null);
}
}
}

View File

@ -9,6 +9,7 @@ namespace Nikse.SubtitleEdit.Forms
Main _mainForm = null;
PositionsAndSizes _positionsAndSizes = null;
Controls.VideoPlayerContainer _videoPlayerContainer;
Keys _redockKeys;
public Panel PanelContainer
{
@ -25,6 +26,7 @@ namespace Nikse.SubtitleEdit.Forms
this.Icon = (Icon)_mainForm.Icon.Clone();
_positionsAndSizes = positionsAndSizes;
_videoPlayerContainer = videoPlayerContainer;
_redockKeys = _mainForm.GetKeys(Configuration.Settings.Shortcuts.MainVideoReDockVideoControls);
}
public VideoPlayerUnDocked()
@ -54,6 +56,10 @@ namespace Nikse.SubtitleEdit.Forms
WindowState = FormWindowState.Maximized;
e.SuppressKeyPress = true;
}
else if (_redockKeys == e.KeyData)
{
_mainForm.redockVideoControlsToolStripMenuItem_Click(null, null);
}
else
{
_mainForm.Main_KeyDown(sender, e);

View File

@ -13,6 +13,7 @@ namespace Nikse.SubtitleEdit.Forms
{
Main _mainForm = null;
PositionsAndSizes _positionsAndSizes = null;
Keys _redockKeys;
public Panel PanelContainer
{
@ -28,6 +29,7 @@ namespace Nikse.SubtitleEdit.Forms
_mainForm = mainForm;
this.Icon = (Icon)mainForm.Icon.Clone();
_positionsAndSizes = positionsAndSizes;
_redockKeys = _mainForm.GetKeys(Configuration.Settings.Shortcuts.MainVideoReDockVideoControls);
}
public WaveFormUnDocked()
@ -51,7 +53,10 @@ namespace Nikse.SubtitleEdit.Forms
private void WaveFormUnDocked_KeyDown(object sender, KeyEventArgs e)
{
_mainForm.Main_KeyDown(sender, e);
if (_redockKeys == e.KeyData)
_mainForm.redockVideoControlsToolStripMenuItem_Click(null, null);
else
_mainForm.Main_KeyDown(sender, e);
}
}
}

View File

@ -407,8 +407,10 @@ namespace Nikse.SubtitleEdit.Logic
public string MainEditFindNext { get; set; }
public string MainEditReplace { get; set; }
public string MainEditGoToLineNumber { get; set; }
public string MainToolsFixCommonErrors { get; set; }
public string MainToolsFixCommonErrors { get; set; }
public string MainVideoShowHideVideo { get; set; }
public string MainVideoUndockVideoControls { get; set; }
public string MainVideoReDockVideoControls { get; set; }
public string MainSynchronizationAdjustTimes { get; set; }
public string MainListViewItalic { get; set; }
public string MainTextBoxItalic { get; set; }
@ -1059,10 +1061,17 @@ namespace Nikse.SubtitleEdit.Logic
settings.Shortcuts.MainEditGoToLineNumber = subNode.InnerText;
subNode = node.SelectSingleNode("MainToolsFixCommonErrors");
if (subNode != null)
settings.Shortcuts.MainToolsFixCommonErrors = subNode.InnerText;
settings.Shortcuts.MainToolsFixCommonErrors = subNode.InnerText;
subNode = node.SelectSingleNode("MainVideoShowHideVideo");
if (subNode != null)
settings.Shortcuts.MainVideoShowHideVideo = subNode.InnerText;
subNode = node.SelectSingleNode("MainVideoUndockVideoControls");
if (subNode != null)
settings.Shortcuts.MainVideoUndockVideoControls = subNode.InnerText;
subNode = node.SelectSingleNode("MainVideoReDockVideoControls");
if (subNode != null)
settings.Shortcuts.MainVideoReDockVideoControls = subNode.InnerText;
subNode = node.SelectSingleNode("MainSynchronizationAdjustTimes");
if (subNode != null)
settings.Shortcuts.MainSynchronizationAdjustTimes = subNode.InnerText;
@ -1299,8 +1308,10 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("MainEditFindNext", settings.Shortcuts.MainEditFindNext);
textWriter.WriteElementString("MainEditReplace", settings.Shortcuts.MainEditReplace);
textWriter.WriteElementString("MainEditGoToLineNumber", settings.Shortcuts.MainEditGoToLineNumber);
textWriter.WriteElementString("MainToolsFixCommonErrors", settings.Shortcuts.MainToolsFixCommonErrors);
textWriter.WriteElementString("MainToolsFixCommonErrors", settings.Shortcuts.MainToolsFixCommonErrors);
textWriter.WriteElementString("MainVideoShowHideVideo", settings.Shortcuts.MainVideoShowHideVideo);
textWriter.WriteElementString("MainVideoUndockVideoControls", settings.Shortcuts.MainVideoUndockVideoControls);
textWriter.WriteElementString("MainVideoReDockVideoControls", settings.Shortcuts.MainVideoReDockVideoControls);
textWriter.WriteElementString("MainSynchronizationAdjustTimes", settings.Shortcuts.MainSynchronizationAdjustTimes);
textWriter.WriteElementString("MainListViewItalic", settings.Shortcuts.MainEditGoToLineNumber);
textWriter.WriteElementString("MainTextBoxItalic", settings.Shortcuts.MainTextBoxItalic);