diff --git a/Controls/MusicOrderViewer.cs b/Controls/MusicOrderViewer.cs index 3778423..04be74e 100644 --- a/Controls/MusicOrderViewer.cs +++ b/Controls/MusicOrderViewer.cs @@ -26,6 +26,18 @@ namespace TaikoSoundEditor.Controls CurrentPage = CurrentPage; } + public void RemoveSong(MusicOrder mo) + { + SongCards.RemoveAll(c => c.MusicOrder == mo); + Selection.RemoveWhere(c => c.MusicOrder == mo); + CutSelection.RemoveWhere(c => c.MusicOrder == mo); + + PasteActive = CutSelection.Count > 0; + CutActive = Selection.Count > 0; + if (!PasteActive) PasteMode = false; + Invalidate(); + } + private int _CurrentPage = 0; public int CurrentPage { diff --git a/MainForm.RequestFiles.cs b/MainForm.RequestFiles.cs index 417b43f..fa4bfd4 100644 --- a/MainForm.RequestFiles.cs +++ b/MainForm.RequestFiles.cs @@ -103,7 +103,7 @@ namespace TaikoSoundEditor Logger.Info($"Setting LoadedMusicBox DataSource"); LoadedMusicBinding = new BindingSource(); - var cleanList = MusicInfos.Items.Where(mi => mi.UniqueId != 0).ToList(); + var cleanList = MusicInfos.Items.Where(mi => mi.UniqueId != 0).OrderBy(_ => _.UniqueId).ToList(); LoadedMusicBinding.DataSource = cleanList; LoadedMusicBox.DataSource = LoadedMusicBinding; @@ -111,11 +111,11 @@ namespace TaikoSoundEditor MusicOrderViewer.WordList = WordList; - foreach (var musicOrder in MusicOrders.Items) + foreach (var musicOrder in MusicOrders.Items.Where(_ => MusicInfos.Items.Any(mi => mi.UniqueId == _.UniqueId))) { MusicOrderViewer.AddSong(musicOrder); } - }); + }); #endregion } diff --git a/MainForm.cs b/MainForm.cs index 19bb0cf..f137637 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -169,6 +169,9 @@ namespace TaikoSoundEditor LoadedMusicBox.SelectedItem = null; LoadedMusicBox.SelectedIndex = sel; + + Logger.Info("Removing from music orders"); + MusicOrderViewer.RemoveSong(mo); return; } }); @@ -176,7 +179,8 @@ namespace TaikoSoundEditor private void SoundViewTab_SelectedIndexChanged(object sender, EventArgs e) { if(SoundViewTab.SelectedTab==MusicOrderTab) - { + { + MusicOrderViewer.Invalidate(); return; }