1
0
mirror of synced 2024-11-23 20:10:57 +01:00

double click in music order redirects to simple view of the song

This commit is contained in:
NotImplementedLife 2023-07-31 19:45:26 +03:00
parent 129454ff78
commit 0debcbf8c9
5 changed files with 49 additions and 3 deletions

View File

@ -51,6 +51,7 @@
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.DoubleClick += new System.EventHandler(this.MusicOrdersPanel_DoubleClick);
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);

View File

@ -15,7 +15,7 @@ namespace TaikoSoundEditor.Controls
typeof(Control).GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
.SetValue(MusicOrdersPanel, true);
.SetValue(MusicOrdersPanel, true);
}
internal WordList WordList { get; set; }
@ -446,7 +446,10 @@ namespace TaikoSoundEditor.Controls
CutActive = RemoveActive = true;
MusicOrdersPanel.Invalidate();
}
}
public delegate void OnSongDoubleClick(MusicOrderViewer sender, MusicOrder mo);
public event OnSongDoubleClick SongDoubleClick;
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
@ -469,5 +472,28 @@ namespace TaikoSoundEditor.Controls
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void MusicOrdersPanel_DoubleClick(object sender, EventArgs e)
{
var cursor = MusicOrdersPanel.PointToClient(Cursor.Position);
int itemW = MusicOrdersPanel.Width / ItemsPerRow;
int itemH = MusicOrdersPanel.Height / ItemsPerCol;
int row = cursor.Y / itemH;
int col = cursor.X / itemW;
//MessageBox.Show($"{row} {col}");
if (row < 0 || row >= ItemsPerCol || col < 0 || col >= ItemsPerRow)
return;
var index = CurrentPage * ItemsPerPage + row * ItemsPerRow + col;
//MessageBox.Show($"{index}");
if (index < 0 || index > SongCards.Count) return;
SongDoubleClick?.Invoke(this, SongCards[index].MusicOrder);
}
}
}

1
MainForm.Designer.cs generated
View File

@ -816,6 +816,7 @@
this.MusicOrderViewer.Size = new System.Drawing.Size(515, 290);
this.MusicOrderViewer.TabIndex = 0;
this.MusicOrderViewer.SongRemoved += new TaikoSoundEditor.Controls.MusicOrderViewer.OnSongRemoved(this.MusicOrderViewer_SongRemoved);
this.MusicOrderViewer.SongDoubleClick += new TaikoSoundEditor.Controls.MusicOrderViewer.OnSongDoubleClick(this.MusicOrderViewer_SongDoubleClick);
//
// RemoveSongButton
//

View File

@ -308,5 +308,23 @@ namespace TaikoSoundEditor
return;
}
});
private void MusicOrderViewer_SongDoubleClick(Controls.MusicOrderViewer sender, MusicOrder mo)
{
var uid = mo.UniqueId;
var mi = LoadedMusicBox.Items.Cast<MusicInfo>().Where(_ => _.UniqueId == uid).FirstOrDefault();
if(mi!=null)
{
LoadedMusicBox.SelectedItem = mi;
return;
}
var ns = AddedMusic.Where(_ => _.UniqueId == uid).FirstOrDefault();
if (ns != null)
{
NewSoundsBox.SelectedItem = ns;
return;
}
}
}
}

View File

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2023-07-30T06:20:22.7718733Z;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-30T06:51:53.3737837Z;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 />
</PropertyGroup>
</Project>