This commit is contained in:
Frank Skare
2019-03-30 15:29:25 +01:00
parent 7fa4418e1f
commit 49b184c99c
9 changed files with 46 additions and 22 deletions

View File

@@ -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: <https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt#L89>
### 2.0 (2019-03-28)
- setting track-auto-selection added to settings editor (<https://mpv.io/manual/master/#options-track-auto-selection>)

View File

@@ -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";

View File

@@ -362,10 +362,7 @@ namespace mpvnet
{
var buttons = MessageBoxButtons.OK;
if (icon == MessageBoxIcon.Question) buttons = MessageBoxButtons.OKCancel;
var fn = new Func<DialogResult>(() => MessageBox.Show(
message, Application.ProductName, buttons, MessageBoxIcon.Information));
var fn = new Func<DialogResult>(() => MessageBox.Show(message, Application.ProductName, buttons, icon));
return (DialogResult)Invoke(fn);
}

View File

@@ -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

View File

@@ -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);
if (args != null && args.Length > 1 && args[0] == "mpv.net")
foreach (var i in mpvnet.Command.Commands)
if (args[1] == i.Name)
try
{
i.Action(args.Skip(2).ToArray());
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")
{
bool found = false;
foreach (var i in mpvnet.Command.Commands)
{
if (args[1] == i.Name)
{
found = true;
i.Action.Invoke(args.Skip(2).ToArray());
}
}
if (!found)
{
List<string> 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);
}
ClientMessage?.Invoke(args);
}
break;
case mpv_event_id.MPV_EVENT_VIDEO_RECONFIG:

View File

@@ -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("")]

BIN
screenshots/mpvConfEdit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB