feature<Preference>: add custom font settings

This commit is contained in:
Jai 2021-08-10 16:55:01 +08:00
parent 0643f5803c
commit 0c7f217106
29 changed files with 202 additions and 70 deletions

View file

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Markup;
using System.Windows.Media;
namespace SourceGit.Models {
public class InstalledFont {
public string Name { get; set; }
public int FamilyIndex { get; set; }
public static List<InstalledFont> GetFonts {
get {
var fontList = new List<InstalledFont>();
var fontCollection = Fonts.SystemFontFamilies;
var familyCount = fontCollection.Count;
for (int i = 0; i < familyCount; i++) {
var fontFamily = fontCollection.ElementAt(i);
var familyNames = fontFamily.FamilyNames;
if (!familyNames.TryGetValue(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name), out var name)) {
if (!familyNames.TryGetValue(XmlLanguage.GetLanguage("en-us"), out name)) {
name = familyNames.FirstOrDefault().Value;
}
}
fontList.Add(new InstalledFont() {
Name = name,
FamilyIndex = i
});
}
fontList.Sort((p, n) => string.Compare(p.Name, n.Name, StringComparison.Ordinal));
return fontList;
}
}
}
}

View file

@ -27,6 +27,27 @@ namespace SourceGit.Models {
/// </summary>
public string Locale { get; set; } = "en_US";
/// <summary>
/// 系统字体
/// </summary>
public string FontFamilyWindowSetting { get; set; } = "Microsoft YaHei UI";
[JsonIgnore]
public string FontFamilyWindow {
get => FontFamilyWindowSetting + ",Microsoft YaHei UI";
set => FontFamilyWindowSetting = value;
}
/// <summary>
/// 用户字体(提交列表、提交日志、差异比较等)
/// </summary>
public string FontFamilyContentSetting { get; set; } = "Consolas";
[JsonIgnore] public string FontFamilyContent {
get => FontFamilyContentSetting + ",Microsoft YaHei UI";
set => FontFamilyContentSetting = value;
}
/// <summary>
/// 头像服务器
/// </summary>

View file

@ -356,6 +356,8 @@
<sys:String x:Key="Text.Preference">Preference</sys:String>
<sys:String x:Key="Text.Preference.General">GENERAL SETTING</sys:String>
<sys:String x:Key="Text.Preference.Locale">Language</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyWindow">Window Font</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyContent">Content Font</sys:String>
<sys:String x:Key="Text.Preference.AvatarServer">Avatar Server</sys:String>
<sys:String x:Key="Text.Preference.CheckUpdate">Check for update</sys:String>
<sys:String x:Key="Text.Preference.AutoFetch">Fetch remotes automatically (need restart)</sys:String>

View file

@ -355,6 +355,8 @@
<sys:String x:Key="Text.Preference">偏好设置</sys:String>
<sys:String x:Key="Text.Preference.General">通用配置</sys:String>
<sys:String x:Key="Text.Preference.Locale">显示语言</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyWindow">系统字体</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyContent">文本字体</sys:String>
<sys:String x:Key="Text.Preference.AvatarServer">头像服务</sys:String>
<sys:String x:Key="Text.Preference.CheckUpdate">启用检测更新</sys:String>
<sys:String x:Key="Text.Preference.AutoFetch">启用定时自动拉取远程更新(重启生效)</sys:String>

View file

@ -1,5 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:models="clr-namespace:SourceGit.Models">
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Background" Value="Transparent"/>
@ -7,7 +8,7 @@
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="MinHeight" Value="24"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="TextElement.FontFamily" Value="Microsoft YaHei UI"/>
<Setter Property="FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyWindow, Mode=OneWay}" />
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>

View file

@ -1,5 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:models="clr-namespace:SourceGit.Models">
<Style x:Key="Style.DataGridCell" TargetType="{x:Type DataGridCell}">
<Setter Property="BorderThickness" Value="0"/>
@ -44,7 +45,7 @@
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TextElement.Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="TextElement.FontFamily" Value="Consolas,Microsoft YaHei UI"/>
<Setter Property="TextElement.FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
<Setter Property="EnableColumnVirtualization" Value="True"/>
<Setter Property="EnableRowVirtualization" Value="True"/>
<Setter Property="RowBackground" Value="Transparent"/>

View file

@ -49,7 +49,6 @@
<Style TargetType="{x:Type TextBlock}" BasedOn="{x:Null}">
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="FontWeight" Value="DemiBold"/>
<Setter Property="FontFamily" Value="Microsoft YaHei UI"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Style.Triggers>

View file

@ -3,7 +3,6 @@
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
<Style x:Key="Style.TextBlock.Base" TargetType="{x:Type TextBlock}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="FontFamily" Value="Consolas,Microsoft YaHei UI"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
@ -20,7 +19,6 @@
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
<Setter Property="FontFamily" Value="Microsoft YaHei UI"/>
<Setter Property="FontWeight" Value="ExtraBold"/>
<Setter Property="FontSize" Value="9pt"/>
<Setter Property="Margin" Value="8,0,0,0"/>

View file

@ -7,7 +7,6 @@
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="TextElement.FontFamily" Value="Consolas,Microsoft YaHei UI"/>
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="CaretBrush" Value="{DynamicResource Brush.FG1}"/>
<Setter Property="Background" Value="Transparent"/>

View file

@ -1,6 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models">
<Style x:Key="Style.TreeView.ToggleButton" TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable" Value="False"/>
@ -58,8 +59,7 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
ContentSource="Header"
TextElement.FontFamily="Consolas,Microsoft YaHei UI"/>
ContentSource="Header"/>
</Grid>
</Border>
<ItemsPresenter x:Name="ItemsHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
@ -97,6 +97,7 @@
<Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Standard" />
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="TextElement.FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>

View file

@ -1,6 +1,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:models="clr-namespace:SourceGit.Models">
<Style x:Key="Style.Window" TargetType="{x:Type Window}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
@ -12,6 +13,7 @@
<Setter Property="TextOptions.TextHintingMode" Value="Animated"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyWindow, Mode=OneWay}"/>
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>

