diff --git a/.all-contributorsrc b/.all-contributorsrc index e21644e4..ab6ac8dd 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -89,6 +89,15 @@ "contributions": [ "design" ] + }, + { + "login": "Tayasui-rainnya", + "name": "tayasui rainnya!", + "avatar_url": "https://avatars.githubusercontent.com/u/156585442?v=4", + "profile": "https://github.com/Tayasui-rainnya", + "contributions": [ + "design" + ] } ] } diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml new file mode 100644 index 00000000..d9263ea7 --- /dev/null +++ b/.github/workflows/prerelease.yml @@ -0,0 +1,298 @@ +name: Pre-release and Changelog + +on: + workflow_dispatch: + inputs: + version_type: + description: 'Version bump type' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + - major + prerelease: + description: 'Create as pre-release' + required: true + default: true + type: boolean + +jobs: + prerelease: + if: github.ref == 'refs/heads/main' + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # 获取所有历史记录用于生成changelog + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Setup MSbuild + uses: microsoft/setup-msbuild@v2 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v2.0.1 + + - name: Restore NuGet Packages + run: nuget restore "Ink Canvas.sln" + + - name: Get current version + id: get_version + run: | + $version = (Get-Content "Ink Canvas\Properties\AssemblyInfo.cs" | Select-String "AssemblyVersion\(""([^""]+)""\)").Matches[0].Groups[1].Value + echo "current_version=$version" >> $env:GITHUB_OUTPUT + echo "Current version: $version" + + - name: Calculate new version + id: calc_version + run: | + $currentVersion = "${{ steps.get_version.outputs.current_version }}" + $versionParts = $currentVersion.Split('.') + $major = [int]$versionParts[0] + $minor = [int]$versionParts[1] + $patch = [int]$versionParts[2] + + $versionType = "${{ github.event.inputs.version_type }}" + + switch ($versionType) { + "major" { + $major++ + $minor = 0 + $patch = 0 + } + "minor" { + $minor++ + $patch = 0 + } + "patch" { + $patch++ + } + } + + $newVersion = "$major.$minor.$patch.0" + echo "new_version=$newVersion" >> $env:GITHUB_OUTPUT + echo "New version: $newVersion" + + - name: Generate Changelog + id: changelog + run: | + # 获取上次tag到现在的所有commit + $lastTag = git describe --tags --abbrev=0 2>$null + if ($lastTag) { + $commits = git log --pretty=format:"%h|%s|%an|%ad" --date=short "$lastTag..HEAD" + } else { + $commits = git log --pretty=format:"%h|%s|%an|%ad" --date=short + } + + # 初始化分类数组 + $fixes = @() + $improvements = @() + $additions = @() + $deletions = @() + $versionChanges = @() + $others = @() + + # 解析每个commit + foreach ($commit in $commits) { + if ($commit -match "^([^|]+)\|([^|]+)\|([^|]+)\|([^|]+)$") { + $hash = $matches[1] + $message = $matches[2] + $author = $matches[3] + $date = $matches[4] + + $commitInfo = @{ + Hash = $hash + Message = $message + Author = $author + Date = $date + } + + # 根据commit消息分类 + if ($message -match "^(fix|修复)") { + $fixes += $commitInfo + } elseif ($message -match "^(improve|改进|优化)") { + $improvements += $commitInfo + } elseif ($message -match "^(add|新增|添加)") { + $additions += $commitInfo + } elseif ($message -match "^(delete|删除|移除)") { + $deletions += $commitInfo + } elseif ($message -match "(版本|version|更新版本号)") { + $versionChanges += $commitInfo + } else { + $others += $commitInfo + } + } + } + + # 生成changelog内容 + $version = "${{ steps.calc_version.outputs.new_version }}" + $changelog = "# ICC CE $version 更新日志`n`n## 修复 (Fixes)" + + if ($fixes.Count -gt 0) { + foreach ($fix in $fixes) { + $changelog += "`n- $($fix.Message) ($($fix.Author), $($fix.Date))" + } + } else { + $changelog += "`n- 无" + } + + $changelog += "`n`n## 改进 (Improvements)" + + if ($improvements.Count -gt 0) { + foreach ($improvement in $improvements) { + $changelog += "`n- $($improvement.Message) ($($improvement.Author), $($improvement.Date))" + } + } else { + $changelog += "`n- 无" + } + + $changelog += "`n`n## 新增功能 (New Features)" + + if ($additions.Count -gt 0) { + foreach ($addition in $additions) { + $changelog += "`n- $($addition.Message) ($($addition.Author), $($addition.Date))" + } + } else { + $changelog += "`n- 无" + } + + $changelog += "`n`n## 删除功能 (Removed Features)" + + if ($deletions.Count -gt 0) { + foreach ($deletion in $deletions) { + $changelog += "`n- $($deletion.Message) ($($deletion.Author), $($deletion.Date))" + } + } else { + $changelog += "`n- 无" + } + + $changelog += "`n`n## 版本更新 (Version Updates)" + + if ($versionChanges.Count -gt 0) { + foreach ($versionChange in $versionChanges) { + $changelog += "`n- $($versionChange.Message) ($($versionChange.Author), $($versionChange.Date))" + } + } else { + $changelog += "`n- 无" + } + + $changelog += "`n`n## 其他更改 (Other Changes)" + + if ($others.Count -gt 0) { + foreach ($other in $others) { + $changelog += "`n- $($other.Message) ($($other.Author), $($other.Date))" + } + } else { + $changelog += "`n- 无" + } + + $changelog += "`n`n---`n*此更新日志由GitHub Actions自动生成*" + + # 保存changelog到文件 + $changelog | Out-File -FilePath "CHANGELOG_${{ steps.calc_version.outputs.new_version }}.md" -Encoding UTF8 + + # 输出changelog内容到步骤输出 + echo "changelog<> $env:GITHUB_OUTPUT + echo $changelog >> $env:GITHUB_OUTPUT + echo "EOF" >> $env:GITHUB_OUTPUT + + echo "Changelog generated successfully" + + - name: Display version info + run: | + echo "Current version: ${{ steps.get_version.outputs.current_version }}" + echo "New version: ${{ steps.calc_version.outputs.new_version }}" + echo "Note: Version will not be automatically updated in repository files" + + - name: Build the Solution + run: | + msbuild -t:restore /p:GitFlow="Github Action" + msbuild /p:platform="AnyCPU" /p:configuration="Release" /p:GitFlow="Github Action" "Ink Canvas/InkCanvasForClass.csproj" + + - name: Create Release Archive + run: | + $version = "${{ steps.calc_version.outputs.new_version }}" + $archiveName = "ICC_CE_$version.zip" + + # 创建发布目录 + New-Item -ItemType Directory -Path "release" -Force + + # 复制发布文件 + Copy-Item "Ink Canvas\bin\Release\net472\*" "release\" -Recurse -Force + + # 创建压缩包 + Compress-Archive -Path "release\*" -DestinationPath $archiveName -Force + + echo "archive_name=$archiveName" >> $env:GITHUB_OUTPUT + + - name: Upload Release Assets + uses: actions/upload-artifact@v4 + with: + name: release-files-${{ steps.calc_version.outputs.new_version }} + path: | + ICC_CE_${{ steps.calc_version.outputs.new_version }}.zip + CHANGELOG_${{ steps.calc_version.outputs.new_version }}.md + + - name: Create Git Tag + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + $version = "${{ steps.calc_version.outputs.new_version }}" + git tag -a "v$version" -m "Release version $version" + git push origin "v$version" + + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.calc_version.outputs.new_version }} + release_name: ICC CE v${{ steps.calc_version.outputs.new_version }} + body: | + ${{ steps.changelog.outputs.changelog }} + draft: false + prerelease: ${{ github.event.inputs.prerelease }} + id: create_release + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./ICC_CE_${{ steps.calc_version.outputs.new_version }}.zip + asset_name: ICC_CE_${{ steps.calc_version.outputs.new_version }}.zip + asset_content_type: application/zip + + - name: Generate UpdateLog preview + run: | + $version = "${{ steps.calc_version.outputs.new_version }}" + $changelogFile = "CHANGELOG_$version.md" + + # 读取生成的changelog + $changelogContent = Get-Content $changelogFile -Raw + + # 生成预览内容 + $previewContent = "ICC CE $version 更新日志`n" + $changelogContent + + echo "UpdateLog preview generated (not written to file):" + echo $previewContent + + - name: Display Summary + run: | + echo "=== Release Summary ===" + echo "Version: ${{ steps.calc_version.outputs.new_version }}" + echo "Pre-release: ${{ github.event.inputs.prerelease }}" + echo "Changelog: Generated and attached to release" + echo "Archive: ICC_CE_${{ steps.calc_version.outputs.new_version }}.zip" + echo "" + echo "Note: No repository files were modified" + echo "You can manually update version numbers and changelog as needed" diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs index 396a012e..f524565a 100644 --- a/Ink Canvas/App.xaml.cs +++ b/Ink Canvas/App.xaml.cs @@ -912,12 +912,20 @@ namespace Ink_Canvas { if (_isSplashScreenShown) { - SetSplashMessage("启动完成!"); - SetSplashProgress(100); - // 延迟关闭启动画面,让用户看到完成消息 - Task.Delay(500).ContinueWith(_ => + SetSplashMessage("完成初始化..."); + SetSplashProgress(80); + Task.Delay(300).ContinueWith(_ => { - Dispatcher.Invoke(() => CloseSplashScreen()); + Dispatcher.Invoke(() => + { + SetSplashMessage("启动完成!"); + SetSplashProgress(100); + // 延迟关闭启动画面,让用户看到完成消息 + Task.Delay(500).ContinueWith(__ => + { + Dispatcher.Invoke(() => CloseSplashScreen()); + }); + }); }); } }; diff --git a/Ink Canvas/Helpers/AutoUpdateHelper.cs b/Ink Canvas/Helpers/AutoUpdateHelper.cs index 8db4fb88..32fb1a5a 100644 --- a/Ink Canvas/Helpers/AutoUpdateHelper.cs +++ b/Ink Canvas/Helpers/AutoUpdateHelper.cs @@ -213,20 +213,20 @@ namespace Ink_Canvas.Helpers .Select(x => x.group) .ToList(); - // 将"智教联盟"线路组插入到最前面(如果存在) - var zhiJiaoGroup = groups.FirstOrDefault(g => g.GroupName == "智教联盟"); - if (zhiJiaoGroup != null) - { - orderedGroups.Insert(0, zhiJiaoGroup); - LogHelper.WriteLogToFile("AutoUpdate | 智教联盟线路组已插入到首位"); - } - - // 将"inkeys"线路组插入到第二位(如果存在) + // 将"inkeys"线路组插入到最前面(如果存在) var inkeysGroup = groups.FirstOrDefault(g => g.GroupName == "inkeys"); if (inkeysGroup != null) { - orderedGroups.Insert(1, inkeysGroup); - LogHelper.WriteLogToFile("AutoUpdate | inkeys线路组已插入到第二位"); + orderedGroups.Insert(0, inkeysGroup); + LogHelper.WriteLogToFile("AutoUpdate | inkeys线路组已插入到首位"); + } + + // 将"智教联盟"线路组插入到第二位(如果存在) + var zhiJiaoGroup = groups.FirstOrDefault(g => g.GroupName == "智教联盟"); + if (zhiJiaoGroup != null) + { + orderedGroups.Insert(1, zhiJiaoGroup); + LogHelper.WriteLogToFile("AutoUpdate | 智教联盟线路组已插入到第二位"); } if (orderedGroups.Count > 0) @@ -671,22 +671,22 @@ namespace Ink_Canvas.Helpers SaveDownloadStatus(false); - // 优先尝试“智教联盟”线路组 + // 优先尝试"inkeys"线路组和"智教联盟"线路组 var zhiJiaoGroup = groups.FirstOrDefault(g => g.GroupName == "智教联盟"); var inkeysGroup = groups.FirstOrDefault(g => g.GroupName == "inkeys"); - if (zhiJiaoGroup != null || inkeysGroup != null) + if (inkeysGroup != null || zhiJiaoGroup != null) { var priorityGroups = new List(); - if (zhiJiaoGroup != null) - { - priorityGroups.Add(zhiJiaoGroup); - LogHelper.WriteLogToFile("AutoUpdate | 下载时优先尝试智教联盟线路组"); - } if (inkeysGroup != null) { priorityGroups.Add(inkeysGroup); LogHelper.WriteLogToFile("AutoUpdate | 下载时优先尝试inkeys线路组"); } + if (zhiJiaoGroup != null) + { + priorityGroups.Add(zhiJiaoGroup); + LogHelper.WriteLogToFile("AutoUpdate | 下载时优先尝试智教联盟线路组"); + } groups = priorityGroups.Concat(groups.Where(g => g.GroupName != "智教联盟" && g.GroupName != "inkeys")).ToList(); } diff --git a/Ink Canvas/Helpers/PPTUIManager.cs b/Ink Canvas/Helpers/PPTUIManager.cs index c8482a4e..dc5c2b86 100644 --- a/Ink Canvas/Helpers/PPTUIManager.cs +++ b/Ink Canvas/Helpers/PPTUIManager.cs @@ -1,6 +1,7 @@ using System; using System.Windows; using System.Windows.Controls; +using System.Windows.Interop; using System.Windows.Media; using System.Windows.Threading; @@ -96,12 +97,37 @@ namespace Ink_Canvas.Helpers UpdateNavigationPanelsVisibility(); UpdateNavigationButtonStyles(); + if (MainWindow.Settings.Advanced.IsEnableAvoidFullScreenHelper) + { + // 设置为画板模式,允许全屏操作 + AvoidFullScreenHelper.SetBoardMode(true); + _dispatcher.BeginInvoke(new Action(() => + { + MainWindow.MoveWindow(new WindowInteropHelper(_mainWindow).Handle, 0, 0, + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true); + }), DispatcherPriority.ApplicationIdle); + } } else { _mainWindow.BtnPPTSlideShow.Visibility = Visibility.Visible; _mainWindow.BtnPPTSlideShowEnd.Visibility = Visibility.Collapsed; HideAllNavigationPanels(); + if (MainWindow.Settings.Advanced.IsEnableAvoidFullScreenHelper) + { + // 恢复为非画板模式,重新启用全屏限制 + AvoidFullScreenHelper.SetBoardMode(false); + + _dispatcher.BeginInvoke(new Action(() => + { + // 退出PPT放映模式,恢复到工作区域大小 + var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; + MainWindow.MoveWindow(new WindowInteropHelper(_mainWindow).Handle, + workingArea.X, workingArea.Y, + workingArea.Width, workingArea.Height, true); + }), DispatcherPriority.ApplicationIdle); + } } } catch (Exception ex) diff --git a/Ink Canvas/InkCanvasForClass.csproj b/Ink Canvas/InkCanvasForClass.csproj index c2576703..6c8c692b 100644 --- a/Ink Canvas/InkCanvasForClass.csproj +++ b/Ink Canvas/InkCanvasForClass.csproj @@ -223,6 +223,8 @@ + + @@ -528,6 +530,8 @@ + + @@ -564,6 +568,9 @@ + + + diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index 1669a49e..6c089f0f 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -1072,6 +1072,8 @@ SelectionChanged="ComboBoxFloatingBarImg_SelectionChanged"> + + @@ -1464,35 +1466,35 @@ FontSize="20" /> - - - + + + - + - + - + @@ -9428,7 +9430,7 @@ - + diff --git a/Ink Canvas/MainWindow_cs/MW_AutoFold.cs b/Ink Canvas/MainWindow_cs/MW_AutoFold.cs index 6c4187c3..b7e0c003 100644 --- a/Ink Canvas/MainWindow_cs/MW_AutoFold.cs +++ b/Ink Canvas/MainWindow_cs/MW_AutoFold.cs @@ -103,7 +103,6 @@ namespace Ink_Canvas HideSubPanels("cursor"); SidePannelMarginAnimation(-10); }); - isFloatingBarChangingHideMode = false; } private async void LeftUnFoldButtonDisplayQuickPanel_MouseUp(object sender, MouseButtonEventArgs e) @@ -325,7 +324,6 @@ namespace Ink_Canvas } }); - isFloatingBarChangingHideMode = false; } private async void SidePannelMarginAnimation(int MarginFromEdge, bool isNoAnimation = false) // Possible value: -50, -10 diff --git a/Ink Canvas/MainWindow_cs/MW_BoardIcons.cs b/Ink Canvas/MainWindow_cs/MW_BoardIcons.cs index 329c8733..37baf9a8 100644 --- a/Ink Canvas/MainWindow_cs/MW_BoardIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_BoardIcons.cs @@ -61,7 +61,7 @@ namespace Ink_Canvas ICCWaterMarkWhite.Visibility = Visibility.Collapsed; // 设置为白板默认背景色 - Color defaultWhiteboardColor = Color.FromRgb(234, 235, 237); + Color defaultWhiteboardColor = Color.FromRgb(255, 255, 255); if (currentMode == 1) // 白板模式 { @@ -233,7 +233,7 @@ namespace Ink_Canvas ICCWaterMarkWhite.Visibility = Visibility.Collapsed; // 设置为白板默认背景色 - Color defaultWhiteboardColor = Color.FromRgb(234, 235, 237); + Color defaultWhiteboardColor = Color.FromRgb(255, 255, 255); if (currentMode == 1) // 白板模式 { diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs index 5fe56780..f2d40ab7 100644 --- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs @@ -1587,7 +1587,6 @@ namespace Ink_Canvas if (toolbarHeight == 0) { pos.Y = screenHeight - MarginFromEdge * ViewboxFloatingBarScaleTransform.ScaleY; - LogHelper.WriteLogToFile($"任务栏隐藏,使用固定边距: {MarginFromEdge}"); } else { @@ -1601,7 +1600,6 @@ namespace Ink_Canvas { pos.Y = screenHeight - ViewboxFloatingBar.ActualHeight * ViewboxFloatingBarScaleTransform.ScaleY - 3 * ViewboxFloatingBarScaleTransform.ScaleY; - LogHelper.WriteLogToFile($"任务栏隐藏,使用固定高度: {ViewboxFloatingBar.ActualHeight}"); } else { @@ -3003,10 +3001,18 @@ namespace Ink_Canvas // 新增:在屏幕模式下恢复基础浮动栏的显示 ViewboxFloatingBar.Visibility = Visibility.Visible; - // 新增:退出白板时自动收纳功能 + // 新增:退出白板时自动收纳功能 - 等待浮动栏完全展开后再收纳 if (Settings.Automation.IsAutoFoldWhenExitWhiteboard && !isFloatingBarFolded) { - FoldFloatingBar_MouseUp(null, null); + // 使用异步延迟,等待浮动栏展开动画完成后再收纳 + Task.Run(async () => + { + await Task.Delay(700); + await Dispatcher.InvokeAsync(() => + { + FoldFloatingBar_MouseUp(new object(), null); + }); + }); } if (BtnSwitchTheme.Content.ToString() == "浅色") diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs index dd5391e5..72b8ae29 100644 --- a/Ink Canvas/MainWindow_cs/MW_Settings.cs +++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs @@ -356,43 +356,55 @@ namespace Ink_Canvas else if (index == 2) { FloatingbarHeadIconImg.Source = - new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuandoujiyanhuaji.png")); - FloatingbarHeadIconImg.Margin = new Thickness(2, 2, 2, 1.5); + new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/icc-noshadow.png")); + FloatingbarHeadIconImg.Margin = new Thickness(0.5); } else if (index == 3) { FloatingbarHeadIconImg.Source = - new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuanshounvhuaji.png")); - FloatingbarHeadIconImg.Margin = new Thickness(2, 2, 2, 1.5); + new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/icc-dark.png")); + FloatingbarHeadIconImg.Margin = new Thickness(0.5); } else if (index == 4) { FloatingbarHeadIconImg.Source = - new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuanciya.png")); + new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuandoujiyanhuaji.png")); FloatingbarHeadIconImg.Margin = new Thickness(2, 2, 2, 1.5); } else if (index == 5) { FloatingbarHeadIconImg.Source = - new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuanneikuhuaji.png")); + new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuanshounvhuaji.png")); FloatingbarHeadIconImg.Margin = new Thickness(2, 2, 2, 1.5); } else if (index == 6) { FloatingbarHeadIconImg.Source = - new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuandogeyuanliangwo.png")); + new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuanciya.png")); FloatingbarHeadIconImg.Margin = new Thickness(2, 2, 2, 1.5); } else if (index == 7) + { + FloatingbarHeadIconImg.Source = + new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuanneikuhuaji.png")); + FloatingbarHeadIconImg.Margin = new Thickness(2, 2, 2, 1.5); + } + else if (index == 8) + { + FloatingbarHeadIconImg.Source = + new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/kuandogeyuanliangwo.png")); + FloatingbarHeadIconImg.Margin = new Thickness(2, 2, 2, 1.5); + } + else if (index == 9) { FloatingbarHeadIconImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/tiebahuaji.png")); FloatingbarHeadIconImg.Margin = new Thickness(2, 2, 2, 1); } - else if (index >= 8 && index - 8 < Settings.Appearance.CustomFloatingBarImgs.Count) + else if (index >= 10 && index - 10 < Settings.Appearance.CustomFloatingBarImgs.Count) { // 使用自定义图标 - var customIcon = Settings.Appearance.CustomFloatingBarImgs[index - 8]; + var customIcon = Settings.Appearance.CustomFloatingBarImgs[index - 10]; try { FloatingbarHeadIconImg.Source = new BitmapImage(new Uri(customIcon.FilePath)); @@ -409,8 +421,8 @@ namespace Ink_Canvas public void UpdateCustomIconsInComboBox() { - // 保留前8个内置图标选项 - while (ComboBoxFloatingBarImg.Items.Count > 8) + // 保留前10个内置图标选项 + while (ComboBoxFloatingBarImg.Items.Count > 10) { ComboBoxFloatingBarImg.Items.RemoveAt(ComboBoxFloatingBarImg.Items.Count - 1); } @@ -1014,23 +1026,73 @@ namespace Ink_Canvas PPTBtnPreviewRS.Visibility = Visibility.Collapsed; } - // 计算预览区域的缩放比例 - double previewScaleY = 182.0 / SystemParameters.PrimaryScreenHeight; - double previewScaleX = 324.0 / SystemParameters.PrimaryScreenWidth; + // 获取当前屏幕的实际尺寸(考虑DPI缩放) + var actualScreenWidth = SystemParameters.PrimaryScreenWidth; + var actualScreenHeight = SystemParameters.PrimaryScreenHeight; - double sideButtonScaleFactor = 1.9; + // 预览区域固定尺寸 + const double previewWidth = 324.0; + const double previewHeight = 182.0; + // 计算缩放比例(预览区域与实际屏幕的比例) + double scaleX = previewWidth / actualScreenWidth; + double scaleY = previewHeight / actualScreenHeight; + + // 获取按钮位置设置 double rsPosition = Settings.PowerPointSettings.PPTRSButtonPosition; double lsPosition = Settings.PowerPointSettings.PPTLSButtonPosition; - - PPTBtnPreviewRSTransform.Y = -(rsPosition * 2 * previewScaleY / sideButtonScaleFactor); - PPTBtnPreviewLSTransform.Y = -(lsPosition * 2 * previewScaleY / sideButtonScaleFactor); - - - double bottomButtonScaleFactor = 1.2; - double leftMarginOffset = 6 * previewScaleX; - PPTBtnPreviewLBTransform.X = leftMarginOffset + (Settings.PowerPointSettings.PPTLBButtonPosition * previewScaleX / bottomButtonScaleFactor); - PPTBtnPreviewRBTransform.X = -(leftMarginOffset + (Settings.PowerPointSettings.PPTRBButtonPosition * previewScaleX / bottomButtonScaleFactor)); + double lbPosition = Settings.PowerPointSettings.PPTLBButtonPosition; + double rbPosition = Settings.PowerPointSettings.PPTRBButtonPosition; + + bool showSidePageButton = sopt.Length >= 1 && sopt[0] == '2'; + bool showBottomPageButton = bopt.Length >= 1 && bopt[0] == '2'; + + // 页码按钮的实际尺寸 + const double pageButtonWidth = 50.0; + const double pageButtonHeight = 50.0; + + // 计算侧边按钮位置(Y轴偏移) + double sideOffsetY = showSidePageButton ? pageButtonHeight * scaleY : 0; + PPTBtnPreviewRSTransform.Y = -(rsPosition * scaleY) - sideOffsetY; + PPTBtnPreviewLSTransform.Y = -(lsPosition * scaleY) - sideOffsetY; + + // 计算底部按钮位置(X轴偏移) + const double bottomMarginOffset = 6.0; + double scaledMarginOffset = bottomMarginOffset * scaleX; + + double bottomOffsetX = showBottomPageButton ? pageButtonWidth * scaleX : 0; + PPTBtnPreviewLBTransform.X = scaledMarginOffset + (lbPosition * scaleX) + bottomOffsetX; + PPTBtnPreviewRBTransform.X = -(scaledMarginOffset + (rbPosition * scaleX) + bottomOffsetX); + + // 计算工具栏尺寸 + var dpiScaleX = 1.0; + var dpiScaleY = 1.0; + try + { + var source = PresentationSource.FromVisual(this); + if (source?.CompositionTarget != null) + { + var transform = source.CompositionTarget.TransformToDevice; + dpiScaleX = transform.M11; + dpiScaleY = transform.M22; + } + } + catch + { + dpiScaleX = 1.0; + dpiScaleY = 1.0; + } + + // 计算工具栏的实际尺寸 + const double baseToolbarHeight = 24.0; + + double actualToolbarHeight = baseToolbarHeight * dpiScaleY; + double scaledToolbarHeight = actualToolbarHeight * scaleY; + double scaledToolbarWidth = previewWidth; + + // 设置工具栏尺寸 + PPTBtnPreviewToolbar.Height = scaledToolbarHeight; + PPTBtnPreviewToolbar.Width = scaledToolbarWidth; } private void ToggleSwitchShowCursor_Toggled(object sender, RoutedEventArgs e) @@ -1064,6 +1126,7 @@ namespace Ink_Canvas if (!isLoaded) return; Settings.Canvas.DisablePressure = ToggleSwitchDisablePressure.IsOn; + inkCanvas.DefaultDrawingAttributes.IgnorePressure = Settings.Canvas.DisablePressure; // 如果启用了屏蔽压感,则自动关闭压感触屏模式 if (Settings.Canvas.DisablePressure && Settings.Canvas.EnablePressureTouchMode) diff --git a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs index 0653fd3a..7234e5eb 100644 --- a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs +++ b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs @@ -10,6 +10,8 @@ using System.Windows.Ink; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Imaging; +using System.Windows.Threading; +using WinForms = System.Windows.Forms; using File = System.IO.File; using OperatingSystem = OSVersionExtension.OperatingSystem; @@ -652,6 +654,7 @@ namespace Ink_Canvas // 初始化屏蔽压感开关状态 ToggleSwitchDisablePressure.IsOn = Settings.Canvas.DisablePressure; + inkCanvas.DefaultDrawingAttributes.IgnorePressure = Settings.Canvas.DisablePressure; ComboBoxPenStyle.SelectedIndex = Settings.Canvas.InkStyle; BoardComboBoxPenStyle.SelectedIndex = Settings.Canvas.InkStyle; @@ -820,6 +823,14 @@ namespace Ink_Canvas if (Settings.Advanced.IsEnableAvoidFullScreenHelper) { AvoidFullScreenHelper.StartAvoidFullScreen(this); + Dispatcher.BeginInvoke(new Action(() => + { + if (isLoaded) + { + MoveWindow(new WindowInteropHelper(this).Handle, 0, 0, + WinForms.Screen.PrimaryScreen.Bounds.Width, WinForms.Screen.PrimaryScreen.Bounds.Height, true); + } + }), DispatcherPriority.ApplicationIdle); } if (Settings.Advanced.IsEnableEdgeGestureUtil) { diff --git a/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs b/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs index b34b60b4..6a1c758f 100644 --- a/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs +++ b/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs @@ -464,7 +464,7 @@ namespace Ink_Canvas var strokeVisual = GetStrokeVisual(e.StylusDevice.Id); var stylusPointCollection = e.GetStylusPoints(this); foreach (var stylusPoint in stylusPointCollection) - strokeVisual.Add(new StylusPoint(stylusPoint.X, stylusPoint.Y, stylusPoint.PressureFactor)); + strokeVisual.Add(new StylusPoint(stylusPoint.X, stylusPoint.Y, stylusPoint.PressureFactor)); strokeVisual.Redraw(); } catch { } diff --git a/Ink Canvas/Resources/Fonts/LXGWWenKaiTC-Regular.ttf b/Ink Canvas/Resources/Fonts/LXGWWenKaiTC-Regular.ttf new file mode 100644 index 00000000..424ff1ac Binary files /dev/null and b/Ink Canvas/Resources/Fonts/LXGWWenKaiTC-Regular.ttf differ diff --git a/Ink Canvas/Resources/Icons-png/icc-dark.png b/Ink Canvas/Resources/Icons-png/icc-dark.png new file mode 100644 index 00000000..d682ec8c Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/icc-dark.png differ diff --git a/Ink Canvas/Resources/Icons-png/icc-noshadow.png b/Ink Canvas/Resources/Icons-png/icc-noshadow.png new file mode 100644 index 00000000..41884423 Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/icc-noshadow.png differ diff --git a/Ink Canvas/Resources/Icons-png/icc.png b/Ink Canvas/Resources/Icons-png/icc.png index cf1979ad..0eeaa37a 100644 Binary files a/Ink Canvas/Resources/Icons-png/icc.png and b/Ink Canvas/Resources/Icons-png/icc.png differ diff --git a/Ink Canvas/Windows/SplashScreen.xaml b/Ink Canvas/Windows/SplashScreen.xaml index 8ad2c252..273659f0 100644 --- a/Ink Canvas/Windows/SplashScreen.xaml +++ b/Ink Canvas/Windows/SplashScreen.xaml @@ -11,9 +11,6 @@ ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> - - - @@ -28,7 +25,7 @@ Foreground="FloralWhite" HorizontalAlignment="Right" VerticalAlignment="Top" - Margin="0,10,50,0" + Margin="0,80,60,0" Opacity="0.8" Panel.ZIndex="1000" /> @@ -37,6 +34,7 @@ Alan-CRL
Alan-CRL

💻 🚇 📖 💵 MKStoler1024
MKStoler1024

📖 💻 🎨 Awesome Iwb
Awesome Iwb

📖 + PrefacedCorg
PrefacedCorg

💻 🎨 - PrefacedCorg
PrefacedCorg

💻 🎨 Jursin
Jursin

🎨 + tayasui rainnya!
tayasui rainnya!

🎨