Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Ink Canvas/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,16 @@
<TextBlock Foreground="#fafafa" Text="{Binding ElementName=InkFadeTimeSlider, Path=Value, StringFormat={}{0:0}ms}"
VerticalAlignment="Center" FontSize="14" Margin="16,0,0,0" />
</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">
<TextBlock Foreground="#fafafa" Text="在笔工具菜单中隐藏墨迹渐隐控制" VerticalAlignment="Center"
FontSize="14" Margin="0,0,16,0" />
<ui:ToggleSwitch OnContent="" OffContent="" Name="ToggleSwitchHideInkFadeControlInPenMenu"
IsOn="False" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
Toggled="ToggleSwitchHideInkFadeControlInPenMenu_Toggled" />
</ui:SimpleStackPanel>
<TextBlock Text="# 开启后,主工具栏上点击笔工具后弹出的上下文菜单中将不显示墨迹渐隐控制开关" TextWrapping="Wrap" Foreground="#a1a1aa" />

</ui:SimpleStackPanel>
</GroupBox>
Expand Down Expand Up @@ -5296,7 +5306,7 @@
IsOn="{Binding ElementName=ToggleSwitchEnableInkToShape, Path=IsOn}" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal"
Width="100">
Width="100" x:Name="InkFadeControlPanel1">
<Label Margin="0,0,10,0" Content="墨迹渐隐"
Foreground="{DynamicResource FloatBarForeground}"
FontSize="12"
Expand Down Expand Up @@ -8320,7 +8330,7 @@
IsOn="{Binding ElementName=ToggleSwitchEnableInkToShape, Path=IsOn}" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal"
Width="100">
Width="100" x:Name="InkFadeControlPanel2">
<Label Margin="0,0,10,0" Content="墨迹渐隐"
Foreground="{DynamicResource FloatBarForeground}"
FontSize="12" VerticalAlignment="Center" />
Expand Down
51 changes: 51 additions & 0 deletions Ink Canvas/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2692,6 +2692,57 @@ private void ToggleSwitchInkFadeInPanel_Toggled(object sender, RoutedEventArgs e
}
}

/// <summary>
/// 在笔工具菜单中隐藏墨迹渐隐控制开关切换事件处理
/// </summary>
private void ToggleSwitchHideInkFadeControlInPenMenu_Toggled(object sender, RoutedEventArgs e)
{
try
{
if (isLoaded)
{
Settings.Canvas.HideInkFadeControlInPenMenu = ToggleSwitchHideInkFadeControlInPenMenu.IsOn;
SaveSettingsToFile();
}

// 立即更新墨迹渐隐控制开关的可见性
UpdateInkFadeControlVisibility();

LogHelper.WriteLogToFile($"在笔工具菜单中隐藏墨迹渐隐控制开关已{(Settings.Canvas.HideInkFadeControlInPenMenu ? "启用" : "禁用")}", LogHelper.LogType.Event);
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"切换在笔工具菜单中隐藏墨迹渐隐控制开关时出错: {ex.Message}", LogHelper.LogType.Error);
}
}

/// <summary>
/// 更新墨迹渐隐控制开关的可见性
/// </summary>
private void UpdateInkFadeControlVisibility()
{
try
{
bool isHidden = Settings.Canvas.HideInkFadeControlInPenMenu;

// 控制 InkFadeControlPanel1(批注子面板中)的可见性
if (InkFadeControlPanel1 != null)
{
InkFadeControlPanel1.Visibility = isHidden ? Visibility.Collapsed : Visibility.Visible;
}

// 控制 InkFadeControlPanel2(普通画笔面板中)的可见性
if (InkFadeControlPanel2 != null)
{
InkFadeControlPanel2.Visibility = isHidden ? Visibility.Collapsed : Visibility.Visible;
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"更新墨迹渐隐控制面板可见性时出错: {ex.Message}", LogHelper.LogType.Error);
}
}

/// <summary>
/// PPT放映模式显示手势按钮开关切换事件处理
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,15 @@ private void LoadInkFadeSettings()
_inkFadeManager.UpdateFadeTime(Settings.Canvas.InkFadeTime);
}

// 同步在笔工具菜单中隐藏墨迹渐隐控制开关的设置
if (ToggleSwitchHideInkFadeControlInPenMenu != null)
{
ToggleSwitchHideInkFadeControlInPenMenu.IsOn = Settings.Canvas.HideInkFadeControlInPenMenu;
}

// 根据设置更新墨迹渐隐控制开关的可见性
UpdateInkFadeControlVisibility();

LogHelper.WriteLogToFile("墨迹渐隐设置已加载", LogHelper.LogType.Event);
}
catch (Exception ex)
Expand Down
2 changes: 2 additions & 0 deletions Ink Canvas/Resources/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public class Canvas
public bool EnableInkFade { get; set; } = false;
[JsonProperty("inkFadeTime")]
public int InkFadeTime { get; set; } = 3000; // 墨迹渐隐时间(毫秒)
[JsonProperty("hideInkFadeControlInPenMenu")]
public bool HideInkFadeControlInPenMenu { get; set; } = false; // 是否在笔工具菜单中隐藏墨迹渐隐控制开关

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,20 @@
<TextBlock x:Name="InkFadeTimeText" Text="3000ms" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在笔工具菜单中隐藏墨迹渐隐控制" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,主工具栏上点击笔工具后弹出的上下文菜单中将不显示墨迹渐隐控制开关" HorizontalAlignment="Left"/>
</StackPanel>
<Border x:Name="ToggleSwitchHideInkFadeControlInPenMenu" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="HideInkFadeControlInPenMenu" MouseLeftButtonDown="ToggleSwitch_Click">
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
</Border.Effect>
</Border>
</Border>
</Grid>
</StackPanel>
</Border>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
}
break;

case "HideInkFadeControlInPenMenu":
// 调用 MainWindow 中的方法
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchHideInkFadeControlInPenMenu", newState);
break;

case "EnableAutoSaveStrokes":
// 调用 MainWindow 中的方法
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableAutoSaveStrokes", newState);
Expand Down