fancy new command palette
This commit is contained in:
@@ -29,9 +29,7 @@ namespace DynamicGUI
|
||||
Link.SetURL(optionSetting.URL);
|
||||
}
|
||||
|
||||
public Theme Theme {
|
||||
get => Theme.Current;
|
||||
}
|
||||
public Theme Theme => Theme.Current;
|
||||
|
||||
string _SearchableText;
|
||||
|
||||
|
||||
@@ -35,9 +35,7 @@ namespace DynamicGUI
|
||||
LinkTextBlock.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public Theme Theme {
|
||||
get => Theme.Current;
|
||||
}
|
||||
public Theme Theme => Theme.Current;
|
||||
|
||||
string _SearchableText;
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ namespace mpvnet
|
||||
{
|
||||
public static class App
|
||||
{
|
||||
public static event Action ShowCommandPalette;
|
||||
|
||||
public static List<string> TempFiles { get; } = new List<string>();
|
||||
|
||||
public static string ConfPath { get => Core.ConfigFolder + "mpvnet.conf"; }
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace mpvnet
|
||||
case "show-input-editor": ShowDialog(typeof(InputWindow)); break;
|
||||
case "show-keys": ShowTextWithEditor("input-key-list", Core.get_property_string("input-key-list").Replace(",", BR)); break;
|
||||
case "show-media-info": ShowMediaInfo(args); break;
|
||||
case "show-media-search": ShowDialog(typeof(EverythingWindow)); break;
|
||||
case "show-playlist": ShowPlaylist(); break;
|
||||
case "show-profiles": ShowTextWithEditor("profile-list", mpvHelp.GetProfiles()); break;
|
||||
case "show-properties": ShowProperties(); break;
|
||||
|
||||
@@ -388,7 +388,7 @@ namespace mpvnet
|
||||
if (LogMessage != null || LogMessageAsync != null)
|
||||
{
|
||||
string msg = $"[{ConvertFromUtf8(data.prefix)}] {ConvertFromUtf8(data.text)}";
|
||||
InvokeAsync<mpv_log_level, string>(LogMessageAsync, data.log_level, msg);
|
||||
InvokeAsync(LogMessageAsync, data.log_level, msg);
|
||||
LogMessage?.Invoke(data.log_level, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,14 @@ namespace mpvnet
|
||||
|
||||
public static IEnumerable<CommandPaletteItem> GetItems()
|
||||
{
|
||||
return CommandItem.Items.Select(i => new CommandPaletteItem() { Text = i.Display, SecondaryText = i.Input });
|
||||
var aaa = CommandItem.Items.ToArray();
|
||||
return CommandItem.Items
|
||||
.Where(i => i.Command != "")
|
||||
.Select(i => new CommandPaletteItem() {
|
||||
Text = i.Display,
|
||||
SecondaryText = i.Input,
|
||||
Action = () => Core.command(i.Command)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
Alt+s script-message mpv.net load-sub #menu: Open > Load external subtitle files...
|
||||
_ ignore #menu: Open > -
|
||||
_ script-message mpv.net open-files append #menu: Open > Add files to playlist...
|
||||
F3 script-message mpv.net show-media-search #menu: Open > Show media search...
|
||||
_ ignore #menu: Open > -
|
||||
_ ignore #menu: Open > Recent
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ namespace mpvnet
|
||||
protected override void OnPreviewKeyDown(KeyEventArgs e) => Close();
|
||||
protected override void OnMouseDown(MouseButtonEventArgs e) => Close();
|
||||
|
||||
public Theme Theme {
|
||||
get => Theme.Current;
|
||||
}
|
||||
public Theme Theme => Theme.Current;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
>
|
||||
|
||||
<UserControl.InputBindings>
|
||||
<KeyBinding Gesture="Esc" Command="{Binding EscapeCommand}"/>
|
||||
<KeyBinding Gesture="Esc" Command="{Binding EscapeCommand}"/>
|
||||
<KeyBinding Gesture="Enter" Command="{Binding ExecuteCommand}"/>
|
||||
</UserControl.InputBindings>
|
||||
|
||||
<Grid>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace mpvnet
|
||||
{
|
||||
public ICollectionView CollectionView { get; set; }
|
||||
public ICommand EscapeCommand { get; }
|
||||
public ICommand ExecuteCommand { get; }
|
||||
public CollectionViewSource CollectionViewSource { get; }
|
||||
public ObservableCollection<CommandPaletteItem> Items { get; } = new ObservableCollection<CommandPaletteItem>();
|
||||
|
||||
@@ -27,7 +28,8 @@ namespace mpvnet
|
||||
MainListView.ItemsSource = CollectionView;
|
||||
|
||||
EscapeCommand = new RelayCommand(OnEscapeCommand);
|
||||
SearchControl.SearchTextBox.PreviewKeyDown += SearchControl_PreviewKeyDown;
|
||||
ExecuteCommand = new RelayCommand(OnExecuteCommand);
|
||||
SearchControl.SearchTextBox.PreviewKeyDown += SearchTextBox_PreviewKeyDown;
|
||||
SearchControl.SearchTextBox.TextChanged += SearchTextBox_TextChanged;
|
||||
SearchControl.SearchTextBox.BorderBrush = Theme.Background;
|
||||
SearchControl.HideClearButton = true;
|
||||
@@ -39,7 +41,7 @@ namespace mpvnet
|
||||
SelectFirst();
|
||||
}
|
||||
|
||||
void SearchControl_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
void SearchTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
@@ -66,16 +68,18 @@ namespace mpvnet
|
||||
MainListView.ScrollIntoView(MainListView.SelectedItem);
|
||||
}
|
||||
break;
|
||||
case Key.Enter:
|
||||
Execute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnEscapeCommand(object param)
|
||||
{
|
||||
MainForm.Instance.HideCommandPalette();
|
||||
}
|
||||
void MainListView_SizeChanged(object sender, SizeChangedEventArgs e) => AdjustHeight();
|
||||
|
||||
void MainListView_MouseUp(object sender, MouseButtonEventArgs e) => Execute();
|
||||
|
||||
void OnEscapeCommand(object param) => MainForm.Instance.HideCommandPalette();
|
||||
|
||||
void OnExecuteCommand(object param) => Execute();
|
||||
|
||||
void OnLoaded(object sender, RoutedEventArgs e) => Keyboard.Focus(SearchControl.SearchTextBox);
|
||||
|
||||
public Theme Theme => Theme.Current;
|
||||
|
||||
@@ -94,7 +98,10 @@ namespace mpvnet
|
||||
public void SelectFirst()
|
||||
{
|
||||
if (MainListView.Items.Count > 0)
|
||||
{
|
||||
MainListView.SelectedIndex = 0;
|
||||
MainListView.ScrollIntoView(MainListView.SelectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
void Execute()
|
||||
@@ -104,14 +111,10 @@ namespace mpvnet
|
||||
CommandPaletteItem item = MainListView.SelectedItem as CommandPaletteItem;
|
||||
MainForm.Instance.HideCommandPalette();
|
||||
item.Action.Invoke();
|
||||
MainForm.Instance.Voodoo();
|
||||
}
|
||||
}
|
||||
|
||||
void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Keyboard.Focus(SearchControl.SearchTextBox);
|
||||
}
|
||||
|
||||
public void SetItems(IEnumerable<CommandPaletteItem> items)
|
||||
{
|
||||
Items.Clear();
|
||||
@@ -120,21 +123,11 @@ namespace mpvnet
|
||||
Items.Add(i);
|
||||
}
|
||||
|
||||
void MainListView_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
AdjustHeight();
|
||||
}
|
||||
|
||||
public void AdjustHeight()
|
||||
{
|
||||
double actualHeight = SearchControl.ActualHeight + MainListView.ActualHeight;
|
||||
int dpi = Native.GetDPI(MainForm.Instance.Handle);
|
||||
MainForm.Instance.CommandPaletteHost.Height = (int)(actualHeight / 96.0 * dpi);
|
||||
}
|
||||
|
||||
void MainListView_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,7 @@ namespace mpvnet
|
||||
FilterListBox.SelectedItem = SearchControl.Text.TrimEnd(':');
|
||||
}
|
||||
|
||||
public Theme Theme {
|
||||
get => Theme.Current;
|
||||
}
|
||||
public Theme Theme => Theme.Current;
|
||||
|
||||
void LoadSettings()
|
||||
{
|
||||
@@ -75,10 +73,10 @@ namespace mpvnet
|
||||
{
|
||||
base.OnClosed(e);
|
||||
App.Settings.ConfigEditorSearch = SearchControl.Text;
|
||||
|
||||
|
||||
if (InitialContent == GetCompareString())
|
||||
return;
|
||||
|
||||
|
||||
File.WriteAllText(Core.ConfPath, GetContent("mpv"));
|
||||
File.WriteAllText(App.ConfPath, GetContent("mpvnet"));
|
||||
|
||||
@@ -89,7 +87,7 @@ namespace mpvnet
|
||||
if (item.File == "mpv")
|
||||
{
|
||||
Core.ProcessProperty(item.Name, item.Value);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
Core.set_property_string(item.Name, item.Value, true);
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<Window
|
||||
x:Class="mpvnet.EverythingWindow"
|
||||
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="Media File Search"
|
||||
FontSize="13"
|
||||
Height="300"
|
||||
Width="600"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Loaded="Window_Loaded"
|
||||
>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBox
|
||||
Name="FilterTextBox"
|
||||
Foreground="{Binding Theme.Foreground}"
|
||||
Background="{Binding Theme.Background}"
|
||||
PreviewKeyDown="FilterTextBox_PreviewKeyDown"
|
||||
TextChanged="FilterTextBox_TextChanged"
|
||||
/>
|
||||
|
||||
<ListView
|
||||
Name="ListView"
|
||||
Foreground="{Binding Theme.Foreground}"
|
||||
Background="{Binding Theme.Background}"
|
||||
Grid.Row="1"
|
||||
MouseUp="ListView_MouseUp"
|
||||
PreviewKeyDown="ListView_PreviewKeyDown"
|
||||
>
|
||||
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
|
||||
</ListView>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,169 +0,0 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
|
||||
using static mpvnet.Global;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
public partial class EverythingWindow : Window
|
||||
{
|
||||
public EverythingWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public Theme Theme {
|
||||
get => Theme.Current;
|
||||
}
|
||||
|
||||
const int EVERYTHING_REQUEST_FILE_NAME = 0x00000001;
|
||||
const int EVERYTHING_REQUEST_PATH = 0x00000002;
|
||||
|
||||
[DllImport("Everything.dll", CharSet = CharSet.Unicode)]
|
||||
public static extern int Everything_SetSearch(string lpSearchString);
|
||||
|
||||
[DllImport("Everything.dll")]
|
||||
public static extern void Everything_SetRequestFlags(UInt32 dwRequestFlags);
|
||||
|
||||
[DllImport("Everything.dll")]
|
||||
public static extern void Everything_SetSort(UInt32 dwSortType);
|
||||
|
||||
[DllImport("Everything.dll", CharSet = CharSet.Unicode)]
|
||||
public static extern bool Everything_Query(bool bWait);
|
||||
|
||||
[DllImport("Everything.dll", CharSet = CharSet.Unicode)]
|
||||
public static extern void Everything_GetResultFullPathName(UInt32 nIndex, StringBuilder lpString, UInt32 nMaxCount);
|
||||
|
||||
[DllImport("Everything.dll")]
|
||||
public static extern bool Everything_GetResultSize(UInt32 nIndex, out long lpFileSize);
|
||||
|
||||
[DllImport("Everything.dll")]
|
||||
public static extern UInt32 Everything_GetNumResults();
|
||||
|
||||
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
||||
source.AddHook(new HwndSourceHook(WndProc));
|
||||
Keyboard.Focus(FilterTextBox);
|
||||
}
|
||||
|
||||
void SelectFirst()
|
||||
{
|
||||
if (ListView.Items.Count > 0)
|
||||
ListView.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void FilterTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Up:
|
||||
{
|
||||
int index = ListView.SelectedIndex;
|
||||
|
||||
if (--index < 0)
|
||||
index = 0;
|
||||
|
||||
ListView.SelectedIndex = index;
|
||||
ListView.ScrollIntoView(ListView.SelectedItem);
|
||||
}
|
||||
break;
|
||||
case Key.Down:
|
||||
{
|
||||
int index = ListView.SelectedIndex;
|
||||
|
||||
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 ListView_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
Close();
|
||||
|
||||
if (e.Key == Key.Enter)
|
||||
Execute();
|
||||
}
|
||||
|
||||
void Execute()
|
||||
{
|
||||
if (ListView.SelectedItem != null)
|
||||
Core.LoadFiles(new[] { ListView.SelectedItem as string }, true, Keyboard.Modifiers == ModifierKeys.Control);
|
||||
|
||||
Keyboard.Focus(FilterTextBox);
|
||||
}
|
||||
|
||||
void ListView_MouseUp(object sender, MouseButtonEventArgs e) => Execute();
|
||||
|
||||
void FilterTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
string searchtext = FilterTextBox.Text;
|
||||
App.RunTask(() => Search(searchtext));
|
||||
}
|
||||
|
||||
object LockObject = new object();
|
||||
|
||||
void Search(string searchText)
|
||||
{
|
||||
lock (LockObject)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> items = new List<string>();
|
||||
StringBuilder sb = new StringBuilder(500);
|
||||
Everything_SetSearch(searchText);
|
||||
Everything_SetRequestFlags(EVERYTHING_REQUEST_FILE_NAME | EVERYTHING_REQUEST_PATH);
|
||||
Everything_Query(true);
|
||||
uint count = Everything_GetNumResults();
|
||||
|
||||
for (uint i = 0; i < count; i++)
|
||||
{
|
||||
Everything_GetResultFullPathName(i, sb, (uint)sb.Capacity);
|
||||
string ext = sb.ToString().Ext();
|
||||
|
||||
if (CorePlayer.AudioTypes.Contains(ext) || CorePlayer.VideoTypes.Contains(ext) || CorePlayer.ImageTypes.Contains(ext))
|
||||
items.Add(sb.ToString());
|
||||
|
||||
if (items.Count > 100)
|
||||
break;
|
||||
}
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
ListView.ItemsSource = items;
|
||||
SelectFirst();
|
||||
});
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Msg.ShowError("Search query failed.",
|
||||
"The search feature depends on [Everything](https://www.voidtools.com) being installed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,14 +26,11 @@ namespace mpvnet
|
||||
DataGrid.SelectionMode = DataGridSelectionMode.Single;
|
||||
CollectionViewSource collectionViewSource = new CollectionViewSource() { Source = CommandItem.Items };
|
||||
CollectionView = collectionViewSource.View;
|
||||
var yourCostumFilter = new Predicate<object>(item => Filter((CommandItem)item));
|
||||
CollectionView.Filter = yourCostumFilter;
|
||||
CollectionView.Filter = new Predicate<object>(item => Filter((CommandItem)item));
|
||||
DataGrid.ItemsSource = CollectionView;
|
||||
}
|
||||
|
||||
public Theme Theme {
|
||||
get => Theme.Current;
|
||||
}
|
||||
public Theme Theme => Theme.Current;
|
||||
|
||||
void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -30,9 +30,7 @@ namespace mpvnet
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public Theme Theme {
|
||||
get => Theme.Current;
|
||||
}
|
||||
public Theme Theme => Theme.Current;
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
static extern short GetKeyState(int keyCode);
|
||||
|
||||
@@ -19,9 +19,7 @@ namespace mpvnet
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public Theme Theme {
|
||||
get => Theme.Current;
|
||||
}
|
||||
public Theme Theme => Theme.Current;
|
||||
|
||||
static BitmapSource _ShieldIcon;
|
||||
|
||||
@@ -45,7 +43,7 @@ namespace mpvnet
|
||||
using (Process proc = new Process())
|
||||
{
|
||||
proc.StartInfo.FileName = WinForms.Application.ExecutablePath;
|
||||
proc.StartInfo.Arguments = "--reg-file-assoc " + String.Join(" ", extensions);
|
||||
proc.StartInfo.Arguments = "--reg-file-assoc " + string.Join(" ", extensions);
|
||||
proc.StartInfo.Verb = "runas";
|
||||
proc.StartInfo.UseShellExecute = true;
|
||||
proc.Start();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace mpvnet
|
||||
int TaskbarButtonCreatedMessage;
|
||||
int ShownTickCount;
|
||||
|
||||
Taskbar Taskbar;
|
||||
Taskbar Taskbar;
|
||||
bool WasMaximized;
|
||||
|
||||
public MainForm()
|
||||
@@ -52,7 +52,7 @@ namespace mpvnet
|
||||
|
||||
Core.observe_property("window-maximized", PropChangeWindowMaximized);
|
||||
Core.observe_property("window-minimized", PropChangeWindowMinimized);
|
||||
|
||||
|
||||
Core.observe_property_bool("pause", PropChangePause);
|
||||
Core.observe_property_bool("fullscreen", PropChangeFullscreen);
|
||||
Core.observe_property_bool("ontop", PropChangeOnTop);
|
||||
@@ -65,7 +65,7 @@ namespace mpvnet
|
||||
Core.observe_property_string("title", PropChangeTitle);
|
||||
|
||||
Core.observe_property_int("edition", PropChangeEdition);
|
||||
|
||||
|
||||
if (Core.GPUAPI != "vulkan")
|
||||
Core.ProcessCommandLine(false);
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace mpvnet
|
||||
Application.ThreadException += (sender, e) => App.ShowException(e.Exception);
|
||||
|
||||
TaskbarButtonCreatedMessage = RegisterWindowMessage("TaskbarButtonCreated");
|
||||
|
||||
|
||||
ContextMenu = new ContextMenuStripEx(components);
|
||||
ContextMenu.Opened += ContextMenu_Opened;
|
||||
ContextMenu.Opening += ContextMenu_Opening;
|
||||
@@ -99,7 +99,7 @@ namespace mpvnet
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
|
||||
Point pos = App.Settings.WindowPosition;
|
||||
|
||||
|
||||
if ((pos.X != 0 || pos.Y != 0) && App.RememberWindowPosition)
|
||||
{
|
||||
Left = pos.X - Width / 2;
|
||||
@@ -168,6 +168,8 @@ namespace mpvnet
|
||||
|
||||
bool IsFullscreen => WindowState == FormWindowState.Maximized && FormBorderStyle == FormBorderStyle.None;
|
||||
|
||||
bool IsCommandPaletteVissible() => CommandPaletteHost != null && CommandPaletteHost.Visible;
|
||||
|
||||
bool IsMouseInOSC()
|
||||
{
|
||||
Point pos = PointToClient(MousePosition);
|
||||
@@ -179,8 +181,6 @@ namespace mpvnet
|
||||
return pos.Y > ClientSize.Height * 0.85 || pos.Y < top;
|
||||
}
|
||||
|
||||
bool IsCommandPaletteVissible() => CommandPaletteHost != null && CommandPaletteHost.Visible;
|
||||
|
||||
void ContextMenu_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
lock (Core.MediaTracks)
|
||||
@@ -273,7 +273,7 @@ namespace mpvnet
|
||||
|
||||
foreach (string path in App.Settings.RecentFiles)
|
||||
MenuItem.Add(recent.DropDownItems, path, () => Core.LoadFiles(new[] { path }, true, Control.ModifierKeys.HasFlag(Keys.Control)));
|
||||
|
||||
|
||||
recent.DropDownItems.Add(new ToolStripSeparator());
|
||||
MenuItem mi = new MenuItem("Clear List");
|
||||
mi.Action = () => App.Settings.RecentFiles.Clear();
|
||||
@@ -316,7 +316,7 @@ namespace mpvnet
|
||||
if (mi.DropDownItems.Count > 0)
|
||||
{
|
||||
MenuItem val = FindMenuItem(text, mi.DropDownItems);
|
||||
|
||||
|
||||
if (val != null)
|
||||
return val;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ namespace mpvnet
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Screen screen = Screen.FromControl(this);
|
||||
int autoFitHeight = Convert.ToInt32(screen.WorkingArea.Height * Core.Autofit);
|
||||
|
||||
@@ -348,7 +348,7 @@ namespace mpvnet
|
||||
Core.VideoSize = new Size((int)(autoFitHeight * (16 / 9f)), autoFitHeight);
|
||||
|
||||
Size videoSize = Core.VideoSize;
|
||||
|
||||
|
||||
int height = videoSize.Height;
|
||||
int width = videoSize.Width;
|
||||
|
||||
@@ -626,6 +626,12 @@ namespace mpvnet
|
||||
|
||||
void SetTitle() => BeginInvoke(new Action(() => Text = Core.expand(Title)));
|
||||
|
||||
public void Voodoo()
|
||||
{
|
||||
Message m = new Message() { Msg = 0x0202 }; // WM_LBUTTONUP
|
||||
SendMessage(Handle, m.Msg, m.WParam, m.LParam);
|
||||
}
|
||||
|
||||
void SaveWindowProperties()
|
||||
{
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
@@ -677,8 +683,6 @@ namespace mpvnet
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
//Debug.WriteLine(m);
|
||||
|
||||
switch (m.Msg)
|
||||
{
|
||||
case 0x100: // WM_KEYDOWN
|
||||
@@ -916,8 +920,7 @@ namespace mpvnet
|
||||
protected override void OnActivated(EventArgs e)
|
||||
{
|
||||
base.OnActivated(e);
|
||||
Message m = new Message() { Msg = 0x0202 }; // WM_LBUTTONUP
|
||||
SendMessage(Handle, m.Msg, m.WParam, m.LParam);
|
||||
Voodoo();
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
@@ -1044,6 +1047,12 @@ namespace mpvnet
|
||||
base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
protected override void OnLayout(LayoutEventArgs args)
|
||||
{
|
||||
base.OnLayout(args);
|
||||
AdjustCommandPaletteLeftAndWidth();
|
||||
}
|
||||
|
||||
public void ShowCommandPalette()
|
||||
{
|
||||
if (CommandPaletteHost == null)
|
||||
@@ -1082,11 +1091,5 @@ namespace mpvnet
|
||||
|
||||
CommandPaletteHost.Left = (ClientSize.Width - CommandPaletteHost.Size.Width) / 2;
|
||||
}
|
||||
|
||||
protected override void OnLayout(LayoutEventArgs args)
|
||||
{
|
||||
base.OnLayout(args);
|
||||
AdjustCommandPaletteLeftAndWidth();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,10 +104,6 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="WPF\EverythingWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="WPF\Resources.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -163,9 +159,6 @@
|
||||
<Compile Include="WPF\SetupWindow.xaml.cs">
|
||||
<DependentUpon>SetupWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WPF\EverythingWindow.xaml.cs">
|
||||
<DependentUpon>EverythingWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WPF\ConfWindow.xaml.cs">
|
||||
<DependentUpon>ConfWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
Reference in New Issue
Block a user