mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-14 15:55:14 -05:00
Improved search filters
Automatically ignore bad sanity/species Allow user to select Box&/Database as their search source.
This commit is contained in:
46
SAV/SAV_Database.Designer.cs
generated
46
SAV/SAV_Database.Designer.cs
generated
@@ -96,6 +96,7 @@ private void InitializeComponent()
|
||||
this.Menu_Tools = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_OpenDB = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_Report = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_Export = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.P_Results = new System.Windows.Forms.Panel();
|
||||
this.PAN_Box = new System.Windows.Forms.Panel();
|
||||
this.bpkx66 = new System.Windows.Forms.PictureBox();
|
||||
@@ -141,7 +142,9 @@ private void InitializeComponent()
|
||||
this.L_Generation = new System.Windows.Forms.Label();
|
||||
this.CB_Generation = new System.Windows.Forms.ComboBox();
|
||||
this.L_Viewed = new System.Windows.Forms.Label();
|
||||
this.Menu_Export = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.searchSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_SearchBoxes = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_SearchDatabase = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx30)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx29)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx28)).BeginInit();
|
||||
@@ -915,6 +918,7 @@ private void InitializeComponent()
|
||||
// Menu_Tools
|
||||
//
|
||||
this.Menu_Tools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.searchSettingsToolStripMenuItem,
|
||||
this.Menu_OpenDB,
|
||||
this.Menu_Report,
|
||||
this.Menu_Export});
|
||||
@@ -936,6 +940,13 @@ private void InitializeComponent()
|
||||
this.Menu_Report.Text = "Create Data Report";
|
||||
this.Menu_Report.Click += new System.EventHandler(this.generateDBReport);
|
||||
//
|
||||
// Menu_Export
|
||||
//
|
||||
this.Menu_Export.Name = "Menu_Export";
|
||||
this.Menu_Export.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_Export.Text = "Export Results to Folder";
|
||||
this.Menu_Export.Click += new System.EventHandler(this.Menu_Export_Click);
|
||||
//
|
||||
// P_Results
|
||||
//
|
||||
this.P_Results.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
@@ -1516,12 +1527,32 @@ private void InitializeComponent()
|
||||
this.L_Viewed.Text = "Last Viewed: {0}";
|
||||
this.L_Viewed.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// Menu_Export
|
||||
// searchSettingsToolStripMenuItem
|
||||
//
|
||||
this.Menu_Export.Name = "Menu_Export";
|
||||
this.Menu_Export.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_Export.Text = "Export Results to Folder";
|
||||
this.Menu_Export.Click += new System.EventHandler(this.Menu_Export_Click);
|
||||
this.searchSettingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.Menu_SearchBoxes,
|
||||
this.Menu_SearchDatabase});
|
||||
this.searchSettingsToolStripMenuItem.Name = "searchSettingsToolStripMenuItem";
|
||||
this.searchSettingsToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
|
||||
this.searchSettingsToolStripMenuItem.Text = "Search Settings";
|
||||
//
|
||||
// Menu_SearchBoxes
|
||||
//
|
||||
this.Menu_SearchBoxes.Checked = true;
|
||||
this.Menu_SearchBoxes.CheckOnClick = true;
|
||||
this.Menu_SearchBoxes.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.Menu_SearchBoxes.Name = "Menu_SearchBoxes";
|
||||
this.Menu_SearchBoxes.Size = new System.Drawing.Size(198, 22);
|
||||
this.Menu_SearchBoxes.Text = "Search Within Boxes";
|
||||
//
|
||||
// Menu_SearchDatabase
|
||||
//
|
||||
this.Menu_SearchDatabase.Checked = true;
|
||||
this.Menu_SearchDatabase.CheckOnClick = true;
|
||||
this.Menu_SearchDatabase.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.Menu_SearchDatabase.Name = "Menu_SearchDatabase";
|
||||
this.Menu_SearchDatabase.Size = new System.Drawing.Size(198, 22);
|
||||
this.Menu_SearchDatabase.Text = "Search Within Database";
|
||||
//
|
||||
// SAV_Database
|
||||
//
|
||||
@@ -1765,6 +1796,9 @@ private void InitializeComponent()
|
||||
private System.Windows.Forms.ComboBox CB_Generation;
|
||||
private System.Windows.Forms.Label L_Viewed;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_Export;
|
||||
private System.Windows.Forms.ToolStripMenuItem searchSettingsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_SearchBoxes;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_SearchDatabase;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -288,7 +288,7 @@ private void prepareDBForSearch()
|
||||
foreach (var db in Database)
|
||||
RawDB.AddRange(db.Slot);
|
||||
|
||||
RawDB = new List<PK6>(RawDB.Where(pk => pk.Checksum == pk.CalculateChecksum()));
|
||||
RawDB = new List<PK6>(RawDB.Where(pk => pk.Checksum == pk.CalculateChecksum() && pk.Species != 0 && pk.Sanity == 0));
|
||||
RawDB = new List<PK6>(RawDB.Distinct());
|
||||
setResults(RawDB);
|
||||
}
|
||||
@@ -428,11 +428,21 @@ private void B_Search_Click(object sender, EventArgs e)
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter for Selected Source
|
||||
if (!Menu_SearchBoxes.Checked)
|
||||
res = res.Where(pk => pk.Identifier.Contains("db\\"));
|
||||
if (!Menu_SearchDatabase.Checked)
|
||||
res = res.Where(pk => !pk.Identifier.Contains("db\\"));
|
||||
|
||||
slotSelected = -1; // reset the slot last viewed
|
||||
var results = res.ToArray();
|
||||
if (results.Length == 0)
|
||||
Util.Alert("No results found!");
|
||||
|
||||
{
|
||||
if (!Menu_SearchBoxes.Checked && !Menu_SearchDatabase.Checked)
|
||||
Util.Alert("No data source to search!", "No results found!");
|
||||
else
|
||||
Util.Alert("No results found!");
|
||||
}
|
||||
setResults(new List<PK6>(results)); // updates Count Label as well.
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user