From 71c7899d58f2e87e3a01596ab03b82db5fd00e19 Mon Sep 17 00:00:00 2001 From: NotImplementedLife Date: Fri, 28 Jul 2023 22:28:05 +0300 Subject: [PATCH] working on music order editor --- Controls/MusicOrderViewer.Designer.cs | 149 +++++++++++ Controls/MusicOrderViewer.cs | 347 ++++++++++++++++++++++++++ Controls/MusicOrderViewer.resx | 60 +++++ Controls/SongCard.cs | 30 +++ Data/WordList.cs | 2 +- Extensions/IntExtensions.cs | 7 + MainForm.Designer.cs | 16 ++ MainForm.RequestFiles.cs | 11 +- MainForm.cs | 8 +- Properties/Resources.Designer.cs | 40 +++ Properties/Resources.resx | 12 + README.md | 3 +- Resources/ic_cut.png | Bin 0 -> 1644 bytes Resources/ic_cut_gs.png | Bin 0 -> 1373 bytes Resources/ic_paste.png | Bin 0 -> 1323 bytes Resources/ic_paste_gs.png | Bin 0 -> 1194 bytes Utils/Constants.cs | 21 ++ 17 files changed, 701 insertions(+), 5 deletions(-) create mode 100644 Controls/MusicOrderViewer.Designer.cs create mode 100644 Controls/MusicOrderViewer.cs create mode 100644 Controls/MusicOrderViewer.resx create mode 100644 Controls/SongCard.cs create mode 100644 Extensions/IntExtensions.cs create mode 100644 Resources/ic_cut.png create mode 100644 Resources/ic_cut_gs.png create mode 100644 Resources/ic_paste.png create mode 100644 Resources/ic_paste_gs.png create mode 100644 Utils/Constants.cs diff --git a/Controls/MusicOrderViewer.Designer.cs b/Controls/MusicOrderViewer.Designer.cs new file mode 100644 index 0000000..e198698 --- /dev/null +++ b/Controls/MusicOrderViewer.Designer.cs @@ -0,0 +1,149 @@ +namespace TaikoSoundEditor.Controls +{ + partial class MusicOrderViewer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.MusicOrdersPanel = new System.Windows.Forms.Panel(); + this.RightButton = new System.Windows.Forms.Button(); + this.ControlsPanel = new System.Windows.Forms.Panel(); + this.PasteButton = new System.Windows.Forms.Button(); + this.CutButton = new System.Windows.Forms.Button(); + this.PageLabel = new System.Windows.Forms.Label(); + this.LeftButton = new System.Windows.Forms.Button(); + this.ControlsPanel.SuspendLayout(); + this.SuspendLayout(); + // + // MusicOrdersPanel + // + this.MusicOrdersPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.MusicOrdersPanel.Location = new System.Drawing.Point(20, 32); + this.MusicOrdersPanel.Name = "MusicOrdersPanel"; + this.MusicOrdersPanel.Size = new System.Drawing.Size(467, 265); + this.MusicOrdersPanel.TabIndex = 0; + this.MusicOrdersPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.MusicOrdersPanel_Paint); + this.MusicOrdersPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MusicOrdersPanel_MouseDown); + this.MusicOrdersPanel.MouseLeave += new System.EventHandler(this.MusicOrdersPanel_MouseLeave); + this.MusicOrdersPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MusicOrdersPanel_MouseMove); + this.MusicOrdersPanel.Resize += new System.EventHandler(this.MusicOrdersPanel_Resize); + // + // RightButton + // + this.RightButton.Dock = System.Windows.Forms.DockStyle.Right; + this.RightButton.Location = new System.Drawing.Point(487, 32); + this.RightButton.Name = "RightButton"; + this.RightButton.Size = new System.Drawing.Size(20, 265); + this.RightButton.TabIndex = 1; + this.RightButton.Text = ">"; + this.RightButton.UseVisualStyleBackColor = true; + this.RightButton.Click += new System.EventHandler(this.RightButton_Click); + // + // ControlsPanel + // + this.ControlsPanel.Controls.Add(this.PasteButton); + this.ControlsPanel.Controls.Add(this.CutButton); + this.ControlsPanel.Controls.Add(this.PageLabel); + this.ControlsPanel.Dock = System.Windows.Forms.DockStyle.Top; + this.ControlsPanel.Location = new System.Drawing.Point(0, 0); + this.ControlsPanel.Name = "ControlsPanel"; + this.ControlsPanel.Size = new System.Drawing.Size(507, 32); + this.ControlsPanel.TabIndex = 2; + // + // PasteButton + // + this.PasteButton.BackgroundImage = global::TaikoSoundEditor.Properties.Resources.ic_paste_gs; + this.PasteButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.PasteButton.FlatAppearance.BorderSize = 0; + this.PasteButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.PasteButton.Location = new System.Drawing.Point(33, 3); + this.PasteButton.Name = "PasteButton"; + this.PasteButton.Size = new System.Drawing.Size(24, 24); + this.PasteButton.TabIndex = 2; + this.PasteButton.UseVisualStyleBackColor = true; + this.PasteButton.Click += new System.EventHandler(this.PasteButton_Click); + // + // CutButton + // + this.CutButton.BackgroundImage = global::TaikoSoundEditor.Properties.Resources.ic_cut_gs; + this.CutButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.CutButton.FlatAppearance.BorderSize = 0; + this.CutButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.CutButton.Location = new System.Drawing.Point(3, 3); + this.CutButton.Name = "CutButton"; + this.CutButton.Size = new System.Drawing.Size(24, 24); + this.CutButton.TabIndex = 1; + this.CutButton.UseVisualStyleBackColor = true; + this.CutButton.Click += new System.EventHandler(this.CutButton_Click); + // + // PageLabel + // + this.PageLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.PageLabel.AutoSize = true; + this.PageLabel.Location = new System.Drawing.Point(217, 8); + this.PageLabel.Name = "PageLabel"; + this.PageLabel.Size = new System.Drawing.Size(67, 15); + this.PageLabel.TabIndex = 0; + this.PageLabel.Text = "Page # of #"; + // + // LeftButton + // + this.LeftButton.Dock = System.Windows.Forms.DockStyle.Left; + this.LeftButton.Location = new System.Drawing.Point(0, 32); + this.LeftButton.Name = "LeftButton"; + this.LeftButton.Size = new System.Drawing.Size(20, 265); + this.LeftButton.TabIndex = 3; + this.LeftButton.Text = "<"; + this.LeftButton.UseVisualStyleBackColor = true; + this.LeftButton.Click += new System.EventHandler(this.LeftButton_Click); + // + // MusicOrderViewer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.MusicOrdersPanel); + this.Controls.Add(this.LeftButton); + this.Controls.Add(this.RightButton); + this.Controls.Add(this.ControlsPanel); + this.Name = "MusicOrderViewer"; + this.Size = new System.Drawing.Size(507, 297); + this.ControlsPanel.ResumeLayout(false); + this.ControlsPanel.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private Panel MusicOrdersPanel; + private Button RightButton; + private Panel ControlsPanel; + private Button LeftButton; + private Label PageLabel; + private Button CutButton; + private Button PasteButton; + } +} diff --git a/Controls/MusicOrderViewer.cs b/Controls/MusicOrderViewer.cs new file mode 100644 index 0000000..3778423 --- /dev/null +++ b/Controls/MusicOrderViewer.cs @@ -0,0 +1,347 @@ +using System.Diagnostics; +using System.Drawing.Drawing2D; +using TaikoSoundEditor.Data; +using TaikoSoundEditor.Properties; + +namespace TaikoSoundEditor.Controls +{ + public partial class MusicOrderViewer : UserControl + { + public MusicOrderViewer() + { + InitializeComponent(); + + + typeof(Control).GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) + .SetValue(MusicOrdersPanel, true); + } + + internal WordList WordList { get; set; } + + private List SongCards = new(); + + public void AddSong(MusicOrder mo) + { + SongCards.Add(new SongCard(WordList, mo)); + CurrentPage = CurrentPage; + } + + private int _CurrentPage = 0; + public int CurrentPage + { + get => _CurrentPage; + set + { + _CurrentPage = value; + PageLabel.Text = $"Page {_CurrentPage + 1} of {PagesCount}"; + MusicOrdersPanel.Invalidate(); + + LeftButton.Enabled = _CurrentPage > 0; + RightButton.Enabled = _CurrentPage < PagesCount - 1; + } + } + + public int PagesCount => (SongCards.Count + ItemsPerPage - 1) / ItemsPerPage; + + private int _ItemsPerRow = 4; + private int _ItemsPerCol = 5; + public int ItemsPerRow + { + get => _ItemsPerRow; + set + { + _ItemsPerRow = value; + MusicOrdersPanel.Invalidate(); + } + } + + public int ItemsPerCol + { + get => _ItemsPerCol; + set + { + _ItemsPerCol = value; + MusicOrdersPanel.Invalidate(); + } + } + + public int ItemsPerPage => ItemsPerRow * ItemsPerCol; + + + private static int ItemsPadding = 3; + + public void RefreshMusicOrdersPanel(Graphics g) + { + var cards = SongCards.Skip(CurrentPage * ItemsPerPage).Take(ItemsPerPage).ToArray(); + + int itemW = MusicOrdersPanel.Width / ItemsPerRow - 2 * ItemsPadding; + int itemH = MusicOrdersPanel.Height / ItemsPerCol - 2 * ItemsPadding; + + var cursor = MusicOrdersPanel.PointToClient(Cursor.Position); + + for (int r = 0; r < ItemsPerCol; r++) + { + for (int c = 0; c < ItemsPerRow; c++) + { + int index = r * ItemsPerRow + c; + + var rect = new Rectangle( + c * (itemW + 2 * ItemsPadding) + ItemsPadding, + r * (itemH + 2 * ItemsPadding) + ItemsPadding, + itemW, + itemH); + + if (index >= cards.Length) + { + if (index == cards.Length && rect.Contains(cursor) && PasteMode) + { + + + g.DrawLine(Pens.Black, rect.Left - 2, rect.Top, rect.Left - 2, rect.Top + rect.Height); + } + break; + } + + var card = cards[index]; + + g.FillRectangle(new SolidBrush(card.Color), rect); + + if(card.IsSelected) + { + g.DrawRectangle(Pens.Blue, rect.Left - 1, rect.Top - 1, rect.Width + 1, rect.Height + 1); + g.DrawRectangle(Pens.Green, rect.Left - 2, rect.Top - 2, rect.Width + 3, rect.Height + 3); + g.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.White)), rect); + } + + if(card.IsCut) + { + g.FillRectangle(new HatchBrush(HatchStyle.ForwardDiagonal, Color.White, card.Color), rect); + } + + if (rect.Contains(cursor)) + { + if (PasteMode) + { + g.DrawLine(Pens.Black, rect.Left - 2, rect.Top, rect.Left - 2, rect.Top + rect.Height); + } + else + { + g.FillRectangle(new SolidBrush(Color.FromArgb(192, Color.White)), rect); + } + } + + var cardInfo = $"{card.Id} ({card.Genre})\n{card.Title}\n{card.Subtitle}"; + g.DrawString(cardInfo, Font, Brushes.Black, rect); + } + } + } + + private void MusicOrdersPanel_Resize(object sender, EventArgs e) + { + MusicOrdersPanel.Invalidate(); + } + + private void MusicOrdersPanel_Paint(object sender, PaintEventArgs e) + { + RefreshMusicOrdersPanel(e.Graphics); + } + + private void LeftButton_Click(object sender, EventArgs e) + { + if (CurrentPage > 0) CurrentPage--; + } + + private void RightButton_Click(object sender, EventArgs e) + { + if (CurrentPage < PagesCount - 1) CurrentPage++; + } + + private void MusicOrdersPanel_MouseMove(object sender, MouseEventArgs e) + { + Invalidate(); + } + + private void MusicOrdersPanel_MouseLeave(object sender, EventArgs e) + { + Invalidate(); + } + + public HashSet Selection = new(); + public HashSet CutSelection = new(); + + + private void MusicOrdersPanel_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + 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 (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 = 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(); + } + else + { + foreach(var sel in Selection) + { + sel.IsSelected = false; + } + Selection.Clear(); + + card.IsSelected = true; + Selection.Add(card); + MusicOrdersPanel.Invalidate(); + } + + CutActive = Selection.Count > 0; + } + + private bool _CutActive = false; + public bool CutActive + { + get => _CutActive; + set + { + _CutActive = value; + CutButton.BackgroundImage = CutActive ? Resources.ic_cut : Resources.ic_cut_gs; + CutButton.Enabled = CutActive; + } + } + + private bool _PasteActive = false; + public bool PasteActive + { + get => _PasteActive; + set + { + _PasteActive = value; + PasteButton.BackgroundImage = PasteActive ? Resources.ic_paste : Resources.ic_paste_gs; + PasteButton.Enabled = PasteActive; + } + } + + private void CutButton_Click(object sender, EventArgs e) + { + PasteMode = false; + foreach(var card in CutSelection) + { + card.IsCut = false; + } + CutSelection.Clear(); + + foreach(var card in Selection) + { + card.IsCut = true; + card.IsSelected = false; + CutSelection.Add(card); + } + Selection.Clear(); + + PasteActive = CutSelection.Count > 0; + CutActive= Selection.Count > 0; + + MusicOrdersPanel.Invalidate(); + } + + private bool _PasteMode = false; + + public bool PasteMode + { + get => _PasteMode; + set + { + _PasteMode = value; + PasteButton.FlatAppearance.BorderSize = _PasteMode ? 1 : 0; + } + } + + private void PasteButton_Click(object sender, EventArgs e) + { + PasteMode = !PasteMode; + + foreach (var card in Selection) + card.IsSelected = false; + Selection.Clear(); + MusicOrdersPanel.Invalidate(); + } + } +} diff --git a/Controls/MusicOrderViewer.resx b/Controls/MusicOrderViewer.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/Controls/MusicOrderViewer.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Controls/SongCard.cs b/Controls/SongCard.cs new file mode 100644 index 0000000..e2fdcef --- /dev/null +++ b/Controls/SongCard.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using TaikoSoundEditor.Data; +using TaikoSoundEditor.Extensions; +using TaikoSoundEditor.Utils; + +namespace TaikoSoundEditor.Controls +{ + public class SongCard + { + internal WordList WordList { get; } + public MusicOrder MusicOrder { get; } + + public string Id => $"{MusicOrder.UniqueId}.{MusicOrder.Id}"; + public string Title => WordList.GetBySong(MusicOrder.Id).JapaneseText; + public string Subtitle => WordList.GetBySongSub(MusicOrder.Id).JapaneseText; + public string Genre => MusicOrder.Genre.ToString(); + public Color Color => Constants.GenreColors[MusicOrder.GenreNo.Clamp(0, Constants.GenreColors.Length - 1)]; + + public SongCard(WordList wordList, MusicOrder musicOrder) + { + WordList = wordList; + MusicOrder = musicOrder; + } + + public bool IsSelected { get; set; } = false; + + public bool IsCut { get; set; } = false; + } +} diff --git a/Data/WordList.cs b/Data/WordList.cs index 3530ce2..d4a77ea 100644 --- a/Data/WordList.cs +++ b/Data/WordList.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace TaikoSoundEditor.Data { - internal class WordList + public class WordList { [JsonPropertyName("items")] public List Items { get; set; } = new List(); diff --git a/Extensions/IntExtensions.cs b/Extensions/IntExtensions.cs new file mode 100644 index 0000000..4f2a471 --- /dev/null +++ b/Extensions/IntExtensions.cs @@ -0,0 +1,7 @@ +namespace TaikoSoundEditor.Extensions +{ + internal static class IntExtensions + { + public static int Clamp(this int x, int a, int b) => x <= a ? a : x >= b ? b : x; + } +} diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index abf8eb2..96cdbd9 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -87,6 +87,7 @@ this.WordsGB = new System.Windows.Forms.GroupBox(); this.WordsGrid = new System.Windows.Forms.PropertyGrid(); this.MusicOrderTab = new System.Windows.Forms.TabPage(); + this.MusicOrderViewer = new TaikoSoundEditor.Controls.MusicOrderViewer(); this.RemoveSongButton = new System.Windows.Forms.Button(); this.DatatableSpaces = new System.Windows.Forms.CheckBox(); this.ExportOpenOnFinished = new System.Windows.Forms.CheckBox(); @@ -143,6 +144,7 @@ this.WordDetailGB.SuspendLayout(); this.WordSubGB.SuspendLayout(); this.WordsGB.SuspendLayout(); + this.MusicOrderTab.SuspendLayout(); this.groupBox8.SuspendLayout(); this.groupBox3.SuspendLayout(); this.tabPage3.SuspendLayout(); @@ -789,6 +791,7 @@ // // MusicOrderTab // + this.MusicOrderTab.Controls.Add(this.MusicOrderViewer); this.MusicOrderTab.Location = new System.Drawing.Point(4, 24); this.MusicOrderTab.Name = "MusicOrderTab"; this.MusicOrderTab.Padding = new System.Windows.Forms.Padding(3); @@ -797,6 +800,17 @@ this.MusicOrderTab.Text = "Music Order"; this.MusicOrderTab.UseVisualStyleBackColor = true; // + // MusicOrderViewer + // + this.MusicOrderViewer.CurrentPage = 0; + this.MusicOrderViewer.Dock = System.Windows.Forms.DockStyle.Fill; + this.MusicOrderViewer.ItemsPerCol = 5; + this.MusicOrderViewer.ItemsPerRow = 4; + this.MusicOrderViewer.Location = new System.Drawing.Point(3, 3); + this.MusicOrderViewer.Name = "MusicOrderViewer"; + this.MusicOrderViewer.Size = new System.Drawing.Size(515, 290); + this.MusicOrderViewer.TabIndex = 0; + // // RemoveSongButton // this.RemoveSongButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -1195,6 +1209,7 @@ this.WordDetailGB.ResumeLayout(false); this.WordSubGB.ResumeLayout(false); this.WordsGB.ResumeLayout(false); + this.MusicOrderTab.ResumeLayout(false); this.groupBox8.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.tabPage3.ResumeLayout(false); @@ -1300,5 +1315,6 @@ private Label label19; private NumericUpDown SimpleStarUraBox; private Button LocateInMusicOrderButton; + private Controls.MusicOrderViewer MusicOrderViewer; } } \ No newline at end of file diff --git a/MainForm.RequestFiles.cs b/MainForm.RequestFiles.cs index 01b1920..417b43f 100644 --- a/MainForm.RequestFiles.cs +++ b/MainForm.RequestFiles.cs @@ -103,9 +103,18 @@ namespace TaikoSoundEditor Logger.Info($"Setting LoadedMusicBox DataSource"); LoadedMusicBinding = new BindingSource(); - LoadedMusicBinding.DataSource = MusicInfos.Items.Where(mi => mi.UniqueId != 0).ToList(); + var cleanList = MusicInfos.Items.Where(mi => mi.UniqueId != 0).ToList(); + + LoadedMusicBinding.DataSource = cleanList; LoadedMusicBox.DataSource = LoadedMusicBinding; TabControl.SelectedIndex = 1; + + + MusicOrderViewer.WordList = WordList; + foreach (var musicOrder in MusicOrders.Items) + { + MusicOrderViewer.AddSong(musicOrder); + } }); #endregion diff --git a/MainForm.cs b/MainForm.cs index 637c220..19bb0cf 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -18,7 +18,7 @@ namespace TaikoSoundEditor NewSoundsBox.DataSource = AddedMusicBinding; TabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged; - SimpleGenreBox.DataSource = Enum.GetValues(typeof(Genre)); + SimpleGenreBox.DataSource = Enum.GetValues(typeof(Genre)); } private void TabControl_SelectedIndexChanged(object sender, EventArgs e) @@ -175,6 +175,11 @@ namespace TaikoSoundEditor private void SoundViewTab_SelectedIndexChanged(object sender, EventArgs e) { + if(SoundViewTab.SelectedTab==MusicOrderTab) + { + return; + } + if (!(SoundViewTab.SelectedTab == SoundViewerExpert || SoundViewTab.SelectedTab == SoundViewerSimple)) return; @@ -235,7 +240,6 @@ namespace TaikoSoundEditor item.MusicInfo.StarUra = (int)SimpleStarUraBox.Value; return; } - }); } } \ No newline at end of file diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 75cf615..83502aa 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -60,6 +60,46 @@ namespace TaikoSoundEditor.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ic_cut { + get { + object obj = ResourceManager.GetObject("ic_cut", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ic_cut_gs { + get { + object obj = ResourceManager.GetObject("ic_cut_gs", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ic_paste { + get { + object obj = ResourceManager.GetObject("ic_paste", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ic_paste_gs { + get { + object obj = ResourceManager.GetObject("ic_paste_gs", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Byte[]. /// diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 8e1f112..22cdd7a 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -118,6 +118,18 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\ic_cut.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_cut_gs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_paste.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_paste_gs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\song_ABCDEF_nus3bank.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/README.md b/README.md index 2db4d81..efc2bd1 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,5 @@ A simple tool to automatize the process of converting music to .nus3bank format ## Credits - big shoutout to [Nabix](https://github.com/Nabixlol) for reaching me with the idea to create this tool, testing it and - offering careful and insightful guidance through all the conversion steps to someone who has never even heard about this game before :)) \ No newline at end of file + offering careful and insightful guidance through all the conversion steps to someone who has never even heard about this game before :)) +- https://www.softicons.com/ \ No newline at end of file diff --git a/Resources/ic_cut.png b/Resources/ic_cut.png new file mode 100644 index 0000000000000000000000000000000000000000..51cb8f8af6a7686c0cc857c89eb9ed3fdb5f21d7 GIT binary patch literal 1644 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 literal 0 HcmV?d00001 diff --git a/Resources/ic_paste.png b/Resources/ic_paste.png new file mode 100644 index 0000000000000000000000000000000000000000..d00ed00436cc62215b01d18e0a4ef28637a58d9f GIT binary patch literal 1323 zcmV+`1=RY9P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1i(o|K~!i%)tX&M z99I;_&o~=b1KAdWTBUgqB9S6!S_^H{hrFm5`VbQ;fwYvCkf#s=C1LR)P}=I!LPOj1 zlL`r;MkH2BTNjizZINsL(Jcp-?FA-_IAr1+IS8sl=E6CUJ@EBdwVU=`gglwb4C$ z!r?GI3NiJP4;gohZnFVVE=N zbs|2#GyyBI2<+6G8>i>c0&5Ho4Xgz`ICI~#$2>;)w z9R*-;|HFHGm6u*W4|9KBqCHl+zr7Egot<>go`Hb@*dzZ2hdN%SJz12@8c6CO?P@*_ zADun{?_ar9PzFk9>zc;KMwpzO%(>xlvdsT^G=Zfgg1ikJcxDC~w*LaVOMZr@Q(>rx ze-BUmdj+<~F2lCFmq41n0O>ouuy*@vdd3E9^bwo~BFMXh5G9jVg~+5OWYoE1#%6@k z1hVV7V{k6`_U4t4vThVa#M=osi65Y`O5_A$);)kk}bXd{niN_<+pQ1&W4 zqHugZAKt}WXC-F|>B~hc8+GI*pI^%g8fb5CCvhPxEiJ*q!U8NWFS|BjEg^;0wF(o> z;E5MWAP^v}-|xrgjH_1`$2p*t3&TV4NLg7Kd79VP*Sj|1XaI#W!6XxE-FqdTQC?mS zm6esQO>hlpB2h4w4HM40>j(z3fG`sk6%{ZxHfC#rYrrt-PND@pP4&p~#+*YFH8nLP zwlm?F0WA}DCImfAoj?D3wg$1DK#`S!2J9?Ju*xF20Rq+1eOvSo1LAd zJz4Ax=moO4NaCH~8(>29vEGCZ_I6n;xG!_jKfZK5(r6&I<4w!E(A67LG%Ae!&+evC zmY$v-^09#Kats_j2hnTR#fTmhjSCYt`aA<(VK$K0B-WQpu}gcC4;$949K~!8O2y>IJ(Mj^IVv(hw09^Wc`y%G~d;68)9- z=EmzepdS#&IWQb*R+Z@F$0r=+qSa zw~~SQ1IMo!2KK%6fguCt3ya)08xX?q@UX&2Bodys-QC@WkrmJeyacg002ovPDHLkV1ju;UjP6A literal 0 HcmV?d00001 diff --git a/Resources/ic_paste_gs.png b/Resources/ic_paste_gs.png new file mode 100644 index 0000000000000000000000000000000000000000..fb8b5291f5f491030a293f1e1374b2f13d5a439e GIT binary patch literal 1194 zcmV;b1XcTqP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T-Pc*(j1Pc}IECfM8QT!8BEJOtHfq#OXm55;F1GKOaY%H}9#6}dfvi5=6Dfj{( zsD&VCeDBRSnd9Be?re6G-6Z}X%-Om7_`W%3b|&%CUneA6*Nlve7&1)A^z^jn`+Fts z0gH=^#^d9oh;wsuMXU1t{Y~xd?ea*^=H@1ij*f;VCMFEr3)k^I5rd+lA{rhZPRV54 z#WOQAMo&)<<>chZ9xLnX>(t%dP51Zrl%JnZA0HoFeu@US3}4 z>FG(7-ObGnU0q$#+1VMLo}S7p{==gWbmqL`xrBgW7!(SHL<=BHMK{8HZc|eejgOC~ zuY^=V5U&%io{RI;k6&0a(BI!r$H&LACmtSo2t+AxTu@LT&qy7VX7nxQIx7iF$XqVm zVgz|{0x;0g(IMhgz&yIWy(KKBZcSK92m%=v&De?elai7W(PBWN>x`={i{l*N5@CWA z4+;wl#oAF@TkG0{qX7tI!7zim4@x|P{ZV;&xoZ=)23RBnqik5XpKlKx$O2#!Wo2cw zv$LZ$VQauV>Q17A$OfLxz(iG5m56mF95cYJ&V>14K>-srH8o=QYG=Z64mhEj^b5R+ zuoK2s96QPS zPN0-v?DFzb_QcQ{Fbm{3Q{tV_PGX**s%TYwI$o_#*lyKI27u#WLfQ6a`yA=-bQ2uHN{EF?cEg|f=udlCVZ(@R;1Lgs7oCCA7vqooU z=WppafsAlj;m2GyV1Afgob10djt1uE=Z*98bMc3V*Vk9so0!4D!MF^l5BBp|HQ);y z8yf}_i9`ZzCnqQ4z7zZ61P0U+O4l6lg`hLQF;Fw$xDI3s=J}xFs{y1ssFq`uKal~T z%Yv^4_#r{GY0H2cF{!jFzPyfBS62=EmWlsnkPdu*jb;v_e*w4gf_f@)O8@`>07*qo IM6N<$f>ks&Z2$lO literal 0 HcmV?d00001 diff --git a/Utils/Constants.cs b/Utils/Constants.cs new file mode 100644 index 0000000..8527dac --- /dev/null +++ b/Utils/Constants.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace TaikoSoundEditor.Utils +{ + internal static class Constants + { + static Random ColorRand = new Random(1236); + + public static Color[] Colors = typeof(Color) + .GetProperties(BindingFlags.Static | BindingFlags.Public) + .Where(p => p.PropertyType == typeof(Color)).Select(p => (Color)p.GetValue(null)) + .Where(c => c != Color.Transparent) + .OrderBy(_ => ColorRand.Next()) + .ToArray(); + + public static Color[] GenreColors = Colors.Where(c => 0.5 <= c.GetBrightness() && c.GetBrightness() < 0.7 && c.GetSaturation() > 0.5).ToArray(); + } +}