From 1bc23af61a451a14b17263d188b7c5bb4727c874 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sun, 31 Aug 2025 08:51:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/Helpers/DeviceIdentifier.cs | 4 +-- Ink Canvas/Helpers/GlobalHotkeyManager.cs | 8 ++--- .../HardwareAcceleratedInkProcessor.cs | 2 -- Ink Canvas/MainWindow.xaml | 2 +- Ink Canvas/MainWindow_cs/MW_BoardControls.cs | 36 +++++++++++++++++-- .../MainWindow_cs/MW_FloatingBarIcons.cs | 5 +-- Ink Canvas/MainWindow_cs/MW_PageListView.cs | 14 ++++++++ Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs | 4 +-- Ink Canvas/Windows/CountdownTimerWindow.xaml | 14 ++++---- .../Windows/CountdownTimerWindow.xaml.cs | 14 ++++---- Ink Canvas/Windows/OperatingGuideWindow.xaml | 4 +-- .../Windows/OperatingGuideWindow.xaml.cs | 4 +-- .../Windows/PluginSettingsWindow.xaml.cs | 4 +-- Ink Canvas/Windows/RandWindow.xaml | 8 ++--- Ink Canvas/Windows/RandWindow.xaml.cs | 4 +-- 15 files changed, 81 insertions(+), 46 deletions(-) diff --git a/Ink Canvas/Helpers/DeviceIdentifier.cs b/Ink Canvas/Helpers/DeviceIdentifier.cs index 306ff21f..e34c4e4c 100644 --- a/Ink Canvas/Helpers/DeviceIdentifier.cs +++ b/Ink Canvas/Helpers/DeviceIdentifier.cs @@ -1339,9 +1339,7 @@ namespace Ink_Canvas.Helpers return descriptions.Count > 0 ? string.Join(", ", descriptions) : "普通用户"; } - - - + /// /// 关机时保存使用时间数据 /// diff --git a/Ink Canvas/Helpers/GlobalHotkeyManager.cs b/Ink Canvas/Helpers/GlobalHotkeyManager.cs index efa21461..c7f43345 100644 --- a/Ink Canvas/Helpers/GlobalHotkeyManager.cs +++ b/Ink Canvas/Helpers/GlobalHotkeyManager.cs @@ -721,26 +721,22 @@ namespace Ink_Canvas.Helpers // 根据高光位置判断当前选中的工具 // 位置计算基于SetFloatingBarHighlightPosition方法中的逻辑 - bool isMouseMode = false; - string currentTool = "unknown"; - + bool isMouseMode; + // 简化判断:如果位置接近0,说明是鼠标模式 // 如果位置接近28,说明是批注模式 // 如果位置更大,说明是其他工具 if (position < 5) // 鼠标模式:marginOffset + (cursorWidth - actualHighlightWidth) / 2 ≈ 0 { isMouseMode = true; - currentTool = "鼠标"; } else if (position < 35) // 批注模式:marginOffset + cursorWidth + (penWidth - actualHighlightWidth) / 2 ≈ 28 { isMouseMode = false; - currentTool = "批注"; } else // 其他工具(橡皮擦、选择等) { isMouseMode = false; - currentTool = "其他工具"; } return isMouseMode; diff --git a/Ink Canvas/Helpers/HardwareAcceleratedInkProcessor.cs b/Ink Canvas/Helpers/HardwareAcceleratedInkProcessor.cs index 1ca4689f..5342b8f6 100644 --- a/Ink Canvas/Helpers/HardwareAcceleratedInkProcessor.cs +++ b/Ink Canvas/Helpers/HardwareAcceleratedInkProcessor.cs @@ -16,7 +16,6 @@ namespace Ink_Canvas.Helpers { private readonly RenderTargetBitmap _renderTarget; private readonly DrawingVisual _drawingVisual; - private readonly DrawingContext _drawingContext; private bool _isInitialized; public HardwareAcceleratedInkProcessor(int width = 1920, int height = 1080) @@ -191,7 +190,6 @@ namespace Ink_Canvas.Helpers /// public void Dispose() { - _drawingContext?.Close(); _renderTarget?.Clear(); _isInitialized = false; } diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index c00ff977..00b1ac61 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -5159,7 +5159,7 @@ - Settings.Automation.MinimumAutomationStrokeNumber) SaveScreenShot(true); if (CurrentWhiteboardIndex >= WhiteboardTotalCount) { - // 在最后一页时,点击“新页面”按钮直接新增一页 + // 在最后一页时,点击"新页面"按钮直接新增一页 BtnWhiteBoardAdd_Click(sender, e); return; } + // 隐藏图片选择工具栏 + if (currentSelectedElement != null) + { + UnselectElement(currentSelectedElement); + currentSelectedElement = null; + } SaveStrokes(); @@ -251,6 +269,13 @@ namespace Ink_Canvas if (Settings.Automation.IsAutoSaveStrokesAtClear && inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) SaveScreenShot(true); + // 隐藏图片选择工具栏 + if (currentSelectedElement != null) + { + UnselectElement(currentSelectedElement); + currentSelectedElement = null; + } + SaveStrokes(); ClearStrokes(true); @@ -279,6 +304,13 @@ namespace Ink_Canvas private void BtnWhiteBoardDelete_Click(object sender, RoutedEventArgs e) { + // 隐藏图片选择工具栏 + if (currentSelectedElement != null) + { + UnselectElement(currentSelectedElement); + currentSelectedElement = null; + } + ClearStrokes(true); if (CurrentWhiteboardIndex != WhiteboardTotalCount) diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs index 0754132c..29e6fd09 100644 --- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs @@ -3096,19 +3096,16 @@ namespace Ink_Canvas // 检查快捷调色盘是否显示及其实际宽度 bool isQuickColorPaletteVisible = false; double quickColorPaletteWidth = 0; - string quickColorPaletteMode = "none"; - + if (QuickColorPalettePanel != null && QuickColorPalettePanel.Visibility == Visibility.Visible) { isQuickColorPaletteVisible = true; quickColorPaletteWidth = QuickColorPalettePanel.ActualWidth > 0 ? QuickColorPalettePanel.ActualWidth : 60; - quickColorPaletteMode = "double"; } else if (QuickColorPaletteSingleRowPanel != null && QuickColorPaletteSingleRowPanel.Visibility == Visibility.Visible) { isQuickColorPaletteVisible = true; quickColorPaletteWidth = QuickColorPaletteSingleRowPanel.ActualWidth > 0 ? QuickColorPaletteSingleRowPanel.ActualWidth : 120; - quickColorPaletteMode = "single"; } // 获取实际按钮宽度,如果获取不到则使用默认值,同时考虑按钮的可见性 diff --git a/Ink Canvas/MainWindow_cs/MW_PageListView.cs b/Ink Canvas/MainWindow_cs/MW_PageListView.cs index c82a0113..5b4daa7e 100644 --- a/Ink Canvas/MainWindow_cs/MW_PageListView.cs +++ b/Ink Canvas/MainWindow_cs/MW_PageListView.cs @@ -86,6 +86,13 @@ namespace Ink_Canvas // 只有当选择的页面与当前页面不同时才进行切换 if (index + 1 != CurrentWhiteboardIndex) { + // 隐藏图片选择工具栏 + if (currentSelectedElement != null) + { + UnselectElement(currentSelectedElement); + currentSelectedElement = null; + } + SaveStrokes(); ClearStrokes(true); CurrentWhiteboardIndex = index + 1; @@ -108,6 +115,13 @@ namespace Ink_Canvas // 只有当选择的页面与当前页面不同时才进行切换 if (index + 1 != CurrentWhiteboardIndex) { + // 隐藏图片选择工具栏 + if (currentSelectedElement != null) + { + UnselectElement(currentSelectedElement); + currentSelectedElement = null; + } + SaveStrokes(); ClearStrokes(true); CurrentWhiteboardIndex = index + 1; diff --git a/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs b/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs index 5ca45da5..f72ed6ab 100644 --- a/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs +++ b/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs @@ -74,9 +74,9 @@ namespace Ink_Canvas ToggleSwitchDrawShapeBorderAutoHide.IsOn = !ToggleSwitchDrawShapeBorderAutoHide.IsOn; if (ToggleSwitchDrawShapeBorderAutoHide.IsOn) - ((SymbolIcon)sender).Symbol = Symbol.Pin; + ((FontIcon)sender).Glyph = ""; else - ((SymbolIcon)sender).Symbol = Symbol.UnPin; + ((FontIcon)sender).Glyph = ""; } private object lastMouseDownSender; diff --git a/Ink Canvas/Windows/CountdownTimerWindow.xaml b/Ink Canvas/Windows/CountdownTimerWindow.xaml index 1a8bfe8e..8c785503 100644 --- a/Ink Canvas/Windows/CountdownTimerWindow.xaml +++ b/Ink Canvas/Windows/CountdownTimerWindow.xaml @@ -179,12 +179,12 @@ - + - + @@ -194,12 +194,12 @@ - + - + @@ -215,7 +215,7 @@ - + - + - + diff --git a/Ink Canvas/Windows/CountdownTimerWindow.xaml.cs b/Ink Canvas/Windows/CountdownTimerWindow.xaml.cs index 5b1ce454..08d2d462 100644 --- a/Ink Canvas/Windows/CountdownTimerWindow.xaml.cs +++ b/Ink Canvas/Windows/CountdownTimerWindow.xaml.cs @@ -57,7 +57,7 @@ namespace Ink_Canvas TextBlockSecond.Text = "00"; timer.Stop(); isTimerRunning = false; - SymbolIconStart.Symbol = Symbol.Play; + FontIconStart.Glyph = ""; BtnStartCover.Visibility = Visibility.Visible; TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); BorderStopTime.Visibility = Visibility.Collapsed; @@ -208,12 +208,12 @@ namespace Ink_Canvas if (WindowState == WindowState.Normal) { WindowState = WindowState.Maximized; - SymbolIconFullscreen.Symbol = Symbol.BackToWindow; + FontIconFullscreen.Glyph = ""; } else { WindowState = WindowState.Normal; - SymbolIconFullscreen.Symbol = Symbol.FullScreen; + FontIconFullscreen.Glyph = ""; } } @@ -238,7 +238,7 @@ namespace Ink_Canvas BtnStartCover.Visibility = Visibility.Collapsed; BorderStopTime.Visibility = Visibility.Collapsed; TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); - SymbolIconStart.Symbol = Symbol.Play; + FontIconStart.Glyph = ""; isTimerRunning = false; timer.Stop(); isPaused = false; @@ -288,7 +288,7 @@ namespace Ink_Canvas startTime += DateTime.Now - pauseTime; ProcessBarTime.IsPaused = false; TextBlockHour.Foreground = Brushes.Black; - SymbolIconStart.Symbol = Symbol.Pause; + FontIconStart.Glyph = ""; isPaused = false; timer.Start(); UpdateStopTime(); @@ -300,7 +300,7 @@ namespace Ink_Canvas pauseTime = DateTime.Now; ProcessBarTime.IsPaused = true; TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); - SymbolIconStart.Symbol = Symbol.Play; + FontIconStart.Glyph = ""; BorderStopTime.Visibility = Visibility.Collapsed; isPaused = true; timer.Stop(); @@ -312,7 +312,7 @@ namespace Ink_Canvas totalSeconds = ((hour * 60) + minute) * 60 + second; ProcessBarTime.IsPaused = false; TextBlockHour.Foreground = Brushes.Black; - SymbolIconStart.Symbol = Symbol.Pause; + FontIconStart.Glyph = ""; BtnResetCover.Visibility = Visibility.Collapsed; if (totalSeconds <= 10) diff --git a/Ink Canvas/Windows/OperatingGuideWindow.xaml b/Ink Canvas/Windows/OperatingGuideWindow.xaml index 67c81734..351d6962 100644 --- a/Ink Canvas/Windows/OperatingGuideWindow.xaml +++ b/Ink Canvas/Windows/OperatingGuideWindow.xaml @@ -80,7 +80,7 @@ - + - + diff --git a/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs b/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs index 3357980f..7b129e9c 100644 --- a/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs +++ b/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs @@ -31,12 +31,12 @@ namespace Ink_Canvas if (WindowState == WindowState.Normal) { WindowState = WindowState.Maximized; - SymbolIconFullscreen.Symbol = Symbol.BackToWindow; + FontIconFullscreen.Glyph = ""; } else { WindowState = WindowState.Normal; - SymbolIconFullscreen.Symbol = Symbol.FullScreen; + FontIconFullscreen.Glyph = ""; } } diff --git a/Ink Canvas/Windows/PluginSettingsWindow.xaml.cs b/Ink Canvas/Windows/PluginSettingsWindow.xaml.cs index 3fa180fa..cdaecc4e 100644 --- a/Ink Canvas/Windows/PluginSettingsWindow.xaml.cs +++ b/Ink Canvas/Windows/PluginSettingsWindow.xaml.cs @@ -68,11 +68,11 @@ namespace Ink_Canvas.Windows } } - public string Name => SelectedPlugin?.Name ?? string.Empty; + public new string Name => SelectedPlugin?.Name ?? string.Empty; public string Version => SelectedPlugin?.Version?.ToString() ?? string.Empty; public string Author => SelectedPlugin?.Author ?? string.Empty; public string Description => SelectedPlugin?.Description ?? string.Empty; - public bool IsEnabled => SelectedPlugin is PluginBase plugin && plugin.IsEnabled; + public new bool IsEnabled => SelectedPlugin is PluginBase plugin && plugin.IsEnabled; public bool IsBuiltIn => SelectedPlugin?.IsBuiltIn ?? false; /// diff --git a/Ink Canvas/Windows/RandWindow.xaml b/Ink Canvas/Windows/RandWindow.xaml index f1bada9c..135d1dc2 100644 --- a/Ink Canvas/Windows/RandWindow.xaml +++ b/Ink Canvas/Windows/RandWindow.xaml @@ -98,7 +98,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -127,7 +127,7 @@ - + @@ -137,7 +137,7 @@ - + diff --git a/Ink Canvas/Windows/RandWindow.xaml.cs b/Ink Canvas/Windows/RandWindow.xaml.cs index aa391d8f..ae708f2a 100644 --- a/Ink Canvas/Windows/RandWindow.xaml.cs +++ b/Ink Canvas/Windows/RandWindow.xaml.cs @@ -100,7 +100,7 @@ namespace Ink_Canvas if (RandMaxPeopleOneTime != -1 && TotalCount >= RandMaxPeopleOneTime) return; TotalCount++; LabelNumberCount.Text = TotalCount.ToString(); - SymbolIconStart.Symbol = Symbol.People; + FontIconStart.Glyph = ""; BorderBtnAdd.Opacity = 1; BorderBtnMinus.Opacity = 1; } @@ -112,7 +112,7 @@ namespace Ink_Canvas LabelNumberCount.Text = TotalCount.ToString(); if (TotalCount == 1) { - SymbolIconStart.Symbol = Symbol.Contact; + FontIconStart.Glyph = ""; } }