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
17 changes: 4 additions & 13 deletions Ink Canvas/Helpers/PPTUIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,14 @@ public void UpdateConnectionStatus(bool isConnected)
/// </summary>
public void UpdateSlideShowStatus(bool isInSlideShow, int currentSlide = 0, int totalSlides = 0)
{
void UpdateSlideShowStatusOnUi()
_dispatcher.InvokeAsync(() =>
{
try
{
_mainWindow.IsInPptPresentationMode = isInSlideShow;

if (isInSlideShow)
{
// Old UI removed: _mainWindow.BtnPPTSlideShow.Visibility = Visibility.Collapsed;
_mainWindow.IsInPptPresentationMode = true;
_mainWindow.UpdateToolbarComponentVisibility();

// 同步页码到所有翻页条 + 兼容旧绑定的隐藏 placeholder
Expand Down Expand Up @@ -116,6 +115,7 @@ void UpdateSlideShowStatusOnUi()
else
{
// Old UI removed: _mainWindow.BtnPPTSlideShow.Visibility = Visibility.Visible;
_mainWindow.IsInPptPresentationMode = false;
_mainWindow.UpdateToolbarComponentVisibility();
HideAllNavigationPanels();
_mainWindow.UpdatePPTTimeCapsuleVisibility();
Expand All @@ -142,16 +142,7 @@ void UpdateSlideShowStatusOnUi()
{
LogHelper.WriteLogToFile($"更新幻灯片放映状态UI失败: {ex}", LogHelper.LogType.Error);
}
}

if (_dispatcher.CheckAccess())
{
UpdateSlideShowStatusOnUi();
}
else
{
_dispatcher.Invoke(UpdateSlideShowStatusOnUi);
}
});
}

/// <summary>
Expand Down
20 changes: 6 additions & 14 deletions Ink Canvas/Helpers/ROTPPTManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,6 @@ public object GetCurrentActivePresentation()
object slide = null;
object activeWindow = null;
object presentation = null;
object returnedPresentation = null;
try
{
if (!IsConnected || PPTApplication == null) return null;
Expand Down Expand Up @@ -1746,8 +1745,7 @@ public object GetCurrentActivePresentation()
{
dynamic slideObj = slide;
presentation = slideObj.Parent;
returnedPresentation = presentation;
return returnedPresentation;
return presentation;
}
}
}
Expand All @@ -1762,13 +1760,11 @@ public object GetCurrentActivePresentation()
presentation = aw.Presentation;
if (presentation != null)
{
returnedPresentation = presentation;
return returnedPresentation;
return presentation;
}
}

