diff --git a/OpenUtau.Core/OpenUtau.Core.csproj b/OpenUtau.Core/OpenUtau.Core.csproj index de3d0761f..a02ce8815 100644 --- a/OpenUtau.Core/OpenUtau.Core.csproj +++ b/OpenUtau.Core/OpenUtau.Core.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 none true embedded @@ -26,7 +26,9 @@ + + diff --git a/OpenUtau.Plugin.Builtin/OpenUtau.Plugin.Builtin.csproj b/OpenUtau.Plugin.Builtin/OpenUtau.Plugin.Builtin.csproj index bf555d107..f63e96922 100644 --- a/OpenUtau.Plugin.Builtin/OpenUtau.Plugin.Builtin.csproj +++ b/OpenUtau.Plugin.Builtin/OpenUtau.Plugin.Builtin.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 none embedded enable diff --git a/OpenUtau.Test/Classic/UstTest.cs b/OpenUtau.Test/Classic/UstTest.cs index 1863f3916..67e7cda80 100644 --- a/OpenUtau.Test/Classic/UstTest.cs +++ b/OpenUtau.Test/Classic/UstTest.cs @@ -8,7 +8,6 @@ using SharpCompress.Common; using SharpCompress.Readers; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Classic { public class UstTest { diff --git a/OpenUtau.Test/Classic/VoicebankConfigTest.cs b/OpenUtau.Test/Classic/VoicebankConfigTest.cs index d975d2e7f..52674d47b 100644 --- a/OpenUtau.Test/Classic/VoicebankConfigTest.cs +++ b/OpenUtau.Test/Classic/VoicebankConfigTest.cs @@ -1,6 +1,5 @@ using OpenUtau.Core; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Classic { public class VoicebankConfigTest { diff --git a/OpenUtau.Test/Classic/VoicebankLoaderTest.cs b/OpenUtau.Test/Classic/VoicebankLoaderTest.cs index f5d8580d3..c71ed4be7 100644 --- a/OpenUtau.Test/Classic/VoicebankLoaderTest.cs +++ b/OpenUtau.Test/Classic/VoicebankLoaderTest.cs @@ -1,7 +1,6 @@ using System.IO; using System.Text; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Classic { public class VoicebankLoaderTest { diff --git a/OpenUtau.Test/Core/Format/MusicXMLTest.cs b/OpenUtau.Test/Core/Format/MusicXMLTest.cs index 9a7fddbdd..ee20e4de1 100644 --- a/OpenUtau.Test/Core/Format/MusicXMLTest.cs +++ b/OpenUtau.Test/Core/Format/MusicXMLTest.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Reflection; using Xunit; -using Xunit.Abstractions; using OpenUtau.Core.Ustx; diff --git a/OpenUtau.Test/Core/G2p/G2pTest.cs b/OpenUtau.Test/Core/G2p/G2pTest.cs index 238e1611d..050a92c8a 100644 --- a/OpenUtau.Test/Core/G2p/G2pTest.cs +++ b/OpenUtau.Test/Core/G2p/G2pTest.cs @@ -1,5 +1,4 @@ using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Core.G2p { public class G2pTest { diff --git a/OpenUtau.Test/Core/SignalChain/WaveSourceTest.cs b/OpenUtau.Test/Core/SignalChain/WaveSourceTest.cs index 1f544f077..e79caec5a 100644 --- a/OpenUtau.Test/Core/SignalChain/WaveSourceTest.cs +++ b/OpenUtau.Test/Core/SignalChain/WaveSourceTest.cs @@ -1,5 +1,4 @@ using Xunit; -using Xunit.Abstractions; using System.IO; using System.Reflection; using NAudio.Wave; diff --git a/OpenUtau.Test/Core/USTx/UstxYamlTest.cs b/OpenUtau.Test/Core/USTx/UstxYamlTest.cs index c7d500dce..cf5da5d70 100644 --- a/OpenUtau.Test/Core/USTx/UstxYamlTest.cs +++ b/OpenUtau.Test/Core/USTx/UstxYamlTest.cs @@ -1,5 +1,4 @@ using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Core.Ustx { public class UstxYamlTest { diff --git a/OpenUtau.Test/Core/Util/Base64Test.cs b/OpenUtau.Test/Core/Util/Base64Test.cs index 13b09e529..61fd45eef 100644 --- a/OpenUtau.Test/Core/Util/Base64Test.cs +++ b/OpenUtau.Test/Core/Util/Base64Test.cs @@ -1,5 +1,4 @@ using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Core.Util { public class Base64Test { diff --git a/OpenUtau.Test/Core/Util/MusicMathTest.cs b/OpenUtau.Test/Core/Util/MusicMathTest.cs index d02b77e05..ce23f1ba8 100644 --- a/OpenUtau.Test/Core/Util/MusicMathTest.cs +++ b/OpenUtau.Test/Core/Util/MusicMathTest.cs @@ -1,5 +1,4 @@ using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Core.Util { public class MusicMathTest { diff --git a/OpenUtau.Test/Core/Util/SplitLyricsTest.cs b/OpenUtau.Test/Core/Util/SplitLyricsTest.cs index 1eadc9521..cc08f6862 100644 --- a/OpenUtau.Test/Core/Util/SplitLyricsTest.cs +++ b/OpenUtau.Test/Core/Util/SplitLyricsTest.cs @@ -1,5 +1,4 @@ using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Core.Util { public class SplitLyricsTest { diff --git a/OpenUtau.Test/Core/Util/TimeAxisTest.cs b/OpenUtau.Test/Core/Util/TimeAxisTest.cs index 213c0bf56..1ec3f7d29 100644 --- a/OpenUtau.Test/Core/Util/TimeAxisTest.cs +++ b/OpenUtau.Test/Core/Util/TimeAxisTest.cs @@ -1,6 +1,5 @@ using OpenUtau.Core.Ustx; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Core { diff --git a/OpenUtau.Test/OpenUtau.Test.csproj b/OpenUtau.Test/OpenUtau.Test.csproj index d57c9d991..675d3c9fc 100644 --- a/OpenUtau.Test/OpenUtau.Test.csproj +++ b/OpenUtau.Test/OpenUtau.Test.csproj @@ -1,9 +1,9 @@ - net8.0-windows + net10.0-windows - net8.0 + net10.0 none @@ -11,12 +11,11 @@ - + - runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -25,6 +24,9 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + + + diff --git a/OpenUtau.Test/Plugins/DeDiphoneTest.cs b/OpenUtau.Test/Plugins/DeDiphoneTest.cs index 951c73823..84e3a1fe9 100644 --- a/OpenUtau.Test/Plugins/DeDiphoneTest.cs +++ b/OpenUtau.Test/Plugins/DeDiphoneTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public class DeDiphoneTest : PhonemizerTestBase { diff --git a/OpenUtau.Test/Plugins/DeVccvTest.cs b/OpenUtau.Test/Plugins/DeVccvTest.cs index 44789c6cb..5b3f5d35d 100644 --- a/OpenUtau.Test/Plugins/DeVccvTest.cs +++ b/OpenUtau.Test/Plugins/DeVccvTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public class DeVccvTest : PhonemizerTestBase { diff --git a/OpenUtau.Test/Plugins/EnArpaPlusTest.cs b/OpenUtau.Test/Plugins/EnArpaPlusTest.cs index d69694d11..fdffd9bc7 100644 --- a/OpenUtau.Test/Plugins/EnArpaPlusTest.cs +++ b/OpenUtau.Test/Plugins/EnArpaPlusTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public class EnArpaPlusTest : PhonemizerTestBase { @@ -88,4 +87,4 @@ public void HintTest(string lyric, string hint, string[] aliases) { RunPhonemizeTest("en_arpa-plus", new NoteParams[] { new NoteParams { lyric = lyric, hint = hint, tone = "C3", phonemes = SamePhonemeParams(4, 0, 0, "")} }, aliases); } } -} \ No newline at end of file +} diff --git a/OpenUtau.Test/Plugins/EnArpaTest.cs b/OpenUtau.Test/Plugins/EnArpaTest.cs index 2ee08792c..f11652cad 100644 --- a/OpenUtau.Test/Plugins/EnArpaTest.cs +++ b/OpenUtau.Test/Plugins/EnArpaTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public class EnArpaTest : PhonemizerTestBase { diff --git a/OpenUtau.Test/Plugins/EnToJaTest.cs b/OpenUtau.Test/Plugins/EnToJaTest.cs index 54b9ed9d5..c2573cf6e 100644 --- a/OpenUtau.Test/Plugins/EnToJaTest.cs +++ b/OpenUtau.Test/Plugins/EnToJaTest.cs @@ -3,7 +3,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; using System.Linq; namespace OpenUtau.Plugins { diff --git a/OpenUtau.Test/Plugins/EnVCCVTest.cs b/OpenUtau.Test/Plugins/EnVCCVTest.cs index 8ec9ee4fe..30847000e 100644 --- a/OpenUtau.Test/Plugins/EnVCCVTest.cs +++ b/OpenUtau.Test/Plugins/EnVCCVTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public class EnVCCVTest : PhonemizerTestBase { diff --git a/OpenUtau.Test/Plugins/EnXSampaTest.cs b/OpenUtau.Test/Plugins/EnXSampaTest.cs index 536bb5ec0..9872b8c69 100644 --- a/OpenUtau.Test/Plugins/EnXSampaTest.cs +++ b/OpenUtau.Test/Plugins/EnXSampaTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public class EnXSampaTest : PhonemizerTestBase { diff --git a/OpenUtau.Test/Plugins/JaCvvcTest.cs b/OpenUtau.Test/Plugins/JaCvvcTest.cs index e8282439a..5266c1753 100644 --- a/OpenUtau.Test/Plugins/JaCvvcTest.cs +++ b/OpenUtau.Test/Plugins/JaCvvcTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public class JaCvvcTest : PhonemizerTestBase { diff --git a/OpenUtau.Test/Plugins/JaPresampTest.cs b/OpenUtau.Test/Plugins/JaPresampTest.cs index 55127bd37..91d0e1f17 100644 --- a/OpenUtau.Test/Plugins/JaPresampTest.cs +++ b/OpenUtau.Test/Plugins/JaPresampTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public class JaPresampTest : PhonemizerTestBase { diff --git a/OpenUtau.Test/Plugins/JaVcvTest.cs b/OpenUtau.Test/Plugins/JaVcvTest.cs index 0aed10b86..efc5a3048 100644 --- a/OpenUtau.Test/Plugins/JaVcvTest.cs +++ b/OpenUtau.Test/Plugins/JaVcvTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public class JaVcvTest : PhonemizerTestBase { diff --git a/OpenUtau.Test/Plugins/PhonemizerTestBase.cs b/OpenUtau.Test/Plugins/PhonemizerTestBase.cs index 41dedc2be..89b118104 100644 --- a/OpenUtau.Test/Plugins/PhonemizerTestBase.cs +++ b/OpenUtau.Test/Plugins/PhonemizerTestBase.cs @@ -8,7 +8,6 @@ using OpenUtau.Classic; using OpenUtau.Core.Format; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { public abstract class PhonemizerTestBase { diff --git a/OpenUtau.Test/Plugins/ZhCvvcTest.cs b/OpenUtau.Test/Plugins/ZhCvvcTest.cs index 9423226e1..d6af013b5 100644 --- a/OpenUtau.Test/Plugins/ZhCvvcTest.cs +++ b/OpenUtau.Test/Plugins/ZhCvvcTest.cs @@ -1,7 +1,6 @@ using OpenUtau.Api; using OpenUtau.Plugin.Builtin; using Xunit; -using Xunit.Abstractions; namespace OpenUtau.Plugins { diff --git a/OpenUtau/Controls/LyricBox.axaml.cs b/OpenUtau/Controls/LyricBox.axaml.cs index 8c60844e2..51d360054 100644 --- a/OpenUtau/Controls/LyricBox.axaml.cs +++ b/OpenUtau/Controls/LyricBox.axaml.cs @@ -22,7 +22,7 @@ public LyricBox() { IsVisible = false; } - private void Box_GotFocus(object? sender, GotFocusEventArgs e) { + private void Box_GotFocus(object? sender, RoutedEventArgs e) { box.SelectAll(); } @@ -158,7 +158,7 @@ public void Show(UVoicePart part, LyricBoxNoteOrPhoneme noteOrPhoneme, string te viewModel.IsVisible = true; box.SelectAll(); focusTimer = new DispatcherTimer( - TimeSpan.FromMilliseconds(15), + TimeSpan.FromMilliseconds(150), DispatcherPriority.Normal, FocusTimer_Tick); focusTimer.Start(); @@ -166,6 +166,7 @@ public void Show(UVoicePart part, LyricBoxNoteOrPhoneme noteOrPhoneme, string te private void FocusTimer_Tick(object? sender, System.EventArgs e) { box.Focus(); + box.SelectAll(); if (focusTimer != null) { focusTimer.Tick -= FocusTimer_Tick; focusTimer.Stop(); diff --git a/OpenUtau/Controls/NotePropertiesControl.axaml.cs b/OpenUtau/Controls/NotePropertiesControl.axaml.cs index 80cb94531..6596e6dd5 100644 --- a/OpenUtau/Controls/NotePropertiesControl.axaml.cs +++ b/OpenUtau/Controls/NotePropertiesControl.axaml.cs @@ -58,7 +58,7 @@ private void LoadPart(UPart? part) { } private string textBoxValue = string.Empty; - void OnTextBoxGotFocus(object? sender, GotFocusEventArgs args) { + void OnTextBoxGotFocus(object? sender, RoutedEventArgs args) { Log.Debug("Note property textbox got focus"); if(sender is TextBox text) { textBoxValue = text.Text ?? string.Empty; diff --git a/OpenUtau/Controls/NotePropertyExpression.axaml.cs b/OpenUtau/Controls/NotePropertyExpression.axaml.cs index 474de2adc..65f93ff62 100644 --- a/OpenUtau/Controls/NotePropertyExpression.axaml.cs +++ b/OpenUtau/Controls/NotePropertyExpression.axaml.cs @@ -19,7 +19,7 @@ public NotePropertyExpression() { // textbox private string textBoxValue = string.Empty; - void OnTextBoxGotFocus(object? sender, GotFocusEventArgs args) { + void OnTextBoxGotFocus(object? sender, RoutedEventArgs args) { Log.Debug("Note property textbox got focus"); if (sender is TextBox textBox) { textBoxValue = textBox.Text ?? string.Empty; diff --git a/OpenUtau/Controls/PropertyEditors/FloatEditor.cs b/OpenUtau/Controls/PropertyEditors/FloatEditor.cs index 22306110e..c39540ea0 100644 --- a/OpenUtau/Controls/PropertyEditors/FloatEditor.cs +++ b/OpenUtau/Controls/PropertyEditors/FloatEditor.cs @@ -3,6 +3,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Data; +using Avalonia.Input; using Avalonia.Interactivity; using ReactiveUI; @@ -51,7 +52,7 @@ protected void OnTextChanged(string? newText) } } - protected override void OnLostFocus(RoutedEventArgs e) { + protected override void OnLostFocus(FocusChangedEventArgs e) { base.OnLostFocus(e); if (!float.TryParse(Text, out float newValue)) { @@ -59,4 +60,4 @@ protected override void OnLostFocus(RoutedEventArgs e) { } } } -} \ No newline at end of file +} diff --git a/OpenUtau/Controls/PropertyEditors/IntEditor.cs b/OpenUtau/Controls/PropertyEditors/IntEditor.cs index 5cffa2c66..6a6f5f4a9 100644 --- a/OpenUtau/Controls/PropertyEditors/IntEditor.cs +++ b/OpenUtau/Controls/PropertyEditors/IntEditor.cs @@ -4,6 +4,7 @@ using Avalonia.Controls; using Avalonia.Data; using Avalonia.Interactivity; +using Avalonia.Input; using ReactiveUI; namespace OpenUtau.Controls{ @@ -51,12 +52,13 @@ protected void OnTextChanged(string? newText) } } - protected override void OnLostFocus(RoutedEventArgs e) { + protected override void OnLostFocus(FocusChangedEventArgs e) { base.OnLostFocus(e); + if (!int.TryParse(Text, out int newValue)) { Text = Value.ToString(); } } } -} \ No newline at end of file +} diff --git a/OpenUtau/Controls/SearchBar.axaml b/OpenUtau/Controls/SearchBar.axaml index 3bfdee333..20a2f35c9 100644 --- a/OpenUtau/Controls/SearchBar.axaml +++ b/OpenUtau/Controls/SearchBar.axaml @@ -11,7 +11,7 @@ diff --git a/OpenUtau/Controls/SearchBar.axaml.cs b/OpenUtau/Controls/SearchBar.axaml.cs index 90efb2b92..550e539c5 100644 --- a/OpenUtau/Controls/SearchBar.axaml.cs +++ b/OpenUtau/Controls/SearchBar.axaml.cs @@ -56,7 +56,7 @@ public void OnClose(object sender, RoutedEventArgs args) { } } - private void Box_GotFocus(object? sender, GotFocusEventArgs e) { + private void Box_GotFocus(object? sender, RoutedEventArgs e) { box.SelectAll(); } diff --git a/OpenUtau/Controls/TrackHeader.axaml.cs b/OpenUtau/Controls/TrackHeader.axaml.cs index 13a8ec35c..3fffa95ed 100644 --- a/OpenUtau/Controls/TrackHeader.axaml.cs +++ b/OpenUtau/Controls/TrackHeader.axaml.cs @@ -151,11 +151,11 @@ void PanFaderContextRequested(object sender, ContextRequestedEventArgs args) { args.Handled = true; } - void TrackSettingsButtonClicked(object sender, RoutedEventArgs args) { + async void TrackSettingsButtonClicked(object sender, RoutedEventArgs args) { if (track?.Singer != null && track.Singer.Found) { - if (VisualRoot is Window window) { + if (TopLevel.GetTopLevel(this) is Window window) { var dialog = new Views.TrackSettingsDialog(track); - dialog.ShowDialog(window); + await dialog.ShowDialog(window); } } } diff --git a/OpenUtau/OpenUtau.csproj b/OpenUtau/OpenUtau.csproj index 85bf69c8b..b9be6ec6b 100644 --- a/OpenUtau/OpenUtau.csproj +++ b/OpenUtau/OpenUtau.csproj @@ -1,9 +1,9 @@ - net8.0-windows + net10.0-windows - net8.0 + net10.0 WinExe @@ -53,22 +53,22 @@ - + - - - - - - - - + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - @@ -126,4 +126,7 @@ Resources.Designer.cs - \ No newline at end of file + + false + + diff --git a/OpenUtau/Program.cs b/OpenUtau/Program.cs index dab8b1029..418a425e7 100644 --- a/OpenUtau/Program.cs +++ b/OpenUtau/Program.cs @@ -8,7 +8,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Media; -using Avalonia.ReactiveUI; +using ReactiveUI.Avalonia; using OpenUtau.App.ViewModels; using OpenUtau.Core; using Serilog; @@ -75,7 +75,7 @@ public static AppBuilder BuildAvaloniaApp() { return AppBuilder.Configure() .UsePlatformDetect() .LogToTrace() - .UseReactiveUI() + .UseReactiveUI(_ => { }) .With(fontOptions) .With(new X11PlatformOptions {EnableIme = true}); } diff --git a/OpenUtau/ViewModels/CurveViewModel.cs b/OpenUtau/ViewModels/CurveViewModel.cs index 9dd13082f..c6998a65d 100644 --- a/OpenUtau/ViewModels/CurveViewModel.cs +++ b/OpenUtau/ViewModels/CurveViewModel.cs @@ -6,7 +6,7 @@ using OpenUtau.Core.Ustx; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.ViewModels { public class CurveCopyEvent { } @@ -23,8 +23,8 @@ public enum CurveTools { CurveEraserTool } - public class CurveViewModel : ViewModelBase, ICmdSubscriber { - [Reactive] public int CurveToolIndex { get; set; } = 1; + public partial class CurveViewModel : ViewModelBase, ICmdSubscriber { + [Reactive] public partial int CurveToolIndex { get; set; } = 1; public CurveTools CurveTool => (CurveTools)CurveToolIndex; public bool IsSelected(string abbr) => selection.HasValue(abbr); diff --git a/OpenUtau/ViewModels/DebugViewModel.cs b/OpenUtau/ViewModels/DebugViewModel.cs index b2cd76d7c..6ab7bc34c 100644 --- a/OpenUtau/ViewModels/DebugViewModel.cs +++ b/OpenUtau/ViewModels/DebugViewModel.cs @@ -10,7 +10,7 @@ using OpenUtau.App.Views; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using Serilog.Core; using Serilog.Events; using Serilog.Formatting; @@ -39,7 +39,7 @@ public LogEventConverter() { } } - public class DebugViewModel : ViewModelBase { + public partial class DebugViewModel : ViewModelBase { private DebugWindow? window; @@ -121,7 +121,7 @@ public override string ToString() { } } - [Reactive] public LogEventLevel LogEventLevel { get; set; } + [Reactive] public partial LogEventLevel LogEventLevel { get; set; } public ObservableCollection LogEvents => Sink.Inst.LogEvents; public ReactiveCommand ReverseLogOrderCommand { get; private set; } public ReactiveCommand CopyLogCommand { get; private set; } diff --git a/OpenUtau/ViewModels/EditSubbanksViewModel.cs b/OpenUtau/ViewModels/EditSubbanksViewModel.cs index feedc5ea5..a0c5694e2 100644 --- a/OpenUtau/ViewModels/EditSubbanksViewModel.cs +++ b/OpenUtau/ViewModels/EditSubbanksViewModel.cs @@ -8,12 +8,12 @@ using OpenUtau.Core; using OpenUtau.Core.Ustx; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - class VoiceColor : ReactiveObject { - [Reactive] public string Name { get; set; } - [Reactive] public ObservableCollectionExtended Rows { get; set; } + partial class VoiceColor : ReactiveObject { + [Reactive] public partial string Name { get; set; } + [Reactive] public partial ObservableCollectionExtended Rows { get; set; } public VoiceColor(string color, List subbanks) { Name = color; Rows = new ObservableCollectionExtended(); @@ -47,11 +47,11 @@ public override string ToString() => string.IsNullOrEmpty(Name) ? "(main)" : Name; } - class VoiceColorRow : ReactiveObject { + partial class VoiceColorRow : ReactiveObject { public readonly int index; - [Reactive] public string Tone { get; private set; } - [Reactive] public string Prefix { get; set; } - [Reactive] public string Suffix { get; set; } + [Reactive] public partial string Tone { get; private set; } + [Reactive] public partial string Prefix { get; set; } + [Reactive] public partial string Suffix { get; set; } public VoiceColorRow(int index, string prefix, string suffix) { this.index = index; Tone = MusicMath.GetToneName(index); @@ -60,14 +60,14 @@ public VoiceColorRow(int index, string prefix, string suffix) { } } - class EditSubbanksViewModel : ViewModelBase { - [Reactive] public ObservableCollectionExtended Colors { get; set; } - [Reactive] public VoiceColor? SelectedColor { get; set; } - [Reactive] public bool IsEditableColor { get; set; } - [Reactive] public ObservableCollectionExtended? Rows { get; set; } - [Reactive] public ObservableCollectionExtended? SelectedRows { get; set; } - [Reactive] public string Prefix { get; set; } - [Reactive] public string Suffix { get; set; } + partial class EditSubbanksViewModel : ViewModelBase { + [Reactive] public partial ObservableCollectionExtended Colors { get; set; } + [Reactive] public partial VoiceColor? SelectedColor { get; set; } + [Reactive] public partial bool IsEditableColor { get; set; } + [Reactive] public partial ObservableCollectionExtended? Rows { get; set; } + [Reactive] public partial ObservableCollectionExtended? SelectedRows { get; set; } + [Reactive] public partial string Prefix { get; set; } + [Reactive] public partial string Suffix { get; set; } public USinger? Singer { get; private set; } diff --git a/OpenUtau/ViewModels/ExeSetupViewModel.cs b/OpenUtau/ViewModels/ExeSetupViewModel.cs index 00a06c7bd..0dfa07c5e 100644 --- a/OpenUtau/ViewModels/ExeSetupViewModel.cs +++ b/OpenUtau/ViewModels/ExeSetupViewModel.cs @@ -1,9 +1,9 @@ -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - public class ExeSetupViewModel : ViewModelBase { + public partial class ExeSetupViewModel : ViewModelBase { public string filePath; - [Reactive] public string message { get; set; } + [Reactive] public partial string message { get; set; } public ExeSetupViewModel(string filePath) { this.filePath = filePath; message = string.Format(ThemeManager.GetString("exesetup.installing"), filePath); diff --git a/OpenUtau/ViewModels/ExpSelectorViewModel.cs b/OpenUtau/ViewModels/ExpSelectorViewModel.cs index a9c22d7e1..c74ee6225 100644 --- a/OpenUtau/ViewModels/ExpSelectorViewModel.cs +++ b/OpenUtau/ViewModels/ExpSelectorViewModel.cs @@ -7,14 +7,14 @@ using OpenUtau.Core; using OpenUtau.Core.Ustx; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - public class ExpSelectorViewModel : ViewModelBase, ICmdSubscriber { - [Reactive] public int Index { get; set; } - [Reactive] public int SelectedIndex { get; set; } - [Reactive] public ExpDisMode DisplayMode { get; set; } - [Reactive] public UExpressionDescriptor? Descriptor { get; set; } + public partial class ExpSelectorViewModel : ViewModelBase, ICmdSubscriber { + [Reactive] public partial int Index { get; set; } + [Reactive] public partial int SelectedIndex { get; set; } + [Reactive] public partial ExpDisMode DisplayMode { get; set; } + [Reactive] public partial UExpressionDescriptor? Descriptor { get; set; } public string Abbr { get{ if (Descriptor == null) { @@ -25,8 +25,8 @@ public string Abbr { } public ObservableCollection Descriptors => descriptors; public string Header => header.Value; - [Reactive] public IBrush TagBrush { get; set; } - [Reactive] public IBrush Background { get; set; } + [Reactive] public partial IBrush TagBrush { get; set; } + [Reactive] public partial IBrush Background { get; set; } ObservableCollection descriptors = new ObservableCollection(); ObservableAsPropertyHelper header; diff --git a/OpenUtau/ViewModels/ExpressionsViewModel.cs b/OpenUtau/ViewModels/ExpressionsViewModel.cs index 51e29f948..3e61ee0d6 100644 --- a/OpenUtau/ViewModels/ExpressionsViewModel.cs +++ b/OpenUtau/ViewModels/ExpressionsViewModel.cs @@ -9,21 +9,21 @@ using OpenUtau.Core; using OpenUtau.Core.Ustx; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - public class ExpressionBuilder : ReactiveObject { - [Reactive] public string Name { get; set; } - [Reactive] public string Abbr { get; set; } - [Reactive] public int ExpressionType { get; set; } - [Reactive] public float Min { get; set; } - [Reactive] public float Max { get; set; } - [Reactive] public float DefaultValue { get; set; } - [Reactive] public float CustomeDefaultValue { get; set; } - [Reactive] public bool IsFlag { get; set; } - [Reactive] public string Flag { get; set; } - [Reactive] public string OptionValues { get; set; } - [Reactive] public bool SkipOutputIfDefault { get; set; } = false; + public partial class ExpressionBuilder : ReactiveObject { + [Reactive] public partial string Name { get; set; } + [Reactive] public partial string Abbr { get; set; } + [Reactive] public partial int ExpressionType { get; set; } + [Reactive] public partial float Min { get; set; } + [Reactive] public partial float Max { get; set; } + [Reactive] public partial float DefaultValue { get; set; } + [Reactive] public partial float CustomeDefaultValue { get; set; } + [Reactive] public partial bool IsFlag { get; set; } + [Reactive] public partial string Flag { get; set; } + [Reactive] public partial string OptionValues { get; set; } + [Reactive] public partial bool SkipOutputIfDefault { get; set; } = false; public bool IsCustom => isCustom.Value; public bool IsRemovable => isRemovable.Value; @@ -117,10 +117,10 @@ public UExpressionDescriptor Build() { public override string ToString() => Name; } - public class ExpressionsViewModel : ViewModelBase { - [Reactive] public string WindowTitle { get; set; } = "Expressions"; - [Reactive] public bool IsTrackOverride { get; set; } - [Reactive] public string CustomDefaultLabel { get; set; } = ThemeManager.GetString("exps.projectdefault"); + public partial class ExpressionsViewModel : ViewModelBase { + [Reactive] public partial string WindowTitle { get; set; } = "Expressions"; + [Reactive] public partial bool IsTrackOverride { get; set; } + [Reactive] public partial string CustomDefaultLabel { get; set; } = ThemeManager.GetString("exps.projectdefault"); public ReadOnlyObservableCollection Expressions => expressions; public ExpressionBuilder? Expression { diff --git a/OpenUtau/ViewModels/LyricBoxViewModel.cs b/OpenUtau/ViewModels/LyricBoxViewModel.cs index 097966379..c81a174c8 100644 --- a/OpenUtau/ViewModels/LyricBoxViewModel.cs +++ b/OpenUtau/ViewModels/LyricBoxViewModel.cs @@ -6,21 +6,21 @@ using OpenUtau.Core; using OpenUtau.Core.Ustx; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - class LyricBoxViewModel : ViewModelBase { + partial class LyricBoxViewModel : ViewModelBase { public class SuggestionItem { public string Alias { get; set; } = string.Empty; public string Source { get; set; } = string.Empty; } - [Reactive] public UVoicePart? Part { get; set; } - [Reactive] public LyricBoxNoteOrPhoneme? NoteOrPhoneme { get; set; } - [Reactive] public bool IsVisible { get; set; } - [Reactive] public string? Text { get; set; } - [Reactive] public SuggestionItem? SelectedSuggestion { get; set; } - [Reactive] public ObservableCollectionExtended Suggestions { get; set; } + [Reactive] public partial UVoicePart? Part { get; set; } + [Reactive] public partial LyricBoxNoteOrPhoneme? NoteOrPhoneme { get; set; } + [Reactive] public partial bool IsVisible { get; set; } + [Reactive] public partial string? Text { get; set; } + [Reactive] public partial SuggestionItem? SelectedSuggestion { get; set; } + [Reactive] public partial ObservableCollectionExtended Suggestions { get; set; } public bool IsAliasBox => isAliasBox.Value; private readonly ObservableAsPropertyHelper isAliasBox; diff --git a/OpenUtau/ViewModels/LyricsReplaceViewModel.cs b/OpenUtau/ViewModels/LyricsReplaceViewModel.cs index 45a8c730f..f39faaaf7 100644 --- a/OpenUtau/ViewModels/LyricsReplaceViewModel.cs +++ b/OpenUtau/ViewModels/LyricsReplaceViewModel.cs @@ -6,13 +6,13 @@ using OpenUtau.Core; using OpenUtau.Core.Ustx; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - class LyricsReplaceViewModel : ViewModelBase { - [Reactive] public string OldValue { get; set; } = ""; - [Reactive] public string NewValue { get; set; } = ""; - [Reactive] public string Preview { get; set; } = ""; + partial class LyricsReplaceViewModel : ViewModelBase { + [Reactive] public partial string OldValue { get; set; } = ""; + [Reactive] public partial string NewValue { get; set; } = ""; + [Reactive] public partial string Preview { get; set; } = ""; public List PresetList { get; } = new List() { //Increase! new ReplacePreset("-", "", ""), new ReplacePreset(ThemeManager.GetString("lyricsreplace.preset.rmvalphabet"), @"[a-zA-Z]", ""), @@ -21,7 +21,7 @@ class LyricsReplaceViewModel : ViewModelBase { new ReplacePreset(ThemeManager.GetString("lyricsreplace.preset.rmvtone"), @"_?[A-G](#|b)?[1-7]", ""), new ReplacePreset(ThemeManager.GetString("lyricsreplace.preset.rmvspace"), ".* ", "") }; - [Reactive] public ReplacePreset SelectedPreset { get; set; } = new ReplacePreset(); + [Reactive] public partial ReplacePreset SelectedPreset { get; set; } = new ReplacePreset(); public string[] Lyrics { get; private set; } private UVoicePart part; diff --git a/OpenUtau/ViewModels/LyricsViewModel.cs b/OpenUtau/ViewModels/LyricsViewModel.cs index 6388fd81a..261865a9c 100644 --- a/OpenUtau/ViewModels/LyricsViewModel.cs +++ b/OpenUtau/ViewModels/LyricsViewModel.cs @@ -4,15 +4,15 @@ using OpenUtau.Core.Ustx; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - class LyricsViewModel : ViewModelBase { - [Reactive] public string? Text { get; set; } = string.Empty; - [Reactive] public int CurrentCount { get; set; } - [Reactive] public int TotalCount { get; set; } - [Reactive] public bool LivePreview { get; set; } = true; - [Reactive] public bool ApplySelection { get; set; } = true; + partial class LyricsViewModel : ViewModelBase { + [Reactive] public partial string? Text { get; set; } = string.Empty; + [Reactive] public partial int CurrentCount { get; set; } + [Reactive] public partial int TotalCount { get; set; } + [Reactive] public partial bool LivePreview { get; set; } = true; + [Reactive] public partial bool ApplySelection { get; set; } = true; private UVoicePart? part; private UNote[]? notes; diff --git a/OpenUtau/ViewModels/MainWindowViewModel.cs b/OpenUtau/ViewModels/MainWindowViewModel.cs index d3090673f..25a1a0b0f 100644 --- a/OpenUtau/ViewModels/MainWindowViewModel.cs +++ b/OpenUtau/ViewModels/MainWindowViewModel.cs @@ -11,7 +11,7 @@ using OpenUtau.Core.Ustx; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { public class PartsContextMenuArgs { @@ -44,7 +44,7 @@ public RecentFileInfo(string path) { } } - public class MainWindowViewModel : ViewModelBase, ICmdSubscriber { + public partial class MainWindowViewModel : ViewModelBase, ICmdSubscriber { public string Title => !ProjectSaved ? $"{AppVersion}" : $"{(DocManager.Inst.ChangesSaved ? "" : "*")}{AppVersion} [{DocManager.Inst.Project.FilePath}]"; @@ -54,39 +54,39 @@ public class MainWindowViewModel : ViewModelBase, ICmdSubscriber { /// ///0: welcome page, 1: tracks page /// - [Reactive] public int Page { get; set; } = 0; + [Reactive] public partial int Page { get; set; } = 0; ObservableCollectionExtended RecentFiles { get; } = new ObservableCollectionExtended(); ObservableCollectionExtended TemplateFiles { get; } = new ObservableCollectionExtended(); - [Reactive] public bool HasRecovery { get; set; } = false; - [Reactive] public string RecoveryPath { get; set; } = String.Empty; - [Reactive] public string RecoveryString { get; set; } = String.Empty; - - [Reactive] public PlaybackViewModel PlaybackViewModel { get; set; } - [Reactive] public TracksViewModel TracksViewModel { get; set; } - [Reactive] public ReactiveCommand? OpenRecentCommand { get; private set; } - [Reactive] public ReactiveCommand? OpenTemplateCommand { get; private set; } + [Reactive] public partial bool HasRecovery { get; set; } = false; + [Reactive] public partial string RecoveryPath { get; set; } = String.Empty; + [Reactive] public partial string RecoveryString { get; set; } = String.Empty; + + [Reactive] public partial PlaybackViewModel PlaybackViewModel { get; set; } + [Reactive] public partial TracksViewModel TracksViewModel { get; set; } + [Reactive] public partial ReactiveCommand? OpenRecentCommand { get; private set; } + [Reactive] public partial ReactiveCommand? OpenTemplateCommand { get; private set; } public ObservableCollectionExtended OpenRecentMenuItems => openRecentMenuItems; public ObservableCollectionExtended OpenTemplatesMenuItems => openTemplatesMenuItems; public ObservableCollectionExtended TimelineContextMenuItems { get; } = new ObservableCollectionExtended(); - [Reactive] public string ClearCacheHeader { get; set; } + [Reactive] public partial string ClearCacheHeader { get; set; } public bool ProjectSaved => !string.IsNullOrEmpty(DocManager.Inst.Project.FilePath) && DocManager.Inst.Project.Saved; public string AppVersion => $"OpenUtau v{System.Reflection.Assembly.GetEntryAssembly()?.GetName().Version}"; - [Reactive] public double Progress { get; set; } - [Reactive] public string ProgressText { get; set; } - [Reactive] public bool ShowPianoRoll { get; set; } - [Reactive] public double PianoRollMaxHeight { get; set; } - [Reactive] public double PianoRollMinHeight { get; set; } + [Reactive] public partial double Progress { get; set; } + [Reactive] public partial string ProgressText { get; set; } + [Reactive] public partial bool ShowPianoRoll { get; set; } + [Reactive] public partial double PianoRollMaxHeight { get; set; } + [Reactive] public partial double PianoRollMinHeight { get; set; } public ReactiveCommand PartDeleteCommand { get; set; } public ReactiveCommand? AddTempoChangeCmd { get; set; } public ReactiveCommand? DelTempoChangeCmd { get; set; } public ReactiveCommand? AddTimeSigChangeCmd { get; set; } public ReactiveCommand? DelTimeSigChangeCmd { get; set; } - [Reactive] public bool CanUndo { get; set; } = false; - [Reactive] public bool CanRedo { get; set; } = false; - [Reactive] public string UndoText { get; set; } = ThemeManager.GetString("menu.edit.undo"); - [Reactive] public string RedoText { get; set; } = ThemeManager.GetString("menu.edit.redo"); + [Reactive] public partial bool CanUndo { get; set; } = false; + [Reactive] public partial bool CanRedo { get; set; } = false; + [Reactive] public partial string UndoText { get; set; } = ThemeManager.GetString("menu.edit.undo"); + [Reactive] public partial string RedoText { get; set; } = ThemeManager.GetString("menu.edit.redo"); private ObservableCollectionExtended openRecentMenuItems = new ObservableCollectionExtended(); diff --git a/OpenUtau/ViewModels/MergeVoicebankViewModel.cs b/OpenUtau/ViewModels/MergeVoicebankViewModel.cs index 1cf645bdc..ccc15e49a 100644 --- a/OpenUtau/ViewModels/MergeVoicebankViewModel.cs +++ b/OpenUtau/ViewModels/MergeVoicebankViewModel.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using OpenUtau.Classic; using OpenUtau.Core; using OpenUtau.Core.Ustx; @@ -29,20 +29,20 @@ public override string ToString(){ return $"{Name} -> {NewName}"; } } - public class MergeVoicebankViewModel : ViewModelBase { - [Reactive] public int Step { get; set; } + public partial class MergeVoicebankViewModel : ViewModelBase { + [Reactive] public partial int Step { get; set; } public List Voicebanks{ get; set; } public ClassicSinger thisSinger; - [Reactive] public ClassicSinger? OtherSinger { get; set; } + [Reactive] public partial ClassicSinger? OtherSinger { get; set; } List existingDirs = new List(); - [Reactive] public ObservableCollection FolderRenames { get; set; } - [Reactive] public string FolderNameErrors { get; set; } = ""; + [Reactive] public partial ObservableCollection FolderRenames { get; set; } + [Reactive] public partial string FolderNameErrors { get; set; } = ""; List existingSubbanks = new List(); - [Reactive] public ObservableCollection SubbankRenames { get; set; } - [Reactive] public string SubbankNameErrors { get; set; } = ""; + [Reactive] public partial ObservableCollection SubbankRenames { get; set; } + [Reactive] public partial string SubbankNameErrors { get; set; } = ""; List existingVoiceColors = new List(); - [Reactive] public ObservableCollection VoiceColorRenames { get; set; } - [Reactive] public string VoiceColorNameErrors { get; set; } = ""; + [Reactive] public partial ObservableCollection VoiceColorRenames { get; set; } + [Reactive] public partial string VoiceColorNameErrors { get; set; } = ""; string[] supportedAudioTypes = new string[]{".wav", ".flac", ".ogg", ".mp3", ".aiff", ".aif", ".aifc"}; public MergeVoicebankViewModel(ClassicSinger thisVoicebank) { this.thisSinger = thisVoicebank; diff --git a/OpenUtau/ViewModels/NoteDefaultsViewModel.cs b/OpenUtau/ViewModels/NoteDefaultsViewModel.cs index 401a3caf6..db4286c94 100644 --- a/OpenUtau/ViewModels/NoteDefaultsViewModel.cs +++ b/OpenUtau/ViewModels/NoteDefaultsViewModel.cs @@ -5,26 +5,26 @@ using OpenUtau.Core.Ustx; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - class NoteDefaultsViewModel : ViewModelBase { + partial class NoteDefaultsViewModel : ViewModelBase { - [Reactive] public string? DefaultLyric { get; set; } - [Reactive] public string? SplittedLyric { get; set; } - [Reactive] public int CurrentPortamentoLength { get; set; } - [Reactive] public int CurrentPortamentoStart { get; set; } - [Reactive] public int CurrentPitchShape { get; set; } - [Reactive] public float CurrentVibratoLength { get; set; } - [Reactive] public float CurrentVibratoPeriod { get; set; } - [Reactive] public float CurrentVibratoDepth { get; set; } - [Reactive] public float CurrentVibratoIn { get; set; } - [Reactive] public float CurrentVibratoOut { get; set; } - [Reactive] public float CurrentVibratoShift { get; set; } - [Reactive] public float CurrentVibratoDrift { get; set; } - [Reactive] public float CurrentVibratoVolLink { get; set; } - [Reactive] public float AutoVibratoNoteLength { get; set; } - [Reactive] public bool AutoVibratoToggle { get; set; } + [Reactive] public partial string? DefaultLyric { get; set; } + [Reactive] public partial string? SplittedLyric { get; set; } + [Reactive] public partial int CurrentPortamentoLength { get; set; } + [Reactive] public partial int CurrentPortamentoStart { get; set; } + [Reactive] public partial int CurrentPitchShape { get; set; } + [Reactive] public partial float CurrentVibratoLength { get; set; } + [Reactive] public partial float CurrentVibratoPeriod { get; set; } + [Reactive] public partial float CurrentVibratoDepth { get; set; } + [Reactive] public partial float CurrentVibratoIn { get; set; } + [Reactive] public partial float CurrentVibratoOut { get; set; } + [Reactive] public partial float CurrentVibratoShift { get; set; } + [Reactive] public partial float CurrentVibratoDrift { get; set; } + [Reactive] public partial float CurrentVibratoVolLink { get; set; } + [Reactive] public partial float AutoVibratoNoteLength { get; set; } + [Reactive] public partial bool AutoVibratoToggle { get; set; } public List? PortamentoPresets { get; } public NotePresets.PortamentoPreset? ApplyPortamentoPreset { get => appliedPortamentoPreset; diff --git a/OpenUtau/ViewModels/NotePropertiesViewModel.cs b/OpenUtau/ViewModels/NotePropertiesViewModel.cs index 15df14904..83d5c928e 100644 --- a/OpenUtau/ViewModels/NotePropertiesViewModel.cs +++ b/OpenUtau/ViewModels/NotePropertiesViewModel.cs @@ -9,38 +9,38 @@ using OpenUtau.Core.Ustx; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using SharpCompress; namespace OpenUtau.App.ViewModels { - public class NotePropertiesViewModel : ViewModelBase, ICmdSubscriber { + public partial class NotePropertiesViewModel : ViewModelBase, ICmdSubscriber { public string Title { get => ThemeManager.GetString("noteproperty") + " (" + selectedNotes.Count + " notes)"; } - [Reactive] public string Lyric { get; set; } = string.Empty; - [Reactive] public string Tone { get; set; } = string.Empty; - [Reactive] public int Tuning { get; set; } - [Reactive] public FontWeight TuningFontWeight { get; set; } = FontWeight.Normal; - [Reactive] public float PortamentoLength { get; set; } - [Reactive] public float PortamentoStart { get; set; } - [Reactive] public int PitchCurveShape { get; set; } = -1; - [Reactive] public bool VibratoEnable { get; set; } - [Reactive] public float VibratoLength { get; set; } - [Reactive] public float VibratoPeriod { get; set; } - [Reactive] public float VibratoDepth { get; set; } - [Reactive] public float VibratoIn { get; set; } - [Reactive] public float VibratoOut { get; set; } - [Reactive] public float VibratoShift { get; set; } - [Reactive] public float VibratoDrift { get; set; } - [Reactive] public float VibratoVolLink { get; set; } - [Reactive] public float AutoVibratoNoteLength { get; set; } - [Reactive] public bool AutoVibratoToggle { get; set; } - [Reactive] public bool IsNoteSelected { get; set; } = false; - - [Reactive] public ObservableCollection? PortamentoPresets { get; private set; } + [Reactive] public partial string Lyric { get; set; } = string.Empty; + [Reactive] public partial string Tone { get; set; } = string.Empty; + [Reactive] public partial int Tuning { get; set; } + [Reactive] public partial FontWeight TuningFontWeight { get; set; } = FontWeight.Normal; + [Reactive] public partial float PortamentoLength { get; set; } + [Reactive] public partial float PortamentoStart { get; set; } + [Reactive] public partial int PitchCurveShape { get; set; } = -1; + [Reactive] public partial bool VibratoEnable { get; set; } + [Reactive] public partial float VibratoLength { get; set; } + [Reactive] public partial float VibratoPeriod { get; set; } + [Reactive] public partial float VibratoDepth { get; set; } + [Reactive] public partial float VibratoIn { get; set; } + [Reactive] public partial float VibratoOut { get; set; } + [Reactive] public partial float VibratoShift { get; set; } + [Reactive] public partial float VibratoDrift { get; set; } + [Reactive] public partial float VibratoVolLink { get; set; } + [Reactive] public partial float AutoVibratoNoteLength { get; set; } + [Reactive] public partial bool AutoVibratoToggle { get; set; } + [Reactive] public partial bool IsNoteSelected { get; set; } = false; + + [Reactive] public partial ObservableCollection? PortamentoPresets { get; private set; } public NotePresets.PortamentoPreset? ApplyPortamentoPreset { get => appliedPortamentoPreset; set => this.RaiseAndSetIfChanged(ref appliedPortamentoPreset, value); } - [Reactive] public ObservableCollection? VibratoPresets { get; private set; } + [Reactive] public partial ObservableCollection? VibratoPresets { get; private set; } public NotePresets.VibratoPreset? ApplyVibratoPreset { get => appliedVibratoPreset; set => this.RaiseAndSetIfChanged(ref appliedVibratoPreset, value); @@ -577,7 +577,7 @@ public void RemoveAppliedVibratoPreset() { } } - public class NotePropertyExpViewModel : ViewModelBase { + public partial class NotePropertyExpViewModel : ViewModelBase { public string Name { get; set; } public bool IsNumerical { get; set; } = false; public bool IsOptions { get; set; } = false; @@ -587,12 +587,12 @@ public class NotePropertyExpViewModel : ViewModelBase { public string abbr; public float defaultValue; - [Reactive] public bool IsNoteSelected { get; set; } = false; - [Reactive] public float Value { get; set; } - [Reactive] public int SelectedOption { get; set; } - [Reactive] public bool DropDownOpen { get; set; } - [Reactive] public bool HasValue { get; set; } = false; - [Reactive] public FontWeight NameFontWeight { get; set; } + [Reactive] public partial bool IsNoteSelected { get; set; } = false; + [Reactive] public partial float Value { get; set; } + [Reactive] public partial int SelectedOption { get; set; } + [Reactive] public partial bool DropDownOpen { get; set; } + [Reactive] public partial bool HasValue { get; set; } = false; + [Reactive] public partial FontWeight NameFontWeight { get; set; } private NotePropertiesViewModel parentViewmodel; diff --git a/OpenUtau/ViewModels/NotesViewModel.cs b/OpenUtau/ViewModels/NotesViewModel.cs index f81023e08..c180d113c 100644 --- a/OpenUtau/ViewModels/NotesViewModel.cs +++ b/OpenUtau/ViewModels/NotesViewModel.cs @@ -18,7 +18,7 @@ using OpenUtau.Core.Util; using OpenUtau.ViewModels; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using Serilog; using SharpCompress; @@ -34,61 +34,61 @@ public NotesSelectionEvent(NoteSelectionViewModel selection) { } public class WaveformRefreshEvent { } - public class NotesViewModel : ViewModelBase, ICmdSubscriber { - [Reactive] public Rect Bounds { get; set; } + public partial class NotesViewModel : ViewModelBase, ICmdSubscriber { + [Reactive] public partial Rect Bounds { get; set; } public int TickCount => Part?.Duration ?? 480 * 4; public int TrackCount => ViewConstants.MaxTone; - [Reactive] public double TickWidth { get; set; } + [Reactive] public partial double TickWidth { get; set; } public double TrackHeightMin => ViewConstants.NoteHeightMin; public double TrackHeightMax => ViewConstants.NoteHeightMax; - [Reactive] public double TrackHeight { get; set; } - [Reactive] public int TickOrigin { get; set; } - [Reactive] public double TickOffset { get; set; } - [Reactive] public double TrackOffset { get; set; } - [Reactive] public int SnapDiv { get; set; } - [Reactive] public int Key { get; set; } + [Reactive] public partial double TrackHeight { get; set; } + [Reactive] public partial int TickOrigin { get; set; } + [Reactive] public partial double TickOffset { get; set; } + [Reactive] public partial double TrackOffset { get; set; } + [Reactive] public partial int SnapDiv { get; set; } + [Reactive] public partial int Key { get; set; } public ObservableCollectionExtended SnapTicks { get; } = new ObservableCollectionExtended(); - [Reactive] public double PlayPosX { get; set; } - [Reactive] public double PlayPosHighlightX { get; set; } - [Reactive] public double PlayPosHighlightWidth { get; set; } - [Reactive] public bool PlayPosWaitingRendering { get; set; } - [Reactive] public bool CursorTool { get; set; } - [Reactive] public bool PenTool { get; set; } - [Reactive] public bool PenPlusTool { get; set; } - [Reactive] public bool EraserTool { get; set; } - [Reactive] public bool DrawPitchTool { get; set; } - [Reactive] public bool DrawLinePitchTool { get; set; } - [Reactive] public bool OverwritePitchTool { get; set; } - [Reactive] public bool OverwriteLinePitchTool { get; set; } - [Reactive] public bool KnifeTool { get; set; } + [Reactive] public partial double PlayPosX { get; set; } + [Reactive] public partial double PlayPosHighlightX { get; set; } + [Reactive] public partial double PlayPosHighlightWidth { get; set; } + [Reactive] public partial bool PlayPosWaitingRendering { get; set; } + [Reactive] public partial bool CursorTool { get; set; } + [Reactive] public partial bool PenTool { get; set; } + [Reactive] public partial bool PenPlusTool { get; set; } + [Reactive] public partial bool EraserTool { get; set; } + [Reactive] public partial bool DrawPitchTool { get; set; } + [Reactive] public partial bool DrawLinePitchTool { get; set; } + [Reactive] public partial bool OverwritePitchTool { get; set; } + [Reactive] public partial bool OverwriteLinePitchTool { get; set; } + [Reactive] public partial bool KnifeTool { get; set; } public ReactiveCommand SelectToolCommand { get; } - [Reactive] public bool ShowTips { get; set; } - [Reactive] public bool PlayTone { get; set; } - [Reactive] public bool ShowVibrato { get; set; } - [Reactive] public bool ShowPitch { get; set; } - [Reactive] public bool ShowFinalPitch { get; set; } - [Reactive] public bool ShowWaveform { get; set; } - [Reactive] public bool ShowPhoneme { get; set; } - [Reactive] public bool ShowNoteParams { get; set; } - [Reactive] public bool ShowExpressions { get; set; } - [Reactive] public bool IsSnapOn { get; set; } - [Reactive] public string SnapDivText { get; set; } - [Reactive] public string KeyText { get; set; } - [Reactive] public Rect ExpBounds { get; set; } - [Reactive] public string PrimaryKey { get; set; } - [Reactive] public bool PrimaryKeyNotSupported { get; set; } - [Reactive] public bool ShowCurveToolbox { get; set; } - [Reactive] public string SecondaryKey { get; set; } - [Reactive] public double ExpTrackHeight { get; set; } - [Reactive] public double ExpShadowOpacity { get; set; } - [Reactive] public double ExpHeightMin { get; set; } - [Reactive] public double ExpHeightMax { get; set; } - [Reactive] public UVoicePart? Part { get; set; } - [Reactive] public Bitmap? Avatar { get; set; } - [Reactive] public Bitmap? Portrait { get; set; } - [Reactive] public IBrush? PortraitMask { get; set; } - [Reactive] public string WindowTitle { get; set; } = "Piano Roll"; - [Reactive] public SolidColorBrush TrackAccentColor { get; set; } = ThemeManager.GetTrackColor("Blue").AccentColor; + [Reactive] public partial bool ShowTips { get; set; } + [Reactive] public partial bool PlayTone { get; set; } + [Reactive] public partial bool ShowVibrato { get; set; } + [Reactive] public partial bool ShowPitch { get; set; } + [Reactive] public partial bool ShowFinalPitch { get; set; } + [Reactive] public partial bool ShowWaveform { get; set; } + [Reactive] public partial bool ShowPhoneme { get; set; } + [Reactive] public partial bool ShowNoteParams { get; set; } + [Reactive] public partial bool ShowExpressions { get; set; } + [Reactive] public partial bool IsSnapOn { get; set; } + [Reactive] public partial string SnapDivText { get; set; } + [Reactive] public partial string KeyText { get; set; } + [Reactive] public partial Rect ExpBounds { get; set; } + [Reactive] public partial string PrimaryKey { get; set; } + [Reactive] public partial bool PrimaryKeyNotSupported { get; set; } + [Reactive] public partial bool ShowCurveToolbox { get; set; } + [Reactive] public partial string SecondaryKey { get; set; } + [Reactive] public partial double ExpTrackHeight { get; set; } + [Reactive] public partial double ExpShadowOpacity { get; set; } + [Reactive] public partial double ExpHeightMin { get; set; } + [Reactive] public partial double ExpHeightMax { get; set; } + [Reactive] public partial UVoicePart? Part { get; set; } + [Reactive] public partial Bitmap? Avatar { get; set; } + [Reactive] public partial Bitmap? Portrait { get; set; } + [Reactive] public partial IBrush? PortraitMask { get; set; } + [Reactive] public partial string WindowTitle { get; set; } = "Piano Roll"; + [Reactive] public partial SolidColorBrush TrackAccentColor { get; set; } = ThemeManager.GetTrackColor("Blue").AccentColor; public double ViewportTicks => viewportTicks.Value; public double ViewportTracks => viewportTracks.Value; public double SmallChangeX => smallChangeX.Value; @@ -96,8 +96,8 @@ public class NotesViewModel : ViewModelBase, ICmdSubscriber { public double HScrollBarMax => Math.Max(0, TickCount - ViewportTicks); public double VScrollBarMax => Math.Max(0, TrackCount - ViewportTracks); public UProject Project => DocManager.Inst.Project; - [Reactive] public List SnapDivs { get; set; } - [Reactive] public List Keys { get; set; } + [Reactive] public partial List SnapDivs { get; set; } + [Reactive] public partial List Keys { get; set; } public ReactiveCommand SetSnapUnitCommand { get; set; } public ReactiveCommand SetKeyCommand { get; set; } diff --git a/OpenUtau/ViewModels/PackageManagerViewModel.cs b/OpenUtau/ViewModels/PackageManagerViewModel.cs index f24604dd1..5d2eb425e 100644 --- a/OpenUtau/ViewModels/PackageManagerViewModel.cs +++ b/OpenUtau/ViewModels/PackageManagerViewModel.cs @@ -4,19 +4,19 @@ using System.Linq; using System.Threading.Tasks; using OpenUtau.Core; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using System.Reactive; using ReactiveUI; namespace OpenUtau.App.ViewModels { - public class PackageRowViewModel : ViewModelBase { + public partial class PackageRowViewModel : ViewModelBase { public RegistrySoftware? Software { get; } public string Id { get; } public string Name { get; } public string Developer { get; } public string Version { get; } - [Reactive] public bool IsInstalled { get; set; } - [Reactive] public string InstalledVersion { get; set; } = string.Empty; + [Reactive] public partial bool IsInstalled { get; set; } + [Reactive] public partial string InstalledVersion { get; set; } = string.Empty; public bool HasRegistry => Software != null; public bool IsUpToDate => IsInstalled && HasRegistry && !string.IsNullOrEmpty(InstalledVersion) && InstalledVersion == Version; @@ -62,9 +62,9 @@ public void SetInstalled(OudepMetadata info) { } } - public class PackageManagerViewModel : ViewModelBase { + public partial class PackageManagerViewModel : ViewModelBase { public ObservableCollection Available { get; } = new ObservableCollection(); - [Reactive] public string Status { get; set; } = string.Empty; + [Reactive] public partial string Status { get; set; } = string.Empty; public ReactiveCommand RefreshCommand { get; } public ReactiveCommand InstallCommand { get; } public ReactiveCommand UninstallCommand { get; } diff --git a/OpenUtau/ViewModels/PasteParamViewModel.cs b/OpenUtau/ViewModels/PasteParamViewModel.cs index 41a105c17..59ad45a34 100644 --- a/OpenUtau/ViewModels/PasteParamViewModel.cs +++ b/OpenUtau/ViewModels/PasteParamViewModel.cs @@ -1,6 +1,7 @@ using System.Collections.ObjectModel; using OpenUtau.Core; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; +using ReactiveUI; namespace OpenUtau.App.ViewModels { public class PasteParamViewModel { @@ -19,14 +20,14 @@ public PasteParamViewModel() { public ObservableCollection Params { get; } = new ObservableCollection(); } - public class PasteParameter { + public partial class PasteParameter: ReactiveObject { public PasteParameter(string name, string abbr) { Name = name; Abbr = abbr; } public string Name { get; set; } public string Abbr { get; set; } - [Reactive] public bool IsSelected { get; set; } = false; + [Reactive] public partial bool IsSelected { get; set; } = false; public override string ToString() { return Name; } } diff --git a/OpenUtau/ViewModels/PhoneticAssistantViewModel.cs b/OpenUtau/ViewModels/PhoneticAssistantViewModel.cs index c0ec317a7..35c065d2d 100644 --- a/OpenUtau/ViewModels/PhoneticAssistantViewModel.cs +++ b/OpenUtau/ViewModels/PhoneticAssistantViewModel.cs @@ -5,10 +5,10 @@ using OpenUtau.Core.G2p; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - public class PhoneticAssistantViewModel : ViewModelBase { + public partial class PhoneticAssistantViewModel : ViewModelBase { public class G2pOption { public string name; public Type klass; @@ -20,9 +20,9 @@ public G2pOption(Type klass) { } public List G2ps => g2ps; - [Reactive] public G2pOption? G2p { get; set; } - [Reactive] public string? Grapheme { get; set; } - [Reactive] public string Phonemes { get; set; } + [Reactive] public partial G2pOption? G2p { get; set; } + [Reactive] public partial string? Grapheme { get; set; } + [Reactive] public partial string Phonemes { get; set; } private readonly List g2ps = new List() { new G2pOption(typeof(ArpabetG2p)), diff --git a/OpenUtau/ViewModels/PianoRollViewModel.cs b/OpenUtau/ViewModels/PianoRollViewModel.cs index 94c5749bb..3e9aaceeb 100644 --- a/OpenUtau/ViewModels/PianoRollViewModel.cs +++ b/OpenUtau/ViewModels/PianoRollViewModel.cs @@ -12,7 +12,7 @@ using OpenUtau.Core.Util; using OpenUtau.ViewModels; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { public class PhonemeMouseoverEvent { @@ -42,11 +42,11 @@ public PianorollRefreshEvent(string refreshItem) { } } - public class PianoRollViewModel : ViewModelBase, ICmdSubscriber { + public partial class PianoRollViewModel : ViewModelBase, ICmdSubscriber { - [Reactive] public NotesViewModel NotesViewModel { get; set; } - [Reactive] public PlaybackViewModel? PlaybackViewModel { get; set; } - [Reactive] public CurveViewModel CurveViewModel { get; set; } + [Reactive] public partial NotesViewModel NotesViewModel { get; set; } + [Reactive] public partial PlaybackViewModel? PlaybackViewModel { get; set; } + [Reactive] public partial CurveViewModel CurveViewModel { get; set; } public double Width => Preferences.Default.PianorollWindowSize.Width; public double Height => Preferences.Default.PianorollWindowSize.Height; @@ -84,11 +84,11 @@ public class PianoRollViewModel : ViewModelBase, ICmdSubscriber { public Dictionary LegacyPluginShortcuts { get; private set; } = new Dictionary(); - [Reactive] public double Progress { get; set; } - [Reactive] public bool CanUndo { get; set; } = false; - [Reactive] public bool CanRedo { get; set; } = false; - [Reactive] public string UndoText { get; set; } = ThemeManager.GetString("menu.edit.undo"); - [Reactive] public string RedoText { get; set; } = ThemeManager.GetString("menu.edit.redo"); + [Reactive] public partial double Progress { get; set; } + [Reactive] public partial bool CanUndo { get; set; } = false; + [Reactive] public partial bool CanRedo { get; set; } = false; + [Reactive] public partial string UndoText { get; set; } = ThemeManager.GetString("menu.edit.undo"); + [Reactive] public partial string RedoText { get; set; } = ThemeManager.GetString("menu.edit.redo"); public ReactiveCommand NoteDeleteCommand { get; set; } public ReactiveCommand NoteCopyCommand { get; set; } diff --git a/OpenUtau/ViewModels/PreferencesViewModel.cs b/OpenUtau/ViewModels/PreferencesViewModel.cs index 958f0fe8f..44ef3d618 100644 --- a/OpenUtau/ViewModels/PreferencesViewModel.cs +++ b/OpenUtau/ViewModels/PreferencesViewModel.cs @@ -10,7 +10,8 @@ using OpenUtau.Core; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; +using ReactiveUI.Avalonia; using OpenUtau.Core.Render; using Serilog; @@ -25,7 +26,7 @@ public override string ToString() { } } - public class PreferencesViewModel : ViewModelBase { + public partial class PreferencesViewModel : ViewModelBase { // General private CultureInfo? language; private CultureInfo? sortingOrder; @@ -40,7 +41,7 @@ public CultureInfo? SortingOrder { get => sortingOrder; set => this.RaiseAndSetIfChanged(ref sortingOrder, value); } - [Reactive] public bool Beta { get; set; } + [Reactive] public partial bool Beta { get; set; } // Playback private List? audioOutputDevices; @@ -54,59 +55,59 @@ public AudioOutputDevice? AudioOutputDevice { get => audioOutputDevice; set => this.RaiseAndSetIfChanged(ref audioOutputDevice, value); } - [Reactive] public int PreferPortAudio { get; set; } - [Reactive] public int LockStartTime { get; set; } - [Reactive] public int PlaybackAutoScroll { get; set; } - [Reactive] public double PlayPosMarkerMargin { get; set; } + [Reactive] public partial int PreferPortAudio { get; set; } + [Reactive] public partial int LockStartTime { get; set; } + [Reactive] public partial int PlaybackAutoScroll { get; set; } + [Reactive] public partial double PlayPosMarkerMargin { get; set; } // Paths public string SingerPath => PathManager.Inst.SingersPath; public string AdditionalSingersPath => !string.IsNullOrWhiteSpace(PathManager.Inst.AdditionalSingersPath) ? PathManager.Inst.AdditionalSingersPath : "(None)"; - [Reactive] public bool InstallToAdditionalSingersPath { get; set; } - [Reactive] public bool LoadDeepFolders { get; set; } + [Reactive] public partial bool InstallToAdditionalSingersPath { get; set; } + [Reactive] public partial bool LoadDeepFolders { get; set; } // Editing public List LyricsHelpers { get; } = ActiveLyricsHelper.Inst.Available .Select(klass => new LyricsHelperOption(klass)) .ToList(); - [Reactive] public LyricsHelperOption? LyricsHelper { get; set; } - [Reactive] public bool LyricsHelperBrackets { get; set; } - [Reactive] public bool PenPlusDefault { get; set; } + [Reactive] public partial LyricsHelperOption? LyricsHelper { get; set; } + [Reactive] public partial bool LyricsHelperBrackets { get; set; } + [Reactive] public partial bool PenPlusDefault { get; set; } // Render - [Reactive] public bool PreRender { get; set; } - [Reactive] public int NumRenderThreads { get; set; } + [Reactive] public partial bool PreRender { get; set; } + [Reactive] public partial int NumRenderThreads { get; set; } public int LogicalCoreCount { get => Environment.ProcessorCount; } - [Reactive] public bool HighThreads { get; set; } + [Reactive] public partial bool HighThreads { get; set; } public int SafeMaxThreadCount { get => Math.Min(8, LogicalCoreCount / 2); } - [Reactive] public bool SkipRenderingMutedTracks { get; set; } - [Reactive] public bool ClearCacheOnQuit { get; set; } + [Reactive] public partial bool SkipRenderingMutedTracks { get; set; } + [Reactive] public partial bool ClearCacheOnQuit { get; set; } public List OnnxRunnerOptions { get; set; } - [Reactive] public string OnnxRunner { get; set; } + [Reactive] public partial string OnnxRunner { get; set; } public List OnnxGpuOptions { get; set; } - [Reactive] public GpuInfo OnnxGpu { get; set; } - [Reactive] public bool ShowOnnxGpu { get; set; } + [Reactive] public partial GpuInfo OnnxGpu { get; set; } + [Reactive] public partial bool ShowOnnxGpu { get; set; } // Appearance - [Reactive] public string ThemeName { get; set; } - [Reactive] public int DegreeStyle { get; set; } - [Reactive] public bool UseTrackColor { get; set; } - [Reactive] public bool ShowPortrait { get; set; } - [Reactive] public bool ShowIcon { get; set; } - [Reactive] public bool ShowGhostNotes { get; set; } - [Reactive] public bool ThemeEditable { get; set; } + [Reactive] public partial string ThemeName { get; set; } + [Reactive] public partial int DegreeStyle { get; set; } + [Reactive] public partial bool UseTrackColor { get; set; } + [Reactive] public partial bool ShowPortrait { get; set; } + [Reactive] public partial bool ShowIcon { get; set; } + [Reactive] public partial bool ShowGhostNotes { get; set; } + [Reactive] public partial bool ThemeEditable { get; set; } public List ThemeItems => ThemeManager.GetAvailableThemes(); public bool IsThemeEditorOpen => Views.ThemeEditorWindow.IsOpen; // UTAU public List DefaultRendererOptions { get; set; } - [Reactive] public string DefaultRenderer { get; set; } - [Reactive] public int OtoEditor { get; set; } + [Reactive] public partial string DefaultRenderer { get; set; } + [Reactive] public partial int OtoEditor { get; set; } public string VLabelerPath => Preferences.Default.VLabelerPath; public string SetParamPath => Preferences.Default.SetParamPath; @@ -114,17 +115,17 @@ public int SafeMaxThreadCount { public List DiffSingerStepsOptions { get; } = new List { 2, 5, 10, 20, 50, 100, 200, 500, 1000 }; public List DiffSingerStepsVarianceOptions { get; } = new List { 2, 5, 10, 20, 50, 100, 200, 500, 1000 }; public List DiffSingerStepsPitchOptions { get; } = new List { 2, 5, 10, 20, 50, 100, 200, 500, 1000 }; - [Reactive] public int DiffSingerSteps { get; set; } - [Reactive] public int DiffSingerStepsVariance { get; set; } - [Reactive] public int DiffSingerStepsPitch { get; set; } - [Reactive] public double DiffSingerDepth { get; set; } - [Reactive] public bool DiffSingerTensorCache { get; set; } - [Reactive] public bool DiffSingerLangCodeHide { get; set; } + [Reactive] public partial int DiffSingerSteps { get; set; } + [Reactive] public partial int DiffSingerStepsVariance { get; set; } + [Reactive] public partial int DiffSingerStepsPitch { get; set; } + [Reactive] public partial double DiffSingerDepth { get; set; } + [Reactive] public partial bool DiffSingerTensorCache { get; set; } + [Reactive] public partial bool DiffSingerLangCodeHide { get; set; } // Advanced - [Reactive] public bool RememberMid { get; set; } - [Reactive] public bool RememberUst { get; set; } - [Reactive] public bool RememberVsqx { get; set; } + [Reactive] public partial bool RememberMid { get; set; } + [Reactive] public partial bool RememberUst { get; set; } + [Reactive] public partial bool RememberVsqx { get; set; } public string WinePath => Preferences.Default.WinePath; public PreferencesViewModel() { @@ -195,7 +196,7 @@ public PreferencesViewModel() { this.WhenAnyValue(vm => vm.AudioOutputDevice) .WhereNotNull() - .SubscribeOn(RxApp.MainThreadScheduler) + .SubscribeOn(AvaloniaScheduler.Instance) .Subscribe(device => { if (PlaybackManager.Inst.AudioOutput != null) { try { diff --git a/OpenUtau/ViewModels/SearchNoteViewModel.cs b/OpenUtau/ViewModels/SearchNoteViewModel.cs index 1dc5a7eb8..0cf855d0d 100644 --- a/OpenUtau/ViewModels/SearchNoteViewModel.cs +++ b/OpenUtau/ViewModels/SearchNoteViewModel.cs @@ -5,20 +5,20 @@ using OpenUtau.Core; using OpenUtau.Core.Ustx; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - class SearchNoteViewModel : ViewModelBase { - [Reactive] public bool NoteMode { get; set; } - [Reactive] public string SearchWord { get; set; } = ""; + partial class SearchNoteViewModel : ViewModelBase { + [Reactive] public partial bool NoteMode { get; set; } + [Reactive] public partial string SearchWord { get; set; } = ""; public string Watermark { get => ThemeManager.GetString(NoteMode ? "pianoroll.menu.searchnote" : "pianoroll.menu.searchnote.searchalias"); } - [Reactive] public int Count { get; private set; } + [Reactive] public partial int Count { get; private set; } public ReactiveCommand SelectCommand { get; } NotesViewModel notesViewModel { get; } List notes = new List(); int selection = -1; - [Reactive]public string ResultCount { get; private set; } = ""; + [Reactive] public partial string ResultCount { get; private set; } = ""; bool CaseSensitive{ get; set; } = true; bool WholeWord{ get; set; } = false; diff --git a/OpenUtau/ViewModels/SingerPublishViewModel.cs b/OpenUtau/ViewModels/SingerPublishViewModel.cs index 64cc277ec..a315f73f9 100644 --- a/OpenUtau/ViewModels/SingerPublishViewModel.cs +++ b/OpenUtau/ViewModels/SingerPublishViewModel.cs @@ -4,13 +4,13 @@ using OpenUtau.Core; using OpenUtau.Core.Util; using OpenUtau.Core.Ustx; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - public class SingerPublishViewModel : ViewModelBase { + public partial class SingerPublishViewModel : ViewModelBase { public USinger singer; - [Reactive] public bool UseIgnore { get; set; } - [Reactive] public string IgnoreTypes { get; set; } + [Reactive] public partial bool UseIgnore { get; set; } + [Reactive] public partial string IgnoreTypes { get; set; } public SingerPublishViewModel(USinger singer) { this.singer = singer; @@ -43,4 +43,4 @@ public Task Publish(string outputFile){ }); } } -} \ No newline at end of file +} diff --git a/OpenUtau/ViewModels/SingerSetupViewModel.cs b/OpenUtau/ViewModels/SingerSetupViewModel.cs index 9a76acc82..2708a529b 100644 --- a/OpenUtau/ViewModels/SingerSetupViewModel.cs +++ b/OpenUtau/ViewModels/SingerSetupViewModel.cs @@ -8,16 +8,16 @@ using OpenUtau.Classic; using OpenUtau.Core; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using SharpCompress.Archives; using SharpCompress.Common; using SharpCompress.Readers; namespace OpenUtau.App.ViewModels { - public class SingerSetupViewModel : ViewModelBase { - [Reactive] public int Step { get; set; } + public partial class SingerSetupViewModel : ViewModelBase { + [Reactive] public partial int Step { get; set; } public ObservableCollection TextItems => textItems; - [Reactive] public string ArchiveFilePath { get; set; } = string.Empty; + [Reactive] public partial string ArchiveFilePath { get; set; } = string.Empty; public Encoding[] Encodings { get; set; } = new Encoding[] { Encoding.GetEncoding("shift_jis"), Encoding.UTF8, @@ -27,11 +27,11 @@ public class SingerSetupViewModel : ViewModelBase { Encoding.GetEncoding("Windows-1252"), Encoding.GetEncoding("macintosh"), }; - [Reactive] public Encoding ArchiveEncoding { get; set; } - [Reactive] public Encoding TextEncoding { get; set; } - [Reactive] public bool MissingInfo { get; set; } + [Reactive] public partial Encoding ArchiveEncoding { get; set; } + [Reactive] public partial Encoding TextEncoding { get; set; } + [Reactive] public partial bool MissingInfo { get; set; } public string[] SingerTypes { get; set; } = new[] { "utau", "enunu", "diffsinger" }; - [Reactive] public string SingerType { get; set; } + [Reactive] public partial string SingerType { get; set; } private ObservableCollectionExtended textItems; diff --git a/OpenUtau/ViewModels/SingersViewModel.cs b/OpenUtau/ViewModels/SingersViewModel.cs index 1b5a65751..30e0d3727 100644 --- a/OpenUtau/ViewModels/SingersViewModel.cs +++ b/OpenUtau/ViewModels/SingersViewModel.cs @@ -16,30 +16,30 @@ using OpenUtau.Core; using OpenUtau.Core.Ustx; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using Serilog; namespace OpenUtau.App.ViewModels { - public class SingersViewModel : ViewModelBase { + public partial class SingersViewModel : ViewModelBase { public IEnumerable Singers => SingerManager.Inst.SingerGroups.Values.SelectMany(l => l); - [Reactive] public USinger? Singer { get; set; } - [Reactive] public Bitmap? Avatar { get; set; } - [Reactive] public string? Info { get; set; } - [Reactive] public bool HasWebsite { get; set; } + [Reactive] public partial USinger? Singer { get; set; } + [Reactive] public partial Bitmap? Avatar { get; set; } + [Reactive] public partial string? Info { get; set; } + [Reactive] public partial bool HasWebsite { get; set; } public bool IsClassic => Singer != null && Singer.SingerType == USingerType.Classic; public bool UseSearchAlias => Singer != null && (Singer.SingerType == USingerType.Classic || Singer.SingerType == USingerType.Enunu); public ObservableCollectionExtended Subbanks => subbanks; public ObservableCollectionExtended Otos => otos; public ObservableCollectionExtended DisplayedOtos { get; set; } = new ObservableCollectionExtended(); - [Reactive] public bool ZoomInMel { get; set; } - [Reactive] public UOto? SelectedOto { get; set; } - [Reactive] public int SelectedIndex { get; set; } + [Reactive] public partial bool ZoomInMel { get; set; } + [Reactive] public partial UOto? SelectedOto { get; set; } + [Reactive] public partial int SelectedIndex { get; set; } public List SetEncodingMenuItems => setEncodingMenuItems; public List SetSingerTypeMenuItems => setSingerTypeMenuItems; public List SetDefaultPhonemizerMenuItems => setDefaultPhonemizerMenuItems; - [Reactive] public bool UseFilenameAsAlias { get; set; } = false; + [Reactive] public partial bool UseFilenameAsAlias { get; set; } = false; - [Reactive] public string SearchAlias { get; set; } = ""; + [Reactive] public partial string SearchAlias { get; set; } = ""; private readonly ObservableCollectionExtended subbanks = new ObservableCollectionExtended(); diff --git a/OpenUtau/ViewModels/ThemeEditorViewModel.cs b/OpenUtau/ViewModels/ThemeEditorViewModel.cs index dd0dc0fd2..d1f6125a1 100644 --- a/OpenUtau/ViewModels/ThemeEditorViewModel.cs +++ b/OpenUtau/ViewModels/ThemeEditorViewModel.cs @@ -6,58 +6,58 @@ using Avalonia.Styling; using OpenUtau.Core; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using Serilog; using OpenUtau.Colors; namespace OpenUtau.App.ViewModels { public class ThemeEditorStateChangedEvent { } - public class ThemeEditorViewModel : ViewModelBase { + public partial class ThemeEditorViewModel : ViewModelBase { private readonly string customThemePath; private readonly string Name; - [Reactive] public bool IsDarkMode { get; set; } - [Reactive] public Color BackgroundColor { get; set; } - [Reactive] public Color BackgroundColorPointerOver { get; set; } - [Reactive] public Color BackgroundColorPressed { get; set; } - [Reactive] public Color BackgroundColorDisabled { get; set; } - - [Reactive] public Color ForegroundColor { get; set; } - [Reactive] public Color ForegroundColorPointerOver { get; set; } - [Reactive] public Color ForegroundColorPressed { get; set; } - [Reactive] public Color ForegroundColorDisabled { get; set; } - - [Reactive] public Color BorderColor { get; set; } - [Reactive] public Color BorderColorPointerOver { get; set; } - - [Reactive] public Color SystemAccentColor { get; set; } - [Reactive] public Color SystemAccentColorLight1 { get; set; } - [Reactive] public Color SystemAccentColorDark1 { get; set; } - - [Reactive] public Color NeutralAccentColor { get; set; } - [Reactive] public Color NeutralAccentColorPointerOver { get; set; } - [Reactive] public Color AccentColor1 { get; set; } - [Reactive] public Color AccentColor2 { get; set; } - [Reactive] public Color AccentColor3 { get; set; } - - [Reactive] public Color TickLineColor { get; set; } - [Reactive] public Color BarNumberColor { get; set; } - [Reactive] public Color FinalPitchColor { get; set; } - [Reactive] public Color TrackBackgroundAltColor { get; set; } - - [Reactive] public Color WhiteKeyColorLeft { get; set; } - [Reactive] public Color WhiteKeyColorRight { get; set; } - [Reactive] public Color WhiteKeyNameColor { get; set; } - - [Reactive] public Color CenterKeyColorLeft { get; set; } - [Reactive] public Color CenterKeyColorRight { get; set; } - [Reactive] public Color CenterKeyNameColor { get; set; } - - [Reactive] public Color BlackKeyColorLeft { get; set; } - [Reactive] public Color BlackKeyColorRight { get; set; } - [Reactive] public Color BlackKeyNameColor { get; set; } + [Reactive] public partial bool IsDarkMode { get; set; } + [Reactive] public partial Color BackgroundColor { get; set; } + [Reactive] public partial Color BackgroundColorPointerOver { get; set; } + [Reactive] public partial Color BackgroundColorPressed { get; set; } + [Reactive] public partial Color BackgroundColorDisabled { get; set; } + + [Reactive] public partial Color ForegroundColor { get; set; } + [Reactive] public partial Color ForegroundColorPointerOver { get; set; } + [Reactive] public partial Color ForegroundColorPressed { get; set; } + [Reactive] public partial Color ForegroundColorDisabled { get; set; } + + [Reactive] public partial Color BorderColor { get; set; } + [Reactive] public partial Color BorderColorPointerOver { get; set; } + + [Reactive] public partial Color SystemAccentColor { get; set; } + [Reactive] public partial Color SystemAccentColorLight1 { get; set; } + [Reactive] public partial Color SystemAccentColorDark1 { get; set; } + + [Reactive] public partial Color NeutralAccentColor { get; set; } + [Reactive] public partial Color NeutralAccentColorPointerOver { get; set; } + [Reactive] public partial Color AccentColor1 { get; set; } + [Reactive] public partial Color AccentColor2 { get; set; } + [Reactive] public partial Color AccentColor3 { get; set; } + + [Reactive] public partial Color TickLineColor { get; set; } + [Reactive] public partial Color BarNumberColor { get; set; } + [Reactive] public partial Color FinalPitchColor { get; set; } + [Reactive] public partial Color TrackBackgroundAltColor { get; set; } + + [Reactive] public partial Color WhiteKeyColorLeft { get; set; } + [Reactive] public partial Color WhiteKeyColorRight { get; set; } + [Reactive] public partial Color WhiteKeyNameColor { get; set; } + + [Reactive] public partial Color CenterKeyColorLeft { get; set; } + [Reactive] public partial Color CenterKeyColorRight { get; set; } + [Reactive] public partial Color CenterKeyNameColor { get; set; } + + [Reactive] public partial Color BlackKeyColorLeft { get; set; } + [Reactive] public partial Color BlackKeyColorRight { get; set; } + [Reactive] public partial Color BlackKeyNameColor { get; set; } public ThemeEditorViewModel(string customThemePath) { this.customThemePath = customThemePath; diff --git a/OpenUtau/ViewModels/TrackColorViewModel.cs b/OpenUtau/ViewModels/TrackColorViewModel.cs index 0416313ba..3692c697f 100644 --- a/OpenUtau/ViewModels/TrackColorViewModel.cs +++ b/OpenUtau/ViewModels/TrackColorViewModel.cs @@ -2,12 +2,12 @@ using System.Linq; using OpenUtau.Core; using OpenUtau.Core.Ustx; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - public class TrackColorViewModel : ViewModelBase { + public partial class TrackColorViewModel : ViewModelBase { public ObservableCollection TrackColors { get; } = new ObservableCollection(ThemeManager.TrackColors); - [Reactive] public TrackColor SelectedColor { get; set; } + [Reactive] public partial TrackColor SelectedColor { get; set; } private UTrack track; public TrackColorViewModel(UTrack track) { diff --git a/OpenUtau/ViewModels/TrackHeaderViewModel.cs b/OpenUtau/ViewModels/TrackHeaderViewModel.cs index 1c62570aa..37808b522 100644 --- a/OpenUtau/ViewModels/TrackHeaderViewModel.cs +++ b/OpenUtau/ViewModels/TrackHeaderViewModel.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Reactive; using System.Reactive.Disposables; +using System.Reactive.Disposables.Fluent; using System.Reactive.Linq; using Avalonia; using Avalonia.Controls.ApplicationLifetimes; @@ -16,11 +17,11 @@ using OpenUtau.Core.Ustx; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using Serilog; namespace OpenUtau.App.ViewModels { - public class TrackHeaderViewModel : ViewModelBase, IActivatableViewModel { + public partial class TrackHeaderViewModel : ViewModelBase, IActivatableViewModel { public int TrackNo => track.TrackNo + 1; public USinger Singer => track.Singer; public Phonemizer Phonemizer => track.Phonemizer; @@ -32,18 +33,18 @@ public class TrackHeaderViewModel : ViewModelBase, IActivatableViewModel { public ReactiveCommand SelectPhonemizerCommand { get; } public IReadOnlyList? RenderersMenuItems { get; set; } public ReactiveCommand SelectRendererCommand { get; } - [Reactive] public string TrackName { get; set; } = string.Empty; - [Reactive] public SolidColorBrush TrackAccentColor { get; set; } = ThemeManager.GetTrackColor("Blue").AccentColor; - [Reactive] public TrackColor TrackColor { get; set; } = ThemeManager.GetTrackColor("Blue"); - [Reactive] public double Volume { get; set; } - [Reactive] public double Pan { get; set; } - [Reactive] public bool Mute { get; set; } - [Reactive] public bool Muted { get; set; } - [Reactive] public bool Solo { get; set; } - [Reactive] public Bitmap? Avatar { get; set; } - [Reactive] public bool IsSingerVisible { get; set; } - [Reactive] public bool IsPhonemizerVisible { get; set; } - [Reactive] public bool IsRendererVisible { get; set; } + [Reactive] public partial string TrackName { get; set; } = string.Empty; + [Reactive] public partial SolidColorBrush TrackAccentColor { get; set; } = ThemeManager.GetTrackColor("Blue").AccentColor; + [Reactive] public partial TrackColor TrackColor { get; set; } = ThemeManager.GetTrackColor("Blue"); + [Reactive] public partial double Volume { get; set; } + [Reactive] public partial double Pan { get; set; } + [Reactive] public partial bool Mute { get; set; } + [Reactive] public partial bool Muted { get; set; } + [Reactive] public partial bool Solo { get; set; } + [Reactive] public partial Bitmap? Avatar { get; set; } + [Reactive] public partial bool IsSingerVisible { get; set; } + [Reactive] public partial bool IsPhonemizerVisible { get; set; } + [Reactive] public partial bool IsRendererVisible { get; set; } public ViewModelActivator Activator { get; } diff --git a/OpenUtau/ViewModels/TrackSettingsViewModel.cs b/OpenUtau/ViewModels/TrackSettingsViewModel.cs index 1fc53fc18..8b12cdffd 100644 --- a/OpenUtau/ViewModels/TrackSettingsViewModel.cs +++ b/OpenUtau/ViewModels/TrackSettingsViewModel.cs @@ -7,18 +7,18 @@ using OpenUtau.Core.Ustx; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { - class TrackSettingsViewModel : ViewModelBase { + partial class TrackSettingsViewModel : ViewModelBase { public UTrack Track { get; private set; } public ObservableCollectionExtended Resamplers => resamplers; - [Reactive] public IResampler? Resampler { get; set; } - [Reactive] public bool NeedsResampler { get; set; } + [Reactive] public partial IResampler? Resampler { get; set; } + [Reactive] public partial bool NeedsResampler { get; set; } public ObservableCollectionExtended Wavtools => wavtools; - [Reactive] public IWavtool? Wavtool { get; set; } - [Reactive] public bool NeedsWavtool { get; set; } - [Reactive] public bool IsNotClassic { get; set; } + [Reactive] public partial IWavtool? Wavtool { get; set; } + [Reactive] public partial bool NeedsWavtool { get; set; } + [Reactive] public partial bool IsNotClassic { get; set; } ObservableCollectionExtended resamplers = new ObservableCollectionExtended(); diff --git a/OpenUtau/ViewModels/TracksViewModel.cs b/OpenUtau/ViewModels/TracksViewModel.cs index 7ecc60458..1b8386baa 100644 --- a/OpenUtau/ViewModels/TracksViewModel.cs +++ b/OpenUtau/ViewModels/TracksViewModel.cs @@ -9,7 +9,7 @@ using OpenUtau.Core.Ustx; using OpenUtau.Core.Util; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { public class TracksRefreshEvent { } @@ -48,24 +48,24 @@ public class PartRedrawEvent { public PartRedrawEvent(UPart part) { this.part = part; } } - public class TracksViewModel : ViewModelBase, ICmdSubscriber { + public partial class TracksViewModel : ViewModelBase, ICmdSubscriber { public UProject Project => DocManager.Inst.Project; - [Reactive] public Rect Bounds { get; set; } + [Reactive] public partial Rect Bounds { get; set; } public int TickCount => Math.Max(Project.timeAxis.BarBeatToTickPos(32, 0), Project.EndTick + 23040); public int TrackCount => Math.Max(20, Project.tracks.Count + 1); - [Reactive] public double TickWidth { get; set; } + [Reactive] public partial double TickWidth { get; set; } public double TrackHeightMin => ViewConstants.TrackHeightMin; public double TrackHeightMax => ViewConstants.TrackHeightMax; - [Reactive] public double TrackHeight { get; set; } - [Reactive] public double TickOffset { get; set; } - [Reactive] public double TrackOffset { get; set; } - [Reactive] public int SnapDiv { get; set; } - [Reactive] public int SnapUnit { get; set; } + [Reactive] public partial double TrackHeight { get; set; } + [Reactive] public partial double TickOffset { get; set; } + [Reactive] public partial double TrackOffset { get; set; } + [Reactive] public partial int SnapDiv { get; set; } + [Reactive] public partial int SnapUnit { get; set; } public ObservableCollectionExtended SnapTicks { get; } = new ObservableCollectionExtended(); - [Reactive] public double PlayPosX { get; set; } - [Reactive] public double PlayPosHighlightX { get; set; } - [Reactive] public double PlayPosHighlightWidth { get; set; } - [Reactive] public bool PlayPosWaitingRendering { get; set; } + [Reactive] public partial double PlayPosX { get; set; } + [Reactive] public partial double PlayPosHighlightX { get; set; } + [Reactive] public partial double PlayPosHighlightWidth { get; set; } + [Reactive] public partial bool PlayPosWaitingRendering { get; set; } public double ViewportTicks => viewportTicks.Value; public double ViewportTracks => viewportTracks.Value; public double SmallChangeX => smallChangeX.Value; diff --git a/OpenUtau/ViewModels/TranscribeViewModel.cs b/OpenUtau/ViewModels/TranscribeViewModel.cs index 1b10f6eff..8705343a3 100644 --- a/OpenUtau/ViewModels/TranscribeViewModel.cs +++ b/OpenUtau/ViewModels/TranscribeViewModel.cs @@ -3,7 +3,7 @@ using System.Linq; using OpenUtau.Core.Analysis; using ReactiveUI; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; namespace OpenUtau.App.ViewModels { public enum TranscribeAlgorithm { @@ -11,14 +11,14 @@ public enum TranscribeAlgorithm { GAME, } - public class TranscribeViewModel : ViewModelBase { + public partial class TranscribeViewModel : ViewModelBase { // --- Availability --- public bool SomeAvailable { get; } public bool GameAvailable { get; } public bool RmvpeAvailable { get; } // --- Algorithm selection --- - [Reactive] public TranscribeAlgorithm SelectedAlgorithm { get; set; } + [Reactive] public partial TranscribeAlgorithm SelectedAlgorithm { get; set; } // Convenience bool bindings for RadioButtons public bool UseSome { @@ -46,27 +46,27 @@ public bool UseGame { (SelectedAlgorithm == TranscribeAlgorithm.SOME && SomeAvailable) || (SelectedAlgorithm == TranscribeAlgorithm.GAME && GameAvailable); - [Reactive] public bool PredictPitd { get; set; } = false; + [Reactive] public partial bool PredictPitd { get; set; } = false; // --- GAME options --- public List SamplingStepsOptions { get; } = new List { 1, 2, 4, 8, 16 }; - [Reactive] public int SamplingStepsIndex { get; set; } = 3; + [Reactive] public partial int SamplingStepsIndex { get; set; } = 3; public int SamplingSteps => SamplingStepsIndex >= 0 && SamplingStepsIndex < SamplingStepsOptions.Count ? SamplingStepsOptions[SamplingStepsIndex] : 1; - [Reactive] public float BoundaryThreshold { get; set; } = 0.2f; - [Reactive] public int BoundaryRadius { get; set; } = 2; - [Reactive] public float ScoreThreshold { get; set; } = 0.2f; + [Reactive] public partial float BoundaryThreshold { get; set; } = 0.2f; + [Reactive] public partial int BoundaryRadius { get; set; } = 2; + [Reactive] public partial float ScoreThreshold { get; set; } = 0.2f; // --- GAME batch inference --- /// Maximum number of audio chunks per batch. 1 = no batching. - [Reactive] public int BatchSize { get; set; } = 1; + [Reactive] public partial int BatchSize { get; set; } = 1; /// Maximum total padded audio duration per batch in seconds (0 = unlimited). - [Reactive] public float MaxBatchDuration { get; set; } = 60f; + [Reactive] public partial float MaxBatchDuration { get; set; } = 60f; // Internal language code list (null = Auto); parallel to LanguageDisplayOptions private readonly List languageCodes; @@ -76,7 +76,7 @@ public bool UseGame { public bool GameHasLanguages { get; } - [Reactive] public int LanguageDisplayIndex { get; set; } = 0; + [Reactive] public partial int LanguageDisplayIndex { get; set; } = 0; /// The selected language code (null = Auto/universal). public string? LanguageCode => LanguageDisplayIndex >= 1 && LanguageDisplayIndex < languageCodes.Count diff --git a/OpenUtau/ViewModels/UpdaterViewModel.cs b/OpenUtau/ViewModels/UpdaterViewModel.cs index ff24dedd2..2e34c316a 100644 --- a/OpenUtau/ViewModels/UpdaterViewModel.cs +++ b/OpenUtau/ViewModels/UpdaterViewModel.cs @@ -13,11 +13,11 @@ using Newtonsoft.Json; using OpenUtau.Core; using OpenUtau.Core.Util; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using Serilog; namespace OpenUtau.App.ViewModels { - public class UpdaterViewModel : ViewModelBase { + public partial class UpdaterViewModel : ViewModelBase { class GithubReleaseAsset { public string name = string.Empty; public string browser_download_url = string.Empty; @@ -34,9 +34,9 @@ class GithubRelease { } public string AppVersion => $"v{System.Reflection.Assembly.GetEntryAssembly()?.GetName().Version}"; public bool IsDarkMode => ThemeManager.IsDarkMode; - [Reactive] public string UpdaterStatus { get; set; } - [Reactive] public bool UpdateAvailable { get; set; } - [Reactive] public FontWeight UpdateButtonFontWeight { get; set; } + [Reactive] public partial string UpdaterStatus { get; set; } + [Reactive] public partial bool UpdateAvailable { get; set; } + [Reactive] public partial FontWeight UpdateButtonFontWeight { get; set; } public Action? CloseApplication { get; set; } private SparkleUpdater? sparkle; diff --git a/OpenUtau/Views/LoadingWindow.axaml b/OpenUtau/Views/LoadingWindow.axaml index 7302c76f6..daffdbc46 100644 --- a/OpenUtau/Views/LoadingWindow.axaml +++ b/OpenUtau/Views/LoadingWindow.axaml @@ -7,10 +7,9 @@ Title="Loading" MinWidth="300" MinHeight="150" Icon="/Assets/open-utau.ico" WindowStartupLocation="CenterScreen" - ExtendClientAreaChromeHints="NoChrome" ExtendClientAreaTitleBarHeightHint="-1" ExtendClientAreaToDecorationsHint="True" - SystemDecorations="BorderOnly"> + WindowDecorations="BorderOnly"> + PlaceholderText="{StaticResource lyricsreplace.regex}"/> diff --git a/OpenUtau/Views/MainWindow.axaml.cs b/OpenUtau/Views/MainWindow.axaml.cs index 342ab19e3..16ad57ba0 100644 --- a/OpenUtau/Views/MainWindow.axaml.cs +++ b/OpenUtau/Views/MainWindow.axaml.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.IO; using System.Linq; using System.Reactive; using System.Threading; @@ -10,8 +9,11 @@ using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.Primitives; +using Avalonia.Controls.Shapes; using Avalonia.Input; using Avalonia.Interactivity; +using Avalonia.Platform.Storage; +using Avalonia.VisualTree; using Avalonia.Threading; using OpenUtau.App.Controls; using OpenUtau.App.ViewModels; @@ -25,6 +27,7 @@ using ReactiveUI; using Serilog; using SharpCompress; +using Path = System.IO.Path; using Point = Avalonia.Point; namespace OpenUtau.App.Views { @@ -888,7 +891,11 @@ async void OnDrop(object? sender, DragEventArgs args) { .Append(Core.Vogen.VogenSingerInstaller.FileExt) .Append(PackageManager.OudepExt) .ToArray(); - var files = args.Data?.GetFiles()?.Where(i => i != null).Select(i => i.Path.LocalPath).ToArray() ?? new string[] { }; + var files = args.DataTransfer.TryGetFiles()? + .Where(i => i != null) + .Select(i => i.Path.LocalPath) + .ToArray() ?? new string[] { }; + if (files.Length == 0) { return; } @@ -1050,7 +1057,9 @@ public void TimelinePointerReleased(object sender, PointerReleasedEventArgs args public void PartsCanvasPointerPressed(object sender, PointerPressedEventArgs args) { var control = (Control)sender; var point = args.GetCurrentPoint(control); - var hitControl = control.InputHitTest(point.Position); + var sourceControl = args.Source as Control; + var hitPartControl = sourceControl?.FindAncestorOfType(includeSelf: true); + if (partEditState != null) { return; } @@ -1058,51 +1067,52 @@ public void PartsCanvasPointerPressed(object sender, PointerPressedEventArgs arg if (args.KeyModifiers == cmdKey) { partEditState = new PartSelectionEditState(control, viewModel, SelectionBox); Cursor = ViewConstants.cursorCross; - } else if (hitControl == control) { + } else if (hitPartControl == null) { + // Clicked empty canvas — equivalent to old `hitControl == control` viewModel.TracksViewModel.DeselectParts(); var part = viewModel.TracksViewModel.MaybeAddPart(point.Position); if (part != null) { - // Start moving right away partEditState = new PartMoveEditState(control, viewModel, part); Cursor = ViewConstants.cursorSizeAll; } - } else if (hitControl is PartControl partControl) { + } else { + // Clicked on a part bool fadein = false; bool fadeout = false; - if (partControl.part is UWavePart wavePart && point.Position.Y < partControl.Bounds.Top + 6) { - var fadePos = partControl.Bounds.Left + partControl.FadeIn; + if (hitPartControl.part is UWavePart && point.Position.Y < hitPartControl.Bounds.Top + 6) { + var fadePos = hitPartControl.Bounds.Left + hitPartControl.FadeIn; fadein = fadePos < point.Position.X && point.Position.X < fadePos + 6; - fadePos = partControl.Bounds.Left + partControl.FadeOut; + fadePos = hitPartControl.Bounds.Left + hitPartControl.FadeOut; fadeout = fadePos - 6 < point.Position.X && point.Position.X < fadePos; } - bool skip = point.Position.X < partControl.Bounds.Left + ViewConstants.ResizeMargin; - bool trim = point.Position.X > partControl.Bounds.Right - ViewConstants.ResizeMargin; + bool skip = point.Position.X < hitPartControl.Bounds.Left + ViewConstants.ResizeMargin; + bool trim = point.Position.X > hitPartControl.Bounds.Right - ViewConstants.ResizeMargin; if (fadein) { - partEditState = new PartFadeInState(control, viewModel, (UWavePart)partControl.part); + partEditState = new PartFadeInState(control, viewModel, (UWavePart)hitPartControl.part); Cursor = ViewConstants.cursorSizeWE; } else if (fadeout) { - partEditState = new PartFadeOutState(control, viewModel, (UWavePart)partControl.part); + partEditState = new PartFadeOutState(control, viewModel, (UWavePart)hitPartControl.part); Cursor = ViewConstants.cursorSizeWE; } else if (skip) { - partEditState = new PartResizeEditState(control, viewModel, partControl.part, true); + partEditState = new PartResizeEditState(control, viewModel, hitPartControl.part, true); Cursor = ViewConstants.cursorSizeWE; } else if (trim) { - partEditState = new PartResizeEditState(control, viewModel, partControl.part); + partEditState = new PartResizeEditState(control, viewModel, hitPartControl.part); Cursor = ViewConstants.cursorSizeWE; } else { - partEditState = new PartMoveEditState(control, viewModel, partControl.part); + partEditState = new PartMoveEditState(control, viewModel, hitPartControl.part); Cursor = ViewConstants.cursorSizeAll; } } } else if (point.Properties.IsRightButtonPressed) { - if (hitControl is PartControl partControl) { - if (!viewModel.TracksViewModel.SelectedParts.Contains(partControl.part)) { + if (hitPartControl != null) { + if (!viewModel.TracksViewModel.SelectedParts.Contains(hitPartControl.part)) { viewModel.TracksViewModel.DeselectParts(); - viewModel.TracksViewModel.SelectPart(partControl.part); + viewModel.TracksViewModel.SelectPart(hitPartControl.part); } if (PartsContextMenu != null && viewModel.TracksViewModel.SelectedParts.Count > 0) { var menuArgs = new PartsContextMenuArgs { - Part = partControl.part, + Part = hitPartControl.part, PartDeleteCommand = viewModel.PartDeleteCommand, PartGotoFileCommand = PartGotoFileCommand, PartReplaceAudioCommand = PartReplaceAudioCommand, @@ -1111,7 +1121,7 @@ public void PartsCanvasPointerPressed(object sender, PointerPressedEventArgs arg PartMergeCommand = PartMergeCommand, PartSplitCommand = PartSplitCommand }; - if (partControl.part is UVoicePart voicePart) { + if (hitPartControl.part is UVoicePart voicePart) { menuArgs.PartApplyPitchMenuItems = DocManager.Inst.Project.parts .OfType() .OrderBy(p => p.trackNo) @@ -1149,18 +1159,19 @@ public void PartsCanvasPointerMoved(object sender, PointerEventArgs args) { partEditState.Update(point.Pointer, point.Position); return; } - var hitControl = control.InputHitTest(point.Position); - if (hitControl is PartControl partControl) { + var sourceControl = args.Source as Control; + var hitPartControl = sourceControl?.FindAncestorOfType(includeSelf: true); + if (hitPartControl != null) { bool fadein = false; bool fadeout = false; - if (partControl.part is UWavePart wavePart && point.Position.Y < partControl.Bounds.Top + 6) { - var fadePos = partControl.Bounds.Left + partControl.FadeIn; + if (hitPartControl.part is UWavePart && point.Position.Y < hitPartControl.Bounds.Top + 6) { + var fadePos = hitPartControl.Bounds.Left + hitPartControl.FadeIn; fadein = fadePos < point.Position.X && point.Position.X < fadePos + 6; - fadePos = partControl.Bounds.Left + partControl.FadeOut; + fadePos = hitPartControl.Bounds.Left + hitPartControl.FadeOut; fadeout = fadePos - 6 < point.Position.X && point.Position.X < fadePos; } - bool skip = point.Position.X < partControl.Bounds.Left + ViewConstants.ResizeMargin; - bool trim = point.Position.X > partControl.Bounds.Right - ViewConstants.ResizeMargin; + bool skip = point.Position.X < hitPartControl.Bounds.Left + ViewConstants.ResizeMargin; + bool trim = point.Position.X > hitPartControl.Bounds.Right - ViewConstants.ResizeMargin; if (fadein || fadeout) { Cursor = ViewConstants.cursorHand; } else if (skip || trim) { @@ -1196,8 +1207,13 @@ public async void PartsCanvasDoubleTapped(object sender, TappedEventArgs args) { if (!(sender is Canvas canvas)) { return; } - var control = canvas.InputHitTest(args.GetPosition(canvas)); - if (control is PartControl partControl && partControl.part is UVoicePart) { + + var point = args.GetPosition(canvas); + var visuals = canvas.GetVisualsAt(point); + var hitPartControl = visuals + .Select(v => v.FindAncestorOfType(includeSelf: true)) + .FirstOrDefault(pc => pc != null); + if (hitPartControl?.part is UVoicePart) { if (pianoRoll == null) { LoadingWindow.BeginLoading(this); @@ -1231,7 +1247,7 @@ await Task.Run(() => viewModel.ShowPianoRoll = true; } int tick = viewModel.TracksViewModel.PointToTick(args.GetPosition(canvas)); - DocManager.Inst.ExecuteCmd(new LoadPartNotification(partControl.part, DocManager.Inst.Project, tick)); + DocManager.Inst.ExecuteCmd(new LoadPartNotification(hitPartControl.part, DocManager.Inst.Project, tick)); pianoRoll.AttachExpressions(); } } diff --git a/OpenUtau/Views/MessageBox.axaml.cs b/OpenUtau/Views/MessageBox.axaml.cs index bb7355b0c..1274d1411 100644 --- a/OpenUtau/Views/MessageBox.axaml.cs +++ b/OpenUtau/Views/MessageBox.axaml.cs @@ -8,6 +8,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Input.Platform; using Avalonia.Interactivity; using Avalonia.Threading; using OpenUtau.Core; diff --git a/OpenUtau/Views/PhoneticAssistant.axaml.cs b/OpenUtau/Views/PhoneticAssistant.axaml.cs index a031e2ee6..ddb61e3a2 100644 --- a/OpenUtau/Views/PhoneticAssistant.axaml.cs +++ b/OpenUtau/Views/PhoneticAssistant.axaml.cs @@ -1,4 +1,5 @@ using Avalonia.Controls; +using Avalonia.Input.Platform; using Avalonia.Interactivity; using OpenUtau.App.ViewModels; diff --git a/OpenUtau/Views/SingersDialog.axaml b/OpenUtau/Views/SingersDialog.axaml index c0dec4a46..af69702ed 100644 --- a/OpenUtau/Views/SingersDialog.axaml +++ b/OpenUtau/Views/SingersDialog.axaml @@ -92,7 +92,7 @@ - beatPerBars = Enumerable.Range(1, 32).ToList(); static readonly List beatUnits = new List { 1, 2, 4, 8, 16, 32 }; public List BeatPerBars => beatPerBars; public List BeatUnits => beatUnits; - [Reactive] public int BeatPerBar { get; set; } - [Reactive] public int BeatUnit { get; set; } + + [Reactive] public partial int BeatPerBar { get; set; } + [Reactive] public partial int BeatUnit { get; set; } + + public new event PropertyChangedEventHandler? PropertyChanged; + public event PropertyChangingEventHandler? PropertyChanging; + + public void RaisePropertyChanging(PropertyChangingEventArgs args) => PropertyChanging?.Invoke(this, args); + public void RaisePropertyChanged(PropertyChangedEventArgs args) => PropertyChanged?.Invoke(this, args); + public Action? OnOk { get; set; } public TimeSignatureDialog() : this(4, 4) { } diff --git a/OpenUtau/Views/UpdaterDialog.axaml b/OpenUtau/Views/UpdaterDialog.axaml index a23d203e8..0664d744a 100644 --- a/OpenUtau/Views/UpdaterDialog.axaml +++ b/OpenUtau/Views/UpdaterDialog.axaml @@ -7,28 +7,26 @@ Width="400" Height="300" CanResize="False" WindowStartupLocation="CenterScreen" Icon="/Assets/open-utau.ico" Title="{DynamicResource updater.caption}" Closing="OnClosing"> - - - - - - - - -