mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
feature: add a toggle button in Preference dialog to only use monospace font in code editor (#292)
This commit is contained in:
parent
d2d95e09b7
commit
aea61e0067
6 changed files with 26 additions and 2 deletions
|
@ -360,6 +360,7 @@
|
||||||
<x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">Default Font</x:String>
|
<x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">Default Font</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.DefaultFontSize" xml:space="preserve">Default Font Size</x:String>
|
<x:String x:Key="Text.Preference.Appearance.DefaultFontSize" xml:space="preserve">Default Font Size</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.MonospaceFont" xml:space="preserve">Monospace Font</x:String>
|
<x:String x:Key="Text.Preference.Appearance.MonospaceFont" xml:space="preserve">Monospace Font</x:String>
|
||||||
|
<x:String x:Key="Text.Preference.Appearance.OnlyUseMonoFontInEditor" xml:space="preserve">Only use monospace font in text editor</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.Theme" xml:space="preserve">Theme</x:String>
|
<x:String x:Key="Text.Preference.Appearance.Theme" xml:space="preserve">Theme</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.ThemeOverrides" xml:space="preserve">Theme Overrides</x:String>
|
<x:String x:Key="Text.Preference.Appearance.ThemeOverrides" xml:space="preserve">Theme Overrides</x:String>
|
||||||
<x:String x:Key="Text.Preference.General" xml:space="preserve">GENERAL</x:String>
|
<x:String x:Key="Text.Preference.General" xml:space="preserve">GENERAL</x:String>
|
||||||
|
|
|
@ -363,6 +363,7 @@
|
||||||
<x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">缺省字体</x:String>
|
<x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">缺省字体</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.DefaultFontSize" xml:space="preserve">默认字体大小</x:String>
|
<x:String x:Key="Text.Preference.Appearance.DefaultFontSize" xml:space="preserve">默认字体大小</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.MonospaceFont" xml:space="preserve">等宽字体</x:String>
|
<x:String x:Key="Text.Preference.Appearance.MonospaceFont" xml:space="preserve">等宽字体</x:String>
|
||||||
|
<x:String x:Key="Text.Preference.Appearance.OnlyUseMonoFontInEditor" xml:space="preserve">仅在文本编辑器中使用等宽字体</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.Theme" xml:space="preserve">主题</x:String>
|
<x:String x:Key="Text.Preference.Appearance.Theme" xml:space="preserve">主题</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.ThemeOverrides" xml:space="preserve">主题自定义</x:String>
|
<x:String x:Key="Text.Preference.Appearance.ThemeOverrides" xml:space="preserve">主题自定义</x:String>
|
||||||
<x:String x:Key="Text.Preference.General" xml:space="preserve">通用配置</x:String>
|
<x:String x:Key="Text.Preference.General" xml:space="preserve">通用配置</x:String>
|
||||||
|
|
|
@ -363,6 +363,7 @@
|
||||||
<x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">預設字型</x:String>
|
<x:String x:Key="Text.Preference.Appearance.DefaultFont" xml:space="preserve">預設字型</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.DefaultFontSize" xml:space="preserve">預設字型大小</x:String>
|
<x:String x:Key="Text.Preference.Appearance.DefaultFontSize" xml:space="preserve">預設字型大小</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.MonospaceFont" xml:space="preserve">等寬字型</x:String>
|
<x:String x:Key="Text.Preference.Appearance.MonospaceFont" xml:space="preserve">等寬字型</x:String>
|
||||||
|
<x:String x:Key="Text.Preference.Appearance.OnlyUseMonoFontInEditor" xml:space="preserve">僅在文字編輯器中使用等寬字體</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.Theme" xml:space="preserve">主題</x:String>
|
<x:String x:Key="Text.Preference.Appearance.Theme" xml:space="preserve">主題</x:String>
|
||||||
<x:String x:Key="Text.Preference.Appearance.ThemeOverrides" xml:space="preserve">主題自訂</x:String>
|
<x:String x:Key="Text.Preference.Appearance.ThemeOverrides" xml:space="preserve">主題自訂</x:String>
|
||||||
<x:String x:Key="Text.Preference.General" xml:space="preserve">通用配置</x:String>
|
<x:String x:Key="Text.Preference.General" xml:space="preserve">通用配置</x:String>
|
||||||
|
|
|
@ -259,7 +259,7 @@
|
||||||
<Setter Property="FontStyle" Value="Italic"/>
|
<Setter Property="FontStyle" Value="Italic"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="TextBlock.monospace, SelectableTextBlock.monospace">
|
<Style Selector="TextBlock.monospace, SelectableTextBlock.monospace">
|
||||||
<Setter Property="FontFamily" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=MonospaceFont}"/>
|
<Setter Property="FontFamily" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=PrimaryFont}"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="TextBlock.group_header_label">
|
<Style Selector="TextBlock.group_header_label">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
|
<Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
|
||||||
|
|
|
@ -92,6 +92,22 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _monospaceFont, value);
|
set => SetProperty(ref _monospaceFont, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public FontFamily PrimaryFont
|
||||||
|
{
|
||||||
|
get => _onlyUseMonoFontInEditor ? _defaultFont : _monospaceFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnlyUseMonoFontInEditor
|
||||||
|
{
|
||||||
|
get => _onlyUseMonoFontInEditor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (SetProperty(ref _onlyUseMonoFontInEditor, value))
|
||||||
|
OnPropertyChanged(nameof(PrimaryFont));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public double DefaultFontSize
|
public double DefaultFontSize
|
||||||
{
|
{
|
||||||
get => _defaultFontSize;
|
get => _defaultFontSize;
|
||||||
|
@ -486,6 +502,7 @@ namespace SourceGit.ViewModels
|
||||||
private string _themeOverrides = string.Empty;
|
private string _themeOverrides = string.Empty;
|
||||||
private FontFamily _defaultFont = null;
|
private FontFamily _defaultFont = null;
|
||||||
private FontFamily _monospaceFont = null;
|
private FontFamily _monospaceFont = null;
|
||||||
|
private bool _onlyUseMonoFontInEditor = false;
|
||||||
private double _defaultFontSize = 13;
|
private double _defaultFontSize = 13;
|
||||||
private LayoutInfo _layout = new LayoutInfo();
|
private LayoutInfo _layout = new LayoutInfo();
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preference.Appearance}"/>
|
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preference.Appearance}"/>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
<Grid Margin="8" RowDefinitions="32,32,32,32,32" ColumnDefinitions="Auto,*">
|
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32" ColumnDefinitions="Auto,*">
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||||
Text="{DynamicResource Text.Preference.Appearance.Theme}"
|
Text="{DynamicResource Text.Preference.Appearance.Theme}"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
|
@ -232,6 +232,10 @@
|
||||||
</Button>
|
</Button>
|
||||||
</TextBox.InnerRightContent>
|
</TextBox.InnerRightContent>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
|
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||||
|
Content="{DynamicResource Text.Preference.Appearance.OnlyUseMonoFontInEditor}"
|
||||||
|
IsChecked="{Binding OnlyUseMonoFontInEditor, Mode=TwoWay}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue