From e3227de8b49403a2c97e88e03878145fcab1348e Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Mon, 14 Oct 2019 16:02:24 +0200 Subject: [PATCH] changelog updated --- Changelog.md | 4 ++-- README.md | 2 +- mpv.net/WinForms/MainForm.cs | 18 +++++++++++++++++- mpv.net/mpv/mp.cs | 3 ++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index dad6bec..c69ac76 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,8 +5,8 @@ and it will suppress auto-load-folder. To get a 'Add to mpv.net playlist' context menu item in explorer with multi selection support use my [Open with++](https://github.com/stax76/OpenWithPlusPlus#add-to-mpvnet-playlist) shell extension, as far as I know multi selection - can not be done using the Registry -- window-size mpv property support added + can not be done using the Registry but only via shell extension +- window-size mpv property support added ([default bindings](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt#L137)) ### 5.4.2 diff --git a/README.md b/README.md index 1613e60..80e6043 100644 --- a/README.md +++ b/README.md @@ -201,7 +201,7 @@ this decision was made to keep the code simple and lightweight. Python scripting is implemented with IronPython which uses Python 2.7. -The main window is WinForms based and uses less than 600 lines of code, +The main window is WinForms based and uses less than 750 lines of code, all other windows are WPF based and use even less code. The config editor adds it's controls dynamically and uses [TOML](https://en.wikipedia.org/wiki/TOML) to define it's diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index 3fd6bdd..96e4d70 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -373,10 +373,12 @@ namespace mpvnet if (!content.Contains("#menu:")) { var defaultItems = CommandItem.GetItems(Properties.Resources.inputConf); + foreach (CommandItem item in items) foreach (CommandItem defaultItem in defaultItems) if (item.Command == defaultItem.Command) defaultItem.Input = item.Input; + items = defaultItems; } @@ -384,7 +386,9 @@ namespace mpvnet { if (string.IsNullOrEmpty(item.Path)) continue; + string path = item.Path.Replace("&", "&&"); + MenuItem menuItem = ContextMenu.Add(path, () => { try { mp.command(item.Command); @@ -392,6 +396,7 @@ namespace mpvnet Msg.ShowException(ex); } }); + if (menuItem != null) menuItem.ShortcutKeyDisplayString = item.Input + " "; } @@ -489,16 +494,20 @@ namespace mpvnet NativeHelp.SubtractWindowBorders(Handle, ref r); int c_w = r.Right - r.Left, c_h = r.Bottom - r.Top; Size s = mp.VideoSize; + if (s == Size.Empty) s = new Size(16, 9); + float aspect = s.Width / (float)s.Height; int d_w = Convert.ToInt32(c_h * aspect - c_w); int d_h = Convert.ToInt32(c_w / aspect - c_h); int[] d_corners = { d_w, d_h, -d_w, -d_h }; int[] corners = { rc.Left, rc.Top, rc.Right, rc.Bottom }; int corner = NativeHelp.GetResizeBorder(m.WParam.ToInt32()); + if (corner >= 0) corners[corner] -= d_corners[corner]; + Marshal.StructureToPtr(new Native.RECT(corners[0], corners[1], corners[2], corners[3]), m.LParam, false); m.Result = new IntPtr(1); return; @@ -581,6 +590,7 @@ namespace mpvnet { if (mp.Border && FormBorderStyle == FormBorderStyle.None) FormBorderStyle = FormBorderStyle.Sizable; + if (!mp.Border && FormBorderStyle == FormBorderStyle.Sizable) FormBorderStyle = FormBorderStyle.None; } @@ -608,7 +618,10 @@ namespace mpvnet protected override void OnShown(EventArgs e) { base.OnShown(e); - if (mp.GPUAPI == "vulkan") mp.ProcessCommandLine(false); + + if (mp.GPUAPI == "vulkan") + mp.ProcessCommandLine(false); + var wpfColor = WPF.WPF.ThemeColor; Color color = Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B); ToolStripRendererEx.InitColors(color, App.IsDarkMode, App.ThemedMenu); @@ -669,6 +682,7 @@ namespace mpvnet protected override void OnDragEnter(DragEventArgs e) { base.OnDragEnter(e); + if (e.Data.GetDataPresent(DataFormats.FileDrop) || e.Data.GetDataPresent(DataFormats.Text)) e.Effect = DragDropEffects.Copy; } @@ -676,8 +690,10 @@ namespace mpvnet protected override void OnDragDrop(DragEventArgs e) { base.OnDragDrop(e); + if (e.Data.GetDataPresent(DataFormats.FileDrop)) mp.Load(e.Data.GetData(DataFormats.FileDrop) as String[], true, Control.ModifierKeys.HasFlag(Keys.Control)); + if (e.Data.GetDataPresent(DataFormats.Text)) mp.Load(new[] { e.Data.GetData(DataFormats.Text).ToString() }, true, Control.ModifierKeys.HasFlag(Keys.Control)); } diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index 837d685..bc60a35 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -119,7 +119,8 @@ namespace mpvnet public static void ProcessProperty(string name, string value) { if (name.Any(char.IsUpper)) - Msg.ShowError("Uppercase char detected: " + name, "mpv properties using the command line and the mpv.conf config file are required to be lowercase."); + Msg.ShowError("Uppercase char detected: " + name, + "mpv properties using the command line and the mpv.conf config file are required to be lowercase."); switch (name) {