[update] 白板翻页按钮;浮动工具栏按钮显示隐藏设置项目;存储系统修复

This commit is contained in:
Dubi906w 2024-08-09 21:34:02 +08:00
parent f281b9eb6f
commit f7004d0565
9 changed files with 231 additions and 176 deletions

View File

@ -101,7 +101,7 @@ namespace Ink_Canvas
mainWin = new MainWindow();
if (isUsingWindowChrome) {
if (isUsingWindowChrome && DwmCompositionHelper.DwmIsCompositionEnabled()) {
mainWin.AllowsTransparency = false;
WindowChrome wc = new WindowChrome();
wc.GlassFrameThickness = new Thickness(-1);

View File

@ -504,7 +504,7 @@
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="5">
<Border CornerRadius="5,5,5,5" Background="#f4f4f5" Margin="0,0,0,0">
<ui:SimpleStackPanel Orientation="Horizontal">
<Border Width="60" Height="50"
<Border Width="60" Height="50" Name="BtnWhiteBoardSwitchPreviousL"
IsEnabled="{Binding ElementName=BtnWhiteBoardSwitchPrevious, Path=IsEnabled}"
BorderThickness="1,1,0,1" BorderBrush="#a1a1aa"
MouseUp="BtnWhiteBoardSwitchPrevious_Click" CornerRadius="5,0,0,5"
@ -535,8 +535,7 @@
BorderThickness="1,1,1,1" BorderBrush="#a1a1aa" Background="#f4f4f5"
Opacity="0.95">
<Grid Margin="6,6,6,4">
<TextBlock HorizontalAlignment="Center"
Text="{Binding ElementName=TextBlockWhiteBoardIndexInfo, Path=Text}"
<TextBlock HorizontalAlignment="Center" Text="1/1" Name="BtnLeftPageListWBTextCount"
Margin="0,-1,0,0" FontSize="17" FontWeight="Bold"
TextAlignment="Center" />
<TextBlock Text="页面" Foreground="#18181b" VerticalAlignment="Bottom"
@ -594,8 +593,7 @@
</Border>
</Grid>
<Border Width="60" Height="50" MouseUp="BtnWhiteBoardSwitchNext_Click"
CornerRadius="0,5,5,0"
IsEnabled="{Binding ElementName=BtnWhiteBoardSwitchNext, Path=IsEnabled}"
CornerRadius="0,5,5,0" Name="BtnWhiteBoardSwitchNextL"
BorderThickness="0,1,1,1" BorderBrush="#a1a1aa"
Background="#f4f4f5" Opacity="0.95">
<Grid Margin="6,6,6,4">
@ -620,7 +618,7 @@
</Border>
</ui:SimpleStackPanel>
</Border>
<Border Width="60" Height="50"
<Border Width="60" Height="50" Name="BtnWhiteboardAddLeft"
BorderThickness="1" BorderBrush="#a1a1aa"
MouseUp="BtnWhiteBoardAdd_Click" CornerRadius="5" Background="#f4f4f5"
Opacity="0.95">
@ -631,7 +629,7 @@
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b"
<GeometryDrawing Brush="#18181b" x:Name="BtnWhiteboardAddGeometryLeft"
Geometry="F0 M24,24z M0,0z M7.39778,13.723L10.7693,13.723 10.7693,10.3514 13.2307,10.3514 13.2307,13.723 16.6022,13.723 16.6022,16.1843 13.2307,16.1843 13.2307,19.5559 10.7693,19.5559 10.7693,16.1843 7.39778,16.1843 7.39778,13.723z M3.1391,1.17001L3.1391,22.83 20.8609,22.83 20.8609,6.66948 15.3614,1.17002 3.1391,1.17001z M12.9846,3.13911L5.10819,3.1391 5.10819,20.8609 18.8918,20.8609 18.8918,9.04638 12.9846,9.04638 12.9846,3.13911z M18.484,7.07729L14.9536,3.54692 14.9536,7.07729 18.484,7.07729z" />
</DrawingGroup>
</DrawingImage.Drawing>
@ -639,7 +637,7 @@
</Image.Source>
</Image>
<TextBlock Text="新页面" Foreground="#18181b" VerticalAlignment="Bottom"
HorizontalAlignment="Center" FontSize="12" />
HorizontalAlignment="Center" FontSize="12" Name="BtnWhiteboardAddTextBlockLeft"/>
</Grid>
</Border>
</ui:SimpleStackPanel>
@ -2761,7 +2759,7 @@
<Grid Name="BlackboardRightSide" Visibility="Visible" Margin="0,0,0,3" Height="50"
HorizontalAlignment="Center" VerticalAlignment="Bottom">
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="5">
<Border Width="60" Height="50"
<Border Width="60" Height="50" Name="BtnWhiteboardAddRight"
BorderThickness="1" BorderBrush="#a1a1aa"
MouseUp="BtnWhiteBoardAdd_Click" CornerRadius="5" Background="#f4f4f5"
Opacity="0.95">
@ -2772,7 +2770,7 @@
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b"
<GeometryDrawing Brush="#18181b" x:Name="BtnWhiteboardAddGeometryRight"
Geometry="F0 M24,24z M0,0z M7.39778,13.723L10.7693,13.723 10.7693,10.3514 13.2307,10.3514 13.2307,13.723 16.6022,13.723 16.6022,16.1843 13.2307,16.1843 13.2307,19.5559 10.7693,19.5559 10.7693,16.1843 7.39778,16.1843 7.39778,13.723z M3.1391,1.17001L3.1391,22.83 20.8609,22.83 20.8609,6.66948 15.3614,1.17002 3.1391,1.17001z M12.9846,3.13911L5.10819,3.1391 5.10819,20.8609 18.8918,20.8609 18.8918,9.04638 12.9846,9.04638 12.9846,3.13911z M18.484,7.07729L14.9536,3.54692 14.9536,7.07729 18.484,7.07729z" />
</DrawingGroup>
</DrawingImage.Drawing>
@ -2780,13 +2778,12 @@
</Image.Source>
</Image>
<TextBlock Text="新页面" Foreground="#18181b" VerticalAlignment="Bottom"
HorizontalAlignment="Center" FontSize="12" />
HorizontalAlignment="Center" FontSize="12" Name="BtnWhiteboardAddTextBlockRight" />
</Grid>
</Border>
<Border CornerRadius="5,5,5,5" Background="#f4f4f5" Margin="0,0,0,0">
<ui:SimpleStackPanel Orientation="Horizontal">
<Border Width="60" Height="50"
IsEnabled="{Binding ElementName=BtnWhiteBoardSwitchPrevious, Path=IsEnabled}"
<Border Width="60" Height="50" Name="BtnWhiteBoardSwitchPreviousR"
BorderThickness="1,1,0,1" BorderBrush="#a1a1aa"
MouseUp="BtnWhiteBoardSwitchPrevious_Click" CornerRadius="5,0,0,5"
Background="#f4f4f5"
@ -2817,7 +2814,7 @@
Opacity="0.95">
<Grid Margin="6,6,6,4">
<TextBlock HorizontalAlignment="Center"
Text="{Binding ElementName=TextBlockWhiteBoardIndexInfo, Path=Text}"
Text="1/1" Name="BtnRightPageListWBTextCount"
Margin="0,-1,0,0" FontSize="17" FontWeight="Bold"
TextAlignment="Center" />
<TextBlock Text="页面" Foreground="#18181b" VerticalAlignment="Bottom"
@ -2875,7 +2872,7 @@
</Border>
</Grid>
<Border Width="60" Height="50" MouseUp="BtnWhiteBoardSwitchNext_Click"
IsEnabled="{Binding ElementName=BtnWhiteBoardSwitchNext, Path=IsEnabled}"
Name="BtnWhiteBoardSwitchNextR"
CornerRadius="0,5,5,0"
BorderThickness="0,1,1,1" BorderBrush="#a1a1aa"
Background="#f4f4f5" Opacity="0.95">
@ -2904,92 +2901,6 @@
</ui:SimpleStackPanel>
</Grid>
</Viewbox>
<ui:SimpleStackPanel Spacing="10" Orientation="Horizontal"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Height="50" Margin="10"
Visibility="Collapsed">
<Button Name="BtnWhiteBoardAdd" FontFamily="Microsoft YaHei UI"
Width="50" Height="48" FontSize="26" Click="BtnWhiteBoardAdd_Click"
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"
Background="{Binding ElementName=BtnExit, Path=Background}">
<ui:SymbolIcon Symbol="Add" />
</Button>
<Button Name="BtnWhiteBoardSwitchPrevious" FontFamily="Symbol"
Width="50" Height="48" FontSize="25" Click="BtnWhiteBoardSwitchPrevious_Click"
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"
Background="{Binding ElementName=BtnExit, Path=Background}"
VerticalContentAlignment="Center"
IsEnabled="False" IsEnabledChanged="Btn_IsEnabledChanged">
<Image RenderTransformOrigin="0.5,0.5" Opacity="0.25">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="-90" />
<TranslateTransform />
</TransformGroup>
</Image.RenderTransform>
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V64 H64 V0 H0 Z">
<DrawingGroup Opacity="1">
<GeometryDrawing Brush="{Binding ElementName=BtnExit, Path=Foreground}"
Geometry="F1 M64,64z M0,0z M32,26.41L16.566,41.844 14.439,39.717 32,22.156 49.561,39.717 47.434,41.844 32,26.41z" />
</DrawingGroup>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Button>
<Border Height="48" CornerRadius="2" Margin="3,0">
<TextBlock Name="TextBlockWhiteBoardIndexInfo"
Text="1/1"
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"
VerticalAlignment="Center" HorizontalAlignment="Center"
FontFamily="Microsoft YaHei UI"
FontSize="18" />
</Border>
<Button Name="BtnWhiteBoardSwitchNext" FontFamily="Symbol"
Width="50" Height="48" FontSize="25" Click="BtnWhiteBoardSwitchNext_Click"
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"
Background="{Binding ElementName=BtnExit, Path=Background}"
VerticalContentAlignment="Center"
IsEnabled="True" IsEnabledChanged="Btn_IsEnabledChanged">
<Image RenderTransformOrigin="0.5,0.5" Opacity="0.25">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="90" />
<TranslateTransform />
</TransformGroup>
</Image.RenderTransform>
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V64 H64 V0 H0 Z">
<DrawingGroup Opacity="1">
<GeometryDrawing Brush="{Binding ElementName=BtnExit, Path=Foreground}"
Geometry="F1 M64,64z M0,0z M32,26.41L16.566,41.844 14.439,39.717 32,22.156 49.561,39.717 47.434,41.844 32,26.41z" />
</DrawingGroup>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Button>
<Button Name="BtnWhiteBoardDelete" Click="BtnWhiteBoardDelete_Click"
FontFamily="Microsoft YaHei UI" Width="50" Height="48" FontSize="26"
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"
Background="{Binding ElementName=BtnExit, Path=Background}"
IsEnabled="False">
<ui:SymbolIcon Symbol="Delete" />
</Button>
</ui:SimpleStackPanel>
</Grid>
</Grid>
@ -6741,6 +6652,31 @@
</CheckBox>
</ui:SimpleStackPanel>
</WrapPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="橡皮按钮" VerticalAlignment="Center"
FontSize="14" Margin="0,0,16,0" />
<ComboBox Name="ComboBoxEraserButton" FontFamily="Microsoft YaHei UI"
SelectedIndex="0"
SelectionChanged="ComboBoxEraserButton_SelectionChanged">
<ComboBoxItem Content="两个都显示" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="只显示板擦" FontFamily="Microsoft YaHei UI" />
<ComboBoxItem Content="只显示线擦" FontFamily="Microsoft YaHei UI" />
</ComboBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Spacing="6" Orientation="Vertical" Name="SettingsOnlyDisplayEraserBtnPanel">
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="只显示为橡皮按钮"
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
<ui:ToggleSwitch OnContent="" OffContent=""
Name="ToggleSwitchOnlyDisplayEraserBtn"
IsOn="True" FontFamily="Microsoft YaHei UI"
FontWeight="Bold" Toggled="ToggleSwitchOnlyDisplayEraserBtn_OnToggled"/>
</ui:SimpleStackPanel>
<TextBlock
Text="# 当橡皮按钮只显示线擦或板擦时,开启该选项可以让该按钮直接显示为“橡皮”按钮,而不显示是板擦按钮还是线擦按钮。"
TextWrapping="Wrap"
Foreground="#a1a1aa" />
</ui:SimpleStackPanel>
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">

View File

@ -239,7 +239,6 @@ namespace Ink_Canvas {
new SolidColorBrush(System.Windows.Media.Color.FromArgb(127, 24, 24, 27));
BtnRightWhiteBoardSwitchPreviousLabel.Opacity = 0.5;
BtnWhiteBoardSwitchPrevious.IsEnabled = CurrentWhiteboardIndex != 1;
BorderInkReplayToolBox.Visibility = Visibility.Collapsed;
BoardBackgroundPopup.Visibility = Visibility.Collapsed;
@ -269,6 +268,8 @@ namespace Ink_Canvas {
InitFreezeWindow(new HWND[] {
new HWND(new WindowInteropHelper(this).Handle)
});
UpdateIndexInfoDisplay();
}
private void SystemEventsOnDisplaySettingsChanged(object sender, EventArgs e) {

View File

@ -189,8 +189,6 @@ namespace Ink_Canvas {
}
private void BtnWhiteBoardSwitchNext_Click(object sender, EventArgs e) {
Trace.WriteLine("113223234");
if (Settings.Automation.IsAutoSaveStrokesAtClear &&
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) SaveScreenshot(true);
if (CurrentWhiteboardIndex >= WhiteboardTotalCount) {
@ -230,7 +228,7 @@ namespace Ink_Canvas {
UpdateIndexInfoDisplay();
if (WhiteboardTotalCount >= 99) BtnWhiteBoardAdd.IsEnabled = false;
//if (WhiteboardTotalCount >= 99) BtnWhiteBoardAdd.IsEnabled = false;
if (BlackBoardLeftSidePageListView.Visibility == Visibility.Visible) {
RefreshBlackBoardSidePageListView();
@ -254,74 +252,84 @@ namespace Ink_Canvas {
UpdateIndexInfoDisplay();
if (WhiteboardTotalCount < 99) BtnWhiteBoardAdd.IsEnabled = true;
//if (WhiteboardTotalCount < 99) BtnWhiteBoardAdd.IsEnabled = true;
}
private bool _whiteboardModePreviousPageButtonEnabled = false;
private bool _whiteboardModeNextPageButtonEnabled = false;
private bool _whiteboardModeNewPageButtonEnabled = false;
private bool _whiteboardModeNewPageButtonMerged = false;
public bool WhiteboardModePreviousPageButtonEnabled {
get => _whiteboardModePreviousPageButtonEnabled;
set {
_whiteboardModePreviousPageButtonEnabled = value;
var geo = new GeometryDrawing[]
{ BtnLeftWhiteBoardSwitchPreviousGeometry, BtnRightWhiteBoardSwitchPreviousGeometry };
var label = new TextBlock[]
{ BtnLeftWhiteBoardSwitchPreviousLabel, BtnRightWhiteBoardSwitchPreviousLabel };
var border = new Border[]
{ BtnWhiteBoardSwitchPreviousL, BtnWhiteBoardSwitchPreviousR };
foreach (var gd in geo)
gd.Brush = new SolidColorBrush(Color.FromArgb((byte)(value ? 255 : 127), 24, 24, 27));
foreach (var tb in label) tb.Opacity = value ? 1 : 0.5;
foreach (var bd in border) bd.IsHitTestVisible = value;
}
}
public bool WhiteboardModeNextPageButtonEnabled {
get => _whiteboardModeNextPageButtonEnabled;
set {
_whiteboardModeNextPageButtonEnabled = value;
var geo = new GeometryDrawing[]
{ BtnLeftWhiteBoardSwitchNextGeometry, BtnRightWhiteBoardSwitchNextGeometry };
var label = new TextBlock[]
{ BtnLeftWhiteBoardSwitchNextLabel, BtnRightWhiteBoardSwitchNextLabel };
var border = new Border[]
{ BtnWhiteBoardSwitchNextL, BtnWhiteBoardSwitchNextR };
foreach (var gd in geo)
gd.Brush = new SolidColorBrush(Color.FromArgb((byte)(value ? 255 : 127), 24, 24, 27));
foreach (var tb in label) tb.Opacity = value ? 1 : 0.5;
foreach (var bd in border) bd.IsHitTestVisible = value;
}
}
public bool WhiteboardModeNewPageButtonEnabled {
get => _whiteboardModeNewPageButtonEnabled;
set {
_whiteboardModeNewPageButtonEnabled = value;
var geo = new GeometryDrawing[]
{ BtnWhiteboardAddGeometryLeft, BtnWhiteboardAddGeometryRight };
var label = new TextBlock[]
{ BtnWhiteboardAddTextBlockLeft, BtnWhiteboardAddTextBlockRight };
var border = new Border[]
{ BtnWhiteboardAddLeft, BtnWhiteboardAddRight };
foreach (var gd in geo)
gd.Brush = new SolidColorBrush(Color.FromArgb((byte)(value ? 255 : 127), 24, 24, 27));
foreach (var tb in label) tb.Opacity = value ? 1 : 0.5;
foreach (var bd in border) bd.IsHitTestVisible = value;
}
}
public bool WhiteboardModeNewPageButtonMerged {
get => _whiteboardModeNewPageButtonMerged;
set {
_whiteboardModeNewPageButtonMerged = value;
BtnWhiteBoardSwitchNextL.Visibility = value ? Visibility.Collapsed : Visibility.Visible;
BtnLeftPageListWB.CornerRadius = value ? new CornerRadius(0, 5, 5, 0) : new CornerRadius(0);
}
}
private void UpdateIndexInfoDisplay() {
TextBlockWhiteBoardIndexInfo.Text =
BtnLeftPageListWBTextCount.Text =
$"{CurrentWhiteboardIndex}/{WhiteboardTotalCount}";
BtnRightPageListWBTextCount.Text =
$"{CurrentWhiteboardIndex}/{WhiteboardTotalCount}";
if (CurrentWhiteboardIndex == WhiteboardTotalCount) {
var newImageSource = new BitmapImage();
newImageSource.BeginInit();
newImageSource.UriSource = new Uri("/Resources/Icons-Fluent/ic_fluent_add_circle_24_regular.png",
UriKind.RelativeOrAbsolute);
newImageSource.EndInit();
//BoardLeftPannelNextPage.Source = newImageSource;
//BoardRightPannelNextPage.Source = newImageSource;
//BoardRightPannelNextPageTextBlock.Text = "加页";
//BoardLeftPannelNextPageTextBlock.Text = "加页";
} else {
var newImageSource = new BitmapImage();
newImageSource.BeginInit();
newImageSource.UriSource =
new Uri("/Resources/Icons-Fluent/ic_fluent_arrow_circle_right_24_regular.png",
UriKind.RelativeOrAbsolute);
newImageSource.EndInit();
//BoardLeftPannelNextPage.Source = newImageSource;
//BoardRightPannelNextPage.Source = newImageSource;
//BoardRightPannelNextPageTextBlock.Text = "下一页";
//BoardLeftPannelNextPageTextBlock.Text = "下一页";
}
BtnWhiteBoardSwitchPrevious.IsEnabled = true;
BtnWhiteBoardSwitchNext.IsEnabled = true;
if (CurrentWhiteboardIndex == 1) {
BtnWhiteBoardSwitchPrevious.IsEnabled = false;
BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 0.5;
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1;
BtnRightWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
BtnRightWhiteBoardSwitchPreviousLabel.Opacity = 0.5;
BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
BtnRightWhiteBoardSwitchNextLabel.Opacity = 1;
} else {
BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 1;
BtnRightWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
BtnRightWhiteBoardSwitchPreviousLabel.Opacity = 1;
if (CurrentWhiteboardIndex == WhiteboardTotalCount) {
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 0.5;
BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
BtnRightWhiteBoardSwitchNextLabel.Opacity = 0.5;
BtnWhiteBoardSwitchNext.IsEnabled = false;
} else {
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1;
BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
BtnRightWhiteBoardSwitchNextLabel.Opacity = 1;
}
}
BtnWhiteBoardDelete.IsEnabled = WhiteboardTotalCount != 1;
WhiteboardModePreviousPageButtonEnabled = CurrentWhiteboardIndex > 1;
WhiteboardModeNextPageButtonEnabled = CurrentWhiteboardIndex < WhiteboardTotalCount;
WhiteboardModeNewPageButtonEnabled = WhiteboardTotalCount < 99;
WhiteboardModeNewPageButtonMerged = CurrentWhiteboardIndex == WhiteboardTotalCount;
}
}
}

View File

@ -1,5 +1,6 @@
using Ink_Canvas.Helpers;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@ -570,6 +571,15 @@ namespace Ink_Canvas {
LassoSelectIconGeometry
};
SimpleStackPanel[] floatingBarIconsSimpleStackPanels = new SimpleStackPanel[] {
Cursor_Icon,
Pen_Icon,
EraserByStrokes_Icon,
Eraser_Icon,
SymbolIconSelect,
HandFloatingBarBtn,
};
TextBlock[] iconTextBlocksFloatingBar = new TextBlock[] {
SelectionToolBarTextBlock,
PenToolbarTextBlock,
@ -629,6 +639,26 @@ namespace Ink_Canvas {
var highlightStepWidth = Settings.Appearance.FloatingBarButtonLabelVisibility ? 28 : 21;
var FloatingBarItemsCalc = new List<FrameworkElement>() {
Cursor_Icon,
Pen_Icon,
SymbolIconDelete,
EraserByStrokes_Icon,
Eraser_Icon,
SymbolIconSelect,
ShapeDrawFloatingBarBtn,
FreezeFloatingBarBtn,
HandFloatingBarBtn,
SymbolIconUndo,
SymbolIconRedo,
CursorWithDelFloatingBarBtn,
};
var final_items = new List<FrameworkElement>();
foreach (var fe in FloatingBarItemsCalc) {
if (fe.Visibility != Visibility.Collapsed) final_items.Add(fe);
}
if (mode != ICCToolsEnum.CursorMode) {
// floating bar
var ngdf = iconGeometryDrawingsFloatingBar[(int)mode];
@ -636,8 +666,7 @@ namespace Ink_Canvas {
iconTextBlocksFloatingBar[(int)mode].Foreground = new SolidColorBrush(Colors.White);
ngdf.Geometry = Geometry.Parse(iconGeometryPathStringsFloatingBar[(int)mode+5]);
FloatingbarSelectionBG.Visibility = Visibility.Visible;
var iconPosI = (int)mode == 1 ? highlightStepWidth :
(int)mode > 1 ? highlightStepWidth * ((int)mode + 1) : 0;
var iconPosI = final_items.IndexOf(floatingBarIconsSimpleStackPanels[(int)mode])*28;
System.Windows.Controls.Canvas.SetLeft(FloatingbarSelectionBG, iconPosI);
// whiteboard
@ -693,6 +722,9 @@ namespace Ink_Canvas {
FreezeIconGeometry.Brush = new SolidColorBrush(Colors.White);
FreezeToolbarTextBlock.Foreground = new SolidColorBrush(Colors.White);
FloatingbarFreezeBtnBG.Visibility = Visibility.Visible;
var transform = FloatingbarFreezeBtnBG.TransformToVisual(BorderFloatingBarMainControls);
var pt = transform.Transform(new Point(0, 0));
System.Windows.Controls.Canvas.SetLeft(FloatingbarFreezeBtnBG, pt.X-5);
} else {
FreezeIconGeometry.Brush = new SolidColorBrush(Color.FromRgb(27, 27, 27));
FreezeToolbarTextBlock.Foreground = new SolidColorBrush(Colors.Black);
@ -807,6 +839,14 @@ namespace Ink_Canvas {
RectangleSelectionHitTestBorder.Visibility = Visibility.Collapsed;
}
private bool ____isHideSubPanel = true;
private void PenIconFakeClickForToolBarSettings() {
____isHideSubPanel = false;
PenIcon_Click(null, null);
____isHideSubPanel = true;
}
private void PenIcon_Click(object sender, RoutedEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
@ -834,7 +874,7 @@ namespace Ink_Canvas {
CheckEnableTwoFingerGestureBtnVisibility(true);
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
ColorSwitchCheck();
HideSubPanels("pen", true);
if (____isHideSubPanel) HideSubPanels("pen", true);
// update tool selection
SelectedMode = ICCToolsEnum.PenMode;
@ -887,7 +927,7 @@ namespace Ink_Canvas {
{
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
ColorSwitchCheck();
HideSubPanels("pen", true);
if (____isHideSubPanel) HideSubPanels("pen", true);
// update tool selection
SelectedMode = ICCToolsEnum.PenMode;
@ -1058,7 +1098,39 @@ namespace Ink_Canvas {
var floatingBarIconsVisibilityValue = Settings.Appearance.FloatingBarIconsVisibility;
var fbivca = floatingBarIconsVisibilityValue.ToCharArray();
for (var i = 0; i < fbivca.Length; i++) {
if (items[i] == EnableTwoFingerGestureBorder) continue;
items[i].Visibility = fbivca[i] == '1' ? Visibility.Visible : Visibility.Collapsed;
if (!isLoaded) continue;
if (items[i] == FreezeFloatingBarBtn && IsAnnotationFreezeOn && fbivca[i] == '0') IsAnnotationFreezeOn = false;
if ((items[i] == HandFloatingBarBtn || items[i] == SymbolIconSelect) && fbivca[i] == '0' &&
SelectedMode != ICCToolsEnum.PenMode &&
SelectedMode != ICCToolsEnum.CursorMode) PenIconFakeClickForToolBarSettings();
}
if (StackPanelCanvasControls.Visibility == Visibility.Visible) {
EnableTwoFingerGestureBorder.Visibility = fbivca[9] == '1' ? Visibility.Visible : Visibility.Collapsed;
}
Eraser_Icon.Visibility = Visibility.Visible;
EraserByStrokes_Icon.Visibility = Visibility.Visible;
if (Settings.Appearance.EraserButtonsVisibility == 1) EraserByStrokes_Icon.Visibility = Visibility.Collapsed;
else if (Settings.Appearance.EraserButtonsVisibility == 2) Eraser_Icon.Visibility = Visibility.Collapsed;
if (((SelectedMode == ICCToolsEnum.EraseByStrokeMode && Settings.Appearance.EraserButtonsVisibility == 1)
|| (SelectedMode == ICCToolsEnum.EraseByGeometryMode &&
Settings.Appearance.EraserButtonsVisibility == 2)) && isLoaded) PenIconFakeClickForToolBarSettings();
SettingsOnlyDisplayEraserBtnPanel.Visibility = Settings.Appearance.EraserButtonsVisibility == 0
? Visibility.Collapsed
: Visibility.Visible;
if (Settings.Appearance.OnlyDisplayEraserBtn && Settings.Appearance.EraserButtonsVisibility != 0) {
InkEraserToolbarTextBlock.Text = "橡皮";
CircleEraserToolbarTextBlock.Text = "橡皮";
} else {
InkEraserToolbarTextBlock.Text = "线擦";
CircleEraserToolbarTextBlock.Text = "板擦";
}
}

View File

@ -820,10 +820,39 @@ namespace Ink_Canvas {
Settings.Appearance.FloatingBarIconsVisibility = vsb.ToString();
UpdateFloatingBarIconsVisibility();
ForceUpdateToolSelection(null);
Dispatcher.InvokeAsync(async () => {
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) {
await Task.Delay(10);
ViewboxFloatingBarMarginAnimation(60);
} else if (Topmost == true) //非黑板
{
await Task.Delay(10);
ViewboxFloatingBarMarginAnimation(100, true);
} else //黑板
{
await Task.Delay(10);
ViewboxFloatingBarMarginAnimation(60);
}
});
SaveSettingsToFile();
}
private void ComboBoxEraserButton_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if (!isLoaded) return;
Settings.Appearance.EraserButtonsVisibility = ComboBoxEraserButton.SelectedIndex;
UpdateFloatingBarIconsVisibility();
SaveSettingsToFile();
}
private void ToggleSwitchOnlyDisplayEraserBtn_OnToggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
Settings.Appearance.OnlyDisplayEraserBtn = ToggleSwitchOnlyDisplayEraserBtn.IsOn;
UpdateFloatingBarIconsVisibility();
SaveSettingsToFile();
}
#endregion
#region Canvas
@ -1577,6 +1606,8 @@ namespace Ink_Canvas {
Settings.Appearance.EnableTrayIcon = true;
Settings.Appearance.FloatingBarButtonLabelVisibility = true;
Settings.Appearance.FloatingBarIconsVisibility = "11111111";
Settings.Appearance.EraserButtonsVisibility = 0;
Settings.Appearance.OnlyDisplayEraserBtn = false;
Settings.Automation.IsAutoFoldInEasiNote = true;
Settings.Automation.IsAutoFoldInEasiNoteIgnoreDesktopAnno = true;

View File

@ -353,6 +353,9 @@ namespace Ink_Canvas {
items[i].IsChecked = fbivca[i] == '1';
}
ComboBoxEraserButton.SelectedIndex = Settings.Appearance.EraserButtonsVisibility;
ToggleSwitchOnlyDisplayEraserBtn.IsOn = Settings.Appearance.OnlyDisplayEraserBtn;
UpdateFloatingBarIconsVisibility();
FloatingBarTextVisibilityBindingLikeAPieceOfShit.Visibility = Settings.Appearance.FloatingBarButtonLabelVisibility ? Visibility.Visible : Visibility.Collapsed;

View File

@ -162,7 +162,7 @@ namespace Ink_Canvas {
ComboBoxStoragePath.SelectedIndex = storageLocationItems.Count - 1;
}
if (isLoaded) CustomStorageLocationGroup.Visibility = ((StorageLocationItem)ComboBoxStoragePath.SelectedItem).SelectItem == "c-" ? Visibility.Visible : Visibility.Collapsed;
if (isLoaded) CustomStorageLocationGroup.Visibility = Settings.Storage.StorageLocation == "c-" ? Visibility.Visible : Visibility.Collapsed;
if (isLoaded) CustomStorageLocation.Text = Settings.Storage.UserStorageLocation;
}

View File

@ -232,8 +232,12 @@ namespace Ink_Canvas
public int Theme { get; set; } = 0;
[JsonProperty("floatingBarButtonLabelVisibility")]
public bool FloatingBarButtonLabelVisibility = true;
[JsonProperty("FloatingBarIconsVisibility")]
public string FloatingBarIconsVisibility = "11111111";
[JsonProperty("floatingBarIconsVisibility")]
public string FloatingBarIconsVisibility = "1111111111";
[JsonProperty("eraserButtonsVisibility")]
public int EraserButtonsVisibility = 0;
[JsonProperty("onlyDisplayEraserBtn")]
public bool OnlyDisplayEraserBtn = false;
}
public class PowerPointSettings