diff --git a/Controls/MusicOrderViewer.Designer.cs b/Controls/MusicOrderViewer.Designer.cs
index 54fe66d..48a5d85 100644
--- a/Controls/MusicOrderViewer.Designer.cs
+++ b/Controls/MusicOrderViewer.Designer.cs
@@ -28,6 +28,7 @@
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.MusicOrdersPanel = new System.Windows.Forms.Panel();
this.RightButton = new System.Windows.Forms.Button();
this.ControlsPanel = new System.Windows.Forms.Panel();
@@ -40,7 +41,18 @@
this.CutButton = new System.Windows.Forms.Button();
this.PageLabel = new System.Windows.Forms.Label();
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.GenreCloneMenuStrip.SuspendLayout();
this.SuspendLayout();
//
// MusicOrdersPanel
@@ -206,6 +218,84 @@
this.LeftButton.UseVisualStyleBackColor = false;
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -218,6 +308,7 @@
this.Size = new System.Drawing.Size(507, 297);
this.ControlsPanel.ResumeLayout(false);
this.ControlsPanel.PerformLayout();
+ this.GenreCloneMenuStrip.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -236,5 +327,15 @@
private Button Right10Button;
private Button ListStartButton;
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;
}
}
diff --git a/Controls/MusicOrderViewer.cs b/Controls/MusicOrderViewer.cs
index 6ded815..dab9f2f 100644
--- a/Controls/MusicOrderViewer.cs
+++ b/Controls/MusicOrderViewer.cs
@@ -187,108 +187,133 @@ namespace TaikoSoundEditor.Controls
private void MusicOrdersPanel_MouseDown(object sender, MouseEventArgs e) => ExceptionGuard.Run(() =>
{
- if (e.Button != MouseButtons.Left) return;
- 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 (PasteMode)
+ 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;
- SongCard before = null, after = null;
-
- for (int i = index; i < SongCards.Count; i++)
- if (!SongCards[i].IsCut)
- {
- before = SongCards[i];
- break;
- }
- for (int i = index - 1; i >= 0; i--)
- if (!SongCards[i].IsCut)
- {
- after = SongCards[i];
- break;
- }
-
- string message = "Do you want to move the selected songs?";
-
- if (before != null)
- {
- if (after != null && before != after)
- {
- message = $"Do you want to move the selected songs before {before.Id} and after {after.Id}?";
- }
- else
- {
- message = $"Do you want to move the selected songs before {before.Id}?";
- }
- }
- else if (after != null)
- {
- message = $"Do you want to move the selected songs after {after.Id}?";
- }
-
- if (MessageBox.Show(message, "Move songs?", MessageBoxButtons.YesNo) != DialogResult.Yes)
- return;
-
- SongCards.RemoveAll(CutSelection.Contains);
- var ix = after != null ? SongCards.IndexOf(after) + 1 : before != null ? SongCards.IndexOf(before) : 0;
- SongCards.InsertRange(ix, CutSelection);
-
- foreach (var c in CutSelection) c.IsCut = false;
- CutSelection.Clear();
- PasteMode = false;
- PasteActive = false;
- CutActive = RemoveActive = false;
- MusicOrdersPanel.Invalidate();
-
- return;
- }
-
- if (index < 0 || index >= SongCards.Count) return;
-
- var card = SongCards[index];
-
- if (Form.ModifierKeys == Keys.Control)
- {
- if (card.IsSelected)
- {
- card.IsSelected = false;
- Selection.Remove(card);
- }
- else
- {
- card.IsSelected = true;
- Selection.Add(card);
- }
- MusicOrdersPanel.Invalidate();
+ CardToClone = SongCards[index];
+ GenreCloneMenuStrip.Show(MusicOrdersPanel, cursor);
}
else
{
- foreach (var sel in Selection)
+
+ if (e.Button != MouseButtons.Left) return;
+ 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 (PasteMode)
{
- sel.IsSelected = false;
+ if (index < 0 || index > SongCards.Count) return;
+
+ SongCard before = null, after = null;
+
+ for (int i = index; i < SongCards.Count; i++)
+ if (!SongCards[i].IsCut)
+ {
+ before = SongCards[i];
+ break;
+ }
+ for (int i = index - 1; i >= 0; i--)
+ if (!SongCards[i].IsCut)
+ {
+ after = SongCards[i];
+ break;
+ }
+
+ string message = "Do you want to move the selected songs?";
+
+ if (before != null)
+ {
+ if (after != null && before != after)
+ {
+ message = $"Do you want to move the selected songs before {before.Id} and after {after.Id}?";
+ }
+ else
+ {
+ message = $"Do you want to move the selected songs before {before.Id}?";
+ }
+ }
+ else if (after != null)
+ {
+ message = $"Do you want to move the selected songs after {after.Id}?";
+ }
+
+ if (MessageBox.Show(message, "Move songs?", MessageBoxButtons.YesNo) != DialogResult.Yes)
+ return;
+
+ SongCards.RemoveAll(CutSelection.Contains);
+ var ix = after != null ? SongCards.IndexOf(after) + 1 : before != null ? SongCards.IndexOf(before) : 0;
+ SongCards.InsertRange(ix, CutSelection);
+
+ foreach (var c in CutSelection) c.IsCut = false;
+ CutSelection.Clear();
+ PasteMode = false;
+ PasteActive = false;
+ CutActive = RemoveActive = false;
+ MusicOrdersPanel.Invalidate();
+
+ return;
}
- Selection.Clear();
- card.IsSelected = true;
- Selection.Add(card);
- MusicOrdersPanel.Invalidate();
+ if (index < 0 || index >= SongCards.Count) return;
+
+ var card = SongCards[index];
+
+ if (Form.ModifierKeys == Keys.Control)
+ {
+ if (card.IsSelected)
+ {
+ card.IsSelected = false;
+ Selection.Remove(card);
+ }
+ else
+ {
+ card.IsSelected = true;
+ Selection.Add(card);
+ }
+ MusicOrdersPanel.Invalidate();
+ }
+ else
+ {
+ foreach (var sel in Selection)
+ {
+ sel.IsSelected = false;
+ }
+ Selection.Clear();
+
+ card.IsSelected = true;
+ Selection.Add(card);
+ MusicOrdersPanel.Invalidate();
+ }
+
+ CutActive = RemoveActive = Selection.Count > 0;
}
-
- CutActive = RemoveActive = Selection.Count > 0;
});
private bool _CutActive = false;
@@ -375,6 +400,8 @@ namespace TaikoSoundEditor.Controls
MusicOrdersPanel.Invalidate();
});
+ public bool SongExists(int uniqueId) => SongCards.Any(c => c.MusicOrder.UniqueId == uniqueId);
+
private void RemoveButton_Click(object sender, EventArgs e) => ExceptionGuard.Run(() =>
{
var toRemove = Selection.ToList();
@@ -495,5 +522,18 @@ namespace TaikoSoundEditor.Controls
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);
+ }
}
}
diff --git a/Controls/MusicOrderViewer.resx b/Controls/MusicOrderViewer.resx
index f298a7b..baf52c1 100644
--- a/Controls/MusicOrderViewer.resx
+++ b/Controls/MusicOrderViewer.resx
@@ -57,4 +57,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/Data/MusicOrder.cs b/Data/MusicOrder.cs
index 2e65765..f4ba9e9 100644
--- a/Data/MusicOrder.cs
+++ b/Data/MusicOrder.cs
@@ -24,5 +24,14 @@ namespace TaikoSoundEditor.Data
get => (Genre)GenreNo;
set => GenreNo = (int)value;
}
+
+ public MusicOrder() { }
+ public MusicOrder(MusicOrder source)
+ {
+ Genre = source.Genre;
+ Id = source.Id;
+ UniqueId = source.UniqueId;
+ CloseDispType = source.CloseDispType;
+ }
}
}
diff --git a/MainForm.cs b/MainForm.cs
index bc3af3c..6c67018 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -268,6 +268,9 @@ namespace TaikoSoundEditor
private void MusicOrderViewer_SongRemoved(Controls.MusicOrderViewer sender, MusicOrder mo) => ExceptionGuard.Run(() =>
{
var uniqId = mo.UniqueId;
+ if (MusicOrderViewer.SongExists(uniqId))
+ return;
+
var mi = MusicInfos.Items.Where(x => x.UniqueId == uniqId).FirstOrDefault();
if (mi != null)
diff --git a/Properties/PublishProfiles/FolderProfile.pubxml.user b/Properties/PublishProfiles/FolderProfile.pubxml.user
index ef1a9c2..e0329a6 100644
--- a/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ b/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- 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;
+ 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;
\ No newline at end of file
diff --git a/Utils/ExceptionGuard.cs b/Utils/ExceptionGuard.cs
index 74cfb70..8a25e91 100644
--- a/Utils/ExceptionGuard.cs
+++ b/Utils/ExceptionGuard.cs
@@ -22,8 +22,8 @@ namespace TaikoSoundEditor.Utils
throw;
#else
- MessageBox.Show(e.Message, "An error occured");
- Logger.Error(e);
+ MessageBox.Show(ex.Message, "An error occured");
+ Logger.Error(ex);
#endif
}
}