working on music order editor
This commit is contained in:
parent
e8e6693306
commit
71c7899d58
149
Controls/MusicOrderViewer.Designer.cs
generated
Normal file
149
Controls/MusicOrderViewer.Designer.cs
generated
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
namespace TaikoSoundEditor.Controls
|
||||||
|
{
|
||||||
|
partial class MusicOrderViewer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Component Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
347
Controls/MusicOrderViewer.cs
Normal file
347
Controls/MusicOrderViewer.cs
Normal file
@ -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<SongCard> 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<SongCard> Selection = new();
|
||||||
|
public HashSet<SongCard> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Controls/MusicOrderViewer.resx
Normal file
60
Controls/MusicOrderViewer.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
30
Controls/SongCard.cs
Normal file
30
Controls/SongCard.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace TaikoSoundEditor.Data
|
namespace TaikoSoundEditor.Data
|
||||||
{
|
{
|
||||||
internal class WordList
|
public class WordList
|
||||||
{
|
{
|
||||||
[JsonPropertyName("items")]
|
[JsonPropertyName("items")]
|
||||||
public List<Word> Items { get; set; } = new List<Word>();
|
public List<Word> Items { get; set; } = new List<Word>();
|
||||||
|
7
Extensions/IntExtensions.cs
Normal file
7
Extensions/IntExtensions.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
16
MainForm.Designer.cs
generated
16
MainForm.Designer.cs
generated
@ -87,6 +87,7 @@
|
|||||||
this.WordsGB = new System.Windows.Forms.GroupBox();
|
this.WordsGB = new System.Windows.Forms.GroupBox();
|
||||||
this.WordsGrid = new System.Windows.Forms.PropertyGrid();
|
this.WordsGrid = new System.Windows.Forms.PropertyGrid();
|
||||||
this.MusicOrderTab = new System.Windows.Forms.TabPage();
|
this.MusicOrderTab = new System.Windows.Forms.TabPage();
|
||||||
|
this.MusicOrderViewer = new TaikoSoundEditor.Controls.MusicOrderViewer();
|
||||||
this.RemoveSongButton = new System.Windows.Forms.Button();
|
this.RemoveSongButton = new System.Windows.Forms.Button();
|
||||||
this.DatatableSpaces = new System.Windows.Forms.CheckBox();
|
this.DatatableSpaces = new System.Windows.Forms.CheckBox();
|
||||||
this.ExportOpenOnFinished = new System.Windows.Forms.CheckBox();
|
this.ExportOpenOnFinished = new System.Windows.Forms.CheckBox();
|
||||||
@ -143,6 +144,7 @@
|
|||||||
this.WordDetailGB.SuspendLayout();
|
this.WordDetailGB.SuspendLayout();
|
||||||
this.WordSubGB.SuspendLayout();
|
this.WordSubGB.SuspendLayout();
|
||||||
this.WordsGB.SuspendLayout();
|
this.WordsGB.SuspendLayout();
|
||||||
|
this.MusicOrderTab.SuspendLayout();
|
||||||
this.groupBox8.SuspendLayout();
|
this.groupBox8.SuspendLayout();
|
||||||
this.groupBox3.SuspendLayout();
|
this.groupBox3.SuspendLayout();
|
||||||
this.tabPage3.SuspendLayout();
|
this.tabPage3.SuspendLayout();
|
||||||
@ -789,6 +791,7 @@
|
|||||||
//
|
//
|
||||||
// MusicOrderTab
|
// MusicOrderTab
|
||||||
//
|
//
|
||||||
|
this.MusicOrderTab.Controls.Add(this.MusicOrderViewer);
|
||||||
this.MusicOrderTab.Location = new System.Drawing.Point(4, 24);
|
this.MusicOrderTab.Location = new System.Drawing.Point(4, 24);
|
||||||
this.MusicOrderTab.Name = "MusicOrderTab";
|
this.MusicOrderTab.Name = "MusicOrderTab";
|
||||||
this.MusicOrderTab.Padding = new System.Windows.Forms.Padding(3);
|
this.MusicOrderTab.Padding = new System.Windows.Forms.Padding(3);
|
||||||
@ -797,6 +800,17 @@
|
|||||||
this.MusicOrderTab.Text = "Music Order";
|
this.MusicOrderTab.Text = "Music Order";
|
||||||
this.MusicOrderTab.UseVisualStyleBackColor = true;
|
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
|
// RemoveSongButton
|
||||||
//
|
//
|
||||||
this.RemoveSongButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
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.WordDetailGB.ResumeLayout(false);
|
||||||
this.WordSubGB.ResumeLayout(false);
|
this.WordSubGB.ResumeLayout(false);
|
||||||
this.WordsGB.ResumeLayout(false);
|
this.WordsGB.ResumeLayout(false);
|
||||||
|
this.MusicOrderTab.ResumeLayout(false);
|
||||||
this.groupBox8.ResumeLayout(false);
|
this.groupBox8.ResumeLayout(false);
|
||||||
this.groupBox3.ResumeLayout(false);
|
this.groupBox3.ResumeLayout(false);
|
||||||
this.tabPage3.ResumeLayout(false);
|
this.tabPage3.ResumeLayout(false);
|
||||||
@ -1300,5 +1315,6 @@
|
|||||||
private Label label19;
|
private Label label19;
|
||||||
private NumericUpDown SimpleStarUraBox;
|
private NumericUpDown SimpleStarUraBox;
|
||||||
private Button LocateInMusicOrderButton;
|
private Button LocateInMusicOrderButton;
|
||||||
|
private Controls.MusicOrderViewer MusicOrderViewer;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -103,9 +103,18 @@ namespace TaikoSoundEditor
|
|||||||
Logger.Info($"Setting LoadedMusicBox DataSource");
|
Logger.Info($"Setting LoadedMusicBox DataSource");
|
||||||
|
|
||||||
LoadedMusicBinding = new BindingSource();
|
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;
|
LoadedMusicBox.DataSource = LoadedMusicBinding;
|
||||||
TabControl.SelectedIndex = 1;
|
TabControl.SelectedIndex = 1;
|
||||||
|
|
||||||
|
|
||||||
|
MusicOrderViewer.WordList = WordList;
|
||||||
|
foreach (var musicOrder in MusicOrders.Items)
|
||||||
|
{
|
||||||
|
MusicOrderViewer.AddSong(musicOrder);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -175,6 +175,11 @@ namespace TaikoSoundEditor
|
|||||||
|
|
||||||
private void SoundViewTab_SelectedIndexChanged(object sender, EventArgs e)
|
private void SoundViewTab_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if(SoundViewTab.SelectedTab==MusicOrderTab)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(SoundViewTab.SelectedTab == SoundViewerExpert || SoundViewTab.SelectedTab == SoundViewerSimple))
|
if (!(SoundViewTab.SelectedTab == SoundViewerExpert || SoundViewTab.SelectedTab == SoundViewerSimple))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -235,7 +240,6 @@ namespace TaikoSoundEditor
|
|||||||
item.MusicInfo.StarUra = (int)SimpleStarUraBox.Value;
|
item.MusicInfo.StarUra = (int)SimpleStarUraBox.Value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
40
Properties/Resources.Designer.cs
generated
40
Properties/Resources.Designer.cs
generated
@ -60,6 +60,46 @@ namespace TaikoSoundEditor.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ic_cut {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ic_cut", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ic_cut_gs {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ic_cut_gs", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ic_paste {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ic_paste", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ic_paste_gs {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ic_paste_gs", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// Looks up a localized resource of type System.Byte[].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -118,6 +118,18 @@
|
|||||||
<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>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="ic_cut" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\ic_cut.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="ic_cut_gs" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\ic_cut_gs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="ic_paste" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\ic_paste.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="ic_paste_gs" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\ic_paste_gs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="song_ABCDEF_nus3bank" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="song_ABCDEF_nus3bank" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\song_ABCDEF_nus3bank.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>..\Resources\song_ABCDEF_nus3bank.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -6,3 +6,4 @@ A simple tool to automatize the process of converting music to .nus3bank format
|
|||||||
|
|
||||||
- big shoutout to [Nabix](https://github.com/Nabixlol) for reaching me with the idea to create this tool, testing it and
|
- 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 :))
|
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/
|
BIN
Resources/ic_cut.png
Normal file
BIN
Resources/ic_cut.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
Resources/ic_cut_gs.png
Normal file
BIN
Resources/ic_cut_gs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
Resources/ic_paste.png
Normal file
BIN
Resources/ic_paste.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
Resources/ic_paste_gs.png
Normal file
BIN
Resources/ic_paste_gs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
21
Utils/Constants.cs
Normal file
21
Utils/Constants.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user