From 29a5306035325535ae93bb33d9b179c96966f086 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sun, 5 Jun 2011 19:10:43 +0000 Subject: [PATCH] Ctrl+A will now resize un-docked video player to display video in 1:1 git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@462 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Controls/VideoPlayerContainer.cs | 3 +++ src/Forms/Main.Designer.cs | 2 +- src/Forms/Main.resx | 2 +- src/Forms/VideoPlayerUnDocked.cs | 11 ++++++++++- src/Logic/Utilities.cs | 2 ++ 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Controls/VideoPlayerContainer.cs b/src/Controls/VideoPlayerContainer.cs index da14491ee..6132b7f8f 100644 --- a/src/Controls/VideoPlayerContainer.cs +++ b/src/Controls/VideoPlayerContainer.cs @@ -43,6 +43,9 @@ namespace Nikse.SubtitleEdit.Controls set { _videoPlayer = value; } } + public int VideoWidth { get; set; } + public int VideoHeight { get; set; } + private bool _isMuted; private double? _muteOldVolume; private readonly System.ComponentModel.ComponentResourceManager _resources; diff --git a/src/Forms/Main.Designer.cs b/src/Forms/Main.Designer.cs index d25de4457..6810b6072 100644 --- a/src/Forms/Main.Designer.cs +++ b/src/Forms/Main.Designer.cs @@ -2819,7 +2819,7 @@ this.showOnlyWaveformToolStripMenuItem, this.showOnlySpectrogramToolStripMenuItem}); this.contextMenuStripWaveForm.Name = "contextMenuStripWaveForm"; - this.contextMenuStripWaveForm.Size = new System.Drawing.Size(253, 236); + this.contextMenuStripWaveForm.Size = new System.Drawing.Size(253, 214); this.contextMenuStripWaveForm.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripWaveForm_Opening); // // addParagraphHereToolStripMenuItem diff --git a/src/Forms/Main.resx b/src/Forms/Main.resx index b5d60467d..ef5596215 100644 --- a/src/Forms/Main.resx +++ b/src/Forms/Main.resx @@ -684,7 +684,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2 - CAAAAk1TRnQBSQFMAgEBAgEAAfABBgHwAQYBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAfgBBgH4AQYBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/src/Forms/VideoPlayerUnDocked.cs b/src/Forms/VideoPlayerUnDocked.cs index 2453b447e..de1e1005b 100644 --- a/src/Forms/VideoPlayerUnDocked.cs +++ b/src/Forms/VideoPlayerUnDocked.cs @@ -1,6 +1,7 @@ using System.Drawing; using System.Windows.Forms; using Nikse.SubtitleEdit.Logic; +using Nikse.SubtitleEdit.Controls; namespace Nikse.SubtitleEdit.Forms { @@ -57,11 +58,19 @@ namespace Nikse.SubtitleEdit.Forms } else if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.A) { - //TODO: Resize to video size... + if (_videoPlayerContainer.VideoWidth > 0 && _videoPlayerContainer.VideoHeight > 0) + { + int wDiff = _videoPlayerContainer.VideoWidth - _videoPlayerContainer.PanelPlayer.Width; + int hDiff = _videoPlayerContainer.VideoHeight - _videoPlayerContainer.PanelPlayer.Height; + Width += wDiff; + Height += hDiff; + e.SuppressKeyPress = true; + } } else if (_redockKeys == e.KeyData) { _mainForm.redockVideoControlsToolStripMenuItem_Click(null, null); + e.SuppressKeyPress = true; } else { diff --git a/src/Logic/Utilities.cs b/src/Logic/Utilities.cs index d3a0cd8b1..d41c2c80e 100644 --- a/src/Logic/Utilities.cs +++ b/src/Logic/Utilities.cs @@ -1189,6 +1189,8 @@ namespace Nikse.SubtitleEdit.Logic videoPlayerContainer.ShowStopButton = Configuration.Settings.General.VideoPlayerShowStopButton; videoPlayerContainer.Volume = Configuration.Settings.General.VideoPlayerDefaultVolume; videoPlayerContainer.EnableMouseWheelStep(); + videoPlayerContainer.VideoWidth = videoInfo.Width; + videoPlayerContainer.VideoHeight = videoInfo.Height; } catch (Exception exception) {