This commit is contained in:
Frank Skare
2019-04-25 10:13:48 +02:00
parent 4bbf84532e
commit 757502e8bf
8 changed files with 58 additions and 45 deletions

View File

@@ -36,6 +36,8 @@ Table of contents
- [Context Menu](#context-menu) - [Context Menu](#context-menu)
- [Settings](#settings) - [Settings](#settings)
- [Scripting](#scripting) - [Scripting](#scripting)
- [Add-ons](#add-ons)
- [Architecture](#architecture)
- [Support](#support) - [Support](#support)
- [Links](#links) - [Links](#links)
- [Download](#download) - [Download](#download)
@@ -111,6 +113,18 @@ Examples:
[CSScriptAddon.vb](https://github.com/stax76/mpv.net/blob/master/CSScriptAddon/CSScriptAddon.vb) [CSScriptAddon.vb](https://github.com/stax76/mpv.net/blob/master/CSScriptAddon/CSScriptAddon.vb)
### Architecture
mpv.net is mostly written in C# 7.0 and runs on the .NET framework 4.7 or higher.
Few parts are written in VB.NET and Python.
The Add-on implementation is based on the Managed Extensibility Framework,
the entire application code is accessible for add-ons and Python scripts.
Python scripting is implemented with IronPython which uses Python 2.7.
The main/video window is WinForms based, other windows are WPF based.
### Support ### Support
[Support thread in Doom9 forum](https://forum.doom9.org/showthread.php?t=174841) [Support thread in Doom9 forum](https://forum.doom9.org/showthread.php?t=174841)
@@ -163,6 +177,7 @@ mpv.net bugs and requests: <https://github.com/stax76/mpv.net/issues>
script descriptions were improved. [Scripting Page](https://github.com/stax76/mpv.net/wiki/Scripting). script descriptions were improved. [Scripting Page](https://github.com/stax76/mpv.net/wiki/Scripting).
- greatly improved README.md file and github startpage - greatly improved README.md file and github startpage
- About dialog added - About dialog added
- the input editor shows only a closing message if actually a change was made
### 3.1 (2019-04-23) ### 3.1 (2019-04-23)

View File

@@ -3,6 +3,7 @@ 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;
@@ -229,4 +230,34 @@ 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;
}
}
} }

View File

@@ -1,8 +1,6 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
namespace mpvnet namespace mpvnet
{ {

View File

@@ -1,7 +1,7 @@
# mpv manual: https://mpv.io/manual/master/ # mpv manual: https://mpv.io/manual/master/
# mpv.net mpv.conf defaults: https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt # mpv.net mpv.conf defaults: https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpvConf.txt
input-ar-delay = 500 input-ar-delay = 500
input-ar-rate = 20 input-ar-rate = 20
@@ -11,4 +11,4 @@ keep-open = yes
keep-open-pause = no keep-open-pause = no
osd-playing-msg = ${filename} osd-playing-msg = ${filename}
screenshot-directory = ~~desktop/ screenshot-directory = ~~desktop/
input-default-bindings = no input-default-bindings = no

View File

@@ -1,36 +0,0 @@
using System;
using System.Drawing;
using System.Windows.Forms;
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;
}
}
}

View File

@@ -164,7 +164,7 @@ namespace mpvnet
WriteToDisk(mp.MpvConfPath, MpvConf, MpvSettingsDefinitions); WriteToDisk(mp.MpvConfPath, MpvConf, MpvSettingsDefinitions);
WriteToDisk(mp.MpvNetConfPath, MpvNetConf, MpvNetSettingsDefinitions); WriteToDisk(mp.MpvNetConfPath, MpvNetConf, MpvNetSettingsDefinitions);
MessageBox.Show("Changes will be available on next startup of mpv.net.", MessageBox.Show("Changes will be available on next mpv.net startup.",
Title, MessageBoxButton.OK, MessageBoxImage.Information); Title, MessageBoxButton.OK, MessageBoxImage.Information);
} }

View File

@@ -12,10 +12,12 @@ namespace mpvnet
public partial class InputWindow : Window public partial class InputWindow : Window
{ {
ICollectionView CollectionView; ICollectionView CollectionView;
string InitialInputConfContent;
public InputWindow() public InputWindow()
{ {
InitializeComponent(); InitializeComponent();
InitialInputConfContent = GetInputConfContent();
SearchControl.SearchTextBox.TextChanged += SearchTextBox_TextChanged; SearchControl.SearchTextBox.TextChanged += SearchTextBox_TextChanged;
DataGrid.SelectionMode = DataGridSelectionMode.Single; DataGrid.SelectionMode = DataGridSelectionMode.Single;
CollectionViewSource collectionViewSource = new CollectionViewSource() { Source = InputItem.InputItems }; CollectionViewSource collectionViewSource = new CollectionViewSource() { Source = InputItem.InputItems };
@@ -81,7 +83,7 @@ namespace mpvnet
private void Window_Loaded(object sender, RoutedEventArgs e) => Keyboard.Focus(SearchControl.SearchTextBox); private void Window_Loaded(object sender, RoutedEventArgs e) => Keyboard.Focus(SearchControl.SearchTextBox);
private void Window_Closed(object sender, EventArgs e) string GetInputConfContent()
{ {
string text = Properties.Resources.inputConfHeader + "\r\n"; string text = Properties.Resources.inputConfHeader + "\r\n";
@@ -99,9 +101,13 @@ namespace mpvnet
text += line + "\r\n"; text += line + "\r\n";
} }
return text;
}
File.WriteAllText(mp.InputConfPath, text); private void Window_Closed(object sender, EventArgs e)
{
if (InitialInputConfContent == GetInputConfContent()) return;
File.WriteAllText(mp.InputConfPath, GetInputConfContent());
MessageBox.Show("Changes will be available on next mpv.net startup.", MessageBox.Show("Changes will be available on next mpv.net startup.",
Title, MessageBoxButton.OK, MessageBoxImage.Information); Title, MessageBoxButton.OK, MessageBoxImage.Information);
} }

View File

@@ -198,7 +198,6 @@
<DependentUpon>InputWindow.xaml</DependentUpon> <DependentUpon>InputWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="trash.cs" /> <Compile Include="trash.cs" />
<Compile Include="UI.cs" />
<Compile Include="WPF\WPF.cs" /> <Compile Include="WPF\WPF.cs" />
<EmbeddedResource Include="MainForm.resx"> <EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>