mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-21 10:25:00 +00:00
Use combobox to select fonts
ges. Lines starting
This commit is contained in:
parent
9efbc7dd7a
commit
6fb238f73a
2 changed files with 36 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
|
@ -381,6 +382,10 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _lastCheckUpdateTime, value);
|
set => SetProperty(ref _lastCheckUpdateTime, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> Fonts { get; private set; } = [string.Empty, ..systemFonts.Value];
|
||||||
|
|
||||||
|
public List<string> MonoFonts { get; private set; } = [string.Empty, ..systemFonts.Value];
|
||||||
|
|
||||||
public void SetCanModify()
|
public void SetCanModify()
|
||||||
{
|
{
|
||||||
_isReadonly = false;
|
_isReadonly = false;
|
||||||
|
@ -695,5 +700,9 @@ namespace SourceGit.ViewModels
|
||||||
private string _externalMergeToolPath = string.Empty;
|
private string _externalMergeToolPath = string.Empty;
|
||||||
|
|
||||||
private uint _statisticsSampleColor = 0xFF00FF00;
|
private uint _statisticsSampleColor = 0xFF00FF00;
|
||||||
|
|
||||||
|
private static readonly Lazy<List<string>> systemFonts = new(
|
||||||
|
() => [..Avalonia.Media.FontManager.Current.SystemFonts.Select(e => e.Name).OrderBy(e => e)],
|
||||||
|
System.Threading.LazyThreadSafetyMode.PublicationOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,19 +175,38 @@
|
||||||
Text="{DynamicResource Text.Preferences.Appearance.DefaultFont}"
|
Text="{DynamicResource Text.Preferences.Appearance.DefaultFont}"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Margin="0,0,16,0"/>
|
Margin="0,0,16,0"/>
|
||||||
<TextBox Grid.Row="1" Grid.Column="1"
|
|
||||||
Height="28"
|
<ComboBox Grid.Row="1" Grid.Column="1"
|
||||||
CornerRadius="3"
|
MinHeight="28"
|
||||||
Text="{Binding DefaultFontFamily, Mode=TwoWay}"/>
|
Padding="8,0"
|
||||||
|
CornerRadius="3"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
SelectedItem="{Binding DefaultFontFamily, Mode=TwoWay}"
|
||||||
|
ItemsSource="{Binding Fonts}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding}" FontFamily="{Binding}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||||
Text="{DynamicResource Text.Preferences.Appearance.MonospaceFont}"
|
Text="{DynamicResource Text.Preferences.Appearance.MonospaceFont}"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Margin="0,0,16,0"/>
|
Margin="0,0,16,0"/>
|
||||||
<TextBox Grid.Row="2" Grid.Column="1"
|
<ComboBox Grid.Row="2" Grid.Column="1"
|
||||||
Height="28"
|
MinHeight="28"
|
||||||
CornerRadius="3"
|
Padding="8,0"
|
||||||
Text="{Binding MonospaceFontFamily, Mode=TwoWay}"/>
|
CornerRadius="3"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
SelectedItem="{Binding MonospaceFontFamily, Mode=TwoWay}"
|
||||||
|
ItemsSource="{Binding Fonts}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding}" FontFamily="{Binding}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||||
Text="{DynamicResource Text.Preferences.Appearance.FontSize}"
|
Text="{DynamicResource Text.Preferences.Appearance.FontSize}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue