diff --git a/Controls/MusicOrderViewer.Designer.cs b/Controls/MusicOrderViewer.Designer.cs index ec89d85..54fe66d 100644 --- a/Controls/MusicOrderViewer.Designer.cs +++ b/Controls/MusicOrderViewer.Designer.cs @@ -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); diff --git a/Controls/MusicOrderViewer.cs b/Controls/MusicOrderViewer.cs index f23c075..6ded815 100644 --- a/Controls/MusicOrderViewer.cs +++ b/Controls/MusicOrderViewer.cs @@ -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); + } } } diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index a7ffe89..d819714 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -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 // diff --git a/MainForm.cs b/MainForm.cs index 23ca604..b505269 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -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().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; + } + + } } } \ No newline at end of file diff --git a/Properties/PublishProfiles/FolderProfile.pubxml.user b/Properties/PublishProfiles/FolderProfile.pubxml.user index f6cdb7d..3285e56 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-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; + 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; \ No newline at end of file