This commit is contained in:
PrefacedCorg
2026-04-14 12:19:36 +08:00
parent b64b0a3618
commit d73e87b980
7 changed files with 163 additions and 136 deletions
+14 -124
View File
@@ -8846,63 +8846,13 @@
<Border ClipToBounds="True" Visibility="Visible" CornerRadius="0,6,6,0" Background="{DynamicResource FloatBarBackground}" Opacity="1" <Border ClipToBounds="True" Visibility="Visible" CornerRadius="0,6,6,0" Background="{DynamicResource FloatBarBackground}" Opacity="1"
BorderThickness="1" BorderBrush="{DynamicResource FloatBarBorderBrush}" Width="32"> BorderThickness="1" BorderBrush="{DynamicResource FloatBarBorderBrush}" Width="32">
<ikw:SimpleStackPanel Orientation="Vertical" Margin="0,5"> <ikw:SimpleStackPanel Orientation="Vertical" Margin="0,5">
<ikw:SimpleStackPanel <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelPersonMoneyIcon}" Label="{i18n:I18n Key=QuickPanel_SingleDraw}" ButtonMouseUp="SymbolIconRandOne_MouseUp" />
MouseUp="SymbolIconRandOne_MouseUp" <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelPeopleMoneyIcon}" Label="{i18n:I18n Key=QuickPanel_RandomDraw}" ButtonMouseUp="SymbolIconRand_MouseUp" />
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelTimerIcon}" Label="{i18n:I18n Key=QuickPanel_Timer}" ButtonMouseUp="ImageCountdownTimer_MouseUp" />
Width="32" Margin="0"> <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelBlackboardIcon}" Label="{i18n:I18n Key=QuickPanel_Whiteboard}" ButtonMouseUp="ImageBlackboard_MouseUp" />
<Image Source="{DynamicResource QuickPanelPersonMoneyIcon}" <controls:QuickPanelButton x:Name="BtnExitPptFromSidebarLeft" IconSource="{DynamicResource QuickPanelEndSlideshowIcon}" Label="{i18n:I18n Key=QuickPanel_ExitShow}" LabelFontSize="7" Visibility="Collapsed" ButtonMouseUp="ExitPPTSlideShow_MouseUp" />
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" /> <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelEyeIcon}" Label="{i18n:I18n Key=QuickPanel_Show}" ButtonMouseUp="UnFoldFloatingBar_MouseUp" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_SingleDraw}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" /> <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelChevronLeftIcon}" ButtonMouseUp="HideQuickPanel_MouseUp" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="SymbolIconRand_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelPeopleMoneyIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_RandomDraw}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="ImageCountdownTimer_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelTimerIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_Timer}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="ImageBlackboard_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelBlackboardIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_Whiteboard}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
x:Name="BtnExitPptFromSidebarLeft"
MouseUp="ExitPPTSlideShow_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0" Visibility="Collapsed">
<Image Source="{DynamicResource QuickPanelEndSlideshowIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_ExitShow}" Foreground="{DynamicResource FloatBarForeground}" FontSize="7" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="UnFoldFloatingBar_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelEyeIcon}" RenderOptions.BitmapScalingMode="HighQuality"
Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_Show}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="HideQuickPanel_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelChevronLeftIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,3" />
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel> </ikw:SimpleStackPanel>
</Border> </Border>
</Viewbox> </Viewbox>
@@ -8929,73 +8879,13 @@
<Border ClipToBounds="True" Visibility="Visible" CornerRadius="6,0,0,6" Background="{DynamicResource FloatBarBackground}" Opacity="1" <Border ClipToBounds="True" Visibility="Visible" CornerRadius="6,0,0,6" Background="{DynamicResource FloatBarBackground}" Opacity="1"
BorderThickness="1" BorderBrush="{DynamicResource FloatBarBorderBrush}" Width="32"> BorderThickness="1" BorderBrush="{DynamicResource FloatBarBorderBrush}" Width="32">
<ikw:SimpleStackPanel Orientation="Vertical" Margin="0,5"> <ikw:SimpleStackPanel Orientation="Vertical" Margin="0,5">
<ikw:SimpleStackPanel <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelPersonMoneyIcon}" Label="{i18n:I18n Key=QuickPanel_SingleDraw}" ButtonMouseUp="SymbolIconRandOne_MouseUp" />
MouseUp="SymbolIconRandOne_MouseUp" <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelPeopleMoneyIcon}" Label="{i18n:I18n Key=QuickPanel_RandomDraw}" ButtonMouseUp="SymbolIconRand_MouseUp" />
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelTimerIcon}" Label="{i18n:I18n Key=QuickPanel_Timer}" ButtonMouseUp="ImageCountdownTimer_MouseUp" />
Width="32" Margin="0"> <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelBlackboardIcon}" Label="{i18n:I18n Key=QuickPanel_Whiteboard}" ButtonMouseUp="ImageBlackboard_MouseUp" />
<Image Source="{DynamicResource QuickPanelPersonMoneyIcon}" <controls:QuickPanelButton x:Name="BtnExitPptFromSidebarRight" IconSource="{DynamicResource QuickPanelEndSlideshowIcon}" Label="{i18n:I18n Key=QuickPanel_ExitShow}" LabelFontSize="7" Visibility="Collapsed" ButtonMouseUp="ExitPPTSlideShow_MouseUp" />
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" /> <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelEyeIcon}" Label="{i18n:I18n Key=QuickPanel_Show}" ButtonMouseUp="UnFoldFloatingBar_MouseUp" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_SingleDraw}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" /> <controls:QuickPanelButton IconSource="{DynamicResource QuickPanelChevronLeftIcon}" ButtonMouseUp="HideQuickPanel_MouseUp" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="SymbolIconRand_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelPeopleMoneyIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_RandomDraw}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="ImageCountdownTimer_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelTimerIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_Timer}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="ImageBlackboard_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelBlackboardIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_Whiteboard}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
x:Name="BtnExitPptFromSidebarRight"
MouseUp="ExitPPTSlideShow_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0" Visibility="Collapsed">
<Image Source="{DynamicResource QuickPanelEndSlideshowIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_ExitShow}" Foreground="{DynamicResource FloatBarForeground}" FontSize="7" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="UnFoldFloatingBar_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelEyeIcon}" RenderOptions.BitmapScalingMode="HighQuality"
Height="17" Margin="0,3,0,0" />
<TextBlock Text="{i18n:I18n Key=QuickPanel_Show}" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,2,0,3" TextAlignment="Center" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel
MouseUp="HideQuickPanel_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center"
Width="32" Margin="0">
<Image Source="{DynamicResource QuickPanelChevronLeftIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,3"
RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="180" />
<TranslateTransform />
</TransformGroup>
</Image.RenderTransform>
</Image>
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel> </ikw:SimpleStackPanel>
</Border> </Border>
</Viewbox> </Viewbox>
+1 -1
View File
@@ -2884,7 +2884,7 @@ namespace Ink_Canvas
ShowPage(currentPageIndex); ShowPage(currentPageIndex);
} }
// 快速面板退出PPT放映按钮事件 // 快速面板退出PPT放映按钮事件
private void ExitPPTSlideShow_MouseUp(object sender, MouseButtonEventArgs e) private void ExitPPTSlideShow_MouseUp(object sender, RoutedEventArgs e)
{ {
// 直接调用PPT放映结束按钮的逻辑 // 直接调用PPT放映结束按钮的逻辑
BtnPPTSlideShowEnd_Click(BtnPPTSlideShowEnd, null); BtnPPTSlideShowEnd_Click(BtnPPTSlideShowEnd, null);
+1 -1
View File
@@ -315,7 +315,7 @@ namespace Ink_Canvas
/// 1. 隐藏左侧快捷面板 /// 1. 隐藏左侧快捷面板
/// 2. 隐藏右侧快捷面板 /// 2. 隐藏右侧快捷面板
/// </remarks> /// </remarks>
private void HideQuickPanel_MouseUp(object sender, MouseButtonEventArgs e) private void HideQuickPanel_MouseUp(object sender, RoutedEventArgs e)
{ {
HideLeftQuickPanel(); HideLeftQuickPanel();
HideRightQuickPanel(); HideRightQuickPanel();
+12 -6
View File
@@ -66,7 +66,7 @@ namespace Ink_Canvas.Controls
private static void OnButtonSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnButtonSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var button = (CircularColorButton)d; var button = (CircularColorButton)d;
if (button.ButtonBorder == null) return; if (button.ButtonBorder == null || button.ColorOverlay == null) return;
var size = (double)e.NewValue; var size = (double)e.NewValue;
button.ButtonBorder.Width = size; button.ButtonBorder.Width = size;
@@ -74,11 +74,17 @@ namespace Ink_Canvas.Controls
var radius = (size - 3) / 2; var radius = (size - 3) / 2;
button.ColorOverlay.Width = radius * 2; button.ColorOverlay.Width = radius * 2;
button.ColorOverlay.Height = radius * 2; button.ColorOverlay.Height = radius * 2;
button.ImageClipGeometry.RadiusX = radius; if (button.ImageClipGeometry != null)
button.ImageClipGeometry.RadiusY = radius; {
button.ImageClipGeometry.Center = new Point(radius, radius); button.ImageClipGeometry.RadiusX = radius;
button.TransparentGridImage.Width = radius * 2; button.ImageClipGeometry.RadiusY = radius;
button.TransparentGridImage.Height = radius * 2; button.ImageClipGeometry.Center = new Point(radius, radius);
}
if (button.TransparentGridImage != null)
{
button.TransparentGridImage.Width = radius * 2;
button.TransparentGridImage.Height = radius * 2;
}
} }
public double ButtonSize public double ButtonSize
+25
View File
@@ -0,0 +1,25 @@
<UserControl x:Class="Ink_Canvas.Controls.QuickPanelButton"
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:ikw="http://schemas.inkore.net/lib/ui/wpf"
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="32">
<ikw:SimpleStackPanel x:Name="ButtonPanel"
MouseUp="ButtonPanel_MouseUp"
Background="Transparent"
Orientation="Vertical"
HorizontalAlignment="Center"
Width="32" Margin="0">
<Image x:Name="ButtonImage"
RenderOptions.BitmapScalingMode="HighQuality"
Height="17" Margin="0,3,0,0" />
<TextBlock x:Name="LabelTextBlock"
Foreground="{DynamicResource FloatBarForeground}"
FontSize="8"
Margin="0,2,0,3"
TextAlignment="Center"
Visibility="Collapsed" />
</ikw:SimpleStackPanel>
</UserControl>
@@ -0,0 +1,80 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace Ink_Canvas.Controls
{
public partial class QuickPanelButton : UserControl
{
public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(
nameof(Label), typeof(string), typeof(QuickPanelButton),
new PropertyMetadata(string.Empty, OnLabelChanged));
private static void OnLabelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var button = (QuickPanelButton)d;
if (button.LabelTextBlock != null)
{
var text = (string)e.NewValue;
button.LabelTextBlock.Text = text;
button.LabelTextBlock.Visibility = string.IsNullOrEmpty(text) ? Visibility.Collapsed : Visibility.Visible;
button.ButtonImage.Margin = string.IsNullOrEmpty(text)
? new Thickness(0, 3, 0, 3)
: new Thickness(0, 3, 0, 0);
}
}
public string Label
{
get => (string)GetValue(LabelProperty);
set => SetValue(LabelProperty, value);
}
public static readonly DependencyProperty IconSourceProperty = DependencyProperty.Register(
nameof(IconSource), typeof(ImageSource), typeof(QuickPanelButton),
new PropertyMetadata(null, OnIconSourceChanged));
private static void OnIconSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var button = (QuickPanelButton)d;
if (button.ButtonImage != null)
button.ButtonImage.Source = (ImageSource)e.NewValue;
}
public ImageSource IconSource
{
get => (ImageSource)GetValue(IconSourceProperty);
set => SetValue(IconSourceProperty, value);
}
public static readonly DependencyProperty LabelFontSizeProperty = DependencyProperty.Register(
nameof(LabelFontSize), typeof(double), typeof(QuickPanelButton),
new PropertyMetadata(8.0, OnLabelFontSizeChanged));
private static void OnLabelFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var button = (QuickPanelButton)d;
if (button.LabelTextBlock != null)
button.LabelTextBlock.FontSize = (double)e.NewValue;
}
public double LabelFontSize
{
get => (double)GetValue(LabelFontSizeProperty);
set => SetValue(LabelFontSizeProperty, value);
}
public event RoutedEventHandler ButtonMouseUp;
public QuickPanelButton()
{
InitializeComponent();
}
private void ButtonPanel_MouseUp(object sender, MouseButtonEventArgs e)
{
ButtonMouseUp?.Invoke(this, new RoutedEventArgs(e.RoutedEvent, this));
}
}
}
+30 -4
View File
@@ -7,6 +7,9 @@ namespace Ink_Canvas.Controls
{ {
public partial class ToolMenuButton : UserControl public partial class ToolMenuButton : UserControl
{ {
private Geometry _pendingGeometry;
private Brush _pendingBrush;
public static readonly DependencyProperty LabelProperty = DependencyProperty.Register( public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(
nameof(Label), typeof(string), typeof(ToolMenuButton), nameof(Label), typeof(string), typeof(ToolMenuButton),
new PropertyMetadata(string.Empty, OnLabelChanged)); new PropertyMetadata(string.Empty, OnLabelChanged));
@@ -31,9 +34,11 @@ namespace Ink_Canvas.Controls
private static void OnIconGeometryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnIconGeometryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var button = (ToolMenuButton)d; var button = (ToolMenuButton)d;
if (e.NewValue is string geometry && !string.IsNullOrEmpty(geometry) && button.IconGeometryInternal != null) if (e.NewValue is string geometry && !string.IsNullOrEmpty(geometry))
{ {
button.IconGeometryInternal.Geometry = Geometry.Parse(geometry); button._pendingGeometry = Geometry.Parse(geometry);
if (button.IconGeometryInternal != null)
button.IconGeometryInternal.Geometry = button._pendingGeometry;
} }
} }
@@ -50,8 +55,9 @@ namespace Ink_Canvas.Controls
private static void OnIconBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnIconBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var button = (ToolMenuButton)d; var button = (ToolMenuButton)d;
button._pendingBrush = (Brush)e.NewValue;
if (button.IconGeometryInternal != null) if (button.IconGeometryInternal != null)
button.IconGeometryInternal.Brush = (Brush)e.NewValue; button.IconGeometryInternal.Brush = button._pendingBrush;
} }
public Brush IconBrush public Brush IconBrush
@@ -66,7 +72,15 @@ namespace Ink_Canvas.Controls
set => ButtonPanel.Background = value; set => ButtonPanel.Background = value;
} }
public GeometryDrawing Icon => IconGeometryInternal; public GeometryDrawing Icon
{
get
{
if (IconGeometryInternal != null)
return IconGeometryInternal;
return new GeometryDrawing(_pendingBrush, null, _pendingGeometry);
}
}
public event MouseButtonEventHandler ButtonMouseDown; public event MouseButtonEventHandler ButtonMouseDown;
public event MouseEventHandler ButtonMouseLeave; public event MouseEventHandler ButtonMouseLeave;
@@ -75,6 +89,18 @@ namespace Ink_Canvas.Controls
public ToolMenuButton() public ToolMenuButton()
{ {
InitializeComponent(); InitializeComponent();
Loaded += ToolMenuButton_Loaded;
}
private void ToolMenuButton_Loaded(object sender, RoutedEventArgs e)
{
if (IconGeometryInternal != null)
{
if (_pendingGeometry != null)
IconGeometryInternal.Geometry = _pendingGeometry;
if (_pendingBrush != null)
IconGeometryInternal.Brush = _pendingBrush;
}
} }
private void ButtonPanel_MouseDown(object sender, MouseButtonEventArgs e) private void ButtonPanel_MouseDown(object sender, MouseButtonEventArgs e)