feat(设置): 新增墨迹纠正设置页面并重构设置界面
重构设置界面,将墨迹纠正相关功能从画板设置中分离出来,新增独立的墨迹纠正设置页面。主要变更包括: - 新增 InkRecognitionPage 用于集中管理墨迹纠正功能 - 调整设置窗口导航结构,将墨迹纠正设为画板设置的子页面 - 优化设置项布局,使用折叠面板组织复杂选项 - 移除主窗口中冗余的崩溃处理和手势设置 - 修复多指手势时橡皮擦状态保存问题 - 新增笔尖模式相关字符串资源
This commit is contained in:
@@ -641,62 +641,6 @@
|
||||
</ikw:SimpleStackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Name="GroupBoxStartup">
|
||||
<GroupBox.Header>
|
||||
<TextBlock Margin="0,12,0,0" Text="{i18n:I18n Key=Startup_Start}" FontWeight="Bold" Foreground="#fafafa"
|
||||
FontSize="26" />
|
||||
</GroupBox.Header>
|
||||
<ikw:SimpleStackPanel Spacing="6">
|
||||
<!--<ui:ToggleSwitch OnContent="" OffContent="" Name="ToggleSwitchAutoHideCanvas" Header="自动隐藏画板" Toggled="ToggleSwitchAutoHideCanvas_Toggled"/>
|
||||
<ui:ToggleSwitch OnContent="" OffContent="" Name="ToggleSwitchAutoEnterModeFinger" Header="自动进入手指模式" Toggled="ToggleSwitchAutoEnterModeFinger_Toggled"/>-->
|
||||
</ikw:SimpleStackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Name="GroupBoxCrashAction">
|
||||
<GroupBox.Header>
|
||||
<TextBlock Margin="0,12,0,0" Text="{i18n:I18n Key=Crash_Title}" FontWeight="Bold" Foreground="#fafafa"
|
||||
FontSize="26" />
|
||||
</GroupBox.Header>
|
||||
<ikw:SimpleStackPanel Spacing="6">
|
||||
<TextBlock Text="{i18n:I18n Key=Crash_Desc}" Foreground="#a1a1aa" TextWrapping="Wrap" Width="420" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,4,0,0">
|
||||
<RadioButton x:Name="RadioCrashSilentRestart" GroupName="CrashAction"
|
||||
Content="{i18n:I18n Key=Crash_SilentRestart}" FontSize="14" Margin="0,0,24,0"
|
||||
Checked="RadioCrashAction_Checked"/>
|
||||
<RadioButton x:Name="RadioCrashNoAction" GroupName="CrashAction"
|
||||
Content="{i18n:I18n Key=Crash_NoAction}" FontSize="14"
|
||||
Checked="RadioCrashAction_Checked"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{i18n:I18n Key=Crash_Hint}" Foreground="#a1a1aa" TextWrapping="Wrap" Width="420" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Name="GroupBoxGesture">
|
||||
<GroupBox.Header>
|
||||
<TextBlock Margin="0,12,0,0" Text="{i18n:I18n Key=Gesture_Title}" FontWeight="Bold" Foreground="#fafafa"
|
||||
FontSize="26" />
|
||||
</GroupBox.Header>
|
||||
<ikw:SimpleStackPanel Spacing="6">
|
||||
<controls:LabeledToggleSwitch x:Name="ToggleSwitchAutoSwitchTwoFingerGesture" Label="{i18n:I18n Key=Gesture_AutoToggleTwoFinger}" Hint="{i18n:I18n Key=Gesture_AutoToggleHint}" IsOn="True" Toggled="ToggleSwitchAutoSwitchTwoFingerGesture_Toggled"/>
|
||||
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0" Stroke="#3f3f46"
|
||||
StrokeThickness="1" Margin="0,4,0,4" />
|
||||
<controls:LabeledToggleSwitch x:Name="ToggleSwitchEnableTwoFingerRotationOnSelection" Label="{i18n:I18n Key=Gesture_AllowRotateScale}" Hint="{i18n:I18n Key=Gesture_AllowRotateScaleHint}" IsOn="True" Toggled="ToggleSwitchEnableTwoFingerRotation_Toggled"/>
|
||||
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0" Stroke="#3f3f46"
|
||||
StrokeThickness="1" Margin="0,4,0,4" />
|
||||
<controls:LabeledToggleSwitch x:Name="ToggleSwitchEnablePalmEraser" Label="{i18n:I18n Key=Gesture_EnablePalmEraser}" Hint="{i18n:I18n Key=Gesture_PalmHint}" IsOn="False" Toggled="ToggleSwitchEnablePalmEraser_Toggled"/>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left"
|
||||
Visibility="{Binding ElementName=ToggleSwitchEnablePalmEraser, Path=IsOn, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Gesture_PalmSensitivity}" VerticalAlignment="Center"
|
||||
FontSize="14" Margin="0,0,16,0" />
|
||||
<ComboBox Name="ComboBoxPalmEraserSensitivity" SelectionChanged="ComboBoxPalmEraserSensitivity_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityLow}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityMedium}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityHigh}" />
|
||||
</ComboBox>
|
||||
</ikw:SimpleStackPanel>
|
||||
<TextBlock Text="{i18n:I18n Key=Gesture_PalmHint}"
|
||||
TextWrapping="Wrap" Foreground="#a1a1aa"
|
||||
Visibility="{Binding ElementName=ToggleSwitchEnablePalmEraser, Path=IsOn, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Name="GroupBoxAppearanceNewUI">
|
||||
<GroupBox.Header>
|
||||
<TextBlock Margin="0,12,0,0" Text="{i18n:I18n Key=Theme_GroupTitle}" FontWeight="Bold" Foreground="#fafafa"
|
||||
|
||||
@@ -1336,12 +1336,6 @@ namespace Ink_Canvas
|
||||
ScheduleStartupFoldAbsenceVerification();
|
||||
}
|
||||
|
||||
// 恢复崩溃后操作设置
|
||||
if (App.CrashAction == App.CrashActionType.SilentRestart)
|
||||
RadioCrashSilentRestart.IsChecked = true;
|
||||
else
|
||||
RadioCrashNoAction.IsChecked = true;
|
||||
|
||||
// 显示快抽悬浮按钮
|
||||
ShowQuickDrawFloatingButton();
|
||||
|
||||
@@ -2122,24 +2116,6 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
|
||||
// 新增:崩溃后操作设置按钮事件
|
||||
private void RadioCrashAction_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (RadioCrashSilentRestart != null && RadioCrashSilentRestart.IsChecked == true)
|
||||
{
|
||||
App.CrashAction = App.CrashActionType.SilentRestart;
|
||||
Settings.Startup.CrashAction = 0;
|
||||
}
|
||||
else if (RadioCrashNoAction != null && RadioCrashNoAction.IsChecked == true)
|
||||
{
|
||||
App.CrashAction = App.CrashActionType.NoAction;
|
||||
Settings.Startup.CrashAction = 1;
|
||||
}
|
||||
SaveSettingsToFile();
|
||||
// 强制同步全局变量,防止后台逻辑未及时感知
|
||||
App.SyncCrashActionFromSettings();
|
||||
}
|
||||
|
||||
// 添加一个辅助方法,根据当前编辑模式设置光标
|
||||
public void SetCursorBasedOnEditingMode(InkCanvas canvas)
|
||||
{
|
||||
@@ -2434,13 +2410,7 @@ namespace Ink_Canvas
|
||||
switch (sectionTag.ToLower())
|
||||
{
|
||||
case "startup":
|
||||
targetGroupBox = GroupBoxStartup;
|
||||
break;
|
||||
case "gesture":
|
||||
targetGroupBox = GroupBoxGesture;
|
||||
break;
|
||||
case "crashaction":
|
||||
targetGroupBox = GroupBoxCrashAction;
|
||||
break;
|
||||
case "ppt":
|
||||
targetGroupBox = GroupBoxPPT;
|
||||
|
||||
@@ -3550,7 +3550,7 @@ namespace Ink_Canvas
|
||||
SyncPdfPageSidebarWithCanvas();
|
||||
}
|
||||
|
||||
private int BoundsWidth = 5;
|
||||
internal int BoundsWidth = 5;
|
||||
|
||||
private void BtnHideInkCanvas_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -166,17 +166,6 @@ namespace Ink_Canvas
|
||||
|
||||
#region Startup
|
||||
|
||||
/// <summary>
|
||||
/// 处理笔尖模式开关状态更改事件
|
||||
/// </summary>
|
||||
/// <param name="sender">事件发送者</param>
|
||||
/// <param name="e">路由事件参数</param>
|
||||
/// <remarks>
|
||||
/// 当笔尖模式开关状态更改时:
|
||||
/// 1. 同步更新两个笔尖模式开关的状态
|
||||
/// 2. 保存笔尖模式设置
|
||||
/// 3. 根据笔尖模式设置更新边界宽度
|
||||
/// </remarks>
|
||||
private void ToggleSwitchEnableNibMode_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
@@ -2653,13 +2642,6 @@ namespace Ink_Canvas
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchAutoSwitchTwoFingerGesture_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
Settings.Gesture.AutoSwitchTwoFingerGesture = ToggleSwitchAutoSwitchTwoFingerGesture.IsOn;
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableTwoFingerZoom_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
@@ -2718,8 +2700,7 @@ namespace Ink_Canvas
|
||||
|
||||
palmEraserWasEnabledBeforeMultiTouch = Settings.Canvas.EnablePalmEraser;
|
||||
Settings.Canvas.EnablePalmEraser = false;
|
||||
if (ToggleSwitchEnablePalmEraser != null)
|
||||
ToggleSwitchEnablePalmEraser.IsOn = false;
|
||||
SaveSettingsToFile();
|
||||
|
||||
// 恢复到之前的编辑状态
|
||||
inkCanvas.EditingMode = currentEditingMode;
|
||||
@@ -2754,8 +2735,7 @@ namespace Ink_Canvas
|
||||
if (palmEraserWasEnabledBeforeMultiTouch)
|
||||
{
|
||||
Settings.Canvas.EnablePalmEraser = true;
|
||||
if (ToggleSwitchEnablePalmEraser != null)
|
||||
ToggleSwitchEnablePalmEraser.IsOn = true;
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
// 恢复到之前的编辑状态
|
||||
@@ -2840,7 +2820,6 @@ namespace Ink_Canvas
|
||||
else
|
||||
ToggleSwitchEnableTwoFingerRotation.IsOn = BoardToggleSwitchEnableTwoFingerRotation.IsOn;
|
||||
Settings.Gesture.IsEnableTwoFingerRotation = ToggleSwitchEnableTwoFingerRotation.IsOn;
|
||||
Settings.Gesture.IsEnableTwoFingerRotationOnSelection = ToggleSwitchEnableTwoFingerRotationOnSelection.IsOn;
|
||||
CheckEnableTwoFingerGestureBtnColorPrompt();
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
@@ -4247,13 +4226,6 @@ namespace Ink_Canvas
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnablePalmEraser_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
Settings.Canvas.EnablePalmEraser = ToggleSwitchEnablePalmEraser.IsOn;
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
#region 底部按钮水平位置控制
|
||||
|
||||
private void PPTButtonLBPositionValueSlider_ValueChanged(object sender, RoutedEventArgs e)
|
||||
@@ -4357,13 +4329,6 @@ namespace Ink_Canvas
|
||||
|
||||
#endregion
|
||||
|
||||
private void ComboBoxPalmEraserSensitivity_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
Settings.Canvas.PalmEraserSensitivity = ComboBoxPalmEraserSensitivity.SelectedIndex;
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
#region 文件关联管理
|
||||
|
||||
private void BtnUnregisterFileAssociation_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -231,25 +231,21 @@ namespace Ink_Canvas
|
||||
else
|
||||
{
|
||||
Settings.Startup = new Startup();
|
||||
Settings.Startup.IsEnableNibMode = false; // 默认关闭笔尖模式
|
||||
ToggleSwitchEnableNibMode.IsOn = false; // 默认关闭笔尖模式
|
||||
BoardToggleSwitchEnableNibMode.IsOn = false; // 默认关闭笔尖模式
|
||||
BoundsWidth = Settings.Advanced.FingerModeBoundsWidth; // 使用手指模式边界宽度
|
||||
Settings.Startup.IsEnableNibMode = false;
|
||||
ToggleSwitchEnableNibMode.IsOn = false;
|
||||
BoardToggleSwitchEnableNibMode.IsOn = false;
|
||||
BoundsWidth = Settings.Advanced.FingerModeBoundsWidth;
|
||||
}
|
||||
|
||||
// 恢复崩溃后操作设置
|
||||
if (Settings.Startup != null)
|
||||
{
|
||||
// 恢复崩溃后操作选项
|
||||
if (Settings.Startup.CrashAction == 0)
|
||||
{
|
||||
App.CrashAction = App.CrashActionType.SilentRestart;
|
||||
if (RadioCrashSilentRestart != null) RadioCrashSilentRestart.IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
App.CrashAction = App.CrashActionType.NoAction;
|
||||
if (RadioCrashNoAction != null) RadioCrashNoAction.IsChecked = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,13 +654,6 @@ namespace Ink_Canvas
|
||||
ToggleSwitchEnableTwoFingerRotation.IsOn = Settings.Gesture.IsEnableTwoFingerRotation;
|
||||
BoardToggleSwitchEnableTwoFingerRotation.IsOn = Settings.Gesture.IsEnableTwoFingerRotation;
|
||||
|
||||
ToggleSwitchAutoSwitchTwoFingerGesture.IsOn = Settings.Gesture.AutoSwitchTwoFingerGesture;
|
||||
|
||||
ToggleSwitchEnableTwoFingerRotation.IsOn = Settings.Gesture.IsEnableTwoFingerRotation;
|
||||
|
||||
ToggleSwitchEnableTwoFingerRotationOnSelection.IsOn =
|
||||
Settings.Gesture.IsEnableTwoFingerRotationOnSelection;
|
||||
|
||||
if (Settings.Gesture.AutoSwitchTwoFingerGesture)
|
||||
{
|
||||
if (Topmost)
|
||||
@@ -855,13 +844,6 @@ namespace Ink_Canvas
|
||||
Settings.Canvas = new Canvas();
|
||||
}
|
||||
|
||||
// Palm Eraser
|
||||
if (Settings.Canvas != null)
|
||||
{
|
||||
ToggleSwitchEnablePalmEraser.IsOn = Settings.Canvas.EnablePalmEraser;
|
||||
ComboBoxPalmEraserSensitivity.SelectedIndex = Settings.Canvas.PalmEraserSensitivity;
|
||||
}
|
||||
|
||||
// Advanced
|
||||
if (Settings.Advanced != null)
|
||||
{
|
||||
|
||||
@@ -233,8 +233,7 @@ namespace Ink_Canvas
|
||||
if (palmEraserWasEnabledBeforeMultiTouch)
|
||||
{
|
||||
Settings.Canvas.EnablePalmEraser = true;
|
||||
if (ToggleSwitchEnablePalmEraser != null)
|
||||
ToggleSwitchEnablePalmEraser.IsOn = true;
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -259,8 +258,7 @@ namespace Ink_Canvas
|
||||
|
||||
palmEraserWasEnabledBeforeMultiTouch = Settings.Canvas.EnablePalmEraser;
|
||||
Settings.Canvas.EnablePalmEraser = false;
|
||||
if (ToggleSwitchEnablePalmEraser != null)
|
||||
ToggleSwitchEnablePalmEraser.IsOn = false;
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -987,8 +987,14 @@
|
||||
<data name="Startup_ExternalProtocolHint" xml:space="preserve">
|
||||
<value>Control via icc:// protocol</value>
|
||||
</data>
|
||||
<data name="Startup_EnableNibMode" xml:space="preserve">
|
||||
<value>Nib Mode</value>
|
||||
</data>
|
||||
<data name="Startup_EnableNibModeHint" xml:space="preserve">
|
||||
<value>Only respond to pen tip touch, ignore palm and finger</value>
|
||||
</data>
|
||||
<data name="Canvas_GroupTitle" xml:space="preserve">
|
||||
<value>Canvas and ink</value>
|
||||
<value>Canvas</value>
|
||||
</data>
|
||||
<data name="Canvas_ShowCursor" xml:space="preserve">
|
||||
<value>Show pen cursor</value>
|
||||
|
||||
@@ -1029,8 +1029,14 @@
|
||||
<data name="Startup_ExternalProtocolHint" xml:space="preserve">
|
||||
<value>通过 icc:// 协议从外部控制软件</value>
|
||||
</data>
|
||||
<data name="Startup_EnableNibMode" xml:space="preserve">
|
||||
<value>笔尖模式</value>
|
||||
</data>
|
||||
<data name="Startup_EnableNibModeHint" xml:space="preserve">
|
||||
<value>启用后仅响应笔尖触摸,忽略手掌和手指</value>
|
||||
</data>
|
||||
<data name="Canvas_GroupTitle" xml:space="preserve">
|
||||
<value>画板和墨迹</value>
|
||||
<value>画板</value>
|
||||
</data>
|
||||
<data name="Canvas_ShowCursor" xml:space="preserve">
|
||||
<value>显示画笔光标</value>
|
||||
|
||||
@@ -140,20 +140,25 @@
|
||||
SwitchName="ToggleSwitchEnableInkFade"
|
||||
Toggled="ToggleSwitchEnableInkFade_Toggled" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_InkFadeTime}"
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=Canvas_EnableInkFade}"
|
||||
Visibility="{Binding IsOn, ElementName=CardEnableInkFade, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardEnableInkFade, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Stopwatch}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="InkFadeTimeSlider" Width="150" Minimum="1000" Maximum="10000"
|
||||
Value="3000" TickFrequency="1000" IsSnapToTickEnabled="True"
|
||||
ValueChanged="InkFadeTimeSlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=InkFadeTimeSlider, StringFormat={}{0:0}ms}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_InkFadeTime}">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="InkFadeTimeSlider" Width="150" Minimum="1000" Maximum="10000"
|
||||
Value="3000" TickFrequency="1000" IsSnapToTickEnabled="True"
|
||||
ValueChanged="InkFadeTimeSlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=InkFadeTimeSlider, StringFormat={}{0:0}ms}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardHideInkFadeControlInPenMenu"
|
||||
Header="{i18n:I18n Key=Canvas_HideInkFadeInPenMenu}"
|
||||
@@ -223,144 +228,69 @@
|
||||
SwitchName="ToggleSwitchEnableEraserAutoSwitchBack"
|
||||
Toggled="ToggleSwitchEnableEraserAutoSwitchBack_Toggled" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_SwitchBackDelay}"
|
||||
Description="{i18n:I18n Key=Canvas_SwitchBackDelayHint}"
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=Canvas_SwitchBackAfterEraser}"
|
||||
Visibility="{Binding IsOn, ElementName=CardEnableEraserAutoSwitchBack, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
d:Visibility="Visible">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="EraserAutoSwitchBackDelaySlider" Width="150" Minimum="1" Maximum="60"
|
||||
Value="10" TickFrequency="1" IsSnapToTickEnabled="True"
|
||||
ValueChanged="EraserAutoSwitchBackDelaySlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=EraserAutoSwitchBackDelaySlider, StringFormat={}{0:0}秒}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=InkRecog_Title}" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableInkToShape"
|
||||
Header="{i18n:I18n Key=InkRecog_EnableInkRecognition}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Draw}"
|
||||
SwitchName="ToggleSwitchEnableInkToShape"
|
||||
Toggled="ToggleSwitchEnableInkToShape_Toggled" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_ShapeEngine}"
|
||||
Description="{i18n:I18n Key=InkRecog_ShapeEngineHint}">
|
||||
<ComboBox x:Name="ComboBoxShapeRecognitionEngine"
|
||||
SelectionChanged="ComboBoxShapeRecognitionEngine_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineAuto}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineIACore}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineWinRT}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableWinRtHandwritingStrokeBeautify"
|
||||
Header="{i18n:I18n Key=InkRecog_HandwritingBeautify}"
|
||||
Description="{i18n:I18n Key=InkRecog_HandwritingBeautifyHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.PenWorkspace}"
|
||||
SwitchName="ToggleSwitchEnableWinRtHandwritingStrokeBeautify"
|
||||
Toggled="ToggleSwitchEnableWinRtHandwritingStrokeBeautify_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableInkToShapeNoFakePressureRectangle"
|
||||
Header="{i18n:I18n Key=InkRecog_BlockRectFakePressure}"
|
||||
ShowWhen="{Binding IsOn, ElementName=CardEnableInkToShape}"
|
||||
d:Visibility="Visible"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.RectangularClipping}"
|
||||
SwitchName="ToggleSwitchEnableInkToShapeNoFakePressureRectangle"
|
||||
Toggled="ToggleSwitchEnableInkToShapeNoFakePressureRectangle_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableInkToShapeNoFakePressureTriangle"
|
||||
Header="{i18n:I18n Key=InkRecog_BlockTriFakePressure}"
|
||||
ShowWhen="{Binding IsOn, ElementName=CardEnableInkToShape}"
|
||||
d:Visibility="Visible"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.IncidentTriangle}"
|
||||
SwitchName="ToggleSwitchEnableInkToShapeNoFakePressureTriangle"
|
||||
Toggled="ToggleSwitchEnableInkToShapeNoFakePressureTriangle_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="形状修正"
|
||||
Visibility="{Binding IsOn, ElementName=CardEnableInkToShape, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardEnableInkToShape, Mode=OneWay}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardEnableEraserAutoSwitchBack, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_FixTriangle}">
|
||||
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeTriangle" IsChecked="True"
|
||||
Checked="ToggleCheckboxEnableInkToShapeTriangle_CheckedChanged"
|
||||
Unchecked="ToggleCheckboxEnableInkToShapeTriangle_CheckedChanged" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_FixRectangle}">
|
||||
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeRectangle" IsChecked="True"
|
||||
Checked="ToggleCheckboxEnableInkToShapeRectangle_CheckedChanged"
|
||||
Unchecked="ToggleCheckboxEnableInkToShapeRectangle_CheckedChanged" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_FixEllipse}">
|
||||
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeRounded" IsChecked="True"
|
||||
Checked="ToggleCheckboxEnableInkToShapeRounded_CheckedChanged"
|
||||
Unchecked="ToggleCheckboxEnableInkToShapeRounded_CheckedChanged" />
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_SwitchBackDelay}"
|
||||
Description="{i18n:I18n Key=Canvas_SwitchBackDelayHint}">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="EraserAutoSwitchBackDelaySlider" Width="150" Minimum="1" Maximum="60"
|
||||
Value="10" TickFrequency="1" IsSnapToTickEnabled="True"
|
||||
ValueChanged="EraserAutoSwitchBackDelaySlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=EraserAutoSwitchBackDelaySlider, StringFormat={}{0:0}秒}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardAutoStraightenLine"
|
||||
Header="{i18n:I18n Key=InkRecog_AutoStraightLine}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.LineDisplay}"
|
||||
SwitchName="ToggleSwitchAutoStraightenLine"
|
||||
Toggled="ToggleSwitchAutoStraightenLine_Toggled" />
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=Gesture_Title}" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_LengthThreshold}"
|
||||
Visibility="{Binding IsOn, ElementName=CardAutoStraightenLine, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
<controls:LabeledSettingsCard x:Name="CardAutoSwitchTwoFingerGesture"
|
||||
Header="{i18n:I18n Key=Gesture_AutoToggleTwoFinger}"
|
||||
Description="{i18n:I18n Key=Gesture_AutoToggleHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Switch}"
|
||||
SwitchName="ToggleSwitchAutoSwitchTwoFingerGesture"
|
||||
Toggled="ToggleSwitchAutoSwitchTwoFingerGesture_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableTwoFingerRotationOnSelection"
|
||||
Header="{i18n:I18n Key=Gesture_AllowRotateScale}"
|
||||
Description="{i18n:I18n Key=Gesture_AllowRotateScaleHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Rotate}"
|
||||
SwitchName="ToggleSwitchEnableTwoFingerRotationOnSelection"
|
||||
Toggled="ToggleSwitchEnableTwoFingerRotationOnSelection_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnablePalmEraser"
|
||||
Header="{i18n:I18n Key=Gesture_EnablePalmEraser}"
|
||||
Description="{i18n:I18n Key=Gesture_PalmHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.EraseTool}"
|
||||
SwitchName="ToggleSwitchEnablePalmEraser"
|
||||
Toggled="ToggleSwitchEnablePalmEraser_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=Gesture_EnablePalmEraser}"
|
||||
Visibility="{Binding IsOn, ElementName=CardEnablePalmEraser, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardEnablePalmEraser, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="AutoStraightenLineThresholdSlider" Width="150" Minimum="30" Maximum="300"
|
||||
Value="80" TickFrequency="30" IsSnapToTickEnabled="True"
|
||||
ValueChanged="AutoStraightenLineThresholdSlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=AutoStraightenLineThresholdSlider, StringFormat={}{0:0}}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_Sensitivity}"
|
||||
Visibility="{Binding IsOn, ElementName=CardAutoStraightenLine, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
d:Visibility="Visible">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="LineStraightenSensitivitySlider" Width="150" Minimum="0.05" Maximum="2.0"
|
||||
Value="0.20" TickFrequency="0.05" IsSnapToTickEnabled="True"
|
||||
ValueChanged="LineStraightenSensitivitySlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=LineStraightenSensitivitySlider, StringFormat={}{0:F2}}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardHighPrecisionLineStraighten"
|
||||
Header="{i18n:I18n Key=InkRecog_HighPrecisionStraighten}"
|
||||
Description="{i18n:I18n Key=InkRecog_HighPrecisionHint}"
|
||||
ShowWhen="{Binding IsOn, ElementName=CardAutoStraightenLine}"
|
||||
d:Visibility="Visible"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Bullseye}"
|
||||
SwitchName="ToggleSwitchHighPrecisionLineStraighten"
|
||||
Toggled="ToggleSwitchHighPrecisionLineStraighten_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardLineEndpointSnapping"
|
||||
Header="{i18n:I18n Key=InkRecog_LineEndpointSnapping}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Link}"
|
||||
SwitchName="ToggleSwitchLineEndpointSnapping"
|
||||
Toggled="ToggleSwitchLineEndpointSnapping_Toggled" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_SnappingDistance}"
|
||||
Description="{i18n:I18n Key=InkRecog_LineEndpointSnappingHint}"
|
||||
Visibility="{Binding IsOn, ElementName=CardLineEndpointSnapping, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
d:Visibility="Visible">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="LineEndpointSnappingThresholdSlider" Width="150" Minimum="5" Maximum="50"
|
||||
Value="15" TickFrequency="5" IsSnapToTickEnabled="True"
|
||||
ValueChanged="LineEndpointSnappingThresholdSlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=LineEndpointSnappingThresholdSlider, StringFormat={}{0:0}}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Gesture_PalmSensitivity}">
|
||||
<ComboBox x:Name="ComboBoxPalmEraserSensitivity"
|
||||
SelectionChanged="ComboBoxPalmEraserSensitivity_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityLow}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityMedium}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityHigh}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<Rectangle Height="48" />
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using Ink_Canvas.Windows.SettingsViews.Helpers;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
@@ -57,26 +56,18 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
BrushAutoRestoreAlphaSlider.Value = settings.Canvas.BrushAutoRestoreAlpha;
|
||||
CardEnableEraserAutoSwitchBack.IsOn = settings.Canvas.EnableEraserAutoSwitchBack;
|
||||
EraserAutoSwitchBackDelaySlider.Value = settings.Canvas.EraserAutoSwitchBackDelaySeconds;
|
||||
CardAutoStraightenLine.IsOn = settings.Canvas.AutoStraightenLine;
|
||||
AutoStraightenLineThresholdSlider.Value = settings.Canvas.AutoStraightenLineThreshold;
|
||||
CardHighPrecisionLineStraighten.IsOn = settings.Canvas.HighPrecisionLineStraighten;
|
||||
CardLineEndpointSnapping.IsOn = settings.Canvas.LineEndpointSnapping;
|
||||
}
|
||||
|
||||
if (settings.InkToShape != null)
|
||||
if (settings.Gesture != null)
|
||||
{
|
||||
CardEnableInkToShape.IsOn = settings.InkToShape.IsInkToShapeEnabled;
|
||||
int eng = settings.InkToShape.ShapeRecognitionEngine;
|
||||
if (eng < 0) eng = 0;
|
||||
if (eng > 2) eng = 2;
|
||||
ComboBoxShapeRecognitionEngine.SelectedIndex = eng;
|
||||
CardEnableWinRtHandwritingStrokeBeautify.IsOn = settings.InkToShape.EnableWinRtHandwritingStrokeBeautify;
|
||||
CardEnableInkToShapeNoFakePressureRectangle.IsOn = settings.InkToShape.IsInkToShapeNoFakePressureRectangle;
|
||||
CardEnableInkToShapeNoFakePressureTriangle.IsOn = settings.InkToShape.IsInkToShapeNoFakePressureTriangle;
|
||||
ToggleCheckboxEnableInkToShapeTriangle.IsChecked = settings.InkToShape.IsInkToShapeTriangle;
|
||||
ToggleCheckboxEnableInkToShapeRectangle.IsChecked = settings.InkToShape.IsInkToShapeRectangle;
|
||||
ToggleCheckboxEnableInkToShapeRounded.IsChecked = settings.InkToShape.IsInkToShapeRounded;
|
||||
LineStraightenSensitivitySlider.Value = settings.InkToShape.LineStraightenSensitivity;
|
||||
CardAutoSwitchTwoFingerGesture.IsOn = settings.Gesture.AutoSwitchTwoFingerGesture;
|
||||
CardEnableTwoFingerRotationOnSelection.IsOn = settings.Gesture.IsEnableTwoFingerRotationOnSelection;
|
||||
}
|
||||
|
||||
if (settings.Canvas != null)
|
||||
{
|
||||
CardEnablePalmEraser.IsOn = settings.Canvas.EnablePalmEraser;
|
||||
ComboBoxPalmEraserSensitivity.SelectedIndex = settings.Canvas.PalmEraserSensitivity;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -108,8 +99,6 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
}
|
||||
}
|
||||
|
||||
#region 画板设置事件处理
|
||||
|
||||
private void ToggleSwitchShowCursor_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -295,111 +284,32 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 墨迹识别事件处理
|
||||
|
||||
private void ToggleSwitchEnableInkToShape_Toggled(object sender, RoutedEventArgs e)
|
||||
private void ToggleSwitchAutoSwitchTwoFingerGesture_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeEnabled = CardEnableInkToShape.IsOn;
|
||||
SettingsManager.Settings.Gesture.AutoSwitchTwoFingerGesture = CardAutoSwitchTwoFingerGesture.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ComboBoxShapeRecognitionEngine_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded || ComboBoxShapeRecognitionEngine == null) return;
|
||||
int idx = ComboBoxShapeRecognitionEngine.SelectedIndex;
|
||||
if (idx < 0) idx = 0;
|
||||
if (idx > 2) idx = 2;
|
||||
SettingsManager.Settings.InkToShape.ShapeRecognitionEngine = idx;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableWinRtHandwritingStrokeBeautify_Toggled(object sender, RoutedEventArgs e)
|
||||
private void ToggleSwitchEnableTwoFingerRotationOnSelection_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.EnableWinRtHandwritingStrokeBeautify = CardEnableWinRtHandwritingStrokeBeautify.IsOn;
|
||||
SettingsManager.Settings.Gesture.IsEnableTwoFingerRotationOnSelection = CardEnableTwoFingerRotationOnSelection.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableInkToShapeNoFakePressureRectangle_Toggled(object sender, RoutedEventArgs e)
|
||||
private void ToggleSwitchEnablePalmEraser_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeNoFakePressureRectangle = CardEnableInkToShapeNoFakePressureRectangle.IsOn;
|
||||
SettingsManager.Settings.Canvas.EnablePalmEraser = CardEnablePalmEraser.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableInkToShapeNoFakePressureTriangle_Toggled(object sender, RoutedEventArgs e)
|
||||
private void ComboBoxPalmEraserSensitivity_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeNoFakePressureTriangle = CardEnableInkToShapeNoFakePressureTriangle.IsOn;
|
||||
SettingsManager.Settings.Canvas.PalmEraserSensitivity = ComboBoxPalmEraserSensitivity.SelectedIndex;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleCheckboxEnableInkToShapeTriangle_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeTriangle = (bool)ToggleCheckboxEnableInkToShapeTriangle.IsChecked;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleCheckboxEnableInkToShapeRectangle_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeRectangle = (bool)ToggleCheckboxEnableInkToShapeRectangle.IsChecked;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleCheckboxEnableInkToShapeRounded_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeRounded = (bool)ToggleCheckboxEnableInkToShapeRounded.IsChecked;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchAutoStraightenLine_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.AutoStraightenLine = CardAutoStraightenLine.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void AutoStraightenLineThresholdSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.AutoStraightenLineThreshold = (int)e.NewValue;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void LineStraightenSensitivitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.LineStraightenSensitivity = e.NewValue;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchHighPrecisionLineStraighten_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.HighPrecisionLineStraighten = CardHighPrecisionLineStraighten.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchLineEndpointSnapping_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.LineEndpointSnapping = CardLineEndpointSnapping.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void LineEndpointSnappingThresholdSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.LineEndpointSnappingThreshold = (int)e.NewValue;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,13 +71,20 @@
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Header="画板" Description="画板与墨迹设置"
|
||||
<ui:SettingsCard Header="画板" Description="画板设置"
|
||||
IsClickEnabled="True" Click="QuickNavCard_Click" Tag="CanvasPage">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Header="墨迹纠正" Description="墨迹纠正设置"
|
||||
IsClickEnabled="True" Click="QuickNavCard_Click" Tag="InkRecognitionPage">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Draw}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Header="关于" Description="关于 InkCanvasForClass"
|
||||
IsClickEnabled="True" Click="QuickNavCard_Click" Tag="AboutPage">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
<ui:Page x:Class="Ink_Canvas.Windows.SettingsViews.Pages.InkRecognitionPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews.Pages"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
||||
xmlns:i18n="clr-namespace:Ink_Canvas.MarkupExtensions"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:controls="clr-namespace:Ink_Canvas.Controls;assembly=InkCanvas.Controls"
|
||||
xmlns:c="clr-namespace:Ink_Canvas.Converter"
|
||||
mc:Ignorable="d"
|
||||
Title="墨迹纠正">
|
||||
<ScrollViewer PanningMode="VerticalFirst">
|
||||
<Grid Margin="59,0,59,0">
|
||||
<FrameworkElement.Resources>
|
||||
<sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
|
||||
<c:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
|
||||
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Style.Setters>
|
||||
<Setter Property="Margin" Value="1,30,0,6" />
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</FrameworkElement.Resources>
|
||||
<Grid>
|
||||
<ikw:SimpleStackPanel MaxWidth="1000" HorizontalAlignment="Stretch"
|
||||
Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=InkRecog_Title}" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableInkToShape"
|
||||
Header="{i18n:I18n Key=InkRecog_EnableInkRecognition}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Draw}"
|
||||
SwitchName="ToggleSwitchEnableInkToShape"
|
||||
Toggled="ToggleSwitchEnableInkToShape_Toggled" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_ShapeEngine}"
|
||||
Description="{i18n:I18n Key=InkRecog_ShapeEngineHint}">
|
||||
<ComboBox x:Name="ComboBoxShapeRecognitionEngine"
|
||||
SelectionChanged="ComboBoxShapeRecognitionEngine_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineAuto}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineIACore}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineWinRT}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableWinRtHandwritingStrokeBeautify"
|
||||
Header="{i18n:I18n Key=InkRecog_HandwritingBeautify}"
|
||||
Description="{i18n:I18n Key=InkRecog_HandwritingBeautifyHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.PenWorkspace}"
|
||||
SwitchName="ToggleSwitchEnableWinRtHandwritingStrokeBeautify"
|
||||
Toggled="ToggleSwitchEnableWinRtHandwritingStrokeBeautify_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableInkToShapeNoFakePressureRectangle"
|
||||
Header="{i18n:I18n Key=InkRecog_BlockRectFakePressure}"
|
||||
ShowWhen="{Binding IsOn, ElementName=CardEnableInkToShape}"
|
||||
d:Visibility="Visible"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.RectangularClipping}"
|
||||
SwitchName="ToggleSwitchEnableInkToShapeNoFakePressureRectangle"
|
||||
Toggled="ToggleSwitchEnableInkToShapeNoFakePressureRectangle_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableInkToShapeNoFakePressureTriangle"
|
||||
Header="{i18n:I18n Key=InkRecog_BlockTriFakePressure}"
|
||||
ShowWhen="{Binding IsOn, ElementName=CardEnableInkToShape}"
|
||||
d:Visibility="Visible"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.IncidentTriangle}"
|
||||
SwitchName="ToggleSwitchEnableInkToShapeNoFakePressureTriangle"
|
||||
Toggled="ToggleSwitchEnableInkToShapeNoFakePressureTriangle_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="形状修正"
|
||||
Visibility="{Binding IsOn, ElementName=CardEnableInkToShape, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardEnableInkToShape, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_FixTriangle}">
|
||||
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeTriangle" IsChecked="True"
|
||||
Checked="ToggleCheckboxEnableInkToShapeTriangle_CheckedChanged"
|
||||
Unchecked="ToggleCheckboxEnableInkToShapeTriangle_CheckedChanged" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_FixRectangle}">
|
||||
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeRectangle" IsChecked="True"
|
||||
Checked="ToggleCheckboxEnableInkToShapeRectangle_CheckedChanged"
|
||||
Unchecked="ToggleCheckboxEnableInkToShapeRectangle_CheckedChanged" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_FixEllipse}">
|
||||
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeRounded" IsChecked="True"
|
||||
Checked="ToggleCheckboxEnableInkToShapeRounded_CheckedChanged"
|
||||
Unchecked="ToggleCheckboxEnableInkToShapeRounded_CheckedChanged" />
|
||||
</ui:SettingsCard>
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardAutoStraightenLine"
|
||||
Header="{i18n:I18n Key=InkRecog_AutoStraightLine}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.LineDisplay}"
|
||||
SwitchName="ToggleSwitchAutoStraightenLine"
|
||||
Toggled="ToggleSwitchAutoStraightenLine_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=InkRecog_AutoStraightLine}"
|
||||
Visibility="{Binding IsOn, ElementName=CardAutoStraightenLine, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardAutoStraightenLine, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_LengthThreshold}">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="AutoStraightenLineThresholdSlider" Width="150" Minimum="30" Maximum="300"
|
||||
Value="80" TickFrequency="30" IsSnapToTickEnabled="True"
|
||||
ValueChanged="AutoStraightenLineThresholdSlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=AutoStraightenLineThresholdSlider, StringFormat={}{0:0}}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_Sensitivity}">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="LineStraightenSensitivitySlider" Width="150" Minimum="0.05" Maximum="2.0"
|
||||
Value="0.20" TickFrequency="0.05" IsSnapToTickEnabled="True"
|
||||
ValueChanged="LineStraightenSensitivitySlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=LineStraightenSensitivitySlider, StringFormat={}{0:F2}}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_HighPrecisionStraighten}"
|
||||
Description="{i18n:I18n Key=InkRecog_HighPrecisionHint}">
|
||||
<CheckBox x:Name="CheckboxHighPrecisionLineStraighten" IsChecked="False"
|
||||
Checked="CheckboxHighPrecisionLineStraighten_CheckedChanged"
|
||||
Unchecked="CheckboxHighPrecisionLineStraighten_CheckedChanged" />
|
||||
</ui:SettingsCard>
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardLineEndpointSnapping"
|
||||
Header="{i18n:I18n Key=InkRecog_LineEndpointSnapping}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Link}"
|
||||
SwitchName="ToggleSwitchLineEndpointSnapping"
|
||||
Toggled="ToggleSwitchLineEndpointSnapping_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=InkRecog_LineEndpointSnapping}"
|
||||
Visibility="{Binding IsOn, ElementName=CardLineEndpointSnapping, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardLineEndpointSnapping, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_SnappingDistance}"
|
||||
Description="{i18n:I18n Key=InkRecog_LineEndpointSnappingHint}">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<Slider x:Name="LineEndpointSnappingThresholdSlider" Width="150" Minimum="5" Maximum="50"
|
||||
Value="15" TickFrequency="5" IsSnapToTickEnabled="True"
|
||||
ValueChanged="LineEndpointSnappingThresholdSlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding Value, ElementName=LineEndpointSnappingThresholdSlider, StringFormat={}{0:0}}"
|
||||
VerticalAlignment="Center" FontSize="14" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<Rectangle Height="48" />
|
||||
|
||||
</ikw:SimpleStackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</ui:Page>
|
||||
@@ -0,0 +1,166 @@
|
||||
using Ink_Canvas.Windows.SettingsViews.Helpers;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
{
|
||||
public partial class InkRecognitionPage : iNKORE.UI.WPF.Modern.Controls.Page
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public InkRecognitionPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += InkRecognitionPage_Loaded;
|
||||
}
|
||||
|
||||
private void InkRecognitionPage_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
private void LoadSettings()
|
||||
{
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
var settings = SettingsManager.Settings;
|
||||
|
||||
if (settings.InkToShape != null)
|
||||
{
|
||||
CardEnableInkToShape.IsOn = settings.InkToShape.IsInkToShapeEnabled;
|
||||
int eng = settings.InkToShape.ShapeRecognitionEngine;
|
||||
if (eng < 0) eng = 0;
|
||||
if (eng > 2) eng = 2;
|
||||
ComboBoxShapeRecognitionEngine.SelectedIndex = eng;
|
||||
CardEnableWinRtHandwritingStrokeBeautify.IsOn = settings.InkToShape.EnableWinRtHandwritingStrokeBeautify;
|
||||
CardEnableInkToShapeNoFakePressureRectangle.IsOn = settings.InkToShape.IsInkToShapeNoFakePressureRectangle;
|
||||
CardEnableInkToShapeNoFakePressureTriangle.IsOn = settings.InkToShape.IsInkToShapeNoFakePressureTriangle;
|
||||
ToggleCheckboxEnableInkToShapeTriangle.IsChecked = settings.InkToShape.IsInkToShapeTriangle;
|
||||
ToggleCheckboxEnableInkToShapeRectangle.IsChecked = settings.InkToShape.IsInkToShapeRectangle;
|
||||
ToggleCheckboxEnableInkToShapeRounded.IsChecked = settings.InkToShape.IsInkToShapeRounded;
|
||||
LineStraightenSensitivitySlider.Value = settings.InkToShape.LineStraightenSensitivity;
|
||||
}
|
||||
|
||||
if (settings.Canvas != null)
|
||||
{
|
||||
CardAutoStraightenLine.IsOn = settings.Canvas.AutoStraightenLine;
|
||||
AutoStraightenLineThresholdSlider.Value = settings.Canvas.AutoStraightenLineThreshold;
|
||||
CheckboxHighPrecisionLineStraighten.IsChecked = settings.Canvas.HighPrecisionLineStraighten;
|
||||
CardLineEndpointSnapping.IsOn = settings.Canvas.LineEndpointSnapping;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"加载墨迹纠正设置时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableInkToShape_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeEnabled = CardEnableInkToShape.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ComboBoxShapeRecognitionEngine_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded || ComboBoxShapeRecognitionEngine == null) return;
|
||||
int idx = ComboBoxShapeRecognitionEngine.SelectedIndex;
|
||||
if (idx < 0) idx = 0;
|
||||
if (idx > 2) idx = 2;
|
||||
SettingsManager.Settings.InkToShape.ShapeRecognitionEngine = idx;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableWinRtHandwritingStrokeBeautify_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.EnableWinRtHandwritingStrokeBeautify = CardEnableWinRtHandwritingStrokeBeautify.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableInkToShapeNoFakePressureRectangle_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeNoFakePressureRectangle = CardEnableInkToShapeNoFakePressureRectangle.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableInkToShapeNoFakePressureTriangle_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeNoFakePressureTriangle = CardEnableInkToShapeNoFakePressureTriangle.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleCheckboxEnableInkToShapeTriangle_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeTriangle = (bool)ToggleCheckboxEnableInkToShapeTriangle.IsChecked;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleCheckboxEnableInkToShapeRectangle_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeRectangle = (bool)ToggleCheckboxEnableInkToShapeRectangle.IsChecked;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleCheckboxEnableInkToShapeRounded_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.IsInkToShapeRounded = (bool)ToggleCheckboxEnableInkToShapeRounded.IsChecked;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchAutoStraightenLine_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.AutoStraightenLine = CardAutoStraightenLine.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void AutoStraightenLineThresholdSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.AutoStraightenLineThreshold = (int)e.NewValue;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void LineStraightenSensitivitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.InkToShape.LineStraightenSensitivity = e.NewValue;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void CheckboxHighPrecisionLineStraighten_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.HighPrecisionLineStraighten = (bool)CheckboxHighPrecisionLineStraighten.IsChecked;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchLineEndpointSnapping_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.LineEndpointSnapping = CardLineEndpointSnapping.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void LineEndpointSnappingThresholdSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.LineEndpointSnappingThreshold = (int)e.NewValue;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,36 @@
|
||||
SwitchName="ToggleSwitchPPTOnlyMode"
|
||||
Toggled="ToggleSwitchPPTOnlyMode_Toggled" />
|
||||
|
||||
<!-- 笔尖模式 -->
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=Startup_EnableNibMode}" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableNibMode"
|
||||
Header="{i18n:I18n Key=Startup_EnableNibMode}"
|
||||
Description="{i18n:I18n Key=Startup_EnableNibModeHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.TouchPointer}"
|
||||
SwitchName="ToggleSwitchEnableNibMode"
|
||||
Toggled="ToggleSwitchEnableNibMode_Toggled" />
|
||||
|
||||
<!-- 崩溃后操作 -->
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=Crash_Title}" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Crash_Title}"
|
||||
Description="{i18n:I18n Key=Crash_Desc}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Warning}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<RadioButton x:Name="RadioCrashSilentRestart" GroupName="CrashAction"
|
||||
Content="{i18n:I18n Key=Crash_SilentRestart}"
|
||||
Checked="RadioCrashAction_Checked" />
|
||||
<RadioButton x:Name="RadioCrashNoAction" GroupName="CrashAction"
|
||||
Content="{i18n:I18n Key=Crash_NoAction}"
|
||||
Checked="RadioCrashAction_Checked" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<!-- 底部空白 -->
|
||||
<Rectangle Height="48" />
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Ink_Canvas.Windows.SettingsViews.Helpers;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
{
|
||||
@@ -44,6 +45,20 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
}
|
||||
|
||||
CardExternalProtocol.IsOn = settings.Advanced.IsEnableUriScheme;
|
||||
|
||||
if (settings.Startup != null)
|
||||
{
|
||||
CardEnableNibMode.IsOn = settings.Startup.IsEnableNibMode;
|
||||
|
||||
if (settings.Startup.CrashAction == 0)
|
||||
{
|
||||
RadioCrashSilentRestart.IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RadioCrashNoAction.IsChecked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -151,6 +166,70 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
|
||||
#endregion
|
||||
|
||||
#region 笔尖模式事件处理
|
||||
|
||||
private void ToggleSwitchEnableNibMode_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
try
|
||||
{
|
||||
bool newState = CardEnableNibMode.IsOn;
|
||||
SettingsManager.Settings.Startup.IsEnableNibMode = newState;
|
||||
|
||||
var window = Application.Current.MainWindow;
|
||||
if (window is MainWindow mw)
|
||||
{
|
||||
if (mw.ToggleSwitchEnableNibMode != null)
|
||||
mw.ToggleSwitchEnableNibMode.IsOn = newState;
|
||||
if (mw.BoardToggleSwitchEnableNibMode != null)
|
||||
mw.BoardToggleSwitchEnableNibMode.IsOn = newState;
|
||||
|
||||
if (newState)
|
||||
mw.BoundsWidth = SettingsManager.Settings.Advanced.NibModeBoundsWidth;
|
||||
else
|
||||
mw.BoundsWidth = SettingsManager.Settings.Advanced.FingerModeBoundsWidth;
|
||||
}
|
||||
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"设置笔尖模式时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 崩溃后操作事件处理
|
||||
|
||||
private void RadioCrashAction_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
try
|
||||
{
|
||||
if (RadioCrashSilentRestart != null && RadioCrashSilentRestart.IsChecked == true)
|
||||
{
|
||||
App.CrashAction = App.CrashActionType.SilentRestart;
|
||||
SettingsManager.Settings.Startup.CrashAction = 0;
|
||||
}
|
||||
else if (RadioCrashNoAction != null && RadioCrashNoAction.IsChecked == true)
|
||||
{
|
||||
App.CrashAction = App.CrashActionType.NoAction;
|
||||
SettingsManager.Settings.Startup.CrashAction = 1;
|
||||
}
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
App.SyncCrashActionFromSettings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"设置崩溃操作时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 模式设置事件处理
|
||||
|
||||
private void ToggleSwitchPPTOnlyMode_Toggled(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -205,10 +205,31 @@
|
||||
x:Name="CanvasPageItem"
|
||||
Content="画板"
|
||||
Tag="CanvasPage"
|
||||
SelectsOnInvoked="True"
|
||||
ToolTipService.ToolTip="画板与墨迹设置">
|
||||
<ui:NavigationViewItem.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}"/>
|
||||
</ui:NavigationViewItem.Icon>
|
||||
<ui:NavigationViewItem.MenuItems>
|
||||
<ui:NavigationViewItem
|
||||
x:Name="CanvasSubPageItem"
|
||||
Content="画板"
|
||||
Tag="CanvasPage"
|
||||
ToolTipService.ToolTip="画板设置">
|
||||
<ui:NavigationViewItem.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}"/>
|
||||
</ui:NavigationViewItem.Icon>
|
||||
</ui:NavigationViewItem>
|
||||
<ui:NavigationViewItem
|
||||
x:Name="InkRecognitionPageItem"
|
||||
Content="墨迹纠正"
|
||||
Tag="InkRecognitionPage"
|
||||
ToolTipService.ToolTip="墨迹纠正设置">
|
||||
<ui:NavigationViewItem.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Draw}"/>
|
||||
</ui:NavigationViewItem.Icon>
|
||||
</ui:NavigationViewItem>
|
||||
</ui:NavigationViewItem.MenuItems>
|
||||
</ui:NavigationViewItem>
|
||||
|
||||
<!-- Debug -->
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{ "UpdatePage", typeof(UpdatePage) },
|
||||
{ "ExperimentalPage", typeof(ExperimentalPage) },
|
||||
{ "CanvasPage", typeof(CanvasPage) },
|
||||
{ "InkRecognitionPage", typeof(InkRecognitionPage) },
|
||||
{ "DebugPage", typeof(IconographyPage) },
|
||||
{ "AboutPage", typeof(AboutPage) },
|
||||
{ "Settings", typeof(SettingsPage) },
|
||||
|
||||
Reference in New Issue
Block a user