1
0
mirror of synced 2024-11-24 04:20:10 +01:00

can add the same song to multiple genres

This commit is contained in:
NotImplementedLife 2023-08-16 19:05:50 +03:00
parent b1617bf7ad
commit 8c93053867
7 changed files with 251 additions and 95 deletions

View File

@ -28,6 +28,7 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.MusicOrdersPanel = new System.Windows.Forms.Panel(); this.MusicOrdersPanel = new System.Windows.Forms.Panel();
this.RightButton = new System.Windows.Forms.Button(); this.RightButton = new System.Windows.Forms.Button();
this.ControlsPanel = new System.Windows.Forms.Panel(); this.ControlsPanel = new System.Windows.Forms.Panel();
@ -40,7 +41,18 @@
this.CutButton = new System.Windows.Forms.Button(); this.CutButton = new System.Windows.Forms.Button();
this.PageLabel = new System.Windows.Forms.Label(); this.PageLabel = new System.Windows.Forms.Label();
this.LeftButton = new System.Windows.Forms.Button(); this.LeftButton = new System.Windows.Forms.Button();
this.GenreCloneMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.cloneAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.popToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.animeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.kidsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.vocaloidToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.gameMusicToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.namcoOriginalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.varietyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.classicalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ControlsPanel.SuspendLayout(); this.ControlsPanel.SuspendLayout();
this.GenreCloneMenuStrip.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// MusicOrdersPanel // MusicOrdersPanel
@ -206,6 +218,84 @@
this.LeftButton.UseVisualStyleBackColor = false; this.LeftButton.UseVisualStyleBackColor = false;
this.LeftButton.Click += new System.EventHandler(this.LeftButton_Click); this.LeftButton.Click += new System.EventHandler(this.LeftButton_Click);
// //
// GenreCloneMenuStrip
//
this.GenreCloneMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cloneAsToolStripMenuItem});
this.GenreCloneMenuStrip.Name = "GenreCloneMenuStrip";
this.GenreCloneMenuStrip.Size = new System.Drawing.Size(181, 48);
//
// cloneAsToolStripMenuItem
//
this.cloneAsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.popToolStripMenuItem,
this.animeToolStripMenuItem,
this.kidsToolStripMenuItem,
this.vocaloidToolStripMenuItem,
this.gameMusicToolStripMenuItem,
this.namcoOriginalToolStripMenuItem,
this.varietyToolStripMenuItem,
this.classicalToolStripMenuItem});
this.cloneAsToolStripMenuItem.Name = "cloneAsToolStripMenuItem";
this.cloneAsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.cloneAsToolStripMenuItem.Text = "Clone as";
//
// popToolStripMenuItem
//
this.popToolStripMenuItem.Name = "popToolStripMenuItem";
this.popToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.popToolStripMenuItem.Text = "Pop";
this.popToolStripMenuItem.Click += new System.EventHandler(this.GenreCloneToolStripMenuItem_Click);
//
// animeToolStripMenuItem
//
this.animeToolStripMenuItem.Name = "animeToolStripMenuItem";
this.animeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.animeToolStripMenuItem.Text = "Anime";
this.animeToolStripMenuItem.Click += new System.EventHandler(this.GenreCloneToolStripMenuItem_Click);
//
// kidsToolStripMenuItem
//
this.kidsToolStripMenuItem.Name = "kidsToolStripMenuItem";
this.kidsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.kidsToolStripMenuItem.Text = "Kids";
this.kidsToolStripMenuItem.Click += new System.EventHandler(this.GenreCloneToolStripMenuItem_Click);
//
// vocaloidToolStripMenuItem
//
this.vocaloidToolStripMenuItem.Name = "vocaloidToolStripMenuItem";
this.vocaloidToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.vocaloidToolStripMenuItem.Text = "Vocaloid";
this.vocaloidToolStripMenuItem.Click += new System.EventHandler(this.GenreCloneToolStripMenuItem_Click);
//
// gameMusicToolStripMenuItem
//
this.gameMusicToolStripMenuItem.Name = "gameMusicToolStripMenuItem";
this.gameMusicToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.gameMusicToolStripMenuItem.Text = "GameMusic";
this.gameMusicToolStripMenuItem.Click += new System.EventHandler(this.GenreCloneToolStripMenuItem_Click);
//
// namcoOriginalToolStripMenuItem
//
this.namcoOriginalToolStripMenuItem.Name = "namcoOriginalToolStripMenuItem";
this.namcoOriginalToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.namcoOriginalToolStripMenuItem.Text = "NamcoOriginal";
this.namcoOriginalToolStripMenuItem.Click += new System.EventHandler(this.GenreCloneToolStripMenuItem_Click);
//
// varietyToolStripMenuItem
//
this.varietyToolStripMenuItem.Name = "varietyToolStripMenuItem";
this.varietyToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.varietyToolStripMenuItem.Text = "Variety";
this.varietyToolStripMenuItem.Click += new System.EventHandler(this.GenreCloneToolStripMenuItem_Click);
//
// classicalToolStripMenuItem
//
this.classicalToolStripMenuItem.Name = "classicalToolStripMenuItem";
this.classicalToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.classicalToolStripMenuItem.Text = "Classical";
this.classicalToolStripMenuItem.Click += new System.EventHandler(this.GenreCloneToolStripMenuItem_Click);
//
// MusicOrderViewer // MusicOrderViewer
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@ -218,6 +308,7 @@
this.Size = new System.Drawing.Size(507, 297); this.Size = new System.Drawing.Size(507, 297);
this.ControlsPanel.ResumeLayout(false); this.ControlsPanel.ResumeLayout(false);
this.ControlsPanel.PerformLayout(); this.ControlsPanel.PerformLayout();
this.GenreCloneMenuStrip.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -236,5 +327,15 @@
private Button Right10Button; private Button Right10Button;
private Button ListStartButton; private Button ListStartButton;
private Button ListEndButton; private Button ListEndButton;
private ContextMenuStrip GenreCloneMenuStrip;
private ToolStripMenuItem cloneAsToolStripMenuItem;
private ToolStripMenuItem popToolStripMenuItem;
private ToolStripMenuItem animeToolStripMenuItem;
private ToolStripMenuItem kidsToolStripMenuItem;
private ToolStripMenuItem vocaloidToolStripMenuItem;
private ToolStripMenuItem gameMusicToolStripMenuItem;
private ToolStripMenuItem namcoOriginalToolStripMenuItem;
private ToolStripMenuItem varietyToolStripMenuItem;
private ToolStripMenuItem classicalToolStripMenuItem;
} }
} }

