撤回commit8042b91

This commit is contained in:
2025-12-20 16:05:37 +08:00
parent 3f460d7a5c
commit 81621cb9d0
+26 -148
View File
@@ -73,8 +73,7 @@ namespace Ink_Canvas
/// <summary> /// <summary>
/// 用於更新浮動工具欄的"手勢"按鈕和白板工具欄的"手勢"按鈕的樣式(開啟和關閉狀態) /// 用於更新浮動工具欄的"手勢"按鈕和白板工具欄的"手勢"按鈕的樣式(開啟和關閉狀態)
/// </summary> /// </summary>
private void CheckEnableTwoFingerGestureBtnColorPrompt() private void CheckEnableTwoFingerGestureBtnColorPrompt() {
{
// 根据主题选择手势图标和颜色 // 根据主题选择手势图标和颜色
bool isDarkTheme = Settings.Appearance.Theme == 1 || bool isDarkTheme = Settings.Appearance.Theme == 1 ||
(Settings.Appearance.Theme == 2 && !IsSystemThemeLight()); (Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
@@ -83,16 +82,13 @@ namespace Ink_Canvas
// 根据主题设置白板模式下的颜色 // 根据主题设置白板模式下的颜色
Color boardBgColor, boardIconColor, boardTextColor, boardBorderColor; Color boardBgColor, boardIconColor, boardTextColor, boardBorderColor;
if (isLightTheme) if (isLightTheme) {
{
// 浅色主题 // 浅色主题
boardBgColor = Color.FromRgb(244, 244, 245); boardBgColor = Color.FromRgb(244, 244, 245);
boardIconColor = Color.FromRgb(24, 24, 27); boardIconColor = Color.FromRgb(24, 24, 27);
boardTextColor = Color.FromRgb(24, 24, 27); boardTextColor = Color.FromRgb(24, 24, 27);
boardBorderColor = Color.FromRgb(161, 161, 170); boardBorderColor = Color.FromRgb(161, 161, 170);
} } else {
else
{
// 深色主题 // 深色主题
boardBgColor = Color.FromRgb(39, 39, 42); boardBgColor = Color.FromRgb(39, 39, 42);
boardIconColor = Color.FromRgb(244, 244, 245); boardIconColor = Color.FromRgb(244, 244, 245);
@@ -100,8 +96,7 @@ namespace Ink_Canvas
boardBorderColor = Color.FromRgb(113, 113, 122); boardBorderColor = Color.FromRgb(113, 113, 122);
} }
if (ToggleSwitchEnableMultiTouchMode.IsOn) if (ToggleSwitchEnableMultiTouchMode.IsOn) {
{
TwoFingerGestureSimpleStackPanel.Opacity = 0.5; TwoFingerGestureSimpleStackPanel.Opacity = 0.5;
TwoFingerGestureSimpleStackPanel.IsHitTestVisible = false; TwoFingerGestureSimpleStackPanel.IsHitTestVisible = false;
EnableTwoFingerGestureBtn.Source = EnableTwoFingerGestureBtn.Source =
@@ -115,12 +110,10 @@ namespace Ink_Canvas
BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.DisabledGestureIcon); BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.DisabledGestureIcon);
BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z"); BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z");
} }
else else {
{
TwoFingerGestureSimpleStackPanel.Opacity = 1; TwoFingerGestureSimpleStackPanel.Opacity = 1;
TwoFingerGestureSimpleStackPanel.IsHitTestVisible = true; TwoFingerGestureSimpleStackPanel.IsHitTestVisible = true;
if (Settings.Gesture.IsEnableTwoFingerGesture) if (Settings.Gesture.IsEnableTwoFingerGesture) {
{
EnableTwoFingerGestureBtn.Source = EnableTwoFingerGestureBtn.Source =
new BitmapImage(new Uri("/Resources/new-icons/gesture-enabled.png", UriKind.Relative)); new BitmapImage(new Uri("/Resources/new-icons/gesture-enabled.png", UriKind.Relative));
@@ -130,10 +123,9 @@ namespace Ink_Canvas
BoardGestureLabel.Foreground = new SolidColorBrush(Colors.GhostWhite); BoardGestureLabel.Foreground = new SolidColorBrush(Colors.GhostWhite);
BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.EnabledGestureIcon); BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.EnabledGestureIcon);
BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z " + XamlGraphicsIconGeometries.EnabledGestureIconBadgeCheck); BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z "+XamlGraphicsIconGeometries.EnabledGestureIconBadgeCheck);
} }
else else {
{
EnableTwoFingerGestureBtn.Source = EnableTwoFingerGestureBtn.Source =
new BitmapImage(new Uri(gestureIconPath, UriKind.Relative)); new BitmapImage(new Uri(gestureIconPath, UriKind.Relative));
@@ -481,23 +473,13 @@ namespace Ink_Canvas
highlightColor = Color.FromRgb(30, 58, 138); // Keep current color for light theme highlightColor = Color.FromRgb(30, 58, 138); // Keep current color for light theme
} }
bool useLegacyUI = Settings.Appearance.UseLegacyFloatingBarUI;
switch (mode) switch (mode)
{ {
case "pen": case "pen":
case "color": case "color":
{ {
if (useLegacyUI) PenIconGeometry.Brush = new SolidColorBrush(highlightColor);
{ PenIconGeometry.Geometry = Geometry.Parse(GetCorrectIcon("pen", true));
PenIconGeometry.Brush = new SolidColorBrush(highlightColor);
PenIconGeometry.Geometry = Geometry.Parse(GetCorrectIcon("pen", false));
}
else
{
PenIconGeometry.Brush = new SolidColorBrush(highlightColor);
PenIconGeometry.Geometry = Geometry.Parse(GetCorrectIcon("pen", true));
}
BoardPen.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardPen.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardPen.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardPen.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardPenGeometry.Brush = new SolidColorBrush(Colors.GhostWhite); BoardPenGeometry.Brush = new SolidColorBrush(Colors.GhostWhite);
@@ -508,18 +490,9 @@ namespace Ink_Canvas
} }
case "eraser": case "eraser":
{ {
if (useLegacyUI) CircleEraserIconGeometry.Brush = new SolidColorBrush(highlightColor);
{ CircleEraserIconGeometry.Geometry =
CircleEraserIconGeometry.Brush = new SolidColorBrush(highlightColor); Geometry.Parse(GetCorrectIcon("eraserCircle", true));
CircleEraserIconGeometry.Geometry =
Geometry.Parse(GetCorrectIcon("eraserCircle", false));
}
else
{
CircleEraserIconGeometry.Brush = new SolidColorBrush(highlightColor);
CircleEraserIconGeometry.Geometry =
Geometry.Parse(GetCorrectIcon("eraserCircle", true));
}
BoardEraser.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardEraser.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardEraser.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardEraser.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardEraserGeometry.Brush = new SolidColorBrush(Colors.GhostWhite); BoardEraserGeometry.Brush = new SolidColorBrush(Colors.GhostWhite);
@@ -530,18 +503,9 @@ namespace Ink_Canvas
} }
case "eraserByStrokes": case "eraserByStrokes":
{ {
if (useLegacyUI) StrokeEraserIconGeometry.Brush = new SolidColorBrush(highlightColor);
{ StrokeEraserIconGeometry.Geometry =
StrokeEraserIconGeometry.Brush = new SolidColorBrush(highlightColor); Geometry.Parse(GetCorrectIcon("eraserStroke", true));
StrokeEraserIconGeometry.Geometry =
Geometry.Parse(GetCorrectIcon("eraserStroke", false));
}
else
{
StrokeEraserIconGeometry.Brush = new SolidColorBrush(highlightColor);
StrokeEraserIconGeometry.Geometry =
Geometry.Parse(GetCorrectIcon("eraserStroke", true));
}
BoardEraser.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardEraser.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardEraser.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardEraser.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardEraserGeometry.Brush = new SolidColorBrush(Colors.GhostWhite); BoardEraserGeometry.Brush = new SolidColorBrush(Colors.GhostWhite);
@@ -552,18 +516,9 @@ namespace Ink_Canvas
} }
case "select": case "select":
{ {
if (useLegacyUI) LassoSelectIconGeometry.Brush = new SolidColorBrush(highlightColor);
{ LassoSelectIconGeometry.Geometry =
LassoSelectIconGeometry.Brush = new SolidColorBrush(highlightColor); Geometry.Parse(GetCorrectIcon("lassoSelect", true));
LassoSelectIconGeometry.Geometry =
Geometry.Parse(GetCorrectIcon("lassoSelect", false));
}
else
{
LassoSelectIconGeometry.Brush = new SolidColorBrush(highlightColor);
LassoSelectIconGeometry.Geometry =
Geometry.Parse(GetCorrectIcon("lassoSelect", true));
}
BoardSelect.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardSelect.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardSelect.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardSelect.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardSelectGeometry.Brush = new SolidColorBrush(Colors.GhostWhite); BoardSelectGeometry.Brush = new SolidColorBrush(Colors.GhostWhite);
@@ -574,18 +529,9 @@ namespace Ink_Canvas
} }
case "cursor": case "cursor":
{ {
if (useLegacyUI) CursorIconGeometry.Brush = new SolidColorBrush(highlightColor);
{ CursorIconGeometry.Geometry =
CursorIconGeometry.Brush = new SolidColorBrush(highlightColor); Geometry.Parse(GetCorrectIcon("cursor", true));
CursorIconGeometry.Geometry =
Geometry.Parse(GetCorrectIcon("cursor", false));
}
else
{
CursorIconGeometry.Brush = new SolidColorBrush(highlightColor);
CursorIconGeometry.Geometry =
Geometry.Parse(GetCorrectIcon("cursor", true));
}
// 根据主题设置颜色 // 根据主题设置颜色
if (Settings.Appearance.Theme == 1) // 深色主题 if (Settings.Appearance.Theme == 1) // 深色主题
{ {
@@ -2047,10 +1993,6 @@ namespace Ink_Canvas
GridTransparencyFakeBackground.Background = Brushes.Transparent; GridTransparencyFakeBackground.Background = Brushes.Transparent;
GridBackgroundCoverHolder.Visibility = Visibility.Collapsed; GridBackgroundCoverHolder.Visibility = Visibility.Collapsed;
// 点击鼠标按钮退出批注模式时的全屏还原
RestoreFullScreenOnExitAnnotationMode();
inkCanvas.Select(new StrokeCollection()); inkCanvas.Select(new StrokeCollection());
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed; GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
@@ -2164,21 +2106,6 @@ namespace Ink_Canvas
BtnHideInkCanvas.Content = "隐藏\n画板"; BtnHideInkCanvas.Content = "隐藏\n画板";
// 进入批注模式时的全屏处理(仅当未应用过全屏处理时)
if (Settings.Advanced.IsEnableAvoidFullScreenHelper && !isFullScreenApplied)
{
// 设置为画板模式,允许全屏操作
AvoidFullScreenHelper.SetBoardMode(true);
Dispatcher.BeginInvoke(new Action(() =>
{
MainWindow.MoveWindow(new WindowInteropHelper(this).Handle, 0, 0,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true);
}), DispatcherPriority.ApplicationIdle);
isFullScreenApplied = true; // 标记已应用全屏处理
}
StackPanelCanvasControls.Visibility = Visibility.Visible; StackPanelCanvasControls.Visibility = Visibility.Visible;
//AnimationsHelper.ShowWithSlideFromLeftAndFade(StackPanelCanvasControls); //AnimationsHelper.ShowWithSlideFromLeftAndFade(StackPanelCanvasControls);
CheckEnableTwoFingerGestureBtnVisibility(true); CheckEnableTwoFingerGestureBtnVisibility(true);
@@ -3020,30 +2947,6 @@ namespace Ink_Canvas
private int currentMode; private int currentMode;
// 退出批注模式时的全屏还原处理
private void RestoreFullScreenOnExitAnnotationMode()
{
if (Settings.Advanced.IsEnableAvoidFullScreenHelper &&
isFullScreenApplied &&
currentMode == 0 && // 不在白板模式
BtnPPTSlideShowEnd.Visibility != Visibility.Visible) // 不在PPT放映模式
{
// 恢复为非画板模式,重新启用全屏限制
AvoidFullScreenHelper.SetBoardMode(false);
Dispatcher.BeginInvoke(new Action(() =>
{
// 退出批注模式,恢复到工作区域大小
var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;
MainWindow.MoveWindow(new WindowInteropHelper(this).Handle,
workingArea.Left, workingArea.Top,
workingArea.Width, workingArea.Height, true);
}), DispatcherPriority.ApplicationIdle);
isFullScreenApplied = false; // 标记全屏处理已还原
}
}
private void BtnSwitch_Click(object sender, RoutedEventArgs e) private void BtnSwitch_Click(object sender, RoutedEventArgs e)
{ {
if (GridTransparencyFakeBackground.Background == Brushes.Transparent) if (GridTransparencyFakeBackground.Background == Brushes.Transparent)
@@ -3112,9 +3015,8 @@ namespace Ink_Canvas
ClearStrokes(true); ClearStrokes(true);
RestoreStrokes(true); RestoreStrokes(true);
// 退出白板模式时取消全屏(仅在非PPT模式下) // 退出白板模式时取消全屏
if (Settings.Advanced.IsEnableAvoidFullScreenHelper && if (Settings.Advanced.IsEnableAvoidFullScreenHelper)
BtnPPTSlideShowEnd.Visibility != Visibility.Visible) // 不在PPT放映模式
{ {
// 恢复为非画板模式,重新启用全屏限制 // 恢复为非画板模式,重新启用全屏限制
AvoidFullScreenHelper.SetBoardMode(false); AvoidFullScreenHelper.SetBoardMode(false);
@@ -3127,8 +3029,6 @@ namespace Ink_Canvas
workingArea.Left, workingArea.Top, workingArea.Left, workingArea.Top,
workingArea.Width, workingArea.Height, true); workingArea.Width, workingArea.Height, true);
}), DispatcherPriority.ApplicationIdle); }), DispatcherPriority.ApplicationIdle);
isFullScreenApplied = false; // 标记全屏处理已还原
} }
// 在屏幕模式下恢复基础浮动栏的显示 // 在屏幕模式下恢复基础浮动栏的显示
@@ -3187,9 +3087,8 @@ namespace Ink_Canvas
RestoreStrokes(); RestoreStrokes();
// 进入白板模式时全屏(仅在非PPT模式下) // 进入白板模式时全屏
if (Settings.Advanced.IsEnableAvoidFullScreenHelper && if (Settings.Advanced.IsEnableAvoidFullScreenHelper)
BtnPPTSlideShowEnd.Visibility != Visibility.Visible) // 不在PPT放映模式
{ {
// 设置为画板模式,允许全屏操作 // 设置为画板模式,允许全屏操作
AvoidFullScreenHelper.SetBoardMode(true); AvoidFullScreenHelper.SetBoardMode(true);
@@ -3199,8 +3098,6 @@ namespace Ink_Canvas
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true); System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true);
}), DispatcherPriority.ApplicationIdle); }), DispatcherPriority.ApplicationIdle);
isFullScreenApplied = true; // 标记已应用全屏处理
} }
ViewboxFloatingBar.Visibility = Visibility.Collapsed; ViewboxFloatingBar.Visibility = Visibility.Collapsed;
@@ -3258,7 +3155,6 @@ namespace Ink_Canvas
{ {
if (GridTransparencyFakeBackground.Background == Brushes.Transparent) if (GridTransparencyFakeBackground.Background == Brushes.Transparent)
{ {
// 进入批注模式
GridTransparencyFakeBackground.Opacity = 1; GridTransparencyFakeBackground.Opacity = 1;
GridTransparencyFakeBackground.Background = new SolidColorBrush(StringToColor("#01FFFFFF")); GridTransparencyFakeBackground.Background = new SolidColorBrush(StringToColor("#01FFFFFF"));
inkCanvas.IsHitTestVisible = true; inkCanvas.IsHitTestVisible = true;
@@ -3283,21 +3179,6 @@ namespace Ink_Canvas
} }
BtnHideInkCanvas.Content = "隐藏\n画板"; BtnHideInkCanvas.Content = "隐藏\n画板";
// 进入批注模式时的全屏处理(仅当未应用过全屏处理时)
if (Settings.Advanced.IsEnableAvoidFullScreenHelper && !isFullScreenApplied)
{
// 设置为画板模式,允许全屏操作
AvoidFullScreenHelper.SetBoardMode(true);
Dispatcher.BeginInvoke(new Action(() =>
{
MainWindow.MoveWindow(new WindowInteropHelper(this).Handle, 0, 0,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true);
}), DispatcherPriority.ApplicationIdle);
isFullScreenApplied = true; // 标记已应用全屏处理
}
} }
else else
{ {
@@ -3348,9 +3229,6 @@ namespace Ink_Canvas
GridBackgroundCoverHolder.Visibility = Visibility.Collapsed; GridBackgroundCoverHolder.Visibility = Visibility.Collapsed;
// 退出批注模式时的全屏还原
RestoreFullScreenOnExitAnnotationMode();
if (currentMode != 0) if (currentMode != 0)
{ {
SaveStrokes(); SaveStrokes();