built-in WM_APPCOMMAND support
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
5.4.7.2 Beta (not yet released)
|
||||
============
|
||||
|
||||
|
||||
- WM_APPCOMMAND (mpv calls this media-keys) based input is no longer
|
||||
directly passed to mpv but rather handled in mpv.net translating
|
||||
the commands to mpv keys and sent via keypress input command to mpv
|
||||
|
||||
|
||||
5.4.7.1 Beta
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:DynamicGUI"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
|
||||
d:DesignHeight="450"
|
||||
@@ -17,8 +17,8 @@
|
||||
Margin="0,10"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Foreground="{x:Static UI:Theme.Heading}"
|
||||
Background="{x:Static UI:Theme.Background}" />
|
||||
Foreground="{x:Static mpvnet:Theme.Heading}"
|
||||
Background="{x:Static mpvnet:Theme.Background}" />
|
||||
|
||||
<ItemsControl x:Name="ItemsControl">
|
||||
<ItemsControl.ItemTemplate>
|
||||
@@ -32,7 +32,7 @@
|
||||
FontSize="16"
|
||||
FontWeight="Normal"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"/>
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"/>
|
||||
|
||||
<TextBox x:Name="ItemHelpTextBox"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
@@ -41,8 +41,8 @@
|
||||
Margin="10,0,0,0" BorderThickness="0"
|
||||
IsReadOnly="True" Padding="7,0,0,0"
|
||||
MinHeight="0"
|
||||
Foreground="{x:Static UI:Theme.Foreground2}"
|
||||
Background="{x:Static UI:Theme.Background}"/>
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground2}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"/>
|
||||
|
||||
</WrapPanel>
|
||||
</DataTemplate>
|
||||
@@ -54,8 +54,8 @@
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Margin="0,10,0,0"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"/>
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"/>
|
||||
<TextBlock x:Name="LinkTextBlock" Margin="0,10">
|
||||
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
|
||||
</TextBlock>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:DynamicGUI"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800">
|
||||
@@ -16,8 +16,8 @@
|
||||
Margin="0,10"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Foreground="{x:Static UI:Theme.Heading}"
|
||||
Background="{x:Static UI:Theme.Background}"/>
|
||||
Foreground="{x:Static mpvnet:Theme.Heading}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"/>
|
||||
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -29,9 +29,9 @@
|
||||
Width="150"
|
||||
Height="20"
|
||||
HorizontalAlignment="Left"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"
|
||||
CaretBrush="{x:Static UI:Theme.Foreground}"
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"
|
||||
CaretBrush="{x:Static mpvnet:Theme.Foreground}"
|
||||
TextChanged="ValueTextBox_TextChanged"/>
|
||||
|
||||
<Button x:Name="Button"
|
||||
@@ -47,8 +47,8 @@
|
||||
TextWrapping="WrapWithOverflow"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"/>
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"/>
|
||||
|
||||
<TextBlock x:Name="LinkTextBlock" Margin="0,10">
|
||||
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
|
||||
|
||||
@@ -4,14 +4,10 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using UI;
|
||||
|
||||
using static libmpv;
|
||||
using static mpvnet.Core;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using static mpvnet.Core;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
public static class App
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
public static class ConsoleHelp
|
||||
{
|
||||
public static int Padding { get; set; }
|
||||
@@ -46,3 +50,65 @@ public static class ConsoleHelp
|
||||
Trace.WriteLine(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public class CursorHelp
|
||||
{
|
||||
static bool IsVisible = true;
|
||||
|
||||
public static void Show()
|
||||
{
|
||||
if (!IsVisible)
|
||||
{
|
||||
Cursor.Show();
|
||||
IsVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Hide()
|
||||
{
|
||||
if (IsVisible)
|
||||
{
|
||||
Cursor.Hide();
|
||||
IsVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsPosDifferent(Point screenPos)
|
||||
{
|
||||
return
|
||||
Math.Abs(screenPos.X - Control.MousePosition.X) > 10 ||
|
||||
Math.Abs(screenPos.Y - Control.MousePosition.Y) > 10;
|
||||
}
|
||||
}
|
||||
|
||||
public class mpvHelp
|
||||
{
|
||||
public static string WM_APPCOMMAND_to_mpv_key(int value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 51: return "CHANNEL_UP"; // MEDIA_CHANNEL_UP
|
||||
case 52: return "CHANNEL_DOWN"; // MEDIA_CHANNEL_DOWN
|
||||
case 49: return "FORWARD"; // MEDIA_FAST_FORWARD
|
||||
case 50: return "REWIND"; // MEDIA_REWIND
|
||||
case 46: return "PLAY"; // MEDIA_PLAY
|
||||
case 14: return "PLAYPAUSE"; // MEDIA_PLAY_PAUSE
|
||||
case 47: return "PAUSE"; // MEDIA_PAUSE
|
||||
case 11: return "NEXT"; // MEDIA_NEXTTRACK
|
||||
case 12: return "PREV"; // MEDIA_PREVIOUSTRACK
|
||||
case 13: return "STOP"; // MEDIA_STOP
|
||||
case 48: return "RECORD"; // MEDIA_RECORD
|
||||
case 1: return "VOLUME_UP"; // VOLUME_UP
|
||||
case 9: return "VOLUME_DOWN"; // VOLUME_DOWN
|
||||
case 8: return "MUTE"; // VOLUME_MUTE
|
||||
case 7: return "HOMEPAGE"; // BROWSER_HOME
|
||||
case 15: return "MAIL"; // LAUNCH_MAIL
|
||||
case 6: return "FAVORITES"; // BROWSER_FAVORITES
|
||||
case 5: return "SEARCH"; // BROWSER_SEARCH
|
||||
case 33: return "PRINT"; // PRINT
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,36 +195,6 @@ namespace mpvnet
|
||||
}
|
||||
}
|
||||
|
||||
public class CursorHelp
|
||||
{
|
||||
static bool IsVisible = true;
|
||||
|
||||
public static void Show()
|
||||
{
|
||||
if (!IsVisible)
|
||||
{
|
||||
Cursor.Show();
|
||||
IsVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Hide()
|
||||
{
|
||||
if (IsVisible)
|
||||
{
|
||||
Cursor.Hide();
|
||||
IsVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsPosDifferent(Point screenPos)
|
||||
{
|
||||
return
|
||||
Math.Abs(screenPos.X - Control.MousePosition.X) > 10 ||
|
||||
Math.Abs(screenPos.Y - Control.MousePosition.Y) > 10;
|
||||
}
|
||||
}
|
||||
|
||||
public class Folder
|
||||
{
|
||||
public static string Startup { get; } = Application.StartupPath + @"\";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace UI
|
||||
namespace mpvnet
|
||||
{
|
||||
public class Theme
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Title="About mpv.net"
|
||||
@@ -13,8 +13,8 @@
|
||||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ResizeMode="NoResize"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}">
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}">
|
||||
|
||||
<Grid>
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Title="Command Palette"
|
||||
@@ -21,15 +21,15 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBox Name="FilterTextBox"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"
|
||||
PreviewKeyDown="FilterTextBox_PreviewKeyDown"
|
||||
TextChanged="FilterTextBox_TextChanged"/>
|
||||
|
||||
<ListView Name="ListView"
|
||||
Grid.Row="1"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"
|
||||
MouseUp="ListView_MouseUp">
|
||||
|
||||
<ListView.ItemContainerStyle>
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Title="Config Editor"
|
||||
Height="530"
|
||||
Width="700"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"
|
||||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Loaded="ConfWindow1_Loaded">
|
||||
@@ -47,8 +47,8 @@
|
||||
ItemsSource="{Binding FilterStrings}"
|
||||
BorderThickness="0"
|
||||
SelectionChanged="FilterListBox_SelectionChanged"
|
||||
Foreground="{x:Static UI:Theme.Heading}"
|
||||
Background="{x:Static UI:Theme.Background}">
|
||||
Foreground="{x:Static mpvnet:Theme.Heading}"
|
||||
Background="{x:Static mpvnet:Theme.Background}">
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -57,10 +57,10 @@
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<TextBlock Name="OpenSettingsTextBlock" Margin="0,30,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{x:Static UI:Theme.Heading}" MouseUp="OpenSettingsTextBlock_MouseUp">Open config folder</TextBlock>
|
||||
<TextBlock Name="PreviewTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{x:Static UI:Theme.Heading}" MouseUp="PreviewTextBlock_MouseUp">Preview mpv.conf</TextBlock>
|
||||
<TextBlock Name="ShowManualTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{x:Static UI:Theme.Heading}" MouseUp="ShowManualTextBlock_MouseUp">Show mpv manual</TextBlock>
|
||||
<TextBlock Name="SupportTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{x:Static UI:Theme.Heading}" MouseUp="SupportTextBlock_MouseUp">Show support forum</TextBlock>
|
||||
<TextBlock Name="OpenSettingsTextBlock" Margin="0,30,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{x:Static mpvnet:Theme.Heading}" MouseUp="OpenSettingsTextBlock_MouseUp">Open config folder</TextBlock>
|
||||
<TextBlock Name="PreviewTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{x:Static mpvnet:Theme.Heading}" MouseUp="PreviewTextBlock_MouseUp">Preview mpv.conf</TextBlock>
|
||||
<TextBlock Name="ShowManualTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{x:Static mpvnet:Theme.Heading}" MouseUp="ShowManualTextBlock_MouseUp">Show mpv manual</TextBlock>
|
||||
<TextBlock Name="SupportTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{x:Static mpvnet:Theme.Heading}" MouseUp="SupportTextBlock_MouseUp">Show support forum</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Title="Media File Search"
|
||||
@@ -21,14 +21,14 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBox Name="FilterTextBox"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"
|
||||
PreviewKeyDown="FilterTextBox_PreviewKeyDown"
|
||||
TextChanged="FilterTextBox_TextChanged"/>
|
||||
|
||||
<ListView Name="ListView"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"
|
||||
Grid.Row="1"
|
||||
MouseUp="ListView_MouseUp"
|
||||
PreviewKeyDown="ListView_PreviewKeyDown">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Title="Input Editor"
|
||||
@@ -11,8 +11,8 @@
|
||||
Width="750"
|
||||
FontSize="13"
|
||||
ShowInTaskbar="False"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"
|
||||
Loaded="Window_Loaded"
|
||||
Closed="Window_Closed">
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Title="Learn Input"
|
||||
@@ -12,8 +12,8 @@
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ResizeMode="NoResize"
|
||||
Loaded="Window_Loaded"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"
|
||||
MouseWheel="Window_MouseWheel"
|
||||
MouseUp="Window_MouseUp"
|
||||
MouseDoubleClick="Window_MouseDoubleClick"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
|
||||
using WinForms = System.Windows.Forms;
|
||||
using static mpvnet.Core;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
@@ -64,9 +64,9 @@ namespace mpvnet
|
||||
case WinForms.Keys.NumPad9:
|
||||
text = "KP" + e.KeyCode.ToString()[6]; break;
|
||||
case WinForms.Keys.Space:
|
||||
text = "Space"; break;
|
||||
text = "SPACE"; break;
|
||||
case WinForms.Keys.Enter:
|
||||
text = "Enter"; break;
|
||||
text = "ENTER"; break;
|
||||
case WinForms.Keys.Tab:
|
||||
text = "TAB"; break;
|
||||
case WinForms.Keys.Back:
|
||||
@@ -76,7 +76,7 @@ namespace mpvnet
|
||||
case WinForms.Keys.Insert:
|
||||
text = "INS"; break;
|
||||
case WinForms.Keys.Home:
|
||||
text = "Home"; break;
|
||||
text = "HOME"; break;
|
||||
case WinForms.Keys.End:
|
||||
text = "END"; break;
|
||||
case WinForms.Keys.PageUp:
|
||||
@@ -86,37 +86,37 @@ namespace mpvnet
|
||||
case WinForms.Keys.Escape:
|
||||
text = "ESC"; break;
|
||||
case WinForms.Keys.PrintScreen:
|
||||
text = "Print"; break;
|
||||
text = "PRINT"; break;
|
||||
case WinForms.Keys.Play:
|
||||
text = "Play"; break;
|
||||
text = "PLAY"; break;
|
||||
case WinForms.Keys.Pause:
|
||||
text = "Pause"; break;
|
||||
text = "PAUSE"; break;
|
||||
case WinForms.Keys.MediaPlayPause:
|
||||
text = "PlayPause"; break;
|
||||
text = "PLAYPAUSE"; break;
|
||||
case WinForms.Keys.MediaStop:
|
||||
text = "Stop"; break;
|
||||
text = "STOP"; break;
|
||||
case WinForms.Keys.MediaNextTrack:
|
||||
text = "Next"; break;
|
||||
text = "NEXT"; break;
|
||||
case WinForms.Keys.MediaPreviousTrack:
|
||||
text = "Prev"; break;
|
||||
case WinForms.Keys.VolumeUp:
|
||||
text = "Volume_Up"; break;
|
||||
case WinForms.Keys.VolumeDown:
|
||||
text = "Volume_Down"; break;
|
||||
text = "PREV"; break;
|
||||
case WinForms.Keys.VolumeMute:
|
||||
text = "Mute"; break;
|
||||
text = "MUTE"; break;
|
||||
case WinForms.Keys.BrowserHome:
|
||||
text = "Homepage"; break;
|
||||
text = "HOMEPAGE"; break;
|
||||
case WinForms.Keys.LaunchMail:
|
||||
text = "Mail"; break;
|
||||
text = "MAIL"; break;
|
||||
case WinForms.Keys.BrowserFavorites:
|
||||
text = "Favorites"; break;
|
||||
text = "FAVORITES"; break;
|
||||
case WinForms.Keys.BrowserSearch:
|
||||
text = "Search"; break;
|
||||
text = "SEARCH"; break;
|
||||
case WinForms.Keys.Sleep:
|
||||
text = "Sleep"; break;
|
||||
text = "SLEEP"; break;
|
||||
case WinForms.Keys.Cancel:
|
||||
text = "Cancel"; break;
|
||||
text = "CANCEL"; break;
|
||||
case WinForms.Keys.VolumeUp:
|
||||
text = ""; break;
|
||||
case WinForms.Keys.VolumeDown:
|
||||
text = ""; break;
|
||||
}
|
||||
|
||||
bool wasModified = false;
|
||||
@@ -131,7 +131,8 @@ namespace mpvnet
|
||||
wasModified = true;
|
||||
}
|
||||
|
||||
if (text == "#") text = "SHARP";
|
||||
if (text == "#")
|
||||
text = "SHARP";
|
||||
|
||||
if (isAlt && !wasModified)
|
||||
text = "ALT+" + text;
|
||||
@@ -146,14 +147,11 @@ namespace mpvnet
|
||||
SetKey(text);
|
||||
}
|
||||
|
||||
DateTime LastKeyUp;
|
||||
|
||||
void SetKey(string key)
|
||||
{
|
||||
NewKey = key;
|
||||
MenuTextBlock.Text = InputItem.Path;
|
||||
KeyTextBlock.Text = key;
|
||||
LastKeyUp = DateTime.Now;
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
@@ -184,143 +182,16 @@ namespace mpvnet
|
||||
OnKeyUp(new WinForms.KeyEventArgs((WinForms.Keys)(unchecked((int)(long)m.WParam)) | ModifierKeys));
|
||||
else if (m.Msg == WM_APPCOMMAND)
|
||||
{
|
||||
if (!core.get_property_bool("input-media-keys"))
|
||||
return;
|
||||
string value = mpvHelp.WM_APPCOMMAND_to_mpv_key((int)(m.LParam.ToInt64() >> 16 & ~0xf000));
|
||||
|
||||
var value = (AppCommand)(m.LParam.ToInt64() >> 16 & ~0xf000);
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case AppCommand.APPCOMMAND_MEDIA_CHANNEL_DOWN:
|
||||
SetKey("CHANNEL_DOWN");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_CHANNEL_UP:
|
||||
SetKey("CHANNEL_UP");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_FAST_FORWARD:
|
||||
SetKey("FORWARD");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_REWIND:
|
||||
SetKey("REWIND");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_PAUSE:
|
||||
SetKey("PAUSE");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_PLAY:
|
||||
SetKey("PLAY");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_PLAY_PAUSE:
|
||||
SetKey("PLAYPAUSE");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_NEXTTRACK:
|
||||
SetKey("NEXT");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_PREVIOUSTRACK:
|
||||
SetKey("PREV");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_RECORD:
|
||||
SetKey("RECORD");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_MEDIA_STOP:
|
||||
SetKey("STOP");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_VOLUME_UP:
|
||||
SetKey("VOLUME_UP");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_VOLUME_DOWN:
|
||||
SetKey("VOLUME_DOWN");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_VOLUME_MUTE:
|
||||
SetKey("MUTE");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_BROWSER_HOME:
|
||||
SetKey("HOMEPAGE");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_LAUNCH_MAIL:
|
||||
SetKey("MAIL");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_BROWSER_FAVORITES:
|
||||
SetKey("FAVORITES");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_BROWSER_SEARCH:
|
||||
SetKey("SEARCH");
|
||||
break;
|
||||
case AppCommand.APPCOMMAND_PRINT:
|
||||
SetKey("PRINT");
|
||||
break;
|
||||
if (value != null)
|
||||
SetKey(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal enum AppCommand
|
||||
{
|
||||
APPCOMMAND_BASS_BOOST = 20,
|
||||
APPCOMMAND_BASS_DOWN = 19,
|
||||
APPCOMMAND_BASS_UP = 21,
|
||||
APPCOMMAND_BROWSER_BACKWARD = 1,
|
||||
APPCOMMAND_BROWSER_FAVORITES = 6,
|
||||
APPCOMMAND_BROWSER_FORWARD = 2,
|
||||
APPCOMMAND_BROWSER_HOME = 7,
|
||||
APPCOMMAND_BROWSER_REFRESH = 3,
|
||||
APPCOMMAND_BROWSER_SEARCH = 5,
|
||||
APPCOMMAND_BROWSER_STOP = 4,
|
||||
APPCOMMAND_CLOSE = 31,
|
||||
APPCOMMAND_COPY = 36,
|
||||
APPCOMMAND_CORRECTION_LIST = 45,
|
||||
APPCOMMAND_CUT = 37,
|
||||
APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE = 43,
|
||||
APPCOMMAND_FIND = 28,
|
||||
APPCOMMAND_FORWARD_MAIL = 40,
|
||||
APPCOMMAND_HELP = 27,
|
||||
APPCOMMAND_LAUNCH_APP1 = 17,
|
||||
APPCOMMAND_LAUNCH_APP2 = 18,
|
||||
APPCOMMAND_LAUNCH_MAIL = 15,
|
||||
APPCOMMAND_LAUNCH_MEDIA_SELECT = 16,
|
||||
APPCOMMAND_MEDIA_CHANNEL_DOWN = 52,
|
||||
APPCOMMAND_MEDIA_CHANNEL_UP = 51,
|
||||
APPCOMMAND_MEDIA_FAST_FORWARD = 49,
|
||||
APPCOMMAND_MEDIA_NEXTTRACK = 11,
|
||||
APPCOMMAND_MEDIA_PAUSE = 47,
|
||||
APPCOMMAND_MEDIA_PLAY = 46,
|
||||
APPCOMMAND_MEDIA_PLAY_PAUSE = 14,
|
||||
APPCOMMAND_MEDIA_PREVIOUSTRACK = 12,
|
||||
APPCOMMAND_MEDIA_RECORD = 48,
|
||||
APPCOMMAND_MEDIA_REWIND = 50,
|
||||
APPCOMMAND_MEDIA_STOP = 13,
|
||||
APPCOMMAND_MIC_ON_OFF_TOGGLE = 44,
|
||||
APPCOMMAND_MICROPHONE_VOLUME_DOWN = 25,
|
||||
APPCOMMAND_MICROPHONE_VOLUME_MUTE = 24,
|
||||
APPCOMMAND_MICROPHONE_VOLUME_UP = 26,
|
||||
APPCOMMAND_NEW = 29,
|
||||
APPCOMMAND_OPEN = 30,
|
||||
APPCOMMAND_PASTE = 38,
|
||||
APPCOMMAND_PRINT = 33,
|
||||
APPCOMMAND_REDO = 35,
|
||||
APPCOMMAND_REPLY_TO_MAIL = 39,
|
||||
APPCOMMAND_SAVE = 32,
|
||||
APPCOMMAND_SEND_MAIL = 41,
|
||||
APPCOMMAND_SPELL_CHECK = 42,
|
||||
APPCOMMAND_TREBLE_DOWN = 22,
|
||||
APPCOMMAND_TREBLE_UP = 23,
|
||||
APPCOMMAND_UNDO = 34,
|
||||
APPCOMMAND_VOLUME_DOWN = 9,
|
||||
APPCOMMAND_VOLUME_MUTE = 8,
|
||||
APPCOMMAND_VOLUME_UP = 10
|
||||
}
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern short GetKeyState(int keyCode);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern short VkKeyScan(char c);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
static extern int ToAscii(uint uVirtKey,
|
||||
uint uScanCode,
|
||||
byte[] lpKeyState,
|
||||
out uint lpChar,
|
||||
uint flags);
|
||||
|
||||
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:UI="clr-namespace:UI">
|
||||
xmlns:mpvnet="clr-namespace:mpvnet">
|
||||
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="Template">
|
||||
@@ -26,7 +26,7 @@
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsFocused" Value="true">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{x:Static UI:Theme.Heading}"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{x:Static mpvnet:Theme.Heading}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -49,8 +49,8 @@
|
||||
x:Name="normal"
|
||||
Width="18"
|
||||
Height="18"
|
||||
Fill="{x:Static UI:Theme.Background}"
|
||||
Stroke="{x:Static UI:Theme.Heading}"
|
||||
Fill="{x:Static mpvnet:Theme.Background}"
|
||||
Stroke="{x:Static mpvnet:Theme.Heading}"
|
||||
StrokeThickness="2" />
|
||||
<Ellipse
|
||||
x:Name="Checked1"
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800">
|
||||
|
||||
<Grid Name="SearchTextBoxUserControl1"
|
||||
Background="{x:Static UI:Theme.Background}">
|
||||
Background="{x:Static mpvnet:Theme.Background}">
|
||||
|
||||
<TextBlock Name="HintTextBlock"
|
||||
Margin="5,2"
|
||||
Text="Find a setting"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{x:Static UI:Theme.Foreground2}"
|
||||
Background="{x:Static UI:Theme.Background}" />
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground2}"
|
||||
Background="{x:Static mpvnet:Theme.Background}" />
|
||||
|
||||
<TextBox Name="SearchTextBox"
|
||||
Height="25"
|
||||
@@ -24,8 +24,8 @@
|
||||
BorderThickness="2"
|
||||
Background="Transparent"
|
||||
TextChanged="SearchTextBox_TextChanged"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
CaretBrush="{x:Static UI:Theme.Foreground}" />
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
CaretBrush="{x:Static mpvnet:Theme.Foreground}" />
|
||||
|
||||
<Button Name="SearchClearButton"
|
||||
Background="Transparent"
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
<Button.Style>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="{x:Static UI:Theme.Background}"/>
|
||||
<Setter Property="Foreground" Value="{x:Static UI:Theme.Foreground2}"/>
|
||||
<Setter Property="Background" Value="{x:Static mpvnet:Theme.Background}"/>
|
||||
<Setter Property="Foreground" Value="{x:Static mpvnet:Theme.Foreground2}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="{x:Static UI:Theme.Heading}"/>
|
||||
<Setter Property="Foreground" Value="{x:Static mpvnet:Theme.Heading}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:UI="clr-namespace:UI"
|
||||
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Title="mpv.net Setup"
|
||||
FontSize="13"
|
||||
Foreground="{x:Static UI:Theme.Foreground}"
|
||||
Background="{x:Static UI:Theme.Background}"
|
||||
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||
Background="{x:Static mpvnet:Theme.Background}"
|
||||
SizeToContent="WidthAndHeight"
|
||||
WindowStartupLocation="CenterOwner" >
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ using System.Globalization;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using UI;
|
||||
using static mpvnet.Core;
|
||||
|
||||
namespace mpvnet
|
||||
@@ -24,6 +23,7 @@ namespace mpvnet
|
||||
Point LastCursorPosition;
|
||||
int LastCursorChanged;
|
||||
int LastCycleFullscreen;
|
||||
int LastAppCommand;
|
||||
int TaskbarButtonCreatedMessage;
|
||||
int ShownTickCount;
|
||||
|
||||
@@ -517,12 +517,28 @@ namespace mpvnet
|
||||
case 0x101: // WM_KEYUP
|
||||
case 0x104: // WM_SYSKEYDOWN
|
||||
case 0x105: // WM_SYSKEYUP
|
||||
case 0x319: // WM_APPCOMMAND
|
||||
if (core.WindowHandle != IntPtr.Zero)
|
||||
m.Result = WinAPI.SendMessage(core.WindowHandle, m.Msg, m.WParam, m.LParam);
|
||||
{
|
||||
bool skip = m.Msg == 0x100 && LastAppCommand != 0 &&
|
||||
(Environment.TickCount - LastAppCommand) < 1000;
|
||||
|
||||
if (m.Msg == 0x319) // WM_APPCOMMAND
|
||||
if (core.WindowHandle != IntPtr.Zero && !skip)
|
||||
m.Result = WinAPI.SendMessage(core.WindowHandle, m.Msg, m.WParam, m.LParam);
|
||||
}
|
||||
|
||||
break;
|
||||
case 0x319: // WM_APPCOMMAND
|
||||
{
|
||||
string value = mpvHelp.WM_APPCOMMAND_to_mpv_key((int)(m.LParam.ToInt64() >> 16 & ~0xf000));
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
core.command("keypress " + value);
|
||||
m.Result = new IntPtr(1);
|
||||
LastAppCommand = Environment.TickCount;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 0x0200: // WM_MOUSEMOVE
|
||||
if (Environment.TickCount - LastCycleFullscreen > 500)
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Misc\Misc.cs" />
|
||||
<Compile Include="mpv\Core.cs" />
|
||||
<Compile Include="mpv\core.cs" />
|
||||
<Compile Include="Misc\Commands.cs" />
|
||||
<Compile Include="Native\Native.cs" />
|
||||
<Compile Include="Native\NativeHelp.cs" />
|
||||
|
||||
@@ -149,9 +149,11 @@ namespace mpvnet
|
||||
|
||||
public void ProcessProperty(string name, string value)
|
||||
{
|
||||
if (name.Any(char.IsUpper))
|
||||
foreach (char i in name)
|
||||
if (char.IsUpper(i))
|
||||
Msg.ShowError("Uppercase char detected: " + name,
|
||||
"mpv properties using the command line and the mpv.conf config file are required to be lowercase.");
|
||||
"mpv properties using the command line and the mpv.conf " +
|
||||
"config file are required to be lowercase.");
|
||||
|
||||
switch (name)
|
||||
{
|
||||
|
||||
14
scripts/powershell/show-in-file-explorer.ps1
Normal file
14
scripts/powershell/show-in-file-explorer.ps1
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
# Shows the current file in File Explorer
|
||||
|
||||
# In input.conf add: <key> script-message show-in-file-explorer
|
||||
|
||||
$code = {
|
||||
if ($args[0] -eq 'show-in-file-explorer')
|
||||
{
|
||||
# probably works only with shell execute for which powershell has no built-in support
|
||||
[Diagnostics.Process]::Start('explorer.exe', '/n, /select, "' + $mp.get_property_string('path') + '"')
|
||||
}
|
||||
}
|
||||
|
||||
$mp.register_event("client-message", $code)
|
||||
Reference in New Issue
Block a user