View File

@ -187,6 +187,30 @@ namespace TaikoSoundEditor.Controls
private void MusicOrdersPanel_MouseDown(object sender, MouseEventArgs e) => ExceptionGuard.Run(() => private void MusicOrdersPanel_MouseDown(object sender, MouseEventArgs e) => ExceptionGuard.Run(() =>
{ {
if (e.Button == MouseButtons.Right)
{
Select();
var cursor = e.Location;
int itemW = MusicOrdersPanel.Width / ItemsPerRow;
int itemH = MusicOrdersPanel.Height / ItemsPerCol;
int row = cursor.Y / itemH;
int col = cursor.X / itemW;
//Debug.WriteLine($"{row} {col}");
if (row < 0 || row >= ItemsPerCol || col < 0 || col >= ItemsPerRow)
return;
var index = CurrentPage * ItemsPerPage + row * ItemsPerRow + col;
if (index < 0 || index > SongCards.Count) return;
CardToClone = SongCards[index];
GenreCloneMenuStrip.Show(MusicOrdersPanel, cursor);
}
else
{
if (e.Button != MouseButtons.Left) return; if (e.Button != MouseButtons.Left) return;
Select(); Select();
var cursor = e.Location; var cursor = e.Location;
@ -289,6 +313,7 @@ namespace TaikoSoundEditor.Controls
} }
CutActive = RemoveActive = Selection.Count > 0; CutActive = RemoveActive = Selection.Count > 0;
}
}); });
private bool _CutActive = false; private bool _CutActive = false;
@ -375,6 +400,8 @@ namespace TaikoSoundEditor.Controls
MusicOrdersPanel.Invalidate(); MusicOrdersPanel.Invalidate();
}); });
public bool SongExists(int uniqueId) => SongCards.Any(c => c.MusicOrder.UniqueId == uniqueId);
private void RemoveButton_Click(object sender, EventArgs e) => ExceptionGuard.Run(() => private void RemoveButton_Click(object sender, EventArgs e) => ExceptionGuard.Run(() =>
{ {
var toRemove = Selection.ToList(); var toRemove = Selection.ToList();
@ -495,5 +522,18 @@ namespace TaikoSoundEditor.Controls
SongDoubleClick?.Invoke(this, SongCards[index].MusicOrder); SongDoubleClick?.Invoke(this, SongCards[index].MusicOrder);
} }
private SongCard CardToClone = null;
private void GenreCloneToolStripMenuItem_Click(object sender, EventArgs e)
{
if (CardToClone == null) return;
var genre = (Genre)Enum.Parse(typeof(Genre), (sender as ToolStripMenuItem).Text);
//MessageBox.Show(genre.ToString());
var newMO = new MusicOrder(CardToClone.MusicOrder);
newMO.Genre = genre;
AddSong(newMO);
}
} }
} }

