@@ -1,5 +1,11 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## v0.15.14
|
||||||
|
|
||||||
|
- 将预览画面的首选项移动至上一次状态参数中
|
||||||
|
- 增加预览画面像素的自动保存和恢复
|
||||||
|
- 增加日志启动时的版本号输出
|
||||||
|
|
||||||
## v0.15.13
|
## v0.15.13
|
||||||
|
|
||||||
- 增加程序布局自动存储和还原
|
- 增加程序布局自动存储和还原
|
||||||
|
|||||||
@@ -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.13</Version>
|
<Version>0.15.14</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace SpineViewer
|
|||||||
{
|
{
|
||||||
InitializeLogConfiguration();
|
InitializeLogConfiguration();
|
||||||
_logger = LogManager.GetCurrentClassLogger();
|
_logger = LogManager.GetCurrentClassLogger();
|
||||||
_logger.Info("Application Started");
|
_logger.Info("Application Started, v{0}", Version);
|
||||||
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
|
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace SpineViewer.Models
|
namespace SpineViewer.Models
|
||||||
{
|
{
|
||||||
public class MainWindowLayoutModel
|
public class LastStateModel
|
||||||
{
|
{
|
||||||
|
#region 画面布局状态
|
||||||
|
|
||||||
public double WindowLeft { get; set; }
|
public double WindowLeft { get; set; }
|
||||||
public double WindowTop { get; set; }
|
public double WindowTop { get; set; }
|
||||||
public double WindowWidth { get; set; }
|
public double WindowWidth { get; set; }
|
||||||
@@ -19,5 +22,19 @@ namespace SpineViewer.Models
|
|||||||
public double ModelListRow0Height { get; set; }
|
public double ModelListRow0Height { get; set; }
|
||||||
public double ExplorerGridRow0Height { get; set; }
|
public double ExplorerGridRow0Height { get; set; }
|
||||||
public double RightPanelGridRow0Height { get; set; }
|
public double RightPanelGridRow0Height { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 预览画面状态
|
||||||
|
|
||||||
|
public uint ResolutionX { get; set; } = 1500;
|
||||||
|
public uint ResolutionY { get; set; } = 1000;
|
||||||
|
public uint MaxFps { get; set; } = 30;
|
||||||
|
public float Speed { get; set; } = 1f;
|
||||||
|
public bool ShowAxis { get; set; } = true;
|
||||||
|
public Color BackgroundColor { get; set; } = Color.FromRgb(105, 105, 105);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,22 +71,6 @@ 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]
|
||||||
|
|||||||
@@ -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.13</Version>
|
<Version>0.15.14</Version>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -93,11 +93,6 @@ 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,
|
||||||
};
|
};
|
||||||
@@ -122,11 +117,6 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -230,34 +220,6 @@ 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();
|
||||||
|
|||||||
@@ -86,6 +86,14 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event NotifyCollectionChangedEventHandler? RequestSelectionChanging;
|
public event NotifyCollectionChangedEventHandler? RequestSelectionChanging;
|
||||||
|
|
||||||
|
public void SetResolution(uint x, uint y)
|
||||||
|
{
|
||||||
|
var lastRes = _renderer.Resolution;
|
||||||
|
_renderer.Resolution = new(x, y);
|
||||||
|
if (lastRes.X != x) OnPropertyChanged(nameof(ResolutionX));
|
||||||
|
if (lastRes.Y != y) OnPropertyChanged(nameof(ResolutionY));
|
||||||
|
}
|
||||||
|
|
||||||
public uint ResolutionX
|
public uint ResolutionX
|
||||||
{
|
{
|
||||||
get => _renderer.Resolution.X;
|
get => _renderer.Resolution.X;
|
||||||
@@ -455,8 +463,7 @@ namespace SpineViewer.ViewModels.MainWindow
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
ResolutionX = value.ResolutionX;
|
SetResolution(value.ResolutionX, value.ResolutionY);
|
||||||
ResolutionY = value.ResolutionY;
|
|
||||||
CenterX = value.CenterX;
|
CenterX = value.CenterX;
|
||||||
CenterY = value.CenterY;
|
CenterY = value.CenterY;
|
||||||
Zoom = value.Zoom;
|
Zoom = value.Zoom;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public partial class MainWindow : Window
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 布局文件保存路径
|
/// 布局文件保存路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly string LayoutFilePath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "layout.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;
|
||||||
@@ -54,8 +54,6 @@ 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;
|
||||||
@@ -63,8 +61,7 @@ public partial class MainWindow : Window
|
|||||||
_renderPanel.CanvasMouseButtonReleased += vm.CanvasMouseButtonReleased;
|
_renderPanel.CanvasMouseButtonReleased += vm.CanvasMouseButtonReleased;
|
||||||
|
|
||||||
// 设置默认参数并启动渲染
|
// 设置默认参数并启动渲染
|
||||||
vm.ResolutionX = 1500;
|
vm.SetResolution(1500, 1000);
|
||||||
vm.ResolutionY = 1000;
|
|
||||||
vm.Zoom = 0.75f;
|
vm.Zoom = 0.75f;
|
||||||
vm.CenterX = 0;
|
vm.CenterX = 0;
|
||||||
vm.CenterY = 0;
|
vm.CenterY = 0;
|
||||||
@@ -74,14 +71,16 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
// 加载首选项
|
// 加载首选项
|
||||||
_vm.PreferenceViewModel.LoadPreference();
|
_vm.PreferenceViewModel.LoadPreference();
|
||||||
|
|
||||||
|
LoadLastState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainWindow_Closed(object? sender, EventArgs e)
|
private void MainWindow_Closed(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
SaveLastState();
|
||||||
|
|
||||||
var vm = _vm.SFMLRendererViewModel;
|
var vm = _vm.SFMLRendererViewModel;
|
||||||
vm.StopRender();
|
vm.StopRender();
|
||||||
|
|
||||||
SaveLayout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -112,9 +111,9 @@ public partial class MainWindow : Window
|
|||||||
LogManager.ReconfigExistingLoggers();
|
LogManager.ReconfigExistingLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadLayout()
|
private void LoadLastState()
|
||||||
{
|
{
|
||||||
if (JsonHelper.Deserialize<MainWindowLayoutModel>(LayoutFilePath, out var m, true))
|
if (JsonHelper.Deserialize<LastStateModel>(LastStateFilePath, out var m, true))
|
||||||
{
|
{
|
||||||
Left = m.WindowLeft;
|
Left = m.WindowLeft;
|
||||||
Top = m.WindowTop;
|
Top = m.WindowTop;
|
||||||
@@ -133,13 +132,19 @@ public partial class MainWindow : Window
|
|||||||
_modelListGrid.RowDefinitions[0].Height = new(m.ModelListRow0Height);
|
_modelListGrid.RowDefinitions[0].Height = new(m.ModelListRow0Height);
|
||||||
_explorerGrid.RowDefinitions[0].Height = new(m.ExplorerGridRow0Height);
|
_explorerGrid.RowDefinitions[0].Height = new(m.ExplorerGridRow0Height);
|
||||||
_rightPanelGrid.RowDefinitions[0].Height = new(m.RightPanelGridRow0Height);
|
_rightPanelGrid.RowDefinitions[0].Height = new(m.RightPanelGridRow0Height);
|
||||||
|
|
||||||
|
_vm.SFMLRendererViewModel.SetResolution(m.ResolutionX, m.ResolutionY);
|
||||||
|
_vm.SFMLRendererViewModel.MaxFps = m.MaxFps;
|
||||||
|
_vm.SFMLRendererViewModel.Speed = m.Speed;
|
||||||
|
_vm.SFMLRendererViewModel.ShowAxis = m.ShowAxis;
|
||||||
|
_vm.SFMLRendererViewModel.BackgroundColor = m.BackgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveLayout()
|
private void SaveLastState()
|
||||||
{
|
{
|
||||||
var m = new MainWindowLayoutModel()
|
var m = new LastStateModel()
|
||||||
{
|
{
|
||||||
WindowLeft = Left,
|
WindowLeft = Left,
|
||||||
WindowTop = Top,
|
WindowTop = Top,
|
||||||
@@ -151,9 +156,16 @@ public partial class MainWindow : Window
|
|||||||
ModelListRow0Height = _modelListGrid.RowDefinitions[0].ActualHeight,
|
ModelListRow0Height = _modelListGrid.RowDefinitions[0].ActualHeight,
|
||||||
ExplorerGridRow0Height = _explorerGrid.RowDefinitions[0].ActualHeight,
|
ExplorerGridRow0Height = _explorerGrid.RowDefinitions[0].ActualHeight,
|
||||||
RightPanelGridRow0Height = _rightPanelGrid.RowDefinitions[0].ActualHeight,
|
RightPanelGridRow0Height = _rightPanelGrid.RowDefinitions[0].ActualHeight,
|
||||||
|
|
||||||
|
ResolutionX = _vm.SFMLRendererViewModel.ResolutionX,
|
||||||
|
ResolutionY = _vm.SFMLRendererViewModel.ResolutionY,
|
||||||
|
MaxFps = _vm.SFMLRendererViewModel.MaxFps,
|
||||||
|
Speed = _vm.SFMLRendererViewModel.Speed,
|
||||||
|
ShowAxis = _vm.SFMLRendererViewModel.ShowAxis,
|
||||||
|
BackgroundColor = _vm.SFMLRendererViewModel.BackgroundColor,
|
||||||
};
|
};
|
||||||
|
|
||||||
JsonHelper.Serialize(m, LayoutFilePath);
|
JsonHelper.Serialize(m, LastStateFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region _spinesListView 事件处理
|
#region _spinesListView 事件处理
|
||||||
@@ -292,9 +304,7 @@ public partial class MainWindow : Window
|
|||||||
IntPtr hwnd = new WindowInteropHelper(this).Handle;
|
IntPtr hwnd = new WindowInteropHelper(this).Handle;
|
||||||
if (Win32.GetScreenResolution(hwnd, out var resX, out var resY))
|
if (Win32.GetScreenResolution(hwnd, out var resX, out var resY))
|
||||||
{
|
{
|
||||||
var vm = _vm.SFMLRendererViewModel;
|
_vm.SFMLRendererViewModel.SetResolution(resX, resY);
|
||||||
vm.ResolutionX = resX;
|
|
||||||
vm.ResolutionY = resY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HandyControl.Controls.IconElement.SetGeometry(_fullScreenButton, AppResource.Geo_ArrowsMinimize);
|
HandyControl.Controls.IconElement.SetGeometry(_fullScreenButton, AppResource.Geo_ArrowsMinimize);
|
||||||
|
|||||||
@@ -134,34 +134,6 @@
|
|||||||
</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