diff --git a/Ink Canvas/Helpers/GlobalHotkeyManager.cs b/Ink Canvas/Helpers/GlobalHotkeyManager.cs index e9bfcd97..e0516650 100644 --- a/Ink Canvas/Helpers/GlobalHotkeyManager.cs +++ b/Ink Canvas/Helpers/GlobalHotkeyManager.cs @@ -285,6 +285,7 @@ namespace Ink_Canvas.Helpers // 功能快捷键 RegisterHotkey("DrawLine", Key.L, ModifierKeys.Alt, () => _mainWindow.BtnDrawLine_Click(null, null)); RegisterHotkey("Screenshot", Key.C, ModifierKeys.Alt, () => _mainWindow.SaveScreenShotToDesktop()); + RegisterHotkey("QuickDraw", Key.K, ModifierKeys.Alt, () => _mainWindow.OpenQuickDrawFromHotkey()); RegisterHotkey("Hide", Key.V, ModifierKeys.Alt, () => _mainWindow.SymbolIconEmoji_MouseUp(null, null)); // 退出快捷键 @@ -1033,6 +1034,7 @@ namespace Ink_Canvas.Helpers new HotkeyConfigItem { Name = "Pen5", Key = Key.D5, Modifiers = ModifierKeys.Alt }, new HotkeyConfigItem { Name = "DrawLine", Key = Key.L, Modifiers = ModifierKeys.Alt }, new HotkeyConfigItem { Name = "Screenshot", Key = Key.C, Modifiers = ModifierKeys.Alt }, + new HotkeyConfigItem { Name = "QuickDraw", Key = Key.K, Modifiers = ModifierKeys.Alt }, new HotkeyConfigItem { Name = "Hide", Key = Key.V, Modifiers = ModifierKeys.Alt }, new HotkeyConfigItem { Name = "Exit", Key = Key.Escape, Modifiers = ModifierKeys.None } }); @@ -1111,6 +1113,14 @@ namespace Ink_Canvas.Helpers } } + // 旧版 HotkeyConfig.json 无「快抽」项时补注册默认组合,避免升级后无快捷键 + if (successCount > 0 && !IsHotkeyRegistered("QuickDraw")) + { + var quickDrawAction = GetActionByName("QuickDraw"); + if (quickDrawAction != null && RegisterHotkey("QuickDraw", Key.K, ModifierKeys.Alt, quickDrawAction)) + successCount++; + } + if (successCount > 0) { _hotkeysShouldBeRegistered = true; @@ -1221,6 +1231,8 @@ namespace Ink_Canvas.Helpers return () => _mainWindow.BtnDrawLine_Click(null, null); case "Screenshot": return () => _mainWindow.SaveScreenShotToDesktop(); + case "QuickDraw": + return () => _mainWindow.OpenQuickDrawFromHotkey(); case "Hide": return () => _mainWindow.SymbolIconEmoji_MouseUp(null, null); case "Exit": diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index da7c2853..4b5a2e7c 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -4711,6 +4711,22 @@ namespace Ink_Canvas } } + internal void OpenQuickDrawFromHotkey() + { + try + { + if (Settings?.RandSettings?.EnableQuickDraw != true) + return; + + var quickDrawWindow = new QuickDrawWindow(); + quickDrawWindow.ShowDialog(); + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"打开快抽窗口失败: {ex.Message}", LogHelper.LogType.Error); + } + } + /// /// 显示快抽悬浮按钮 /// diff --git a/Ink Canvas/Properties/Strings.en-US.resx b/Ink Canvas/Properties/Strings.en-US.resx index 50a63586..36ee52db 100644 --- a/Ink Canvas/Properties/Strings.en-US.resx +++ b/Ink Canvas/Properties/Strings.en-US.resx @@ -1258,7 +1258,7 @@ Exit slide show - Show + Annotation bar Exit diff --git a/Ink Canvas/Properties/Strings.resx b/Ink Canvas/Properties/Strings.resx index 5a21029f..483d13e0 100644 --- a/Ink Canvas/Properties/Strings.resx +++ b/Ink Canvas/Properties/Strings.resx @@ -1301,7 +1301,7 @@ 退出放映 - 显示 + 批注栏 退出 diff --git a/Ink Canvas/Windows/HotkeySettingsWindow.xaml b/Ink Canvas/Windows/HotkeySettingsWindow.xaml index 60928011..249de7b1 100644 --- a/Ink Canvas/Windows/HotkeySettingsWindow.xaml +++ b/Ink Canvas/Windows/HotkeySettingsWindow.xaml @@ -177,6 +177,11 @@ Description="保存屏幕截图到桌面" DefaultKey="C" DefaultModifiers="Alt"/> + _mainWindow.BtnDrawLine_Click(null, null); case "Screenshot": return () => _mainWindow.SaveScreenShotToDesktop(); + case "QuickDraw": + return () => _mainWindow.OpenQuickDrawFromHotkey(); case "Hide": return () => _mainWindow.SymbolIconEmoji_MouseUp(null, null); case "Exit": diff --git a/Ink Canvas/Windows/OperatingGuideWindow.xaml b/Ink Canvas/Windows/OperatingGuideWindow.xaml index c911ada8..e2628752 100644 --- a/Ink Canvas/Windows/OperatingGuideWindow.xaml +++ b/Ink Canvas/Windows/OperatingGuideWindow.xaml @@ -3,99 +3,216 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:local="clr-namespace:Ink_Canvas" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf" - ui:ThemeManager.RequestedTheme="Light" Topmost="True" Background="Transparent" - mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True" - WindowStartupLocation="CenterScreen" + mc:Ignorable="d" Title="Ink Canvas Annotation 使用指南" - Height="600" Width="500"> - - - - - - - - + Height="600" + Width="520" + MinHeight="400" + MinWidth="400" + WindowStartupLocation="CenterScreen" + Topmost="True" + ResizeMode="CanResize" + FontFamily="Microsoft YaHei UI" + ui:ThemeManager.IsThemeAware="True" + ui:TitleBar.ExtendViewIntoTitleBar="True" + ui:WindowHelper.SystemBackdropType="Mica" + ui:WindowHelper.UseModernWindowStyle="True" + ui:TitleBar.Height="48"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + diff --git a/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs b/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs index 823151bb..f65be003 100644 --- a/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs +++ b/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs @@ -1,6 +1,5 @@ using Ink_Canvas.Helpers; using iNKORE.UI.WPF.Modern; -using iNKORE.UI.WPF.Modern.Common.IconKeys; using System; using System.Windows; using System.Windows.Input; @@ -15,33 +14,10 @@ namespace Ink_Canvas public OperatingGuideWindow() { InitializeComponent(); + RefreshTheme(); AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25); } - private void BtnClose_MouseUp(object sender, MouseButtonEventArgs e) - { - Close(); - } - - private void WindowDragMove(object sender, MouseEventArgs e) - { - if (e.LeftButton == MouseButtonState.Pressed) DragMove(); - } - - private void BtnFullscreen_MouseUp(object sender, MouseButtonEventArgs e) - { - if (WindowState == WindowState.Normal) - { - WindowState = WindowState.Maximized; - FontIconFullscreen.Icon = SegoeFluentIcons.BackToWindow; - } - else - { - WindowState = WindowState.Normal; - FontIconFullscreen.Icon = SegoeFluentIcons.FullScreen; - } - } - private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e) { e.Handled = true; diff --git a/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs index de08ea64..703200cf 100644 --- a/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs @@ -6,33 +6,17 @@ using System.Windows; using System.Windows.Navigation; using System.Windows.Interop; using System.Windows.Input; -using System.ComponentModel.Composition; -using System.ComponentModel.Composition.Hosting; using System.Linq; using MessageBox = System.Windows.MessageBox; using Screen = System.Windows.Forms.Screen; -using System.Composition; namespace Ink_Canvas.Windows.SettingsViews2 { - // 插件设置页面契约接口,所有插件必须实现此接口即可自动接入 - public interface IPluginSettingsPage - { - string PageTag { get; } // 页面唯一标识,不可与内置页面重复 - string PageTitle { get; } // 导航菜单显示的标题 - string PageIconCode { get; } // Segoe MDL2 Assets 图标字符,例:"\xE713"(设置图标) - Type PageType { get; } // 插件设置页面的类型(继承自Page) - bool IsFooterItem { get; } // 是否放在导航底部菜单 - } - public partial class SettingsWindow2 : Window { private readonly Dictionary _pageTypes; private readonly Dictionary _pages = new Dictionary(); - [System.ComponentModel.Composition.ImportMany(typeof(IPluginSettingsPage))] - private IEnumerable _pluginPages; // 自动导入所有插件页面 - // 保存窗口原始位置和大小 private double _originalLeft; private double _originalTop; @@ -64,11 +48,6 @@ namespace Ink_Canvas.Windows.SettingsViews2 { "Settings", typeof(SettingsPage) } }; - // 加载插件页面 - LoadPluginSettingsPages(); - // 初始化导航菜单(内置+插件) - InitializeNavigationMenu(); - // 默认选中首页 if (NavigationViewControl.MenuItems.Count > 0) { @@ -178,56 +157,6 @@ namespace Ink_Canvas.Windows.SettingsViews2 private static extern int ShowCursor(bool bShow); #endregion - #region 插件化动态设置页面核心逻辑 - private void LoadPluginSettingsPages() - { - try - { - // 扫描程序目录下Plugins文件夹中的插件dll - var pluginCatalog = new DirectoryCatalog("./Plugins", "*.dll"); - var container = new CompositionContainer(pluginCatalog); - container.ComposeParts(this); - - // 将插件页面注册到页面映射字典 - foreach (var pluginPage in _pluginPages) - { - if (!_pageTypes.ContainsKey(pluginPage.PageTag)) - { - _pageTypes.Add(pluginPage.PageTag, pluginPage.PageType); - } - } - } - catch (Exception ex) - { - // 插件加载失败不影响主程序运行,仅输出调试日志 - System.Diagnostics.Debug.WriteLine($"插件加载失败: {ex.Message}"); - } - } - - private void InitializeNavigationMenu() - { - // 自动将插件页面添加到导航菜单 - foreach (var pluginPage in _pluginPages) - { - var navItem = new NavigationViewItem - { - Tag = pluginPage.PageTag, - Content = pluginPage.PageTitle, - Icon = new FontIcon { Glyph = pluginPage.PageIconCode } - }; - - if (pluginPage.IsFooterItem) - { - NavigationViewControl.FooterMenuItems.Add(navItem); - } - else - { - NavigationViewControl.MenuItems.Add(navItem); - } - } - } - #endregion - #region 高DPI/多屏自适应窗口控制 /// @@ -502,7 +431,7 @@ namespace Ink_Canvas.Windows.SettingsViews2 sender.ItemsSource = suggestions; } - // 统一获取所有导航项(主菜单+子菜单+底部菜单+插件页面) + // 统一获取所有导航项(主菜单+子菜单+底部菜单) private List GetAllNavigationItems() { var items = new List();