Merge pull request #1119 from onesounds/antialising

Remove All Cleartype Rendering
This commit is contained in:
Jeremy Wu 2022-04-19 13:13:31 +10:00 committed by GitHub
commit cfe760a5e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,15 +1,16 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"> xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure">
<!-- Further font customisations are dynamically loaded in Theme.cs --> <!-- Further font customisations are dynamically loaded in Theme.cs -->
<Style x:Key="BaseQueryBoxStyle" TargetType="{x:Type TextBox}"> <Style x:Key="BaseQueryBoxStyle" TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="0" /> <Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="28" /> <Setter Property="FontSize" Value="28" />
<Setter Property="FontWeight" Value="Regular" /> <Setter Property="FontWeight" Value="Regular" />
<Setter Property="Margin" Value="16 7 0 7" /> <Setter Property="Margin" Value="16,7,0,7" />
<Setter Property="Padding" Value="0 4 68 0" /> <Setter Property="Padding" Value="0,4,68,0" />
<Setter Property="Background" Value="#2F2F2F" /> <Setter Property="Background" Value="#2F2F2F" />
<Setter Property="Height" Value="48" /> <Setter Property="Height" Value="48" />
<Setter Property="Foreground" Value="#E3E0E3" /> <Setter Property="Foreground" Value="#E3E0E3" />
@ -20,13 +21,22 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}"> <ControlTemplate TargetType="{x:Type TextBox}">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> <Border
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" x:Name="border"
Background="{TemplateBinding Background}"> Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="True">
<ScrollViewer
x:Name="PART_ContentHost"
Background="{TemplateBinding Background}"
Focusable="false"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ScrollViewer.ContentTemplate> <ScrollViewer.ContentTemplate>
<DataTemplate> <DataTemplate>
<Grid Background="{Binding Background, ElementName=PART_ContentHost}" RenderOptions.ClearTypeHint="Enabled"> <Grid Background="{Binding Background, ElementName=PART_ContentHost}">
<ContentPresenter Content="{Binding Path=Content, ElementName=PART_ContentHost}"></ContentPresenter> <ContentPresenter Content="{Binding Path=Content, ElementName=PART_ContentHost}" />
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</ScrollViewer.ContentTemplate> </ScrollViewer.ContentTemplate>
@ -37,47 +47,47 @@
</Setter> </Setter>
</Style> </Style>
<!-- Further font customisations are dynamically loaded in Theme.cs --> <!-- Further font customisations are dynamically loaded in Theme.cs -->
<Style x:Key="BaseQuerySuggestionBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}"> <Style
x:Key="BaseQuerySuggestionBoxStyle"
BasedOn="{StaticResource BaseQueryBoxStyle}"
TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="DarkGray" /> <Setter Property="Foreground" Value="DarkGray" />
<Setter Property="Height" Value="48" /> <Setter Property="Height" Value="48" />
<Setter Property="Margin" Value="16 7 0 7" /> <Setter Property="Margin" Value="16,7,0,7" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="0 4 68 0" /> <Setter Property="Padding" Value="0,4,68,0" />
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
</Style> </Style>
<Style x:Key="BaseWindowBorderStyle" TargetType="{x:Type Border}"> <Style x:Key="BaseWindowBorderStyle" TargetType="{x:Type Border}">
<Setter Property="BorderThickness" Value="0" /> <Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="#2F2F2F"></Setter> <Setter Property="Background" Value="#2F2F2F" />
<Setter Property="Padding" Value="0 0 0 0" /> <Setter Property="Padding" Value="0,0,0,0" />
<Setter Property="CornerRadius" Value="5" /> <Setter Property="CornerRadius" Value="5" />
</Style> </Style>
<Style x:Key="BaseWindowStyle" TargetType="{x:Type Window}"> <Style x:Key="BaseWindowStyle" TargetType="{x:Type Window}">
<Setter Property="Width" Value="600" /> <Setter Property="Width" Value="600" />
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
</Style> </Style>
<Style x:Key="WindowRadius" TargetType="{x:Type Border}"> <Style x:Key="WindowRadius" TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="5" /> <Setter Property="CornerRadius" Value="5" />
</Style> </Style>
<Style x:Key="BasePendingLineStyle" TargetType="{x:Type Line}"> <Style x:Key="BasePendingLineStyle" TargetType="{x:Type Line}">
<Setter Property="Stroke" Value="Blue" /> <Setter Property="Stroke" Value="Blue" />
</Style> </Style>
<!-- Item Style --> <!-- Item Style -->
<Style x:Key="BaseItemTitleStyle" TargetType="{x:Type TextBlock}"> <Style x:Key="BaseItemTitleStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#FFFFF8" /> <Setter Property="Foreground" Value="#FFFFF8" />
<Setter Property="FontSize" Value="16" /> <Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Medium" /> <Setter Property="FontWeight" Value="Medium" />
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
</Style> </Style>
<Style x:Key="BaseItemSubTitleStyle" TargetType="{x:Type TextBlock}" > <Style x:Key="BaseItemSubTitleStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#D9D9D4" /> <Setter Property="Foreground" Value="#D9D9D4" />
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="FontSize" Value="13" /> <Setter Property="FontSize" Value="13" />
<Setter Property="FontWeight" Value="Normal" /> <Setter Property="FontWeight" Value="Normal" />
<Style.Triggers> <Style.Triggers>
@ -89,9 +99,8 @@
<Style x:Key="BaseItemNumberStyle" TargetType="{x:Type TextBlock}"> <Style x:Key="BaseItemNumberStyle" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Margin" Value="3 0 0 0" /> <Setter Property="Margin" Value="3,0,0,0" />
<Setter Property="FontSize" Value="22" /> <Setter Property="FontSize" Value="22" />
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
</Style> </Style>
<Style x:Key="BaseGlyphStyle" TargetType="{x:Type TextBlock}"> <Style x:Key="BaseGlyphStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#ffffff" /> <Setter Property="Foreground" Value="#ffffff" />
@ -99,34 +108,31 @@
<Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Width" Value="25" /> <Setter Property="Width" Value="25" />
<Setter Property="Height" Value="25" /> <Setter Property="Height" Value="25" />
<Setter Property="FontSize" Value="25"/> <Setter Property="FontSize" Value="25" />
</Style> </Style>
<Style x:Key="BaseItemTitleSelectedStyle" TargetType="{x:Type TextBlock}" > <Style x:Key="BaseItemTitleSelectedStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#FFFFF8" /> <Setter Property="Foreground" Value="#FFFFF8" />
<Setter Property="FontSize" Value="16" /> <Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Normal" /> <Setter Property="FontWeight" Value="Normal" />
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
</Style> </Style>
<Style x:Key="BaseItemSubTitleSelectedStyle" TargetType="{x:Type TextBlock}" > <Style x:Key="BaseItemSubTitleSelectedStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#D9D9D4" /> <Setter Property="Foreground" Value="#D9D9D4" />
<Setter Property="FontSize" Value="13" /> <Setter Property="FontSize" Value="13" />
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=SubTitle, UpdateSourceTrigger=PropertyChanged, Path=Text.Length}" Value="0"> <DataTrigger Binding="{Binding ElementName=SubTitle, UpdateSourceTrigger=PropertyChanged, Path=Text.Length}" Value="0">
<Setter Property="Height" Value="0" /> <Setter Property="Height" Value="0" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style x:Key="BaseItemImageSelectedStyle" TargetType="{x:Type Image}" > <Style x:Key="BaseItemImageSelectedStyle" TargetType="{x:Type Image}" />
</Style>
<Style x:Key="BaseListboxStyle" TargetType="{x:Type ListBox}"> <Style x:Key="BaseListboxStyle" TargetType="{x:Type ListBox}">
<Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="Margin" Value="0 0 0 0" /> <Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="Padding" Value="0 0 0 0" /> <Setter Property="Padding" Value="0,0,0,0" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="ListBox"> <ControlTemplate TargetType="ListBox">
@ -135,12 +141,12 @@
<Style TargetType="ScrollViewer"> <Style TargetType="ScrollViewer">
<Style.Triggers> <Style.Triggers>
<Trigger Property="ComputedVerticalScrollBarVisibility" Value="Visible"> <Trigger Property="ComputedVerticalScrollBarVisibility" Value="Visible">
<Setter Property="Margin" Value="0 0 0 0" /> <Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="Padding" Value="0 0 0 0" /> <Setter Property="Padding" Value="0,0,0,0" />
</Trigger> </Trigger>
<Trigger Property="ComputedVerticalScrollBarVisibility" Value="Collapsed"> <Trigger Property="ComputedVerticalScrollBarVisibility" Value="Collapsed">
<Setter Property="Margin" Value="0 0 0 0" /> <Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="Padding" Value="0 0 0 0" /> <Setter Property="Padding" Value="0,0,0,0" />
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
@ -152,7 +158,7 @@
</Setter> </Setter>
</Style> </Style>
<!-- ScrollViewer Style --> <!-- ScrollViewer Style -->
<ControlTemplate x:Key="ScrollViewerControlTemplate" TargetType="{x:Type ScrollViewer}"> <ControlTemplate x:Key="ScrollViewerControlTemplate" TargetType="{x:Type ScrollViewer}">
<Grid x:Name="Grid" Background="{TemplateBinding Background}"> <Grid x:Name="Grid" Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -160,44 +166,50 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!--content in the left of ScrollViewer, just default--> <!-- content in the left of ScrollViewer, just default -->
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" <ScrollContentPresenter
CanContentScroll="{TemplateBinding CanContentScroll}" x:Name="PART_ScrollContentPresenter"
CanHorizontallyScroll="False" Grid.Row="0"
CanVerticallyScroll="False" Grid.Column="0"
ContentTemplate="{TemplateBinding ContentTemplate}" Margin="0"
Content="{TemplateBinding Content}" CanContentScroll="{TemplateBinding CanContentScroll}"
Grid.Column="0" CanHorizontallyScroll="False"
Margin="0" CanVerticallyScroll="False"
Grid.Row="0" /> Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
<!--Scrollbar in thr rigth of ScrollViewer--> <!-- Scrollbar in thr rigth of ScrollViewer -->
<ScrollBar x:Name="PART_VerticalScrollBar" <ScrollBar
AutomationProperties.AutomationId="VerticalScrollBar" x:Name="PART_VerticalScrollBar"
Cursor="Arrow" Grid.Row="0"
Grid.Column="0" Grid.Column="0"
HorizontalAlignment="Right" Margin="0,0,0,0"
Margin="0 0 0 0" HorizontalAlignment="Right"
Maximum="{TemplateBinding ScrollableHeight}" AutomationProperties.AutomationId="VerticalScrollBar"
Minimum="0" Cursor="Arrow"
Grid.Row="0" Maximum="{TemplateBinding ScrollableHeight}"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Minimum="0"
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{DynamicResource ScrollBarStyle}"
ViewportSize="{TemplateBinding ViewportHeight}" ViewportSize="{TemplateBinding ViewportHeight}"
Style="{DynamicResource ScrollBarStyle}" /> Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
<!-- button style in the middle of the scrollbar --> <!-- button style in the middle of the scrollbar -->
<Style x:Key="BaseThumbStyle" TargetType="{x:Type Thumb}"> <Style x:Key="BaseThumbStyle" TargetType="{x:Type Thumb}">
<Setter Property="SnapsToDevicePixels" Value="True"/> <Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="IsTabStop" Value="false"/> <Setter Property="IsTabStop" Value="false" />
<Setter Property="Focusable" Value="false"/> <Setter Property="Focusable" Value="false" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}"> <ControlTemplate TargetType="{x:Type Thumb}">
<Border CornerRadius="2" DockPanel.Dock="Right" Background="#898989" BorderBrush="Transparent" /> <Border
Background="#898989"
BorderBrush="Transparent"
CornerRadius="2"
DockPanel.Dock="Right" />
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
@ -207,16 +219,19 @@
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" /> <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
<Setter Property="Stylus.IsFlicksEnabled" Value="false" /> <Setter Property="Stylus.IsFlicksEnabled" Value="false" />
<Setter Property="Background" Value="Black" /> <Setter Property="Background" Value="Black" />
<!-- must set min width --> <!-- must set min width -->
<Setter Property="MinWidth" Value="0"/> <Setter Property="MinWidth" Value="0" />
<Setter Property="Width" Value="5"/> <Setter Property="Width" Value="5" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}"> <ControlTemplate TargetType="{x:Type ScrollBar}">
<DockPanel> <DockPanel>
<Track x:Name="PART_Track" IsDirectionReversed="true" DockPanel.Dock="Right"> <Track
x:Name="PART_Track"
DockPanel.Dock="Right"
IsDirectionReversed="true">
<Track.Thumb> <Track.Thumb>
<Thumb Style="{DynamicResource ThumbStyle}"/> <Thumb Style="{DynamicResource ThumbStyle}" />
</Track.Thumb> </Track.Thumb>
</Track> </Track>
</DockPanel> </DockPanel>
@ -224,8 +239,7 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style x:Key="BaseSeparatorStyle" TargetType="Rectangle"> <Style x:Key="BaseSeparatorStyle" TargetType="Rectangle" />
</Style>
<Style x:Key="HighlightStyle"> <Style x:Key="HighlightStyle">
<Setter Property="Inline.FontWeight" Value="Bold" /> <Setter Property="Inline.FontWeight" Value="Bold" />
</Style> </Style>
@ -249,12 +263,12 @@
<Style x:Key="BaseSearchIconPosition" TargetType="{x:Type Canvas}"> <Style x:Key="BaseSearchIconPosition" TargetType="{x:Type Canvas}">
<Setter Property="Width" Value="32" /> <Setter Property="Width" Value="32" />
<Setter Property="Height" Value="32" /> <Setter Property="Height" Value="32" />
<Setter Property="Margin" Value="0 2 18 0" /> <Setter Property="Margin" Value="0,2,18,0" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalAlignment" Value="Right" /> <Setter Property="HorizontalAlignment" Value="Right" />
</Style> </Style>
<!--for classic themes--> <!-- for classic themes -->
<Style x:Key="SearchIconStyle" TargetType="{x:Type Path}"> <Style x:Key="SearchIconStyle" TargetType="{x:Type Path}">
<Setter Property="Fill" Value="#555555" /> <Setter Property="Fill" Value="#555555" />
<Setter Property="Width" Value="32" /> <Setter Property="Width" Value="32" />
@ -263,19 +277,24 @@
<Style x:Key="SearchIconPosition" TargetType="{x:Type Canvas}"> <Style x:Key="SearchIconPosition" TargetType="{x:Type Canvas}">
<Setter Property="Width" Value="32" /> <Setter Property="Width" Value="32" />
<Setter Property="Height" Value="32" /> <Setter Property="Height" Value="32" />
<Setter Property="Margin" Value="0 2 18 0" /> <Setter Property="Margin" Value="0,2,18,0" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalAlignment" Value="Right" /> <Setter Property="HorizontalAlignment" Value="Right" />
</Style> </Style>
<Style x:Key="ItemHotkeyStyle" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource BaseItemHotkeyStyle}"> <Style
x:Key="ItemHotkeyStyle"
BasedOn="{StaticResource BaseItemHotkeyStyle}"
TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="15" /> <Setter Property="FontSize" Value="15" />
<Setter Property="Foreground" Value="#8f8f8f" /> <Setter Property="Foreground" Value="#8f8f8f" />
<Setter Property="Opacity" Value="0.5" /> <Setter Property="Opacity" Value="0.5" />
</Style> </Style>
<Style x:Key="ItemHotkeySelectedStyle" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource BaseItemHotkeySelecetedStyle}"> <Style
x:Key="ItemHotkeySelectedStyle"
BasedOn="{StaticResource BaseItemHotkeySelecetedStyle}"
TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="15" /> <Setter Property="FontSize" Value="15" />
<Setter Property="Foreground" Value="#8f8f8f" /> <Setter Property="Foreground" Value="#8f8f8f" />
<Setter Property="Opacity" Value="0.5" /> <Setter Property="Opacity" Value="0.5" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>