1
0
mirror of synced 2024-11-13 16:40:46 +01:00

added search bar for loaded songs

This commit is contained in:
NotImplementedLife 2023-07-31 20:17:21 +03:00
parent 427de0a4e1
commit b1617bf7ad
8 changed files with 85 additions and 12 deletions

37
MainForm.Designer.cs generated
View File

@ -119,6 +119,8 @@
this.TJASelector = new TaikoSoundEditor.PathSelector();
this.AudioFileSelector = new TaikoSoundEditor.PathSelector();
this.label10 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.SearchBox = new System.Windows.Forms.TextBox();
this.TabControl.SuspendLayout();
this.tabPage1.SuspendLayout();
this.panel1.SuspendLayout();
@ -152,6 +154,7 @@
this.groupBox10.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SilenceBox)).BeginInit();
this.groupBox9.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// TabControl
@ -931,6 +934,8 @@
//
// groupBox3
//
this.groupBox3.Controls.Add(this.SearchBox);
this.groupBox3.Controls.Add(this.pictureBox1);
this.groupBox3.Controls.Add(this.LoadedMusicBox);
this.groupBox3.Location = new System.Drawing.Point(8, 6);
this.groupBox3.Name = "groupBox3";
@ -941,12 +946,14 @@
//
// LoadedMusicBox
//
this.LoadedMusicBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.LoadedMusicBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.LoadedMusicBox.FormattingEnabled = true;
this.LoadedMusicBox.ItemHeight = 15;
this.LoadedMusicBox.Location = new System.Drawing.Point(3, 19);
this.LoadedMusicBox.Location = new System.Drawing.Point(3, 49);
this.LoadedMusicBox.Name = "LoadedMusicBox";
this.LoadedMusicBox.Size = new System.Drawing.Size(119, 181);
this.LoadedMusicBox.Size = new System.Drawing.Size(119, 139);
this.LoadedMusicBox.TabIndex = 1;
this.LoadedMusicBox.SelectedIndexChanged += new System.EventHandler(this.LoadedMusicBox_SelectedIndexChanged);
//
@ -1176,6 +1183,26 @@
this.label10.TabIndex = 8;
this.label10.Text = "Audio file";
//
// pictureBox1
//
this.pictureBox1.Image = global::TaikoSoundEditor.Properties.Resources.ic_search;
this.pictureBox1.Location = new System.Drawing.Point(3, 22);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(20, 20);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 2;
this.pictureBox1.TabStop = false;
//
// SearchBox
//
this.SearchBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.SearchBox.Location = new System.Drawing.Point(29, 20);
this.SearchBox.Name = "SearchBox";
this.SearchBox.Size = new System.Drawing.Size(90, 23);
this.SearchBox.TabIndex = 3;
this.SearchBox.TextChanged += new System.EventHandler(this.SearchBox_TextChanged);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@ -1219,6 +1246,7 @@
this.MusicOrderTab.ResumeLayout(false);
this.groupBox8.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.groupBox10.ResumeLayout(false);
@ -1226,6 +1254,7 @@
((System.ComponentModel.ISupportInitialize)(this.SilenceBox)).EndInit();
this.groupBox9.ResumeLayout(false);
this.groupBox9.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
@ -1323,5 +1352,7 @@
private NumericUpDown SimpleStarUraBox;
private Button LocateInMusicOrderButton;
private Controls.MusicOrderViewer MusicOrderViewer;
private TextBox SearchBox;
private PictureBox pictureBox1;
}
}

View File

@ -161,8 +161,7 @@ namespace TaikoSoundEditor
WordList.Items.Remove(wd);
Logger.Info("Refreshing list");
LoadedMusicBinding.DataSource = MusicInfos.Items.Where(mi => mi.UniqueId != 0).ToList();
LoadedMusicBinding.ResetBindings(false);
RefreshExistingSongsListView();
var sel = LoadedMusicBox.SelectedIndex;
@ -326,5 +325,30 @@ namespace TaikoSoundEditor
}
}
private void SearchBox_TextChanged(object sender, EventArgs e)
{
RefreshExistingSongsListView();
}
private void RefreshExistingSongsListView()
{
var list = MusicInfos.Items.Where(mi => mi.UniqueId != 0)
.Where(mi =>
{
if (string.IsNullOrEmpty(SearchBox.Text))
return true;
if (int.TryParse(SearchBox.Text, out int uid) && mi.UniqueId == uid)
{
return true;
}
return mi.Id.Contains(SearchBox.Text)
|| WordList.GetBySong(mi.Id).JapaneseText.Contains(SearchBox.Text)
|| WordList.GetBySongSub(mi.Id).JapaneseText.Contains(SearchBox.Text);
})
.ToList();
LoadedMusicBox.DataSource = list;
LoadedMusicBinding.ResetBindings(false);
}
}
}

View File

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<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>
<History>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;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

View File

@ -160,6 +160,16 @@ namespace TaikoSoundEditor.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ic_search {
get {
object obj = ResourceManager.GetObject("ic_search", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>

View File

@ -148,6 +148,9 @@
<data name="ic_right_10" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ic_right_10.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ic_search" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ic_search.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">
<value>..\Resources\song_ABCDEF_nus3bank.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>

BIN
Resources/ic_search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -161,6 +161,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Tools\tja2fumen-old2.exe">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Update="Tools\tja2fumen.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Tools\VGAudio\idsp\empty.txt">

View File

@ -16,14 +16,16 @@ namespace TaikoSoundEditor.Utils
}
catch (Exception ex)
{
Error(ex);
}
}
#if DEBUG
Logger.Error(ex);
if (MessageBox.Show(ex.Message + "\n\nThrow?", "An error occured", MessageBoxButtons.YesNo) == DialogResult.Yes)
throw;
#else
public static void Error(Exception e)
{
MessageBox.Show(e.Message, "An error occured");
Logger.Error(e);
}
#endif
}
}
}
}