improve:UI

This commit is contained in:
2026-05-02 10:06:21 +08:00
parent be34eda535
commit 860dc43c8d
12 changed files with 202 additions and 46 deletions
+58 -1
View File
@@ -2737,7 +2737,22 @@ Hide</value>
<value>Logs</value>
</data>
<data name="Storage_Logs_Desc" xml:space="preserve">
<value>.txt logs and crash reports under Logs / Crashs. Cleanable.</value>
<value>.txt logs and crash reports under Logs / Crashes. Cleanable.</value>
</data>
<data name="Hotkey_NotSet" xml:space="preserve">
<value>Not set</value>
</data>
<data name="Settings_Nav_Security" xml:space="preserve">
<value>Security</value>
</data>
<data name="Settings_Nav_Security_Tooltip" xml:space="preserve">
<value>Security password and process protection</value>
</data>
<data name="Settings_Nav_Hotkey" xml:space="preserve">
<value>Hotkeys</value>
</data>
<data name="Settings_Nav_Hotkey_Tooltip" xml:space="preserve">
<value>Hotkey settings</value>
</data>
<data name="Storage_Ink_Header" xml:space="preserve">
<value>Ink</value>
@@ -2799,4 +2814,46 @@ Hide</value>
<data name="Storage_NavTooltip" xml:space="preserve">
<value>View and clean storage used by ICC CE</value>
</data>
<data name="Debug_ShowConsole_Header" xml:space="preserve">
<value>Show debug console</value>
</data>
<data name="Debug_ShowConsole_Desc" xml:space="preserve">
<value>Show a separate console window for live log output (takes effect immediately; if "Enable logging" is off in settings, no content will be emitted).</value>
</data>
<data name="Automation_UseCustomSaveFileName_Header" xml:space="preserve">
<value>Use custom save file name</value>
</data>
<data name="Automation_UseCustomSaveFileName_Desc" xml:space="preserve">
<value>When enabled, choose how saved files are named</value>
</data>
<data name="Automation_SaveFileNameFormat" xml:space="preserve">
<value>File name format</value>
</data>
<data name="Automation_SaveFileName_Timestamp" xml:space="preserve">
<value>Timestamp (default)</value>
</data>
<data name="Automation_SaveFileName_Date" xml:space="preserve">
<value>Date</value>
</data>
<data name="Automation_SaveFileName_DateTime" xml:space="preserve">
<value>Date + Time</value>
</data>
<data name="Automation_SaveFileName_DateMode" xml:space="preserve">
<value>Date + Mode</value>
</data>
<data name="Automation_SaveFileName_DateModePage" xml:space="preserve">
<value>Date + Mode + Page</value>
</data>
<data name="Automation_SaveFileName_DateModePageCount" xml:space="preserve">
<value>Date + Mode + Page + Stroke count</value>
</data>
<data name="Automation_SaveFileName_Custom" xml:space="preserve">
<value>Custom...</value>
</data>
<data name="Automation_SaveFileName_CustomTemplate_Header" xml:space="preserve">
<value>Custom template</value>
</data>
<data name="Automation_SaveFileName_CustomTemplate_Desc" xml:space="preserve">
<value>Available placeholders: {date} {time} {datetime} {mode} {page} {count} {type}</value>
</data>
</root>
+57
View File
@@ -2782,6 +2782,21 @@
<data name="Storage_Logs_Desc" xml:space="preserve">
<value>位于 Logs / Crashs 目录下的 .txt 日志与崩溃报告,可清理</value>
</data>
<data name="Hotkey_NotSet" xml:space="preserve">
<value>未设置</value>
</data>
<data name="Settings_Nav_Security" xml:space="preserve">
<value>安全</value>
</data>
<data name="Settings_Nav_Security_Tooltip" xml:space="preserve">
<value>安全密码与进程保护</value>
</data>
<data name="Settings_Nav_Hotkey" xml:space="preserve">
<value>快捷键</value>
</data>
<data name="Settings_Nav_Hotkey_Tooltip" xml:space="preserve">
<value>快捷键设置</value>
</data>
<data name="Storage_Ink_Header" xml:space="preserve">
<value>墨迹</value>
</data>
@@ -2842,4 +2857,46 @@
<data name="Storage_NavTooltip" xml:space="preserve">
<value>查看与清理 ICC CE 占用的存储空间</value>
</data>
<data name="Debug_ShowConsole_Header" xml:space="preserve">
<value>显示调试窗口</value>
</data>
<data name="Debug_ShowConsole_Desc" xml:space="preserve">
<value>显示一个独立的控制台窗口,用于实时输出日志(开启后立即生效;关闭设置中的“启用日志记录”将不会输出内容)。</value>
</data>
<data name="Automation_UseCustomSaveFileName_Header" xml:space="preserve">
<value>使用自定义保存文件名</value>
</data>
<data name="Automation_UseCustomSaveFileName_Desc" xml:space="preserve">
<value>开启后可选择保存文件的命名方式</value>
</data>
<data name="Automation_SaveFileNameFormat" xml:space="preserve">
<value>文件名格式</value>
</data>
<data name="Automation_SaveFileName_Timestamp" xml:space="preserve">
<value>时间戳(默认)</value>
</data>
<data name="Automation_SaveFileName_Date" xml:space="preserve">
<value>日期</value>
</data>
<data name="Automation_SaveFileName_DateTime" xml:space="preserve">
<value>日期 + 时间</value>
</data>
<data name="Automation_SaveFileName_DateMode" xml:space="preserve">
<value>日期 + 模式</value>
</data>
<data name="Automation_SaveFileName_DateModePage" xml:space="preserve">
<value>日期 + 模式 + 页码</value>
</data>
<data name="Automation_SaveFileName_DateModePageCount" xml:space="preserve">
<value>日期 + 模式 + 页码 + 笔画数</value>
</data>
<data name="Automation_SaveFileName_Custom" xml:space="preserve">
<value>自定义...</value>
</data>
<data name="Automation_SaveFileName_CustomTemplate_Header" xml:space="preserve">
<value>自定义模板</value>
</data>
<data name="Automation_SaveFileName_CustomTemplate_Desc" xml:space="preserve">
<value>可用占位符:{date} {time} {datetime} {mode} {page} {count} {type}</value>
</data>
</root>
+2 -1
View File
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
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"
mc:Ignorable="d"
d:DesignHeight="68"
d:DesignWidth="600">
@@ -20,7 +21,7 @@
FontFamily="Consolas"
FontWeight="SemiBold"
Click="BtnSetHotkey_Click">
<TextBlock x:Name="CurrentHotkeyTextBlock" Text="未设置" />
<TextBlock x:Name="CurrentHotkeyTextBlock" Text="{i18n:I18n Key=Hotkey_NotSet}" />
</Button>
</ui:SettingsCard>
</UserControl>
+2 -1
View File
@@ -1,3 +1,4 @@
using Ink_Canvas.Helpers;
using System;
using System.Windows;
using System.Windows.Controls;
@@ -68,7 +69,7 @@ namespace Ink_Canvas.Windows
{
if (_currentKey == Key.None)
{
CurrentHotkeyTextBlock.Text = "未设置";
CurrentHotkeyTextBlock.Text = LocalizationHelper.GetString("Hotkey_NotSet");
}
else
{
@@ -339,14 +339,12 @@ namespace Ink_Canvas.Windows.SettingsViews.Helpers
};
bool isThemeRelated = false;
string controlNameLower = controlName.ToLower();
foreach (var themeControl in themeRelatedControls)
{
string themeControlLower = themeControl.ToLower();
if (controlNameLower.Contains(themeControlLower) ||
themeControlLower.Contains(controlNameLower) ||
controlNameLower == themeControlLower)
// OrdinalIgnoreCase 避免在循环里反复 ToLower() 生成中间字符串。
if (controlName.IndexOf(themeControl, StringComparison.OrdinalIgnoreCase) >= 0 ||
themeControl.IndexOf(controlName, StringComparison.OrdinalIgnoreCase) >= 0)
{
isThemeRelated = true;
break;
@@ -228,8 +228,14 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
private void ViewboxFloatingBarScaleTransformValueSlider_ValueChanged(object sender, RoutedEventArgs e)
{
if (!_isLoaded) return;
var val = Math.Round(ViewboxFloatingBarScaleTransformValueSlider.Value, 2);
ViewboxFloatingBarScaleTransformValueSlider.Value = val;
var slider = ViewboxFloatingBarScaleTransformValueSlider;
var val = Math.Round(slider.Value, 2);
// 仅当四舍五入纠正了显示值时才回写;那次 set 会重入 ValueChanged 完成保存。
if (slider.Value != val)
{
slider.Value = val;
return;
}
SettingsManager.Settings.Appearance.ViewboxFloatingBarScaleTransformValue = val;
SettingsManager.SaveSettingsToFile();
var mw = GetMainWindow();
@@ -247,8 +253,13 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
private void ViewboxFloatingBarOpacityValueSlider_ValueChanged(object sender, RoutedEventArgs e)
{
if (!_isLoaded) return;
var val = Math.Round(ViewboxFloatingBarOpacityValueSlider.Value, 2);
ViewboxFloatingBarOpacityValueSlider.Value = val;
var slider = ViewboxFloatingBarOpacityValueSlider;
var val = Math.Round(slider.Value, 2);
if (slider.Value != val)
{
slider.Value = val;
return;
}
SettingsManager.Settings.Appearance.ViewboxFloatingBarOpacityValue = val;
SettingsManager.SaveSettingsToFile();
var mw = GetMainWindow();
@@ -258,8 +269,13 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
private void ViewboxFloatingBarOpacityInPPTValueSlider_ValueChanged(object sender, RoutedEventArgs e)
{
if (!_isLoaded) return;
var val = Math.Round(ViewboxFloatingBarOpacityInPPTValueSlider.Value, 2);
ViewboxFloatingBarOpacityInPPTValueSlider.Value = val;
var slider = ViewboxFloatingBarOpacityInPPTValueSlider;
var val = Math.Round(slider.Value, 2);
if (slider.Value != val)
{
slider.Value = val;
return;
}
SettingsManager.Settings.Appearance.ViewboxFloatingBarOpacityInPPTValue = val;
SettingsManager.SaveSettingsToFile();
var mw = GetMainWindow();
@@ -290,8 +306,13 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
private void ViewboxBlackBoardScaleTransformValueSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!_isLoaded) return;
var val = Math.Round(ViewboxBlackBoardScaleTransformValueSlider.Value, 2);
ViewboxBlackBoardScaleTransformValueSlider.Value = val;
var slider = ViewboxBlackBoardScaleTransformValueSlider;
var val = Math.Round(slider.Value, 2);
if (slider.Value != val)
{
slider.Value = val;
return;
}
SettingsManager.Settings.Appearance.ViewboxBlackBoardScaleTransformValue = val;
SettingsManager.SaveSettingsToFile();
var mw = GetMainWindow();
@@ -373,30 +373,30 @@
Toggled="ToggleSwitchSaveFullPageStrokes_Toggled"/>
<controls:LabeledSettingsCard x:Name="CardUseCustomSaveFileName"
Header="使用自定义保存文件名"
Description="开启后可选择保存文件的命名方式"
Header="{i18n:I18n Key=Automation_UseCustomSaveFileName_Header}"
Description="{i18n:I18n Key=Automation_UseCustomSaveFileName_Desc}"
Icon="{x:Static ui:SegoeFluentIcons.Edit}"
Toggled="ToggleSwitchUseCustomSaveFileName_Toggled"/>
<ui:SettingsExpander x:Name="CardSaveFileNamePreset" Header="文件名格式">
<ui:SettingsExpander x:Name="CardSaveFileNamePreset" Header="{i18n:I18n Key=Automation_SaveFileNameFormat}">
<ui:SettingsExpander.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}"/>
</ui:SettingsExpander.HeaderIcon>
<ComboBox x:Name="ComboBoxSaveFileNamePreset"
MinWidth="260"
SelectionChanged="ComboBoxSaveFileNamePreset_SelectionChanged">
<ComboBoxItem Content="时间戳(默认)" Tag="{}{datetime}"/>
<ComboBoxItem Content="日期" Tag="{}{date}"/>
<ComboBoxItem Content="日期 + 时间" Tag="{}{date}_{time}"/>
<ComboBoxItem Content="日期 + 模式" Tag="{}{date}_{mode}"/>
<ComboBoxItem Content="日期 + 模式 + 页码" Tag="{}{date}_{mode}_Page-{page}"/>
<ComboBoxItem Content="日期 + 模式 + 页码 + 笔画数" Tag="{}{date}_{mode}_Page-{page}_Strokes-{count}"/>
<ComboBoxItem Content="自定义..." Tag="__custom__"/>
<ComboBoxItem Content="{i18n:I18n Key=Automation_SaveFileName_Timestamp}" Tag="{}{datetime}"/>
<ComboBoxItem Content="{i18n:I18n Key=Automation_SaveFileName_Date}" Tag="{}{date}"/>
<ComboBoxItem Content="{i18n:I18n Key=Automation_SaveFileName_DateTime}" Tag="{}{date}_{time}"/>
<ComboBoxItem Content="{i18n:I18n Key=Automation_SaveFileName_DateMode}" Tag="{}{date}_{mode}"/>
<ComboBoxItem Content="{i18n:I18n Key=Automation_SaveFileName_DateModePage}" Tag="{}{date}_{mode}_Page-{page}"/>
<ComboBoxItem Content="{i18n:I18n Key=Automation_SaveFileName_DateModePageCount}" Tag="{}{date}_{mode}_Page-{page}_Strokes-{count}"/>
<ComboBoxItem Content="{i18n:I18n Key=Automation_SaveFileName_Custom}" Tag="__custom__"/>
</ComboBox>
<ui:SettingsExpander.Items>
<ui:SettingsCard x:Name="CardCustomSaveFileNameTemplate"
Header="自定义模板"
Description="可用占位符:{date} {time} {datetime} {mode} {page} {count} {type}"
Header="{i18n:I18n Key=Automation_SaveFileName_CustomTemplate_Header}"
Description="{i18n:I18n Key=Automation_SaveFileName_CustomTemplate_Desc}"
Visibility="Collapsed">
<TextBox x:Name="TextBoxCustomSaveFileNameTemplate"
MinWidth="260"
@@ -294,8 +294,14 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
private void BrushAutoRestoreWidthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!_isLoaded) return;
var val = Math.Round(BrushAutoRestoreWidthSlider.Value, 2);
BrushAutoRestoreWidthSlider.Value = val;
var slider = BrushAutoRestoreWidthSlider;
var val = Math.Round(slider.Value, 2);
// 仅在四舍五入纠正了显示值时回写;那次 set 会重入 ValueChanged 完成保存。
if (slider.Value != val)
{
slider.Value = val;
return;
}
SettingsManager.Settings.Canvas.BrushAutoRestoreWidth = val;
SettingsManager.SaveSettingsToFile();
}
@@ -8,6 +8,7 @@
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:controls="clr-namespace:Ink_Canvas.Controls;assembly=InkCanvas.Controls"
xmlns:i18n="clr-namespace:Ink_Canvas.MarkupExtensions"
mc:Ignorable="d"
Title="Debug">
@@ -32,8 +33,8 @@
Text="Debug" />
<controls:LabeledSettingsCard x:Name="ToggleSwitchDebugConsole"
Header="显示调试窗口"
Description="显示一个独立的控制台窗口,用于实时输出日志(开启后立即生效;关闭设置中的“启用日志记录”将不会输出内容)。"
Header="{i18n:I18n Key=Debug_ShowConsole_Header}"
Description="{i18n:I18n Key=Debug_ShowConsole_Desc}"
Icon="{x:Static ui:SegoeFluentIcons.DeveloperTools}"
IsOn="False"
Toggled="ToggleSwitchDebugConsole_Toggled"/>
@@ -216,8 +216,14 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
private void MLAvoidanceWeightSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!_isLoaded) return;
var val = Math.Round(MLAvoidanceWeightSlider.Value, 2);
MLAvoidanceWeightSlider.Value = val;
var slider = MLAvoidanceWeightSlider;
var val = Math.Round(slider.Value, 2);
// 仅当四舍五入纠正了显示值时才回写;那次 set 会重入 ValueChanged 完成保存。
if (slider.Value != val)
{
slider.Value = val;
return;
}
SettingsManager.Settings.RandSettings.MLAvoidanceWeight = val;
SettingsManager.SaveSettingsToFile();
}
@@ -281,8 +287,13 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
private void TimerVolumeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!_isLoaded) return;
var val = Math.Round(TimerVolumeSlider.Value, 2);
TimerVolumeSlider.Value = val;
var slider = TimerVolumeSlider;
var val = Math.Round(slider.Value, 2);
if (slider.Value != val)
{
slider.Value = val;
return;
}
SettingsManager.Settings.RandSettings.TimerVolume = val;
SettingsManager.SaveSettingsToFile();
}
@@ -321,8 +332,13 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
private void ProgressiveReminderVolumeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!_isLoaded) return;
var val = Math.Round(ProgressiveReminderVolumeSlider.Value, 2);
ProgressiveReminderVolumeSlider.Value = val;
var slider = ProgressiveReminderVolumeSlider;
var val = Math.Round(slider.Value, 2);
if (slider.Value != val)
{
slider.Value = val;
return;
}
SettingsManager.Settings.RandSettings.ProgressiveReminderVolume = val;
SettingsManager.SaveSettingsToFile();
}
@@ -155,9 +155,9 @@
</ui:NavigationViewItem>
<ui:NavigationViewItem
x:Name="SecurityPageItem"
Content="安全"
Content="{i18n:I18n Key=Settings_Nav_Security}"
Tag="SecurityPage"
ToolTipService.ToolTip="安全密码与进程保护">
ToolTipService.ToolTip="{i18n:I18n Key=Settings_Nav_Security_Tooltip}">
<ui:NavigationViewItem.Icon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Permissions}"/>
</ui:NavigationViewItem.Icon>
@@ -195,9 +195,9 @@
</ui:NavigationViewItem>
<ui:NavigationViewItem
x:Name="HotkeyPageItem"
Content="快捷键"
Content="{i18n:I18n Key=Settings_Nav_Hotkey}"
Tag="HotkeyPage"
ToolTipService.ToolTip="快捷键设置">
ToolTipService.ToolTip="{i18n:I18n Key=Settings_Nav_Hotkey_Tooltip}">
<ui:NavigationViewItem.Icon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.KeyboardStandard}"/>
</ui:NavigationViewItem.Icon>
@@ -587,10 +587,9 @@ namespace Ink_Canvas.Windows.SettingsViews
if (string.IsNullOrWhiteSpace(raw)) return;
string query = raw.Trim();
string queryLower = query.ToLower();
var entry = _searchIndex.FirstOrDefault(e => e.Text.Equals(query, StringComparison.OrdinalIgnoreCase))
?? _searchIndex.FirstOrDefault(e => e.Text.ToLower().Contains(queryLower));
?? _searchIndex.FirstOrDefault(e => e.Text.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0);
NavigateToSearchEntry(entry);
}
@@ -608,9 +607,8 @@ namespace Ink_Canvas.Windows.SettingsViews
return;
}
string queryLower = query.ToLower();
var suggestions = _searchIndex
.Where(e => e.Text.ToLower().Contains(queryLower))
.Where(e => e.Text.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0)
.Select(e => e.Text)
.Distinct()
.Take(50)