From d0ad69656a710f8b4c7f369f57f9a3ffb37cd163 Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Wed, 10 Mar 2021 16:40:31 +0100 Subject: [PATCH] Command palette shows commands without assigned menu item --- Changelog.md | 5 +++-- mpv.net/Misc/Misc.cs | 1 + mpv.net/Resources/input.conf.txt | 5 +++-- mpv.net/WPF/CommandPaletteWindow.xaml | 4 ++-- mpv.net/WPF/CommandPaletteWindow.xaml.cs | 2 +- mpv.net/WinForms/MainForm.cs | 18 +++++++++++++----- 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Changelog.md b/Changelog.md index 0950c3c..b11038c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,8 +2,9 @@ 5.4.8.8 Beta (2021-03-??) ========================= -- The mpv window-scale property works now exactly like in mpv. -- Implementation for the mpv title property. +- Improved window scaling. +- Title property implementation. +- Command palette shows commands without assigned menu item. 5.4.8.7 Beta (2021-03-09) diff --git a/mpv.net/Misc/Misc.cs b/mpv.net/Misc/Misc.cs index 66ced47..a5f9246 100644 --- a/mpv.net/Misc/Misc.cs +++ b/mpv.net/Misc/Misc.cs @@ -102,6 +102,7 @@ namespace mpvnet public string Path { get; set; } = ""; public string Command { get; set; } = ""; + public string Display { get { return string.IsNullOrEmpty(Path) ? Command : Path; } } public CommandItem() { } diff --git a/mpv.net/Resources/input.conf.txt b/mpv.net/Resources/input.conf.txt index d6b793f..55c09e2 100644 --- a/mpv.net/Resources/input.conf.txt +++ b/mpv.net/Resources/input.conf.txt @@ -141,8 +141,9 @@ Ctrl+t set ontop yes #menu: View > On Top > Enable Ctrl+T set ontop no #menu: View > On Top > Disable - Alt++ script-message mpv.net scale-window 1.2 #menu: View > Window Size > Enlarge - Alt+- script-message mpv.net scale-window 0.8 #menu: View > Window Size > Shrink + Alt++ script-message mpv.net scale-window 1.2 #menu: View > Zoom > Enlarge + Alt+- script-message mpv.net scale-window 0.8 #menu: View > Zoom > Shrink + _ ignore #menu: View > Zoom > - Alt+0 set window-scale 0.5 #menu: View > Zoom > 50 % Alt+1 set window-scale 1.0 #menu: View > Zoom > 100 % Alt+2 set window-scale 2.0 #menu: View > Zoom > 200 % diff --git a/mpv.net/WPF/CommandPaletteWindow.xaml b/mpv.net/WPF/CommandPaletteWindow.xaml index 0fa48c8..797e7f6 100644 --- a/mpv.net/WPF/CommandPaletteWindow.xaml +++ b/mpv.net/WPF/CommandPaletteWindow.xaml @@ -45,8 +45,8 @@ - - + + SetFormPosAndSize(value))); + void ScaleWindow(float value) { + BeginInvoke(new Action(() => { + if (value < 1 && (Width == MinimumSize.Width || Height == MinimumSize.Height)) + return; + SetFormPosAndSize(value, false, false, false); + })); } void WindowScale(double scale) @@ -334,7 +337,10 @@ namespace mpvnet return null; } - void SetFormPosAndSize(double scale = 1, bool force = false) + void SetFormPosAndSize(double scale = 1, + bool force = false, + bool checkAutofitSmaller = true, + bool checkAutofitLarger = true) { if (!force) { @@ -375,7 +381,8 @@ namespace mpvnet } height = Convert.ToInt32(height * scale); - SetSize(new Size(height * videoSize.Width / videoSize.Height, height), videoSize, screen); + SetSize(new Size(height * videoSize.Width / videoSize.Height, height), + videoSize, screen, checkAutofitSmaller, checkAutofitLarger); } void SetSize(Size size, @@ -842,6 +849,7 @@ namespace mpvnet WPF.WPF.Init(); System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown; Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y); + MinimumSize = new Size(FontHeight * 9, FontHeight * 9); UpdateCheck.DailyCheck(); core.LoadScripts(); Task.Run(() => App.Extension = new Extension());