Skip to content

Commit

Permalink
Merge pull request #801 from maiko3tattun/0806_BatchMenu
Browse files Browse the repository at this point in the history
Tweaked piano roll menus
  • Loading branch information
stakira authored Aug 14, 2023
2 parents dce8bef + a02b12f commit f3e66ce
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
2 changes: 2 additions & 0 deletions OpenUtau/Strings/Strings.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ Warning: this option removes custom presets.</system:String>
<system:String x:Key="phoneticassistant.caption">Phonetic Assistant</system:String>
<system:String x:Key="phoneticassistant.copy">Copy</system:String>

<system:String x:Key="pianoroll.menu.batch">Batch Edits</system:String>
<system:String x:Key="pianoroll.menu.lyrics">Lyrics</system:String>
<system:String x:Key="pianoroll.menu.lyrics.dashtoplus">Replace "-" with "+"</system:String>
<system:String x:Key="pianoroll.menu.lyrics.edit">Edit Lyrics</system:String>
Expand Down Expand Up @@ -222,6 +223,7 @@ Warning: this option removes custom presets.</system:String>
<system:String x:Key="pianoroll.menu.notes.removetailrest">Remove tail "R"</system:String>
<system:String x:Key="pianoroll.menu.part">Part</system:String>
<system:String x:Key="pianoroll.menu.part.legacypluginexp">Legacy Plugin (Experimental)</system:String>
<system:String x:Key="pianoroll.menu.part.singer">Singer and Oto settings</system:String>
<system:String x:Key="pianoroll.toggle.finalpitch">View Final Pitch to Render (R)</system:String>
<system:String x:Key="pianoroll.toggle.noteparams">View Note Parameters (\)</system:String>
<system:String x:Key="pianoroll.toggle.phoneme">View Phonemes (O)</system:String>
Expand Down
2 changes: 2 additions & 0 deletions OpenUtau/Strings/Strings.ja-JP.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
<system:String x:Key="phoneticassistant.caption">音素変換アシスタント</system:String>
<system:String x:Key="phoneticassistant.copy">コピー</system:String>

