improve:UI

This commit is contained in:
2026-05-01 21:58:09 +08:00
parent 31aee3bd9a
commit 4f5f3ed8fe
10 changed files with 268 additions and 194 deletions
@@ -55,6 +55,27 @@
SwitchName="ToggleSwitchEnableWinRtHandwritingStrokeBeautify"
Toggled="ToggleSwitchEnableWinRtHandwritingStrokeBeautify_Toggled" />
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_HandwritingFont}"
Description="{i18n:I18n Key=InkRecog_HandwritingFontHint}"
Visibility="{Binding IsOn, ElementName=CardEnableWinRtHandwritingStrokeBeautify, Converter={StaticResource BooleanToVisibilityConverter}}"
d:Visibility="Visible">
<ComboBox x:Name="ComboBoxHandwritingCorrectionFont" MinWidth="220"
SelectionChanged="ComboBoxHandwritingCorrectionFont_SelectionChanged">
<ComboBoxItem Content="Ink Free / 楷体 / Segoe Script" Tag="Ink Free,KaiTi,Segoe Script" />
<ComboBoxItem Content="楷体 (KaiTi)" Tag="KaiTi" FontFamily="KaiTi" />
<ComboBoxItem Content="华文楷体 (STKaiti)" Tag="STKaiti" FontFamily="STKaiti" />
<ComboBoxItem Content="华文行楷 (STXingkai)" Tag="STXingkai" FontFamily="STXingkai" />
<ComboBoxItem Content="仿宋 (FangSong)" Tag="FangSong" FontFamily="FangSong" />
<ComboBoxItem Content="华文仿宋 (STFangsong)" Tag="STFangsong" FontFamily="STFangsong" />
<ComboBoxItem Content="隶书 (LiSu)" Tag="LiSu" FontFamily="LiSu" />
<ComboBoxItem Content="幼圆 (YouYuan)" Tag="YouYuan" FontFamily="YouYuan" />
<ComboBoxItem Content="Ink Free" Tag="Ink Free" FontFamily="Ink Free" />
<ComboBoxItem Content="Segoe Script" Tag="Segoe Script" FontFamily="Segoe Script" />
<ComboBoxItem Content="Segoe Print" Tag="Segoe Print" FontFamily="Segoe Print" />
<ComboBoxItem Content="Comic Sans MS" Tag="Comic Sans MS" FontFamily="Comic Sans MS" />
</ComboBox>
</ui:SettingsCard>
<controls:LabeledSettingsCard x:Name="CardEnableInkToShapeNoFakePressureRectangle"
Header="{i18n:I18n Key=InkRecog_BlockRectFakePressure}"
ShowWhen="{Binding IsOn, ElementName=CardEnableInkToShape}"
@@ -38,6 +38,7 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
if (eng > 2) eng = 2;
ComboBoxShapeRecognitionEngine.SelectedIndex = eng;
CardEnableWinRtHandwritingStrokeBeautify.IsOn = settings.InkToShape.EnableWinRtHandwritingStrokeBeautify;
SelectHandwritingFontByValue(settings.InkToShape.HandwritingCorrectionFontFamily);
CardEnableInkToShapeNoFakePressureRectangle.IsOn = settings.InkToShape.IsInkToShapeNoFakePressureRectangle;
CardEnableInkToShapeNoFakePressureTriangle.IsOn = settings.InkToShape.IsInkToShapeNoFakePressureTriangle;
ToggleCheckboxEnableInkToShapeTriangle.IsChecked = settings.InkToShape.IsInkToShapeTriangle;
@@ -97,6 +98,34 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
SettingsManager.SaveSettingsToFile();
}
private void SelectHandwritingFontByValue(string value)
{
if (ComboBoxHandwritingCorrectionFont == null) return;
value = (value ?? string.Empty).Trim();
int matchIndex = -1;
for (int i = 0; i < ComboBoxHandwritingCorrectionFont.Items.Count; i++)
{
var item = ComboBoxHandwritingCorrectionFont.Items[i] as ComboBoxItem;
var tag = item?.Tag as string;
if (!string.IsNullOrEmpty(tag) && string.Equals(tag, value, StringComparison.OrdinalIgnoreCase))
{
matchIndex = i;
break;
}
}
ComboBoxHandwritingCorrectionFont.SelectedIndex = matchIndex >= 0 ? matchIndex : 0;
}
private void ComboBoxHandwritingCorrectionFont_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!_isLoaded || ComboBoxHandwritingCorrectionFont == null) return;
var item = ComboBoxHandwritingCorrectionFont.SelectedItem as ComboBoxItem;
var tag = item?.Tag as string;
if (string.IsNullOrWhiteSpace(tag)) return;
SettingsManager.Settings.InkToShape.HandwritingCorrectionFontFamily = tag;
SettingsManager.SaveSettingsToFile();
}
private void ToggleSwitchEnableInkToShapeNoFakePressureRectangle_Toggled(object sender, RoutedEventArgs e)
{
if (!_isLoaded) return;
@@ -91,15 +91,12 @@
Text="{i18n:I18n Key=Random_BackgroundSettingsTitle}" />
<ui:SettingsCard Header="{i18n:I18n Key=Random_BackgroundSelectLabel}">
<ComboBox x:Name="ComboBoxPickNameBackground"
SelectedIndex="0"
SelectionChanged="ComboBoxPickNameBackground_SelectionChanged" />
</ui:SettingsCard>
<ui:SettingsCard ContentAlignment="Left">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
<Button x:Name="ButtonAddCustomBackground" Content="{i18n:I18n Key=Random_CustomBackground_Upload}" Click="ButtonAddCustomBackground_Click" />
<Button x:Name="ButtonManageBackgrounds" Content="{i18n:I18n Key=Random_CustomBackground_Manage}" Click="ButtonManageBackgrounds_Click" />
<ComboBox x:Name="ComboBoxPickNameBackground"
SelectedIndex="0"
SelectionChanged="ComboBoxPickNameBackground_SelectionChanged" />
</ikw:SimpleStackPanel>
</ui:SettingsCard>