View file

@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d"
Title="{DynamicResource Text.Blame}"
WindowStartupLocation="CenterOwner"
@ -56,8 +57,8 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" x:Name="txtFile" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Foreground="{DynamicResource Brush.FG2}" FontSize="11" Text="{DynamicResource Text.Blame.Tip}"/>
<TextBlock Grid.Column="0" x:Name="txtFile" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Foreground="{DynamicResource Brush.FG2}" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" FontSize="11" Text="{DynamicResource Text.Blame.Tip}"/>
</Grid>
</Border>

View file

@ -136,7 +136,7 @@ namespace SourceGit.Views.Controls {
placeholder,
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface(new FontFamily("Consolas"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
new Typeface(new FontFamily(Models.Preference.Instance.General.FontFamilyWindow), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
a.Width * 0.65,
Brushes.White,
VisualTreeHelper.GetDpi(a).PixelsPerDip);

View file

@ -74,7 +74,7 @@ namespace SourceGit.Views.Controls {
txt,
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface(new FontFamily("Microsoft YaHei UI"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
new Typeface(new FontFamily(Models.Preference.Instance.General.FontFamilyWindow), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
icon.Width * 0.8,
new SolidColorBrush(Color.FromRgb(241, 241, 241)),
VisualTreeHelper.GetDpi(icon).PixelsPerDip);

View file

@ -49,7 +49,7 @@ namespace SourceGit.Views.Controls {
Placeholder,
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface(new FontFamily("Microsoft YaHei UI"), FontStyle, FontWeight, FontStretch),
new Typeface(new FontFamily(Models.Preference.Instance.General.FontFamilyWindow), FontStyle, FontWeight, FontStretch),
FontSize,
FindResource("Brush.FG2") as Brush,
new NumberSubstitution(),

View file

@ -0,0 +1,20 @@
using System;
using System.Globalization;
using System.Linq;
using System.Windows.Data;
namespace SourceGit.Views.Converters {
public class FontFamiliesToName : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
if (value is string s)
return s.Split(',').ElementAt(0);
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
return value;
}
}
}

View file

@ -78,7 +78,7 @@
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="20">
<TextBlock Text="{Binding Name}" Margin="4,0"/>
<TextBlock Text="{Binding Desc}" Margin="4,0" FontFamily="Microsoft YaHei UI" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
<TextBlock Text="{Binding Desc}" Margin="4,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>

View file

@ -38,7 +38,6 @@
<TextBlock
Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
Text="{DynamicResource Text.Init.Tip}"
FontFamily="Microsoft YaHei UI"
Foreground="{DynamicResource Brush.FG2}"/>
</Grid>
</controls:PopupWidget>

View file

@ -62,7 +62,7 @@
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="20">
<TextBlock Text="{Binding Name}" Margin="4,0"/>
<TextBlock Text="{Binding Desc}" Margin="4,0" FontFamily="Microsoft YaHei UI" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
<TextBlock Text="{Binding Desc}" Margin="4,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>

View file

@ -72,7 +72,7 @@
<Path Grid.Column="0" Width="12" Height="12" Fill="{Binding Color}" Data="M 0,0 A 180,180 180 1 1 1,1 Z"/>
<TextBlock Grid.Column="1" Text="{Binding Name}" Margin="4,0,0,0"/>
<TextBlock Grid.Column="2" Text="{Binding Desc}" FontFamily="Microsoft YaHei UI" FontSize="11" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right"/>
<TextBlock Grid.Column="2" Text="{Binding Desc}" FontSize="11" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right"/>
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>

View file

@ -7,12 +7,16 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models"
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
mc:Ignorable="d"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
Title="{DynamicResource Text.Preference}"
Width="500" SizeToContent="Height">
<Grid>
<Grid.Resources>
<converters:FontFamiliesToName x:Key="FontFamiliesToName"/>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
@ -58,6 +62,8 @@
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="8"/>
<RowDefinition Height="36"/>
<RowDefinition Height="28"/>
@ -99,14 +105,58 @@
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.Locale, Mode=TwoWay}"
SelectionChanged="LocaleChanged"/>
<!-- Avatar -->
<!-- System Font -->
<TextBlock
Grid.Row="2" Grid.Column="0"
Text="{DynamicResource Text.Preference.FontFamilyWindow}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="2" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:InstalledFont.GetFonts}}"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyWindow, Mode=TwoWay, Converter={StaticResource FontFamiliesToName}}"
DisplayMemberPath="Name"
SelectedValuePath="Name"
SelectionChanged="LocaleChanged">
<ComboBox.Resources>
<Style TargetType="ComboBoxItem">
<Setter Property="FontFamily" Value="{Binding Name}"/>
<Setter Property="ToolTip" Value="{Binding Name}"/>
</Style>
</ComboBox.Resources>
</ComboBox>
<!-- Content Font -->
<TextBlock
Grid.Row="3" Grid.Column="0"
Text="{DynamicResource Text.Preference.FontFamilyContent}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<ComboBox
Grid.Row="3" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:InstalledFont.GetFonts}}"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=TwoWay, Converter={StaticResource FontFamiliesToName}}"
DisplayMemberPath="Name"
SelectedValuePath="Name"
SelectionChanged="LocaleChanged">
<ComboBox.Resources>
<Style TargetType="ComboBoxItem">
<Setter Property="FontFamily" Value="{Binding Name}"/>
<Setter Property="ToolTip" Value="{Binding Name}"/>
</Style>
</ComboBox.Resources>
</ComboBox>
<!-- Avatar -->
<TextBlock
Grid.Row="4" Grid.Column="0"
Text="{DynamicResource Text.Preference.AvatarServer}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="2" Grid.Column="1"
Grid.Row="4" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:AvatarServer.Supported}}"
DisplayMemberPath="Name"
@ -115,36 +165,36 @@
<!-- Enable Check For Update -->
<CheckBox
Grid.Row="3" Grid.Column="1"
Grid.Row="5" Grid.Column="1"
Content="{DynamicResource Text.Preference.CheckUpdate}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.CheckForUpdate, Mode=TwoWay}"/>
<!-- Auto Fetch -->
<CheckBox
Grid.Row="4" Grid.Column="1"
Grid.Row="6" Grid.Column="1"
Content="{DynamicResource Text.Preference.AutoFetch}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.AutoFetchRemotes, Mode=TwoWay}"/>
<!-- Restore Windows -->
<CheckBox
Grid.Row="5" Grid.Column="1"
Grid.Row="7" Grid.Column="1"
Content="{DynamicResource Text.Preference.RestoreTabs}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
<!-- Git Group -->
<TextBlock
Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2"
Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="2"
Text="{DynamicResource Text.Preference.Git}"
FontSize="16" FontWeight="DemiBold"
Foreground="{DynamicResource Brush.FG2}"/>
<!-- Git Executable Path -->
<TextBlock
Grid.Row="8" Grid.Column="0"
Grid.Row="10" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Path}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<Grid Grid.Row="8" Grid.Column="1">
<Grid Grid.Row="10" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
@ -167,11 +217,11 @@
<!-- Default Clone Dir -->
<TextBlock
Grid.Row="9" Grid.Column="0"
Grid.Row="11" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Dir}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<Grid Grid.Row="9" Grid.Column="1">
<Grid Grid.Row="11" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
@ -194,36 +244,36 @@
<!-- User -->
<TextBlock
Grid.Row="10" Grid.Column="0"
Grid.Row="12" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.User}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<controls:TextEdit
Grid.Row="10" Grid.Column="1"
Grid.Row="12" Grid.Column="1"
Height="24"
Text="{Binding ElementName=me, Path=User, Mode=TwoWay}"
Placeholder="{DynamicResource Text.Preference.Git.User.Placeholder}"/>
<!-- Email -->
<TextBlock
Grid.Row="11" Grid.Column="0"
Grid.Row="13" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Email}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<controls:TextEdit
Grid.Row="11" Grid.Column="1"
Grid.Row="13" Grid.Column="1"
Height="24"
Text="{Binding ElementName=me, Path=Email, Mode=TwoWay}"
Placeholder="{DynamicResource Text.Preference.Git.Email.Placeholder}"/>
<!-- CRLF -->
<TextBlock
Grid.Row="12" Grid.Column="0"
Grid.Row="14" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.CRLF}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="12" Grid.Column="1"
Grid.Row="14" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:CRLFOption.Supported}}"
SelectedValuePath="Value"
@ -232,7 +282,7 @@
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="20">
<TextBlock Text="{Binding Display}" Margin="2,0"/>
<TextBlock Text="{Binding Desc}" Margin="8,0,0,0" FontFamily="Microsoft YaHei UI" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
<TextBlock Text="{Binding Desc}" Margin="8,0,0,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
@ -240,19 +290,19 @@
<!-- Merge Tool Group -->
<TextBlock
Grid.Row="14" Grid.Column="0" Grid.ColumnSpan="2"
Grid.Row="16" Grid.Column="0" Grid.ColumnSpan="2"
Text="{DynamicResource Text.Preference.Merger}"
FontSize="16" FontWeight="DemiBold"
Foreground="{DynamicResource Brush.FG2}"/>
<!-- Merge Tool Type -->
<TextBlock
Grid.Row="15" Grid.Column="0"
Grid.Row="17" Grid.Column="0"
Text="{DynamicResource Text.Preference.Merger.Type}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="15" Grid.Column="1"
Grid.Row="17" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:MergeTool.Supported}}"
DisplayMemberPath="Name"
@ -262,11 +312,11 @@
<!-- Merge Tool Executable Path -->
<TextBlock
Grid.Row="16" Grid.Column="0"
Grid.Row="18" Grid.Column="0"
Text="{DynamicResource Text.Preference.Merger.Path}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<Grid Grid.Row="16" Grid.Column="1">
<Grid Grid.Row="18" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>

