Remove UseSystemFont option

This commit is contained in:
Julien Richard 2022-04-17 10:00:04 +02:00
commit 273d4e157b
4 changed files with 5 additions and 38 deletions

View file

@ -20,8 +20,6 @@ namespace Greenshot.Editor.Controls
set { SetValue(EmojiProperty, value); }
}
public static readonly DependencyProperty UseSystemFontProperty = DependencyProperty.Register("UseSystemFont", typeof(bool), typeof(EmojiControl), new PropertyMetadata(default(bool), OnUseSystemFontPropertyChanged));
private static void OnUseSystemFontPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((EmojiControl)d).Source = null;
@ -31,16 +29,10 @@ namespace Greenshot.Editor.Controls
{
if (Source == null && !string.IsNullOrEmpty(Emoji))
{
Source = EmojiRenderer.GetBitmapSource(Emoji, iconSize: 48, useSystemFont: UseSystemFont);
Source = EmojiRenderer.GetBitmapSource(Emoji, iconSize: 48, useSystemFont: false);
}
base.OnRender(dc);
}
public bool UseSystemFont
{
get { return (bool)GetValue(UseSystemFontProperty); }
set { SetValue(UseSystemFontProperty, value); }
}
}
}

View file

@ -36,7 +36,7 @@
<Button Background="Transparent" BorderBrush="Transparent"
Margin="0" Click="OnEmojiPicked"
Width="40" Height="40" ToolTip="{Binding Path=Name}">
<controls:EmojiControl Height="24" UseSystemFont="{Binding UseSystemFont, ElementName=StackPanel_INTERNAL, Mode=OneWay}" Emoji="{Binding Path=Text}" />
<controls:EmojiControl Height="24" Emoji="{Binding Path=Text}" />
</Button>
</DataTemplate>
</ListView.ItemTemplate>
@ -48,7 +48,7 @@
x:Name="VariationButton" Background="Transparent" BorderBrush="Transparent"
Click="OnEmojiPicked" Focusable="False" ToolTip="{Binding Path=Name}">
<Grid>
<controls:EmojiControl Height="24" Margin="4" UseSystemFont="{Binding UseSystemFont, ElementName=StackPanel_INTERNAL, Mode=OneWay}" Emoji="{Binding Path=Text}"
<controls:EmojiControl Height="24" Margin="4" Emoji="{Binding Path=Text}"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Polygon Visibility="{Binding HasVariations, Converter={StaticResource BoolToVis}}"
Width="6" Height="6" VerticalAlignment="Bottom" HorizontalAlignment="Right"
@ -77,7 +77,7 @@
<TabControl.ItemTemplate>
<DataTemplate>
<Grid>
<controls:EmojiControl Height="24" UseSystemFont="{Binding UseSystemFont, ElementName=StackPanel_INTERNAL, Mode=OneWay}" Emoji="{Binding Icon}" >
<controls:EmojiControl Height="24" Emoji="{Binding Icon}" >
<Image.ToolTip>
<TextBlock Text="{Binding Name}"/>
</Image.ToolTip>
@ -134,9 +134,6 @@
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
<CheckBox VerticalContentAlignment="Center" IsChecked="{Binding UseSystemFont, ElementName=StackPanel_INTERNAL}" >
Use system font
</CheckBox>
</StackPanel>
</Border>
</Popup>

View file

@ -45,14 +45,6 @@ namespace Greenshot.Editor.Controls
public IList<EmojiData.Group> EmojiGroups => EmojiData.AllGroups;
public static readonly DependencyProperty UseSystemFontProperty = DependencyProperty.Register("UseSystemFont", typeof(bool), typeof(EmojiPicker), new PropertyMetadata(default(bool)));
public bool UseSystemFont
{
get { return (bool)GetValue(UseSystemFontProperty); }
set { SetValue(UseSystemFontProperty, value); }
}
// Backwards compatibility for when the backend was a TextBlock.
public double FontSize
{

View file

@ -22,13 +22,11 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using Greenshot.Base.Core;
using Greenshot.Base.Interfaces.Drawing;
using Greenshot.Editor.Controls;
using Greenshot.Editor.Drawing.Adorners;
using Greenshot.Editor.Helpers;
using Image = System.Drawing.Image;
@ -47,7 +45,6 @@ namespace Greenshot.Editor.Drawing
[NonSerialized] private bool _justCreated = true;
private string _emoji;
private bool _useSystemFont;
public string Emoji
{
@ -59,16 +56,6 @@ namespace Greenshot.Editor.Drawing
}
}
public bool UseSystemFont
{
get => _useSystemFont;
set
{
_useSystemFont = value;
ResetCachedBitmap();
}
}
public EmojiContainer(Surface parent) : this(parent, "🙂", size: 64)
{
}
@ -114,7 +101,6 @@ namespace Greenshot.Editor.Drawing
_emojiPicker.Picked += (_, args) =>
{
_currentContainer.Emoji = args.Emoji;
_currentContainer.UseSystemFont = _emojiPicker.UseSystemFont;
_currentContainer.Invalidate();
};
@ -169,7 +155,7 @@ namespace Greenshot.Editor.Drawing
var iconSize = Math.Min(Bounds.Width, Bounds.Height);
if (iconSize <= 0) return null;
var image = EmojiRenderer.GetBitmap(Emoji, iconSize, useSystemFont: _useSystemFont);
var image = EmojiRenderer.GetBitmap(Emoji, iconSize, useSystemFont: false);
if (RotationAngle != 0)
{
var newImage = image.Rotate(RotationAngle);