-
25
README.md
@@ -55,13 +55,25 @@ Table of contents
|
|||||||
|
|
||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||

|
#### Main Window
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|
#### Context Menu
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
#### Config Editor
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### Input Editor
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### Command Palette
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Context Menu
|
### Context Menu
|
||||||
|
|
||||||
@@ -183,12 +195,15 @@ mpv.net bugs and requests: <https://github.com/stax76/mpv.net/issues>
|
|||||||
the config folder should be created (portable or appdata)
|
the config folder should be created (portable or appdata)
|
||||||
- there was an issue causing keys not working after a modal window was shown
|
- there was an issue causing keys not working after a modal window was shown
|
||||||
- there was a crash when no script folder existed in the conf folder
|
- there was a crash when no script folder existed in the conf folder
|
||||||
- MediaInfo, youtube-dl and libmpv were updated
|
- MediaInfo and youtube-dl were updated
|
||||||
- a new JavaScript example script was added to the wiki and the
|
- a new JavaScript example script was added to the wiki and the
|
||||||
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
|
- the input editor shows only a closing message if actually a change was made
|
||||||
|
- the input editor don't show menu separators any longer
|
||||||
|
- new Command Palette feature added
|
||||||
|
- the history feature had a bug causing files to be logged more than once
|
||||||
|
|
||||||
### 3.1 (2019-04-23)
|
### 3.1 (2019-04-23)
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,15 @@ namespace mpvnet
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void show_command_palette(string[] args)
|
||||||
|
{
|
||||||
|
MainForm.Instance.Invoke(new Action(() => {
|
||||||
|
var w = new CommandPaletteWindow();
|
||||||
|
new WindowInteropHelper(w).Owner = MainForm.Instance.Handle;
|
||||||
|
w.ShowDialog();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
public static void show_history(string[] args)
|
public static void show_history(string[] args)
|
||||||
{
|
{
|
||||||
var fp = mp.MpvConfFolder + "history.txt";
|
var fp = mp.MpvConfFolder + "history.txt";
|
||||||
|
|||||||
@@ -305,13 +305,13 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string i in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
if (!i.Contains("#menu:")) continue;
|
if (!line.Contains("#menu:")) continue;
|
||||||
string left = i.Substring(0, i.IndexOf("#menu:")).Trim();
|
string left = line.Substring(0, line.IndexOf("#menu:")).Trim();
|
||||||
if (left.StartsWith("#")) continue;
|
if (left.StartsWith("#")) continue;
|
||||||
string command = left.Substring(left.IndexOf(" ") + 1).Trim();
|
string command = left.Substring(left.IndexOf(" ") + 1).Trim();
|
||||||
string menu = i.Substring(i.IndexOf("#menu:") + "#menu:".Length).Trim();
|
string menu = line.Substring(line.IndexOf("#menu:") + "#menu:".Length).Trim();
|
||||||
string input = left.Substring(0, left.IndexOf(" "));
|
string input = left.Substring(0, left.IndexOf(" "));
|
||||||
if (input == "_") input = "";
|
if (input == "_") input = "";
|
||||||
if (menu.Contains(";")) input = menu.Substring(0, menu.IndexOf(";")).Trim();
|
if (menu.Contains(";")) input = menu.Substring(0, menu.IndexOf(";")).Trim();
|
||||||
@@ -393,6 +393,8 @@ namespace mpvnet
|
|||||||
|
|
||||||
protected override void WndProc(ref Message m)
|
protected override void WndProc(ref Message m)
|
||||||
{
|
{
|
||||||
|
//Debug.WriteLine(m);
|
||||||
|
|
||||||
switch (m.Msg)
|
switch (m.Msg)
|
||||||
{
|
{
|
||||||
case 0x0201: // WM_LBUTTONDOWN
|
case 0x0201: // WM_LBUTTONDOWN
|
||||||
|
|||||||
@@ -163,15 +163,16 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class InputItem : INotifyPropertyChanged
|
public class CommandItem : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
public string Menu { get; set; } = "";
|
|
||||||
|
public string Path { get; set; } = "";
|
||||||
public string Command { get; set; } = "";
|
public string Command { get; set; } = "";
|
||||||
|
|
||||||
public InputItem() { }
|
public CommandItem() { }
|
||||||
|
|
||||||
public InputItem(SerializationInfo info, StreamingContext context) { }
|
public CommandItem(SerializationInfo info, StreamingContext context) { }
|
||||||
|
|
||||||
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
|
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
|
||||||
{
|
{
|
||||||
@@ -188,45 +189,44 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ObservableCollection<InputItem> _InputItems;
|
private static ObservableCollection<CommandItem> _Items;
|
||||||
|
|
||||||
public static ObservableCollection<InputItem> InputItems {
|
public static ObservableCollection<CommandItem> Items {
|
||||||
get {
|
get {
|
||||||
if (_InputItems is null)
|
if (_Items is null)
|
||||||
{
|
{
|
||||||
_InputItems = new ObservableCollection<InputItem>();
|
_Items = new ObservableCollection<CommandItem>();
|
||||||
|
|
||||||
if (File.Exists(mp.InputConfPath))
|
if (File.Exists(mp.InputConfPath))
|
||||||
{
|
{
|
||||||
foreach (string line in File.ReadAllLines(mp.InputConfPath))
|
foreach (string line in File.ReadAllLines(mp.InputConfPath))
|
||||||
{
|
{
|
||||||
string l = line.Trim();
|
string val = line.Trim();
|
||||||
if (l.StartsWith("#")) continue;
|
if (val.StartsWith("#")) continue;
|
||||||
if (!l.Contains(" ")) continue;
|
if (!val.Contains(" ")) continue;
|
||||||
InputItem item = new InputItem();
|
CommandItem item = new CommandItem();
|
||||||
item.Input = l.Substring(0, l.IndexOf(" "));
|
item.Input = val.Substring(0, val.IndexOf(" ")).Replace("_", "");
|
||||||
if (item.Input == "") continue;
|
val = val.Substring(val.IndexOf(" ") + 1);
|
||||||
l = l.Substring(l.IndexOf(" ") + 1);
|
|
||||||
|
|
||||||
if (l.Contains("#menu:"))
|
if (val.Contains("#menu:"))
|
||||||
{
|
{
|
||||||
item.Menu = l.Substring(l.IndexOf("#menu:") + 6).Trim();
|
item.Path = val.Substring(val.IndexOf("#menu:") + 6).Trim();
|
||||||
l = l.Substring(0, l.IndexOf("#menu:"));
|
val = val.Substring(0, val.IndexOf("#menu:"));
|
||||||
|
|
||||||
if (item.Menu.Contains(";"))
|
if (item.Path.Contains(";"))
|
||||||
item.Menu = item.Menu.Substring(item.Menu.IndexOf(";") + 1).Trim();
|
item.Path = item.Path.Substring(item.Path.IndexOf(";") + 1).Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
item.Command = l.Trim();
|
item.Command = val.Trim();
|
||||||
if (item.Command == "")
|
if (item.Command == "")
|
||||||
continue;
|
continue;
|
||||||
if (item.Command.ToLower() == "ignore")
|
if (item.Command.ToLower() == "ignore")
|
||||||
item.Command = "";
|
item.Command = "";
|
||||||
_InputItems.Add(item);
|
_Items.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _InputItems;
|
return _Items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,11 +138,12 @@
|
|||||||
Ctrl+i script-message mpv.net show-input-editor #menu: Settings > Show Input Editor
|
Ctrl+i script-message mpv.net show-input-editor #menu: Settings > Show Input Editor
|
||||||
Ctrl+f script-message mpv.net open-conf-folder #menu: Settings > Open Config Folder
|
Ctrl+f script-message mpv.net open-conf-folder #menu: Settings > Open Config Folder
|
||||||
|
|
||||||
h script-message mpv.net show-history #menu: Tools > Show History
|
Ctrl+P script-message mpv.net show-command-palette #menu: Tools > Command Palette
|
||||||
l ab-loop #menu: Tools > Set/clear A-B loop points
|
h script-message mpv.net show-history #menu: Tools > Show History
|
||||||
L cycle-values loop-file "inf" "no" #menu: Tools > Toggle infinite file looping
|
l ab-loop #menu: Tools > Set/clear A-B loop points
|
||||||
Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Cycle Hardware Decoding
|
L cycle-values loop-file "inf" "no" #menu: Tools > Toggle infinite file looping
|
||||||
_ script-message mpv.net execute-mpv-command #menu: Tools > Execute mpv command...
|
Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Cycle Hardware Decoding
|
||||||
|
_ script-message mpv.net execute-mpv-command #menu: Tools > Execute mpv command...
|
||||||
|
|
||||||
_ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > Show mpv manual
|
_ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > Show mpv manual
|
||||||
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/blob/master/etc/input.conf #menu: Help > Show mpv default keys
|
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/blob/master/etc/input.conf #menu: Help > Show mpv default keys
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="About mpv.net" Height="230" Width="420" FontSize="16" ShowInTaskbar="False"
|
Title="About mpv.net" Height="230" Width="420" FontSize="16" ShowInTaskbar="False"
|
||||||
WindowStartupLocation="CenterOwner" ResizeMode="NoResize">
|
WindowStartupLocation="CenterOwner" ResizeMode="NoResize" PreviewKeyDown="Window_PreviewKeyDown">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
<TextBlock FontSize="48" HorizontalAlignment="Center" Margin="0,0,0,10">mpv.net</TextBlock>
|
<TextBlock FontSize="48" HorizontalAlignment="Center" Margin="0,0,0,10">mpv.net</TextBlock>
|
||||||
|
|||||||
@@ -11,5 +11,10 @@ namespace mpvnet
|
|||||||
Version.Text = $"Version {System.Windows.Forms.Application.ProductVersion}";
|
Version.Text = $"Version {System.Windows.Forms.Application.ProductVersion}";
|
||||||
Foreground = WPF.WPF.ThemeBrush;
|
Foreground = WPF.WPF.ThemeBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
35
mpv.net/Windows/CommandPaletteWindow.xaml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<Window x:Class="mpvnet.CommandPaletteWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
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"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Command Palette" Height="295" Width="400" ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterOwner" Loaded="Window_Loaded" FontSize="13">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBox Name="FilterTextBox" PreviewKeyDown="FilterTextBox_PreviewKeyDown" TextChanged="FilterTextBox_TextChanged"></TextBox>
|
||||||
|
<ListView Name="ListView" Grid.Row="1" MouseUp="ListView_MouseUp">
|
||||||
|
<ListView.ItemContainerStyle>
|
||||||
|
<Style TargetType="ListBoxItem">
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
|
||||||
|
</Style>
|
||||||
|
</ListView.ItemContainerStyle>
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="{Binding Path}"></TextBlock>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Input}" HorizontalAlignment="Right"></TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
109
mpv.net/Windows/CommandPaletteWindow.xaml.cs
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
|
||||||
|
namespace mpvnet
|
||||||
|
{
|
||||||
|
public partial class CommandPaletteWindow : Window
|
||||||
|
{
|
||||||
|
ICollectionView CollectionView;
|
||||||
|
|
||||||
|
public CommandPaletteWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
CollectionViewSource collectionViewSource = new CollectionViewSource() { Source = CommandItem.Items };
|
||||||
|
CollectionView = collectionViewSource.View;
|
||||||
|
var yourCostumFilter = new Predicate<object>(item => Filter((CommandItem)item));
|
||||||
|
CollectionView.Filter = yourCostumFilter;
|
||||||
|
ListView.ItemsSource = CollectionView;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Filter(CommandItem item)
|
||||||
|
{
|
||||||
|
if (item.Command == "") return false;
|
||||||
|
string filter = FilterTextBox.Text.ToLower();
|
||||||
|
if (filter == "") return true;
|
||||||
|
if (item.Command.ToLower().Contains(filter) ||
|
||||||
|
item.Input.ToLower().Contains(filter) ||
|
||||||
|
item.Path.ToLower().Contains(filter))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
||||||
|
source.AddHook(new HwndSourceHook(WndProc));
|
||||||
|
Keyboard.Focus(FilterTextBox);
|
||||||
|
SelectFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectFirst()
|
||||||
|
{
|
||||||
|
if (ListView.Items.Count > 0)
|
||||||
|
ListView.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||||
|
{
|
||||||
|
if (msg == 0x200 /*WM_MOUSEMOVE*/ && Mouse.LeftButton != MouseButtonState.Pressed)
|
||||||
|
handled = true;
|
||||||
|
return IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FilterTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.Key)
|
||||||
|
{
|
||||||
|
case Key.Up:
|
||||||
|
{
|
||||||
|
int index = ListView.SelectedIndex;
|
||||||
|
index -= 1;
|
||||||
|
if (index < 0) index = 0;
|
||||||
|
ListView.SelectedIndex = index;
|
||||||
|
ListView.ScrollIntoView(ListView.SelectedItem);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Key.Down:
|
||||||
|
{
|
||||||
|
int index = ListView.SelectedIndex;
|
||||||
|
index += 1;
|
||||||
|
if (index > ListView.Items.Count - 1) index = ListView.Items.Count - 1;
|
||||||
|
ListView.SelectedIndex = index;
|
||||||
|
ListView.ScrollIntoView(ListView.SelectedItem);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Key.Escape:
|
||||||
|
Close();
|
||||||
|
break;
|
||||||
|
case Key.Enter:
|
||||||
|
Execute();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Execute()
|
||||||
|
{
|
||||||
|
if (ListView.SelectedItem != null)
|
||||||
|
{
|
||||||
|
CommandItem item = ListView.SelectedItem as CommandItem;
|
||||||
|
Close();
|
||||||
|
mp.command_string(item.Command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListView_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FilterTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
CollectionView.Refresh();
|
||||||
|
SelectFirst();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="4*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="10*" />
|
<ColumnDefinition Width="1*" />
|
||||||
<ColumnDefinition Width="60*" />
|
<ColumnDefinition Width="6*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Controls:SearchTextBoxUserControl HintText="Find a setting" x:Name="SearchControl" Width="250" Margin="0,20,0,10" Grid.ColumnSpan="2" />
|
<Controls:SearchTextBoxUserControl HintText="Find a setting" x:Name="SearchControl" Width="250" Margin="0,20,0,10" Grid.ColumnSpan="2" />
|
||||||
<ScrollViewer x:Name="MainScrollViewer" VerticalScrollBarVisibility="Auto" Grid.Row="1" Grid.Column="1" Margin="0,0,0,10">
|
<ScrollViewer x:Name="MainScrollViewer" VerticalScrollBarVisibility="Auto" Grid.Row="1" Grid.Column="1" Margin="0,0,0,10">
|
||||||
@@ -24,9 +24,7 @@
|
|||||||
<ListBox x:Name="FilterListBox" ItemsSource="{Binding FilterStrings}" BorderThickness="0" SelectionChanged="ListBox_SelectionChanged" Foreground="{x:Static WPF:WPF.ThemeBrush}" Background="{Binding Path=Background, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}">
|
<ListBox x:Name="FilterListBox" ItemsSource="{Binding FilterStrings}" BorderThickness="0" SelectionChanged="ListBox_SelectionChanged" Foreground="{x:Static WPF:WPF.ThemeBrush}" Background="{Binding Path=Background, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal">
|
<TextBlock Text="{Binding}" FontSize="16" />
|
||||||
<TextBlock Text="{Binding}" FontSize="16" />
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<Controls:SearchTextBoxUserControl HintText="Type ? to get help." x:Name="SearchControl" Width="300" Margin="0,20,0,20" Grid.ColumnSpan="2" />
|
<Controls:SearchTextBoxUserControl HintText="Type ? to get help." x:Name="SearchControl" Width="300" Margin="0,20,0,20" Grid.ColumnSpan="2" />
|
||||||
<DataGrid Grid.Row="1" x:Name="DataGrid" CommandManager.PreviewCanExecute="DataGrid_PreviewCanExecute" AutoGenerateColumns="False" CellStyle="{StaticResource DataGrid_Font_Centering}">
|
<DataGrid Grid.Row="1" x:Name="DataGrid" CommandManager.PreviewCanExecute="DataGrid_PreviewCanExecute" AutoGenerateColumns="False" CellStyle="{StaticResource DataGrid_Font_Centering}">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Menu" Binding="{Binding Menu}"/>
|
<DataGridTextColumn Header="Menu" Binding="{Binding Path}"/>
|
||||||
<DataGridTemplateColumn Header="Input">
|
<DataGridTemplateColumn Header="Input">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ namespace mpvnet
|
|||||||
InitialInputConfContent = GetInputConfContent();
|
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 = CommandItem.Items };
|
||||||
CollectionView = collectionViewSource.View;
|
CollectionView = collectionViewSource.View;
|
||||||
var yourCostumFilter = new Predicate<object>(item => Filter((InputItem)item));
|
var yourCostumFilter = new Predicate<object>(item => Filter((CommandItem)item));
|
||||||
CollectionView.Filter = yourCostumFilter;
|
CollectionView.Filter = yourCostumFilter;
|
||||||
DataGrid.ItemsSource = CollectionView;
|
DataGrid.ItemsSource = CollectionView;
|
||||||
}
|
}
|
||||||
@@ -35,8 +35,9 @@ namespace mpvnet
|
|||||||
MessageBox.Show("Filtering works by searching in the Input, Menu and Command but it's possible to reduce the filter scope to either of Input, Menu or Command by prefixing as follows:\n\ni <input search>\ni: <input search>\n\nm <menu search>\nm: <menu search>\n\nc <command search>\nc: <command search>\n\nIf only one character is entered the search will be performed only in the input.", "Filtering", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("Filtering works by searching in the Input, Menu and Command but it's possible to reduce the filter scope to either of Input, Menu or Command by prefixing as follows:\n\ni <input search>\ni: <input search>\n\nm <menu search>\nm: <menu search>\n\nc <command search>\nc: <command search>\n\nIf only one character is entered the search will be performed only in the input.", "Filtering", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Filter(InputItem item)
|
bool Filter(CommandItem item)
|
||||||
{
|
{
|
||||||
|
if (item.Command == "") return false;
|
||||||
string searchText = SearchControl.SearchTextBox.Text.ToLower();
|
string searchText = SearchControl.SearchTextBox.Text.ToLower();
|
||||||
if (searchText == "") return true;
|
if (searchText == "") return true;
|
||||||
|
|
||||||
@@ -51,11 +52,11 @@ namespace mpvnet
|
|||||||
return item.Input.ToLower().Contains(searchText);
|
return item.Input.ToLower().Contains(searchText);
|
||||||
}
|
}
|
||||||
else if (searchText.StartsWith("m ") || searchText.StartsWith("m:"))
|
else if (searchText.StartsWith("m ") || searchText.StartsWith("m:"))
|
||||||
return item.Menu.ToLower().Contains(searchText.Substring(2).Trim());
|
return item.Path.ToLower().Contains(searchText.Substring(2).Trim());
|
||||||
else if (searchText.StartsWith("c ") || searchText.StartsWith("c:"))
|
else if (searchText.StartsWith("c ") || searchText.StartsWith("c:"))
|
||||||
return item.Command.ToLower().Contains(searchText.Substring(2).Trim());
|
return item.Command.ToLower().Contains(searchText.Substring(2).Trim());
|
||||||
else if (item.Command.ToLower().Contains(searchText) ||
|
else if (item.Command.ToLower().Contains(searchText) ||
|
||||||
item.Menu.ToLower().Contains(searchText) ||
|
item.Path.ToLower().Contains(searchText) ||
|
||||||
item.Input.ToLower().Contains(searchText))
|
item.Input.ToLower().Contains(searchText))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -65,18 +66,18 @@ namespace mpvnet
|
|||||||
|
|
||||||
private void ButtonClick(object sender, RoutedEventArgs e)
|
private void ButtonClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
InputItem item = ((Button)e.Source).DataContext as InputItem;
|
CommandItem item = ((Button)e.Source).DataContext as CommandItem;
|
||||||
if (item is null) return;
|
if (item is null) return;
|
||||||
LearnWindow w = new LearnWindow();
|
LearnWindow w = new LearnWindow();
|
||||||
w.Owner = this;
|
w.Owner = this;
|
||||||
w.InputItem = item;
|
w.InputItem = item;
|
||||||
w.ShowDialog();
|
w.ShowDialog();
|
||||||
|
|
||||||
var items = new Dictionary<string, InputItem>();
|
var items = new Dictionary<string, CommandItem>();
|
||||||
|
|
||||||
foreach (InputItem i in InputItem.InputItems)
|
foreach (CommandItem i in CommandItem.Items)
|
||||||
if (items.ContainsKey(i.Input) && i.Input != "_")
|
if (items.ContainsKey(i.Input) && i.Input != "")
|
||||||
MessageBox.Show($"Duplicate found:\n\n{i.Input}: {i.Menu}\n\n{items[i.Input].Input}: {items[i.Input].Menu}\n\nPlease note that you can chain multiple commands in the same line by using a semicolon as separator.", "Duplicate Found", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show($"Duplicate found:\n\n{i.Input}: {i.Path}\n\n{items[i.Input].Input}: {items[i.Input].Path}\n\nPlease note that you can chain multiple commands in the same line by using a semicolon as separator.", "Duplicate Found", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
else
|
else
|
||||||
items[i.Input] = i;
|
items[i.Input] = i;
|
||||||
}
|
}
|
||||||
@@ -87,17 +88,18 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
string text = Properties.Resources.inputConfHeader + "\r\n";
|
string text = Properties.Resources.inputConfHeader + "\r\n";
|
||||||
|
|
||||||
foreach (InputItem item in InputItem.InputItems)
|
foreach (CommandItem item in CommandItem.Items)
|
||||||
{
|
{
|
||||||
string line = " " + item.Input.PadRight(10);
|
string input = item.Input == "" ? "_" : item.Input;
|
||||||
|
string line = " " + input.PadRight(10);
|
||||||
|
|
||||||
if (item.Command.Trim() == "")
|
if (item.Command.Trim() == "")
|
||||||
line += " ignore";
|
line += " ignore";
|
||||||
else
|
else
|
||||||
line += " " + item.Command.Trim();
|
line += " " + item.Command.Trim();
|
||||||
|
|
||||||
if (item.Menu.Trim() != "")
|
if (item.Path.Trim() != "")
|
||||||
line = line.PadRight(40) + " #menu: " + item.Menu;
|
line = line.PadRight(40) + " #menu: " + item.Path;
|
||||||
|
|
||||||
text += line + "\r\n";
|
text += line + "\r\n";
|
||||||
}
|
}
|
||||||
@@ -117,7 +119,7 @@ namespace mpvnet
|
|||||||
DataGrid grid = (DataGrid)sender;
|
DataGrid grid = (DataGrid)sender;
|
||||||
|
|
||||||
if (e.Command == DataGrid.DeleteCommand)
|
if (e.Command == DataGrid.DeleteCommand)
|
||||||
if (MessageBox.Show($"Confirm to delete: {(grid.SelectedItem as InputItem).Input} ({(grid.SelectedItem as InputItem).Menu})", "Confirm Delete", MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK)
|
if (MessageBox.Show($"Confirm to delete: {(grid.SelectedItem as CommandItem).Input} ({(grid.SelectedItem as CommandItem).Path})", "Confirm Delete", MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK)
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
public partial class LearnWindow : Window
|
public partial class LearnWindow : Window
|
||||||
{
|
{
|
||||||
public InputItem InputItem { get; set; }
|
public CommandItem InputItem { get; set; }
|
||||||
public string NewKey { get; set; } = "";
|
public string NewKey { get; set; } = "";
|
||||||
|
|
||||||
public LearnWindow()
|
public LearnWindow()
|
||||||
@@ -144,7 +144,7 @@ namespace mpvnet
|
|||||||
void SetKey(string key)
|
void SetKey(string key)
|
||||||
{
|
{
|
||||||
NewKey = key;
|
NewKey = key;
|
||||||
MenuLabel.Content = InputItem.Menu;
|
MenuLabel.Content = InputItem.Path;
|
||||||
KeyLabel.Content = key;
|
KeyLabel.Content = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ namespace mpvnet
|
|||||||
case mpv_event_id.MPV_EVENT_FILE_LOADED:
|
case mpv_event_id.MPV_EVENT_FILE_LOADED:
|
||||||
FileLoaded?.Invoke();
|
FileLoaded?.Invoke();
|
||||||
LoadFolder();
|
LoadFolder();
|
||||||
|
WriteHistory(mp.get_property_string("path"));
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_TRACKS_CHANGED:
|
case mpv_event_id.MPV_EVENT_TRACKS_CHANGED:
|
||||||
TracksChanged?.Invoke();
|
TracksChanged?.Invoke();
|
||||||
@@ -322,10 +323,7 @@ namespace mpvnet
|
|||||||
VideoSizeChanged?.Invoke();
|
VideoSizeChanged?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
Task.Run(new Action(() => {
|
Task.Run(new Action(() => ReadMetaData()));
|
||||||
WriteHistory(mp.get_property_string("path"));
|
|
||||||
ReadMetaData();
|
|
||||||
}));
|
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_CHAPTER_CHANGE:
|
case mpv_event_id.MPV_EVENT_CHAPTER_CHANGE:
|
||||||
ChapterChange?.Invoke();
|
ChapterChange?.Invoke();
|
||||||
|
|||||||
@@ -145,6 +145,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Windows\CommandPaletteWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="WPF\Resources.xaml">
|
<Page Include="WPF\Resources.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -186,6 +190,9 @@
|
|||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Sys\TaskDialog.cs" />
|
<Compile Include="Sys\TaskDialog.cs" />
|
||||||
|
<Compile Include="Windows\CommandPaletteWindow.xaml.cs">
|
||||||
|
<DependentUpon>CommandPaletteWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\ConfWindow.xaml.cs">
|
<Compile Include="Windows\ConfWindow.xaml.cs">
|
||||||
<DependentUpon>ConfWindow.xaml</DependentUpon>
|
<DependentUpon>ConfWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
BIN
screenshots/CommandPalette.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
screenshots/ConfEditor.png
Normal file
|
After Width: | Height: | Size: 268 KiB |
BIN
screenshots/InputEditor.png
Normal file
|
After Width: | Height: | Size: 277 KiB |
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 2.9 MiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 171 KiB |