Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OpenUtau.Core/Util/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 11 additions & 2 deletions OpenUtau/Controls/PianoRoll.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ await MessageBox.ShowProcessing(RootWindow, $"{name} - ? / ?",
}
});

MessageBus.Current.Listen<PianorollRefreshEvent>()
.Subscribe(e => {
if(e.refreshItem == "Attachment") {
MainWindow?.SetPianoRollAttachment();
ViewModel.RaisePropertyChanged(nameof(ViewModel.PianoRollDetached));
}
});

DocManager.Inst.AddSubscriber(this);
}

Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions OpenUtau/Strings/Strings.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ Warning: this option removes custom presets.</system:String>
<system:String x:Key="prefs.appearance.showghostnotes">Show other tracks' notes on piano roll</system:String>
<system:String x:Key="prefs.appearance.showicon">Show icon on piano roll</system:String>
<system:String x:Key="prefs.appearance.showportrait">Show portrait on piano roll</system:String>
<system:String x:Key="prefs.appearance.detachpianoroll">Show piano roll in separate window</system:String>
<system:String x:Key="prefs.appearance.sortorder">Singer name display language</system:String>
<system:String x:Key="prefs.appearance.theme">Theme</system:String>
<system:String x:Key="prefs.appearance.theme.dark">Dark</system:String>
Expand Down
8 changes: 8 additions & 0 deletions OpenUtau/ViewModels/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> ThemeItems => ThemeManager.GetAvailableThemes();
public bool IsThemeEditorOpen => Views.ThemeEditorWindow.IsOpen;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 5 additions & 8 deletions OpenUtau/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions OpenUtau/Views/PreferencesDialog.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@
<TextBlock Text="{DynamicResource prefs.appearance.showghostnotes}" HorizontalAlignment="Left"/>
<ToggleSwitch IsChecked="{Binding ShowGhostNotes}"/>
</Grid>
<Grid Margin="0,5,0,0">
<TextBlock Text="{DynamicResource prefs.appearance.detachpianoroll}" HorizontalAlignment="Left"/>
<ToggleSwitch IsChecked="{Binding DetachPianoRoll}"/>
</Grid>
</StackPanel>

<!-- UTAU -->
Expand Down
Loading