Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d31237d5f | ||
|
|
3705e2abbf | ||
|
|
7d73529c83 | ||
|
|
2e59d49ad1 | ||
|
|
f61eef8961 | ||
|
|
efb4c085d5 | ||
|
|
4a045d6a91 | ||
|
|
da1a78cfa3 | ||
|
|
5b3697fbde | ||
|
|
726d759589 | ||
|
|
ed614332f7 | ||
|
|
9d46064dca | ||
|
|
407b49b3ad | ||
|
|
0e92d4ec0c | ||
|
|
4f96835e19 | ||
|
|
56d954d94e | ||
|
|
a8aeb1e3e9 | ||
|
|
415fd266a2 |
49
Changelog.md
49
Changelog.md
@@ -1,10 +1,57 @@
|
|||||||
|
|
||||||
5.4.5.2 Beta (not yet released)
|
5.4.8.1 Beta (not yet released)
|
||||||
============
|
============
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
5.4.8.0
|
||||||
|
=======
|
||||||
|
|
||||||
|
- fix learn window of input editor (much work)
|
||||||
|
- fix black one pixel bar on right side
|
||||||
|
- fix beep sound when closed from taskbar
|
||||||
|
|
||||||
|
|
||||||
|
5.4.7.4 Beta (not yet released)
|
||||||
|
============
|
||||||
|
|
||||||
|
- the media key issue should now be fixed!
|
||||||
|
- libmpv and youtube-dl update
|
||||||
|
|
||||||
|
|
||||||
|
5.4.7.3 Beta
|
||||||
|
============
|
||||||
|
|
||||||
|
- new setting media-keys added, can be found in the config editor in the input tab.
|
||||||
|
|
||||||
|
|
||||||
|
5.4.7.2 Beta
|
||||||
|
============
|
||||||
|
|
||||||
|
- another attempt to fix a app command issue. WM_APPCOMMAND (mpv calls this media keys)
|
||||||
|
based input is no longer directly passed to mpv but rather handled in mpv.net directly
|
||||||
|
translating the native commands to mpv keys and sent via keypress input command to mpv
|
||||||
|
- another attempt to fix a crash caused by powershell 5.1 not being installed
|
||||||
|
|
||||||
|
|
||||||
|
5.4.7.1 Beta
|
||||||
|
============
|
||||||
|
|
||||||
|
- log error fix, mpv.net does now ignore all log messages because libmpv already
|
||||||
|
prints the log messages to the the terminal
|
||||||
|
- the release script now also outputs x86 beta versions so x86 users can test betas
|
||||||
|
|
||||||
|
|
||||||
|
5.4.7.0
|
||||||
|
=======
|
||||||
|
|
||||||
|
- log error fix
|
||||||
|
- workaround to support AviSynth portable (ffmpeg blocks loading AviSynth from path env var)
|
||||||
|
- attempt to fix not reproducible volume input issue
|
||||||
|
- attempt to fix exception caused by powershell being not available on Win 7
|
||||||
|
|
||||||
|
|
||||||
5.4.6.0
|
5.4.6.0
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|||||||
39
Manual.md
39
Manual.md
@@ -166,7 +166,9 @@ After the file associations were registered, go to the Windows settings under 'S
|
|||||||
|
|
||||||
It's possible to change the default application using the 'Open with' feature of the context menu in File Explorer.
|
It's possible to change the default application using the 'Open with' feature of the context menu in File Explorer.
|
||||||
|
|
||||||
[Open with++](#open-with) can be used to extend the File Explorer context menu to get menu items for 'Play with mpv.net' and 'Add to mpv.net playlist'.
|
[Open with++](#open-with) can be used to extend the File Explorer context menu to get menu items for [Play with mpv.net](https://github.com/stax76/OpenWithPlusPlus#play-with-mpvnet) and [Add to mpv.net playlist](https://github.com/stax76/OpenWithPlusPlus#add-to-mpvnet-playlist).
|
||||||
|
|
||||||
|
When multiple files are selected in File Explorer and enter is pressed then the files are opened in mpv.net in random order, this works with maximum 15 files.
|
||||||
|
|
||||||
|
|
||||||
Support
|
Support
|
||||||
@@ -174,9 +176,9 @@ Support
|
|||||||
|
|
||||||
Before making a support request, please try a newer [beta version](#beta) first.
|
Before making a support request, please try a newer [beta version](#beta) first.
|
||||||
|
|
||||||
[Support thread in VideoHelp forum](https://forum.videohelp.com/threads/392514-mpv-net-a-extendable-media-player-for-windows)
|
Bugs and feature requests can be made on the github [issue tracker](https://github.com/stax76/mpv.net/issues), feel free to use for anything mpv.net related.
|
||||||
|
|
||||||
[Issue tracker](https://github.com/stax76/mpv.net/issues), feel free to use for anything mpv.net related.
|
Or use the [support thread](https://forum.videohelp.com/threads/392514-mpv-net-a-extendable-media-player-for-windows) in the VideoHelp forum.
|
||||||
|
|
||||||
|
|
||||||
Settings
|
Settings
|
||||||
@@ -272,30 +274,7 @@ Alternatively he Chrome/Firefox extension [Open With](https://github.com/stax76/
|
|||||||
|
|
||||||
### Open with++
|
### Open with++
|
||||||
|
|
||||||
Open with++ allows to customize the File Explorer context menu to add menu items 'Play with mpv.net' and 'Add to mpv.net playlist'.
|
[Open with++](https://github.com/stax76/OpenWithPlusPlus) can be used to extend the File Explorer context menu to get menu items for [Play with mpv.net](https://github.com/stax76/OpenWithPlusPlus#play-with-mpvnet) and [Add to mpv.net playlist](https://github.com/stax76/OpenWithPlusPlus#add-to-mpvnet-playlist).
|
||||||
|
|
||||||
https://github.com/stax76/OpenWithPlusPlus
|
|
||||||
|
|
||||||
https://github.com/stax76/OpenWithPlusPlus#mpvnet
|
|
||||||
|
|
||||||
https://github.com/stax76/OpenWithPlusPlus#add-to-mpvnet-playlist
|
|
||||||
|
|
||||||
|
|
||||||
### MediaInfo.NET
|
|
||||||
|
|
||||||
MediaInfo.NET is a media info GUI.
|
|
||||||
|
|
||||||
https://github.com/stax76/MediaInfo.NET
|
|
||||||
|
|
||||||
To start a external application mpv has the run input command (it does not use shell execute).
|
|
||||||
|
|
||||||
If the path has spaces then it must be enclosed in quotes and then double backslashes must be used for escaping or alternatively forward slashes.
|
|
||||||
|
|
||||||
`_ run D:\Software\MediaInfoNET.exe "${path}" #menu: Tools > Open file with MediaInfo.NET`
|
|
||||||
|
|
||||||
`_ run "D:\\Soft ware\\MediaInfoNET.exe" "${path}" #menu: Tools > Open file with MediaInfo.NET`
|
|
||||||
|
|
||||||
`_ run "D:/Soft ware/MediaInfoNET.exe" "${path}" #menu: Tools > Open file with MediaInfo.NET`
|
|
||||||
|
|
||||||
|
|
||||||
Scripting
|
Scripting
|
||||||
@@ -442,7 +421,7 @@ Selecting multiple files in File Explorer and pressing enter will open the files
|
|||||||
|
|
||||||
Whenever the control key is pressed when files or URLs are opened, the playlist is not cleared but the files or URLs are appended to the playlist. This works in all mpv.net features that open files or URLs.
|
Whenever the control key is pressed when files or URLs are opened, the playlist is not cleared but the files or URLs are appended to the playlist. This works in all mpv.net features that open files or URLs.
|
||||||
|
|
||||||
Pressing the shift key while opening a single file will suppress loading all files in the folder.
|
Pressing the shift key while opening a single file will suppress loading all files of the folder into the playlist.
|
||||||
|
|
||||||
In fullscreen mode clicking the top right corner closes the player.
|
In fullscreen mode clicking the top right corner closes the player.
|
||||||
|
|
||||||
@@ -538,9 +517,7 @@ input.conf defines mpvs key and mouse bindings and mpv.net uses comments to defi
|
|||||||
|
|
||||||
The Open Files menu entry is one way to open files in mpv.net, it supports multi selection.
|
The Open Files menu entry is one way to open files in mpv.net, it supports multi selection.
|
||||||
|
|
||||||
Another way to open files is the command line, it is used by the File Explorer if file associations exist.
|
Another way to open files is the command line which is used by File Explorer for existing associations.
|
||||||
|
|
||||||
When mpv.net is started from a terminal, mpv.net outputs status and debug messages on the terminal.
|
|
||||||
|
|
||||||
A third way is to drag and drop files on the main window.
|
A third way is to drag and drop files on the main window.
|
||||||
|
|
||||||
|
|||||||
96
Release.ps1
96
Release.ps1
@@ -1,39 +1,6 @@
|
|||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
$include = @(
|
|
||||||
'*.cs',
|
|
||||||
'*.csproj',
|
|
||||||
'*.iss',
|
|
||||||
'*.js',
|
|
||||||
'*.lua',
|
|
||||||
'*.ps1',
|
|
||||||
'*.resx',
|
|
||||||
'*.sln',
|
|
||||||
'*.txt',
|
|
||||||
'*.xaml'
|
|
||||||
)
|
|
||||||
|
|
||||||
$files = Get-ChildItem -Path $PSScriptRoot -Recurse -File -Include $include
|
|
||||||
|
|
||||||
foreach ($file in $files)
|
|
||||||
{
|
|
||||||
$lines = Get-Content $file
|
|
||||||
|
|
||||||
foreach ($line in $lines)
|
|
||||||
{
|
|
||||||
foreach ($char in $line.ToCharArray())
|
|
||||||
{
|
|
||||||
$codePoint = [int]$char
|
|
||||||
|
|
||||||
if ($codePoint -gt 127)
|
|
||||||
{
|
|
||||||
throw "Non ASCII char $char in file '$($file.FullName)' in line: $line"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$desktopDir = [Environment]::GetFolderPath('Desktop')
|
$desktopDir = [Environment]::GetFolderPath('Desktop')
|
||||||
$exePath = $PSScriptRoot + '\mpv.net\bin\x64\mpvnet.exe'
|
$exePath = $PSScriptRoot + '\mpv.net\bin\x64\mpvnet.exe'
|
||||||
$versionInfo = [Diagnostics.FileVersionInfo]::GetVersionInfo($exePath)
|
$versionInfo = [Diagnostics.FileVersionInfo]::GetVersionInfo($exePath)
|
||||||
@@ -42,6 +9,29 @@ $msBuild = $vsDir + '\Community\MSBuild\Current\Bin\MSBuild.exe'
|
|||||||
$inno = 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe'
|
$inno = 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe'
|
||||||
$7z = 'C:\Program Files\7-Zip\7z.exe'
|
$7z = 'C:\Program Files\7-Zip\7z.exe'
|
||||||
|
|
||||||
|
$cloudDirectories = 'C:\Users\frank\OneDrive\Public\mpv.net\',
|
||||||
|
'C:\Users\frank\Dropbox\Public\mpv.net\'
|
||||||
|
|
||||||
|
function UploadBeta($sourceFile)
|
||||||
|
{
|
||||||
|
foreach ($cloudDirectory in $cloudDirectories)
|
||||||
|
{
|
||||||
|
if (-not (Test-Path $cloudDirectory))
|
||||||
|
{
|
||||||
|
throw $cloudDirectory
|
||||||
|
}
|
||||||
|
|
||||||
|
$targetFile = $cloudDirectory + (Split-Path $sourceFile -Leaf)
|
||||||
|
|
||||||
|
if (Test-Path $targetFile)
|
||||||
|
{
|
||||||
|
throw $targetFile
|
||||||
|
}
|
||||||
|
|
||||||
|
Copy-Item $sourceFile $targetFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($versionInfo.FilePrivatePart -eq 0)
|
if ($versionInfo.FilePrivatePart -eq 0)
|
||||||
{
|
{
|
||||||
& $msBuild mpv.net.sln -t:Rebuild -p:Configuration=Debug -p:Platform=x64
|
& $msBuild mpv.net.sln -t:Rebuild -p:Configuration=Debug -p:Platform=x64
|
||||||
@@ -58,56 +48,50 @@ if ($versionInfo.FilePrivatePart -eq 0)
|
|||||||
|
|
||||||
$targetDir = $desktopDir + "\mpv.net-portable-x64-$($versionInfo.FileVersion)"
|
$targetDir = $desktopDir + "\mpv.net-portable-x64-$($versionInfo.FileVersion)"
|
||||||
Copy-Item .\mpv.net\bin\x64 $targetDir -Recurse -Exclude System.Management.Automation.xml
|
Copy-Item .\mpv.net\bin\x64 $targetDir -Recurse -Exclude System.Management.Automation.xml
|
||||||
|
|
||||||
& $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"
|
& $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"
|
||||||
if ($LastExitCode) { throw $LastExitCode }
|
if ($LastExitCode) { throw $LastExitCode }
|
||||||
|
|
||||||
& $7z a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*"
|
& $7z a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*"
|
||||||
if ($LastExitCode) { throw $LastExitCode }
|
if ($LastExitCode) { throw $LastExitCode }
|
||||||
|
|
||||||
$targetDir = $desktopDir + "\mpv.net-portable-x86-$($versionInfo.FileVersion)"
|
$targetDir = $desktopDir + "\mpv.net-portable-x86-$($versionInfo.FileVersion)"
|
||||||
Copy-Item .\mpv.net\bin\x86 $targetDir -Recurse -Exclude System.Management.Automation.xml
|
Copy-Item .\mpv.net\bin\x86 $targetDir -Recurse -Exclude System.Management.Automation.xml
|
||||||
|
|
||||||
& $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"
|
& $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"
|
||||||
if ($LastExitCode) { throw $LastExitCode }
|
if ($LastExitCode) { throw $LastExitCode }
|
||||||
|
|
||||||
& $7z a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*"
|
& $7z a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*"
|
||||||
if ($LastExitCode) { throw $LastExitCode }
|
if ($LastExitCode) { throw $LastExitCode }
|
||||||
|
|
||||||
|
Set-Clipboard ($versionInfo.FileVersion + "`n`nChangelog:`n`n" +
|
||||||
|
'https://github.com/stax76/mpv.net/blob/master/Changelog.md' + "`n`nDownload:`n`n" +
|
||||||
|
'https://github.com/stax76/mpv.net/blob/master/Manual.md#stable')
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
& $msBuild mpv.net.sln -t:Rebuild -p:Configuration=Debug -p:Platform=x64
|
& $msBuild mpv.net.sln -t:Rebuild -p:Configuration=Debug -p:Platform=x64
|
||||||
if ($LastExitCode) { throw $LastExitCode }
|
if ($LastExitCode) { throw $LastExitCode }
|
||||||
|
|
||||||
|
& $msBuild mpv.net.sln -t:Rebuild -p:Configuration=Debug -p:Platform=x86
|
||||||
|
if ($LastExitCode) { throw $LastExitCode }
|
||||||
|
|
||||||
$targetDir = "$desktopDir\mpv.net-portable-x64-$($versionInfo.FileVersion)-beta"
|
$targetDir = "$desktopDir\mpv.net-portable-x64-$($versionInfo.FileVersion)-beta"
|
||||||
Copy-Item .\mpv.net\bin\x64 $targetDir -Recurse -Exclude System.Management.Automation.xml
|
Copy-Item .\mpv.net\bin\x64 $targetDir -Recurse -Exclude System.Management.Automation.xml
|
||||||
& $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"
|
& $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"
|
||||||
if ($LastExitCode) { throw $LastExitCode }
|
if ($LastExitCode) { throw $LastExitCode }
|
||||||
|
UploadBeta "$targetDir.7z"
|
||||||
|
|
||||||
$cloudDirectories = 'C:\Users\frank\OneDrive\Public\mpv.net\',
|
$targetDir = $desktopDir + "\mpv.net-portable-x86-$($versionInfo.FileVersion)-beta"
|
||||||
'C:\Users\frank\Dropbox\Public\mpv.net\'
|
Copy-Item .\mpv.net\bin\x86 $targetDir -Recurse -Exclude System.Management.Automation.xml
|
||||||
|
& $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"
|
||||||
|
if ($LastExitCode) { throw $LastExitCode }
|
||||||
|
UploadBeta "$targetDir.7z"
|
||||||
|
|
||||||
foreach ($cloudDirectory in $cloudDirectories)
|
foreach ($cloudDirectory in $cloudDirectories)
|
||||||
{
|
{
|
||||||
if (-not (Test-Path $cloudDirectory))
|
|
||||||
{
|
|
||||||
throw $cloudDirectory
|
|
||||||
}
|
|
||||||
|
|
||||||
$targetFile = $cloudDirectory + (Split-Path $targetDir -Leaf) + '.7z'
|
|
||||||
|
|
||||||
if (Test-Path $targetFile)
|
|
||||||
{
|
|
||||||
throw $targetFile
|
|
||||||
}
|
|
||||||
|
|
||||||
Copy-Item ($targetDir + '.7z') $targetFile
|
|
||||||
Invoke-Item $cloudDirectory
|
Invoke-Item $cloudDirectory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set-Clipboard ($versionInfo.FileVersion + " Beta`n`nChangelog:`n`n" +
|
||||||
|
'https://github.com/stax76/mpv.net/blob/master/Changelog.md' + "`n`nDownload:`n`n" +
|
||||||
|
'https://github.com/stax76/mpv.net/blob/master/Manual.md#beta')
|
||||||
}
|
}
|
||||||
|
|
||||||
Set-Clipboard ($versionInfo.FileVersion + "`n`n" +
|
|
||||||
'https://github.com/stax76/mpv.net/blob/master/Changelog.md' + "`n`n" +
|
|
||||||
'https://github.com/stax76/mpv.net#download')
|
|
||||||
|
|
||||||
Write-Host 'successfully finished' -ForegroundColor Green
|
Write-Host 'successfully finished' -ForegroundColor Green
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:DynamicGUI"
|
xmlns:local="clr-namespace:DynamicGUI"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
Margin="0,10"
|
Margin="0,10"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Foreground="{x:Static UI:Theme.Heading}"
|
Foreground="{x:Static mpvnet:Theme.Heading}"
|
||||||
Background="{x:Static UI:Theme.Background}" />
|
Background="{x:Static mpvnet:Theme.Background}" />
|
||||||
|
|
||||||
<ItemsControl x:Name="ItemsControl">
|
<ItemsControl x:Name="ItemsControl">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
FontSize="16"
|
FontSize="16"
|
||||||
FontWeight="Normal"
|
FontWeight="Normal"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"/>
|
Foreground="{x:Static mpvnet:Theme.Foreground}"/>
|
||||||
|
|
||||||
<TextBox x:Name="ItemHelpTextBox"
|
<TextBox x:Name="ItemHelpTextBox"
|
||||||
TextWrapping="WrapWithOverflow"
|
TextWrapping="WrapWithOverflow"
|
||||||
@@ -41,8 +41,8 @@
|
|||||||
Margin="10,0,0,0" BorderThickness="0"
|
Margin="10,0,0,0" BorderThickness="0"
|
||||||
IsReadOnly="True" Padding="7,0,0,0"
|
IsReadOnly="True" Padding="7,0,0,0"
|
||||||
MinHeight="0"
|
MinHeight="0"
|
||||||
Foreground="{x:Static UI:Theme.Foreground2}"
|
Foreground="{x:Static mpvnet:Theme.Foreground2}"
|
||||||
Background="{x:Static UI:Theme.Background}"/>
|
Background="{x:Static mpvnet:Theme.Background}"/>
|
||||||
|
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
@@ -54,8 +54,8 @@
|
|||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Margin="0,10,0,0"
|
Margin="0,10,0,0"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"/>
|
Background="{x:Static mpvnet:Theme.Background}"/>
|
||||||
<TextBlock x:Name="LinkTextBlock" Margin="0,10">
|
<TextBlock x:Name="LinkTextBlock" Margin="0,10">
|
||||||
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
|
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:DynamicGUI"
|
xmlns:local="clr-namespace:DynamicGUI"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800">
|
d:DesignWidth="800">
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
Margin="0,10"
|
Margin="0,10"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Foreground="{x:Static UI:Theme.Heading}"
|
Foreground="{x:Static mpvnet:Theme.Heading}"
|
||||||
Background="{x:Static UI:Theme.Background}"/>
|
Background="{x:Static mpvnet:Theme.Background}"/>
|
||||||
|
|
||||||
<Grid Margin="0,0,0,10">
|
<Grid Margin="0,0,0,10">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -29,9 +29,9 @@
|
|||||||
Width="150"
|
Width="150"
|
||||||
Height="20"
|
Height="20"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"
|
Background="{x:Static mpvnet:Theme.Background}"
|
||||||
CaretBrush="{x:Static UI:Theme.Foreground}"
|
CaretBrush="{x:Static mpvnet:Theme.Foreground}"
|
||||||
TextChanged="ValueTextBox_TextChanged"/>
|
TextChanged="ValueTextBox_TextChanged"/>
|
||||||
|
|
||||||
<Button x:Name="Button"
|
<Button x:Name="Button"
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
TextWrapping="WrapWithOverflow"
|
TextWrapping="WrapWithOverflow"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"/>
|
Background="{x:Static mpvnet:Theme.Background}"/>
|
||||||
|
|
||||||
<TextBlock x:Name="LinkTextBlock" Margin="0,10">
|
<TextBlock x:Name="LinkTextBlock" Margin="0,10">
|
||||||
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
|
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
|
||||||
|
|||||||
@@ -4,14 +4,10 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using UI;
|
|
||||||
|
|
||||||
using static libmpv;
|
|
||||||
using static mpvnet.Core;
|
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using static mpvnet.Core;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
public static class App
|
public static class App
|
||||||
@@ -89,13 +85,6 @@ namespace mpvnet
|
|||||||
|
|
||||||
core.Shutdown += Shutdown;
|
core.Shutdown += Shutdown;
|
||||||
core.Initialized += Initialized;
|
core.Initialized += Initialized;
|
||||||
core.LogMessage += ShowFatalError;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ShowFatalError(mpv_log_level level, string msg)
|
|
||||||
{
|
|
||||||
if (!App.IsStartedFromTerminal && level == mpv_log_level.MPV_LOG_LEVEL_FATAL)
|
|
||||||
Msg.ShowError(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RunAction(Action action)
|
public static void RunAction(Action action)
|
||||||
|
|||||||
@@ -1,48 +1,111 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
public static class ConsoleHelp
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
public static int Padding { get; set; }
|
public static class ConsoleHelp
|
||||||
|
|
||||||
public static void WriteError(object obj, string module = "mpv.net")
|
|
||||||
{
|
{
|
||||||
Write(obj, module, ConsoleColor.Red, false);
|
public static int Padding { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
public static void Write(object obj, string module = "mpv.net")
|
public static void WriteError(object obj, string module = "mpv.net")
|
||||||
{
|
{
|
||||||
Write(obj, module, ConsoleColor.Black, true);
|
Write(obj, module, ConsoleColor.Red, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Write(object obj, string module, ConsoleColor color)
|
public static void Write(object obj, string module = "mpv.net")
|
||||||
{
|
{
|
||||||
Write(obj, module, color, false);
|
Write(obj, module, ConsoleColor.Black, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Write(object obj, string module, ConsoleColor color, bool useDefaultColor)
|
public static void Write(object obj, string module, ConsoleColor color)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
Write(obj, module, color, false);
|
||||||
return;
|
}
|
||||||
|
|
||||||
string value = obj.ToString();
|
public static void Write(object obj, string module, ConsoleColor color, bool useDefaultColor)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(module))
|
string value = obj.ToString();
|
||||||
module = "[" + module + "] ";
|
|
||||||
|
|
||||||
if (useDefaultColor)
|
if (!string.IsNullOrEmpty(module))
|
||||||
|
module = "[" + module + "] ";
|
||||||
|
|
||||||
|
if (useDefaultColor)
|
||||||
|
Console.ResetColor();
|
||||||
|
else
|
||||||
|
Console.ForegroundColor = color;
|
||||||
|
|
||||||
|
value = module + value;
|
||||||
|
|
||||||
|
if (Padding > 0 && value.Length < Padding)
|
||||||
|
value = value.PadRight(Padding);
|
||||||
|
|
||||||
|
Console.WriteLine(value);
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
else
|
Trace.WriteLine(obj);
|
||||||
Console.ForegroundColor = color;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
value = module + value;
|
public class CursorHelp
|
||||||
|
{
|
||||||
|
static bool IsVisible = true;
|
||||||
|
|
||||||
if (Padding > 0 && value.Length < Padding)
|
public static void Show()
|
||||||
value = value.PadRight(Padding);
|
{
|
||||||
|
if (!IsVisible)
|
||||||
|
{
|
||||||
|
Cursor.Show();
|
||||||
|
IsVisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine(value);
|
public static void Hide()
|
||||||
Console.ResetColor();
|
{
|
||||||
Trace.WriteLine(obj);
|
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 5: return "SEARCH"; // BROWSER_SEARCH
|
||||||
|
case 6: return "FAVORITES"; // BROWSER_FAVORITES
|
||||||
|
case 7: return "HOMEPAGE"; // BROWSER_HOME
|
||||||
|
case 15: return "MAIL"; // LAUNCH_MAIL
|
||||||
|
case 33: return "PRINT"; // PRINT
|
||||||
|
case 11: return "NEXT"; // MEDIA_NEXTTRACK
|
||||||
|
case 12: return "PREV"; // MEDIA_PREVIOUSTRACK
|
||||||
|
case 13: return "STOP"; // MEDIA_STOP
|
||||||
|
case 14: return "PLAYPAUSE"; // MEDIA_PLAY_PAUSE
|
||||||
|
case 46: return "PLAY"; // MEDIA_PLAY
|
||||||
|
case 47: return "PAUSE"; // MEDIA_PAUSE
|
||||||
|
case 48: return "RECORD"; // MEDIA_RECORD
|
||||||
|
case 49: return "FORWARD"; // MEDIA_FAST_FORWARD
|
||||||
|
case 50: return "REWIND"; // MEDIA_REWIND
|
||||||
|
case 51: return "CHANNEL_UP"; // MEDIA_CHANNEL_UP
|
||||||
|
case 52: return "CHANNEL_DOWN"; // MEDIA_CHANNEL_DOWN
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@@ -195,36 +193,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 class Folder
|
||||||
{
|
{
|
||||||
public static string Startup { get; } = Application.StartupPath + @"\";
|
public static string Startup { get; } = Application.StartupPath + @"\";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace UI
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
public class Theme
|
public class Theme
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
@@ -35,4 +36,4 @@ namespace mpvnet
|
|||||||
WinAPI.AdjustWindowRect(ref rc, (uint)WinAPI.GetWindowLong(hwnd, -16 /* GWL_STYLE */), false);
|
WinAPI.AdjustWindowRect(ref rc, (uint)WinAPI.GetWindowLong(hwnd, -16 /* GWL_STYLE */), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("5.4.6.0")]
|
[assembly: AssemblyVersion("5.4.8.0")]
|
||||||
[assembly: AssemblyFileVersion("5.4.6.0")]
|
[assembly: AssemblyFileVersion("5.4.8.0")]
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ options = [{ name = "yes" },
|
|||||||
name = "autofit"
|
name = "autofit"
|
||||||
file = "mpv"
|
file = "mpv"
|
||||||
filter = "Screen"
|
filter = "Screen"
|
||||||
help = "<int> Initial window height in percent. Default: 50"
|
help = "<int> Initial window height in percent. Default: 60"
|
||||||
|
|
||||||
[[settings]]
|
[[settings]]
|
||||||
name = "autofit-smaller"
|
name = "autofit-smaller"
|
||||||
@@ -348,7 +348,7 @@ help = "Threshold in milliseconds to wait for libmpv returning the video resolut
|
|||||||
name = "minimum-aspect-ratio"
|
name = "minimum-aspect-ratio"
|
||||||
file = "mpvnet"
|
file = "mpvnet"
|
||||||
filter = "Screen"
|
filter = "Screen"
|
||||||
help = "<float> Minimum aspect ratio for the window. Default: 1.2 (mpv.net specific setting)"
|
help = "<float> Minimum aspect ratio, if the AR is smaller than the defined value then the window AR is set to 16/9. This avoids a square window for Music with cover art. Default: 1.2 (mpv.net specific setting)"
|
||||||
|
|
||||||
[[settings]]
|
[[settings]]
|
||||||
name = "remember-position"
|
name = "remember-position"
|
||||||
|
|||||||
@@ -1,22 +1,31 @@
|
|||||||
|
|
||||||
# This file defines the key and mouse bindings and the context menu
|
# This file defines the key and mouse bindings and the context menu of mpv.net.
|
||||||
# of mpv.net. A input and config editor can be found in mpv.nets
|
|
||||||
# context menu under 'Settings'. The defaults of this file can be found at:
|
# A convenient input and config editor can be found in the context menu of mpv.net
|
||||||
|
# under 'Settings'.
|
||||||
# https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt
|
|
||||||
|
# The mpv.conf defaults of mpv.net contain: 'input-default-bindings = no'
|
||||||
# The defaults of mpv can be found at:
|
# which disables the input defaults of mpv. Every line in this file begins with a
|
||||||
|
|
||||||
# https://github.com/mpv-player/mpv/blob/master/etc/input.conf
|
|
||||||
|
|
||||||
# mpv.net's defaults of mpv.conf contain: 'input-default-bindings = no'
|
|
||||||
# which disables mpv's input defaults. Every line in this file begins with a
|
|
||||||
# space character to make it easier to do a text search, so if you want to know
|
# space character to make it easier to do a text search, so if you want to know
|
||||||
# if 'o' has already a binding you can do a text search on ' o '.
|
# if 'o' has already a binding you can do a text search on ' o '.
|
||||||
|
|
||||||
# mpv input commands: https://mpv.io/manual/master/#list-of-input-commands
|
# input test mode:
|
||||||
|
# mpvnet --input-test
|
||||||
|
|
||||||
# run mpv.net in input test mode with: mpvnet --input-test
|
# input key list:
|
||||||
|
# mpv --input-keylist
|
||||||
|
|
||||||
|
# mpv.net input.conf defaults:
|
||||||
|
# https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt
|
||||||
|
|
||||||
|
# mpv input.conf defaults:
|
||||||
|
# https://github.com/mpv-player/mpv/blob/master/etc/input.conf
|
||||||
|
|
||||||
|
# mpv input commands:
|
||||||
|
# https://mpv.io/manual/master/#list-of-input-commands
|
||||||
|
|
||||||
|
# mpv input options:
|
||||||
|
# https://mpv.io/manual/master/#input
|
||||||
|
|
||||||
o script-message mpv.net open-files #menu: Open > Open Files...
|
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
|
u script-message mpv.net open-url #menu: Open > Open URL or file path from clipboard
|
||||||
@@ -180,9 +189,6 @@
|
|||||||
Stop stop
|
Stop stop
|
||||||
Forward seek 60
|
Forward seek 60
|
||||||
Rewind seek -60
|
Rewind seek -60
|
||||||
Mute cycle mute
|
|
||||||
Volume_Up add volume 10
|
|
||||||
Volume_Down add volume -10
|
|
||||||
Wheel_Up add volume 10
|
Wheel_Up add volume 10
|
||||||
Wheel_Down add volume -10
|
Wheel_Down add volume -10
|
||||||
Wheel_Left add volume -10
|
Wheel_Left add volume -10
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
|
||||||
Title="About mpv.net"
|
Title="About mpv.net"
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}">
|
Background="{x:Static mpvnet:Theme.Background}">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
|
||||||
Title="Command Palette"
|
Title="Command Palette"
|
||||||
@@ -21,15 +21,15 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<TextBox Name="FilterTextBox"
|
<TextBox Name="FilterTextBox"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"
|
Background="{x:Static mpvnet:Theme.Background}"
|
||||||
PreviewKeyDown="FilterTextBox_PreviewKeyDown"
|
PreviewKeyDown="FilterTextBox_PreviewKeyDown"
|
||||||
TextChanged="FilterTextBox_TextChanged"/>
|
TextChanged="FilterTextBox_TextChanged"/>
|
||||||
|
|
||||||
<ListView Name="ListView"
|
<ListView Name="ListView"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"
|
Background="{x:Static mpvnet:Theme.Background}"
|
||||||
MouseUp="ListView_MouseUp">
|
MouseUp="ListView_MouseUp">
|
||||||
|
|
||||||
<ListView.ItemContainerStyle>
|
<ListView.ItemContainerStyle>
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
|
||||||
Title="Config Editor"
|
Title="Config Editor"
|
||||||
Height="530"
|
Height="530"
|
||||||
Width="700"
|
Width="700"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"
|
Background="{x:Static mpvnet:Theme.Background}"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Loaded="ConfWindow1_Loaded">
|
Loaded="ConfWindow1_Loaded">
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
ItemsSource="{Binding FilterStrings}"
|
ItemsSource="{Binding FilterStrings}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
SelectionChanged="FilterListBox_SelectionChanged"
|
SelectionChanged="FilterListBox_SelectionChanged"
|
||||||
Foreground="{x:Static UI:Theme.Heading}"
|
Foreground="{x:Static mpvnet:Theme.Heading}"
|
||||||
Background="{x:Static UI:Theme.Background}">
|
Background="{x:Static mpvnet:Theme.Background}">
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@@ -57,10 +57,10 @@
|
|||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</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="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 UI:Theme.Heading}" MouseUp="PreviewTextBlock_MouseUp">Preview mpv.conf</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 UI:Theme.Heading}" MouseUp="ShowManualTextBlock_MouseUp">Show mpv manual</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 UI:Theme.Heading}" MouseUp="SupportTextBlock_MouseUp">Show support forum</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>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
|
||||||
Title="Media File Search"
|
Title="Media File Search"
|
||||||
@@ -21,14 +21,14 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<TextBox Name="FilterTextBox"
|
<TextBox Name="FilterTextBox"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"
|
Background="{x:Static mpvnet:Theme.Background}"
|
||||||
PreviewKeyDown="FilterTextBox_PreviewKeyDown"
|
PreviewKeyDown="FilterTextBox_PreviewKeyDown"
|
||||||
TextChanged="FilterTextBox_TextChanged"/>
|
TextChanged="FilterTextBox_TextChanged"/>
|
||||||
|
|
||||||
<ListView Name="ListView"
|
<ListView Name="ListView"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"
|
Background="{x:Static mpvnet:Theme.Background}"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
MouseUp="ListView_MouseUp"
|
MouseUp="ListView_MouseUp"
|
||||||
PreviewKeyDown="ListView_PreviewKeyDown">
|
PreviewKeyDown="ListView_PreviewKeyDown">
|
||||||
|
|||||||
@@ -161,4 +161,4 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
|
||||||
Title="Input Editor"
|
Title="Input Editor"
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
Width="750"
|
Width="750"
|
||||||
FontSize="13"
|
FontSize="13"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"
|
Background="{x:Static mpvnet:Theme.Background}"
|
||||||
Loaded="Window_Loaded"
|
Loaded="Window_Loaded"
|
||||||
Closed="Window_Closed">
|
Closed="Window_Closed">
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
|
||||||
Title="Learn Input"
|
Title="Learn Input"
|
||||||
@@ -12,12 +12,11 @@
|
|||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
Loaded="Window_Loaded"
|
Loaded="Window_Loaded"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"
|
Background="{x:Static mpvnet:Theme.Background}"
|
||||||
MouseWheel="Window_MouseWheel"
|
MouseWheel="Window_MouseWheel"
|
||||||
MouseUp="Window_MouseUp"
|
MouseUp="Window_MouseUp"
|
||||||
MouseDoubleClick="Window_MouseDoubleClick"
|
MouseDoubleClick="Window_MouseDoubleClick" PreviewKeyDown="Window_PreviewKeyDown">
|
||||||
TextInput="Window_TextInput">
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Forms;
|
||||||
using WinForms = System.Windows.Forms;
|
|
||||||
using static mpvnet.Core;
|
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
@@ -14,13 +14,68 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
public CommandItem InputItem { get; set; }
|
public CommandItem InputItem { get; set; }
|
||||||
string NewKey = "";
|
string NewKey = "";
|
||||||
string KeyChar = "";
|
|
||||||
|
uint MAPVK_VK_TO_VSC = 0;
|
||||||
|
|
||||||
|
int VK_MENU = 0x12;
|
||||||
|
int VK_LMENU = 0xA4;
|
||||||
|
int VK_RMENU = 0xA5;
|
||||||
|
|
||||||
|
int VK_CONTROL = 0x11;
|
||||||
|
int VK_LCONTROL = 0xA2;
|
||||||
|
int VK_RCONTROL = 0xA3;
|
||||||
|
|
||||||
public LearnWindow() => InitializeComponent();
|
public LearnWindow() => InitializeComponent();
|
||||||
|
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
|
static extern short GetKeyState(int keyCode);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
static extern uint MapVirtualKey(uint uCode, uint uMapType);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
|
||||||
|
static extern int ToUnicode(uint wVirtKey, uint wScanCode, byte[] lpKeyState,
|
||||||
|
StringBuilder pwszBuff, int cchBuff, uint wFlags);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
static extern bool GetKeyboardState(byte[] lpKeyState);
|
||||||
|
|
||||||
|
string ToUnicode(uint vk)
|
||||||
|
{
|
||||||
|
byte[] keys = new byte[256];
|
||||||
|
|
||||||
|
if (!GetKeyboardState(keys))
|
||||||
|
return "";
|
||||||
|
|
||||||
|
if ((keys[VK_CONTROL] & 0x80) != 0 && (keys[VK_MENU] & 0x80) == 0)
|
||||||
|
keys[VK_LCONTROL] = keys[VK_RCONTROL] = keys[VK_CONTROL] = 0;
|
||||||
|
|
||||||
|
uint scanCode = MapVirtualKey(vk, MAPVK_VK_TO_VSC);
|
||||||
|
|
||||||
|
string ret = ToUnicode(vk, scanCode, keys);
|
||||||
|
|
||||||
|
if (ret.Length == 1 && (int)ret[0] < 32)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
if (ret == "" && (keys[VK_MENU] & 0x80) != 0)
|
||||||
|
{
|
||||||
|
keys[VK_LMENU] = keys[VK_RMENU] = keys[VK_MENU] = 0;
|
||||||
|
ret = ToUnicode(vk, scanCode, keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ToUnicode(uint vk, uint scanCode, byte[] keys)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder(10);
|
||||||
|
ToUnicode(vk, scanCode, keys, sb, sb.Capacity, 0);
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||||
{
|
{
|
||||||
WinForms.Message m = new WinForms.Message();
|
Message m = new Message();
|
||||||
m.HWnd = hwnd;
|
m.HWnd = hwnd;
|
||||||
m.Msg = msg;
|
m.Msg = msg;
|
||||||
m.WParam = wParam;
|
m.WParam = wParam;
|
||||||
@@ -29,298 +84,116 @@ namespace mpvnet
|
|||||||
return m.Result;
|
return m.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnKeyUp(WinForms.KeyEventArgs e)
|
void OnKeyDown(uint vk)
|
||||||
{
|
{
|
||||||
if (e.KeyCode == WinForms.Keys.ControlKey || e.KeyCode == WinForms.Keys.ShiftKey ||
|
Keys key = (Keys)vk;
|
||||||
e.KeyCode == WinForms.Keys.Menu || e.KeyCode == WinForms.Keys.None)
|
|
||||||
|
if (key == Keys.ControlKey || key == Keys.ShiftKey ||
|
||||||
|
key == Keys.Menu || key == Keys.None)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string text = "";
|
string text = ToUnicode(vk);
|
||||||
uint charValue = MapVirtualKey((uint)e.KeyCode, 2);
|
|
||||||
|
|
||||||
if (charValue == 0 || (charValue & 1 << 31) == 1 << 31)
|
if ((int)key > 111 && (int)key < 136)
|
||||||
text = e.KeyCode.ToString().Trim();
|
text = "F" + ((int)key - 111);
|
||||||
else
|
|
||||||
try {
|
|
||||||
text = Convert.ToChar(charValue).ToString().ToLower().Trim();
|
|
||||||
} catch {}
|
|
||||||
|
|
||||||
for (int i = 0; i < 13; i++)
|
if ((int)key > 95 && (int)key < 106)
|
||||||
if ("D" + i == text)
|
text = "KP" + ((int)key - 96);
|
||||||
text = text.Substring(1);
|
|
||||||
|
|
||||||
switch (e.KeyCode)
|
switch (text)
|
||||||
{
|
{
|
||||||
case WinForms.Keys.NumPad0:
|
case "#": text = "SHARP"; break;
|
||||||
case WinForms.Keys.NumPad1:
|
case "´´": text = "´"; break;
|
||||||
case WinForms.Keys.NumPad2:
|
case "``": text = "`"; break;
|
||||||
case WinForms.Keys.NumPad3:
|
case "^^": text = "^"; break;
|
||||||
case WinForms.Keys.NumPad4:
|
|
||||||
case WinForms.Keys.NumPad5:
|
|
||||||
case WinForms.Keys.NumPad6:
|
|
||||||
case WinForms.Keys.NumPad7:
|
|
||||||
case WinForms.Keys.NumPad8:
|
|
||||||
case WinForms.Keys.NumPad9:
|
|
||||||
text = "KP" + e.KeyCode.ToString()[6]; break;
|
|
||||||
case WinForms.Keys.Space:
|
|
||||||
text = "Space"; break;
|
|
||||||
case WinForms.Keys.Enter:
|
|
||||||
text = "Enter"; break;
|
|
||||||
case WinForms.Keys.Tab:
|
|
||||||
text = "TAB"; break;
|
|
||||||
case WinForms.Keys.Back:
|
|
||||||
text = "BS"; break;
|
|
||||||
case WinForms.Keys.Delete:
|
|
||||||
text = "DEL"; break;
|
|
||||||
case WinForms.Keys.Insert:
|
|
||||||
text = "INS"; break;
|
|
||||||
case WinForms.Keys.Home:
|
|
||||||
text = "Home"; break;
|
|
||||||
case WinForms.Keys.End:
|
|
||||||
text = "END"; break;
|
|
||||||
case WinForms.Keys.PageUp:
|
|
||||||
text = "PGUP"; break;
|
|
||||||
case WinForms.Keys.PageDown:
|
|
||||||
text = "PGDWN"; break;
|
|
||||||
case WinForms.Keys.Escape:
|
|
||||||
text = "ESC"; break;
|
|
||||||
case WinForms.Keys.PrintScreen:
|
|
||||||
text = "Print"; break;
|
|
||||||
case WinForms.Keys.Play:
|
|
||||||
text = "Play"; break;
|
|
||||||
case WinForms.Keys.Pause:
|
|
||||||
text = "Pause"; break;
|
|
||||||
case WinForms.Keys.MediaPlayPause:
|
|
||||||
text = "PlayPause"; break;
|
|
||||||
case WinForms.Keys.MediaStop:
|
|
||||||
text = "Stop"; break;
|
|
||||||
case WinForms.Keys.MediaNextTrack:
|
|
||||||
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;
|
|
||||||
case WinForms.Keys.VolumeMute:
|
|
||||||
text = "Mute"; break;
|
|
||||||
case WinForms.Keys.BrowserHome:
|
|
||||||
text = "Homepage"; break;
|
|
||||||
case WinForms.Keys.LaunchMail:
|
|
||||||
text = "Mail"; break;
|
|
||||||
case WinForms.Keys.BrowserFavorites:
|
|
||||||
text = "Favorites"; break;
|
|
||||||
case WinForms.Keys.BrowserSearch:
|
|
||||||
text = "Search"; break;
|
|
||||||
case WinForms.Keys.Sleep:
|
|
||||||
text = "Sleep"; break;
|
|
||||||
case WinForms.Keys.Cancel:
|
|
||||||
text = "Cancel"; break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wasModified = false;
|
switch (key)
|
||||||
|
|
||||||
bool isAlt = GetKeyState(18) < (short)0;
|
|
||||||
bool isShift = GetKeyState(16) < (short)0;
|
|
||||||
bool isCtrl = GetKeyState(17) < (short)0;
|
|
||||||
|
|
||||||
if (text.Length == 1 && KeyChar != text)
|
|
||||||
{
|
{
|
||||||
text = KeyChar;
|
case Keys.Left: text = "LEFT"; break;
|
||||||
wasModified = true;
|
case Keys.Up: text = "UP"; break;
|
||||||
|
case Keys.Right: text = "RIGHT"; break;
|
||||||
|
case Keys.Down: text = "DOWN"; break;
|
||||||
|
case Keys.Space: text = "SPACE"; break;
|
||||||
|
case Keys.Enter: text = "ENTER"; break;
|
||||||
|
case Keys.Tab: text = "TAB"; break;
|
||||||
|
case Keys.Back: text = "BS"; break;
|
||||||
|
case Keys.Delete: text = "DEL"; break;
|
||||||
|
case Keys.Insert: text = "INS"; break;
|
||||||
|
case Keys.Home: text = "HOME"; break;
|
||||||
|
case Keys.End: text = "END"; break;
|
||||||
|
case Keys.PageUp: text = "PGUP"; break;
|
||||||
|
case Keys.PageDown: text = "PGDWN"; break;
|
||||||
|
case Keys.Escape: text = "ESC"; break;
|
||||||
|
case Keys.Sleep: text = "SLEEP"; break;
|
||||||
|
case Keys.Cancel: text = "CANCEL"; break;
|
||||||
|
case Keys.PrintScreen: text = "PRINT"; break;
|
||||||
|
case Keys.BrowserFavorites: text = "FAVORITES"; break;
|
||||||
|
case Keys.BrowserSearch: text = "SEARCH"; break;
|
||||||
|
case Keys.BrowserHome: text = "HOMEPAGE"; break;
|
||||||
|
case Keys.LaunchMail: text = "MAIL"; break;
|
||||||
|
case Keys.Play: text = "PLAY"; break;
|
||||||
|
case Keys.Pause: text = "PAUSE"; break;
|
||||||
|
case Keys.MediaPlayPause: text = "PLAYPAUSE"; break;
|
||||||
|
case Keys.MediaStop: text = "STOP"; break;
|
||||||
|
case Keys.MediaNextTrack: text = "NEXT"; break;
|
||||||
|
case Keys.MediaPreviousTrack: text = "PREV"; break;
|
||||||
|
|
||||||
|
case Keys.VolumeUp:
|
||||||
|
case Keys.VolumeDown:
|
||||||
|
case Keys.VolumeMute:
|
||||||
|
text = ""; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text == "#") text = "SHARP";
|
bool isAlt = GetKeyState(18) < 0;
|
||||||
|
bool isShift = GetKeyState(16) < 0;
|
||||||
|
bool isCtrl = GetKeyState(17) < 0;
|
||||||
|
|
||||||
if (isAlt && !wasModified)
|
bool isLetter = (int)key > 64 && (int)key < 91;
|
||||||
|
|
||||||
|
if (isLetter && isShift)
|
||||||
|
text = text.ToUpper();
|
||||||
|
|
||||||
|
string keyString = ToUnicode(vk);
|
||||||
|
|
||||||
|
if (isAlt && !isCtrl)
|
||||||
text = "ALT+" + text;
|
text = "ALT+" + text;
|
||||||
|
|
||||||
if (isShift && !wasModified)
|
if (isShift && keyString == "")
|
||||||
text = "SHIFT+" + text;
|
text = "SHIFT+" + text;
|
||||||
|
|
||||||
if (isCtrl && !wasModified)
|
if (isCtrl && !(keyString != "" && isCtrl && isAlt))
|
||||||
text = "CTRL+" + text;
|
text = "CTRL+" + text;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(text))
|
if (!string.IsNullOrEmpty(text))
|
||||||
SetKey(text);
|
SetKey(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime LastKeyUp;
|
|
||||||
|
|
||||||
void SetKey(string key)
|
void SetKey(string key)
|
||||||
{
|
{
|
||||||
NewKey = key;
|
NewKey = key;
|
||||||
MenuTextBlock.Text = InputItem.Path;
|
MenuTextBlock.Text = InputItem.Path;
|
||||||
KeyTextBlock.Text = key;
|
KeyTextBlock.Text = key;
|
||||||
LastKeyUp = DateTime.Now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
void ProcessKeyEventArgs(ref Message m)
|
||||||
static extern uint MapVirtualKey(uint uCode, uint uMapType);
|
|
||||||
|
|
||||||
public static WinForms.Keys ModifierKeys {
|
|
||||||
get {
|
|
||||||
WinForms.Keys keys = WinForms.Keys.None;
|
|
||||||
|
|
||||||
if (GetKeyState(17) < (short)0)
|
|
||||||
keys |= WinForms.Keys.Control;
|
|
||||||
|
|
||||||
if (GetKeyState(16) < (short)0)
|
|
||||||
keys |= WinForms.Keys.Shift;
|
|
||||||
|
|
||||||
if (GetKeyState(18) < (short)0)
|
|
||||||
keys |= WinForms.Keys.Alt;
|
|
||||||
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessKeyEventArgs(ref WinForms.Message m)
|
|
||||||
{
|
{
|
||||||
int WM_KEYUP = 0x0101, WM_SYSKEYUP = 0x0105, WM_APPCOMMAND = 0x0319;
|
int WM_KEYDOWN = 0x100;
|
||||||
|
int WM_SYSKEYDOWN = 0x104;
|
||||||
|
int WM_APPCOMMAND = 0x319;
|
||||||
|
|
||||||
if (m.Msg == WM_KEYUP || m.Msg == WM_SYSKEYUP)
|
if (m.Msg == WM_KEYDOWN || m.Msg == WM_SYSKEYDOWN)
|
||||||
OnKeyUp(new WinForms.KeyEventArgs((WinForms.Keys)(unchecked((int)(long)m.WParam)) | ModifierKeys));
|
OnKeyDown((uint)m.WParam.ToInt64());
|
||||||
else if (m.Msg == WM_APPCOMMAND)
|
else if (m.Msg == WM_APPCOMMAND)
|
||||||
{
|
{
|
||||||
if (!core.get_property_bool("input-media-keys"))
|
string value = mpvHelp.WM_APPCOMMAND_to_mpv_key((int)(m.LParam.ToInt64() >> 16 & ~0xf000));
|
||||||
return;
|
|
||||||
|
|
||||||
var value = (AppCommand)(m.LParam.ToInt64() >> 16 & ~0xf000);
|
if (value != null)
|
||||||
|
SetKey(value);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
||||||
@@ -381,9 +254,13 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_TextInput(object sender, TextCompositionEventArgs e)
|
void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||||
{
|
{
|
||||||
KeyChar = e.Text;
|
if (e.Key == Key.Tab)
|
||||||
|
{
|
||||||
|
OnKeyDown((uint)Keys.Tab);
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:UI="clr-namespace:UI">
|
xmlns:mpvnet="clr-namespace:mpvnet">
|
||||||
|
|
||||||
<Style TargetType="TextBox">
|
<Style TargetType="TextBox">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
|
<Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsFocused" Value="true">
|
<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>
|
</Trigger>
|
||||||
</ControlTemplate.Triggers>
|
</ControlTemplate.Triggers>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
@@ -49,8 +49,8 @@
|
|||||||
x:Name="normal"
|
x:Name="normal"
|
||||||
Width="18"
|
Width="18"
|
||||||
Height="18"
|
Height="18"
|
||||||
Fill="{x:Static UI:Theme.Background}"
|
Fill="{x:Static mpvnet:Theme.Background}"
|
||||||
Stroke="{x:Static UI:Theme.Heading}"
|
Stroke="{x:Static mpvnet:Theme.Heading}"
|
||||||
StrokeThickness="2" />
|
StrokeThickness="2" />
|
||||||
<Ellipse
|
<Ellipse
|
||||||
x:Name="Checked1"
|
x:Name="Checked1"
|
||||||
|
|||||||
@@ -3,20 +3,20 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800">
|
d:DesignWidth="800">
|
||||||
|
|
||||||
<Grid Name="SearchTextBoxUserControl1"
|
<Grid Name="SearchTextBoxUserControl1"
|
||||||
Background="{x:Static UI:Theme.Background}">
|
Background="{x:Static mpvnet:Theme.Background}">
|
||||||
|
|
||||||
<TextBlock Name="HintTextBlock"
|
<TextBlock Name="HintTextBlock"
|
||||||
Margin="5,2"
|
Margin="5,2"
|
||||||
Text="Find a setting"
|
Text="Find a setting"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Foreground="{x:Static UI:Theme.Foreground2}"
|
Foreground="{x:Static mpvnet:Theme.Foreground2}"
|
||||||
Background="{x:Static UI:Theme.Background}" />
|
Background="{x:Static mpvnet:Theme.Background}" />
|
||||||
|
|
||||||
<TextBox Name="SearchTextBox"
|
<TextBox Name="SearchTextBox"
|
||||||
Height="25"
|
Height="25"
|
||||||
@@ -24,8 +24,8 @@
|
|||||||
BorderThickness="2"
|
BorderThickness="2"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
TextChanged="SearchTextBox_TextChanged"
|
TextChanged="SearchTextBox_TextChanged"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
CaretBrush="{x:Static UI:Theme.Foreground}" />
|
CaretBrush="{x:Static mpvnet:Theme.Foreground}" />
|
||||||
|
|
||||||
<Button Name="SearchClearButton"
|
<Button Name="SearchClearButton"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
@@ -40,8 +40,8 @@
|
|||||||
|
|
||||||
<Button.Style>
|
<Button.Style>
|
||||||
<Style TargetType="Button">
|
<Style TargetType="Button">
|
||||||
<Setter Property="Background" Value="{x:Static UI:Theme.Background}"/>
|
<Setter Property="Background" Value="{x:Static mpvnet:Theme.Background}"/>
|
||||||
<Setter Property="Foreground" Value="{x:Static UI:Theme.Foreground2}"/>
|
<Setter Property="Foreground" Value="{x:Static mpvnet:Theme.Foreground2}"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Setter Property="Foreground" Value="{x:Static UI:Theme.Heading}"/>
|
<Setter Property="Foreground" Value="{x:Static mpvnet:Theme.Heading}"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:UI="clr-namespace:UI"
|
xmlns:mpvnet="clr-namespace:mpvnet"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
|
||||||
Title="mpv.net Setup"
|
Title="mpv.net Setup"
|
||||||
FontSize="13"
|
FontSize="13"
|
||||||
Foreground="{x:Static UI:Theme.Foreground}"
|
Foreground="{x:Static mpvnet:Theme.Foreground}"
|
||||||
Background="{x:Static UI:Theme.Background}"
|
Background="{x:Static mpvnet:Theme.Background}"
|
||||||
SizeToContent="WidthAndHeight"
|
SizeToContent="WidthAndHeight"
|
||||||
WindowStartupLocation="CenterOwner" >
|
WindowStartupLocation="CenterOwner" >
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ using System.Globalization;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using UI;
|
|
||||||
using static mpvnet.Core;
|
using static mpvnet.Core;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
@@ -24,6 +23,7 @@ namespace mpvnet
|
|||||||
Point LastCursorPosition;
|
Point LastCursorPosition;
|
||||||
int LastCursorChanged;
|
int LastCursorChanged;
|
||||||
int LastCycleFullscreen;
|
int LastCycleFullscreen;
|
||||||
|
int LastAppCommand;
|
||||||
int TaskbarButtonCreatedMessage;
|
int TaskbarButtonCreatedMessage;
|
||||||
int ShownTickCount;
|
int ShownTickCount;
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ namespace mpvnet
|
|||||||
if (core.VideoSize.Height == 0 || core.VideoSize.Width == 0 ||
|
if (core.VideoSize.Height == 0 || core.VideoSize.Width == 0 ||
|
||||||
core.VideoSize.Width / (float)core.VideoSize.Height < App.MinimumAspectRatio)
|
core.VideoSize.Width / (float)core.VideoSize.Height < App.MinimumAspectRatio)
|
||||||
|
|
||||||
core.VideoSize = new Size((int)(autoFitHeight * (16 / 9.0)), autoFitHeight);
|
core.VideoSize = new Size((int)(autoFitHeight * (16 / 9f)), autoFitHeight);
|
||||||
|
|
||||||
Size videoSize = core.VideoSize;
|
Size videoSize = core.VideoSize;
|
||||||
int height = videoSize.Height;
|
int height = videoSize.Height;
|
||||||
@@ -321,26 +321,26 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
|
|
||||||
height = Convert.ToInt32(height * scale);
|
height = Convert.ToInt32(height * scale);
|
||||||
int width = Convert.ToInt32(height * videoSize.Width / (double)videoSize.Height);
|
int width = height * videoSize.Width / videoSize.Height;
|
||||||
int maxHeight = screen.WorkingArea.Height - (Height - ClientSize.Height);
|
int maxHeight = screen.WorkingArea.Height - (Height - ClientSize.Height);
|
||||||
int maxWidth = screen.WorkingArea.Width - (Width - ClientSize.Width);
|
int maxWidth = screen.WorkingArea.Width - (Width - ClientSize.Width);
|
||||||
|
|
||||||
if (height < maxHeight * core.AutofitSmaller)
|
if (height < maxHeight * core.AutofitSmaller)
|
||||||
{
|
{
|
||||||
height = Convert.ToInt32(maxHeight * core.AutofitSmaller);
|
height = Convert.ToInt32(maxHeight * core.AutofitSmaller);
|
||||||
width = Convert.ToInt32(height * videoSize.Width / (double)videoSize.Height);
|
width = Convert.ToInt32(height * videoSize.Width / videoSize.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height > maxHeight * core.AutofitLarger)
|
if (height > maxHeight * core.AutofitLarger)
|
||||||
{
|
{
|
||||||
height = Convert.ToInt32(maxHeight * core.AutofitLarger);
|
height = Convert.ToInt32(maxHeight * core.AutofitLarger);
|
||||||
width = Convert.ToInt32(height * videoSize.Width / (double)videoSize.Height);
|
width = Convert.ToInt32(height * videoSize.Width / videoSize.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width > maxWidth)
|
if (width > maxWidth)
|
||||||
{
|
{
|
||||||
width = maxWidth;
|
width = maxWidth;
|
||||||
height = Convert.ToInt32(width * videoSize.Height / (double)videoSize.Width);
|
height = (int)Math.Ceiling(width * videoSize.Height / (double)videoSize.Width);
|
||||||
}
|
}
|
||||||
|
|
||||||
Point middlePos = new Point(Left + Width / 2, Top + Height / 2);
|
Point middlePos = new Point(Left + Width / 2, Top + Height / 2);
|
||||||
@@ -517,9 +517,26 @@ namespace mpvnet
|
|||||||
case 0x101: // WM_KEYUP
|
case 0x101: // WM_KEYUP
|
||||||
case 0x104: // WM_SYSKEYDOWN
|
case 0x104: // WM_SYSKEYDOWN
|
||||||
case 0x105: // WM_SYSKEYUP
|
case 0x105: // WM_SYSKEYUP
|
||||||
|
{
|
||||||
|
bool skip = m.Msg == 0x100 && LastAppCommand != 0 &&
|
||||||
|
(Environment.TickCount - LastAppCommand) < 1000;
|
||||||
|
|
||||||
|
if (core.WindowHandle != IntPtr.Zero && !skip)
|
||||||
|
m.Result = WinAPI.SendMessage(core.WindowHandle, m.Msg, m.WParam, m.LParam);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 0x319: // WM_APPCOMMAND
|
case 0x319: // WM_APPCOMMAND
|
||||||
if (core.WindowHandle != IntPtr.Zero)
|
{
|
||||||
m.Result = WinAPI.SendMessage(core.WindowHandle, m.Msg, m.WParam, m.LParam);
|
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;
|
break;
|
||||||
case 0x0200: // WM_MOUSEMOVE
|
case 0x0200: // WM_MOUSEMOVE
|
||||||
if (Environment.TickCount - LastCycleFullscreen > 500)
|
if (Environment.TickCount - LastCycleFullscreen > 500)
|
||||||
@@ -562,8 +579,18 @@ namespace mpvnet
|
|||||||
s = new Size(16, 9);
|
s = new Size(16, 9);
|
||||||
|
|
||||||
float aspect = s.Width / (float)s.Height;
|
float aspect = s.Width / (float)s.Height;
|
||||||
int d_w = Convert.ToInt32(c_h * aspect - c_w);
|
int d_w = (int)(c_h * aspect - c_w);
|
||||||
int d_h = Convert.ToInt32(c_w / aspect - c_h);
|
int d_h = (int)(c_w / aspect - c_h);
|
||||||
|
|
||||||
|
Debug.WriteLine(d_w);
|
||||||
|
Debug.WriteLine(d_h);
|
||||||
|
|
||||||
|
int d_w2 = (int)(c_h * aspect - c_w);
|
||||||
|
int d_h2 = (int)(c_w / aspect - c_h);
|
||||||
|
|
||||||
|
Debug.WriteLine(d_w2);
|
||||||
|
Debug.WriteLine(d_h2);
|
||||||
|
|
||||||
int[] d_corners = { d_w, d_h, -d_w, -d_h };
|
int[] d_corners = { d_w, d_h, -d_w, -d_h };
|
||||||
int[] corners = { rc.Left, rc.Top, rc.Right, rc.Bottom };
|
int[] corners = { rc.Left, rc.Top, rc.Right, rc.Bottom };
|
||||||
int corner = NativeHelp.GetResizeBorder(m.WParam.ToInt32());
|
int corner = NativeHelp.GetResizeBorder(m.WParam.ToInt32());
|
||||||
@@ -604,7 +631,9 @@ namespace mpvnet
|
|||||||
ProgressTimer.Start();
|
ProgressTimer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
base.WndProc(ref m);
|
// beep sound when closed using taskbar due to exception
|
||||||
|
if (!IsDisposed)
|
||||||
|
base.WndProc(ref m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CursorTimer_Tick(object sender, EventArgs e)
|
void CursorTimer_Tick(object sender, EventArgs e)
|
||||||
@@ -792,11 +821,6 @@ namespace mpvnet
|
|||||||
|
|
||||||
if (!core.ShutdownAutoResetEvent.WaitOne(10000))
|
if (!core.ShutdownAutoResetEvent.WaitOne(10000))
|
||||||
Msg.ShowError("Shutdown thread failed to complete within 10 seconds.");
|
Msg.ShowError("Shutdown thread failed to complete within 10 seconds.");
|
||||||
|
|
||||||
try { // PowerShell 5.1 might not be available
|
|
||||||
foreach (PowerShell ps in PowerShell.Instances)
|
|
||||||
ps.Runspace.Dispose();
|
|
||||||
} catch {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseDown(MouseEventArgs e)
|
protected override void OnMouseDown(MouseEventArgs e)
|
||||||
@@ -842,8 +866,9 @@ namespace mpvnet
|
|||||||
|
|
||||||
protected override void OnKeyDown(KeyEventArgs e)
|
protected override void OnKeyDown(KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
// prevent beep using alt key
|
||||||
if (Control.ModifierKeys == Keys.Alt)
|
if (Control.ModifierKeys == Keys.Alt)
|
||||||
e.SuppressKeyPress = true; // prevent beep using alt key
|
e.SuppressKeyPress = true;
|
||||||
|
|
||||||
base.OnKeyDown(e);
|
base.OnKeyDown(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,7 @@
|
|||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Misc\Misc.cs" />
|
<Compile Include="Misc\Misc.cs" />
|
||||||
<Compile Include="mpv\Core.cs" />
|
<Compile Include="mpv\core.cs" />
|
||||||
<Compile Include="Misc\Commands.cs" />
|
<Compile Include="Misc\Commands.cs" />
|
||||||
<Compile Include="Native\Native.cs" />
|
<Compile Include="Native\Native.cs" />
|
||||||
<Compile Include="Native\NativeHelp.cs" />
|
<Compile Include="Native\NativeHelp.cs" />
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace mpvnet
|
|||||||
if (Handle == IntPtr.Zero)
|
if (Handle == IntPtr.Zero)
|
||||||
throw new Exception("error mpv_create");
|
throw new Exception("error mpv_create");
|
||||||
|
|
||||||
mpv_request_log_messages(Handle, "info");
|
mpv_request_log_messages(Handle, "terminal-default");
|
||||||
|
|
||||||
Task.Run(() => EventLoop());
|
Task.Run(() => EventLoop());
|
||||||
|
|
||||||
@@ -130,7 +130,6 @@ namespace mpvnet
|
|||||||
|
|
||||||
set_property_string("wid", MainForm.Hwnd.ToString());
|
set_property_string("wid", MainForm.Hwnd.ToString());
|
||||||
set_property_string("osc", "yes");
|
set_property_string("osc", "yes");
|
||||||
set_property_string("input-media-keys", "yes");
|
|
||||||
set_property_string("force-window", "yes");
|
set_property_string("force-window", "yes");
|
||||||
set_property_string("config-dir", ConfigFolder);
|
set_property_string("config-dir", ConfigFolder);
|
||||||
set_property_string("config", "yes");
|
set_property_string("config", "yes");
|
||||||
@@ -149,9 +148,11 @@ namespace mpvnet
|
|||||||
|
|
||||||
public void ProcessProperty(string name, string value)
|
public void ProcessProperty(string name, string value)
|
||||||
{
|
{
|
||||||
if (name.Any(char.IsUpper))
|
foreach (char i in name)
|
||||||
Msg.ShowError("Uppercase char detected: " + name,
|
if (char.IsUpper(i))
|
||||||
"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)
|
switch (name)
|
||||||
{
|
{
|
||||||
@@ -169,7 +170,7 @@ namespace mpvnet
|
|||||||
break;
|
break;
|
||||||
case "fs":
|
case "fs":
|
||||||
case "fullscreen": Fullscreen = value == "yes"; break;
|
case "fullscreen": Fullscreen = value == "yes"; break;
|
||||||
case "border": Border = value == "yes"; break;
|
case "border": Border = value == "yes"; break;
|
||||||
case "window-maximized": WindowMaximized = value == "yes"; break;
|
case "window-maximized": WindowMaximized = value == "yes"; break;
|
||||||
case "window-minimized": WindowMinimized = value == "yes"; break;
|
case "window-minimized": WindowMinimized = value == "yes"; break;
|
||||||
case "taskbar-progress": TaskbarProgress = value == "yes"; break;
|
case "taskbar-progress": TaskbarProgress = value == "yes"; break;
|
||||||
@@ -396,10 +397,13 @@ namespace mpvnet
|
|||||||
case mpv_event_id.MPV_EVENT_LOG_MESSAGE:
|
case mpv_event_id.MPV_EVENT_LOG_MESSAGE:
|
||||||
{
|
{
|
||||||
var data = (mpv_event_log_message)Marshal.PtrToStructure(evt.data, typeof(mpv_event_log_message));
|
var data = (mpv_event_log_message)Marshal.PtrToStructure(evt.data, typeof(mpv_event_log_message));
|
||||||
mpv_log_level level = data.log_level;
|
|
||||||
string msg = $"[{ConvertFromUtf8(data.prefix)}] {ConvertFromUtf8(data.text)}";
|
if (LogMessage != null || LogMessageAsync != null)
|
||||||
InvokeAsync<mpv_log_level, string>(LogMessageAsync, level, msg);
|
{
|
||||||
LogMessage?.Invoke(level, msg);
|
string msg = $"[{ConvertFromUtf8(data.prefix)}] {ConvertFromUtf8(data.text)}";
|
||||||
|
InvokeAsync<mpv_log_level, string>(LogMessageAsync, data.log_level, msg);
|
||||||
|
LogMessage?.Invoke(data.log_level, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_CLIENT_MESSAGE:
|
case mpv_event_id.MPV_EVENT_CLIENT_MESSAGE:
|
||||||
@@ -966,6 +970,7 @@ namespace mpvnet
|
|||||||
for (int i = 0; i < files.Length; i++)
|
for (int i = 0; i < files.Length; i++)
|
||||||
{
|
{
|
||||||
string file = files[i];
|
string file = files[i];
|
||||||
|
LoadLibrary(file.ShortExt());
|
||||||
|
|
||||||
if (App.SubtitleTypes.Contains(file.ShortExt()))
|
if (App.SubtitleTypes.Contains(file.ShortExt()))
|
||||||
commandv("sub-add", file);
|
commandv("sub-add", file);
|
||||||
@@ -1012,6 +1017,17 @@ namespace mpvnet
|
|||||||
commandv("playlist-move", "0", (index + 1).ToString());
|
commandv("playlist-move", "0", (index + 1).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wasAviSynthLoaded;
|
||||||
|
|
||||||
|
void LoadLibrary(string ext)
|
||||||
|
{
|
||||||
|
if (!wasAviSynthLoaded && ext == "avs")
|
||||||
|
{
|
||||||
|
WinAPI.LoadLibrary("AviSynth.dll");
|
||||||
|
wasAviSynthLoaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string LastHistoryPath;
|
string LastHistoryPath;
|
||||||
DateTime LastHistoryStartDateTime;
|
DateTime LastHistoryStartDateTime;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
|
|
||||||
Set-Variable wasPaused $false -Option AllScope
|
|
||||||
|
|
||||||
$code = {
|
$code = {
|
||||||
$isMinimized = $args[0]
|
$isMinimized = $args[0]
|
||||||
$isPaused = $mp.get_property_bool('pause')
|
$isPaused = $mp.get_property_bool('pause')
|
||||||
@@ -10,17 +8,17 @@ $code = {
|
|||||||
if (-not $isPaused)
|
if (-not $isPaused)
|
||||||
{
|
{
|
||||||
$mp.set_property_bool('pause', $true)
|
$mp.set_property_bool('pause', $true)
|
||||||
$wasPaused = $true
|
$script:wasPaused = $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($wasPaused -and $isPaused)
|
if ($script:wasPaused -and $isPaused)
|
||||||
{
|
{
|
||||||
$mp.set_property_bool('pause', $false)
|
$mp.set_property_bool('pause', $false)
|
||||||
}
|
}
|
||||||
|
|
||||||
$wasPaused = $false
|
$script:wasPaused = $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
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