View file

@ -7,7 +7,8 @@
xmlns:models="clr-namespace:SourceGit.Models"
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800"
FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}">
<TabControl x:Name="body">
<TabItem Header="{DynamicResource Text.CommitViewer.Info}">
<Grid>

View file

@ -27,13 +27,13 @@
<Button Click="Explore" Margin="6,0" ToolTip="{DynamicResource Text.Dashboard.Explore.Tip}" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Folder.Open}"/>
<TextBlock Margin="4,0" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Text="{DynamicResource Text.Dashboard.Explore}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{DynamicResource Text.Dashboard.Explore}"/>
</StackPanel>
</Button>
<Button Click="Terminal" Margin="6,0" ToolTip="{DynamicResource Text.Dashboard.Terminal.Tip}" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="13" Height="13" Data="{StaticResource Icon.Terminal}"/>
<TextBlock Margin="4,0" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Text="{DynamicResource Text.Dashboard.Terminal}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{DynamicResource Text.Dashboard.Terminal}"/>
</StackPanel>
</Button>
</StackPanel>
@ -42,31 +42,31 @@
<Button Click="OpenFetch" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Fetch}"/>
<TextBlock Margin="4,0" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Text="{DynamicResource Text.Fetch}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{DynamicResource Text.Fetch}"/>
</StackPanel>
</Button>
<Button Click="OpenPull" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Pull}"/>
<TextBlock Margin="4,0" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Text="{DynamicResource Text.Pull}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{DynamicResource Text.Pull}"/>
</StackPanel>
</Button>
<Button Click="OpenPush" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Push}"/>
<TextBlock Margin="4,0" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Text="{DynamicResource Text.Push}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{DynamicResource Text.Push}"/>
</StackPanel>
</Button>
<Button Click="OpenStash" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.SaveStash}"/>
<TextBlock Margin="4,0" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Text="{DynamicResource Text.Stash}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{DynamicResource Text.Stash}"/>
</StackPanel>
</Button>
<Button Click="OpenApply" Margin="8,0" BorderThickness="0">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Apply}"/>
<TextBlock Margin="4,0" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Text="{DynamicResource Text.Apply}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{DynamicResource Text.Apply}"/>
</StackPanel>
</Button>
</StackPanel>
@ -75,13 +75,13 @@
<Button Click="OpenSearch" Margin="6,0" BorderThickness="0" ToolTip="{DynamicResource Text.Dashboard.Search.Tip}">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Search}"/>
<TextBlock Margin="4,0" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Text="{DynamicResource Text.Dashboard.Search}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{DynamicResource Text.Dashboard.Search}"/>
</StackPanel>
</Button>
<Button Click="OpenConfigure" Margin="6,0" BorderThickness="0" ToolTip="{DynamicResource Text.Dashboard.Configure.Tip}">
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14" Data="{StaticResource Icon.Setting}"/>
<TextBlock Margin="4,0" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Text="{DynamicResource Text.Configure}"/>
<TextBlock Margin="4,0" FontWeight="Bold" Text="{DynamicResource Text.Configure}"/>
</StackPanel>
</Button>
</StackPanel>
@ -123,7 +123,7 @@
<ListViewItem IsSelected="True">
<StackPanel Margin="16,0,0,0" Height="28" Orientation="Horizontal">
<Path Width="16" Height="16" Data="{StaticResource Icon.Histories}"/>
<TextBlock Margin="8,0,0,0" FontWeight="Bold" Text="{DynamicResource Text.Histories}"/>
<TextBlock Margin="8,0,0,0" Text="{DynamicResource Text.Histories}"/>
</StackPanel>
</ListViewItem>
<ListViewItem>
@ -134,7 +134,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Path Grid.Column="0" Width="16" Height="16" Data="{StaticResource Icon.Send}"/>
<TextBlock Grid.Column="1" Margin="8,0,0,0" FontWeight="Bold" Text="{DynamicResource Text.WorkingCopy}"/>
<TextBlock Grid.Column="1" Margin="8,0,0,0" Text="{DynamicResource Text.WorkingCopy}"/>
<controls:Badge Grid.Column="2" Margin="4,0" x:Name="badgeLocalChanges"/>
</Grid>
</ListViewItem>
@ -146,7 +146,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Path Grid.Column="0" Width="16" Height="16" Data="{StaticResource Icon.Stashes}"/>
<TextBlock Grid.Column="1" Margin="8,0,0,0" FontWeight="Bold" Text="{DynamicResource Text.Stashes}"/>
<TextBlock Grid.Column="1" Margin="8,0,0,0" Text="{DynamicResource Text.Stashes}"/>
<controls:Badge Grid.Column="2" Margin="4,0" x:Name="badgeStashes"/>
</Grid>
</ListViewItem>