View File

@ -57,4 +57,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="GenreCloneMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View File

@ -24,5 +24,14 @@ namespace TaikoSoundEditor.Data
get => (Genre)GenreNo; get => (Genre)GenreNo;
set => GenreNo = (int)value; set => GenreNo = (int)value;
} }
public MusicOrder() { }
public MusicOrder(MusicOrder source)
{
Genre = source.Genre;
Id = source.Id;
UniqueId = source.UniqueId;
CloseDispType = source.CloseDispType;
}
} }
} }

View File

@ -268,6 +268,9 @@ namespace TaikoSoundEditor
private void MusicOrderViewer_SongRemoved(Controls.MusicOrderViewer sender, MusicOrder mo) => ExceptionGuard.Run(() => private void MusicOrderViewer_SongRemoved(Controls.MusicOrderViewer sender, MusicOrder mo) => ExceptionGuard.Run(() =>
{ {
var uniqId = mo.UniqueId; var uniqId = mo.UniqueId;
if (MusicOrderViewer.SongExists(uniqId))
return;
var mi = MusicInfos.Items.Where(x => x.UniqueId == uniqId).FirstOrDefault(); var mi = MusicInfos.Items.Where(x => x.UniqueId == uniqId).FirstOrDefault();
if (mi != null) if (mi != null)

View File

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<History>True|2023-07-31T16:49:36.9770534Z;True|2023-07-31T19:48:14.6352025+03:00;True|2023-07-30T09:51:53.3737837+03:00;True|2023-07-30T09:20:22.7718733+03:00;True|2023-07-30T09:02:22.1384796+03:00;True|2023-07-30T08:20:21.5020489+03:00;True|2023-07-29T11:28:56.2445862+03:00;True|2023-07-29T11:05:03.3876668+03:00;True|2023-07-29T10:54:04.8963992+03:00;True|2023-07-29T10:22:03.4096107+03:00;True|2023-07-29T10:05:26.6712083+03:00;True|2023-07-28T19:30:15.3174413+03:00;True|2023-07-22T19:07:39.3718711+03:00;True|2023-07-22T19:06:41.2393088+03:00;True|2023-07-22T12:07:26.2620601+03:00;True|2023-07-22T12:06:39.9230498+03:00;True|2023-07-22T11:29:18.0153916+03:00;True|2023-07-22T08:23:07.5000923+03:00;True|2023-07-21T20:03:15.6598520+03:00;True|2023-07-21T19:41:13.2800435+03:00;True|2023-07-19T13:08:33.4726289+03:00;True|2023-07-19T12:08:17.2430335+03:00;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> <History>True|2023-07-31T17:19:48.4524724Z;False|2023-07-31T20:17:55.5982472+03:00;False|2023-07-31T20:17:38.1663347+03:00;True|2023-07-31T19:49:36.9770534+03:00;True|2023-07-31T19:48:14.6352025+03:00;True|2023-07-30T09:51:53.3737837+03:00;True|2023-07-30T09:20:22.7718733+03:00;True|2023-07-30T09:02:22.1384796+03:00;True|2023-07-30T08:20:21.5020489+03:00;True|2023-07-29T11:28:56.2445862+03:00;True|2023-07-29T11:05:03.3876668+03:00;True|2023-07-29T10:54:04.8963992+03:00;True|2023-07-29T10:22:03.4096107+03:00;True|2023-07-29T10:05:26.6712083+03:00;True|2023-07-28T19:30:15.3174413+03:00;True|2023-07-22T19:07:39.3718711+03:00;True|2023-07-22T19:06:41.2393088+03:00;True|2023-07-22T12:07:26.2620601+03:00;True|2023-07-22T12:06:39.9230498+03:00;True|2023-07-22T11:29:18.0153916+03:00;True|2023-07-22T08:23:07.5000923+03:00;True|2023-07-21T20:03:15.6598520+03:00;True|2023-07-21T19:41:13.2800435+03:00;True|2023-07-19T13:08:33.4726289+03:00;True|2023-07-19T12:08:17.2430335+03:00;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 /> <LastFailureDetails />
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -22,8 +22,8 @@ namespace TaikoSoundEditor.Utils
throw; throw;
#else #else
MessageBox.Show(e.Message, "An error occured"); MessageBox.Show(ex.Message, "An error occured");
Logger.Error(e); Logger.Error(ex);
#endif #endif
} }
} }