diff --git a/Changelog.md b/Changelog.md index 5a37848..1b471fe 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,12 +1,15 @@ ### -- fix: window restore was broken +- fix: window restore from maximized and from minimized was broken - fix: it's possible to multi select files in File Explorer and press enter to open the files, this did however only work when the auto load folder feature was disabled or the shift key was pressed (blocks auto load folder). Now it should also work without shift key and with auto load folder being enabled. +- update: libmpv shinchiro 2019-10-27 +- update: youtube-dl 2019-10-31 + ### 5.4.2.1 Beta - pressing shift key suppresses auto-load-folder diff --git a/Manual.md b/Manual.md index 07b02aa..d676cf0 100644 --- a/Manual.md +++ b/Manual.md @@ -90,6 +90,7 @@ + [Exit](#exit) + [Exit Watch Later](#exit-watch-later) * [Command Line Interface](#command-line-interface) +* [Theme](#theme) ## About mpv.net @@ -819,8 +820,17 @@ Exits mpv.net and remembers the position in the file using the following command ## Command Line Interface -mpvnet implements a basic CLI to set mpv commands. +mpvnet implements a command line interface to set mpv commands. + +Supported are all mpv properties which are documented at: + + Example: -mpvnet --mute=yes \ No newline at end of file +mpvnet --mute=yes + +## Theme + +mpv.net supports custom themes, the definition of the built-in themes can be found at: + diff --git a/mpv.net/DynamicGUI/OptionSettingControl.xaml b/mpv.net/DynamicGUI/OptionSettingControl.xaml index aee1c4d..ae7b97e 100644 --- a/mpv.net/DynamicGUI/OptionSettingControl.xaml +++ b/mpv.net/DynamicGUI/OptionSettingControl.xaml @@ -4,22 +4,58 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:DynamicGUI" - mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800"> + xmlns:UI="clr-namespace:UI" + mc:Ignorable="d" + + d:DesignHeight="450" + d:DesignWidth="800"> + - + + - - + + + + - + + diff --git a/mpv.net/DynamicGUI/StringSettingControl.xaml b/mpv.net/DynamicGUI/StringSettingControl.xaml index 9b43069..6ac6246 100644 --- a/mpv.net/DynamicGUI/StringSettingControl.xaml +++ b/mpv.net/DynamicGUI/StringSettingControl.xaml @@ -4,21 +4,52 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:DynamicGUI" + xmlns:UI="clr-namespace:UI" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> + - + + - - + + + - + + + diff --git a/mpv.net/DynamicGUI/StringSettingControl.xaml.cs b/mpv.net/DynamicGUI/StringSettingControl.xaml.cs index b6a56a2..135979c 100644 --- a/mpv.net/DynamicGUI/StringSettingControl.xaml.cs +++ b/mpv.net/DynamicGUI/StringSettingControl.xaml.cs @@ -61,18 +61,20 @@ namespace DynamicGUI } break; case "color": - using (var d = new WinForms.ColorDialog()) + using (var dialog = new WinForms.ColorDialog()) { - d.FullOpen = true; + dialog.FullOpen = true; + try { if (!string.IsNullOrEmpty(ValueTextBox.Text)) { Color col = GetColor(ValueTextBox.Text); - d.Color = System.Drawing.Color.FromArgb(col.A, col.R, col.G, col.B); + dialog.Color = System.Drawing.Color.FromArgb(col.A, col.R, col.G, col.B); } } catch {} - if (d.ShowDialog() == WinForms.DialogResult.OK) - ValueTextBox.Text = "#" + d.Color.ToArgb().ToString("X8"); + + if (dialog.ShowDialog() == WinForms.DialogResult.OK) + ValueTextBox.Text = "#" + dialog.Color.ToArgb().ToString("X8"); } break; } diff --git a/mpv.net/Misc/App.cs b/mpv.net/Misc/App.cs index 24db1c6..cf68a99 100644 --- a/mpv.net/Misc/App.cs +++ b/mpv.net/Misc/App.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Windows.Forms; +using UI; namespace mpvnet { @@ -15,10 +16,10 @@ namespace mpvnet public static string RegPath { get; } = @"HKCU\Software\" + Application.ProductName; public static string ConfPath { get => mp.ConfigFolder + "mpvnet.conf"; } - public static string DarkMode { get; set; } = "always"; public static string ProcessInstance { get; set; } = "single"; - public static string DarkColor { get; set; } - public static string LightColor { get; set; } + public static string DarkMode { get; set; } = "always"; + public static string DarkTheme { get; set; } = "dark"; + public static string LightTheme { get; set; } = "light"; public static bool RememberHeight { get; set; } = true; public static bool RememberPosition { get; set; } @@ -27,7 +28,6 @@ namespace mpvnet public static bool IsStartedFromTerminal { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes"; public static bool RememberVolume { get; set; } = true; public static bool AutoLoadFolder { get; set; } = true; - public static bool ThemedMenu { get; set; } public static bool Queue { get; set; } public static int StartThreshold { get; set; } = 1500; @@ -65,6 +65,16 @@ namespace mpvnet } } + string themeContent = null; + + if (File.Exists(mp.ConfigFolder + "theme.conf")) + themeContent = File.ReadAllText(mp.ConfigFolder + "theme.conf"); + + Theme.Init( + themeContent, + Properties.Resources.theme, + IsDarkMode ? DarkTheme : LightTheme); + mp.Shutdown += Shutdown; mp.Initialized += Initialized; } @@ -114,15 +124,14 @@ namespace mpvnet case "process-instance": ProcessInstance = value; return true; case "dark-mode": DarkMode = value; return true; case "debug-mode": DebugMode = value == "yes"; return true; - case "dark-color": DarkColor = value.Trim('\'', '"'); return true; - case "light-color": LightColor = value.Trim('\'', '"'); return true; case "remember-volume": RememberVolume = value == "yes"; return true; case "start-threshold": StartThreshold = value.Int(); return true; case "minimum-aspect-ratio": MinimumAspectRatio = value.Float(); return true; case "auto-load-folder": AutoLoadFolder = value == "yes"; return true; - case "themed-menu": ThemedMenu = value == "yes"; return true; case "recent-count": RecentCount = value.Int(); return true; case "queue": Queue = value == "yes"; return true; + case "dark-theme": DarkTheme = value.Trim('\'', '"'); return true; + case "light-theme": LightTheme = value.Trim('\'', '"'); return true; } return false; } diff --git a/mpv.net/Misc/Command.cs b/mpv.net/Misc/Command.cs index c66dd6e..ff3ba20 100644 --- a/mpv.net/Misc/Command.cs +++ b/mpv.net/Misc/Command.cs @@ -1,4 +1,5 @@ -using System; + +using System; using System.Diagnostics; using System.IO; using System.Linq; diff --git a/mpv.net/Misc/Help.cs b/mpv.net/Misc/Help.cs new file mode 100644 index 0000000..1419e42 --- /dev/null +++ b/mpv.net/Misc/Help.cs @@ -0,0 +1,11 @@ +using System; + +class ConsoleHelp +{ + public static void WriteError(object obj) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine(obj?.ToString()); + Console.ResetColor(); + } +} \ No newline at end of file diff --git a/mpv.net/Misc/Program.cs b/mpv.net/Misc/Program.cs index 95800b2..b947c3d 100644 --- a/mpv.net/Misc/Program.cs +++ b/mpv.net/Misc/Program.cs @@ -17,7 +17,11 @@ namespace mpvnet Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - if (mp.ConfigFolder == "") return; + if (App.IsStartedFromTerminal) + Native.AttachConsole(-1 /*ATTACH_PARENT_PROCESS*/); + + if (mp.ConfigFolder == "") + return; string[] args = Environment.GetCommandLineArgs().Skip(1).ToArray(); @@ -62,20 +66,26 @@ namespace mpvnet data.cbData = data.lpData.Length * 2 + 1; Native.SendMessage(proc.MainWindowHandle, 0x004A /*WM_COPYDATA*/, IntPtr.Zero, ref data); mutex.Dispose(); + + if (App.IsStartedFromTerminal) + Native.FreeConsole(); + return; } } + Thread.Sleep(50); } + mutex.Dispose(); return; } - if (App.IsStartedFromTerminal) - Native.AttachConsole(-1 /*ATTACH_PARENT_PROCESS*/); - Application.Run(new MainForm()); - if (App.IsStartedFromTerminal) Native.FreeConsole(); + + if (App.IsStartedFromTerminal) + Native.FreeConsole(); + mutex.Dispose(); } catch (Exception ex) diff --git a/mpv.net/Misc/Theme.cs b/mpv.net/Misc/Theme.cs new file mode 100644 index 0000000..9a56e28 --- /dev/null +++ b/mpv.net/Misc/Theme.cs @@ -0,0 +1,96 @@ + +using System.Collections.Generic; +using System.Windows.Media; + +namespace UI +{ + public class Theme + { + public string Name { get; set; } + public Dictionary Dictionary { get; } = new Dictionary(); + + public static List DefaultThemes { get; set; } + public static List CustomThemes { get; set; } + + public static Theme Current { get; set; } + + public static Brush Foreground { get; set; } + public static Brush Foreground2 { get; set; } + public static Brush Background { get; set; } + public static Brush Heading { get; set; } + + public System.Drawing.Color GetWinFormsColor(string key) + { + return System.Drawing.ColorTranslator.FromHtml(Dictionary[key]); + } + + public Brush GetBrush(string key) + { + return new SolidColorBrush((Color)ColorConverter.ConvertFromString(Dictionary[key])); + } + + public static void Init(string customContent, string defaultContent, string activeTheme) + { + DefaultThemes = Load(defaultContent); + CustomThemes = Load(customContent); + + foreach (Theme theme in CustomThemes) + { + if (theme.Name == activeTheme) + { + bool isKeyMissing = false; + + foreach (string key in DefaultThemes[0].Dictionary.Keys) + { + if (!theme.Dictionary.ContainsKey(key)) + { + isKeyMissing = true; + ConsoleHelp.WriteError($"Theme '{activeTheme}' misses '{key}'"); + break; + } + } + + if (!isKeyMissing) + Current = theme; + + break; + } + } + + if (Current == null) + foreach (Theme theme in DefaultThemes) + if (theme.Name == activeTheme) + Current = theme; + + if (Current == null) + Current = DefaultThemes[0]; + + Foreground = Current.GetBrush("foreground"); + Foreground2 = Current.GetBrush("foreground2"); + Background = Current.GetBrush("background"); + Heading = Current.GetBrush("heading"); + } + + static List Load(string content) + { + List list = new List(); + Theme theme = null; + + foreach (string currentLine in (content ?? "").Split(new [] { '\r', '\n' })) + { + string line = currentLine.Trim(); + + if (line.StartsWith("[") && line.EndsWith("]")) + list.Add(theme = new Theme() { Name = line.Substring(1, line.Length - 2).Trim() }); + + if (line.Contains("=") && theme != null) + { + string left = line.Substring(0, line.IndexOf("=")).Trim(); + theme.Dictionary[left] = line.Substring(line.IndexOf("=") + 1).Trim(); + } + } + + return list; + } + } +} \ No newline at end of file diff --git a/mpv.net/Properties/Resources.Designer.cs b/mpv.net/Properties/Resources.Designer.cs index 1fc93bf..8cf664f 100644 --- a/mpv.net/Properties/Resources.Designer.cs +++ b/mpv.net/Properties/Resources.Designer.cs @@ -71,9 +71,9 @@ namespace mpvnet.Properties { ///options = [{ name = "no", help = "always use software decoding" }, /// { name = "auto", hel [rest of string was truncated]";. /// - internal static string ConfToml { + internal static string confToml { get { - return ResourceManager.GetString("ConfToml", resourceCulture); + return ResourceManager.GetString("confToml", resourceCulture); } } @@ -105,7 +105,7 @@ namespace mpvnet.Properties { ///keep-open = yes ///keep-open-pause = no ///osd-playing-msg = '${filename}' - ///script-opts=osc-scalewindowed=1.5 + ///script-opts = osc-scalewindowed=1.5 ///screenshot-directory = '~~desktop/' ///cscale = spline36 ///dscale = spline36 @@ -132,12 +132,37 @@ namespace mpvnet.Properties { } /// - /// Looks up a localized string similar to dark-color = '#1E90FF' - ///light-color = '#28394F'. + /// Looks up a localized string similar to + ///[dark] + /// + ///heading = #1E90FF + ///foreground = #FFFFFF + ///foreground2 = #C0C0C0 + ///background = #323232 + /// + ///menu-foreground = #FFFFFF + ///menu-background = #323232 + ///menu-highlight = #505050 + ///menu-border = #FFFFFF + ///menu-checked = #5A5A5A + /// + ///[light] + /// + ///heading = #0068B2 + ///foreground = #000000 + ///foreground2 = #4C4C4C + ///background = #F7F7F7 + /// + ///menu-foreground = #000000 + ///menu-background = #DFDFDF + ///menu-highlight = #BFBFBF + ///menu-border = #6A6A6A + ///menu-checked = #AAAAAA + ///. /// - internal static string mpvNetConf { + internal static string theme { get { - return ResourceManager.GetString("mpvNetConf", resourceCulture); + return ResourceManager.GetString("theme", resourceCulture); } } } diff --git a/mpv.net/Properties/Resources.resx b/mpv.net/Properties/Resources.resx index 945d49b..6bfa498 100644 --- a/mpv.net/Properties/Resources.resx +++ b/mpv.net/Properties/Resources.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + ..\Resources\ConfToml.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 @@ -130,7 +130,7 @@ ..\Resources\mpvnet.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\mpvNetConf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + ..\Resources\theme.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 \ No newline at end of file diff --git a/mpv.net/Resources/ConfToml.txt b/mpv.net/Resources/ConfToml.txt index ccbdc1a..b055785 100644 --- a/mpv.net/Resources/ConfToml.txt +++ b/mpv.net/Resources/ConfToml.txt @@ -537,24 +537,13 @@ options = [{ name = "always" }, { name = "never" }] [[settings]] -name = "dark-color" +name = "dark-theme" file = "mpvnet" -type = "color" filter = "UI" -help = "Theme color used in dark-mode. Leave empty to use OS theme. (mpv.net specific setting)" +help = "Color theme used in dark mode. Default: dark" [[settings]] -name = "light-color" +name = "light-theme" file = "mpvnet" -type = "color" filter = "UI" -help = "Theme color used when dark-mode is disabled. Leave empty to use OS theme. (mpv.net specific setting)" - -[[settings]] -name = "themed-menu" -file = "mpvnet" -default = "no" -filter = "UI" -help = "Follow theme color in context menu. (mpv.net specific setting)" -options = [{ name = "yes" }, - { name = "no" }] \ No newline at end of file +help = "Color theme used in light mode. Default: light" \ No newline at end of file diff --git a/mpv.net/Resources/mpvNetConf.txt b/mpv.net/Resources/mpvNetConf.txt deleted file mode 100644 index 77e3277..0000000 --- a/mpv.net/Resources/mpvNetConf.txt +++ /dev/null @@ -1,2 +0,0 @@ -dark-color = '#1E90FF' -light-color = '#28394F' \ No newline at end of file diff --git a/mpv.net/Resources/theme.txt b/mpv.net/Resources/theme.txt new file mode 100644 index 0000000..a067167 --- /dev/null +++ b/mpv.net/Resources/theme.txt @@ -0,0 +1,27 @@ + +[dark] + +heading = #1E90FF +foreground = #FFFFFF +foreground2 = #C0C0C0 +background = #323232 + +menu-foreground = #FFFFFF +menu-background = #323232 +menu-highlight = #505050 +menu-border = #FFFFFF +menu-checked = #5A5A5A + + +[light] + +heading = #0068B2 +foreground = #000000 +foreground2 = #4C4C4C +background = #F7F7F7 + +menu-foreground = #000000 +menu-background = #DFDFDF +menu-highlight = #BFBFBF +menu-border = #6A6A6A +menu-checked = #AAAAAA diff --git a/mpv.net/Scripting/PowerShellScript.cs b/mpv.net/Scripting/PowerShellScript.cs index be7fd9a..362020a 100644 --- a/mpv.net/Scripting/PowerShellScript.cs +++ b/mpv.net/Scripting/PowerShellScript.cs @@ -94,20 +94,24 @@ namespace mpvnet public void Output_DataReady(object sender, EventArgs e) { - if (!WriteStandard) return; + if (!WriteStandard) + return; + var output = sender as PipelineReader; + while (output.Count > 0) Console.WriteLine("[" + ModuleName + "] " + output.Read().ToString()); } public void Error_DataReady(object sender, EventArgs e) { - if (!WriteError) return; + if (!WriteError) + return; + var output = sender as PipelineReader; - Console.ForegroundColor = ConsoleColor.Red; + while (output.Count > 0) - Console.WriteLine("[" + ModuleName + "] " + output.Read().ToString()); - Console.ResetColor(); + ConsoleHelp.WriteError("[" + ModuleName + "] " + output.Read().ToString()); } } } diff --git a/mpv.net/WPF/AboutWindow.xaml b/mpv.net/WPF/AboutWindow.xaml index 4838722..a3a5130 100644 --- a/mpv.net/WPF/AboutWindow.xaml +++ b/mpv.net/WPF/AboutWindow.xaml @@ -3,9 +3,19 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:UI="clr-namespace:UI" mc:Ignorable="d" - Title="About mpv.net" Height="230" Width="400" FontSize="16" ShowInTaskbar="False" - WindowStartupLocation="CenterOwner" ResizeMode="NoResize"> + + Title="About mpv.net" + Height="230" + Width="400" + FontSize="16" + ShowInTaskbar="False" + WindowStartupLocation="CenterOwner" + ResizeMode="NoResize" + Foreground="{x:Static UI:Theme.Foreground}" + Background="{x:Static UI:Theme.Background}"> + mpv.net diff --git a/mpv.net/WPF/CommandPaletteWindow.xaml b/mpv.net/WPF/CommandPaletteWindow.xaml index b518e02..7e64410 100644 --- a/mpv.net/WPF/CommandPaletteWindow.xaml +++ b/mpv.net/WPF/CommandPaletteWindow.xaml @@ -3,21 +3,41 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:UI="clr-namespace:UI" mc:Ignorable="d" - Title="Command Palette" Height="295" Width="400" ResizeMode="NoResize" - WindowStartupLocation="CenterOwner" Loaded="Window_Loaded" FontSize="13"> + + Title="Command Palette" + Height="295" + Width="400" + FontSize="13" + ResizeMode="NoResize" + WindowStartupLocation="CenterOwner" + Loaded="Window_Loaded"> + - - + + + + + + @@ -25,8 +45,12 @@ + - + + diff --git a/mpv.net/WPF/CommandPaletteWindow.xaml.cs b/mpv.net/WPF/CommandPaletteWindow.xaml.cs index f4be8b3..821a086 100644 --- a/mpv.net/WPF/CommandPaletteWindow.xaml.cs +++ b/mpv.net/WPF/CommandPaletteWindow.xaml.cs @@ -23,14 +23,6 @@ namespace mpvnet var yourCostumFilter = new Predicate(item => Filter((CommandItem)item)); CollectionView.Filter = yourCostumFilter; ListView.ItemsSource = CollectionView; - - if (App.IsDarkMode) - { - ListView.Foreground = Brushes.White; - ListView.Background = Brushes.Black; - FilterTextBox.Foreground = Brushes.White; - FilterTextBox.Background = Brushes.Black; - } } bool Filter(CommandItem item) diff --git a/mpv.net/WPF/ConfWindow.xaml b/mpv.net/WPF/ConfWindow.xaml index 2d07ef1..769c2ea 100644 --- a/mpv.net/WPF/ConfWindow.xaml +++ b/mpv.net/WPF/ConfWindow.xaml @@ -3,35 +3,63 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:WPF="clr-namespace:WPF" + xmlns:UI="clr-namespace:UI" mc:Ignorable="d" - Height="530" Width="700" Loaded="ConfWindow1_Loaded" ShowInTaskbar="False" - WindowStartupLocation="CenterScreen" Title="Config Editor"> + + Title="Config Editor" + Height="530" + Width="700" + Foreground="{x:Static UI:Theme.Foreground}" + Background="{x:Static UI:Theme.Background}" + ShowInTaskbar="False" + WindowStartupLocation="CenterScreen" + Loaded="ConfWindow1_Loaded"> + + - - + + + + + + - + + - Open config folder - Preview mpv.conf - Show mpv manual - Show support forum + + Open config folder + Preview mpv.conf + Show mpv manual + Show support forum \ No newline at end of file diff --git a/mpv.net/WPF/ConfWindow.xaml.cs b/mpv.net/WPF/ConfWindow.xaml.cs index 332cf91..0e4e4d0 100644 --- a/mpv.net/WPF/ConfWindow.xaml.cs +++ b/mpv.net/WPF/ConfWindow.xaml.cs @@ -1,26 +1,26 @@ -using System; + +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; +using System.Linq; +using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using System.Windows.Media; -using System.Linq; using DynamicGUI; -using System.Text; namespace mpvnet { public partial class ConfWindow : Window { - private List SettingsDefinitions = Settings.LoadSettings(Properties.Resources.ConfToml); - private List ConfItems = new List(); + List SettingsDefinitions = Settings.LoadSettings(Properties.Resources.confToml); + List ConfItems = new List(); public ObservableCollection FilterStrings { get; } = new ObservableCollection(); string InitialContent; - + public ConfWindow() { InitializeComponent(); @@ -31,23 +31,8 @@ namespace mpvnet LoadSettings(); InitialContent = GetCompareString(); SearchControl.Text = RegHelp.GetString(App.RegPath, "ConfigEditorSearch"); - - if (App.IsDarkMode) - { - Foreground = Brushes.White; - Foreground2 = Brushes.Silver; - Background = Brushes.Black; - } } - public Brush Foreground2 { - get { return (Brush)GetValue(Foreground2Property); } - set { SetValue(Foreground2Property, value); } - } - - public static readonly DependencyProperty Foreground2Property = - DependencyProperty.Register("Foreground2", typeof(Brush), typeof(ConfWindow), new PropertyMetadata(Brushes.DarkSlateGray)); - private void LoadSettings() { foreach (SettingBase setting in SettingsDefinitions) @@ -70,12 +55,10 @@ namespace mpvnet { case StringSetting s: var sc = new StringSettingControl(s); - sc.TitleTextBox.Foreground = WPF.WPF.ThemeBrush; MainStackPanel.Children.Add(sc); break; case OptionSetting s: var oc = new OptionSettingControl(s); - oc.TitleTextBox.Foreground = WPF.WPF.ThemeBrush; MainStackPanel.Children.Add(oc); break; } diff --git a/mpv.net/WPF/EverythingWindow.xaml b/mpv.net/WPF/EverythingWindow.xaml index 6cb0acd..f6665fa 100644 --- a/mpv.net/WPF/EverythingWindow.xaml +++ b/mpv.net/WPF/EverythingWindow.xaml @@ -3,21 +3,42 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:UI="clr-namespace:UI" mc:Ignorable="d" - Title="Media File Search" Height="300" Width="600" ResizeMode="NoResize" - WindowStartupLocation="CenterOwner" Loaded="Window_Loaded" FontSize="13"> + + Title="Media File Search" + FontSize="13" + Height="300" + Width="600" + ResizeMode="NoResize" + WindowStartupLocation="CenterOwner" + Loaded="Window_Loaded"> + - - + + + + + + \ No newline at end of file diff --git a/mpv.net/WPF/EverythingWindow.xaml.cs b/mpv.net/WPF/EverythingWindow.xaml.cs index 4661338..f76fb88 100644 --- a/mpv.net/WPF/EverythingWindow.xaml.cs +++ b/mpv.net/WPF/EverythingWindow.xaml.cs @@ -1,4 +1,5 @@ -using System; + +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; @@ -8,7 +9,6 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; -using System.Windows.Media; namespace mpvnet { @@ -17,19 +17,10 @@ namespace mpvnet public EverythingWindow() { InitializeComponent(); - - if (App.IsDarkMode) - { - ListView.Foreground = Brushes.White; - ListView.Background = Brushes.Black; - FilterTextBox.Foreground = Brushes.White; - FilterTextBox.Background = Brushes.Black; - } } const int EVERYTHING_REQUEST_FILE_NAME = 0x00000001; const int EVERYTHING_REQUEST_PATH = 0x00000002; - const int EVERYTHING_SORT_SIZE_DESCENDING = 6; [DllImport("Everything.dll", CharSet = CharSet.Unicode)] public static extern int Everything_SetSearch(string lpSearchString); @@ -69,6 +60,7 @@ namespace mpvnet { if (msg == 0x200 /*WM_MOUSEMOVE*/ && Mouse.LeftButton != MouseButtonState.Pressed) handled = true; + return IntPtr.Zero; } @@ -101,14 +93,18 @@ namespace mpvnet private void ListView_PreviewKeyDown(object sender, KeyEventArgs e) { - if (e.Key == Key.Escape) Close(); - if (e.Key == Key.Enter) Execute(); + if (e.Key == Key.Escape) + Close(); + + if (e.Key == Key.Enter) + Execute(); } void Execute() { if (ListView.SelectedItem != null) mp.Load(new[] { ListView.SelectedItem as string }, true, Keyboard.Modifiers == ModifierKeys.Control); + Keyboard.Focus(FilterTextBox); } diff --git a/mpv.net/WPF/InputWindow.xaml b/mpv.net/WPF/InputWindow.xaml index 5ad37e5..5c5f2c6 100644 --- a/mpv.net/WPF/InputWindow.xaml +++ b/mpv.net/WPF/InputWindow.xaml @@ -3,15 +3,25 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:UI="clr-namespace:UI" mc:Ignorable="d" - Title="Input Editor" Height="500" Width="750" FontSize="13" - Loaded="Window_Loaded" Closed="Window_Closed" ShowInTaskbar="False"> + + Title="Input Editor" + Height="500" + Width="750" + FontSize="13" + ShowInTaskbar="False" + Foreground="{x:Static UI:Theme.Foreground}" + Background="{x:Static UI:Theme.Background}" + Loaded="Window_Loaded" + Closed="Window_Closed"> + + - - + + + + + + @@ -37,7 +61,9 @@ + + diff --git a/mpv.net/WPF/InputWindow.xaml.cs b/mpv.net/WPF/InputWindow.xaml.cs index 61a07f1..47534fe 100644 --- a/mpv.net/WPF/InputWindow.xaml.cs +++ b/mpv.net/WPF/InputWindow.xaml.cs @@ -1,4 +1,5 @@ -using System; + +using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; @@ -6,7 +7,6 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; -using System.Windows.Media; namespace mpvnet { @@ -26,23 +26,8 @@ namespace mpvnet var yourCostumFilter = new Predicate(item => Filter((CommandItem)item)); CollectionView.Filter = yourCostumFilter; DataGrid.ItemsSource = CollectionView; - - if (App.IsDarkMode) - { - Foreground = Brushes.White; - Foreground2 = Brushes.Silver; - Background = Brushes.Black; - } } - public Brush Foreground2 { - get { return (Brush)GetValue(Foreground2Property); } - set { SetValue(Foreground2Property, value); } - } - - public static readonly DependencyProperty Foreground2Property = - DependencyProperty.Register("Foreground2", typeof(Brush), typeof(InputWindow), new PropertyMetadata(Brushes.DarkSlateGray)); - private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e) { CollectionView.Refresh(); diff --git a/mpv.net/WPF/LearnWindow.xaml b/mpv.net/WPF/LearnWindow.xaml index 021cf22..43cadbf 100644 --- a/mpv.net/WPF/LearnWindow.xaml +++ b/mpv.net/WPF/LearnWindow.xaml @@ -3,21 +3,47 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:UI="clr-namespace:UI" mc:Ignorable="d" - Title="Learn Input" Height="200" Width="400" WindowStartupLocation="CenterOwner" - ResizeMode="NoResize" Loaded="Window_Loaded" Background="Black" MouseWheel="Window_MouseWheel" MouseUp="Window_MouseUp" MouseDoubleClick="Window_MouseDoubleClick" TextInput="Window_TextInput"> + + Title="Learn Input" + Height="200" + Width="400" + WindowStartupLocation="CenterOwner" + ResizeMode="NoResize" + Loaded="Window_Loaded" + Foreground="{x:Static UI:Theme.Foreground}" + Background="{x:Static UI:Theme.Background}" + MouseWheel="Window_MouseWheel" + MouseUp="Window_MouseUp" + MouseDoubleClick="Window_MouseDoubleClick" + TextInput="Window_TextInput"> + + - - + + + + + diff --git a/mpv.net/WPF/LearnWindow.xaml.cs b/mpv.net/WPF/LearnWindow.xaml.cs index eafac5f..f0ea4ec 100644 --- a/mpv.net/WPF/LearnWindow.xaml.cs +++ b/mpv.net/WPF/LearnWindow.xaml.cs @@ -1,9 +1,11 @@ -using System; + +using System; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Input; using System.Windows.Interop; -using WF = System.Windows.Forms; + +using WinForms = System.Windows.Forms; namespace mpvnet { @@ -17,7 +19,7 @@ namespace mpvnet private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { - WF.Message m = new WF.Message(); + WinForms.Message m = new WinForms.Message(); m.HWnd = hwnd; m.Msg = msg; m.WParam = wParam; @@ -26,10 +28,10 @@ namespace mpvnet return m.Result; } - void OnKeyUp(WF.KeyEventArgs e) + void OnKeyUp(WinForms.KeyEventArgs e) { - if (e.KeyCode == WF.Keys.ControlKey || e.KeyCode == WF.Keys.ShiftKey || - e.KeyCode == WF.Keys.Menu || e.KeyCode == WF.Keys.None) + if (e.KeyCode == WinForms.Keys.ControlKey || e.KeyCode == WinForms.Keys.ShiftKey || + e.KeyCode == WinForms.Keys.Menu || e.KeyCode == WinForms.Keys.None) return; @@ -49,70 +51,70 @@ namespace mpvnet switch (e.KeyCode) { - case WF.Keys.NumPad0: - case WF.Keys.NumPad1: - case WF.Keys.NumPad2: - case WF.Keys.NumPad3: - case WF.Keys.NumPad4: - case WF.Keys.NumPad5: - case WF.Keys.NumPad6: - case WF.Keys.NumPad7: - case WF.Keys.NumPad8: - case WF.Keys.NumPad9: + case WinForms.Keys.NumPad0: + case WinForms.Keys.NumPad1: + case WinForms.Keys.NumPad2: + case WinForms.Keys.NumPad3: + 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 WF.Keys.Space: + case WinForms.Keys.Space: text = "Space"; break; - case WF.Keys.Enter: + case WinForms.Keys.Enter: text = "Enter"; break; - case WF.Keys.Tab: + case WinForms.Keys.Tab: text = "TAB"; break; - case WF.Keys.Back: + case WinForms.Keys.Back: text = "BS"; break; - case WF.Keys.Delete: + case WinForms.Keys.Delete: text = "DEL"; break; - case WF.Keys.Insert: + case WinForms.Keys.Insert: text = "INS"; break; - case WF.Keys.Home: + case WinForms.Keys.Home: text = "Home"; break; - case WF.Keys.End: + case WinForms.Keys.End: text = "END"; break; - case WF.Keys.PageUp: + case WinForms.Keys.PageUp: text = "PGUP"; break; - case WF.Keys.PageDown: + case WinForms.Keys.PageDown: text = "PGDWN"; break; - case WF.Keys.Escape: + case WinForms.Keys.Escape: text = "ESC"; break; - case WF.Keys.PrintScreen: + case WinForms.Keys.PrintScreen: text = "Print"; break; - case WF.Keys.Play: + case WinForms.Keys.Play: text = "Play"; break; - case WF.Keys.Pause: + case WinForms.Keys.Pause: text = "Pause"; break; - case WF.Keys.MediaPlayPause: + case WinForms.Keys.MediaPlayPause: text = "PlayPause"; break; - case WF.Keys.MediaStop: + case WinForms.Keys.MediaStop: text = "Stop"; break; - case WF.Keys.MediaNextTrack: + case WinForms.Keys.MediaNextTrack: text = "Next"; break; - case WF.Keys.MediaPreviousTrack: + case WinForms.Keys.MediaPreviousTrack: text = "Prev"; break; - case WF.Keys.VolumeUp: + case WinForms.Keys.VolumeUp: text = "Volume_Up"; break; - case WF.Keys.VolumeDown: + case WinForms.Keys.VolumeDown: text = "Volume_Down"; break; - case WF.Keys.VolumeMute: + case WinForms.Keys.VolumeMute: text = "Mute"; break; - case WF.Keys.BrowserHome: + case WinForms.Keys.BrowserHome: text = "Homepage"; break; - case WF.Keys.LaunchMail: + case WinForms.Keys.LaunchMail: text = "Mail"; break; - case WF.Keys.BrowserFavorites: + case WinForms.Keys.BrowserFavorites: text = "Favorites"; break; - case WF.Keys.BrowserSearch: + case WinForms.Keys.BrowserSearch: text = "Search"; break; - case WF.Keys.Sleep: + case WinForms.Keys.Sleep: text = "Sleep"; break; - case WF.Keys.Cancel: + case WinForms.Keys.Cancel: text = "Cancel"; break; } @@ -130,9 +132,14 @@ namespace mpvnet if (text == "#") text = "SHARP"; - if (isAlt && !wasModified) text = "ALT+" + text; - if (isShift && !wasModified) text = "SHIFT+" + text; - if (isCtrl && !wasModified) text = "CTRL+" + text; + if (isAlt && !wasModified) + text = "ALT+" + text; + + if (isShift && !wasModified) + text = "SHIFT+" + text; + + if (isCtrl && !wasModified) + text = "CTRL+" + text; if (!string.IsNullOrEmpty(text)) SetKey(text); @@ -151,25 +158,29 @@ namespace mpvnet [DllImport("user32.dll")] static extern uint MapVirtualKey(uint uCode, uint uMapType); - public static WF.Keys ModifierKeys { + public static WinForms.Keys ModifierKeys { get { - WF.Keys keys = WF.Keys.None; + WinForms.Keys keys = WinForms.Keys.None; + if (GetKeyState(17) < (short)0) - keys |= WF.Keys.Control; + keys |= WinForms.Keys.Control; + if (GetKeyState(16) < (short)0) - keys |= WF.Keys.Shift; + keys |= WinForms.Keys.Shift; + if (GetKeyState(18) < (short)0) - keys |= WF.Keys.Alt; + keys |= WinForms.Keys.Alt; + return keys; } } - void ProcessKeyEventArgs(ref WF.Message m) + void ProcessKeyEventArgs(ref WinForms.Message m) { int WM_KEYUP = 0x0101, WM_SYSKEYUP = 0x0105, WM_APPCOMMAND = 0x0319; if (m.Msg == WM_KEYUP || m.Msg == WM_SYSKEYUP) - OnKeyUp(new WF.KeyEventArgs((WF.Keys)(unchecked((int)(long)m.WParam)) | ModifierKeys)); + OnKeyUp(new WinForms.KeyEventArgs((WinForms.Keys)(unchecked((int)(long)m.WParam)) | ModifierKeys)); else if (m.Msg == WM_APPCOMMAND) { var value = (AppCommand)(m.LParam.ToInt64() >> 16 & ~0xf000); diff --git a/mpv.net/WPF/Resources.xaml b/mpv.net/WPF/Resources.xaml index ddfa956..343110b 100644 --- a/mpv.net/WPF/Resources.xaml +++ b/mpv.net/WPF/Resources.xaml @@ -1,14 +1,23 @@  + xmlns:UI="clr-namespace:UI"> + + - - - - - - - - + + + + + + + \ No newline at end of file diff --git a/mpv.net/WPF/SetupWindow.xaml.cs b/mpv.net/WPF/SetupWindow.xaml.cs index bcab40f..744fd00 100644 --- a/mpv.net/WPF/SetupWindow.xaml.cs +++ b/mpv.net/WPF/SetupWindow.xaml.cs @@ -1,7 +1,9 @@ -using System; + +using System; using System.Diagnostics; using System.Windows; -using WF = System.Windows.Forms; + +using WinForms = System.Windows.Forms; namespace mpvnet { @@ -11,24 +13,29 @@ namespace mpvnet void RegisterFileAssociations(string value) { - using (var proc = new Process()) + try { - proc.StartInfo.FileName = System.Windows.Forms.Application.ExecutablePath; - proc.StartInfo.Arguments = "--reg-file-assoc " + value; - proc.StartInfo.Verb = "runas"; - try { proc.Start(); } catch { } - } + using (var proc = new Process()) + { + proc.StartInfo.FileName = WinForms.Application.ExecutablePath; + proc.StartInfo.Arguments = "--reg-file-assoc " + value; + proc.StartInfo.Verb = "runas"; + proc.Start(); + } + + Process.Start("ms-settings:defaultapps"); + } catch {} } private void RegisterVideo_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("video"); private void RegisterAudio_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("audio"); private void RegisterImage_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("image"); + private void UnregisterFileAssociations_Click(object sender, RoutedEventArgs e) => RegisterFileAssociations("unreg"); - private void ManageDefaultApps_Click(object sender, RoutedEventArgs e) => Process.Start("ms-settings:defaultapps"); private void AddToPathEnvVar_Click(object sender, RoutedEventArgs e) { - string var = WF.Application.StartupPath + ";"; + string var = WinForms.Application.StartupPath + ";"; string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User); if (path.Contains(var)) @@ -42,7 +49,7 @@ namespace mpvnet private void RemoveFromPathEnvVar_Click(object sender, RoutedEventArgs e) { - string var = WF.Application.StartupPath + ";"; + string var = WinForms.Application.StartupPath + ";"; string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User); if (path.Contains(var)) diff --git a/mpv.net/WPF/WPF.cs b/mpv.net/WPF/WPF.cs index 293ba79..980e6b9 100644 --- a/mpv.net/WPF/WPF.cs +++ b/mpv.net/WPF/WPF.cs @@ -1,68 +1,20 @@ using System; using System.Windows; -using System.Windows.Media; - -using Microsoft.Win32; -using mpvnet; namespace WPF { public class WPF { public static void Init() - { - EnsureApplicationResources(); - } - - public static void EnsureApplicationResources() { if (Application.Current == null) { new Application(); + Application.Current.Resources.MergedDictionaries.Add( Application.LoadComponent(new Uri("mpvnet;component/WPF/Resources.xaml", UriKind.Relative)) as ResourceDictionary); } } - - public static Brush ThemeBrush { get; } = new SolidColorBrush(ThemeColor); - - static bool WasThemeColorSet; - - static Color _ThemeColor; - - public static Color ThemeColor { - get { - if (!WasThemeColorSet) - { - Color? color = null; - - try { - if (App.IsDarkMode && !string.IsNullOrEmpty(App.DarkColor)) - color = (Color)ColorConverter.ConvertFromString(App.DarkColor); - else if (!App.IsDarkMode && !string.IsNullOrEmpty(App.LightColor)) - color = (Color)ColorConverter.ConvertFromString(App.LightColor); - } catch { } - - if (!color.HasValue) - { - if (Environment.OSVersion.Version.Major < 10) - { - int argb = Convert.ToInt32(Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM", "ColorizationColor", 0)); - var wfc = System.Drawing.Color.FromArgb(argb); - color = Color.FromArgb(wfc.A, wfc.R, wfc.G, wfc.B); - } - else - color = SystemParameters.WindowGlassColor; - } - - if (App.IsDarkMode && color == Colors.Black) color = Colors.Orange; - if (!App.IsDarkMode && color == Colors.White) color = Colors.Orange; - _ThemeColor = color.Value; - WasThemeColorSet = true; - } - return _ThemeColor; - } - } } } \ No newline at end of file diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index 8c64139..7afb8cb 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -1,4 +1,5 @@ -using System; + +using System; using System.Drawing; using System.IO; using System.Runtime.InteropServices; @@ -9,6 +10,7 @@ using System.ComponentModel; using System.Globalization; using System.Diagnostics; using System.Threading.Tasks; +using UI; namespace mpvnet { @@ -610,7 +612,10 @@ namespace mpvnet protected override void OnLoad(EventArgs e) { base.OnLoad(e); - if (mp.GPUAPI != "vulkan") mp.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold); + + if (mp.GPUAPI != "vulkan") + mp.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold); + SetFormPosAndSize(); } @@ -621,9 +626,12 @@ namespace mpvnet if (mp.GPUAPI == "vulkan") mp.ProcessCommandLine(false); - var wpfColor = WPF.WPF.ThemeColor; - Color color = Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B); - ToolStripRendererEx.InitColors(color, App.IsDarkMode, App.ThemedMenu); + ToolStripRendererEx.ForegroundColor = Theme.Current.GetWinFormsColor("menu-foreground"); + ToolStripRendererEx.BackgroundColor = Theme.Current.GetWinFormsColor("menu-background"); + ToolStripRendererEx.SelectionColor = Theme.Current.GetWinFormsColor("menu-highlight"); + ToolStripRendererEx.BorderColor = Theme.Current.GetWinFormsColor("menu-border"); + ToolStripRendererEx.CheckedColor = Theme.Current.GetWinFormsColor("menu-checked"); + BuildMenu(); ContextMenuStrip = ContextMenu; WPF.WPF.Init(); diff --git a/mpv.net/WinForms/Menu.cs b/mpv.net/WinForms/Menu.cs index bd1b2b8..c374cd2 100644 --- a/mpv.net/WinForms/Menu.cs +++ b/mpv.net/WinForms/Menu.cs @@ -130,49 +130,29 @@ public class MenuItem : ToolStripMenuItem public class ToolStripRendererEx : ToolStripSystemRenderer { - public static Color ColorForeground { get; set; } = Color.Black; - public static Color ColorTheme { get; set; } - public static Color ColorChecked { get; set; } - public static Color ColorBorder { get; set; } - public static Color ColorTop { get; set; } - public static Color ColorSelection { get; set; } - public static Color ColorBackground { get; set; } + public static Color ForegroundColor { get; set; } + public static Color BackgroundColor { get; set; } + public static Color SelectionColor { get; set; } + public static Color CheckedColor { get; set; } + public static Color BorderColor { get; set; } int TextOffset; - public static void InitColors(Color themeColor, bool darkMode, bool themed) + public static void SetDefaultColors() { - if (darkMode) - { - ColorBorder = Color.White; - ColorBackground = Color.FromArgb(50, 50, 50); - ColorSelection = Color.FromArgb(80, 80, 80); - - if (themed) - ColorForeground = themeColor; - else - ColorForeground = Color.White; - - ColorChecked = Color.FromArgb(90, 90, 90); - } - else - { - if (!themed) themeColor = Color.FromArgb(238, 238, 238); - - ColorBorder = HSLColor.Convert(themeColor).ToColorSetLuminosity(100); - ColorChecked = HSLColor.Convert(themeColor).ToColorSetLuminosity(160); - ColorSelection = HSLColor.Convert(themeColor).ToColorSetLuminosity(180); - ColorBackground = HSLColor.Convert(themeColor).ToColorSetLuminosity(210); - ColorTop = HSLColor.Convert(themeColor).ToColorSetLuminosity(240); - } + ForegroundColor = Color.FromArgb(unchecked((int)0xFF000000)); + BackgroundColor = Color.FromArgb(unchecked((int)0xFFDFDFDF)); + SelectionColor = Color.FromArgb(unchecked((int)0xFFBFBFBF)); + CheckedColor = Color.FromArgb(unchecked((int)0xFFAAAAAA)); + BorderColor = Color.FromArgb(unchecked((int)0xFF6A6A6A)); } protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { Rectangle r = e.AffectedBounds; r.Inflate(-1, -1); - ControlPaint.DrawBorder(e.Graphics, r, ColorBackground, ButtonBorderStyle.Solid); - ControlPaint.DrawBorder(e.Graphics, e.AffectedBounds, ColorBorder, ButtonBorderStyle.Solid); + ControlPaint.DrawBorder(e.Graphics, r, BackgroundColor, ButtonBorderStyle.Solid); + ControlPaint.DrawBorder(e.Graphics, e.AffectedBounds, BorderColor, ButtonBorderStyle.Solid); } protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) @@ -189,7 +169,7 @@ public class ToolStripRendererEx : ToolStripSystemRenderer else TextOffset = Convert.ToInt32(e.Item.Height * 0.2); - e.TextColor = ColorForeground; + e.TextColor = ForegroundColor; e.TextRectangle = new Rectangle(TextOffset, Convert.ToInt32((e.Item.Height - rect.Height) / 2.0), rect.Width, rect.Height); } @@ -201,14 +181,14 @@ public class ToolStripRendererEx : ToolStripSystemRenderer Rectangle rect = new Rectangle(Point.Empty, e.Item.Size); if (!(e.Item.Owner is MenuStrip)) - e.Graphics.Clear(ColorBackground); + e.Graphics.Clear(BackgroundColor); if (e.Item.Selected && e.Item.Enabled) { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; rect = new Rectangle(rect.X + 2, rect.Y, rect.Width - 4, rect.Height - 1); rect.Inflate(-1, -1); - using (SolidBrush b = new SolidBrush(ColorSelection)) + using (SolidBrush b = new SolidBrush(SelectionColor)) e.Graphics.FillRectangle(b, rect); } } @@ -224,7 +204,7 @@ public class ToolStripRendererEx : ToolStripSystemRenderer float y3 = e.Item.Height * 0.75f; e.Graphics.SmoothingMode = SmoothingMode.HighQuality; - using (Brush b = new SolidBrush(ColorForeground)) + using (Brush b = new SolidBrush(ForegroundColor)) { using (Pen p = new Pen(b, Control.DefaultFont.Height / 20f)) { @@ -250,7 +230,7 @@ public class ToolStripRendererEx : ToolStripSystemRenderer rect = new Rectangle(rect.X + 2, rect.Y, rect.Height - 1, rect.Height - 1); rect.Inflate(-1, -1); - using (Brush brush = new SolidBrush(ColorChecked)) + using (Brush brush = new SolidBrush(CheckedColor)) e.Graphics.FillRectangle(brush, rect); float ellipseWidth = rect.Height / 3f; @@ -260,17 +240,17 @@ public class ToolStripRendererEx : ToolStripSystemRenderer ellipseWidth, ellipseWidth); - using (Brush brush = new SolidBrush(ColorForeground)) + using (Brush brush = new SolidBrush(ForegroundColor)) e.Graphics.FillEllipse(brush, rectF); } protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e) { - e.Graphics.Clear(ColorBackground); + e.Graphics.Clear(BackgroundColor); int top = e.Item.Height / 2; top -= 1; int offset = Convert.ToInt32(e.Item.Font.Height * 0.7); - using (Pen p = new Pen(ColorBorder)) + using (Pen p = new Pen(BorderColor)) e.Graphics.DrawLine(p, new Point(offset, top), new Point(e.Item.Width - offset, top)); diff --git a/mpv.net/mpv.net.csproj b/mpv.net/mpv.net.csproj index dacae27..c511049 100644 --- a/mpv.net/mpv.net.csproj +++ b/mpv.net/mpv.net.csproj @@ -116,6 +116,7 @@ + MSBuild:Compile Designer @@ -140,6 +141,8 @@ Designer MSBuild:Compile + + SearchTextBoxUserControl.xaml @@ -239,10 +242,9 @@ - + - diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index 138956e..5342e31 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -209,10 +209,8 @@ namespace mpvnet if (!File.Exists(_ConfigFolder + "mpv.conf")) File.WriteAllText(_ConfigFolder + "mpv.conf", Properties.Resources.mpvConf); - - if (!File.Exists(_ConfigFolder + "mpvnet.conf")) - File.WriteAllText(_ConfigFolder + "mpvnet.conf", Properties.Resources.mpvNetConf); } + return _ConfigFolder; } }