View file

@ -7,7 +7,8 @@
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d"
Background="{DynamicResource Brush.Window}"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800"
FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}">
<UserControl.Resources>
<Style x:Key="Style.DataGridRow.DiffViewer" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
<EventSetter Event="RequestBringIntoView" Handler="OnTextDiffBringIntoView"/>

View file

@ -28,7 +28,6 @@
<TextBlock
Grid.Row="0"
Text="{DynamicResource Text.Launcher.Error}"
FontFamily="Microsoft YaHei UI"
FontWeight="Bold"/>
<controls:TextEdit
Grid.Row="1"
@ -39,14 +38,12 @@
VerticalScrollBarVisibility="Auto"
MaxHeight="80"
Margin="0,8"
FontFamily="Microsoft YaHei UI"
VerticalAlignment="Top"/>
<Button
Grid.Row="2"
Height="25"
Margin="4,0" Padding="8,0"
Click="Dismiss"
FontFamily="Microsoft YaHei UI"
Content="{DynamicResource Text.Close}"
Background="{DynamicResource Brush.Accent1}"
BorderBrush="{DynamicResource Brush.FG1}"

View file

@ -27,8 +27,8 @@
<TextBlock Margin="8,8,0,18" x:Name="txtTitle" FontSize="18" FontWeight="DemiBold" TextOptions.TextFormattingMode="Ideal" RenderOptions.ClearTypeHint="Enabled"/>
<ContentControl x:Name="container"/>
<StackPanel Margin="0,16,0,0" Height="32" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Click="Sure" Width="80" Content="{DynamicResource Text.Sure}" BorderBrush="{DynamicResource Brush.FG1}" Background="{DynamicResource Brush.Accent1}" FontFamily="Microsoft YaHei UI" FontWeight="Bold"/>
<Button Click="Cancel" Width="80" Margin="8,0,0,0" Content="{DynamicResource Text.Cancel}" FontFamily="Microsoft YaHei UI" FontWeight="Bold"/>
<Button Click="Sure" Width="80" Content="{DynamicResource Text.Sure}" BorderBrush="{DynamicResource Brush.FG1}" Background="{DynamicResource Brush.Accent1}" FontWeight="Bold"/>
<Button Click="Cancel" Width="80" Margin="8,0,0,0" Content="{DynamicResource Text.Cancel}" FontWeight="Bold"/>
</StackPanel>
</StackPanel>
</Border>

