mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Add better format filtering
This commit is contained in:
parent
5d25b919a4
commit
250fc15f14
2 changed files with 84 additions and 34 deletions
73
Subforms/SAV_Database.Designer.cs
generated
73
Subforms/SAV_Database.Designer.cs
generated
|
@ -149,9 +149,11 @@
|
|||
this.MT_ESV = new System.Windows.Forms.MaskedTextBox();
|
||||
this.CHK_Shiny = new System.Windows.Forms.CheckBox();
|
||||
this.TLP_Filters = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.FLP_Level = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.FLP_Format = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.CB_Format = new System.Windows.Forms.ComboBox();
|
||||
this.CB_FormatComparator = new System.Windows.Forms.ComboBox();
|
||||
this.L_Format = new System.Windows.Forms.Label();
|
||||
this.FLP_Level = new System.Windows.Forms.FlowLayoutPanel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx30)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx29)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx28)).BeginInit();
|
||||
|
@ -223,6 +225,7 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.bpkx61)).BeginInit();
|
||||
this.FLP_Egg.SuspendLayout();
|
||||
this.TLP_Filters.SuspendLayout();
|
||||
this.FLP_Format.SuspendLayout();
|
||||
this.FLP_Level.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -1661,6 +1664,7 @@
|
|||
this.TLP_Filters.ColumnCount = 2;
|
||||
this.TLP_Filters.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.TLP_Filters.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.TLP_Filters.Controls.Add(this.FLP_Format, 1, 15);
|
||||
this.TLP_Filters.Controls.Add(this.L_Format, 0, 15);
|
||||
this.TLP_Filters.Controls.Add(this.FLP_Egg, 1, 0);
|
||||
this.TLP_Filters.Controls.Add(this.CHK_Shiny, 0, 0);
|
||||
|
@ -1692,7 +1696,6 @@
|
|||
this.TLP_Filters.Controls.Add(this.CB_GameOrigin, 1, 13);
|
||||
this.TLP_Filters.Controls.Add(this.L_Generation, 0, 14);
|
||||
this.TLP_Filters.Controls.Add(this.CB_Generation, 1, 14);
|
||||
this.TLP_Filters.Controls.Add(this.CB_Format, 1, 15);
|
||||
this.TLP_Filters.Location = new System.Drawing.Point(304, 11);
|
||||
this.TLP_Filters.Name = "TLP_Filters";
|
||||
this.TLP_Filters.RowCount = 17;
|
||||
|
@ -1716,17 +1719,16 @@
|
|||
this.TLP_Filters.Size = new System.Drawing.Size(228, 354);
|
||||
this.TLP_Filters.TabIndex = 118;
|
||||
//
|
||||
// FLP_Level
|
||||
// FLP_Format
|
||||
//
|
||||
this.FLP_Level.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.FLP_Level.AutoSize = true;
|
||||
this.FLP_Level.Controls.Add(this.TB_Level);
|
||||
this.FLP_Level.Controls.Add(this.CB_Level);
|
||||
this.FLP_Level.Location = new System.Drawing.Point(83, 104);
|
||||
this.FLP_Level.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.FLP_Level.Name = "FLP_Level";
|
||||
this.FLP_Level.Size = new System.Drawing.Size(88, 21);
|
||||
this.FLP_Level.TabIndex = 119;
|
||||
this.FLP_Format.AutoSize = true;
|
||||
this.FLP_Format.Controls.Add(this.CB_FormatComparator);
|
||||
this.FLP_Format.Controls.Add(this.CB_Format);
|
||||
this.FLP_Format.Location = new System.Drawing.Point(83, 314);
|
||||
this.FLP_Format.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.FLP_Format.Name = "FLP_Format";
|
||||
this.FLP_Format.Size = new System.Drawing.Size(122, 21);
|
||||
this.FLP_Format.TabIndex = 124;
|
||||
//
|
||||
// CB_Format
|
||||
//
|
||||
|
@ -1735,15 +1737,33 @@
|
|||
this.CB_Format.FormattingEnabled = true;
|
||||
this.CB_Format.Items.AddRange(new object[] {
|
||||
"Any",
|
||||
">=pk6",
|
||||
">=pk5",
|
||||
">=pk4",
|
||||
">=pk3"});
|
||||
this.CB_Format.Location = new System.Drawing.Point(83, 314);
|
||||
".pk6",
|
||||
".pk5",
|
||||
".pk4",
|
||||
".pk3"});
|
||||
this.CB_Format.Location = new System.Drawing.Point(54, 0);
|
||||
this.CB_Format.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.CB_Format.Name = "CB_Format";
|
||||
this.CB_Format.Size = new System.Drawing.Size(122, 21);
|
||||
this.CB_Format.Size = new System.Drawing.Size(68, 21);
|
||||
this.CB_Format.TabIndex = 121;
|
||||
this.CB_Format.Visible = false;
|
||||
//
|
||||
// CB_FormatComparator
|
||||
//
|
||||
this.CB_FormatComparator.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.CB_FormatComparator.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_FormatComparator.FormattingEnabled = true;
|
||||
this.CB_FormatComparator.Items.AddRange(new object[] {
|
||||
"Any",
|
||||
">=",
|
||||
"==",
|
||||
"<="});
|
||||
this.CB_FormatComparator.Location = new System.Drawing.Point(0, 0);
|
||||
this.CB_FormatComparator.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.CB_FormatComparator.Name = "CB_FormatComparator";
|
||||
this.CB_FormatComparator.Size = new System.Drawing.Size(54, 21);
|
||||
this.CB_FormatComparator.TabIndex = 122;
|
||||
this.CB_FormatComparator.SelectedIndexChanged += new System.EventHandler(this.changeFormatFilter);
|
||||
//
|
||||
// L_Format
|
||||
//
|
||||
|
@ -1757,6 +1777,18 @@
|
|||
this.L_Format.Text = "Format:";
|
||||
this.L_Format.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// FLP_Level
|
||||
//
|
||||
this.FLP_Level.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.FLP_Level.AutoSize = true;
|
||||
this.FLP_Level.Controls.Add(this.TB_Level);
|
||||
this.FLP_Level.Controls.Add(this.CB_Level);
|
||||
this.FLP_Level.Location = new System.Drawing.Point(83, 104);
|
||||
this.FLP_Level.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.FLP_Level.Name = "FLP_Level";
|
||||
this.FLP_Level.Size = new System.Drawing.Size(88, 21);
|
||||
this.FLP_Level.TabIndex = 119;
|
||||
//
|
||||
// SAV_Database
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -1852,6 +1884,7 @@
|
|||
this.FLP_Egg.PerformLayout();
|
||||
this.TLP_Filters.ResumeLayout(false);
|
||||
this.TLP_Filters.PerformLayout();
|
||||
this.FLP_Format.ResumeLayout(false);
|
||||
this.FLP_Level.ResumeLayout(false);
|
||||
this.FLP_Level.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
@ -1982,7 +2015,9 @@
|
|||
public System.Windows.Forms.CheckBox CHK_IsEgg;
|
||||
private System.Windows.Forms.FlowLayoutPanel FLP_Egg;
|
||||
private System.Windows.Forms.FlowLayoutPanel FLP_Level;
|
||||
private System.Windows.Forms.ComboBox CB_Format;
|
||||
private System.Windows.Forms.Label L_Format;
|
||||
private System.Windows.Forms.FlowLayoutPanel FLP_Format;
|
||||
private System.Windows.Forms.ComboBox CB_FormatComparator;
|
||||
private System.Windows.Forms.ComboBox CB_Format;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,10 @@ namespace PKHeX
|
|||
{
|
||||
m_parent = f1;
|
||||
InitializeComponent();
|
||||
CB_Format.SelectedIndex = MAXFORMAT - Main.SAV.Generation + 1;
|
||||
|
||||
// Preset Filters to only show PKM available for loaded save
|
||||
CB_FormatComparator.SelectedIndex = 3; // <=
|
||||
|
||||
PKXBOXES = new[]
|
||||
{
|
||||
bpkx1, bpkx2, bpkx3, bpkx4, bpkx5, bpkx6,
|
||||
|
@ -426,23 +429,21 @@ namespace PKHeX
|
|||
IEnumerable<PKM> res = RawDB;
|
||||
|
||||
int format = MAXFORMAT + 1 - CB_Format.SelectedIndex;
|
||||
res = res.Where(pk => pk.Format <= format);
|
||||
switch (CB_FormatComparator.SelectedIndex)
|
||||
{
|
||||
case 0: /* Do nothing */ break;
|
||||
case 1: res = res.Where(pk => pk.Format >= format); break;
|
||||
case 2: res = res.Where(pk => pk.Format == format); break;
|
||||
case 3: res = res.Where(pk => pk.Format <= format); break;
|
||||
}
|
||||
|
||||
switch (CB_Generation.SelectedIndex)
|
||||
{
|
||||
case 0: break; // Do nothing
|
||||
case 1: // Gen 6
|
||||
res = res.Where(pk => pk.Gen6);
|
||||
break;
|
||||
case 2: // Gen 5
|
||||
res = res.Where(pk => pk.Gen5);
|
||||
break;
|
||||
case 3: // Gen 4
|
||||
res = res.Where(pk => pk.Gen4);
|
||||
break;
|
||||
case 4: // Gen 3
|
||||
res = res.Where(pk => pk.Gen3);
|
||||
break;
|
||||
case 0: /* Do nothing */ break;
|
||||
case 1: res = res.Where(pk => pk.Gen6); break;
|
||||
case 2: res = res.Where(pk => pk.Gen5); break;
|
||||
case 3: res = res.Where(pk => pk.Gen4); break;
|
||||
case 4: res = res.Where(pk => pk.Gen3); break;
|
||||
}
|
||||
|
||||
// Primary Searchables
|
||||
|
@ -652,5 +653,19 @@ namespace PKHeX
|
|||
if (newval >= SCR_Box.Minimum && SCR_Box.Maximum >= newval)
|
||||
FillPKXBoxes(SCR_Box.Value = newval);
|
||||
}
|
||||
|
||||
private void changeFormatFilter(object sender, EventArgs e)
|
||||
{
|
||||
if (CB_FormatComparator.SelectedIndex == 0)
|
||||
{
|
||||
CB_Format.Visible = false; // !any
|
||||
CB_Format.SelectedIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
CB_Format.Visible = true;
|
||||
CB_Format.SelectedIndex = MAXFORMAT - Main.SAV.Generation + 1; // SAV generation (offset by 1 for "Any")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue