added option to remove songs
This commit is contained in:
parent
604e578eda
commit
6024970ebd
17
MainForm.Designer.cs
generated
17
MainForm.Designer.cs
generated
@ -45,6 +45,7 @@
|
||||
this.MusicAttributePathSelector = new TaikoSoundEditor.PathSelector();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.RemoveSongButton = new System.Windows.Forms.Button();
|
||||
this.DatatableSpaces = new System.Windows.Forms.CheckBox();
|
||||
this.ExportOpenOnFinished = new System.Windows.Forms.CheckBox();
|
||||
this.ExportAllButton = new System.Windows.Forms.Button();
|
||||
@ -300,6 +301,7 @@
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.RemoveSongButton);
|
||||
this.tabPage2.Controls.Add(this.DatatableSpaces);
|
||||
this.tabPage2.Controls.Add(this.ExportOpenOnFinished);
|
||||
this.tabPage2.Controls.Add(this.ExportAllButton);
|
||||
@ -318,12 +320,20 @@
|
||||
this.tabPage2.Text = "tabPage2";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// RemoveSongButton
|
||||
//
|
||||
this.RemoveSongButton.Location = new System.Drawing.Point(220, 343);
|
||||
this.RemoveSongButton.Name = "RemoveSongButton";
|
||||
this.RemoveSongButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.RemoveSongButton.TabIndex = 12;
|
||||
this.RemoveSongButton.Text = "Remove";
|
||||
this.RemoveSongButton.UseVisualStyleBackColor = true;
|
||||
this.RemoveSongButton.Click += new System.EventHandler(this.RemoveSongButton_Click);
|
||||
//
|
||||
// DatatableSpaces
|
||||
//
|
||||
this.DatatableSpaces.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.DatatableSpaces.AutoSize = true;
|
||||
this.DatatableSpaces.Checked = true;
|
||||
this.DatatableSpaces.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DatatableSpaces.Location = new System.Drawing.Point(139, 372);
|
||||
this.DatatableSpaces.Name = "DatatableSpaces";
|
||||
this.DatatableSpaces.Size = new System.Drawing.Size(308, 19);
|
||||
@ -335,6 +345,8 @@
|
||||
//
|
||||
this.ExportOpenOnFinished.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ExportOpenOnFinished.AutoSize = true;
|
||||
this.ExportOpenOnFinished.Checked = true;
|
||||
this.ExportOpenOnFinished.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.ExportOpenOnFinished.Location = new System.Drawing.Point(139, 395);
|
||||
this.ExportOpenOnFinished.Name = "ExportOpenOnFinished";
|
||||
this.ExportOpenOnFinished.Size = new System.Drawing.Size(203, 19);
|
||||
@ -867,5 +879,6 @@
|
||||
private CheckBox ExportOpenOnFinished;
|
||||
private CheckBox AddSilenceBox;
|
||||
private CheckBox DatatableSpaces;
|
||||
private Button RemoveSongButton;
|
||||
}
|
||||
}
|
84
MainForm.cs
84
MainForm.cs
@ -132,10 +132,15 @@ namespace TaikoSoundEditor
|
||||
}
|
||||
|
||||
Logger.Info($"Setting LoadedMusicBox DataSource");
|
||||
LoadedMusicBox.DataSource = MusicInfos.Items;
|
||||
|
||||
LoadedMusicBinding = new BindingSource();
|
||||
LoadedMusicBinding.DataSource = MusicInfos.Items;
|
||||
LoadedMusicBox.DataSource = LoadedMusicBinding;
|
||||
TabControl.SelectedIndex = 1;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
BindingSource LoadedMusicBinding;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -161,8 +166,20 @@ namespace TaikoSoundEditor
|
||||
#region Editor
|
||||
|
||||
private void GridsShow(MusicInfo item)
|
||||
{
|
||||
{
|
||||
Logger.Info($"Showing properties for MusicInfo: {item}");
|
||||
|
||||
if(item==null)
|
||||
{
|
||||
MusicInfoGrid.SelectedObject = null;
|
||||
MusicAttributesGrid.SelectedObject = null;
|
||||
MusicOrderGrid.SelectedObject = null;
|
||||
WordsGrid.SelectedObject = null;
|
||||
WordSubGrid.SelectedObject = null;
|
||||
WordDetailGrid.SelectedObject = null;
|
||||
return;
|
||||
}
|
||||
|
||||
MusicInfoGrid.SelectedObject = item;
|
||||
MusicAttributesGrid.SelectedObject = MusicAttributes.GetByUniqueId(item.UniqueId);
|
||||
MusicOrderGrid.SelectedObject = MusicOrders.GetByUniqueId(item.UniqueId);
|
||||
@ -170,13 +187,18 @@ namespace TaikoSoundEditor
|
||||
WordSubGrid.SelectedObject = WordList.GetBySongSub(item.Id);
|
||||
WordDetailGrid.SelectedObject = WordList.GetBySongDetail(item.Id);
|
||||
}
|
||||
|
||||
|
||||
private bool indexChanging = false;
|
||||
|
||||
private void LoadedMusicBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (indexChanging) return;
|
||||
indexChanging = true;
|
||||
NewSoundsBox.SelectedItem = null;
|
||||
var item = LoadedMusicBox.SelectedItem as MusicInfo;
|
||||
Logger.Info($"Selection Changed MusicItem: {item}");
|
||||
GridsShow(item);
|
||||
GridsShow(item);
|
||||
indexChanging = false;
|
||||
}
|
||||
|
||||
private void EditorTable_Resize(object sender, EventArgs e)
|
||||
@ -186,6 +208,9 @@ namespace TaikoSoundEditor
|
||||
|
||||
private void NewSoundsBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (indexChanging) return;
|
||||
indexChanging = true;
|
||||
LoadedMusicBox.SelectedItem = null;
|
||||
var item = NewSoundsBox.SelectedItem as NewSongData;
|
||||
Logger.Info($"Selection Changed NewSongData: {item}");
|
||||
Logger.Info($"Showing properties for NewSongData: {item}");
|
||||
@ -195,6 +220,7 @@ namespace TaikoSoundEditor
|
||||
WordsGrid.SelectedObject = item?.Word;
|
||||
WordSubGrid.SelectedObject = item?.WordSub;
|
||||
WordDetailGrid.SelectedObject = item?.WordDetail;
|
||||
indexChanging = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -303,9 +329,9 @@ namespace TaikoSoundEditor
|
||||
ns.MBin = tja_binaries[2];
|
||||
ns.NBin = tja_binaries[3];
|
||||
|
||||
var selectedMusicInfo = LoadedMusicBox.SelectedItem as MusicInfo;
|
||||
var selectedMusicInfo = LoadedMusicBox.SelectedItem as MusicInfo;
|
||||
|
||||
var mi = selectedMusicInfo.Clone();
|
||||
var mi = (selectedMusicInfo ?? (NewSoundsBox.SelectedItem as NewSongData)?.MusicInfo ?? new MusicInfo()).Clone();
|
||||
mi.Id = songName;
|
||||
mi.UniqueId = id;
|
||||
ns.MusicInfo = mi;
|
||||
@ -315,7 +341,7 @@ namespace TaikoSoundEditor
|
||||
mo.UniqueId = id;
|
||||
ns.MusicOrder = mo;
|
||||
|
||||
var ma = MusicAttributes.GetByUniqueId(selectedMusicInfo.UniqueId).Clone();
|
||||
var ma = selectedMusicInfo != null ? MusicAttributes.GetByUniqueId(selectedMusicInfo.UniqueId).Clone() : new MusicAttribute();
|
||||
ma.Id = songName;
|
||||
ma.UniqueId = id;
|
||||
ma.New = true;
|
||||
@ -624,6 +650,46 @@ namespace TaikoSoundEditor
|
||||
if (name.Length == 6)
|
||||
SongNameBox.Text = name;
|
||||
}
|
||||
|
||||
|
||||
private void RemoveSongButton_Click(object sender, EventArgs e) => RunGuard(() =>
|
||||
{
|
||||
Logger.Info("Clicked remove song");
|
||||
if (NewSoundsBox.SelectedItem != null)
|
||||
{
|
||||
Logger.Info("Removing newly added song");
|
||||
AddedMusic.Remove(NewSoundsBox.SelectedItem as NewSongData);
|
||||
Logger.Info("Refreshing list");
|
||||
AddedMusicBinding.ResetBindings(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (LoadedMusicBox.SelectedItem != null)
|
||||
{
|
||||
Logger.Info("Removing existing song");
|
||||
var mi = LoadedMusicBox.SelectedItem as MusicInfo;
|
||||
var ma = MusicAttributes.GetByUniqueId(mi.UniqueId);
|
||||
var mo = MusicOrders.GetByUniqueId(mi.UniqueId);
|
||||
var w = WordList.GetBySong(mi.Id);
|
||||
var ws = WordList.GetBySongSub(mi.Id);
|
||||
var wd = WordList.GetBySongDetail(mi.Id);
|
||||
|
||||
Logger.Info("Removing music info");
|
||||
MusicInfos.Items.RemoveAll(x => x.UniqueId == mi.UniqueId);
|
||||
Logger.Info("Removing music attribute");
|
||||
MusicAttributes.Items.Remove(ma);
|
||||
Logger.Info("Removing music order");
|
||||
MusicOrders.Items.Remove(mo);
|
||||
Logger.Info("Removing word");
|
||||
WordList.Items.Remove(w);
|
||||
Logger.Info("Removing word sub");
|
||||
WordList.Items.Remove(ws);
|
||||
Logger.Info("Removing word detail");
|
||||
WordList.Items.Remove(wd);
|
||||
|
||||
Logger.Info("Refreshing list");
|
||||
LoadedMusicBinding.ResetBindings(false);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2023-07-18T06:38:50.7615921Z;True|2023-07-18T09:25:23.0403589+03:00;True|2023-07-17T17:57:08.1469738+03:00;True|2023-07-17T11:28:41.9554245+03:00;True|2023-07-17T11:15:26.2194507+03:00;</History>
|
||||
<History>True|2023-07-19T09:08:17.2430335Z;True|2023-07-18T09:38:50.7615921+03:00;True|2023-07-18T09:25:23.0403589+03:00;True|2023-07-17T17:57:08.1469738+03:00;True|2023-07-17T11:28:41.9554245+03:00;True|2023-07-17T11:15:26.2194507+03:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user