diff --git a/Changelog.md b/Changelog.md index e28b38c..fdd56ac 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,9 +1,18 @@ -5.4.4.6 Beta (not yet released) +5.4.4.7 Beta (not yet released) ============ +- +5.4.4.6 Beta +============ + +- using start-size=video the window size was not remembered + after fullscreen mode was left. +- using start-size=video the window can now use the entire + working area using autofit-larger=100 + 5.4.4.5 Beta ============ diff --git a/Manual.md b/Manual.md index 07cfe7a..8f1a2c3 100644 --- a/Manual.md +++ b/Manual.md @@ -177,10 +177,6 @@ Before making a support request, please try a newer [beta version](#beta) first. [Issue tracker](https://github.com/stax76/mpv.net/issues), feel free to use for anything mpv.net related. -You can support my work with a PayPal donation. The input hardware support in mpv.net is not 100% mpv compatible, people use all kind of weird input hardware and sometimes I have to buy those to support them. - - - Settings -------- diff --git a/README.md b/README.md index 207cf00..d96321c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![](https://raw.githubusercontent.com/stax76/mpv.net/master/img/mpvnet.png) -![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/stax76/mpv.net) ![GitHub closed issues](https://img.shields.io/github/issues-closed/stax76/mpv.net) ![GitHub All Releases](https://img.shields.io/github/downloads/stax76/mpv.net/total) ![GitHub tag (latest by date)](https://img.shields.io/github/tag-date/stax76/mpv.net) ![GitHub stars](https://img.shields.io/github/stars/stax76/mpv.net) [![PayPal donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/stax76) +![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/stax76/mpv.net) ![GitHub closed issues](https://img.shields.io/github/issues-closed/stax76/mpv.net) ![GitHub All Releases](https://img.shields.io/github/downloads/stax76/mpv.net/total) ![GitHub tag (latest by date)](https://img.shields.io/github/tag-date/stax76/mpv.net) ![GitHub stars](https://img.shields.io/github/stars/stax76/mpv.net) 🎞 mpv.net ========== diff --git a/mpv.net/Properties/AssemblyInfo.cs b/mpv.net/Properties/AssemblyInfo.cs index f9db999..1f71c32 100644 --- a/mpv.net/Properties/AssemblyInfo.cs +++ b/mpv.net/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("5.4.4.5")] -[assembly: AssemblyFileVersion("5.4.4.5")] +[assembly: AssemblyVersion("5.4.4.6")] +[assembly: AssemblyFileVersion("5.4.4.6")] diff --git a/mpv.net/Resources/input.conf.txt b/mpv.net/Resources/input.conf.txt index fcde0b0..6c52370 100644 --- a/mpv.net/Resources/input.conf.txt +++ b/mpv.net/Resources/input.conf.txt @@ -185,6 +185,8 @@ Volume_Down add volume -10 Wheel_Up add volume 10 Wheel_Down add volume -10 + Wheel_Left add volume -10 + Wheel_Right add volume 10 Prev playlist-prev Next playlist-next MBTN_Forward playlist-next @@ -194,4 +196,5 @@ Ctrl+Wheel_Up no-osd seek 7 Ctrl+Wheel_Down no-osd seek -7 MBTN_Left_DBL cycle fullscreen - KP_Enter cycle fullscreen \ No newline at end of file + KP_Enter cycle fullscreen + \ No newline at end of file diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index d1ff317..44514cc 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -280,13 +280,11 @@ namespace mpvnet return null; } - bool WasInitialSizeSet; - void SetFormPosAndSize(double scale = 1, bool force = false) { if (!force) { - if (WindowState == FormWindowState.Maximized || WindowState == FormWindowState.Minimized) + if (WindowState != FormWindowState.Normal) return; if (mp.Fullscreen) @@ -304,51 +302,45 @@ namespace mpvnet mp.VideoSize = new Size((int)(autoFitHeight * (16 / 9.0)), autoFitHeight); - Size size = mp.VideoSize; - int height = size.Height; + Size videoSize = mp.VideoSize; + int height = videoSize.Height; - if (App.StartSize == "previous" || App.StartSize == "always" || scale != 1) + if (mp.WasInitialSizeSet || scale != 1) + height = ClientSize.Height; + else { - if (WasInitialSizeSet || scale != 1) - height = ClientSize.Height; - else - { - int savedHeight = RegistryHelp.GetInt(App.RegPath, "Height"); + int savedHeight = RegistryHelp.GetInt(App.RegPath, "Height"); - if (App.StartSize == "always" && savedHeight != 0) - height = savedHeight; - else + if (App.StartSize == "always" && savedHeight != 0) + height = savedHeight; + else + if (App.StartSize != "video") height = autoFitHeight; - WasInitialSizeSet = true; - } + mp.WasInitialSizeSet = true; } height = Convert.ToInt32(height * scale); - int width = Convert.ToInt32(height * size.Width / (double)size.Height); + int width = Convert.ToInt32(height * videoSize.Width / (double)videoSize.Height); + int maxHeight = screen.WorkingArea.Height - (Height - ClientSize.Height); + int maxWidth = screen.WorkingArea.Width - (Width - ClientSize.Width); - if (height < screen.WorkingArea.Height * mp.AutofitSmaller) + if (height < maxHeight * mp.AutofitSmaller) { - height = Convert.ToInt32(screen.WorkingArea.Height * mp.AutofitSmaller); - width = Convert.ToInt32(height * size.Width / (double)size.Height); + height = Convert.ToInt32(maxHeight * mp.AutofitSmaller); + width = Convert.ToInt32(height * videoSize.Width / (double)videoSize.Height); } - if (height > screen.WorkingArea.Height * mp.AutofitLarger) + if (height > maxHeight * mp.AutofitLarger) { - height = Convert.ToInt32(screen.WorkingArea.Height * mp.AutofitLarger); - width = Convert.ToInt32(height * size.Width / (double)size.Height); + height = Convert.ToInt32(maxHeight * mp.AutofitLarger); + width = Convert.ToInt32(height * videoSize.Width / (double)videoSize.Height); } - if (height > screen.WorkingArea.Height * 0.95) + if (width > maxWidth) { - height = Convert.ToInt32(screen.WorkingArea.Height * 0.95); - width = Convert.ToInt32(height * size.Width / (double)size.Height); - } - - if (width > screen.WorkingArea.Width * 0.95) - { - width = Convert.ToInt32(screen.WorkingArea.Width * 0.95); - height = Convert.ToInt32(width * size.Height / (double)size.Width); + width = maxWidth; + height = Convert.ToInt32(width * videoSize.Height / (double)videoSize.Width); } Point middlePos = new Point(Left + Width / 2, Top + Height / 2); @@ -375,7 +367,8 @@ namespace mpvnet if (top + rect.Height > maxBottom) top = maxBottom - rect.Height; - WinAPI.SetWindowPos(Handle, IntPtr.Zero /* HWND_TOP */, left, top, rect.Width, rect.Height, 4 /* SWP_NOZORDER */); + WinAPI.SetWindowPos(Handle, IntPtr.Zero /* HWND_TOP */, + left, top, rect.Width, rect.Height, 4 /* SWP_NOZORDER */); } public void CycleFullscreen(bool enabled) @@ -508,20 +501,20 @@ namespace mpvnet switch (m.Msg) { - case 0x0201: // WM_LBUTTONDOWN - case 0x0202: // WM_LBUTTONUP - case 0x0207: // WM_MBUTTONDOWN - case 0x0208: // WM_MBUTTONUP - case 0x020b: // WM_XBUTTONDOWN - case 0x020c: // WM_XBUTTONUP - case 0x020A: // WM_MOUSEWHEEL - case 0x0100: // WM_KEYDOWN - case 0x0101: // WM_KEYUP - case 0x0102: // WM_CHAR - case 0x0104: // WM_SYSKEYDOWN - case 0x0105: // WM_SYSKEYUP - case 0x0106: // WM_SYSCHAR - case 0x319: // WM_APPCOMMAND + case 0x201: // WM_LBUTTONDOWN + case 0x202: // WM_LBUTTONUP + case 0x207: // WM_MBUTTONDOWN + case 0x208: // WM_MBUTTONUP + case 0x20b: // WM_XBUTTONDOWN + case 0x20c: // WM_XBUTTONUP + case 0x20A: // WM_MOUSEWHEEL + case 0x100: // WM_KEYDOWN + case 0x101: // WM_KEYUP + case 0x102: // WM_CHAR + case 0x104: // WM_SYSKEYDOWN + case 0x105: // WM_SYSKEYUP + case 0x106: // WM_SYSCHAR + case 0x319: // WM_APPCOMMAND if (mp.WindowHandle != IntPtr.Zero) m.Result = WinAPI.SendMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam); break; @@ -730,9 +723,9 @@ namespace mpvnet ToolStripRendererEx.ForegroundColor = Theme.Current.GetWinFormsColor("menu-foreground"); ToolStripRendererEx.BackgroundColor = Theme.Current.GetWinFormsColor("menu-background"); - ToolStripRendererEx.SelectionColor = Theme.Current.GetWinFormsColor("menu-highlight"); - ToolStripRendererEx.BorderColor = Theme.Current.GetWinFormsColor("menu-border"); - ToolStripRendererEx.CheckedColor = Theme.Current.GetWinFormsColor("menu-checked"); + ToolStripRendererEx.SelectionColor = Theme.Current.GetWinFormsColor("menu-highlight"); + ToolStripRendererEx.BorderColor = Theme.Current.GetWinFormsColor("menu-border"); + ToolStripRendererEx.CheckedColor = Theme.Current.GetWinFormsColor("menu-checked"); BuildMenu(); ContextMenuStrip = ContextMenu; @@ -788,10 +781,7 @@ namespace mpvnet protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); - - if (WindowState == FormWindowState.Normal) - SaveWindowProperties(); - + SaveWindowProperties(); RegistryHelp.SetValue(App.RegPath, "Recent", RecentFiles.ToArray()); if (mp.IsQuitNeeded) diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index 3b206aa..6e0eb54 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -72,7 +72,7 @@ namespace mpvnet public static List PythonScripts { get; set; } = new List(); public static Size VideoSize { get; set; } public static TimeSpan Duration; - public static AutoResetEvent ShutdownAutoResetEvent { get; } = new AutoResetEvent(false); + public static AutoResetEvent ShutdownAutoResetEvent { get; } = new AutoResetEvent(false); public static AutoResetEvent VideoSizeAutoResetEvent { get; } = new AutoResetEvent(false); public static string InputConfPath { get => ConfigFolder + "input.conf"; } @@ -82,6 +82,7 @@ namespace mpvnet public static string Vid { get; set; } = ""; public static string GPUAPI { get; set; } = "auto"; + public static bool WasInitialSizeSet; public static bool Border { get; set; } = true; public static bool Fullscreen { get; set; } public static bool IsLogoVisible { set; get; } @@ -160,6 +161,9 @@ namespace mpvnet case "screen": Screen = Convert.ToInt32(value); break; case "gpu-api": GPUAPI = value; break; } + + if (AutofitLarger > 1) + AutofitLarger = 1; } static string _ConfigFolder; @@ -367,6 +371,10 @@ namespace mpvnet { HideLogo(); Duration = TimeSpan.FromSeconds(get_property_number("duration")); + + if (App.StartSize == "video") + mp.WasInitialSizeSet = false; + Size size = new Size(get_property_int("width"), get_property_int("height")); if (size.Width == 0 || size.Height == 0)