diff --git a/OpenUtau.Core/Util/Preferences.cs b/OpenUtau.Core/Util/Preferences.cs index 46aa926f1..c963d45c2 100644 --- a/OpenUtau.Core/Util/Preferences.cs +++ b/OpenUtau.Core/Util/Preferences.cs @@ -250,7 +250,7 @@ public class SerializablePreferences { errors.txt "; public string RecoveryPath = string.Empty; - public bool DetachPianoRoll = false; + public bool DetachPianoRoll = true; // ----- Mix FX (post-processing) ----- // Per-track FX state lives in UTrack.MixFx and the project ustx. diff --git a/OpenUtau/Controls/PianoRoll.axaml.cs b/OpenUtau/Controls/PianoRoll.axaml.cs index abdb081b3..b2cdcf051 100644 --- a/OpenUtau/Controls/PianoRoll.axaml.cs +++ b/OpenUtau/Controls/PianoRoll.axaml.cs @@ -219,6 +219,14 @@ await MessageBox.ShowProcessing(RootWindow, $"{name} - ? / ?", } }); + MessageBus.Current.Listen() + .Subscribe(e => { + if(e.refreshItem == "Attachment") { + MainWindow?.SetPianoRollAttachment(); + ViewModel.RaisePropertyChanged(nameof(ViewModel.PianoRollDetached)); + } + }); + DocManager.Inst.AddSubscriber(this); } @@ -330,8 +338,9 @@ void OnMenuSearchNote(object sender, RoutedEventArgs args) { } void OnMenuDetachPianoRoll(object sender, RoutedEventArgs args) { - MainWindow?.SetPianoRollAttachment(); - ViewModel.RaisePropertyChanged(nameof(ViewModel.PianoRollDetached)); + Preferences.Default.DetachPianoRoll ^= true; + Preferences.Save(); + MessageBus.Current.SendMessage(new PianorollRefreshEvent("Attachment")); } void OnMenuHidePianoRoll(object sender, RoutedEventArgs args) { diff --git a/OpenUtau/Strings/Strings.axaml b/OpenUtau/Strings/Strings.axaml index 7c08bab77..b43096d13 100644 --- a/OpenUtau/Strings/Strings.axaml +++ b/OpenUtau/Strings/Strings.axaml @@ -571,6 +571,7 @@ Warning: this option removes custom presets. Show other tracks' notes on piano roll Show icon on piano roll Show portrait on piano roll + Show piano roll in separate window Singer name display language Theme Dark diff --git a/OpenUtau/ViewModels/PreferencesViewModel.cs b/OpenUtau/ViewModels/PreferencesViewModel.cs index 9db829b46..ce60bb44c 100644 --- a/OpenUtau/ViewModels/PreferencesViewModel.cs +++ b/OpenUtau/ViewModels/PreferencesViewModel.cs @@ -100,6 +100,7 @@ public int SafeMaxThreadCount { [Reactive] public bool ShowPortrait { get; set; } [Reactive] public bool ShowIcon { get; set; } [Reactive] public bool ShowGhostNotes { get; set; } + [Reactive] public bool DetachPianoRoll { get; set; } [Reactive] public bool ThemeEditable { get; set; } public List ThemeItems => ThemeManager.GetAvailableThemes(); public bool IsThemeEditorOpen => Views.ThemeEditorWindow.IsOpen; @@ -183,6 +184,7 @@ public PreferencesViewModel() { ShowPortrait = Preferences.Default.ShowPortrait; ShowIcon = Preferences.Default.ShowIcon; ShowGhostNotes = Preferences.Default.ShowGhostNotes; + DetachPianoRoll = Preferences.Default.DetachPianoRoll; Beta = Preferences.Default.Beta; LyricsHelper = LyricsHelpers.FirstOrDefault(option => option.klass.Equals(ActiveLyricsHelper.Inst.GetPreferred())); LyricsHelperBrackets = Preferences.Default.LyricsHelperBrackets; @@ -305,6 +307,12 @@ public PreferencesViewModel() { Preferences.Save(); MessageBus.Current.SendMessage(new PianorollRefreshEvent("Part")); }); + this.WhenAnyValue(vm => vm.DetachPianoRoll) + .Subscribe(detachPianoRoll => { + Preferences.Default.DetachPianoRoll = detachPianoRoll; + Preferences.Save(); + MessageBus.Current.SendMessage(new PianorollRefreshEvent("Attachment")); + }); this.WhenAnyValue(vm => vm.Beta) .Subscribe(beta => { Preferences.Default.Beta = beta; diff --git a/OpenUtau/Views/MainWindow.axaml.cs b/OpenUtau/Views/MainWindow.axaml.cs index 5ea4cdb0c..521e81153 100644 --- a/OpenUtau/Views/MainWindow.axaml.cs +++ b/OpenUtau/Views/MainWindow.axaml.cs @@ -1223,21 +1223,18 @@ public void SetPianoRollAttachment() { return; } if (Preferences.Default.DetachPianoRoll) { - pianoRollWindow?.ForceClose(); - pianoRollWindow = null; - PianoRollContainer.Content = pianoRoll; - viewModel.ShowPianoRoll = true; - Preferences.Default.DetachPianoRoll = false; - } else { PianoRollContainer.Content = null; viewModel.ShowPianoRoll = false; if (pianoRollWindow == null) { pianoRollWindow = new(pianoRoll); pianoRollWindow.Show(); } - Preferences.Default.DetachPianoRoll = true; + } else { + pianoRollWindow?.ForceClose(); + pianoRollWindow = null; + PianoRollContainer.Content = pianoRoll; + viewModel.ShowPianoRoll = true; } - Preferences.Save(); } public void MainPagePointerWheelChanged(object sender, PointerWheelEventArgs args) { diff --git a/OpenUtau/Views/PreferencesDialog.axaml b/OpenUtau/Views/PreferencesDialog.axaml index e116bbe34..9779a5b8d 100644 --- a/OpenUtau/Views/PreferencesDialog.axaml +++ b/OpenUtau/Views/PreferencesDialog.axaml @@ -269,6 +269,10 @@ + + + +