Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34f9eeff2c | ||
|
|
1278fefea2 | ||
|
|
48d46afcff | ||
|
|
6742dacaf2 | ||
|
|
3337ecc03a | ||
|
|
b9eaacd1f7 | ||
|
|
a0ada51325 | ||
|
|
8e03911957 | ||
|
|
0b3db0fd0d | ||
|
|
bb2862ed4f | ||
|
|
8c3be98b54 | ||
|
|
b76224c010 | ||
|
|
bd9f8d714a | ||
|
|
6900968555 | ||
|
|
741d334a92 | ||
|
|
b583108afa | ||
|
|
f7ace4dfe9 | ||
|
|
7ce2bd5629 | ||
|
|
41716df7b2 | ||
|
|
fe9b9829e2 | ||
|
|
4365c2a008 | ||
|
|
7896e072e7 | ||
|
|
940397c673 | ||
|
|
d57ea781f0 | ||
|
|
b74f2811a7 | ||
|
|
66223f952b |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -15,4 +15,4 @@ assignees: ''
|
|||||||
如果有必要,提供报错时的有关截图。/If applicable, add screenshots to help explain your problem.
|
如果有必要,提供报错时的有关截图。/If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
## 附件(可选)/Attachments (Optional)
|
## 附件(可选)/Attachments (Optional)
|
||||||
请将会**出现问题的文件**以及**日志文件**打包成一个 ZIP 后作为附件贴在 issue 内。/Please compress the problematic files and the log files into a single ZIP archive and attach it to this issue.
|
请将会**出现问题的文件**以及**日志文件**打包成一个 ZIP 后作为附件贴在 issue 内,日志文件位于程序目录下的 `logs` 文件夹内。/Please compress the problematic files and the log files into a single ZIP archive and attach it to this issue. The log files are located in the `logs` folder under the program directory.
|
||||||
|
|||||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,5 +1,20 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## v0.16.0
|
||||||
|
|
||||||
|
- 增加最小化至托盘图标功能
|
||||||
|
- 调整部分参数项的顺序
|
||||||
|
- 增加开机自启和自启文件设置
|
||||||
|
- 切换桌面投影时自动设置预览分辨率为主屏幕分辨率
|
||||||
|
- 修复 3.4 版本下可能存在的附件残留问题
|
||||||
|
|
||||||
|
## v0.15.19
|
||||||
|
|
||||||
|
- 模型重载后选中最后一个重载模型
|
||||||
|
- 修复 3.4 版本可能的奇数顶点数组导致的越界崩溃问题
|
||||||
|
- 移除参数自动记录中的背景图片路径
|
||||||
|
- 增加测试性桌面投影功能
|
||||||
|
|
||||||
## v0.15.18
|
## v0.15.18
|
||||||
|
|
||||||
- 完善窗口日志颜色标记
|
- 完善窗口日志颜色标记
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
||||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||||
<Version>0.15.18</Version>
|
<Version>0.16.0</Version>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
87
README.en.md
87
README.en.md
@@ -8,29 +8,32 @@
|
|||||||
|
|
||||||
A simple and user-friendly Spine file viewer and exporter with multi-language support (Chinese/English/Japanese).
|
A simple and user-friendly Spine file viewer and exporter with multi-language support (Chinese/English/Japanese).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
<video src="https://github.com/user-attachments/assets/37b6b730-088a-4352-827a-c338127a16f0">
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Supports multiple versions of Spine files.
|
- Multiple versions of Spine files
|
||||||
* Batch open files via drag-and-drop or copy-paste.
|
- Batch file opening via drag-and-drop or copy-paste
|
||||||
* Batch preview functionality.
|
- Batch preview
|
||||||
* List-based multi-skeleton viewing and render order management.
|
- List-based multi-skeleton viewing and render order management
|
||||||
* Batch adjustment of skeleton parameters using multi-selection.
|
- Multi-selection in lists for batch skeleton parameter settings
|
||||||
* Multi-track animation settings.
|
- Multi-track animation settings
|
||||||
* Skin and custom slot attachment settings.
|
- Skin and custom slot attachment settings
|
||||||
* Custom slot visibility settings.
|
- Custom slot visibility
|
||||||
* Debug rendering support.
|
- Debug rendering
|
||||||
* View/model/track time scale adjustment.
|
- Playback speed adjustment for view/model/track timelines
|
||||||
* Track alpha blending parameter settings.
|
- Track alpha blending parameter settings
|
||||||
* Fullscreen preview mode.
|
- Fullscreen preview
|
||||||
* Export to single frame/image sequence/animated GIF/video formats.
|
- Export to single frame, image sequence, animated GIF, or video file
|
||||||
* Automatic resolution batch export.
|
- Automatic resolution batch export
|
||||||
* FFmpeg custom export support.
|
- Custom export with FFmpeg
|
||||||
* Program parameter saving.
|
- Program parameter saving
|
||||||
* File name extension association.
|
- File extension association
|
||||||
* Supports texture image formats other than PNG.
|
- Texture images in formats other than PNG
|
||||||
* ...
|
- Launch at startup with persistent dynamic wallpaper
|
||||||
|
- ......
|
||||||
|
|
||||||
### Supported Spine Versions
|
### Supported Spine Versions
|
||||||
|
|
||||||
@@ -78,14 +81,14 @@ In the menu, go to "File" -> "Preferences..." -> "Language," select your desired
|
|||||||
|
|
||||||
The program is organized into a left-right layout:
|
The program is organized into a left-right layout:
|
||||||
|
|
||||||
* **Left Panel:** Functionality panel.
|
- **Left Panel:** Functionality panel.
|
||||||
* **Right Panel:** Preview display.
|
- **Right Panel:** Preview display.
|
||||||
|
|
||||||
The left panel includes three sub-panels:
|
The left panel includes three sub-panels:
|
||||||
|
|
||||||
* **Browse:** Preview the content of a specified folder without importing files into the program. This panel allows generating `.webp` previews for models or importing selected models.
|
- **Browse:** Preview the content of a specified folder without importing files into the program. This panel allows generating `.webp` previews for models or importing selected models.
|
||||||
* **Model:** Lists imported models for rendering. Parameters and rendering order can be adjusted here, along with other model-related functionalities.
|
- **Model:** Lists imported models for rendering. Parameters and rendering order can be adjusted here, along with other model-related functionalities.
|
||||||
* **Display:** Adjust parameters for the right-side preview display.
|
- **Display:** Adjust parameters for the right-side preview display.
|
||||||
|
|
||||||
Hover your mouse over buttons, labels, or input fields to see help text for most UI elements.
|
Hover your mouse over buttons, labels, or input fields to see help text for most UI elements.
|
||||||
|
|
||||||
@@ -101,10 +104,10 @@ The Model panel supports right-click menus, some shortcuts, and batch adjustment
|
|||||||
|
|
||||||
For preview display adjustments:
|
For preview display adjustments:
|
||||||
|
|
||||||
* **Left-click:** Select and drag models. Hold `Ctrl` for multi-selection, synchronized with the left-side list.
|
- **Left-click:** Select and drag models. Hold `Ctrl` for multi-selection, synchronized with the left-side list.
|
||||||
* **Right-click:** Drag the entire display.
|
- **Right-click:** Drag the entire display.
|
||||||
* **Scroll wheel:** Zoom in/out. Hold `Ctrl` to scale selected models.
|
- **Scroll wheel:** Zoom in/out. Hold `Ctrl` to scale selected models.
|
||||||
* **Render selected-only mode:** In this mode, the preview only shows selected models, and selection status can only be changed via the left-side list.
|
- **Render selected-only mode:** In this mode, the preview only shows selected models, and selection status can only be changed via the left-side list.
|
||||||
|
|
||||||
The buttons below the preview display allow time adjustments, serving as a simple playback control.
|
The buttons below the preview display allow time adjustments, serving as a simple playback control.
|
||||||
|
|
||||||
@@ -116,9 +119,17 @@ Use the right-click menu in the Model panel to export selected items.
|
|||||||
|
|
||||||
Key export parameters include:
|
Key export parameters include:
|
||||||
|
|
||||||
* **Output folder:** Optional. When not specified, output is saved to the respective model folder; otherwise, all output is saved to the provided folder.
|
- **Output folder:** Optional. When not specified, output is saved to the respective model folder; otherwise, all output is saved to the provided folder.
|
||||||
* **Export single:** By default, each model is exported independently. Selecting "Export single" renders all selected models in a single frame, producing a unified output.
|
- **Export single:** By default, each model is exported independently. Selecting "Export single" renders all selected models in a single frame, producing a unified output.
|
||||||
* **Auto resolution:** Ignores the preview resolution and viewport parameters, exporting output at the actual size of the content. For animations/videos, the output matches the size required for full visibility.
|
- **Auto resolution:** Ignores the preview resolution and viewport parameters, exporting output at the actual size of the content. For animations/videos, the output matches the size required for full visibility.
|
||||||
|
|
||||||
|
### Dynamic Wallpaper
|
||||||
|
|
||||||
|
Dynamic wallpaper is implemented through desktop projection, allowing the content of the current preview to be projected onto the desktop in real time.
|
||||||
|
|
||||||
|
You can enable or disable desktop projection from the program preferences or the right-click menu of the tray icon. After adjusting the model and display parameters, you can save the current configuration as a workspace file for convenient restoration later.
|
||||||
|
|
||||||
|
If you want the wallpaper to stay active after startup, you can enable auto-start in the preferences and specify which workspace file should be loaded when the program launches.
|
||||||
|
|
||||||
### More Information
|
### More Information
|
||||||
|
|
||||||
@@ -126,12 +137,12 @@ For detailed usage and documentation, see the [Wiki](https://github.com/ww-rm/Sp
|
|||||||
|
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
|
|
||||||
* [spine-runtimes](https://github.com/EsotericSoftware/spine-runtimes)
|
- [spine-runtimes](https://github.com/EsotericSoftware/spine-runtimes)
|
||||||
* [SFML.Net](https://github.com/SFML/SFML.Net)
|
- [SFML.Net](https://github.com/SFML/SFML.Net)
|
||||||
* [FFMpegCore](https://github.com/rosenbjerg/FFMpegCore)
|
- [FFMpegCore](https://github.com/rosenbjerg/FFMpegCore)
|
||||||
* [HandyControl](https://github.com/HandyOrg/HandyControl)
|
- [HandyControl](https://github.com/HandyOrg/HandyControl)
|
||||||
* [NLog](https://github.com/NLog/NLog)
|
- [NLog](https://github.com/NLog/NLog)
|
||||||
* [SkiaSharp](https://github.com/mono/SkiaSharp)
|
- [SkiaSharp](https://github.com/mono/SkiaSharp)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
15
README.md
15
README.md
@@ -6,9 +6,11 @@
|
|||||||
|
|
||||||
[中文](README.md) | [English](README.en.md)
|
[中文](README.md) | [English](README.en.md)
|
||||||
|
|
||||||
一个简单好用的 Spine 文件查看&导出程序, 支持中/英/日多语言界面.
|
Spine 文件查看&导出程序, 同时也是支持 Spine 的动态壁纸程序.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
<video src="https://github.com/user-attachments/assets/37b6b730-088a-4352-827a-c338127a16f0">
|
||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
|
|
||||||
@@ -30,6 +32,7 @@
|
|||||||
- 支持程序参数保存
|
- 支持程序参数保存
|
||||||
- 支持文件后缀关联
|
- 支持文件后缀关联
|
||||||
- 支持非 png 格式的纹理图片格式
|
- 支持非 png 格式的纹理图片格式
|
||||||
|
- 支持开机自启常驻动态壁纸
|
||||||
- ......
|
- ......
|
||||||
|
|
||||||
### Spine 版本支持
|
### Spine 版本支持
|
||||||
@@ -117,6 +120,14 @@
|
|||||||
- 导出单个. 默认是每个模型独立导出, 即对模型列表进行批量操作, 如果选择仅导出单个, 那么被导出的所有模型将在同一个画面上被渲染, 输出产物只有一份.
|
- 导出单个. 默认是每个模型独立导出, 即对模型列表进行批量操作, 如果选择仅导出单个, 那么被导出的所有模型将在同一个画面上被渲染, 输出产物只有一份.
|
||||||
- 自动分辨率. 该模式会忽略预览画面的分辨率和视区参数, 导出产物的分辨率与被导出内容的实际大小一致, 如果是动图或者视频则会与完整显示动画的必需大小一致.
|
- 自动分辨率. 该模式会忽略预览画面的分辨率和视区参数, 导出产物的分辨率与被导出内容的实际大小一致, 如果是动图或者视频则会与完整显示动画的必需大小一致.
|
||||||
|
|
||||||
|
### 动态壁纸
|
||||||
|
|
||||||
|
动态壁纸通过桌面投影实现, 可以将当前预览画面上的内容实时投影至桌面.
|
||||||
|
|
||||||
|
在程序首选项或者托盘图标右键菜单中可以进行桌面投影的启用与否, 模型和画面参数调整完成后, 可以将当前参数保存为工作区文件, 方便之后恢复该配置.
|
||||||
|
|
||||||
|
如果希望开机自启常驻壁纸, 也可以在首选项中启用开机自启, 并且设置启动后需要加载的工作区文件.
|
||||||
|
|
||||||
### 更多
|
### 更多
|
||||||
|
|
||||||
更为详细的使用方法和说明见 [Wiki](https://github.com/ww-rm/SpineViewer/wiki), 有使用上的问题或者 BUG 可以提个 [Issue](https://github.com/ww-rm/SpineViewer/issues).
|
更为详细的使用方法和说明见 [Wiki](https://github.com/ww-rm/SpineViewer/wiki), 有使用上的问题或者 BUG 可以提个 [Issue](https://github.com/ww-rm/SpineViewer/issues).
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ namespace SFMLRenderer
|
|||||||
hs?.Dispose();
|
hs?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private nint HwndMessageHook(nint hwnd, int msg, nint wParam, nint lParam, ref bool handled)
|
private IntPtr HwndMessageHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||||
{
|
{
|
||||||
_renderWindow?.DispatchEvents();
|
_renderWindow?.DispatchEvents();
|
||||||
return nint.Zero;
|
return IntPtr.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
171
SFMLRenderer/SFMLRenderWindow.cs
Normal file
171
SFMLRenderer/SFMLRenderWindow.cs
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
using SFML.Graphics;
|
||||||
|
using SFML.System;
|
||||||
|
using SFML.Window;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace SFMLRenderer
|
||||||
|
{
|
||||||
|
public class SFMLRenderWindow : RenderWindow, ISFMLRenderer
|
||||||
|
{
|
||||||
|
private readonly DispatcherTimer _timer = new() { Interval = TimeSpan.FromMilliseconds(10) };
|
||||||
|
|
||||||
|
public SFMLRenderWindow(VideoMode mode, string title, Styles style) : base(mode, title, style)
|
||||||
|
{
|
||||||
|
SetActive(false);
|
||||||
|
_timer.Tick += (s, e) => DispatchEvents();
|
||||||
|
_timer.Start();
|
||||||
|
RendererCreated?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler? RendererCreated;
|
||||||
|
|
||||||
|
public event EventHandler? RendererDisposing
|
||||||
|
{
|
||||||
|
add => throw new NotImplementedException();
|
||||||
|
remove => throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<MouseMoveEventArgs>? CanvasMouseMove
|
||||||
|
{
|
||||||
|
add { MouseMoved += value; }
|
||||||
|
remove { MouseMoved -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<MouseButtonEventArgs>? CanvasMouseButtonPressed
|
||||||
|
{
|
||||||
|
add { MouseButtonPressed += value; }
|
||||||
|
remove { MouseButtonPressed -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<MouseButtonEventArgs>? CanvasMouseButtonReleased
|
||||||
|
{
|
||||||
|
add { MouseButtonReleased += value; }
|
||||||
|
remove { MouseButtonReleased -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<MouseWheelScrollEventArgs>? CanvasMouseWheelScrolled
|
||||||
|
{
|
||||||
|
add { MouseWheelScrolled += value; }
|
||||||
|
remove { MouseWheelScrolled -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2u Resolution
|
||||||
|
{
|
||||||
|
get => Size;
|
||||||
|
set => Size = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2f Center
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
using var view = GetView();
|
||||||
|
return view.Center;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
using var view = GetView();
|
||||||
|
view.Center = value;
|
||||||
|
SetView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Zoom
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
using var view = GetView();
|
||||||
|
return Math.Abs(Size.X / view.Size.X); // XXX: 仅使用宽度进行缩放计算
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
value = Math.Abs(value);
|
||||||
|
if (value <= 0) return;
|
||||||
|
using var view = GetView();
|
||||||
|
var signX = Math.Sign(view.Size.X);
|
||||||
|
var signY = Math.Sign(view.Size.Y);
|
||||||
|
var resolution = Size;
|
||||||
|
view.Size = new(resolution.X / value * signX, resolution.Y / value * signY);
|
||||||
|
SetView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Rotation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
using var view = GetView();
|
||||||
|
return view.Rotation;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
using var view = GetView();
|
||||||
|
view.Rotation = value;
|
||||||
|
SetView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool FlipX
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
using var view = GetView();
|
||||||
|
return view.Size.X < 0;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
using var view = GetView();
|
||||||
|
var size = view.Size;
|
||||||
|
if (size.X > 0 && value || size.X < 0 && !value)
|
||||||
|
size.X *= -1;
|
||||||
|
view.Size = size;
|
||||||
|
SetView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool FlipY
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
using var view = GetView();
|
||||||
|
return view.Size.Y < 0;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
using var view = GetView();
|
||||||
|
var size = view.Size;
|
||||||
|
if (size.Y > 0 && value || size.Y < 0 && !value)
|
||||||
|
size.Y *= -1;
|
||||||
|
view.Size = size;
|
||||||
|
SetView(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint MaxFps
|
||||||
|
{
|
||||||
|
get => _maxFps;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetFramerateLimit(value);
|
||||||
|
_maxFps = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private uint _maxFps = 0;
|
||||||
|
|
||||||
|
public bool VerticalSync
|
||||||
|
{
|
||||||
|
get => _verticalSync;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetVerticalSyncEnabled(value);
|
||||||
|
_verticalSync = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private bool _verticalSync = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
||||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||||
<Version>0.15.4</Version>
|
<Version>0.16.0</Version>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
||||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||||
<Version>0.15.18</Version>
|
<Version>0.16.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SFML.Graphics;
|
using NLog;
|
||||||
|
using SFML.Graphics;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -22,6 +23,8 @@ namespace Spine.SpineWrappers
|
|||||||
SpineRuntime41.TextureLoader,
|
SpineRuntime41.TextureLoader,
|
||||||
SpineRuntime42.TextureLoader
|
SpineRuntime42.TextureLoader
|
||||||
{
|
{
|
||||||
|
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 默认的全局纹理加载器
|
/// 默认的全局纹理加载器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -44,9 +47,18 @@ namespace Spine.SpineWrappers
|
|||||||
|
|
||||||
private Texture ReadTexture(string path)
|
private Texture ReadTexture(string path)
|
||||||
{
|
{
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
_logger.Error($"Texture file not found, {path}");
|
||||||
|
throw new FileNotFoundException("Texture file not found", path);
|
||||||
|
}
|
||||||
|
|
||||||
using var codec = SKCodec.Create(path, out var result);
|
using var codec = SKCodec.Create(path, out var result);
|
||||||
if (codec is null || result != SKCodecResult.Success)
|
if (codec is null || result != SKCodecResult.Success)
|
||||||
|
{
|
||||||
|
_logger.Error($"Failed to create codec '{path}', {result}");
|
||||||
throw new InvalidOperationException($"Failed to create codec '{path}', {result}");
|
throw new InvalidOperationException($"Failed to create codec '{path}', {result}");
|
||||||
|
}
|
||||||
|
|
||||||
var width = codec.Info.Width;
|
var width = codec.Info.Width;
|
||||||
var height = codec.Info.Height;
|
var height = codec.Info.Height;
|
||||||
@@ -57,7 +69,10 @@ namespace Spine.SpineWrappers
|
|||||||
|
|
||||||
result = codec.GetPixels(info, out var pixels);
|
result = codec.GetPixels(info, out var pixels);
|
||||||
if (result != SKCodecResult.Success)
|
if (result != SKCodecResult.Success)
|
||||||
|
{
|
||||||
|
_logger.Error($"Failed to decode image '{path}', {result}");
|
||||||
throw new InvalidOperationException($"Failed to decode image '{path}', {result}");
|
throw new InvalidOperationException($"Failed to decode image '{path}', {result}");
|
||||||
|
}
|
||||||
|
|
||||||
Texture tex = new((uint)width, (uint)height);
|
Texture tex = new((uint)width, (uint)height);
|
||||||
tex.Update(pixels);
|
tex.Update(pixels);
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ namespace SpineRuntime21 {
|
|||||||
|
|
||||||
if (vertices != null)
|
if (vertices != null)
|
||||||
{
|
{
|
||||||
for (int ii = 0; ii < verticesLength; ii += 2)
|
for (int ii = 0; ii + 1 < verticesLength; ii += 2)
|
||||||
{
|
{
|
||||||
float vx = vertices[ii], vy = vertices[ii + 1];
|
float vx = vertices[ii], vy = vertices[ii + 1];
|
||||||
minX = Math.Min(minX, vx);
|
minX = Math.Min(minX, vx);
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ namespace SpineRuntime34 {
|
|||||||
|
|
||||||
if (vertices != null)
|
if (vertices != null)
|
||||||
{
|
{
|
||||||
for (int ii = 0; ii < verticesLength; ii += 2)
|
for (int ii = 0; ii + 1 < verticesLength; ii += 2)
|
||||||
{
|
{
|
||||||
float vx = vertices[ii], vy = vertices[ii + 1];
|
float vx = vertices[ii], vy = vertices[ii + 1];
|
||||||
minX = Math.Min(minX, vx);
|
minX = Math.Min(minX, vx);
|
||||||
|
|||||||
@@ -521,7 +521,7 @@ namespace SpineRuntime35 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vertices != null) {
|
if (vertices != null) {
|
||||||
for (int ii = 0; ii < verticesLength; ii += 2) {
|
for (int ii = 0; ii + 1 < verticesLength; ii += 2) {
|
||||||
float vx = vertices[ii], vy = vertices[ii + 1];
|
float vx = vertices[ii], vy = vertices[ii + 1];
|
||||||
minX = Math.Min(minX, vx);
|
minX = Math.Min(minX, vx);
|
||||||
minY = Math.Min(minY, vy);
|
minY = Math.Min(minY, vy);
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ namespace SpineRuntime36 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vertices != null) {
|
if (vertices != null) {
|
||||||
for (int ii = 0; ii < verticesLength; ii += 2) {
|
for (int ii = 0; ii + 1 < verticesLength; ii += 2) {
|
||||||
float vx = vertices[ii], vy = vertices[ii + 1];
|
float vx = vertices[ii], vy = vertices[ii + 1];
|
||||||
minX = Math.Min(minX, vx);
|
minX = Math.Min(minX, vx);
|
||||||
minY = Math.Min(minY, vy);
|
minY = Math.Min(minY, vy);
|
||||||
|
|||||||
@@ -580,7 +580,7 @@ namespace SpineRuntime37 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vertices != null) {
|
if (vertices != null) {
|
||||||
for (int ii = 0; ii < verticesLength; ii += 2) {
|
for (int ii = 0; ii + 1 < verticesLength; ii += 2) {
|
||||||
float vx = vertices[ii], vy = vertices[ii + 1];
|
float vx = vertices[ii], vy = vertices[ii + 1];
|
||||||
minX = Math.Min(minX, vx);
|
minX = Math.Min(minX, vx);
|
||||||
minY = Math.Min(minY, vy);
|
minY = Math.Min(minY, vy);
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ namespace SpineRuntime38 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vertices != null) {
|
if (vertices != null) {
|
||||||
for (int ii = 0; ii < verticesLength; ii += 2) {
|
for (int ii = 0; ii + 1 < verticesLength; ii += 2) {
|
||||||
float vx = vertices[ii], vy = vertices[ii + 1];
|
float vx = vertices[ii], vy = vertices[ii + 1];
|
||||||
minX = Math.Min(minX, vx);
|
minX = Math.Min(minX, vx);
|
||||||
minY = Math.Min(minY, vy);
|
minY = Math.Min(minY, vy);
|
||||||
|
|||||||
@@ -595,7 +595,7 @@ namespace SpineRuntime40 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vertices != null) {
|
if (vertices != null) {
|
||||||
for (int ii = 0; ii < verticesLength; ii += 2) {
|
for (int ii = 0; ii + 1 < verticesLength; ii += 2) {
|
||||||
float vx = vertices[ii], vy = vertices[ii + 1];
|
float vx = vertices[ii], vy = vertices[ii + 1];
|
||||||
minX = Math.Min(minX, vx);
|
minX = Math.Min(minX, vx);
|
||||||
minY = Math.Min(minY, vy);
|
minY = Math.Min(minY, vy);
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ namespace SpineRuntime41 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vertices != null) {
|
if (vertices != null) {
|
||||||
for (int ii = 0; ii < verticesLength; ii += 2) {
|
for (int ii = 0; ii + 1 < verticesLength; ii += 2) {
|
||||||
float vx = vertices[ii], vy = vertices[ii + 1];
|
float vx = vertices[ii], vy = vertices[ii + 1];
|
||||||
minX = Math.Min(minX, vx);
|
minX = Math.Min(minX, vx);
|
||||||
minY = Math.Min(minY, vy);
|
minY = Math.Min(minY, vy);
|
||||||
|
|||||||
@@ -742,7 +742,7 @@ namespace SpineRuntime42 {
|
|||||||
verticesLength = clipper.ClippedVertices.Count;
|
verticesLength = clipper.ClippedVertices.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int ii = 0; ii < verticesLength; ii += 2) {
|
for (int ii = 0; ii + 1 < verticesLength; ii += 2) {
|
||||||
float vx = vertices[ii], vy = vertices[ii + 1];
|
float vx = vertices[ii], vy = vertices[ii + 1];
|
||||||
minX = Math.Min(minX, vx);
|
minX = Math.Min(minX, vx);
|
||||||
minY = Math.Min(minY, vy);
|
minY = Math.Min(minY, vy);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using NLog;
|
using Microsoft.Win32;
|
||||||
|
using NLog;
|
||||||
using SpineViewer.Natives;
|
using SpineViewer.Natives;
|
||||||
|
using SpineViewer.ViewModels.MainWindow;
|
||||||
using SpineViewer.Views;
|
using SpineViewer.Views;
|
||||||
using System.Collections.Frozen;
|
using System.Collections.Frozen;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
@@ -18,15 +20,28 @@ namespace SpineViewer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
|
public const string AppName = "SpineViewer_D";
|
||||||
|
public const string ProgId = "SpineViewer_D.skel";
|
||||||
|
#else
|
||||||
|
public const string AppName = "SpineViewer";
|
||||||
public const string ProgId = "SpineViewer.skel";
|
public const string ProgId = "SpineViewer.skel";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public const string AutoRunFlag = "--autorun";
|
||||||
|
private const string MutexName = "__SpineViewerInstance__";
|
||||||
|
private const string PipeName = "__SpineViewerPipe__";
|
||||||
|
|
||||||
public static readonly string ProcessPath = Environment.ProcessPath;
|
public static readonly string ProcessPath = Environment.ProcessPath;
|
||||||
public static readonly string ProcessDirectory = Path.GetDirectoryName(Environment.ProcessPath);
|
public static readonly string ProcessDirectory = Path.GetDirectoryName(Environment.ProcessPath);
|
||||||
public static readonly string ProcessName = Process.GetCurrentProcess().ProcessName;
|
public static readonly string ProcessName = Process.GetCurrentProcess().ProcessName;
|
||||||
public static readonly string Version = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
public static readonly string Version = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
||||||
|
|
||||||
private const string MutexName = "SpineViewerInstance";
|
private static readonly string AutoRunCommand = $"\"{ProcessPath}\" {AutoRunFlag}";
|
||||||
private const string PipeName = "SpineViewerPipe";
|
|
||||||
|
private static readonly string SkelFileDescription = $"SpineViewer File";
|
||||||
|
private static readonly string SkelIconFilePath = Path.Combine(ProcessDirectory, "Resources\\Images\\skel.ico");
|
||||||
|
private static readonly string ShellOpenCommand = $"\"{ProcessPath}\" \"%1\"";
|
||||||
|
|
||||||
private static readonly Logger _logger;
|
private static readonly Logger _logger;
|
||||||
private static readonly Mutex _instanceMutex;
|
private static readonly Mutex _instanceMutex;
|
||||||
@@ -87,7 +102,7 @@ namespace SpineViewer
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 2. 遍历同名进程
|
// 遍历同名进程
|
||||||
var processes = Process.GetProcessesByName(ProcessName);
|
var processes = Process.GetProcessesByName(ProcessName);
|
||||||
foreach (var p in processes)
|
foreach (var p in processes)
|
||||||
{
|
{
|
||||||
@@ -171,7 +186,11 @@ namespace SpineViewer
|
|||||||
|
|
||||||
if (args.Count > 0)
|
if (args.Count > 0)
|
||||||
{
|
{
|
||||||
Current.Dispatcher.Invoke(() => ((MainWindow)Current.MainWindow).OpenFiles(args));
|
Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
var vm = (MainWindowViewModel)((MainWindow)Current.MainWindow).DataContext;
|
||||||
|
vm.SpineObjectListViewModel.AddSpineObjectFromFileList(args);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,7 +205,6 @@ namespace SpineViewer
|
|||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
var uiCulture = CultureInfo.CurrentUICulture.Name.ToLowerInvariant();
|
var uiCulture = CultureInfo.CurrentUICulture.Name.ToLowerInvariant();
|
||||||
_logger.Info("Current UI Culture: {0}", uiCulture);
|
_logger.Info("Current UI Culture: {0}", uiCulture);
|
||||||
|
|
||||||
if (uiCulture.StartsWith("zh")) { } // 默认就是中文, 无需操作
|
if (uiCulture.StartsWith("zh")) { } // 默认就是中文, 无需操作
|
||||||
else if (uiCulture.StartsWith("ja")) Language = AppLanguage.JA;
|
else if (uiCulture.StartsWith("ja")) Language = AppLanguage.JA;
|
||||||
else Language = AppLanguage.EN;
|
else Language = AppLanguage.EN;
|
||||||
@@ -199,6 +217,116 @@ namespace SpineViewer
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AutoRun
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"))
|
||||||
|
{
|
||||||
|
var command = key?.GetValue(AppName) as string;
|
||||||
|
return string.Equals(command, AutoRunCommand, StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.Error("Failed to query autorun registry key, {0}", ex.Message);
|
||||||
|
_logger.Trace(ex.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
// 写入自启命令
|
||||||
|
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"))
|
||||||
|
{
|
||||||
|
key?.SetValue(AppName, AutoRunCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 删除自启命令
|
||||||
|
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"))
|
||||||
|
{
|
||||||
|
key?.DeleteValue(AppName, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.Error("Failed to set autorun registry key, {0}", ex.Message);
|
||||||
|
_logger.Trace(ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AssociateFileSuffix
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 检查 .skel 的 ProgID
|
||||||
|
using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Classes\.skel"))
|
||||||
|
{
|
||||||
|
var progIdValue = key?.GetValue("") as string;
|
||||||
|
if (!string.Equals(progIdValue, App.ProgId, StringComparison.OrdinalIgnoreCase))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查 command 指令是否相同
|
||||||
|
using (var key = Registry.CurrentUser.OpenSubKey($@"Software\Classes\{App.ProgId}\shell\open\command"))
|
||||||
|
{
|
||||||
|
var command = key?.GetValue("") as string;
|
||||||
|
if (string.IsNullOrWhiteSpace(command))
|
||||||
|
return false;
|
||||||
|
return command == ShellOpenCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
// 文件关联
|
||||||
|
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Classes\.skel"))
|
||||||
|
{
|
||||||
|
key?.SetValue("", App.ProgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var key = Registry.CurrentUser.CreateSubKey($@"Software\Classes\{App.ProgId}"))
|
||||||
|
{
|
||||||
|
key?.SetValue("", SkelFileDescription);
|
||||||
|
using (var iconKey = key?.CreateSubKey("DefaultIcon"))
|
||||||
|
{
|
||||||
|
iconKey?.SetValue("", $"\"{SkelIconFilePath}\"");
|
||||||
|
}
|
||||||
|
using (var shellKey = key?.CreateSubKey(@"shell\open\command"))
|
||||||
|
{
|
||||||
|
shellKey?.SetValue("", ShellOpenCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 删除关联
|
||||||
|
Registry.CurrentUser.DeleteSubKeyTree(@"Software\Classes\.skel", false);
|
||||||
|
Registry.CurrentUser.DeleteSubKeyTree($@"Software\Classes\{App.ProgId}", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Shell32.NotifyAssociationChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 程序语言
|
/// 程序语言
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -221,7 +349,6 @@ namespace SpineViewer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private AppLanguage _language = AppLanguage.ZH;
|
private AppLanguage _language = AppLanguage.ZH;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum AppLanguage
|
public enum AppLanguage
|
||||||
|
|||||||
@@ -19,9 +19,16 @@ namespace SpineViewer.Models
|
|||||||
public WindowState WindowState { get; set; }
|
public WindowState WindowState { get; set; }
|
||||||
|
|
||||||
public double RootGridCol0Width { get; set; }
|
public double RootGridCol0Width { get; set; }
|
||||||
|
public double RootGridCol2Width { get; set; }
|
||||||
|
|
||||||
public double ModelListRow0Height { get; set; }
|
public double ModelListRow0Height { get; set; }
|
||||||
|
public double ModelListRow2Height { get; set; }
|
||||||
|
|
||||||
public double ExplorerGridRow0Height { get; set; }
|
public double ExplorerGridRow0Height { get; set; }
|
||||||
|
public double ExplorerGridRow2Height { get; set; }
|
||||||
|
|
||||||
public double RightPanelGridRow0Height { get; set; }
|
public double RightPanelGridRow0Height { get; set; }
|
||||||
|
public double RightPanelGridRow2Height { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -33,7 +40,6 @@ namespace SpineViewer.Models
|
|||||||
public float Speed { get; set; } = 1f;
|
public float Speed { get; set; } = 1f;
|
||||||
public bool ShowAxis { get; set; } = true;
|
public bool ShowAxis { get; set; } = true;
|
||||||
public Color BackgroundColor { get; set; } = Color.FromRgb(105, 105, 105);
|
public Color BackgroundColor { get; set; } = Color.FromRgb(105, 105, 105);
|
||||||
public string BackgroundImagePath { get; set; }
|
|
||||||
public Stretch BackgroundImageMode { get; set; } = Stretch.Uniform;
|
public Stretch BackgroundImageMode { get; set; } = Stretch.Uniform;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using Spine.SpineWrappers;
|
using Spine.SpineWrappers;
|
||||||
|
using SpineViewer.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -73,15 +75,35 @@ namespace SpineViewer.Models
|
|||||||
|
|
||||||
#region 程序选项
|
#region 程序选项
|
||||||
|
|
||||||
[ObservableProperty]
|
public RelayCommand Cmd_SelectAutoRunWorkspaceConfigPath => _cmd_SelectAutoRunWorkspaceConfigPath ??= new(() =>
|
||||||
private bool _renderSelectedOnly;
|
{
|
||||||
|
if (!DialogService.ShowOpenJsonDialog(out var fileName))
|
||||||
[ObservableProperty]
|
return;
|
||||||
private bool _associateFileSuffix;
|
AutoRunWorkspaceConfigPath = fileName;
|
||||||
|
});
|
||||||
|
private RelayCommand? _cmd_SelectAutoRunWorkspaceConfigPath;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private AppLanguage _appLanguage;
|
private AppLanguage _appLanguage;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _renderSelectedOnly;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _wallpaperView;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool? _closeToTray = null;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _autoRun;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _autoRunWorkspaceConfigPath;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _associateFileSuffix;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -269,6 +269,12 @@ namespace SpineViewer.Models
|
|||||||
entry = _spineObject.AnimationState.SetAnimation(index, name, true);
|
entry = _spineObject.AnimationState.SetAnimation(index, name, true);
|
||||||
entry.TimeScale = lastTimeScale;
|
entry.TimeScale = lastTimeScale;
|
||||||
entry.Alpha = lastAlpha;
|
entry.Alpha = lastAlpha;
|
||||||
|
|
||||||
|
// XXX(#105): 部分 3.4.02 版本模型在设置动画后出现附件残留, 因此强制进行一次 Setup
|
||||||
|
if (_spineObject.Version == SpineVersion.V34)
|
||||||
|
{
|
||||||
|
_spineObject.Skeleton.SetSlotsToSetupPose();
|
||||||
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,15 +15,15 @@ namespace SpineViewer.Natives
|
|||||||
public static class Gdi32
|
public static class Gdi32
|
||||||
{
|
{
|
||||||
[DllImport("gdi32.dll", SetLastError = true)]
|
[DllImport("gdi32.dll", SetLastError = true)]
|
||||||
public static extern nint CreateCompatibleDC(nint hdc);
|
public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
|
||||||
|
|
||||||
[DllImport("gdi32.dll", SetLastError = true)]
|
[DllImport("gdi32.dll", SetLastError = true)]
|
||||||
public static extern bool DeleteDC(nint hdc);
|
public static extern bool DeleteDC(IntPtr hdc);
|
||||||
|
|
||||||
[DllImport("gdi32.dll", SetLastError = true)]
|
[DllImport("gdi32.dll", SetLastError = true)]
|
||||||
public static extern nint SelectObject(nint hdc, nint hgdiobj);
|
public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
|
||||||
|
|
||||||
[DllImport("gdi32.dll", SetLastError = true)]
|
[DllImport("gdi32.dll", SetLastError = true)]
|
||||||
public static extern bool DeleteObject(nint hObject);
|
public static extern bool DeleteObject(IntPtr hObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,22 +15,61 @@ namespace SpineViewer.Natives
|
|||||||
public static class User32
|
public static class User32
|
||||||
{
|
{
|
||||||
public const int GWL_STYLE = -16;
|
public const int GWL_STYLE = -16;
|
||||||
public const int WS_SIZEBOX = 0x40000;
|
public const int WS_OVERLAPPED = 0x00000000;
|
||||||
public const int WS_BORDER = 0x800000;
|
|
||||||
public const int WS_VISIBLE = 0x10000000;
|
|
||||||
public const int WS_CHILD = 0x40000000;
|
|
||||||
public const int WS_POPUP = unchecked((int)0x80000000);
|
public const int WS_POPUP = unchecked((int)0x80000000);
|
||||||
|
public const int WS_CHILD = 0x40000000;
|
||||||
|
public const int WS_MINIMIZE = 0x20000000;
|
||||||
|
public const int WS_VISIBLE = 0x10000000;
|
||||||
|
public const int WS_DISABLED = 0x08000000;
|
||||||
|
public const int WS_CLIPSIBLINGS = 0x04000000;
|
||||||
|
public const int WS_CLIPCHILDREN = 0x02000000;
|
||||||
|
public const int WS_MAXIMIZE = 0x01000000;
|
||||||
|
public const int WS_BORDER = 0x00800000;
|
||||||
|
public const int WS_DLGFRAME = 0x00400000;
|
||||||
|
public const int WS_VSCROLL = 0x00200000;
|
||||||
|
public const int WS_HSCROLL = 0x00100000;
|
||||||
|
public const int WS_SYSMENU = 0x00080000;
|
||||||
|
public const int WS_THICKFRAME = 0x00040000;
|
||||||
|
public const int WS_GROUP = 0x00020000;
|
||||||
|
public const int WS_TABSTOP = 0x00010000;
|
||||||
|
public const int WS_MINIMIZEBOX = 0x00020000;
|
||||||
|
public const int WS_MAXIMIZEBOX = 0x00010000;
|
||||||
|
public const int WS_CHILDWINDOW = WS_CHILD;
|
||||||
|
public const int WS_CAPTION = WS_BORDER | WS_DLGFRAME;
|
||||||
|
public const int WS_TILED = WS_OVERLAPPED;
|
||||||
|
public const int WS_ICONIC = WS_MINIMIZE;
|
||||||
|
public const int WS_SIZEBOX = WS_THICKFRAME;
|
||||||
|
public const int WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW;
|
||||||
|
public const int WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
|
||||||
|
public const int WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU;
|
||||||
|
|
||||||
public const int GWL_EXSTYLE = -20;
|
public const int GWL_EXSTYLE = -20;
|
||||||
public const int WS_EX_TOPMOST = 0x8;
|
public const int WS_EX_DLGMODALFRAME = 0x00000001;
|
||||||
public const int WS_EX_TRANSPARENT = 0x20;
|
public const int WS_EX_NOPARENTNOTIFY = 0x00000004;
|
||||||
public const int WS_EX_TOOLWINDOW = 0x80;
|
public const int WS_EX_TOPMOST = 0x00000008;
|
||||||
public const int WS_EX_WINDOWEDGE = 0x100;
|
public const int WS_EX_ACCEPTFILES = 0x00000010;
|
||||||
public const int WS_EX_CLIENTEDGE = 0x200;
|
public const int WS_EX_TRANSPARENT = 0x00000020;
|
||||||
public const int WS_EX_APPWINDOW = 0x40000;
|
public const int WS_EX_MDICHILD = 0x00000040;
|
||||||
public const int WS_EX_LAYERED = 0x80000;
|
public const int WS_EX_TOOLWINDOW = 0x00000080;
|
||||||
|
public const int WS_EX_WINDOWEDGE = 0x00000100;
|
||||||
|
public const int WS_EX_CLIENTEDGE = 0x00000200;
|
||||||
|
public const int WS_EX_CONTEXTHELP = 0x00000400;
|
||||||
|
public const int WS_EX_RIGHT = 0x00001000;
|
||||||
|
public const int WS_EX_LEFT = 0x00000000;
|
||||||
|
public const int WS_EX_RTLREADING = 0x00002000;
|
||||||
|
public const int WS_EX_LTRREADING = 0x00000000;
|
||||||
|
public const int WS_EX_LEFTSCROLLBAR = 0x00004000;
|
||||||
|
public const int WS_EX_RIGHTSCROLLBAR = 0x00000000;
|
||||||
|
public const int WS_EX_CONTROLPARENT = 0x00010000;
|
||||||
|
public const int WS_EX_STATICEDGE = 0x00020000;
|
||||||
|
public const int WS_EX_APPWINDOW = 0x00040000;
|
||||||
public const int WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE;
|
public const int WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE;
|
||||||
public const int WS_EX_NOACTIVATE = 0x8000000;
|
public const int WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
|
||||||
|
public const int WS_EX_LAYERED = 0x00080000;
|
||||||
|
public const int WS_EX_NOINHERITLAYOUT = 0x00100000;
|
||||||
|
public const int WS_EX_LAYOUTRTL = 0x00400000;
|
||||||
|
public const int WS_EX_COMPOSITED = 0x02000000;
|
||||||
|
public const int WS_EX_NOACTIVATE = 0x08000000;
|
||||||
|
|
||||||
public const uint LWA_COLORKEY = 0x1;
|
public const uint LWA_COLORKEY = 0x1;
|
||||||
public const uint LWA_ALPHA = 0x2;
|
public const uint LWA_ALPHA = 0x2;
|
||||||
@@ -42,12 +81,23 @@ namespace SpineViewer.Natives
|
|||||||
public const int ULW_ALPHA = 0x00000002;
|
public const int ULW_ALPHA = 0x00000002;
|
||||||
public const int ULW_OPAQUE = 0x00000004;
|
public const int ULW_OPAQUE = 0x00000004;
|
||||||
|
|
||||||
public const nint HWND_TOPMOST = -1;
|
public const IntPtr HWND_TOPMOST = -1;
|
||||||
|
|
||||||
public const uint SWP_NOSIZE = 0x0001;
|
public const uint SWP_ASYNCWINDOWPOS = 0x4000;
|
||||||
public const uint SWP_NOMOVE = 0x0002;
|
public const uint SWP_DEFERERASE = 0x2000;
|
||||||
public const uint SWP_NOZORDER = 0x0004;
|
public const uint SWP_NOSENDCHANGING = 0x0400;
|
||||||
|
public const uint SWP_NOOWNERZORDER = 0x0200;
|
||||||
|
public const uint SWP_NOREPOSITION = 0x0200;
|
||||||
|
public const uint SWP_NOCOPYBITS = 0x0100;
|
||||||
|
public const uint SWP_HIDEWINDOW = 0x0080;
|
||||||
|
public const uint SWP_SHOWWINDOW = 0x0040;
|
||||||
|
public const uint SWP_DRAWFRAME = 0x0020;
|
||||||
public const uint SWP_FRAMECHANGED = 0x0020;
|
public const uint SWP_FRAMECHANGED = 0x0020;
|
||||||
|
public const uint SWP_NOACTIVATE = 0x0010;
|
||||||
|
public const uint SWP_NOREDRAW = 0x0008;
|
||||||
|
public const uint SWP_NOZORDER = 0x0004;
|
||||||
|
public const uint SWP_NOMOVE = 0x0002;
|
||||||
|
public const uint SWP_NOSIZE = 0x0001;
|
||||||
|
|
||||||
public const int WM_SPAWN_WORKER = 0x052C; // 一个未公开的神秘消息
|
public const int WM_SPAWN_WORKER = 0x052C; // 一个未公开的神秘消息
|
||||||
|
|
||||||
@@ -72,6 +122,8 @@ namespace SpineViewer.Natives
|
|||||||
public const int SW_RESTORE = 9;
|
public const int SW_RESTORE = 9;
|
||||||
public const int SW_SHOWDEFAULT = 10;
|
public const int SW_SHOWDEFAULT = 10;
|
||||||
|
|
||||||
|
public const uint MONITOR_DEFAULTTONULL = 0;
|
||||||
|
public const uint MONITOR_DEFAULTTOPRIMARY = 1;
|
||||||
public const uint MONITOR_DEFAULTTONEAREST = 2;
|
public const uint MONITOR_DEFAULTTONEAREST = 2;
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
@@ -124,29 +176,25 @@ namespace SpineViewer.Natives
|
|||||||
public string szDevice;
|
public string szDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
|
||||||
public static extern nint GetDC(nint hWnd);
|
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern int ReleaseDC(nint hWnd, nint hDC);
|
public static extern IntPtr GetDC(IntPtr hWnd);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern int SetWindowLong(nint hWnd, int nIndex, int dwNewLong);
|
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern int GetWindowLong(nint hWnd, int nIndex);
|
public static extern bool GetLayeredWindowAttributes(IntPtr hWnd, ref uint crKey, ref byte bAlpha, ref uint dwFlags);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern bool GetLayeredWindowAttributes(nint hWnd, ref uint crKey, ref byte bAlpha, ref uint dwFlags);
|
public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, uint pcrKey, byte pbAlpha, uint pdwFlags);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern bool SetLayeredWindowAttributes(nint hWnd, uint pcrKey, byte pbAlpha, uint pdwFlags);
|
public static extern bool UpdateLayeredWindow(IntPtr hWnd, IntPtr hdcDst, IntPtr pptDst, ref SIZE psize, IntPtr hdcSrc, ref POINT pptSrc, int crKey, ref BLENDFUNCTION pblend, int dwFlags);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern bool UpdateLayeredWindow(nint hWnd, nint hdcDst, nint pptDst, ref SIZE psize, nint hdcSrc, ref POINT pptSrc, int crKey, ref BLENDFUNCTION pblend, int dwFlags);
|
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
|
||||||
public static extern bool SetWindowPos(nint hWnd, nint hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern uint GetDoubleClickTime();
|
public static extern uint GetDoubleClickTime();
|
||||||
@@ -155,28 +203,34 @@ namespace SpineViewer.Natives
|
|||||||
private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
|
private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern nint FindWindow(string lpClassName, string lpWindowName);
|
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern nint SendMessageTimeout(nint hWnd, uint Msg, nint wParam, nint lParam, uint fuFlags, uint uTimeout, out nint lpdwResult);
|
public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam, uint fuFlags, uint uTimeout, out IntPtr lpdwResult);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern nint FindWindowEx(nint parentHandle, nint childAfter, string className, string windowTitle);
|
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern nint SetParent(nint hWndChild, nint hWndNewParent);
|
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern nint GetParent(nint hWnd);
|
public static extern IntPtr GetParent(IntPtr hWnd);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern nint GetAncestor(nint hWnd, uint gaFlags);
|
public static extern IntPtr GetAncestor(IntPtr hWnd, uint gaFlags);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern nint GetWindow(nint hWnd, uint uCmd);
|
public static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern bool ShowWindow(nint hWnd, int nCmdShow);
|
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport("User32.dll")]
|
||||||
|
public static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern bool IsIconic(IntPtr hWnd);
|
public static extern bool IsIconic(IntPtr hWnd);
|
||||||
@@ -190,6 +244,12 @@ namespace SpineViewer.Natives
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFOEX lpmi);
|
private static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFOEX lpmi);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||||
|
|
||||||
public static TimeSpan GetLastInputElapsedTime()
|
public static TimeSpan GetLastInputElapsedTime()
|
||||||
{
|
{
|
||||||
LASTINPUTINFO lastInputInfo = new();
|
LASTINPUTINFO lastInputInfo = new();
|
||||||
@@ -205,14 +265,59 @@ namespace SpineViewer.Natives
|
|||||||
return TimeSpan.FromMilliseconds(idleTimeMillis);
|
return TimeSpan.FromMilliseconds(idleTimeMillis);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static nint GetWorkerW()
|
public static IntPtr GetWorkerW()
|
||||||
{
|
{
|
||||||
|
// NOTE: Codes borrowed from @rocksdanister/lively
|
||||||
|
|
||||||
var progman = FindWindow("Progman", null);
|
var progman = FindWindow("Progman", null);
|
||||||
if (progman == nint.Zero)
|
if (progman == IntPtr.Zero)
|
||||||
return nint.Zero;
|
return IntPtr.Zero;
|
||||||
nint hWnd = FindWindowEx(progman, 0, "WorkerW", null);
|
|
||||||
Debug.WriteLine($"HWND(Progman.WorkerW): {hWnd:x8}");
|
// Send 0x052C to Progman. This message directs Progman to spawn a
|
||||||
return hWnd;
|
// WorkerW behind the desktop icons. If it is already there, nothing
|
||||||
|
// happens.
|
||||||
|
SendMessageTimeout(progman, WM_SPAWN_WORKER, 0, 0, SMTO_NORMAL, 1000, out _);
|
||||||
|
|
||||||
|
// Spy++ output
|
||||||
|
// .....
|
||||||
|
// 0x00010190 "" WorkerW
|
||||||
|
// ...
|
||||||
|
// 0x000100EE "" SHELLDLL_DefView
|
||||||
|
// 0x000100F0 "FolderView" SysListView32
|
||||||
|
// 0x00100B8A "" WorkerW <-- This is the WorkerW instance we are after!
|
||||||
|
// 0x000100EC "Program Manager" Progman
|
||||||
|
var workerw = IntPtr.Zero;
|
||||||
|
|
||||||
|
// We enumerate all Windows, until we find one, that has the SHELLDLL_DefView
|
||||||
|
// as a child.
|
||||||
|
// If we found that window, we take its next sibling and assign it to workerw.
|
||||||
|
EnumWindows(new EnumWindowsProc((tophandle, topparamhandle) =>
|
||||||
|
{
|
||||||
|
IntPtr p = FindWindowEx(tophandle, IntPtr.Zero, "SHELLDLL_DefView", null);
|
||||||
|
|
||||||
|
if (p != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
// Gets the WorkerW Window after the current one.
|
||||||
|
workerw = FindWindowEx(IntPtr.Zero, tophandle, "WorkerW", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}), IntPtr.Zero);
|
||||||
|
|
||||||
|
// Some Windows 11 builds have a different Progman window layout.
|
||||||
|
// If the above code failed to find WorkerW, we should try this.
|
||||||
|
// Spy++ output
|
||||||
|
// 0x000100EC "Program Manager" Progman
|
||||||
|
// 0x000100EE "" SHELLDLL_DefView
|
||||||
|
// 0x000100F0 "FolderView" SysListView32
|
||||||
|
// 0x00100B8A "" WorkerW <-- This is the WorkerW instance we are after!
|
||||||
|
if (workerw == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
workerw = FindWindowEx(progman, IntPtr.Zero, "WorkerW", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.WriteLine($"HWND(WorkerW): {workerw:x8}");
|
||||||
|
return workerw;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool GetScreenResolution(IntPtr hwnd, out uint width, out uint height)
|
public static bool GetScreenResolution(IntPtr hwnd, out uint width, out uint height)
|
||||||
@@ -231,5 +336,22 @@ namespace SpineViewer.Natives
|
|||||||
width = height = 0;
|
width = height = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool GetPrimaryScreenResolution(out uint width, out uint height)
|
||||||
|
{
|
||||||
|
IntPtr hMon = MonitorFromWindow(IntPtr.Zero, MONITOR_DEFAULTTOPRIMARY);
|
||||||
|
|
||||||
|
var mi = new MONITORINFOEX { cbSize = (uint)Marshal.SizeOf<MONITORINFOEX>() };
|
||||||
|
if (GetMonitorInfo(hMon, ref mi))
|
||||||
|
{
|
||||||
|
int widthPx = mi.rcMonitor.Right - mi.rcMonitor.Left;
|
||||||
|
int heightPx = mi.rcMonitor.Bottom - mi.rcMonitor.Top;
|
||||||
|
width = (uint)widthPx;
|
||||||
|
height = (uint)heightPx;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
width = height = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ namespace SpineViewer.Resources
|
|||||||
public static string Str_TooManyItemsToAddQuest => Get<string>("Str_TooManyItemsToAddQuest");
|
public static string Str_TooManyItemsToAddQuest => Get<string>("Str_TooManyItemsToAddQuest");
|
||||||
public static string Str_RemoveItemsQuest => Get<string>("Str_RemoveItemsQuest");
|
public static string Str_RemoveItemsQuest => Get<string>("Str_RemoveItemsQuest");
|
||||||
public static string Str_DeleteItemsQuest => Get<string>("Str_DeleteItemsQuest");
|
public static string Str_DeleteItemsQuest => Get<string>("Str_DeleteItemsQuest");
|
||||||
|
public static string Str_CloseToTrayQuest => Get<string>("Str_CloseToTrayQuest");
|
||||||
|
|
||||||
public static string Str_FrameExporterTitle => Get<string>("Str_FrameExporterTitle");
|
public static string Str_FrameExporterTitle => Get<string>("Str_FrameExporterTitle");
|
||||||
public static string Str_FrameSequenceExporterTitle => Get<string>("Str_FrameSequenceExporterTitle");
|
public static string Str_FrameSequenceExporterTitle => Get<string>("Str_FrameSequenceExporterTitle");
|
||||||
|
|||||||
@@ -118,6 +118,7 @@
|
|||||||
<s:String x:Key="Str_MaxFps">Max FPS</s:String>
|
<s:String x:Key="Str_MaxFps">Max FPS</s:String>
|
||||||
<s:String x:Key="Str_MaxFpsTooltip">Maximum frame rate of the preview. Set to 0 for no limit.</s:String>
|
<s:String x:Key="Str_MaxFpsTooltip">Maximum frame rate of the preview. Set to 0 for no limit.</s:String>
|
||||||
<s:String x:Key="Str_PlaySpeed">Playback Speed</s:String>
|
<s:String x:Key="Str_PlaySpeed">Playback Speed</s:String>
|
||||||
|
<s:String x:Key="Str_WallpaperView">Wallpaper View</s:String>
|
||||||
<s:String x:Key="Str_RenderSelectedOnly">Render Selected Only</s:String>
|
<s:String x:Key="Str_RenderSelectedOnly">Render Selected Only</s:String>
|
||||||
<s:String x:Key="Str_ShowAxis">Show Axis</s:String>
|
<s:String x:Key="Str_ShowAxis">Show Axis</s:String>
|
||||||
<s:String x:Key="Str_BackgroundColor">Background Color</s:String>
|
<s:String x:Key="Str_BackgroundColor">Background Color</s:String>
|
||||||
@@ -148,6 +149,7 @@
|
|||||||
<s:String x:Key="Str_TooManyItemsToAddQuest">{0} items total, add all at once?</s:String>
|
<s:String x:Key="Str_TooManyItemsToAddQuest">{0} items total, add all at once?</s:String>
|
||||||
<s:String x:Key="Str_RemoveItemsQuest">Remove {0} items?</s:String>
|
<s:String x:Key="Str_RemoveItemsQuest">Remove {0} items?</s:String>
|
||||||
<s:String x:Key="Str_DeleteItemsQuest">Delete {0} items?</s:String>
|
<s:String x:Key="Str_DeleteItemsQuest">Delete {0} items?</s:String>
|
||||||
|
<s:String x:Key="Str_CloseToTrayQuest" xml:space="preserve">You clicked the close button. Do you want to minimize to the tray icon instead of closing the application directly?
(If you choose Yes, the window will be minimized to the tray and can be restored by double-clicking the icon. You can change this option later in the application preferences.)</s:String>
|
||||||
|
|
||||||
<!-- 导出对话框弹窗文本 -->
|
<!-- 导出对话框弹窗文本 -->
|
||||||
<s:String x:Key="Str_FrameExporterTitle">Export Single Frame</s:String>
|
<s:String x:Key="Str_FrameExporterTitle">Export Single Frame</s:String>
|
||||||
@@ -236,7 +238,11 @@
|
|||||||
<s:String x:Key="Str_RendererPreference">Preview Options</s:String>
|
<s:String x:Key="Str_RendererPreference">Preview Options</s:String>
|
||||||
|
|
||||||
<s:String x:Key="Str_AppPreference">Application Options</s:String>
|
<s:String x:Key="Str_AppPreference">Application Options</s:String>
|
||||||
<s:String x:Key="Str_AssociateFileSuffix">Associate File Extension</s:String>
|
|
||||||
<s:String x:Key="Str_Language">Language</s:String>
|
<s:String x:Key="Str_Language">Language</s:String>
|
||||||
|
<s:String x:Key="Str_CloseToTray">Minimize to tray when closing</s:String>
|
||||||
|
<s:String x:Key="Str_AutoRun">Auto Start</s:String>
|
||||||
|
<s:String x:Key="Str_AutoRunWorkspaceConfigPath">Auto-load Workspace File on Startup</s:String>
|
||||||
|
<s:String x:Key="Str_AutoRunWorkspaceConfigPathTooltip">Specifies the workspace configuration file to be automatically loaded when the program starts with Windows startup. This takes effect only if auto-startup is enabled.</s:String>
|
||||||
|
<s:String x:Key="Str_AssociateFileSuffix">Associate File Extension</s:String>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|||||||
@@ -118,6 +118,7 @@
|
|||||||
<s:String x:Key="Str_MaxFps">最大FPS</s:String>
|
<s:String x:Key="Str_MaxFps">最大FPS</s:String>
|
||||||
<s:String x:Key="Str_MaxFpsTooltip">プレビュー画面の最大フレームレート。0 に設定すると制限なし。</s:String>
|
<s:String x:Key="Str_MaxFpsTooltip">プレビュー画面の最大フレームレート。0 に設定すると制限なし。</s:String>
|
||||||
<s:String x:Key="Str_PlaySpeed">再生速度</s:String>
|
<s:String x:Key="Str_PlaySpeed">再生速度</s:String>
|
||||||
|
<s:String x:Key="Str_WallpaperView">壁紙表示</s:String>
|
||||||
<s:String x:Key="Str_RenderSelectedOnly">選択のみレンダリング</s:String>
|
<s:String x:Key="Str_RenderSelectedOnly">選択のみレンダリング</s:String>
|
||||||
<s:String x:Key="Str_ShowAxis">座標軸を表示</s:String>
|
<s:String x:Key="Str_ShowAxis">座標軸を表示</s:String>
|
||||||
<s:String x:Key="Str_BackgroundColor">背景色</s:String>
|
<s:String x:Key="Str_BackgroundColor">背景色</s:String>
|
||||||
@@ -148,6 +149,7 @@
|
|||||||
<s:String x:Key="Str_TooManyItemsToAddQuest">全{0}件、一度に追加しますか?</s:String>
|
<s:String x:Key="Str_TooManyItemsToAddQuest">全{0}件、一度に追加しますか?</s:String>
|
||||||
<s:String x:Key="Str_RemoveItemsQuest">{0}件を削除してもよろしいですか?</s:String>
|
<s:String x:Key="Str_RemoveItemsQuest">{0}件を削除してもよろしいですか?</s:String>
|
||||||
<s:String x:Key="Str_DeleteItemsQuest">{0}件を削除してもよろしいですか?</s:String>
|
<s:String x:Key="Str_DeleteItemsQuest">{0}件を削除してもよろしいですか?</s:String>
|
||||||
|
<s:String x:Key="Str_CloseToTrayQuest" xml:space="preserve">閉じるボタンをクリックしました。アプリケーションを直接終了するのではなく、通知領域のアイコンに最小化しますか?
(「はい」を選択すると、ウィンドウは通知領域に最小化され、アイコンをダブルクリックすると復元できます。この設定は後でアプリケーションの環境設定から変更できます。)</s:String>
|
||||||
|
|
||||||
<!-- 导出对话框弹窗文本 -->
|
<!-- 导出对话框弹窗文本 -->
|
||||||
<s:String x:Key="Str_FrameExporterTitle">単一フレームをエクスポート</s:String>
|
<s:String x:Key="Str_FrameExporterTitle">単一フレームをエクスポート</s:String>
|
||||||
@@ -236,8 +238,12 @@
|
|||||||
<s:String x:Key="Str_RendererPreference">プレビュー画面オプション</s:String>
|
<s:String x:Key="Str_RendererPreference">プレビュー画面オプション</s:String>
|
||||||
|
|
||||||
<s:String x:Key="Str_AppPreference">アプリケーションプション</s:String>
|
<s:String x:Key="Str_AppPreference">アプリケーションプション</s:String>
|
||||||
<s:String x:Key="Str_AssociateFileSuffix">ファイル拡張子を関連付ける</s:String>
|
|
||||||
<s:String x:Key="Str_Language">言語</s:String>
|
<s:String x:Key="Str_Language">言語</s:String>
|
||||||
|
<s:String x:Key="Str_CloseToTray">閉じるときにトレイに最小化する</s:String>
|
||||||
|
<s:String x:Key="Str_AutoRun">自動起動</s:String>
|
||||||
|
<s:String x:Key="Str_AutoRunWorkspaceConfigPath">起動時にワークスペースファイルを自動読み込み</s:String>
|
||||||
|
<s:String x:Key="Str_AutoRunWorkspaceConfigPathTooltip">プログラムが Windows 起動と同時に自動起動した場合に、自動的に読み込むワークスペース設定ファイルを指定します。自動起動が有効な場合にのみ適用されます。</s:String>
|
||||||
|
<s:String x:Key="Str_AssociateFileSuffix">ファイル拡張子を関連付ける</s:String>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,7 @@
|
|||||||
<s:String x:Key="Str_MaxFps">最大帧率</s:String>
|
<s:String x:Key="Str_MaxFps">最大帧率</s:String>
|
||||||
<s:String x:Key="Str_MaxFpsTooltip">预览画面的最大帧率,设置为 0 时则无帧率限制</s:String>
|
<s:String x:Key="Str_MaxFpsTooltip">预览画面的最大帧率,设置为 0 时则无帧率限制</s:String>
|
||||||
<s:String x:Key="Str_PlaySpeed">播放速度</s:String>
|
<s:String x:Key="Str_PlaySpeed">播放速度</s:String>
|
||||||
|
<s:String x:Key="Str_WallpaperView">桌面投影</s:String>
|
||||||
<s:String x:Key="Str_RenderSelectedOnly">仅渲染选中</s:String>
|
<s:String x:Key="Str_RenderSelectedOnly">仅渲染选中</s:String>
|
||||||
<s:String x:Key="Str_ShowAxis">显示坐标轴</s:String>
|
<s:String x:Key="Str_ShowAxis">显示坐标轴</s:String>
|
||||||
<s:String x:Key="Str_BackgroundColor">背景颜色</s:String>
|
<s:String x:Key="Str_BackgroundColor">背景颜色</s:String>
|
||||||
@@ -148,6 +149,7 @@
|
|||||||
<s:String x:Key="Str_TooManyItemsToAddQuest">共 {0} 项,是否一次性添加?</s:String>
|
<s:String x:Key="Str_TooManyItemsToAddQuest">共 {0} 项,是否一次性添加?</s:String>
|
||||||
<s:String x:Key="Str_RemoveItemsQuest">确定移除 {0} 项?</s:String>
|
<s:String x:Key="Str_RemoveItemsQuest">确定移除 {0} 项?</s:String>
|
||||||
<s:String x:Key="Str_DeleteItemsQuest">确定删除 {0} 项?</s:String>
|
<s:String x:Key="Str_DeleteItemsQuest">确定删除 {0} 项?</s:String>
|
||||||
|
<s:String x:Key="Str_CloseToTrayQuest" xml:space="preserve">您点击了关闭按钮,是否需要最小化至托盘图标而不是直接关闭?
(选是则最小化至托盘图标,可以通过双击图标还原窗口,以后也可以在程序首选项中重新设置该选项)</s:String>
|
||||||
|
|
||||||
<!-- 导出对话框弹窗文本 -->
|
<!-- 导出对话框弹窗文本 -->
|
||||||
<s:String x:Key="Str_FrameExporterTitle">导出单帧</s:String>
|
<s:String x:Key="Str_FrameExporterTitle">导出单帧</s:String>
|
||||||
@@ -236,7 +238,11 @@
|
|||||||
<s:String x:Key="Str_RendererPreference">预览画面选项</s:String>
|
<s:String x:Key="Str_RendererPreference">预览画面选项</s:String>
|
||||||
|
|
||||||
<s:String x:Key="Str_AppPreference">应用程序选项</s:String>
|
<s:String x:Key="Str_AppPreference">应用程序选项</s:String>
|
||||||
<s:String x:Key="Str_AssociateFileSuffix">关联文件后缀</s:String>
|
|
||||||
<s:String x:Key="Str_Language">语言</s:String>
|
<s:String x:Key="Str_Language">语言</s:String>
|
||||||
|
<s:String x:Key="Str_CloseToTray">关闭时最小化至托盘图标</s:String>
|
||||||
|
<s:String x:Key="Str_AutoRun">开机自启</s:String>
|
||||||
|
<s:String x:Key="Str_AutoRunWorkspaceConfigPath">自启动加载工作区文件</s:String>
|
||||||
|
<s:String x:Key="Str_AutoRunWorkspaceConfigPathTooltip">设置程序开机自启后自动加载的工作区配置文件,仅在启用开机自启时生效</s:String>
|
||||||
|
<s:String x:Key="Str_AssociateFileSuffix">关联文件后缀</s:String>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -28,10 +28,16 @@ namespace SpineViewer.Services
|
|||||||
MessageBox.Show(text, title, MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show(text, title, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Quest(string text, string? title = null)
|
public static bool OKCancel(string text, string? title = null)
|
||||||
{
|
{
|
||||||
title ??= AppResource.Str_QuestPopup;
|
title ??= AppResource.Str_QuestPopup;
|
||||||
return MessageBox.Show(text, title, MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK;
|
return MessageBox.Show(text, title, MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool YesNo(string text, string? title = null)
|
||||||
|
{
|
||||||
|
title ??= AppResource.Str_QuestPopup;
|
||||||
|
return MessageBox.Show(text, title, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
|
||||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||||
<Version>0.15.18</Version>
|
<Version>0.16.0</Version>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
private void DeletePreview_Execute(IList? args)
|
private void DeletePreview_Execute(IList? args)
|
||||||
{
|
{
|
||||||
if (args is null || args.Count <= 0) return;
|
if (args is null || args.Count <= 0) return;
|
||||||
if (!MessagePopupService.Quest(string.Format(AppResource.Str_DeleteItemsQuest, args.Count))) return;
|
if (!MessagePopupService.OKCancel(string.Format(AppResource.Str_DeleteItemsQuest, args.Count))) return;
|
||||||
|
|
||||||
if (args.Count <= 10)
|
if (args.Count <= 10)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
{
|
{
|
||||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public MainWindowViewModel(ISFMLRenderer sfmlRenderer)
|
public MainWindowViewModel(ISFMLRenderer sfmlRenderer, ISFMLRenderer wallpaperRenderer)
|
||||||
{
|
{
|
||||||
_sfmlRenderer = sfmlRenderer;
|
_sfmlRenderer = sfmlRenderer;
|
||||||
|
_wallpaperRenderer = wallpaperRenderer;
|
||||||
_explorerListViewModel = new(this);
|
_explorerListViewModel = new(this);
|
||||||
_spineObjectListViewModel = new(this);
|
_spineObjectListViewModel = new(this);
|
||||||
_sfmlRendererViewModel = new(this);
|
_sfmlRendererViewModel = new(this);
|
||||||
@@ -28,12 +29,35 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
|
|
||||||
public string Title => $"SpineViewer - v{App.Version}";
|
public string Title => $"SpineViewer - v{App.Version}";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指示是否通过托盘图标进行退出
|
||||||
|
/// </summary>
|
||||||
|
public bool IsShuttingDownFromTray => _isShuttingDownFromTray;
|
||||||
|
private bool _isShuttingDownFromTray;
|
||||||
|
|
||||||
|
public bool? CloseToTray
|
||||||
|
{
|
||||||
|
get => _closeToTray;
|
||||||
|
set => SetProperty(ref _closeToTray, value);
|
||||||
|
}
|
||||||
|
private bool? _closeToTray = null;
|
||||||
|
|
||||||
|
public string AutoRunWorkspaceConfigPath
|
||||||
|
{
|
||||||
|
get => _autoRunWorkspaceConfigPath;
|
||||||
|
set => SetProperty(ref _autoRunWorkspaceConfigPath, value);
|
||||||
|
}
|
||||||
|
private string _autoRunWorkspaceConfigPath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SFML 渲染对象
|
/// SFML 渲染对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ISFMLRenderer SFMLRenderer => _sfmlRenderer;
|
public ISFMLRenderer SFMLRenderer => _sfmlRenderer;
|
||||||
private readonly ISFMLRenderer _sfmlRenderer;
|
private readonly ISFMLRenderer _sfmlRenderer;
|
||||||
|
|
||||||
|
public ISFMLRenderer WallpaperRenderer => _wallpaperRenderer;
|
||||||
|
private readonly ISFMLRenderer _wallpaperRenderer;
|
||||||
|
|
||||||
public TaskbarItemProgressState ProgressState { get => _progressState; set => SetProperty(ref _progressState, value); }
|
public TaskbarItemProgressState ProgressState { get => _progressState; set => SetProperty(ref _progressState, value); }
|
||||||
private TaskbarItemProgressState _progressState = TaskbarItemProgressState.None;
|
private TaskbarItemProgressState _progressState = TaskbarItemProgressState.None;
|
||||||
|
|
||||||
@@ -46,6 +70,9 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
public ObservableCollectionWithLock<SpineObjectModel> SpineObjects => _spineObjectModels;
|
public ObservableCollectionWithLock<SpineObjectModel> SpineObjects => _spineObjectModels;
|
||||||
private readonly ObservableCollectionWithLock<SpineObjectModel> _spineObjectModels = [];
|
private readonly ObservableCollectionWithLock<SpineObjectModel> _spineObjectModels = [];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 首选项 ViewModel
|
||||||
|
/// </summary>
|
||||||
public PreferenceViewModel PreferenceViewModel => _preferenceViewModel;
|
public PreferenceViewModel PreferenceViewModel => _preferenceViewModel;
|
||||||
private readonly PreferenceViewModel _preferenceViewModel;
|
private readonly PreferenceViewModel _preferenceViewModel;
|
||||||
|
|
||||||
@@ -73,7 +100,20 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
public SFMLRendererViewModel SFMLRendererViewModel => _sfmlRendererViewModel;
|
public SFMLRendererViewModel SFMLRendererViewModel => _sfmlRendererViewModel;
|
||||||
private readonly SFMLRendererViewModel _sfmlRendererViewModel;
|
private readonly SFMLRendererViewModel _sfmlRendererViewModel;
|
||||||
|
|
||||||
public RelayCommand Cmd_Exit => new(App.Current.Shutdown);
|
public RelayCommand Cmd_SwitchWallpaperView => _cmd_SwitchWallpaperView ??= new(() =>
|
||||||
|
{
|
||||||
|
_preferenceViewModel.WallpaperView = !_preferenceViewModel.WallpaperView;
|
||||||
|
_preferenceViewModel.SavePreference();
|
||||||
|
});
|
||||||
|
private RelayCommand _cmd_SwitchWallpaperView;
|
||||||
|
|
||||||
|
public RelayCommand Cmd_ExitFromTray => _cmd_ExitFromTray ??= new(() =>
|
||||||
|
{
|
||||||
|
_isShuttingDownFromTray = true;
|
||||||
|
OnPropertyChanged(nameof(IsShuttingDownFromTray));
|
||||||
|
App.Current.Shutdown();
|
||||||
|
});
|
||||||
|
private RelayCommand? _cmd_ExitFromTray;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 打开工作区
|
/// 打开工作区
|
||||||
@@ -134,18 +174,5 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 调试命令
|
|
||||||
/// </summary>
|
|
||||||
public RelayCommand Cmd_Debug => _cmd_Debug ??= new(Debug_Execute);
|
|
||||||
private RelayCommand? _cmd_Debug;
|
|
||||||
|
|
||||||
private void Debug_Execute()
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
|
|
||||||
MessagePopupService.Quest("测试一下");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,10 +26,6 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly string PreferenceFilePath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "preference.json");
|
public static readonly string PreferenceFilePath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "preference.json");
|
||||||
|
|
||||||
private static readonly string SkelFileDescription = "SpineViewer File";
|
|
||||||
private static readonly string SkelIconFilePath = Path.Combine(App.ProcessDirectory, "Resources\\Images\\skel.ico");
|
|
||||||
private static readonly string ShellOpenCommand = $"\"{App.ProcessPath}\" \"%1\"";
|
|
||||||
|
|
||||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
private readonly MainWindowViewModel _vmMain;
|
private readonly MainWindowViewModel _vmMain;
|
||||||
@@ -111,9 +107,13 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
DebugPoints = DebugPoints,
|
DebugPoints = DebugPoints,
|
||||||
DebugClippings = DebugClippings,
|
DebugClippings = DebugClippings,
|
||||||
|
|
||||||
RenderSelectedOnly = RenderSelectedOnly,
|
|
||||||
AssociateFileSuffix = AssociateFileSuffix,
|
|
||||||
AppLanguage = AppLanguage,
|
AppLanguage = AppLanguage,
|
||||||
|
RenderSelectedOnly = RenderSelectedOnly,
|
||||||
|
WallpaperView = WallpaperView,
|
||||||
|
CloseToTray = CloseToTray,
|
||||||
|
AutoRun = AutoRun,
|
||||||
|
AutoRunWorkspaceConfigPath = AutoRunWorkspaceConfigPath,
|
||||||
|
AssociateFileSuffix = AssociateFileSuffix,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -136,9 +136,13 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
DebugPoints = value.DebugPoints;
|
DebugPoints = value.DebugPoints;
|
||||||
DebugClippings = value.DebugClippings;
|
DebugClippings = value.DebugClippings;
|
||||||
|
|
||||||
RenderSelectedOnly = value.RenderSelectedOnly;
|
|
||||||
AssociateFileSuffix = value.AssociateFileSuffix;
|
|
||||||
AppLanguage = value.AppLanguage;
|
AppLanguage = value.AppLanguage;
|
||||||
|
RenderSelectedOnly = value.RenderSelectedOnly;
|
||||||
|
WallpaperView = value.WallpaperView;
|
||||||
|
CloseToTray = value.CloseToTray;
|
||||||
|
AutoRun = value.AutoRun;
|
||||||
|
AutoRunWorkspaceConfigPath = value.AutoRunWorkspaceConfigPath;
|
||||||
|
AssociateFileSuffix = value.AssociateFileSuffix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,83 +248,48 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
|
|
||||||
public static ImmutableArray<AppLanguage> AppLanguageOptions { get; } = Enum.GetValues<AppLanguage>().ToImmutableArray();
|
public static ImmutableArray<AppLanguage> AppLanguageOptions { get; } = Enum.GetValues<AppLanguage>().ToImmutableArray();
|
||||||
|
|
||||||
public bool RenderSelectedOnly
|
|
||||||
{
|
|
||||||
get => _vmMain.SFMLRendererViewModel.RenderSelectedOnly;
|
|
||||||
set => SetProperty(_vmMain.SFMLRendererViewModel.RenderSelectedOnly, value, v => _vmMain.SFMLRendererViewModel.RenderSelectedOnly = v);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AssociateFileSuffix
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// 检查 .skel 的 ProgID
|
|
||||||
using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Classes\.skel"))
|
|
||||||
{
|
|
||||||
var progIdValue = key?.GetValue("") as string;
|
|
||||||
if (!string.Equals(progIdValue, App.ProgId, StringComparison.OrdinalIgnoreCase))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查 command 指令是否相同
|
|
||||||
using (var key = Registry.CurrentUser.OpenSubKey($@"Software\Classes\{App.ProgId}\shell\open\command"))
|
|
||||||
{
|
|
||||||
var command = key?.GetValue("") as string;
|
|
||||||
if (string.IsNullOrWhiteSpace(command))
|
|
||||||
return false;
|
|
||||||
return command == ShellOpenCommand;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(AssociateFileSuffix, value, v =>
|
|
||||||
{
|
|
||||||
if (v)
|
|
||||||
{
|
|
||||||
// 文件关联
|
|
||||||
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Classes\.skel"))
|
|
||||||
{
|
|
||||||
key?.SetValue("", App.ProgId);
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var key = Registry.CurrentUser.CreateSubKey($@"Software\Classes\{App.ProgId}"))
|
|
||||||
{
|
|
||||||
key?.SetValue("", SkelFileDescription);
|
|
||||||
using (var iconKey = key?.CreateSubKey("DefaultIcon"))
|
|
||||||
{
|
|
||||||
iconKey?.SetValue("", $"\"{SkelIconFilePath}\"");
|
|
||||||
}
|
|
||||||
using (var shellKey = key?.CreateSubKey(@"shell\open\command"))
|
|
||||||
{
|
|
||||||
shellKey?.SetValue("", ShellOpenCommand);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 删除关联
|
|
||||||
Registry.CurrentUser.DeleteSubKeyTree(@"Software\Classes\.skel", false);
|
|
||||||
Registry.CurrentUser.DeleteSubKeyTree($@"Software\Classes\{App.ProgId}", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Shell32.NotifyAssociationChanged();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AppLanguage AppLanguage
|
public AppLanguage AppLanguage
|
||||||
{
|
{
|
||||||
get => ((App)App.Current).Language;
|
get => ((App)App.Current).Language;
|
||||||
set => SetProperty(((App)App.Current).Language, value, v => ((App)App.Current).Language = v);
|
set => SetProperty(((App)App.Current).Language, value, v => ((App)App.Current).Language = v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool RenderSelectedOnly
|
||||||
|
{
|
||||||
|
get => _vmMain.SFMLRendererViewModel.RenderSelectedOnly;
|
||||||
|
set => SetProperty(_vmMain.SFMLRendererViewModel.RenderSelectedOnly, value, v => _vmMain.SFMLRendererViewModel.RenderSelectedOnly = v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool WallpaperView
|
||||||
|
{
|
||||||
|
get => _vmMain.SFMLRendererViewModel.WallpaperView;
|
||||||
|
set => SetProperty(_vmMain.SFMLRendererViewModel.WallpaperView, value, v => _vmMain.SFMLRendererViewModel.WallpaperView = v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool? CloseToTray
|
||||||
|
{
|
||||||
|
get => _vmMain.CloseToTray;
|
||||||
|
set => SetProperty(_vmMain.CloseToTray, value, v => _vmMain.CloseToTray = v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AutoRun
|
||||||
|
{
|
||||||
|
get => ((App)App.Current).AutoRun;
|
||||||
|
set => SetProperty(((App)App.Current).AutoRun, value, v => ((App)App.Current).AutoRun = v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AutoRunWorkspaceConfigPath
|
||||||
|
{
|
||||||
|
get => _vmMain.AutoRunWorkspaceConfigPath;
|
||||||
|
set => SetProperty(_vmMain.AutoRunWorkspaceConfigPath, value, v => _vmMain.AutoRunWorkspaceConfigPath = v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AssociateFileSuffix
|
||||||
|
{
|
||||||
|
get => ((App)App.Current).AssociateFileSuffix;
|
||||||
|
set => SetProperty(((App)App.Current).AssociateFileSuffix, value, v => ((App)App.Current).AssociateFileSuffix = v);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
private readonly MainWindowViewModel _vmMain;
|
private readonly MainWindowViewModel _vmMain;
|
||||||
private readonly ObservableCollectionWithLock<SpineObjectModel> _models;
|
private readonly ObservableCollectionWithLock<SpineObjectModel> _models;
|
||||||
private readonly ISFMLRenderer _renderer;
|
private readonly ISFMLRenderer _renderer;
|
||||||
|
private readonly ISFMLRenderer _wallpaperRenderer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 被选中对象的背景颜色
|
/// 被选中对象的背景颜色
|
||||||
@@ -90,6 +91,7 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
_vmMain = vmMain;
|
_vmMain = vmMain;
|
||||||
_models = _vmMain.SpineObjects;
|
_models = _vmMain.SpineObjects;
|
||||||
_renderer = _vmMain.SFMLRenderer;
|
_renderer = _vmMain.SFMLRenderer;
|
||||||
|
_wallpaperRenderer = _vmMain.WallpaperRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -238,6 +240,13 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
}
|
}
|
||||||
private Stretch _backgroundImageMode = Stretch.Uniform;
|
private Stretch _backgroundImageMode = Stretch.Uniform;
|
||||||
|
|
||||||
|
public bool WallpaperView
|
||||||
|
{
|
||||||
|
get => _wallpaperView;
|
||||||
|
set => SetProperty(ref _wallpaperView, value);
|
||||||
|
}
|
||||||
|
private bool _wallpaperView;
|
||||||
|
|
||||||
public bool RenderSelectedOnly
|
public bool RenderSelectedOnly
|
||||||
{
|
{
|
||||||
get => _renderSelectedOnly;
|
get => _renderSelectedOnly;
|
||||||
@@ -443,6 +452,7 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
_wallpaperRenderer.SetActive(true);
|
||||||
_renderer.SetActive(true);
|
_renderer.SetActive(true);
|
||||||
|
|
||||||
float delta;
|
float delta;
|
||||||
@@ -461,8 +471,15 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
_forwardDelta = 0;
|
_forwardDelta = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using var v = _renderer.GetView();
|
||||||
_renderer.Clear(_backgroundColor);
|
_renderer.Clear(_backgroundColor);
|
||||||
|
|
||||||
|
if (_wallpaperView)
|
||||||
|
{
|
||||||
|
_wallpaperRenderer.SetView(v);
|
||||||
|
_wallpaperRenderer.Clear(_backgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
// 渲染背景
|
// 渲染背景
|
||||||
lock (_bgLock)
|
lock (_bgLock)
|
||||||
{
|
{
|
||||||
@@ -492,6 +509,11 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
bg.Position = view.Center;
|
bg.Position = view.Center;
|
||||||
bg.Rotation = view.Rotation;
|
bg.Rotation = view.Rotation;
|
||||||
_renderer.Draw(bg);
|
_renderer.Draw(bg);
|
||||||
|
|
||||||
|
if (_wallpaperView)
|
||||||
|
{
|
||||||
|
_wallpaperRenderer.Draw(bg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,10 +553,20 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
sp.EnableDebug = true;
|
sp.EnableDebug = true;
|
||||||
_renderer.Draw(sp);
|
_renderer.Draw(sp);
|
||||||
sp.EnableDebug = false;
|
sp.EnableDebug = false;
|
||||||
|
|
||||||
|
if (_wallpaperView)
|
||||||
|
{
|
||||||
|
_wallpaperRenderer.Draw(sp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderer.Display();
|
_renderer.Display();
|
||||||
|
|
||||||
|
if (_wallpaperView)
|
||||||
|
{
|
||||||
|
_wallpaperRenderer.Display();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -546,6 +578,7 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_renderer.SetActive(false);
|
_renderer.SetActive(false);
|
||||||
|
_wallpaperRenderer.SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
|
|
||||||
if (args.Count > 1)
|
if (args.Count > 1)
|
||||||
{
|
{
|
||||||
if (!MessagePopupService.Quest(string.Format(AppResource.Str_RemoveItemsQuest, args.Count)))
|
if (!MessagePopupService.OKCancel(string.Format(AppResource.Str_RemoveItemsQuest, args.Count)))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
{
|
{
|
||||||
if (!RemoveAllSpineObject_CanExecute(args)) return;
|
if (!RemoveAllSpineObject_CanExecute(args)) return;
|
||||||
|
|
||||||
if (!MessagePopupService.Quest(string.Format(AppResource.Str_RemoveItemsQuest, args.Count)))
|
if (!MessagePopupService.OKCancel(string.Format(AppResource.Str_RemoveItemsQuest, args.Count)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (_spineObjectModels.Lock)
|
lock (_spineObjectModels.Lock)
|
||||||
@@ -213,6 +213,8 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
spNew.ObjectConfig = sp.ObjectConfig;
|
spNew.ObjectConfig = sp.ObjectConfig;
|
||||||
_spineObjectModels[idx] = spNew;
|
_spineObjectModels[idx] = spNew;
|
||||||
sp.Dispose();
|
sp.Dispose();
|
||||||
|
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Reset));
|
||||||
|
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Add, spNew));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -268,6 +270,11 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
_spineObjectModels[idx] = spNew;
|
_spineObjectModels[idx] = spNew;
|
||||||
sp.Dispose();
|
sp.Dispose();
|
||||||
success++;
|
success++;
|
||||||
|
Application.Current.Dispatcher.BeginInvoke(() =>
|
||||||
|
{
|
||||||
|
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Reset));
|
||||||
|
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Add, spNew));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -462,7 +469,7 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
{
|
{
|
||||||
if (validPaths.Count > 100)
|
if (validPaths.Count > 100)
|
||||||
{
|
{
|
||||||
if (!MessagePopupService.Quest(string.Format(AppResource.Str_TooManyItemsToAddQuest, validPaths.Count)))
|
if (!MessagePopupService.OKCancel(string.Format(AppResource.Str_TooManyItemsToAddQuest, validPaths.Count)))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ProgressService.RunAsync((pr, ct) => AddSpineObjectsTask(
|
ProgressService.RunAsync((pr, ct) => AddSpineObjectsTask(
|
||||||
|
|||||||
@@ -334,27 +334,31 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
|
|
||||||
public ObservableCollection<SkinViewModel> Skins => _skins;
|
public ObservableCollection<SkinViewModel> Skins => _skins;
|
||||||
|
|
||||||
public RelayCommand<IList?> Cmd_EnableSkins { get; } = new(
|
public RelayCommand<IList?> Cmd_EnableSkins => _cmd_EnableSkins ??= new (
|
||||||
args => { if (args is null) return; foreach (var s in args.OfType<SkinViewModel>()) s.Status = true; },
|
args => { if (args is null) return; foreach (var s in args.OfType<SkinViewModel>()) s.Status = true; },
|
||||||
args => { return args is not null && args.OfType<SkinViewModel>().Any(); }
|
args => { return args is not null && args.OfType<SkinViewModel>().Any(); }
|
||||||
);
|
);
|
||||||
|
private RelayCommand<IList?> _cmd_EnableSkins;
|
||||||
|
|
||||||
public RelayCommand<IList?> Cmd_DisableSkins { get; } = new(
|
public RelayCommand<IList?> Cmd_DisableSkins => _cmd_DisableSkins ??= new (
|
||||||
args => { if (args is null) return; foreach (var s in args.OfType<SkinViewModel>()) s.Status = false; },
|
args => { if (args is null) return; foreach (var s in args.OfType<SkinViewModel>()) s.Status = false; },
|
||||||
args => { return args is not null && args.OfType<SkinViewModel>().Any(); }
|
args => { return args is not null && args.OfType<SkinViewModel>().Any(); }
|
||||||
);
|
);
|
||||||
|
private RelayCommand<IList?> _cmd_DisableSkins;
|
||||||
|
|
||||||
public ObservableCollection<SlotViewModel> Slots => _slots;
|
public ObservableCollection<SlotViewModel> Slots => _slots;
|
||||||
|
|
||||||
public RelayCommand<IList?> Cmd_EnableSlots { get; } = new(
|
public RelayCommand<IList?> Cmd_EnableSlots => _cmd_EnableSlots ??= new (
|
||||||
args => { if (args is null) return; foreach (var s in args.OfType<SlotViewModel>()) s.Visible = true; },
|
args => { if (args is null) return; foreach (var s in args.OfType<SlotViewModel>()) s.Visible = true; },
|
||||||
args => { return args is not null && args.OfType<SlotViewModel>().Any(); }
|
args => { return args is not null && args.OfType<SlotViewModel>().Any(); }
|
||||||
);
|
);
|
||||||
|
private RelayCommand<IList?> _cmd_EnableSlots;
|
||||||
|
|
||||||
public RelayCommand<IList?> Cmd_DisableSlots { get; } = new(
|
public RelayCommand<IList?> Cmd_DisableSlots => _cmd_DisableSlots ??= new (
|
||||||
args => { if (args is null) return; foreach (var s in args.OfType<SlotViewModel>()) s.Visible = false; },
|
args => { if (args is null) return; foreach (var s in args.OfType<SlotViewModel>()) s.Visible = false; },
|
||||||
args => { return args is not null && args.OfType<SlotViewModel>().Any(); }
|
args => { return args is not null && args.OfType<SlotViewModel>().Any(); }
|
||||||
);
|
);
|
||||||
|
private RelayCommand<IList?> _cmd_DisableSlots;
|
||||||
|
|
||||||
public ObservableCollection<AnimationTrackViewModel> AnimationTracks => _animationTracks;
|
public ObservableCollection<AnimationTrackViewModel> AnimationTracks => _animationTracks;
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace SpineViewer.ViewModels
|
|||||||
private void Cancel_Execute()
|
private void Cancel_Execute()
|
||||||
{
|
{
|
||||||
if (!Cancel_CanExecute()) return;
|
if (!Cancel_CanExecute()) return;
|
||||||
if (!MessagePopupService.Quest(AppResource.Str_CancelQuest)) return;
|
if (!MessagePopupService.OKCancel(AppResource.Str_CancelQuest)) return;
|
||||||
_cts.Cancel();
|
_cts.Cancel();
|
||||||
Cmd_Cancel.NotifyCanExecuteChanged();
|
Cmd_Cancel.NotifyCanExecuteChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,73 +21,120 @@
|
|||||||
<Button Width="120" Content="{DynamicResource Str_CopyDiagnosticsInfo}" Command="{Binding Cmd_CopyToClipboard}"/>
|
<Button Width="120" Content="{DynamicResource Str_CopyDiagnosticsInfo}" Command="{Binding Cmd_CopyToClipboard}"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border>
|
<Border Grid.IsSharedSizeScope="True">
|
||||||
|
<Border.Resources>
|
||||||
|
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource LabelDefault}">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxBaseStyle}">
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||||
|
</Style>
|
||||||
|
</Border.Resources>
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||||
<Grid Margin="30 10">
|
<StackPanel Margin="30 10">
|
||||||
<Grid.Resources>
|
<Grid>
|
||||||
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource LabelDefault}">
|
<Grid.ColumnDefinitions>
|
||||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
<ColumnDefinition Width="*" />
|
||||||
</Style>
|
</Grid.ColumnDefinitions>
|
||||||
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxBaseStyle}">
|
<Label Content="CPU"/>
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding CPU, Mode=OneWay}"/>
|
||||||
</Style>
|
</Grid>
|
||||||
</Grid.Resources>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<Label Grid.Row="0" Grid.Column="0" Content="CPU"/>
|
<Grid>
|
||||||
<TextBox Grid.Row="0" Grid.Column="1" IsReadOnly="True" Text="{Binding CPU, Mode=OneWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="GPU"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding GPU, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="1" Grid.Column="0" Content="GPU"/>
|
<Grid>
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" IsReadOnly="True" Text="{Binding GPU, Mode=OneWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="Memory"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding Memory, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="2" Grid.Column="0" Content="Memory"/>
|
<Separator Height="10"/>
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" IsReadOnly="True" Text="{Binding Memory, Mode=OneWay}"/>
|
|
||||||
|
|
||||||
<Separator Grid.Row="3" Grid.ColumnSpan="2" Height="10"/>
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="WindowsVersion"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding WindowsVersion, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="4" Grid.Column="0" Content="WindowsVersion"/>
|
<Grid>
|
||||||
<TextBox Grid.Row="4" Grid.Column="1" IsReadOnly="True" Text="{Binding WindowsVersion, Mode=OneWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="DotNetVersion"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding DotNetVersion, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="5" Grid.Column="0" Content="DotNetVersion"/>
|
<Grid>
|
||||||
<TextBox Grid.Row="5" Grid.Column="1" IsReadOnly="True" Text="{Binding DotNetVersion, Mode=OneWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="ProgramVersion"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding ProgramVersion, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="6" Grid.Column="0" Content="ProgramVersion"/>
|
<Grid>
|
||||||
<TextBox Grid.Row="6" Grid.Column="1" IsReadOnly="True" Text="{Binding ProgramVersion, Mode=OneWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="NLogVersion"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding NLogVersion, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="7" Grid.Column="0" Content="NLogVersion"/>
|
<Grid>
|
||||||
<TextBox Grid.Row="7" Grid.Column="1" IsReadOnly="True" Text="{Binding NLogVersion, Mode=OneWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="SFMLVersion"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding SFMLVersion, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="8" Grid.Column="0" Content="SFMLVersion"/>
|
<Grid>
|
||||||
<TextBox Grid.Row="8" Grid.Column="1" IsReadOnly="True" Text="{Binding SFMLVersion, Mode=OneWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="FFMpegCoreVersion"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding FFMpegCoreVersion, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="9" Grid.Column="0" Content="FFMpegCoreVersion"/>
|
<Grid>
|
||||||
<TextBox Grid.Row="9" Grid.Column="1" IsReadOnly="True" Text="{Binding FFMpegCoreVersion, Mode=OneWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="SkiaSharpVersion"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding SkiaSharpVersion, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="10" Grid.Column="0" Content="SkiaSharpVersion"/>
|
<Grid>
|
||||||
<TextBox Grid.Row="10" Grid.Column="1" IsReadOnly="True" Text="{Binding SkiaSharpVersion, Mode=OneWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="HandyControlVersion"/>
|
||||||
|
<TextBox Grid.Column="1" IsReadOnly="True" Text="{Binding HandyControlVersion, Mode=OneWay}"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<Label Grid.Row="11" Grid.Column="0" Content="HandyControlVersion"/>
|
|
||||||
<TextBox Grid.Row="11" Grid.Column="1" IsReadOnly="True" Text="{Binding HandyControlVersion, Mode=OneWay}"/>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Border>
|
</Border>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
<MenuItem Header="{DynamicResource Str_Diagnostics}" Command="{Binding Cmd_ShowDiagnosticsDialog}"/>
|
<MenuItem Header="{DynamicResource Str_Diagnostics}" Command="{Binding Cmd_ShowDiagnosticsDialog}"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="{DynamicResource Str_Abount}" Command="{Binding Cmd_ShowAboutDialog}"/>
|
<MenuItem Header="{DynamicResource Str_Abount}" Command="{Binding Cmd_ShowAboutDialog}"/>
|
||||||
<MenuItem Header="{DynamicResource Str_Debug}" Command="{Binding Cmd_Debug}"/>
|
<MenuItem Header="{DynamicResource Str_Debug}" Click="DebugMenuItem_Click"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<!--<MenuItem Header="{DynamicResource Str_Experiment}"/>-->
|
<!--<MenuItem Header="{DynamicResource Str_Experiment}"/>-->
|
||||||
</Menu>
|
</Menu>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<Grid x:Name="_rootGrid">
|
<Grid x:Name="_rootGrid">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto"/>
|
||||||
<ColumnDefinition Width="2.5*"/>
|
<ColumnDefinition Width="2.5*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
@@ -940,9 +940,9 @@
|
|||||||
MouseDoubleClick="_notifyIcon_MouseDoubleClick">
|
MouseDoubleClick="_notifyIcon_MouseDoubleClick">
|
||||||
<hc:NotifyIcon.ContextMenu>
|
<hc:NotifyIcon.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Header="There may be a funtion :)" IsChecked="True"/>
|
<MenuItem Header="{DynamicResource Str_WallpaperView}" Command="{Binding Cmd_SwitchWallpaperView}" IsChecked="{Binding PreferenceViewModel.WallpaperView}"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="{DynamicResource Str_Exit}" Command="{Binding Cmd_Exit}"/>
|
<MenuItem Header="{DynamicResource Str_Exit}" Command="{Binding Cmd_ExitFromTray}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:NotifyIcon.ContextMenu>
|
</hc:NotifyIcon.ContextMenu>
|
||||||
</hc:NotifyIcon>
|
</hc:NotifyIcon>
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
using Microsoft.Win32;
|
using NLog;
|
||||||
using NLog;
|
|
||||||
using NLog.Layouts;
|
using NLog.Layouts;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
|
using SFMLRenderer;
|
||||||
using Spine;
|
using Spine;
|
||||||
using SpineViewer.Models;
|
using SpineViewer.Models;
|
||||||
using SpineViewer.Natives;
|
using SpineViewer.Natives;
|
||||||
using SpineViewer.Resources;
|
using SpineViewer.Resources;
|
||||||
|
using SpineViewer.Services;
|
||||||
using SpineViewer.Utils;
|
using SpineViewer.Utils;
|
||||||
using SpineViewer.ViewModels.MainWindow;
|
using SpineViewer.ViewModels.MainWindow;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
@@ -35,72 +37,42 @@ public partial class MainWindow : Window
|
|||||||
public static readonly string LastStateFilePath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "laststate.json");
|
public static readonly string LastStateFilePath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "laststate.json");
|
||||||
|
|
||||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
private ListViewItem? _listViewDragSourceItem = null;
|
private ListViewItem? _listViewDragSourceItem = null;
|
||||||
private Point _listViewDragSourcePoint;
|
private Point _listViewDragSourcePoint;
|
||||||
|
|
||||||
|
private readonly SFMLRenderWindow _wallpaperRenderWindow;
|
||||||
private readonly MainWindowViewModel _vm;
|
private readonly MainWindowViewModel _vm;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
InitializeLogConfiguration();
|
InitializeLogConfiguration();
|
||||||
DataContext = _vm = new(_renderPanel);
|
|
||||||
_notifyIcon.Text = _vm.Title; // XXX: hc 的 NotifyIcon 的 Text 似乎没法双向绑定
|
// Initialize Wallpaper RenderWindow
|
||||||
|
_wallpaperRenderWindow = new(new(1, 1), "SpineViewerWallpaper", SFML.Window.Styles.None);
|
||||||
|
_wallpaperRenderWindow.SetVisible(false);
|
||||||
|
var handle = _wallpaperRenderWindow.SystemHandle;
|
||||||
|
var style = User32.GetWindowLong(handle, User32.GWL_STYLE) | User32.WS_POPUP;
|
||||||
|
var exStyle = User32.GetWindowLong(handle, User32.GWL_EXSTYLE) | User32.WS_EX_LAYERED | User32.WS_EX_TOOLWINDOW;
|
||||||
|
User32.SetWindowLong(handle, User32.GWL_STYLE, style);
|
||||||
|
User32.SetWindowLong(handle, User32.GWL_EXSTYLE, exStyle);
|
||||||
|
User32.SetLayeredWindowAttributes(handle, 0, byte.MaxValue, User32.LWA_ALPHA);
|
||||||
|
|
||||||
|
DataContext = _vm = new(_renderPanel, _wallpaperRenderWindow);
|
||||||
|
|
||||||
|
// XXX: hc 的 NotifyIcon 的 Text 似乎没法双向绑定
|
||||||
|
_notifyIcon.Text = _vm.Title;
|
||||||
|
|
||||||
|
Loaded += MainWindow_Loaded;
|
||||||
|
ContentRendered += MainWindow_ContentRendered;
|
||||||
|
Closing += MainWindow_Closing;
|
||||||
|
Closed += MainWindow_Closed;
|
||||||
|
|
||||||
_vm.SpineObjectListViewModel.RequestSelectionChanging += SpinesListView_RequestSelectionChanging;
|
_vm.SpineObjectListViewModel.RequestSelectionChanging += SpinesListView_RequestSelectionChanging;
|
||||||
_vm.SFMLRendererViewModel.RequestSelectionChanging += SpinesListView_RequestSelectionChanging;
|
_vm.SFMLRendererViewModel.RequestSelectionChanging += SpinesListView_RequestSelectionChanging;
|
||||||
Loaded += MainWindow_Loaded;
|
|
||||||
ContentRendered += MainWindow_ContentRendered;
|
|
||||||
Closed += MainWindow_Closed;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
_vm.SFMLRendererViewModel.PropertyChanged += SFMLRendererViewModel_PropertyChanged;
|
||||||
{
|
|
||||||
var vm = _vm.SFMLRendererViewModel;
|
|
||||||
_renderPanel.CanvasMouseWheelScrolled += vm.CanvasMouseWheelScrolled;
|
|
||||||
_renderPanel.CanvasMouseButtonPressed += (s, e) => { vm.CanvasMouseButtonPressed(s, e); _spinesListView.Focus(); }; // 用户点击画布后强制转移焦点至列表
|
|
||||||
_renderPanel.CanvasMouseMove += vm.CanvasMouseMove;
|
|
||||||
_renderPanel.CanvasMouseButtonReleased += vm.CanvasMouseButtonReleased;
|
|
||||||
|
|
||||||
// 设置默认参数并启动渲染
|
|
||||||
vm.SetResolution(1500, 1000);
|
|
||||||
vm.Zoom = 0.75f;
|
|
||||||
vm.CenterX = 0;
|
|
||||||
vm.CenterY = 0;
|
|
||||||
vm.FlipY = true;
|
|
||||||
vm.MaxFps = 30;
|
|
||||||
vm.StartRender();
|
|
||||||
|
|
||||||
// 加载首选项
|
|
||||||
_vm.PreferenceViewModel.LoadPreference();
|
|
||||||
|
|
||||||
LoadLastState();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MainWindow_ContentRendered(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string[] args = Environment.GetCommandLineArgs();
|
|
||||||
if (args.Length > 1)
|
|
||||||
{
|
|
||||||
string[] filePaths = args.Skip(1).ToArray();
|
|
||||||
_vm.SpineObjectListViewModel.AddSpineObjectFromFileList(filePaths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MainWindow_Closed(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
SaveLastState();
|
|
||||||
|
|
||||||
var vm = _vm.SFMLRendererViewModel;
|
|
||||||
vm.StopRender();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 给管道通信提供的打开文件外部调用方法
|
|
||||||
/// </summary>
|
|
||||||
public void OpenFiles(IEnumerable<string> filePaths)
|
|
||||||
{
|
|
||||||
_vm.SpineObjectListViewModel.AddSpineObjectFromFileList(filePaths);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -147,35 +119,49 @@ public partial class MainWindow : Window
|
|||||||
WindowState = WindowState.Normal;
|
WindowState = WindowState.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
_rootGrid.ColumnDefinitions[0].Width = new(m.RootGridCol0Width);
|
_rootGrid.ColumnDefinitions[0].Width = new(m.RootGridCol0Width, GridUnitType.Star);
|
||||||
_modelListGrid.RowDefinitions[0].Height = new(m.ModelListRow0Height);
|
_rootGrid.ColumnDefinitions[2].Width = new(m.RootGridCol2Width, GridUnitType.Star);
|
||||||
if (m.ExplorerGridRow0Height > 0) _explorerGrid.RowDefinitions[0].Height = new(m.ExplorerGridRow0Height);
|
|
||||||
_rightPanelGrid.RowDefinitions[0].Height = new(m.RightPanelGridRow0Height);
|
_modelListGrid.RowDefinitions[0].Height = new(m.ModelListRow0Height, GridUnitType.Star);
|
||||||
|
_modelListGrid.RowDefinitions[2].Height = new(m.ModelListRow2Height, GridUnitType.Star);
|
||||||
|
|
||||||
|
_explorerGrid.RowDefinitions[0].Height = new(m.ExplorerGridRow0Height, GridUnitType.Star);
|
||||||
|
_explorerGrid.RowDefinitions[2].Height = new(m.ExplorerGridRow2Height, GridUnitType.Star);
|
||||||
|
|
||||||
|
_rightPanelGrid.RowDefinitions[0].Height = new(m.RightPanelGridRow0Height, GridUnitType.Star);
|
||||||
|
_rightPanelGrid.RowDefinitions[2].Height = new(m.RightPanelGridRow2Height, GridUnitType.Star);
|
||||||
|
|
||||||
_vm.SFMLRendererViewModel.SetResolution(m.ResolutionX, m.ResolutionY);
|
_vm.SFMLRendererViewModel.SetResolution(m.ResolutionX, m.ResolutionY);
|
||||||
_vm.SFMLRendererViewModel.MaxFps = m.MaxFps;
|
_vm.SFMLRendererViewModel.MaxFps = m.MaxFps;
|
||||||
_vm.SFMLRendererViewModel.Speed = m.Speed;
|
_vm.SFMLRendererViewModel.Speed = m.Speed;
|
||||||
_vm.SFMLRendererViewModel.ShowAxis = m.ShowAxis;
|
_vm.SFMLRendererViewModel.ShowAxis = m.ShowAxis;
|
||||||
_vm.SFMLRendererViewModel.BackgroundColor = m.BackgroundColor;
|
_vm.SFMLRendererViewModel.BackgroundColor = m.BackgroundColor;
|
||||||
_vm.SFMLRendererViewModel.BackgroundImagePath = m.BackgroundImagePath;
|
|
||||||
_vm.SFMLRendererViewModel.BackgroundImageMode = m.BackgroundImageMode;
|
_vm.SFMLRendererViewModel.BackgroundImageMode = m.BackgroundImageMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveLastState()
|
private void SaveLastState()
|
||||||
{
|
{
|
||||||
|
var rb = RestoreBounds;
|
||||||
var m = new LastStateModel()
|
var m = new LastStateModel()
|
||||||
{
|
{
|
||||||
WindowLeft = Left,
|
WindowLeft = rb.Left,
|
||||||
WindowTop = Top,
|
WindowTop = rb.Top,
|
||||||
WindowWidth = Width,
|
WindowWidth = rb.Width,
|
||||||
WindowHeight = Height,
|
WindowHeight = rb.Height,
|
||||||
WindowState = WindowState,
|
WindowState = WindowState,
|
||||||
|
|
||||||
RootGridCol0Width = _rootGrid.ColumnDefinitions[0].ActualWidth,
|
RootGridCol0Width = _rootGrid.ColumnDefinitions[0].Width.Value,
|
||||||
ModelListRow0Height = _modelListGrid.RowDefinitions[0].ActualHeight,
|
RootGridCol2Width = _rootGrid.ColumnDefinitions[2].Width.Value,
|
||||||
ExplorerGridRow0Height = _explorerGrid.RowDefinitions[0].ActualHeight,
|
|
||||||
RightPanelGridRow0Height = _rightPanelGrid.RowDefinitions[0].ActualHeight,
|
ModelListRow0Height = _modelListGrid.RowDefinitions[0].Height.Value,
|
||||||
|
ModelListRow2Height = _modelListGrid.RowDefinitions[2].Height.Value,
|
||||||
|
|
||||||
|
ExplorerGridRow0Height = _explorerGrid.RowDefinitions[0].Height.Value,
|
||||||
|
ExplorerGridRow2Height = _explorerGrid.RowDefinitions[2].Height.Value,
|
||||||
|
|
||||||
|
RightPanelGridRow0Height = _rightPanelGrid.RowDefinitions[0].Height.Value,
|
||||||
|
RightPanelGridRow2Height = _rightPanelGrid.RowDefinitions[2].Height.Value,
|
||||||
|
|
||||||
ResolutionX = _vm.SFMLRendererViewModel.ResolutionX,
|
ResolutionX = _vm.SFMLRendererViewModel.ResolutionX,
|
||||||
ResolutionY = _vm.SFMLRendererViewModel.ResolutionY,
|
ResolutionY = _vm.SFMLRendererViewModel.ResolutionY,
|
||||||
@@ -183,13 +169,127 @@ public partial class MainWindow : Window
|
|||||||
Speed = _vm.SFMLRendererViewModel.Speed,
|
Speed = _vm.SFMLRendererViewModel.Speed,
|
||||||
ShowAxis = _vm.SFMLRendererViewModel.ShowAxis,
|
ShowAxis = _vm.SFMLRendererViewModel.ShowAxis,
|
||||||
BackgroundColor = _vm.SFMLRendererViewModel.BackgroundColor,
|
BackgroundColor = _vm.SFMLRendererViewModel.BackgroundColor,
|
||||||
BackgroundImagePath = _vm.SFMLRendererViewModel.BackgroundImagePath,
|
|
||||||
BackgroundImageMode = _vm.SFMLRendererViewModel.BackgroundImageMode,
|
BackgroundImageMode = _vm.SFMLRendererViewModel.BackgroundImageMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
JsonHelper.Serialize(m, LastStateFilePath);
|
JsonHelper.Serialize(m, LastStateFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region MainWindow 事件处理
|
||||||
|
|
||||||
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var vm = _vm.SFMLRendererViewModel;
|
||||||
|
_renderPanel.CanvasMouseWheelScrolled += vm.CanvasMouseWheelScrolled;
|
||||||
|
_renderPanel.CanvasMouseButtonPressed += (s, e) => { vm.CanvasMouseButtonPressed(s, e); _spinesListView.Focus(); }; // 用户点击画布后强制转移焦点至列表
|
||||||
|
_renderPanel.CanvasMouseMove += vm.CanvasMouseMove;
|
||||||
|
_renderPanel.CanvasMouseButtonReleased += vm.CanvasMouseButtonReleased;
|
||||||
|
|
||||||
|
// 设置默认参数并启动渲染
|
||||||
|
vm.SetResolution(1500, 1000);
|
||||||
|
vm.Zoom = 0.75f;
|
||||||
|
vm.CenterX = 0;
|
||||||
|
vm.CenterY = 0;
|
||||||
|
vm.FlipY = true;
|
||||||
|
vm.MaxFps = 30;
|
||||||
|
vm.StartRender();
|
||||||
|
|
||||||
|
// 加载首选项
|
||||||
|
_vm.PreferenceViewModel.LoadPreference();
|
||||||
|
|
||||||
|
LoadLastState();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainWindow_ContentRendered(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string[] args = Environment.GetCommandLineArgs();
|
||||||
|
|
||||||
|
// 不带参数启动
|
||||||
|
if (args.Length <= 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 带一个参数启动, 允许提供一些启动选项
|
||||||
|
if (args.Length == 2)
|
||||||
|
{
|
||||||
|
if (args[1] == App.AutoRunFlag)
|
||||||
|
{
|
||||||
|
var autoPath = _vm.AutoRunWorkspaceConfigPath;
|
||||||
|
if (!string.IsNullOrWhiteSpace(autoPath) && JsonHelper.Deserialize<WorkspaceModel>(autoPath, out var obj))
|
||||||
|
_vm.Workspace = obj;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 其余提供了任意参数的情况
|
||||||
|
string[] filePaths = args.Skip(1).ToArray();
|
||||||
|
_vm.SpineObjectListViewModel.AddSpineObjectFromFileList(filePaths);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainWindow_Closing(object? sender, CancelEventArgs e)
|
||||||
|
{
|
||||||
|
if (!_vm.IsShuttingDownFromTray)
|
||||||
|
{
|
||||||
|
if (_vm.CloseToTray is null)
|
||||||
|
{
|
||||||
|
_vm.PreferenceViewModel.CloseToTray = MessagePopupService.YesNo(AppResource.Str_CloseToTrayQuest);
|
||||||
|
_vm.PreferenceViewModel.SavePreference();
|
||||||
|
}
|
||||||
|
if (_vm.CloseToTray is true)
|
||||||
|
{
|
||||||
|
Hide();
|
||||||
|
e.Cancel = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveLastState();
|
||||||
|
_vm.SFMLRendererViewModel.StopRender();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainWindow_Closed(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ViewModel PropertyChanged 事件处理
|
||||||
|
|
||||||
|
private void SFMLRendererViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName == nameof(SFMLRendererViewModel.WallpaperView))
|
||||||
|
{
|
||||||
|
var wnd = _wallpaperRenderWindow;
|
||||||
|
if (_vm.SFMLRendererViewModel.WallpaperView)
|
||||||
|
{
|
||||||
|
var workerw = User32.GetWorkerW();
|
||||||
|
if (workerw == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
_logger.Error("Failed to enable wallpaper view, WorkerW not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var handle = wnd.SystemHandle;
|
||||||
|
|
||||||
|
User32.GetPrimaryScreenResolution(out var sw, out var sh);
|
||||||
|
|
||||||
|
User32.SetParent(handle, workerw);
|
||||||
|
User32.SetLayeredWindowAttributes(handle, 0, byte.MaxValue, User32.LWA_ALPHA);
|
||||||
|
|
||||||
|
_vm.SFMLRendererViewModel.SetResolution(sw, sh);
|
||||||
|
wnd.Position = new(0, 0);
|
||||||
|
wnd.Size = new(sw + 1, sh);
|
||||||
|
wnd.Size = new(sw, sh);
|
||||||
|
wnd.SetVisible(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wnd.SetVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region _spinesListView 事件处理
|
#region _spinesListView 事件处理
|
||||||
|
|
||||||
private void SpinesListView_RequestSelectionChanging(object? sender, NotifyCollectionChangedEventArgs e)
|
private void SpinesListView_RequestSelectionChanging(object? sender, NotifyCollectionChangedEventArgs e)
|
||||||
@@ -338,7 +438,12 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
private void _notifyIcon_MouseDoubleClick(object sender, RoutedEventArgs e)
|
private void _notifyIcon_MouseDoubleClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Show();
|
||||||
|
if (WindowState == WindowState.Minimized)
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
}
|
||||||
|
Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -600,4 +705,15 @@ public partial class MainWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void DebugMenuItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
var a = _rootGrid.ColumnDefinitions[0].Width;
|
||||||
|
var b = _rootGrid.ColumnDefinitions[1].Width;
|
||||||
|
var c = _rootGrid.ColumnDefinitions[2].Width;
|
||||||
|
Debug.WriteLine(a);
|
||||||
|
Debug.WriteLine(_rootGrid.ColumnDefinitions[0].Width.IsStar);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -53,111 +53,229 @@
|
|||||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||||
<StackPanel Grid.IsSharedSizeScope="True">
|
<StackPanel Grid.IsSharedSizeScope="True">
|
||||||
<GroupBox Header="{DynamicResource Str_TextureLoadPreference}">
|
<GroupBox Header="{DynamicResource Str_TextureLoadPreference}">
|
||||||
<Grid>
|
<StackPanel>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid>
|
||||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Col1"/>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
</Grid.ColumnDefinitions>
|
<ColumnDefinition Width="*" />
|
||||||
<Grid.RowDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<Label Content="{DynamicResource Str_ForcePremul}" ToolTip="{DynamicResource Str_ForcePremulTooltip}"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<ToggleButton Grid.Column="1" IsChecked="{Binding ForcePremul}" ToolTip="{DynamicResource Str_ForcePremulTooltip}"/>
|
||||||
<RowDefinition Height="Auto"/>
|
</Grid>
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource Str_ForcePremul}" ToolTip="{DynamicResource Str_ForcePremulTooltip}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="0" Grid.Column="1" IsChecked="{Binding ForcePremul}" ToolTip="{DynamicResource Str_ForcePremulTooltip}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_ForceNearest}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding ForceNearest}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource Str_ForceNearest}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="1" Grid.Column="1" IsChecked="{Binding ForceNearest}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
<Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource Str_ForceMipmap}" ToolTip="{DynamicResource Str_ForceMipmapTooltip}"/>
|
<ColumnDefinition Width="*" />
|
||||||
<ToggleButton Grid.Row="2" Grid.Column="1" IsChecked="{Binding ForceMipmap}" ToolTip="{DynamicResource Str_ForceMipmapTooltip}"/>
|
</Grid.ColumnDefinitions>
|
||||||
</Grid>
|
<Label Content="{DynamicResource Str_ForceMipmap}" ToolTip="{DynamicResource Str_ForceMipmapTooltip}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding ForceMipmap}" ToolTip="{DynamicResource Str_ForceMipmapTooltip}"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
|
||||||
<GroupBox Header="{DynamicResource Str_SpineLoadPreference}">
|
<GroupBox Header="{DynamicResource Str_SpineLoadPreference}">
|
||||||
<Grid>
|
<StackPanel>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid>
|
||||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Col1"/>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
</Grid.ColumnDefinitions>
|
<ColumnDefinition Width="*" />
|
||||||
<Grid.RowDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<Label Content="{DynamicResource Str_IsShown}"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<ToggleButton Grid.Column="1" IsChecked="{Binding IsShown}"/>
|
||||||
<RowDefinition Height="Auto"/>
|
</Grid>
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource Str_IsShown}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="0" Grid.Column="1" IsChecked="{Binding IsShown}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_UsePma}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding UsePma}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource Str_UsePma}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="1" Grid.Column="1" IsChecked="{Binding UsePma}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugTexture}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugTexture}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource Str_DebugTexture}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="2" Grid.Column="1" IsChecked="{Binding DebugTexture}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugBounds}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugBounds}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="3" Grid.Column="0" Content="{DynamicResource Str_DebugBounds}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="3" Grid.Column="1" IsChecked="{Binding DebugBounds}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugBones}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugBones}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="4" Grid.Column="0" Content="{DynamicResource Str_DebugBones}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="4" Grid.Column="1" IsChecked="{Binding DebugBones}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugRegions}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugRegions}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="5" Grid.Column="0" Content="{DynamicResource Str_DebugRegions}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="5" Grid.Column="1" IsChecked="{Binding DebugRegions}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugMeshHulls}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugMeshHulls}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="6" Grid.Column="0" Content="{DynamicResource Str_DebugMeshHulls}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="6" Grid.Column="1" IsChecked="{Binding DebugMeshHulls}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugMeshes}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugMeshes}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="7" Grid.Column="0" Content="{DynamicResource Str_DebugMeshes}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="7" Grid.Column="1" IsChecked="{Binding DebugMeshes}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugClippings}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugClippings}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="8" Grid.Column="0" Content="{DynamicResource Str_DebugClippings}"/>
|
<!-- <Grid>
|
||||||
<ToggleButton Grid.Row="8" Grid.Column="1" IsChecked="{Binding DebugClippings}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugBoundingBoxes}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugBoundingBoxes}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<!--<Label Grid.Row="9" Grid.Column="0" Content="{DynamicResource Str_DebugBoundingBoxes}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="9" Grid.Column="1" IsChecked="{Binding DebugBoundingBoxes}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugPaths}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugPaths}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="10" Grid.Column="0" Content="{DynamicResource Str_DebugPaths}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="10" Grid.Column="1" IsChecked="{Binding DebugPaths}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_DebugPoints}"/>
|
||||||
|
<ToggleButton Grid.Column="1" IsChecked="{Binding DebugPoints}"/>
|
||||||
|
</Grid> -->
|
||||||
|
|
||||||
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource Str_DebugPoints}"/>
|
</StackPanel>
|
||||||
<ToggleButton Grid.Row="11" Grid.Column="1" IsChecked="{Binding DebugPoints}"/>-->
|
|
||||||
</Grid>
|
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
|
||||||
<GroupBox Header="{DynamicResource Str_AppPreference}">
|
<GroupBox Header="{DynamicResource Str_AppPreference}">
|
||||||
<Grid>
|
<StackPanel>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid>
|
||||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Col1"/>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
</Grid.ColumnDefinitions>
|
<ColumnDefinition Width="*" />
|
||||||
<Grid.RowDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<Label Content="{DynamicResource Str_Language}"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<ComboBox Grid.Column="1"
|
||||||
<RowDefinition Height="Auto"/>
|
SelectedItem="{Binding AppLanguage}"
|
||||||
</Grid.RowDefinitions>
|
ItemsSource="{x:Static vm:PreferenceViewModel.AppLanguageOptions}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource Str_RenderSelectedOnly}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="0" Grid.Column="1" IsChecked="{Binding RenderSelectedOnly}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_RenderSelectedOnly}"/>
|
||||||
|
<ToggleButton Grid.Column="1"
|
||||||
|
IsChecked="{Binding RenderSelectedOnly}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource Str_AssociateFileSuffix}"/>
|
<Grid>
|
||||||
<ToggleButton Grid.Row="1" Grid.Column="1" IsChecked="{Binding AssociateFileSuffix}"/>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_WallpaperView}"/>
|
||||||
|
<ToggleButton Grid.Column="1"
|
||||||
|
IsChecked="{Binding WallpaperView}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource Str_Language}"/>
|
<Grid>
|
||||||
<ComboBox Grid.Row="2" Grid.Column="1"
|
<Grid.ColumnDefinitions>
|
||||||
SelectedItem="{Binding AppLanguage}"
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
ItemsSource="{x:Static vm:PreferenceViewModel.AppLanguageOptions}"/>
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_CloseToTray}"/>
|
||||||
|
<ToggleButton Grid.Column="1"
|
||||||
|
IsChecked="{Binding CloseToTray}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_AutoRun}"/>
|
||||||
|
<ToggleButton Grid.Column="1"
|
||||||
|
IsChecked="{Binding AutoRun}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_AutoRunWorkspaceConfigPath}"
|
||||||
|
ToolTip="{DynamicResource Str_AutoRunWorkspaceConfigPathTooltip}"/>
|
||||||
|
<DockPanel Grid.Column="1" IsEnabled="{Binding AutoRun}">
|
||||||
|
<Button DockPanel.Dock="Right"
|
||||||
|
Content="..."
|
||||||
|
Command="{Binding Cmd_SelectAutoRunWorkspaceConfigPath}"/>
|
||||||
|
<TextBox Grid.Column="1"
|
||||||
|
Text="{Binding AutoRunWorkspaceConfigPath}"
|
||||||
|
ToolTip="{DynamicResource Str_AutoRunWorkspaceConfigPathTooltip}"/>
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="{DynamicResource Str_AssociateFileSuffix}"/>
|
||||||
|
<ToggleButton Grid.Column="1"
|
||||||
|
IsChecked="{Binding AssociateFileSuffix}"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
BIN
img/preview.webp
BIN
img/preview.webp
Binary file not shown.
|
Before Width: | Height: | Size: 177 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user