View file

@ -138,7 +138,7 @@ namespace SourceGit.Views.Widgets {
#region EVENTS
private void LayoutTextPreview(List<Models.TextLine> lines) {
var font = new FontFamily("Consolas");
var font = new FontFamily(Models.Preference.Instance.General.FontFamilyWindow);
var maxLineNumber = $"{lines.Count + 1}";
var formatted = new FormattedText(

View file

@ -37,7 +37,6 @@
Margin="4,0,0,0"
Text="{DynamicResource Text.Stashes.Stashes}"
Foreground="{DynamicResource Brush.FG2}"
FontFamily="Microsoft YaHei UI"
FontWeight="Bold"/>
<controls:Loading
@ -89,7 +88,6 @@
Margin="4,0,0,0"
Text="{DynamicResource Text.Stashes.Changes}"
Foreground="{DynamicResource Brush.FG2}"
FontFamily="Microsoft YaHei UI"
FontWeight="Bold"/>
</StackPanel>
</Border>

View file

@ -10,7 +10,8 @@
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800"
FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}">
<UserControl.Resources>
<converter:BoolToCollapsed x:Key="BoolToCollapsed"/>
</UserControl.Resources>
@ -53,7 +54,6 @@
Margin="6,0"
Text="{DynamicResource Text.WorkingCopy.Unstaged}"
Foreground="{DynamicResource Brush.FG2}"
FontFamily="Microsoft YaHei UI"
FontWeight="Bold"/>
<controls:Loading
Grid.Column="2"
@ -108,7 +108,6 @@
Margin="6,0"
Text="{DynamicResource Text.WorkingCopy.Staged}"
Foreground="{DynamicResource Brush.FG2}"
FontFamily="Microsoft YaHei UI"
FontWeight="Bold"/>
<controls:IconButton
@ -233,7 +232,6 @@
Height="26"
Padding="8,0"
Click="Commit"
FontFamily="Microsoft YaHei UI"
FontWeight="Bold"
Background="{DynamicResource Brush.Accent1}"
BorderBrush="{DynamicResource Brush.FG1}"
@ -245,7 +243,6 @@
Height="26"
Padding="8,0"
Click="CommitAndPush"
FontFamily="Microsoft YaHei UI"
FontWeight="Bold"
Content="{DynamicResource Text.WorkingCopy.CommitAndPush}"
Margin="8,0,0,0"/>