returnedPresentation = CurrentPresentation;
return returnedPresentation;
return CurrentPresentation;
}
catch (COMException comEx)
{
Expand All @@ -1782,20 +1778,16 @@ public object GetCurrentActivePresentation()
return null;
}
LogHelper.WriteLogToFile($"获取当前活跃演示文稿失败: {comEx.Message}", LogHelper.LogType.Warning);
returnedPresentation = CurrentPresentation;
return returnedPresentation;
return CurrentPresentation;
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"获取当前活跃演示文稿失败: {ex}", LogHelper.LogType.Error);
returnedPresentation = CurrentPresentation;
return returnedPresentation;
return CurrentPresentation;
}
finally
{
if (presentation != null &&
!ReferenceEquals(presentation, CurrentPresentation) &&
!ReferenceEquals(presentation, returnedPresentation))
if (presentation != null && !ReferenceEquals(presentation, CurrentPresentation))
{
SafeReleaseComObject(presentation);
}
Expand Down
18 changes: 6 additions & 12 deletions Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3290,10 +3290,7 @@ private void RebuildCanvasOnTargetScreen(Screen targetScreen)
/// </summary>
/// <param name="sender">发送者</param>
/// <param name="e">路由事件参数</param>
internal void CursorIcon_Click(object sender, MouseButtonEventArgs e)
=> CursorIcon_Click(sender, e, false);

private async void CursorIcon_Click(object sender, MouseButtonEventArgs e, bool suppressFloatingBarMove)
internal async void CursorIcon_Click(object sender, MouseButtonEventArgs e)
{
if (lastBorderMouseDownObject is Panel panel)
panel.Background = new SolidColorBrush(Colors.Transparent);
Expand Down Expand Up @@ -3386,16 +3383,13 @@ private async void CursorIcon_Click(object sender, MouseButtonEventArgs e, bool

if (!isFloatingBarFolded)
{
HideSubPanels("cursor", !suppressFloatingBarMove);
HideSubPanels("cursor", true);
await Task.Delay(50);

if (!suppressFloatingBarMove)
{
if (IsInPptPresentationMode)
ViewboxFloatingBarMarginAnimation(60);
else
ViewboxFloatingBarMarginAnimation(100, true);
}
if (IsInPptPresentationMode)
ViewboxFloatingBarMarginAnimation(60);
else
ViewboxFloatingBarMarginAnimation(100, true);
}
}

Expand Down
45 changes: 14 additions & 31 deletions Ink Canvas/MainWindow_cs/MW_PPT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,12 @@ await Application.Current.Dispatcher.InvokeAsync(() =>
// 注意:快捷调色盘的可见性现在完全由工具栏规则集管理
// 不需要手动设置,UpdateToolbarComponentVisibility 会处理好

EnsureCursorModeAfterPptExit();
if (GridTransparencyFakeBackground.Background != Brushes.Transparent)
BtnHideInkCanvas_Click(null, null);
SetCurrentToolMode(InkCanvasEditingMode.None);

UpdateCurrentToolMode("cursor");
SetFloatingBarHighlightPosition("cursor");

CheckMainWindowVisibility();
}
Expand Down Expand Up @@ -2375,7 +2380,7 @@ private async Task OnPptNavBarPageClickAsync(Controls.PptNavBar bar)
GridTransparencyFakeBackground.Opacity = 1;
GridTransparencyFakeBackground.Background = new SolidColorBrush(StringToColor("#01FFFFFF"));
SetTransparentNotHitThrough();
CursorIcon_Click(null, null, true);
CursorIcon_Click(null, null);

if (Settings.PowerPointSettings.EnablePPTButtonEnhancedPreview && bar != null)
{
Expand Down Expand Up @@ -2431,6 +2436,11 @@ private async Task OnPptNavBarPageClickAsync(Controls.PptNavBar bar)
}
}

if (!isFloatingBarFolded)
{
await Task.Delay(100);
ViewboxFloatingBarMarginAnimation(60);
}
}
catch (OperationCanceledException)
{
Expand Down Expand Up @@ -2986,7 +2996,8 @@ await Application.Current.Dispatcher.InvokeAsync(() =>
await HandleManualSlideShowEnd();
}

await Application.Current.Dispatcher.InvokeAsync(EnsureCursorModeAfterPptExit);
HideSubPanels("cursor");
SetCurrentToolMode(InkCanvasEditingMode.None);

await Task.Delay(150);
if (!isFloatingBarFolded)
Expand All @@ -3012,7 +3023,6 @@ await Application.Current.Dispatcher.InvokeAsync(() =>
_pptUIManager?.UpdateSlideShowStatus(false);
_pptUIManager?.UpdateSidebarExitButtons(false);
HideFloatingBarExitPPTBtn();
EnsureCursorModeAfterPptExit();
CheckMainWindowVisibility();
});

Expand Down Expand Up @@ -3055,33 +3065,6 @@ private async Task HandleManualSlideShowEnd()
}
}

private void EnsureCursorModeAfterPptExit()
{
try
{
GridTransparencyFakeBackground.Opacity = 0;
GridTransparencyFakeBackground.Background = Brushes.Transparent;
SetTransparentHitThrough();

GridBackgroundCoverHolder.Visibility = Visibility.Collapsed;
inkCanvas.IsHitTestVisible = false;
inkCanvas.Visibility = Visibility.Visible;
inkCanvas.Select(new StrokeCollection());
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;

RestoreFullScreenOnExitAnnotationMode();
SetCurrentToolMode(InkCanvasEditingMode.None);
UpdateCurrentToolMode("cursor");
UpdateToolbarComponentVisibility();
HideSubPanels("cursor");
SetFloatingBarHighlightPosition("cursor");
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"同步PPT退出后的鼠标模式失败: {ex}", LogHelper.LogType.Error);
}
}

/// <summary>
/// 处理PPT上一页控制按钮的鼠标按下事件
/// </summary>
Expand Down
Loading