From 83658aa476a3dcb09e2642407fb4295e8e7494dd Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Fri, 12 Jul 2019 23:53:43 +0200 Subject: [PATCH] - --- Changelog.md | 9 ++++-- Manual.md | 4 +-- mpv.net/Properties/AssemblyInfo.cs | 4 +-- mpv.net/Resources/inputConf.txt | 2 ++ mpv.net/WPF/LearnWindow.xaml | 6 ++-- mpv.net/WPF/LearnWindow.xaml.cs | 46 ++++++++++++++++++++++++------ mpv.net/WinForms/MainForm.cs | 14 +++++---- mpv.net/mpv/mp.cs | 7 +++-- 8 files changed, 67 insertions(+), 25 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9894589..7596fb4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,11 +1,16 @@ -### +### 4.7 -- left mouse double click MBTN_LEFT_DBL was not working - remember-height was replaced with start-size, when start-size is set to video the main video starts directly with the native video size, before it was starting with the autofit size first and was only afterwards resized to the native video size - on exit the window location can be saved with remember-position +- in the learn window of the input editor underscores were stripped + because they have a special meaning in WPF labels +- keys/input not working for MBTN_LEFT_DBL, MBTN_BACK, MBTN_FORWARD +- in the learn window of the input editor support was added for + mouse left, mouse left double, mouse mid, mouse forward, mouse back +- libmpv updated to shinchiro 2019-07-07 ### 4.6 diff --git a/Manual.md b/Manual.md index ad80676..1b60470 100644 --- a/Manual.md +++ b/Manual.md @@ -102,9 +102,9 @@ mpv.net is meant to be a small single person project, it's designed to be mpv co ### Target Audience -The target audience of mpv.net are Windows programmers and users that need something more advanced than common media players. +The target audience of mpv.net are programmers, nerds and software enthusiasts that need something more advanced than typical media players. -Furthermore mpv.net is well suited for Windows users who are interested to learn about the Linux operating system and portable apps, even though mpv.net self is not portable. +Furthermore mpv.net is well suited for users who are interested to learn mpv, Linux, portable apps and the command line. ## Requirements diff --git a/mpv.net/Properties/AssemblyInfo.cs b/mpv.net/Properties/AssemblyInfo.cs index 1783311..cf29616 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("4.6.0.0")] -[assembly: AssemblyFileVersion("4.6.0.0")] +[assembly: AssemblyVersion("4.7.0.0")] +[assembly: AssemblyFileVersion("4.7.0.0")] diff --git a/mpv.net/Resources/inputConf.txt b/mpv.net/Resources/inputConf.txt index 92e3af8..047388b 100644 --- a/mpv.net/Resources/inputConf.txt +++ b/mpv.net/Resources/inputConf.txt @@ -24,6 +24,8 @@ # mpv input keys: https://github.com/stax76/mpv.net/wiki/mpv-input-keys + # run mpv.net in input test mode with: mpvnet --input-test + o script-message mpv.net open-files #menu: Open > Open Files... u script-message mpv.net open-url #menu: Open > Open URL or file path from clipboard _ ignore #menu: Open > - diff --git a/mpv.net/WPF/LearnWindow.xaml b/mpv.net/WPF/LearnWindow.xaml index 9564c8e..d1e3ca5 100644 --- a/mpv.net/WPF/LearnWindow.xaml +++ b/mpv.net/WPF/LearnWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="Learn Input" Height="200" Width="400" WindowStartupLocation="CenterOwner" - ResizeMode="NoResize" Loaded="Window_Loaded" Background="Black" MouseWheel="Window_MouseWheel"> + ResizeMode="NoResize" Loaded="Window_Loaded" Background="Black" MouseWheel="Window_MouseWheel" MouseUp="Window_MouseUp" MouseDoubleClick="Window_MouseDoubleClick"> @@ -16,8 +16,8 @@ - - + + diff --git a/mpv.net/WPF/LearnWindow.xaml.cs b/mpv.net/WPF/LearnWindow.xaml.cs index d8044b4..a518fc4 100644 --- a/mpv.net/WPF/LearnWindow.xaml.cs +++ b/mpv.net/WPF/LearnWindow.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.InteropServices; +using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Interop; @@ -12,10 +13,7 @@ namespace mpvnet public CommandItem InputItem { get; set; } public string NewKey { get; set; } = ""; - public LearnWindow() - { - InitializeComponent(); - } + public LearnWindow() => InitializeComponent(); private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { @@ -43,8 +41,7 @@ namespace mpvnet else try { text = Convert.ToChar(charValue).ToString().ToLower().Trim(); - } - catch {} + } catch {} for (int i = 0; i < 13; i++) if ("D" + i.ToString() == text) @@ -144,8 +141,8 @@ namespace mpvnet void SetKey(string key) { NewKey = key; - MenuLabel.Content = InputItem.Path; - KeyLabel.Content = key; + MenuTextBlock.Text = InputItem.Path; + KeyTextBlock.Text = key; } [DllImport("user32.dll")] @@ -295,5 +292,38 @@ namespace mpvnet else SetKey("WHEEL_DOWN"); } + + private void Window_MouseUp(object sender, MouseButtonEventArgs e) + { + switch (e.ChangedButton) + { + case MouseButton.Left: + if (BlockMBTN_LEFT) + BlockMBTN_LEFT = false; + else + SetKey("MBTN_LEFT"); + break; + case MouseButton.Middle: + SetKey("MBTN_MID"); + break; + case MouseButton.XButton1: + SetKey("MBTN_BACK"); + break; + case MouseButton.XButton2: + SetKey("MBTN_FORWARD"); + break; + } + } + + bool BlockMBTN_LEFT; + + private void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + SetKey("MBTN_LEFT_DBL"); + BlockMBTN_LEFT = true; + } + } } } \ No newline at end of file diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index bb647c6..8ad37b0 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -61,7 +61,7 @@ namespace mpvnet int posX = RegHelp.GetInt(App.RegPath, "PosX"); int posY = RegHelp.GetInt(App.RegPath, "PosY"); - if (posX != 0 && posY != 0) + if (posX != 0 && posY != 0 && App.RememberPosition) { Left = posX - Width / 2; Top = posY - Height / 2; @@ -89,11 +89,11 @@ namespace mpvnet public MenuItem FindMenuItem(string text) => FindMenuItem(text, ContextMenu.Items); - void Idle() => BeginInvoke(new Action(() => { Text = "mpv.net " + Application.ProductVersion; })); + void Idle() => BeginInvoke(new Action(() => Text = "mpv.net " + Application.ProductVersion)); void CM_Popup(object sender, EventArgs e) => CursorHelp.Show(); - void VideoSizeChanged() => Invoke(new Action(() => SetFormPosAndSize())); + void VideoSizeChanged() => BeginInvoke(new Action(() => SetFormPosAndSize())); void Shutdown() => BeginInvoke(new Action(() => Close())); @@ -358,13 +358,15 @@ namespace mpvnet { case 0x0201: // WM_LBUTTONDOWN case 0x0202: // WM_LBUTTONUP + case 0x0207: // WM_MBUTTONDOWN + case 0x0208: // WM_MBUTTONUP + case 0x020A: // WM_MOUSEWHEEL + case 0x020C: // WM_XBUTTONUP + case 0x020B: // WM_XBUTTONDOWN case 0x0100: // WM_KEYDOWN case 0x0101: // WM_KEYUP case 0x0104: // WM_SYSKEYDOWN case 0x0105: // WM_SYSKEYUP - case 0x0207: // WM_MBUTTONDOWN - case 0x0208: // WM_MBUTTONUP - case 0x020A: // WM_MOUSEWHEEL if (mp.WindowHandle != IntPtr.Zero) Native.SendMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam); break; diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index a77c1d3..cb7aba9 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -314,10 +314,11 @@ namespace mpvnet if (VideoSize != vidSize && vidSize != Size.Empty) { VideoSize = vidSize; - VideoSizeAutoResetEvent.Set(); VideoSizeChanged?.Invoke(); } + VideoSizeAutoResetEvent.Set(); + Task.Run(new Action(() => ReadMetaData())); break; case mpv_event_id.MPV_EVENT_CHAPTER_CHANGE: @@ -515,6 +516,8 @@ namespace mpvnet Load(files.ToArray(), App.ProcessInstance != "queue", Control.ModifierKeys.HasFlag(Keys.Control)); + if (files.Count == 0) VideoSizeAutoResetEvent.Set(); + foreach (string i in args) { if (i.StartsWith("--")) @@ -538,7 +541,7 @@ namespace mpvnet } } - static DateTime LastLoad; + public static DateTime LastLoad; public static void Load(string[] files, bool loadFolder, bool append) {