<system:String x:Key="pianoroll.menu.batch">一括編集</system:String>
<system:String x:Key="pianoroll.menu.lyrics">歌詞</system:String>
<system:String x:Key="pianoroll.menu.lyrics.dashtoplus">"-" を "+" に置き換え</system:String>
<system:String x:Key="pianoroll.menu.lyrics.edit">歌詞を編集</system:String>
Expand Down Expand Up @@ -220,6 +221,7 @@
<system:String x:Key="pianoroll.menu.notes.reset.vibratos">ビブラートをリセット</system:String>
<system:String x:Key="pianoroll.menu.part">パート</system:String>
<system:String x:Key="pianoroll.menu.part.legacypluginexp">従来のプラグイン (試験中)</system:String>
<system:String x:Key="pianoroll.menu.part.singer">シンガーと原音設定</system:String>
<system:String x:Key="pianoroll.toggle.finalpitch">最終的なピッチを表示 (R)</system:String>
<system:String x:Key="pianoroll.toggle.noteparams">音符のパラメータを表示 (\)</system:String>
<system:String x:Key="pianoroll.toggle.phoneme">音素を表示 (O)</system:String>
Expand Down
37 changes: 20 additions & 17 deletions OpenUtau/Views/PianoRollWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,24 @@
<Border CornerRadius="2" ClipToBounds="True">
<Menu CornerRadius="2" Height="20" Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
Closed="OnMenuClosed" PointerExited="OnMenuPointerLeave">
<MenuItem Height="20" Header="{DynamicResource pianoroll.menu.part}" CornerRadius="2,0,0,2">
<MenuItem Header="{DynamicResource pianoroll.menu.part}">
<MenuItem Header="{DynamicResource pianoroll.menu.part.singer}" Click="OnMenuSingers"/>
</MenuItem>
<MenuItem Header="{DynamicResource pianoroll.menu.batch}">
<MenuItem Header="{DynamicResource pianoroll.menu.notes}" ItemsSource="{Binding NoteBatchEdits}">
<MenuItem.DataTemplates>
<DataTemplate DataType="vm:MenuItemViewModel">
<MenuItem Header="{Binding Header}" Command="{Binding Command, FallbackValue={x:Null}}" CommandParameter="{Binding CommandParameter}"/>
</DataTemplate>
</MenuItem.DataTemplates>
</MenuItem>
<MenuItem Header="{DynamicResource pianoroll.menu.lyrics}" ItemsSource="{Binding LyricBatchEdits}">
<MenuItem.DataTemplates>
<DataTemplate DataType="vm:MenuItemViewModel">
<MenuItem Header="{Binding Header}" Command="{Binding Command, FallbackValue={x:Null}}" CommandParameter="{Binding CommandParameter}"/>
</DataTemplate>
</MenuItem.DataTemplates>
</MenuItem>
<MenuItem Header="{DynamicResource pianoroll.menu.part.legacypluginexp}" ItemsSource="{Binding LegacyPlugins}">
<MenuItem.DataTemplates>
<DataTemplate DataType="vm:MenuItemViewModel">
Expand All @@ -383,22 +400,8 @@
</MenuItem.DataTemplates>
</MenuItem>
</MenuItem>
<MenuItem Height="20" Header="{DynamicResource pianoroll.menu.notes}" ItemsSource="{Binding NoteBatchEdits}">
<MenuItem.DataTemplates>
<DataTemplate DataType="vm:MenuItemViewModel">
<MenuItem Header="{Binding Header}" Command="{Binding Command, FallbackValue={x:Null}}" CommandParameter="{Binding CommandParameter}"/>
</DataTemplate>
</MenuItem.DataTemplates>
</MenuItem>
<MenuItem Height="20" Header="{DynamicResource pianoroll.menu.lyrics}" ItemsSource="{Binding LyricBatchEdits}">
<MenuItem.DataTemplates>
<DataTemplate DataType="vm:MenuItemViewModel">
<MenuItem Header="{Binding Header}" Command="{Binding Command, FallbackValue={x:Null}}" CommandParameter="{Binding CommandParameter}"/>
</DataTemplate>
</MenuItem.DataTemplates>
</MenuItem>
<MenuItem Height="20" Header="{DynamicResource pianoroll.menu.lyrics.edit}" Click="OnMenuEditLyrics"/>
<MenuItem Height="20" Header="{DynamicResource pianoroll.menu.notedefaults}" Click="OnMenuNoteDefaults"/>
<MenuItem Header="{DynamicResource pianoroll.menu.lyrics.edit}" Click="OnMenuEditLyrics"/>
<MenuItem Header="{DynamicResource pianoroll.menu.notedefaults}" Click="OnMenuNoteDefaults"/>
</Menu>
</Border>
</Border>
Expand Down
11 changes: 11 additions & 0 deletions OpenUtau/Views/PianoRollWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ void OnMenuPointerLeave(object sender, PointerEventArgs args) {
Focus(); // Force unfocus menu for key down events.
}

void OnMenuSingers(object sender, RoutedEventArgs args) {
MainWindow?.OpenSingersWindow();
try {
if (ViewModel.NotesViewModel.Part != null && !ViewModel.NotesViewModel.Selection.IsEmpty && ViewModel.NotesViewModel.Part.phonemes.Count() > 0) {
USinger singer = ViewModel.NotesViewModel.Project.tracks[ViewModel.NotesViewModel.Part.trackNo].Singer;
UOto oto = ViewModel.NotesViewModel.Part.phonemes.First(p => p.Parent == ViewModel.NotesViewModel.Selection.First()).oto;
DocManager.Inst.ExecuteCmd(new GotoOtoNotification(singer, oto));
}
} catch { }
}

void ReplaceLyrics() {
if (ViewModel.NotesViewModel.Part == null) {
return;
Expand Down

0 comments on commit f3e66ce

Please sign in to comment.