Fixed genre sort, updated app layout
Song list now gets sorted dynamically. Sorting still leaves to be desired and will require more attention. Made the app window bigger.
This commit is contained in:
parent
12b4d4102f
commit
b81dde230e
@ -11,6 +11,7 @@ using System.Linq;
|
|||||||
using System;
|
using System;
|
||||||
using TaikoSoundEditor.Collections;
|
using TaikoSoundEditor.Collections;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||||
|
|
||||||
namespace TaikoSoundEditor.Commons.Controls
|
namespace TaikoSoundEditor.Commons.Controls
|
||||||
{
|
{
|
||||||
@ -32,32 +33,21 @@ namespace TaikoSoundEditor.Commons.Controls
|
|||||||
public void AddSong(IMusicOrder mo)
|
public void AddSong(IMusicOrder mo)
|
||||||
{
|
{
|
||||||
var songCard = new SongCard(WordList, mo);
|
var songCard = new SongCard(WordList, mo);
|
||||||
|
|
||||||
if (Config.MusicOrderSort == Config.MusicOrderSortValueNone)
|
|
||||||
{
|
|
||||||
SongCards.Add(songCard);
|
SongCards.Add(songCard);
|
||||||
}
|
|
||||||
else if (Config.MusicOrderSort == Config.MusicOrderSortValueId)
|
|
||||||
{
|
|
||||||
SongCards.Add(songCard);
|
|
||||||
SongCards.Sort((c1, c2) => c1.MusicOrder.UniqueId.CompareTo(c2.MusicOrder.UniqueId));
|
|
||||||
}
|
|
||||||
else if (Config.MusicOrderSort == Config.MusicOrderSortValueGenre)
|
|
||||||
{
|
|
||||||
var firstInGenre = SongCards.Find(c => c.MusicOrder.Genre == mo.Genre);
|
|
||||||
if (firstInGenre == null)
|
|
||||||
{
|
|
||||||
SongCards.Add(songCard);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var index = SongCards.IndexOf(firstInGenre);
|
|
||||||
SongCards.Insert(index, songCard);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CurrentPage = CurrentPage;
|
CurrentPage = CurrentPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SortSongs()
|
||||||
|
{
|
||||||
|
if (Config.MusicOrderSort == Config.MusicOrderSortValueId) SongCards.Sort((c1, c2) => c1.MusicOrder.UniqueId.CompareTo(c2.MusicOrder.UniqueId));
|
||||||
|
else if (Config.MusicOrderSort == Config.MusicOrderSortValueTitle) SongCards.Sort((c1, c2) => c1.Title.CompareTo(c2.Title));
|
||||||
|
else if (Config.MusicOrderSort == Config.MusicOrderSortValueGenre) SongCards.Sort((c1, c2) => {
|
||||||
|
var ret = c1.Genre.CompareTo(c2.Genre);
|
||||||
|
if (ret == 0) ret = c1.Title.CompareTo(c2.Title);
|
||||||
|
return ret;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void RemoveAllSongs(int uniqueId)
|
public void RemoveAllSongs(int uniqueId)
|
||||||
{
|
{
|
||||||
SongCards.RemoveAll(c => c.MusicOrder.UniqueId == uniqueId);
|
SongCards.RemoveAll(c => c.MusicOrder.UniqueId == uniqueId);
|
||||||
@ -195,6 +185,8 @@ namespace TaikoSoundEditor.Commons.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void MusicOrdersPanel_Update() => MusicOrdersPanel.Invalidate();
|
||||||
|
|
||||||
private void MusicOrdersPanel_Resize(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
private void MusicOrdersPanel_Resize(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
||||||
{
|
{
|
||||||
MusicOrdersPanel.Invalidate();
|
MusicOrdersPanel.Invalidate();
|
||||||
@ -578,6 +570,7 @@ namespace TaikoSoundEditor.Commons.Controls
|
|||||||
var newMO = DatatableTypes.Clone(CardToClone.MusicOrder);
|
var newMO = DatatableTypes.Clone(CardToClone.MusicOrder);
|
||||||
newMO.Genre = genre;
|
newMO.Genre = genre;
|
||||||
AddSong(newMO);
|
AddSong(newMO);
|
||||||
|
SortSongs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
private static IniFile CreateIniFile()
|
private static IniFile CreateIniFile()
|
||||||
{
|
{
|
||||||
var ini = new IniFile();
|
var ini = new IniFile();
|
||||||
if(!ini.KeyExists("MusicOrderSort")) ini.Write(MusicOrderSortProperty, MusicOrderSortValueNone);
|
if(!ini.KeyExists("MusicOrderSort")) ini.Write(MusicOrderSortProperty, MusicOrderSortValueGenre);
|
||||||
return ini;
|
return ini;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,8 +14,10 @@
|
|||||||
public static readonly IniFile IniFile = CreateIniFile();
|
public static readonly IniFile IniFile = CreateIniFile();
|
||||||
|
|
||||||
public static void SetMusicOrderSortById() => IniFile.Write(MusicOrderSortProperty, MusicOrderSortValueId);
|
public static void SetMusicOrderSortById() => IniFile.Write(MusicOrderSortProperty, MusicOrderSortValueId);
|
||||||
public static void SetMusicOrderNoSort() => IniFile.Write(MusicOrderSortProperty, MusicOrderSortValueNone);
|
|
||||||
public static void SetMusicOrderSortByGenre() => IniFile.Write(MusicOrderSortProperty, MusicOrderSortValueGenre);
|
public static void SetMusicOrderSortByGenre() => IniFile.Write(MusicOrderSortProperty, MusicOrderSortValueGenre);
|
||||||
|
public static void SetMusicOrderSortByTitle() => IniFile.Write(MusicOrderSortProperty, MusicOrderSortValueTitle);
|
||||||
|
|
||||||
|
public static void SetMusicOrderNoSort() => IniFile.Write(MusicOrderSortProperty, MusicOrderSortValueNoSort);
|
||||||
|
|
||||||
public static string DatatableDefPath
|
public static string DatatableDefPath
|
||||||
{
|
{
|
||||||
@ -52,8 +54,9 @@
|
|||||||
public static string MusicOrderSortProperty = "MusicOrderSort";
|
public static string MusicOrderSortProperty = "MusicOrderSort";
|
||||||
public static string DatatableDefPathProperty = "DatatableDef";
|
public static string DatatableDefPathProperty = "DatatableDef";
|
||||||
|
|
||||||
public static string MusicOrderSortValueNone = "None";
|
|
||||||
public static string MusicOrderSortValueId = "Id";
|
public static string MusicOrderSortValueId = "Id";
|
||||||
public static string MusicOrderSortValueGenre = "Genre";
|
public static string MusicOrderSortValueGenre = "Genre";
|
||||||
|
public static string MusicOrderSortValueTitle = "Title";
|
||||||
|
public static string MusicOrderSortValueNoSort = "None";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
562
MainForm.Designer.cs
generated
562
MainForm.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -174,10 +174,8 @@ namespace TaikoSoundEditor
|
|||||||
});*/
|
});*/
|
||||||
|
|
||||||
MusicOrderViewer.WordList = WordList;
|
MusicOrderViewer.WordList = WordList;
|
||||||
foreach (var musicOrder in MusicOrders.Items.Where(_ => MusicInfos.Items.Any(mi => mi.UniqueId == _.UniqueId)))
|
foreach (var musicOrder in MusicOrders.Items.Where(_ => MusicInfos.Items.Any(mi => mi.UniqueId == _.UniqueId))) MusicOrderViewer.AddSong(musicOrder);
|
||||||
{
|
MusicOrderViewer.SortSongs();
|
||||||
MusicOrderViewer.AddSong(musicOrder);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -311,6 +311,7 @@ namespace TaikoSoundEditor
|
|||||||
MusicAttributes.Items.Add(ns.MusicAttribute);
|
MusicAttributes.Items.Add(ns.MusicAttribute);
|
||||||
|
|
||||||
MusicOrderViewer.AddSong(mo);
|
MusicOrderViewer.AddSong(mo);
|
||||||
|
MusicOrderViewer.SortSongs();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
57
MainForm.cs
57
MainForm.cs
@ -21,18 +21,6 @@ namespace TaikoSoundEditor
|
|||||||
WordListPathSelector.PathChanged += WordListPathSelector_PathChanged;
|
WordListPathSelector.PathChanged += WordListPathSelector_PathChanged;
|
||||||
DirSelector.PathChanged += DirSelector_PathChanged;
|
DirSelector.PathChanged += DirSelector_PathChanged;
|
||||||
|
|
||||||
UseEncryptionBox.Checked = Config.UseEncryption;
|
|
||||||
UseEncryptionBox_CheckedChanged(null, null); // update state of the key two text boxes
|
|
||||||
|
|
||||||
//If path is set for the datatable folder, update paths for all the files.
|
|
||||||
if (Config.DatatablesPath != "") DirSelector.Path = Config.DatatablesPath;
|
|
||||||
|
|
||||||
|
|
||||||
DatatableKeyBox.Text = Config.DatatableKey;
|
|
||||||
FumenKeyBox.Text = Config.FumenKey;
|
|
||||||
|
|
||||||
DatatableDef.Path = Config.DatatableDefPath;
|
|
||||||
|
|
||||||
//Other stuff
|
//Other stuff
|
||||||
AddedMusicBinding.DataSource = AddedMusic;
|
AddedMusicBinding.DataSource = AddedMusic;
|
||||||
NewSoundsBox.DataSource = AddedMusicBinding;
|
NewSoundsBox.DataSource = AddedMusicBinding;
|
||||||
@ -125,7 +113,7 @@ namespace TaikoSoundEditor
|
|||||||
Logger.Info($"Selection Changed MusicItem: {item}");
|
Logger.Info($"Selection Changed MusicItem: {item}");
|
||||||
LoadMusicInfo(item);
|
LoadMusicInfo(item);
|
||||||
indexChanging = false;
|
indexChanging = false;
|
||||||
SoundViewTab.SelectedTab = SoundViewerSimple;
|
if (SoundViewTab.SelectedTab == MusicOrderTab) SoundViewTab.SelectedTab = SoundViewerSimple;
|
||||||
});
|
});
|
||||||
|
|
||||||
private void EditorTable_Resize(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
private void EditorTable_Resize(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
||||||
@ -140,7 +128,7 @@ namespace TaikoSoundEditor
|
|||||||
LoadedMusicBox.SelectedItem = null;
|
LoadedMusicBox.SelectedItem = null;
|
||||||
var item = NewSoundsBox.SelectedItem as NewSongData;
|
var item = NewSoundsBox.SelectedItem as NewSongData;
|
||||||
LoadNewSongData(item);
|
LoadNewSongData(item);
|
||||||
SoundViewTab.SelectedTab = SoundViewerSimple;
|
if(SoundViewTab.SelectedTab == MusicOrderTab) SoundViewTab.SelectedTab = SoundViewerSimple;
|
||||||
});
|
});
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -373,7 +361,7 @@ namespace TaikoSoundEditor
|
|||||||
|
|
||||||
private void MusicOrderSortToolStripMenuItem_Click(object sender, EventArgs e)
|
private void MusicOrderSortToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SortByGenreToolStripMenuItem.Checked = SortByIdToolStripMenuItem.Checked = NoSortToolStripMenuItem.Checked = false;
|
SortByGenreToolStripMenuItem.Checked = SortByIdToolStripMenuItem.Checked = sortByTitleToolStripMenuItem.Checked = noSortToolStripMenuItem.Checked = false;
|
||||||
|
|
||||||
if (sender == SortByGenreToolStripMenuItem)
|
if (sender == SortByGenreToolStripMenuItem)
|
||||||
{
|
{
|
||||||
@ -385,28 +373,39 @@ namespace TaikoSoundEditor
|
|||||||
SortByIdToolStripMenuItem.Checked = true;
|
SortByIdToolStripMenuItem.Checked = true;
|
||||||
Config.SetMusicOrderSortById();
|
Config.SetMusicOrderSortById();
|
||||||
}
|
}
|
||||||
else //if (sender == NoSortToolStripMenuItem)
|
else if (sender == sortByTitleToolStripMenuItem)
|
||||||
{
|
{
|
||||||
NoSortToolStripMenuItem.Checked = true;
|
sortByTitleToolStripMenuItem.Checked = true;
|
||||||
|
Config.SetMusicOrderSortByTitle();
|
||||||
|
}
|
||||||
|
else //(sender == noSortToolStripMenuItem)
|
||||||
|
{
|
||||||
|
noSortToolStripMenuItem.Checked = true;
|
||||||
Config.SetMusicOrderNoSort();
|
Config.SetMusicOrderNoSort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MusicOrderViewer.SortSongs();
|
||||||
|
MusicOrderViewer.MusicOrdersPanel_Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadPreferences()
|
private void LoadPreferences()
|
||||||
{
|
{
|
||||||
|
UseEncryptionBox.Checked = Config.UseEncryption;
|
||||||
|
UseEncryptionBox_CheckedChanged(null, null); // update state of the key two text boxes
|
||||||
|
|
||||||
|
//If path is set for the datatable folder, update paths for all the files.
|
||||||
|
if (Config.DatatablesPath != "") DirSelector.Path = Config.DatatablesPath;
|
||||||
|
|
||||||
|
|
||||||
|
DatatableKeyBox.Text = Config.DatatableKey;
|
||||||
|
FumenKeyBox.Text = Config.FumenKey;
|
||||||
|
|
||||||
|
DatatableDef.Path = Config.DatatableDefPath;
|
||||||
|
|
||||||
var musicOrderSort = Config.IniFile.Read(Config.MusicOrderSortProperty);
|
var musicOrderSort = Config.IniFile.Read(Config.MusicOrderSortProperty);
|
||||||
if (musicOrderSort == Config.MusicOrderSortValueGenre)
|
if (musicOrderSort == Config.MusicOrderSortValueGenre) SortByGenreToolStripMenuItem.PerformClick();
|
||||||
{
|
else if (musicOrderSort == Config.MusicOrderSortValueId) SortByIdToolStripMenuItem.PerformClick();
|
||||||
SortByGenreToolStripMenuItem.PerformClick();
|
else if (musicOrderSort == Config.MusicOrderSortValueTitle) sortByTitleToolStripMenuItem.PerformClick();
|
||||||
}
|
|
||||||
else if (musicOrderSort == Config.MusicOrderSortValueId)
|
|
||||||
{
|
|
||||||
SortByIdToolStripMenuItem.PerformClick();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NoSortToolStripMenuItem.PerformClick();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e) => ExceptionGuard.Run(() =>
|
||||||
|
Loading…
Reference in New Issue
Block a user