@@ -1,5 +1,10 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## v0.15.13
|
||||||
|
|
||||||
|
- 增加程序布局自动存储和还原
|
||||||
|
- 增加部分预览画面首选项
|
||||||
|
|
||||||
## v0.15.12
|
## v0.15.12
|
||||||
|
|
||||||
- 增加单个模型和单个轨道的时间因子
|
- 增加单个模型和单个轨道的时间因子
|
||||||
|
|||||||
@@ -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.12</Version>
|
<Version>0.15.13</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
23
SpineViewer/Models/MainWindowLayoutModel.cs
Normal file
23
SpineViewer/Models/MainWindowLayoutModel.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace SpineViewer.Models
|
||||||
|
{
|
||||||
|
public class MainWindowLayoutModel
|
||||||
|
{
|
||||||
|
public double WindowLeft { get; set; }
|
||||||
|
public double WindowTop { get; set; }
|
||||||
|
public double WindowWidth { get; set; }
|
||||||
|
public double WindowHeight { get; set; }
|
||||||
|
public WindowState WindowState { get; set; }
|
||||||
|
|
||||||
|
public double RootGridCol0Width { get; set; }
|
||||||
|
public double ModelListRow0Height { get; set; }
|
||||||
|
public double ExplorerGridRow0Height { get; set; }
|
||||||
|
public double RightPanelGridRow0Height { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -71,6 +71,22 @@ namespace SpineViewer.Models
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 预览画面首选项
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private uint _maxFps = 30;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private float _speed = 1f;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _showAxis = true;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Color _backgroundColor = Color.FromRgb(105, 105, 105);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region 程序选项
|
#region 程序选项
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
|||||||
@@ -229,6 +229,8 @@
|
|||||||
|
|
||||||
<s:String x:Key="Str_SpineLoadPreference">Model Loading Options</s:String>
|
<s:String x:Key="Str_SpineLoadPreference">Model Loading 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_Language">Language</s:String>
|
<s:String x:Key="Str_Language">Language</s:String>
|
||||||
|
|
||||||
|
|||||||
@@ -229,6 +229,8 @@
|
|||||||
|
|
||||||
<s:String x:Key="Str_SpineLoadPreference">モデル読み込みオプション</s:String>
|
<s:String x:Key="Str_SpineLoadPreference">モデル読み込みオプション</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_Language">言語</s:String>
|
<s:String x:Key="Str_Language">言語</s:String>
|
||||||
|
|
||||||
|
|||||||
@@ -229,6 +229,8 @@
|
|||||||
|
|
||||||
<s:String x:Key="Str_SpineLoadPreference">模型加载选项</s:String>
|
<s:String x:Key="Str_SpineLoadPreference">模型加载选项</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_Language">语言</s:String>
|
<s:String x:Key="Str_Language">语言</s:String>
|
||||||
|
|
||||||
|
|||||||
@@ -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.12</Version>
|
<Version>0.15.13</Version>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -93,6 +93,11 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
DebugPoints = DebugPoints,
|
DebugPoints = DebugPoints,
|
||||||
DebugClippings = DebugClippings,
|
DebugClippings = DebugClippings,
|
||||||
|
|
||||||
|
MaxFps = MaxFps,
|
||||||
|
Speed = Speed,
|
||||||
|
ShowAxis = ShowAxis,
|
||||||
|
BackgroundColor = BackgroundColor,
|
||||||
|
|
||||||
RenderSelectedOnly = RenderSelectedOnly,
|
RenderSelectedOnly = RenderSelectedOnly,
|
||||||
AppLanguage = AppLanguage,
|
AppLanguage = AppLanguage,
|
||||||
};
|
};
|
||||||
@@ -117,6 +122,11 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
DebugPoints = value.DebugPoints;
|
DebugPoints = value.DebugPoints;
|
||||||
DebugClippings = value.DebugClippings;
|
DebugClippings = value.DebugClippings;
|
||||||
|
|
||||||
|
MaxFps = value.MaxFps;
|
||||||
|
Speed = value.Speed;
|
||||||
|
ShowAxis = value.ShowAxis;
|
||||||
|
BackgroundColor = value.BackgroundColor;
|
||||||
|
|
||||||
RenderSelectedOnly = value.RenderSelectedOnly;
|
RenderSelectedOnly = value.RenderSelectedOnly;
|
||||||
AppLanguage = value.AppLanguage;
|
AppLanguage = value.AppLanguage;
|
||||||
}
|
}
|
||||||
@@ -220,6 +230,34 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 预览画面首选项
|
||||||
|
|
||||||
|
public uint MaxFps
|
||||||
|
{
|
||||||
|
get => _vmMain.SFMLRendererViewModel.MaxFps;
|
||||||
|
set => SetProperty(_vmMain.SFMLRendererViewModel.MaxFps, value, v => _vmMain.SFMLRendererViewModel.MaxFps = value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Speed
|
||||||
|
{
|
||||||
|
get => _vmMain.SFMLRendererViewModel.Speed;
|
||||||
|
set => SetProperty(_vmMain.SFMLRendererViewModel.Speed, value, v => _vmMain.SFMLRendererViewModel.Speed = value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ShowAxis
|
||||||
|
{
|
||||||
|
get => _vmMain.SFMLRendererViewModel.ShowAxis;
|
||||||
|
set => SetProperty(_vmMain.SFMLRendererViewModel.ShowAxis, value, v => _vmMain.SFMLRendererViewModel.ShowAxis = value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color BackgroundColor
|
||||||
|
{
|
||||||
|
get => _vmMain.SFMLRendererViewModel.BackgroundColor;
|
||||||
|
set => SetProperty(_vmMain.SFMLRendererViewModel.BackgroundColor, value, v => _vmMain.SFMLRendererViewModel.BackgroundColor = value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region 程序选项
|
#region 程序选项
|
||||||
|
|
||||||
public static ImmutableArray<AppLanguage> AppLanguageOptions { get; } = Enum.GetValues<AppLanguage>().ToImmutableArray();
|
public static ImmutableArray<AppLanguage> AppLanguageOptions { get; } = Enum.GetValues<AppLanguage>().ToImmutableArray();
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border Grid.Row="1">
|
<Border Grid.Row="1">
|
||||||
<Grid>
|
<Grid x:Name="_rootGrid">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
|
|
||||||
<!-- 模型列表页 -->
|
<!-- 模型列表页 -->
|
||||||
<TabItem Header="{DynamicResource Str_SpineObject}">
|
<TabItem Header="{DynamicResource Str_SpineObject}">
|
||||||
<Grid>
|
<Grid x:Name="_modelListGrid">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
@@ -578,7 +578,7 @@
|
|||||||
|
|
||||||
<!-- 浏览页 -->
|
<!-- 浏览页 -->
|
||||||
<TabItem Header="{DynamicResource Str_Explorer}" DataContext="{Binding ExplorerListViewModel}">
|
<TabItem Header="{DynamicResource Str_Explorer}" DataContext="{Binding ExplorerListViewModel}">
|
||||||
<Grid>
|
<Grid x:Name="_explorerGrid">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
@@ -785,14 +785,14 @@
|
|||||||
<GridSplitter Grid.Column="1" ResizeDirection="Columns"/>
|
<GridSplitter Grid.Column="1" ResizeDirection="Columns"/>
|
||||||
|
|
||||||
<Border Grid.Column="2">
|
<Border Grid.Column="2">
|
||||||
<Grid>
|
<Grid x:Name="_rightPanelGrid">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="5*"/>
|
<RowDefinition Height="5*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid >
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ using NLog;
|
|||||||
using NLog.Layouts;
|
using NLog.Layouts;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
using Spine;
|
using Spine;
|
||||||
|
using SpineViewer.Models;
|
||||||
using SpineViewer.Natives;
|
using SpineViewer.Natives;
|
||||||
using SpineViewer.Resources;
|
using SpineViewer.Resources;
|
||||||
|
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.Text;
|
using System.Text;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
@@ -26,6 +29,11 @@ namespace SpineViewer.Views;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 布局文件保存路径
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string LayoutFilePath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "layout.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;
|
||||||
@@ -46,6 +54,8 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
LoadLayout();
|
||||||
|
|
||||||
var vm = _vm.SFMLRendererViewModel;
|
var vm = _vm.SFMLRendererViewModel;
|
||||||
_renderPanel.CanvasMouseWheelScrolled += vm.CanvasMouseWheelScrolled;
|
_renderPanel.CanvasMouseWheelScrolled += vm.CanvasMouseWheelScrolled;
|
||||||
_renderPanel.CanvasMouseButtonPressed += vm.CanvasMouseButtonPressed;
|
_renderPanel.CanvasMouseButtonPressed += vm.CanvasMouseButtonPressed;
|
||||||
@@ -70,6 +80,8 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
var vm = _vm.SFMLRendererViewModel;
|
var vm = _vm.SFMLRendererViewModel;
|
||||||
vm.StopRender();
|
vm.StopRender();
|
||||||
|
|
||||||
|
SaveLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -100,6 +112,50 @@ public partial class MainWindow : Window
|
|||||||
LogManager.ReconfigExistingLoggers();
|
LogManager.ReconfigExistingLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadLayout()
|
||||||
|
{
|
||||||
|
if (JsonHelper.Deserialize<MainWindowLayoutModel>(LayoutFilePath, out var m, true))
|
||||||
|
{
|
||||||
|
Left = m.WindowLeft;
|
||||||
|
Top = m.WindowTop;
|
||||||
|
Width = m.WindowWidth;
|
||||||
|
Height = m.WindowHeight;
|
||||||
|
if (m.WindowState == WindowState.Maximized)
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Maximized;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
_rootGrid.ColumnDefinitions[0].Width = new(m.RootGridCol0Width);
|
||||||
|
_modelListGrid.RowDefinitions[0].Height = new(m.ModelListRow0Height);
|
||||||
|
_explorerGrid.RowDefinitions[0].Height = new(m.ExplorerGridRow0Height);
|
||||||
|
_rightPanelGrid.RowDefinitions[0].Height = new(m.RightPanelGridRow0Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveLayout()
|
||||||
|
{
|
||||||
|
var m = new MainWindowLayoutModel()
|
||||||
|
{
|
||||||
|
WindowLeft = Left,
|
||||||
|
WindowTop = Top,
|
||||||
|
WindowWidth = Width,
|
||||||
|
WindowHeight = Height,
|
||||||
|
WindowState = WindowState,
|
||||||
|
|
||||||
|
RootGridCol0Width = _rootGrid.ColumnDefinitions[0].ActualWidth,
|
||||||
|
ModelListRow0Height = _modelListGrid.RowDefinitions[0].ActualHeight,
|
||||||
|
ExplorerGridRow0Height = _explorerGrid.RowDefinitions[0].ActualHeight,
|
||||||
|
RightPanelGridRow0Height = _rightPanelGrid.RowDefinitions[0].ActualHeight,
|
||||||
|
};
|
||||||
|
|
||||||
|
JsonHelper.Serialize(m, LayoutFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
#region _spinesListView 事件处理
|
#region _spinesListView 事件处理
|
||||||
|
|
||||||
private void SpinesListView_RequestSelectionChanging(object? sender, NotifyCollectionChangedEventArgs e)
|
private void SpinesListView_RequestSelectionChanging(object? sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
|||||||
@@ -134,6 +134,34 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
|
||||||
|
<GroupBox Header="{DynamicResource Str_RendererPreference}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="Col1"/>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource Str_MaxFps}"/>
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding MaxFps}"/>
|
||||||
|
|
||||||
|
<Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource Str_PlaySpeed}"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Speed}"/>
|
||||||
|
|
||||||
|
<Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource Str_ShowAxis}"/>
|
||||||
|
<ToggleButton Grid.Row="2" Grid.Column="1" IsChecked="{Binding ShowAxis}"/>
|
||||||
|
|
||||||
|
<Label Grid.Row="3" Grid.Column="0" Content="{DynamicResource Str_BackgroundColor}" ToolTip="#AARRGGBB"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding BackgroundColor}" ToolTip="#AARRGGBB"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
|
||||||
<GroupBox Header="{DynamicResource Str_AppPreference}">
|
<GroupBox Header="{DynamicResource Str_AppPreference}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|||||||
Reference in New Issue
Block a user