Improved input editor theming

This commit is contained in:
Frank Skare
2021-05-28 21:58:32 +02:00
parent 3875e1c1bf
commit e128a4868b
4 changed files with 52 additions and 26 deletions

View File

@@ -3,8 +3,8 @@
========================= =========================
- `window-scale 1` does not work correctly in mpv, - `window-scale 1` does not work correctly in mpv,
so I've removed support for it and added my own implementation so I've removed support for it and added my own implementation:
that actually works: `script-message mpv.net window-scale`. `script-message mpv.net window-scale`.
- The CS-Script library was replaced with my own C# scripting implementation. - The CS-Script library was replaced with my own C# scripting implementation.
- If a player window border is near to a screen border and the window size - If a player window border is near to a screen border and the window size
changes, the player windows sticks to that near screen border location. changes, the player windows sticks to that near screen border location.
@@ -22,6 +22,7 @@
- Settings are stored in the file settings.xml now instead of the Registry. - Settings are stored in the file settings.xml now instead of the Registry.
- Video rotation support added. - Video rotation support added.
- After using the config editor it's no longer necessary to restart mpv.net. - After using the config editor it's no longer necessary to restart mpv.net.
- Improved input editor theming.
5.4.8.8 Beta (2021-05-09) 5.4.8.8 Beta (2021-05-09)

View File

@@ -12,11 +12,6 @@ menu-highlight = #505050
menu-border = #FFFFFF menu-border = #FFFFFF
menu-checked = #5A5A5A menu-checked = #5A5A5A
button-foreground = #DDDDDD
button-background = #505050
button-hover = #555555
button-border = #707070
[light] [light]
@@ -30,8 +25,3 @@ menu-background = #DFDFDF
menu-highlight = #BFBFBF menu-highlight = #BFBFBF
menu-border = #6A6A6A menu-border = #6A6A6A
menu-checked = #AAAAAA menu-checked = #AAAAAA
button-foreground = #000000
button-background = #BBBBBB
button-hover = #CCCCCC
button-border = #6A6A6A

View File

@@ -18,7 +18,7 @@
> >
<Window.Resources> <Window.Resources>
<Style x:Key="DataGrid_Font_Centering" TargetType="{x:Type DataGridCell}"> <Style x:Key="DataGridFontCentering" TargetType="{x:Type DataGridCell}">
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}"> <ControlTemplate TargetType="{x:Type DataGridCell}">
@@ -29,6 +29,19 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<LinearGradientBrush x:Key="HeaderBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="Gray" Offset="0"/>
<GradientStop Color="Gray" Offset="1"/>
<GradientStop Color="#323232" Offset="0.5"/>
</LinearGradientBrush>
<Style x:Key="HeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="{StaticResource HeaderBrush}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="MinHeight" Value="22" />
<Setter Property="Cursor" Value="Hand" />
</Style>
</Window.Resources> </Window.Resources>
<Grid> <Grid>
@@ -46,15 +59,27 @@
/> />
<DataGrid <DataGrid
x:Name="DataGrid" Name="DataGrid"
Grid.Row="1" Grid.Row="1"
CommandManager.PreviewCanExecute="DataGrid_PreviewCanExecute" CommandManager.PreviewCanExecute="DataGrid_PreviewCanExecute"
AutoGenerateColumns="False" AutoGenerateColumns="False"
CellStyle="{StaticResource DataGrid_Font_Centering}" ColumnHeaderStyle="{StaticResource HeaderStyle}"
Foreground="{Binding Theme.Foreground}"
Background="{Binding Theme.Background}"
RowBackground="{Binding Theme.Background}"
HorizontalGridLinesBrush="{Binding Theme.Foreground}"
VerticalGridLinesBrush="{Binding Theme.Foreground}"
CellStyle="{StaticResource DataGridFontCentering}"
> >
<DataGrid.Resources>
<Style BasedOn="{StaticResource {x:Type DataGridColumnHeader}}" TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="{Binding DataContext.Theme.Background, ElementName=DataGrid}" />
</Style>
</DataGrid.Resources>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="Menu" Binding="{Binding Path}"/> <DataGridTextColumn Header="Menu" Binding="{Binding Path}"/>
<DataGridTemplateColumn Header="Input"> <DataGridTemplateColumn Header="Input">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
@@ -65,9 +90,8 @@
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTextColumn Header="Command" Binding="{Binding Command}" MaxWidth="330" /> <DataGridTextColumn Header="Command" Binding="{Binding Command}" MaxWidth="330" />
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
</Grid> </Grid>

View File

@@ -42,6 +42,7 @@ namespace mpvnet
if (SearchControl.SearchTextBox.Text == "?") if (SearchControl.SearchTextBox.Text == "?")
{ {
SearchControl.SearchTextBox.Text = ""; SearchControl.SearchTextBox.Text = "";
Msg.ShowInfo("Filtering", Msg.ShowInfo("Filtering",
"Reduce the filter scope with:" + BR2 + "Reduce the filter scope with:" + BR2 +
"i input" + BR2 + "i input" + BR2 +
@@ -53,9 +54,13 @@ namespace mpvnet
bool Filter(CommandItem item) bool Filter(CommandItem item)
{ {
if (item.Command == "") return false; if (item.Command == "")
return false;
string searchText = SearchControl.SearchTextBox.Text.ToLower(); string searchText = SearchControl.SearchTextBox.Text.ToLower();
if (searchText == "" || searchText == "?") return true;
if (searchText == "" || searchText == "?")
return true;
if (searchText.Length == 1) if (searchText.Length == 1)
return item.Input.ToLower().Replace("ctrl+", "").Replace("shift+", "").Replace("alt+", "") == searchText.ToLower(); return item.Input.ToLower().Replace("ctrl+", "").Replace("shift+", "").Replace("alt+", "") == searchText.ToLower();
@@ -74,8 +79,8 @@ namespace mpvnet
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.Path.ToLower().Contains(searchText) || item.Path.ToLower().Contains(searchText) ||
item.Input.ToLower().Contains(searchText)) item.Input.ToLower().Contains(searchText))
{ {
return true; return true;
} }
@@ -85,7 +90,10 @@ namespace mpvnet
void ButtonClick(object sender, RoutedEventArgs e) void ButtonClick(object sender, RoutedEventArgs e)
{ {
CommandItem item = ((Button)e.Source).DataContext as CommandItem; 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;
@@ -109,10 +117,12 @@ namespace mpvnet
foreach (string line in Properties.Resources.input_conf.Split(new[] { "\r\n" }, StringSplitOptions.None)) foreach (string line in Properties.Resources.input_conf.Split(new[] { "\r\n" }, StringSplitOptions.None))
{ {
string test = line.Trim(); string test = line.Trim();
if (test == "" || test.StartsWith("#")) text += test + "\r\n";
if (test == "" || test.StartsWith("#"))
text += test + BR;
} }
text = "\r\n" + text.Trim() + "\r\n\r\n"; text = BR + text.Trim() + BR2;
foreach (CommandItem item in CommandItem.Items) foreach (CommandItem item in CommandItem.Items)
{ {
@@ -127,8 +137,9 @@ namespace mpvnet
if (item.Path.Trim() != "") if (item.Path.Trim() != "")
line = line.PadRight(40) + " #menu: " + item.Path; line = line.PadRight(40) + " #menu: " + item.Path;
text += line + "\r\n"; text += line + BR;
} }
return text; return text;
} }