Merge pull request #241 from InkCanvasForClass/beta
合并pre-release action
This commit is contained in:
@@ -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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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<<EOF" >> $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"
|
||||
+13
-5
@@ -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());
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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<UpdateLineGroup>();
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -223,6 +223,8 @@
|
||||
<Resource Include="Resources\Icons-png\icc-transparent-dark.png" />
|
||||
<Resource Include="Resources\Icons-png\icc-transparent.png" />
|
||||
<Resource Include="Resources\Icons-png\icc.png" />
|
||||
<Resource Include="Resources\Icons-png\icc-dark.png" />
|
||||
<Resource Include="Resources\Icons-png\icc-noshadow.png" />
|
||||
<Resource Include="Resources\Icons-png\InkCanvas.png" />
|
||||
<Resource Include="Resources\Icons-png\kuanciya.png" />
|
||||
<Resource Include="Resources\Icons-png\kuandogeyuanliangwo.png" />
|
||||
@@ -528,6 +530,8 @@
|
||||
<None Remove="Resources\Icons-png\icc-transparent-dark.png" />
|
||||
<None Remove="Resources\Icons-png\icc-transparent.png" />
|
||||
<None Remove="Resources\Icons-png\icc.png" />
|
||||
<None Remove="Resources\Icons-png\icc-dark.png" />
|
||||
<None Remove="Resources\Icons-png\icc-noshadow.png" />
|
||||
<None Remove="Resources\Icons-png\idt.png" />
|
||||
<None Remove="Resources\Icons-png\InkCanvas.png" />
|
||||
<None Remove="Resources\Icons-png\kuanciya.png" />
|
||||
@@ -564,6 +568,9 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons-png\idt.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Fonts\LXGWWenKaiTC-Regular.ttf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons-png\HiteAnnotation.png" />
|
||||
<Resource Include="Resources\Icons-png\AiClass.png" />
|
||||
|
||||
+15
-12
@@ -1072,6 +1072,8 @@
|
||||
SelectionChanged="ComboBoxFloatingBarImg_SelectionChanged">
|
||||
<ComboBoxItem Content="“ICC-CE”默认" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="“ICC-CE”黑色透明版" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="“ICC-CE”无阴影" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="“ICC-CE”深色" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="酷安斗鸡眼滑稽" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="酷安受虐滑稽" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="酷安呲牙笑" FontFamily="Microsoft YaHei UI" />
|
||||
@@ -1464,35 +1466,35 @@
|
||||
FontSize="20" />
|
||||
<Border ClipToBounds="True" Width="324" Height="182">
|
||||
<Grid>
|
||||
<Image Source="Resources/PresentationExample/page.jpg"></Image>
|
||||
<Image Source="Resources/PresentationExample/toolbar.png" Height="16"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Center" />
|
||||
<Image Name="PPTBtnPreviewLS" Source="Resources/PresentationExample/sidebar-white.png" Width="10"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" >
|
||||
<Image Source="Resources/PresentationExample/page.jpg" Width="324" Height="182" Stretch="Fill"></Image>
|
||||
<Image Name="PPTBtnPreviewToolbar" Source="Resources/PresentationExample/toolbar.png" Height="16"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Center" Stretch="Uniform" />
|
||||
<Image Name="PPTBtnPreviewLS" Source="Resources/PresentationExample/sidebar-white.png" Width="10" Height="30"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewLSTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image Name="PPTBtnPreviewRS" Source="Resources/PresentationExample/sidebar-white.png" Width="10"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" >
|
||||
<Image Name="PPTBtnPreviewRS" Source="Resources/PresentationExample/sidebar-white.png" Width="10" Height="30"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewRSTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image Name="PPTBtnPreviewLB" Source="Resources/PresentationExample/bottombar-white.png" Height="10"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5">
|
||||
<Image Name="PPTBtnPreviewLB" Source="Resources/PresentationExample/bottombar-white.png" Height="10" Width="30"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewLBTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image Name="PPTBtnPreviewRB" Source="Resources/PresentationExample/bottombar-white.png" Height="12"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5">
|
||||
<Image Name="PPTBtnPreviewRB" Source="Resources/PresentationExample/bottombar-white.png" Height="10" Width="30"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewRBTransform"/>
|
||||
@@ -9428,7 +9430,7 @@
|
||||
<ui:SimpleStackPanel Background="Transparent" Orientation="Vertical"
|
||||
HorizontalAlignment="Center"
|
||||
Width="28" Margin="0,0">
|
||||
<Image Source="/Resources/new-icons/end-slides-show.png"
|
||||
<Image Source="{DynamicResource QuickPanelEndSlideshowIcon}"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" Width="28" Height="17"
|
||||
Margin="0,3,0,0" />
|
||||
<TextBlock Text="退出" Foreground="{DynamicResource FloatBarForeground}" FontSize="8" Margin="0,1,0,0"
|
||||
@@ -9771,3 +9773,4 @@
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) // 白板模式
|
||||
{
|
||||
|
||||
@@ -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() == "浅色")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 { }
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 474 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 557 KiB |
@@ -11,9 +11,6 @@
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<!-- 背景遮罩 -->
|
||||
<Rectangle Fill="#80000000" />
|
||||
|
||||
<!-- 启动图片容器 -->
|
||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<!-- 启动图片 -->
|
||||
@@ -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" />
|
||||
</Grid>
|
||||
@@ -37,6 +34,7 @@
|
||||
<TextBlock x:Name="LoadingText"
|
||||
Text="正在启动 Ink Canvas..."
|
||||
FontSize="18"
|
||||
FontFamily="pack://application:,,,/Resources/Fonts/#LXGW WenKai TC"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="White"
|
||||
HorizontalAlignment="Center"
|
||||
|
||||
@@ -90,10 +90,11 @@
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Alan-CRL"><img src="https://avatars.githubusercontent.com/u/92425617?v=4?s=100" width="100px;" alt="Alan-CRL"/><br /><sub><b>Alan-CRL</b></sub></a><br /><a href="#code-Alan-CRL" title="Code">💻</a> <a href="#infra-Alan-CRL" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#doc-Alan-CRL" title="Documentation">📖</a> <a href="#financial-Alan-CRL" title="Financial">💵</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MKStoler1024"><img src="https://avatars.githubusercontent.com/u/158786854?v=4?s=100" width="100px;" alt="MKStoler1024"/><br /><sub><b>MKStoler1024</b></sub></a><br /><a href="#doc-MKStoler1024" title="Documentation">📖</a> <a href="#code-MKStoler1024" title="Code">💻</a> <a href="#design-MKStoler1024" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/awesome-iwb"><img src="https://avatars.githubusercontent.com/u/184760810?v=4?s=100" width="100px;" alt="Awesome Iwb"/><br /><sub><b>Awesome Iwb</b></sub></a><br /><a href="#doc-awesome-iwb" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/PrefacedCorg"><img src="https://avatars.githubusercontent.com/u/129855423?v=4?s=100" width="100px;" alt="PrefacedCorg"/><br /><sub><b>PrefacedCorg</b></sub></a><br /><a href="#code-PrefacedCorg" title="Code">💻</a> <a href="#design-PrefacedCorg" title="Design">🎨</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/PrefacedCorg"><img src="https://avatars.githubusercontent.com/u/129855423?v=4?s=100" width="100px;" alt="PrefacedCorg"/><br /><sub><b>PrefacedCorg</b></sub></a><br /><a href="#code-PrefacedCorg" title="Code">💻</a> <a href="#design-PrefacedCorg" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="http://blog.jursin.top"><img src="https://avatars.githubusercontent.com/u/127487914?v=4?s=100" width="100px;" alt="Jursin"/><br /><sub><b>Jursin</b></sub></a><br /><a href="#design-Jursin" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Tayasui-rainnya"><img src="https://avatars.githubusercontent.com/u/156585442?v=4?s=100" width="100px;" alt="tayasui rainnya!"/><br /><sub><b>tayasui rainnya!</b></sub></a><br /><a href="#design-Tayasui-rainnya" title="Design">🎨</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user