-
This commit is contained in:
@@ -5,7 +5,8 @@
|
|||||||
pdn and png source is located [here](https://github.com/stax76/mpv.net/tree/master/img)
|
pdn and png source is located [here](https://github.com/stax76/mpv.net/tree/master/img)
|
||||||
- everytime only one file is opened the complete folder is loaded in the playlist
|
- everytime only one file is opened the complete folder is loaded in the playlist
|
||||||
- the info command (i key) shows the audio format
|
- the info command (i key) shows the audio format
|
||||||
- new options osd-font-size, sub-font, sub-font-size, sub-color, sub-border-color, sub-back-color
|
- new options osd-font-size, sub-font, sub-font-size
|
||||||
|
- new color options with dedicated GUI support: sub-color, sub-border-color, sub-back-color
|
||||||
- the config editor no longer shows the command line switches
|
- the config editor no longer shows the command line switches
|
||||||
- the github start page was greatly improved
|
- the github start page was greatly improved
|
||||||
- the setup.ps1 PowerShell script was greatly improved in regard of error handling and readability
|
- the setup.ps1 PowerShell script was greatly improved in regard of error handling and readability
|
||||||
|
|||||||
@@ -165,6 +165,11 @@ Third party components:
|
|||||||
- [CS-Script, scripting with C#](http://www.csscript.net/)
|
- [CS-Script, scripting with C#](http://www.csscript.net/)
|
||||||
- [Everything, a blazing fast file search service](https://www.voidtools.com)
|
- [Everything, a blazing fast file search service](https://www.voidtools.com)
|
||||||
|
|
||||||
|
Due to mpv.net being my first WPF app and mpv.net never ment
|
||||||
|
to be a large application best practices and design pattern
|
||||||
|
are often ignored, also the coding style might not be the
|
||||||
|
best because I don't believe C has good syntax.
|
||||||
|
|
||||||
### Support
|
### Support
|
||||||
|
|
||||||
[Support thread in Doom9 forum](https://forum.doom9.org/showthread.php?t=174841)
|
[Support thread in Doom9 forum](https://forum.doom9.org/showthread.php?t=174841)
|
||||||
|
|||||||
@@ -49,14 +49,16 @@ namespace DynamicGUI
|
|||||||
StringSetting stringSetting = new StringSetting();
|
StringSetting stringSetting = new StringSetting();
|
||||||
baseSetting = stringSetting;
|
baseSetting = stringSetting;
|
||||||
stringSetting.Default = setting["default"];
|
stringSetting.Default = setting["default"];
|
||||||
if (setting.HasKey("folder")) stringSetting.IsFolder = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
baseSetting.Name = setting["name"];
|
baseSetting.Name = setting["name"];
|
||||||
baseSetting.Filter = setting["filter"];
|
baseSetting.Filter = setting["filter"];
|
||||||
|
|
||||||
if (setting.HasKey("help")) baseSetting.Help = setting["help"];
|
if (setting.HasKey("help")) baseSetting.Help = setting["help"];
|
||||||
if (setting.HasKey("helpurl")) baseSetting.HelpURL = setting["helpurl"];
|
if (setting.HasKey("helpurl")) baseSetting.HelpURL = setting["helpurl"];
|
||||||
if (setting.HasKey("width")) baseSetting.Width = setting["width"];
|
if (setting.HasKey("width")) baseSetting.Width = setting["width"];
|
||||||
|
if (setting.HasKey("type")) baseSetting.Type = setting["type"];
|
||||||
|
|
||||||
settingsList.Add(baseSetting);
|
settingsList.Add(baseSetting);
|
||||||
}
|
}
|
||||||
return settingsList;
|
return settingsList;
|
||||||
@@ -72,12 +74,12 @@ namespace DynamicGUI
|
|||||||
public string Default { get; set; }
|
public string Default { get; set; }
|
||||||
public string HelpURL { get; set; }
|
public string HelpURL { get; set; }
|
||||||
public string Filter { get; set; }
|
public string Filter { get; set; }
|
||||||
|
public string Type { get; set; }
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StringSetting : SettingBase
|
public class StringSetting : SettingBase
|
||||||
{
|
{
|
||||||
public bool IsFolder { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OptionSetting : SettingBase
|
public class OptionSetting : SettingBase
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBox x:Name="ValueTextBox" Text="{Binding Path=Text, ElementName=StringSettingControl1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="150" HorizontalAlignment="Left" Height="20" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" Background="{Binding Path=Background, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"/>
|
<TextBox x:Name="ValueTextBox" Text="{Binding Path=Text, ElementName=StringSettingControl1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="150" HorizontalAlignment="Left" Height="20" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" Background="{Binding Path=Background, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" TextChanged="ValueTextBox_TextChanged"/>
|
||||||
<Button x:Name="Button" Height="20" Grid.Column="1" Visibility="{Binding Path=Text, ElementName=StringSettingControl1}" Margin="5,0,0,0" Width="20" Click="Button_Click">...</Button>
|
<Button x:Name="Button" Height="20" Grid.Column="1" Visibility="{Binding Path=Text, ElementName=StringSettingControl1}" Margin="5,0,0,0" Width="20" Click="Button_Click">...</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBox x:Name="HelpTextBox" TextWrapping="WrapWithOverflow" Margin="0,0,0,10" BorderThickness="0" IsReadOnly="True" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" Background="{Binding Path=Background, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"></TextBox>
|
<TextBox x:Name="HelpTextBox" TextWrapping="WrapWithOverflow" Margin="0,0,0,10" BorderThickness="0" IsReadOnly="True" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" Background="{Binding Path=Background, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"></TextBox>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
using System.Windows;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using WinForms = System.Windows.Forms;
|
||||||
|
|
||||||
namespace DynamicGUI
|
namespace DynamicGUI
|
||||||
{
|
{
|
||||||
@@ -13,10 +17,10 @@ namespace DynamicGUI
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
TitleTextBox.Text = stringSetting.Name;
|
TitleTextBox.Text = stringSetting.Name;
|
||||||
HelpTextBox.Text = stringSetting.Help;
|
HelpTextBox.Text = stringSetting.Help;
|
||||||
ValueTextBox.Text = stringSetting.Value;
|
ValueTextBox.Text = StringSetting.Value;
|
||||||
if (stringSetting.Width > 0)
|
if (StringSetting.Width > 0)
|
||||||
ValueTextBox.Width = stringSetting.Width;
|
ValueTextBox.Width = StringSetting.Width;
|
||||||
if (!StringSetting.IsFolder)
|
if (StringSetting.Type != "folder" && StringSetting.Type != "color")
|
||||||
Button.Visibility = Visibility.Hidden;
|
Button.Visibility = Visibility.Hidden;
|
||||||
Link.SetURL(StringSetting.HelpURL);
|
Link.SetURL(StringSetting.HelpURL);
|
||||||
if (string.IsNullOrEmpty(stringSetting.HelpURL))
|
if (string.IsNullOrEmpty(stringSetting.HelpURL))
|
||||||
@@ -29,7 +33,6 @@ namespace DynamicGUI
|
|||||||
get {
|
get {
|
||||||
if (_SearchableText is null)
|
if (_SearchableText is null)
|
||||||
_SearchableText = (TitleTextBox.Text + HelpTextBox.Text +ValueTextBox.Text).ToLower();
|
_SearchableText = (TitleTextBox.Text + HelpTextBox.Text +ValueTextBox.Text).ToLower();
|
||||||
|
|
||||||
return _SearchableText;
|
return _SearchableText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,13 +48,56 @@ namespace DynamicGUI
|
|||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
using (var d = new System.Windows.Forms.FolderBrowserDialog())
|
switch (StringSetting.Type)
|
||||||
|
{
|
||||||
|
case "folder":
|
||||||
|
using (var d = new WinForms.FolderBrowserDialog())
|
||||||
{
|
{
|
||||||
d.Description = "Choose a folder.";
|
d.Description = "Choose a folder.";
|
||||||
d.SelectedPath = ValueTextBox.Text;
|
d.SelectedPath = ValueTextBox.Text;
|
||||||
if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||||
ValueTextBox.Text = d.SelectedPath;
|
ValueTextBox.Text = d.SelectedPath;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "color":
|
||||||
|
using (var d = new WinForms.ColorDialog())
|
||||||
|
{
|
||||||
|
d.FullOpen = true;
|
||||||
|
try {
|
||||||
|
d.Color = System.Drawing.ColorTranslator.FromHtml(ValueTextBox.Text);
|
||||||
|
} catch { }
|
||||||
|
if (d.ShowDialog() == WinForms.DialogResult.OK)
|
||||||
|
ValueTextBox.Text = System.Drawing.ColorTranslator.ToHtml(d.Color);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ValueTextBox_TextChanged(object sender, TextChangedEventArgs e) => Update();
|
||||||
|
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
if (StringSetting.Type == "color")
|
||||||
|
{
|
||||||
|
Color c = Colors.Transparent;
|
||||||
|
if (ValueTextBox.Text != "")
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (ValueTextBox.Text.Contains("/"))
|
||||||
|
{
|
||||||
|
string[] a = ValueTextBox.Text.Split('/');
|
||||||
|
if (a.Length == 3)
|
||||||
|
c = Color.FromRgb(ToByte(a[0]), ToByte(a[1]), ToByte(a[2]));
|
||||||
|
else if (a.Length == 4)
|
||||||
|
c = Color.FromArgb(ToByte(a[3]), ToByte(a[0]), ToByte(a[1]), ToByte(a[2]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
c = (Color)ColorConverter.ConvertFromString(ValueTextBox.Text);
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
ValueTextBox.Background = new SolidColorBrush(c);
|
||||||
|
}
|
||||||
|
Byte ToByte(string val) => Convert.ToByte(Convert.ToSingle(val, CultureInfo.InvariantCulture) * 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,18 +193,21 @@ help = "Specify the sub font size. The unit is the size in scaled pixels at a wi
|
|||||||
[[settings]]
|
[[settings]]
|
||||||
name = "sub-color"
|
name = "sub-color"
|
||||||
default = ""
|
default = ""
|
||||||
|
type = "color"
|
||||||
filter = "Subtitle"
|
filter = "Subtitle"
|
||||||
help = "Specify the color used for unstyled text subtitles.\n\nThe color is specified in the form r/g/b, where each color component is specified as number in the range 0.0 to 1.0. It's also possible to specify the transparency by using r/g/b/a, where the alpha value 0 means fully transparent, and 1.0 means opaque. If the alpha component is not given, the color is 100% opaque.\n\nPassing a single number to the option sets the sub to gray, and the form gray/a lets you specify alpha additionally.\n\nExamples\n\n1.0/0.0/0.0 set sub to opaque red\n1.0/0.0/0.0/0.75 set sub to opaque red with 75% alpha\n0.5/0.75 set sub to 50% gray with 75% alpha\n\nAlternatively, the color can be specified as a RGB hex triplet in the form #RRGGBB, where each 2-digit group expresses a color value in the range 0 (00) to 255 (FF). For example, #FF0000 is red. This is similar to web colors. Alpha is given with #AARRGGBB.\n\nExamples\n\n#FF0000 set sub to opaque red\n#C0808080 set sub to 50% gray with 75% alpha"
|
help = "Specify the color used for unstyled text subtitles.\n\nThe color is specified in the form r/g/b, where each color component is specified as number in the range 0.0 to 1.0. It's also possible to specify the transparency by using r/g/b/a, where the alpha value 0 means fully transparent, and 1.0 means opaque. If the alpha component is not given, the color is 100% opaque.\n\nPassing a single number to the option sets the sub to gray, and the form gray/a lets you specify alpha additionally.\n\nExamples\n\n1.0/0.0/0.0 set sub to opaque red\n1.0/0.0/0.0/0.75 set sub to opaque red with 75% alpha\n0.5/0.75 set sub to 50% gray with 75% alpha\n\nAlternatively, the color can be specified as a RGB hex triplet in the form #RRGGBB, where each 2-digit group expresses a color value in the range 0 (00) to 255 (FF). For example, #FF0000 is red. This is similar to web colors. Alpha is given with #AARRGGBB.\n\nExamples\n\n#FF0000 set sub to opaque red\n#C0808080 set sub to 50% gray with 75% alpha"
|
||||||
|
|
||||||
[[settings]]
|
[[settings]]
|
||||||
name = "sub-border-color"
|
name = "sub-border-color"
|
||||||
default = ""
|
default = ""
|
||||||
|
type = "color"
|
||||||
filter = "Subtitle"
|
filter = "Subtitle"
|
||||||
help = "See --sub-color. Color used for the sub font border. Ignored when sub-back-color is specified (or more exactly: when that option is not set to completely transparent)."
|
help = "See --sub-color. Color used for the sub font border. Ignored when sub-back-color is specified (or more exactly: when that option is not set to completely transparent)."
|
||||||
|
|
||||||
[[settings]]
|
[[settings]]
|
||||||
name = "sub-back-color"
|
name = "sub-back-color"
|
||||||
default = ""
|
default = ""
|
||||||
|
type = "color"
|
||||||
filter = "Subtitle"
|
filter = "Subtitle"
|
||||||
help = "See sub-color. Color used for sub text background. You can use sub-shadow-offset to change its size relative to the text."
|
help = "See sub-color. Color used for sub text background. You can use sub-shadow-offset to change its size relative to the text."
|
||||||
|
|
||||||
@@ -240,7 +243,7 @@ options = [{ name = "yes" },
|
|||||||
name = "screenshot-directory"
|
name = "screenshot-directory"
|
||||||
default = ""
|
default = ""
|
||||||
width = 500
|
width = 500
|
||||||
folder = true
|
type = "folder"
|
||||||
filter = "Screen"
|
filter = "Screen"
|
||||||
help = "Store screenshots in this directory. This path is joined with the filename generated by screenshot-template. If the template filename is already absolute, the directory is ignored.\n\nIf the directory does not exist, it is created on the first screenshot. If it is not a directory, an error is generated when trying to write a screenshot.\n\nThis option is not set by default, and thus will write screenshots to the directory from which mpv was started. In pseudo-gui mode (see PSEUDO GUI MODE), this is set to the desktop."
|
help = "Store screenshots in this directory. This path is joined with the filename generated by screenshot-template. If the template filename is already absolute, the directory is ignored.\n\nIf the directory does not exist, it is created on the first screenshot. If it is not a directory, an error is generated when trying to write a screenshot.\n\nThis option is not set by default, and thus will write screenshots to the directory from which mpv was started. In pseudo-gui mode (see PSEUDO GUI MODE), this is set to the desktop."
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Windows;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using DynamicGUI;
|
using DynamicGUI;
|
||||||
|
|
||||||
@@ -215,6 +216,8 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
SearchControl.SearchTextBox.SelectAll();
|
SearchControl.SearchTextBox.SelectAll();
|
||||||
Keyboard.Focus(SearchControl.SearchTextBox);
|
Keyboard.Focus(SearchControl.SearchTextBox);
|
||||||
|
foreach (var i in MainStackPanel.Children.OfType<StringSettingControl>())
|
||||||
|
i.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user