diff --git a/README.md b/README.md index 1199904..832d564 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,9 @@ Table of contents ![](https://raw.githubusercontent.com/stax76/mpv.net/master/screenshots/screenshot.png) -![](https://raw.githubusercontent.com/stax76/mpv.net/master/screenshots/mpvSettingsEditor.png) +![](https://raw.githubusercontent.com/stax76/mpv.net/master/screenshots/mpvConfEdit.png) + +![](https://raw.githubusercontent.com/stax76/mpv.net/master/screenshots/mpvInputEdit.png) ### Context Menu @@ -66,6 +68,16 @@ https://github.com/stax76/mpv.net/wiki/Scripting-(CSharp,-Python,-JavaScript,-Lu ### Changelog +### soon + +- messages boxes had always the info icon even if a different icon (error, warning, question) was intended +- instead of silently do nothing on unknown commands there is now a error message listing available commands and showing the location of the default bindings, this helps when commands are removed or renamed +- there was a problem fixed that made the cursor hidden when it should be visible + +### 2.1 (2019-03-30) + +- new input editor added, default key binding is here: + ### 2.0 (2019-03-28) - setting track-auto-selection added to settings editor () diff --git a/mpv.net/Command.cs b/mpv.net/Command.cs index 8678f2e..b08f41f 100644 --- a/mpv.net/Command.cs +++ b/mpv.net/Command.cs @@ -68,7 +68,7 @@ namespace mpvnet Process.Start(Application.StartupPath + "\\mpvConfEdit.exe"); } - public static void history(string[] args) + public static void show_history(string[] args) { var fp = mp.mpvConfFolderPath + "history.txt"; diff --git a/mpv.net/MainForm.cs b/mpv.net/MainForm.cs index b74aed0..469064b 100644 --- a/mpv.net/MainForm.cs +++ b/mpv.net/MainForm.cs @@ -362,10 +362,7 @@ namespace mpvnet { var buttons = MessageBoxButtons.OK; if (icon == MessageBoxIcon.Question) buttons = MessageBoxButtons.OKCancel; - - var fn = new Func(() => MessageBox.Show( - message, Application.ProductName, buttons, MessageBoxIcon.Information)); - + var fn = new Func(() => MessageBox.Show(message, Application.ProductName, buttons, icon)); return (DialogResult)Invoke(fn); } diff --git a/mpv.net/Resources/input.conf.txt b/mpv.net/Resources/input.conf.txt index bffab4d..8364575 100644 --- a/mpv.net/Resources/input.conf.txt +++ b/mpv.net/Resources/input.conf.txt @@ -92,7 +92,7 @@ t script-binding stats/display-stats #menu: Tools > Show Statistics T script-binding stats/display-stats-toggle #menu: Tools > Toggle Statistics _ ignore #menu: Tools > - - h script-message mpv.net history #menu: Tools > Show History + h script-message mpv.net show-history #menu: Tools > Show History l ab-loop #menu: Tools > Set/clear A-B loop points L cycle-values loop-file "inf" "no" #menu: Tools > Toggle Infinite Looping Del script-binding osc/visibility #menu: Tools > Toggle OSC Visibility @@ -109,7 +109,7 @@ Q quit-watch-later #menu: Exit Watch Later > playlist-next < playlist-prev - Enter cycle pause + Enter cycle pause Power quit Play cycle pause Pause cycle pause @@ -118,7 +118,7 @@ Forward seek 60 Rewind seek -60 Mute cycle mute - Volume_Up add volume 10 + Volume_Up add volume 10 Volume_Down add volume -10 Wheel_Up add volume 10 Wheel_Down add volume -10 \ No newline at end of file diff --git a/mpv.net/mp.cs b/mpv.net/mp.cs index d48f36c..76acc29 100644 --- a/mpv.net/mp.cs +++ b/mpv.net/mp.cs @@ -195,21 +195,36 @@ namespace mpvnet case mpv_event_id.MPV_EVENT_CLIENT_MESSAGE: if (ClientMessage != null) { - var client_messageData = (mpv_event_client_message)Marshal.PtrToStructure(evt.data, typeof(mpv_event_client_message)); - var args = NativeUtf8StrArray2ManagedStrArray(client_messageData.args, client_messageData.num_args); + try + { + var client_messageData = (mpv_event_client_message)Marshal.PtrToStructure(evt.data, typeof(mpv_event_client_message)); + string[] args = NativeUtf8StrArray2ManagedStrArray(client_messageData.args, client_messageData.num_args); - if (args != null && args.Length > 1 && args[0] == "mpv.net") - foreach (var i in mpvnet.Command.Commands) - if (args[1] == i.Name) - try + if (args != null && args.Length > 1 && args[0] == "mpv.net") + { + bool found = false; + + foreach (var i in mpvnet.Command.Commands) + { + if (args[1] == i.Name) { - i.Action(args.Skip(2).ToArray()); + found = true; + i.Action.Invoke(args.Skip(2).ToArray()); } - catch (Exception ex) - { - MainForm.Instance.ShowMsgBox(ex.GetType().Name + "\n\n" + ex.ToString(), MessageBoxIcon.Error); - } - ClientMessage?.Invoke(args); + } + if (!found) + { + List names = mpvnet.Command.Commands.Select((item) => item.Name).ToList(); + names.Sort(); + MainForm.Instance.ShowMsgBox($"No command '{args[1]}' found. Available commands are:\n\n{string.Join("\n", names)}\n\nHow to bind these commands can be seen in the default input bindings and menu definition located at:\n\nhttps://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt", MessageBoxIcon.Error); + } + } + ClientMessage?.Invoke(args); + } + catch (Exception ex) + { + MainForm.Instance.ShowMsgBox(ex.GetType().Name + "\n\n" + ex.ToString(), MessageBoxIcon.Error); + } } break; case mpv_event_id.MPV_EVENT_VIDEO_RECONFIG: diff --git a/mpvInputEdit/Properties/AssemblyInfo.cs b/mpvInputEdit/Properties/AssemblyInfo.cs index 62a3340..f53a944 100644 --- a/mpvInputEdit/Properties/AssemblyInfo.cs +++ b/mpvInputEdit/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ using System.Windows; [assembly: AssemblyDescription("mpv(.net) key bindings editor")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("mpv input edit")] +[assembly: AssemblyProduct("mpv(.net) input edit")] [assembly: AssemblyCopyright("Copyright © stax76")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/screenshots/mpvConfEdit.png b/screenshots/mpvConfEdit.png new file mode 100644 index 0000000..71b5c3a Binary files /dev/null and b/screenshots/mpvConfEdit.png differ diff --git a/screenshots/mpvSettingsEditor.png b/screenshots/mpvSettingsEditor.png deleted file mode 100644 index d01f514..0000000 Binary files a/screenshots/mpvSettingsEditor.png and /dev/null differ diff --git a/screenshots/screenshot.png b/screenshots/mpvnet.png similarity index 100% rename from screenshots/screenshot.png rename to screenshots/mpvnet.png