Add more flag setting logic

Checks the opposing checkbox when set.

Of course one could take this further but it should be left up to the
user for insane tweaks.
This commit is contained in:
Kurt
2015-10-06 17:19:15 -07:00
parent f0faf76fc6
commit ccb5f6e428
4 changed files with 62 additions and 16 deletions

View File

@@ -104,7 +104,7 @@ private void InitializeComponent()
this.CHK_P6.TabIndex = 8;
this.CHK_P6.Text = "Male";
this.CHK_P6.UseVisualStyleBackColor = true;
this.CHK_P6.Click += new System.EventHandler(this.changePartitionBool);
this.CHK_P6.Click += new System.EventHandler(this.changeDisplayed);
//
// CHK_P7
//
@@ -115,7 +115,7 @@ private void InitializeComponent()
this.CHK_P7.TabIndex = 9;
this.CHK_P7.Text = "Female";
this.CHK_P7.UseVisualStyleBackColor = true;
this.CHK_P7.Click += new System.EventHandler(this.changePartitionBool);
this.CHK_P7.Click += new System.EventHandler(this.changeDisplayed);
//
// CHK_P8
//
@@ -126,7 +126,7 @@ private void InitializeComponent()
this.CHK_P8.TabIndex = 10;
this.CHK_P8.Text = "Shiny Male";
this.CHK_P8.UseVisualStyleBackColor = true;
this.CHK_P8.Click += new System.EventHandler(this.changePartitionBool);
this.CHK_P8.Click += new System.EventHandler(this.changeDisplayed);
//
// CHK_P9
//
@@ -137,7 +137,7 @@ private void InitializeComponent()
this.CHK_P9.TabIndex = 11;
this.CHK_P9.Text = "Shiny Female";
this.CHK_P9.UseVisualStyleBackColor = true;
this.CHK_P9.Click += new System.EventHandler(this.changePartitionBool);
this.CHK_P9.Click += new System.EventHandler(this.changeDisplayed);
//
// CHK_L7
//
@@ -362,6 +362,7 @@ private void InitializeComponent()
this.CHK_P5.TabIndex = 7;
this.CHK_P5.Text = "Shiny Female";
this.CHK_P5.UseVisualStyleBackColor = true;
this.CHK_P5.Click += new System.EventHandler(this.changeEncountered);
//
// CHK_P4
//
@@ -372,6 +373,7 @@ private void InitializeComponent()
this.CHK_P4.TabIndex = 6;
this.CHK_P4.Text = "Shiny Male";
this.CHK_P4.UseVisualStyleBackColor = true;
this.CHK_P4.Click += new System.EventHandler(this.changeEncountered);
//
// CHK_P3
//
@@ -382,6 +384,7 @@ private void InitializeComponent()
this.CHK_P3.TabIndex = 5;
this.CHK_P3.Text = "Female";
this.CHK_P3.UseVisualStyleBackColor = true;
this.CHK_P3.Click += new System.EventHandler(this.changeEncountered);
//
// CHK_P2
//
@@ -392,6 +395,7 @@ private void InitializeComponent()
this.CHK_P2.TabIndex = 4;
this.CHK_P2.Text = "Male";
this.CHK_P2.UseVisualStyleBackColor = true;
this.CHK_P2.Click += new System.EventHandler(this.changeEncountered);
//
// SAV_PokedexORAS
//

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections;
using System.Linq;
using System.Windows.Forms;
namespace PKHeX
@@ -106,7 +105,7 @@ private void removedropCB(object sender, KeyEventArgs e)
{
((ComboBox)sender).DroppedDown = false;
}
private void changePartitionBool(object sender, EventArgs e)
private void changeDisplayed(object sender, EventArgs e)
{
if (!(sender as CheckBox).Checked)
return;
@@ -115,6 +114,27 @@ private void changePartitionBool(object sender, EventArgs e)
CHK_P7.Checked = (sender as CheckBox == CHK_P7);
CHK_P8.Checked = (sender as CheckBox == CHK_P8);
CHK_P9.Checked = (sender as CheckBox == CHK_P9);
if (CHK_P6.Checked) CHK_P2.Checked = true;
if (CHK_P7.Checked) CHK_P3.Checked = true;
if (CHK_P8.Checked) CHK_P4.Checked = true;
if (CHK_P9.Checked) CHK_P5.Checked = true;
}
private void changeEncountered(object sender, EventArgs e)
{
if (!(CHK_P2.Checked || CHK_P3.Checked || CHK_P4.Checked || CHK_P5.Checked))
CHK_P6.Checked = CHK_P7.Checked = CHK_P8.Checked = CHK_P9.Checked = false;
else if (!(CHK_P6.Checked || CHK_P7.Checked || CHK_P8.Checked || CHK_P9.Checked))
{
if (sender as CheckBox == CHK_P2 && CHK_P2.Checked)
CHK_P6.Checked = true;
else if (sender as CheckBox == CHK_P3 && CHK_P3.Checked)
CHK_P7.Checked = true;
else if (sender as CheckBox == CHK_P4 && CHK_P4.Checked)
CHK_P8.Checked = true;
else if (sender as CheckBox == CHK_P5 && CHK_P5.Checked)
CHK_P9.Checked = true;
}
}
private int species = -1;
@@ -238,11 +258,10 @@ private void B_GiveAll_Click(object sender, EventArgs e)
CHK_P2.Checked = CHK_P4.Checked = (gt != 254) && ModifierKeys != Keys.Control;
CHK_P3.Checked = CHK_P5.Checked = (gt != 0) && (gt != 255) && ModifierKeys != Keys.Control;
bool[] disp = {CHK_P6.Checked, CHK_P7.Checked, CHK_P8.Checked, CHK_P9.Checked};
if (ModifierKeys == Keys.Control)
foreach (var chk in new[]{CHK_P6, CHK_P7, CHK_P8, CHK_P9})
chk.Checked = false;
else if (!disp.Contains(true))
else if (!(CHK_P6.Checked || CHK_P7.Checked || CHK_P8.Checked || CHK_P9.Checked))
{
if (gt != 254)
CHK_P6.Checked = true;

View File

@@ -103,6 +103,7 @@ private void InitializeComponent()
this.CHK_P2.TabIndex = 4;
this.CHK_P2.Text = "Male";
this.CHK_P2.UseVisualStyleBackColor = true;
this.CHK_P2.Click += new System.EventHandler(this.changeEncountered);
//
// CHK_P3
//
@@ -113,6 +114,7 @@ private void InitializeComponent()
this.CHK_P3.TabIndex = 5;
this.CHK_P3.Text = "Female";
this.CHK_P3.UseVisualStyleBackColor = true;
this.CHK_P3.Click += new System.EventHandler(this.changeEncountered);
//
// CHK_P4
//
@@ -123,6 +125,7 @@ private void InitializeComponent()
this.CHK_P4.TabIndex = 6;
this.CHK_P4.Text = "Shiny Male";
this.CHK_P4.UseVisualStyleBackColor = true;
this.CHK_P4.Click += new System.EventHandler(this.changeEncountered);
//
// CHK_P5
//
@@ -133,6 +136,7 @@ private void InitializeComponent()
this.CHK_P5.TabIndex = 7;
this.CHK_P5.Text = "Shiny Female";
this.CHK_P5.UseVisualStyleBackColor = true;
this.CHK_P5.Click += new System.EventHandler(this.changeEncountered);
//
// CHK_P6
//
@@ -143,7 +147,7 @@ private void InitializeComponent()
this.CHK_P6.TabIndex = 8;
this.CHK_P6.Text = "Male";
this.CHK_P6.UseVisualStyleBackColor = true;
this.CHK_P6.Click += new System.EventHandler(this.changePartitionBool);
this.CHK_P6.Click += new System.EventHandler(this.changeDisplayed);
//
// CHK_P7
//
@@ -154,7 +158,7 @@ private void InitializeComponent()
this.CHK_P7.TabIndex = 9;
this.CHK_P7.Text = "Female";
this.CHK_P7.UseVisualStyleBackColor = true;
this.CHK_P7.Click += new System.EventHandler(this.changePartitionBool);
this.CHK_P7.Click += new System.EventHandler(this.changeDisplayed);
//
// CHK_P8
//
@@ -165,7 +169,7 @@ private void InitializeComponent()
this.CHK_P8.TabIndex = 10;
this.CHK_P8.Text = "Shiny Male";
this.CHK_P8.UseVisualStyleBackColor = true;
this.CHK_P8.Click += new System.EventHandler(this.changePartitionBool);
this.CHK_P8.Click += new System.EventHandler(this.changeDisplayed);
//
// CHK_P9
//
@@ -176,7 +180,7 @@ private void InitializeComponent()
this.CHK_P9.TabIndex = 11;
this.CHK_P9.Text = "Shiny Female";
this.CHK_P9.UseVisualStyleBackColor = true;
this.CHK_P9.Click += new System.EventHandler(this.changePartitionBool);
this.CHK_P9.Click += new System.EventHandler(this.changeDisplayed);
//
// CHK_L7
//

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections;
using System.Linq;
using System.Windows.Forms;
namespace PKHeX
@@ -115,7 +114,7 @@ private void removedropCB(object sender, KeyEventArgs e)
{
((ComboBox)sender).DroppedDown = false;
}
private void changePartitionBool(object sender, EventArgs e)
private void changeDisplayed(object sender, EventArgs e)
{
if (!(sender as CheckBox).Checked)
return;
@@ -124,6 +123,27 @@ private void changePartitionBool(object sender, EventArgs e)
CHK_P7.Checked = (sender as CheckBox == CHK_P7);
CHK_P8.Checked = (sender as CheckBox == CHK_P8);
CHK_P9.Checked = (sender as CheckBox == CHK_P9);
if (CHK_P6.Checked) CHK_P2.Checked = true;
if (CHK_P7.Checked) CHK_P3.Checked = true;
if (CHK_P8.Checked) CHK_P4.Checked = true;
if (CHK_P9.Checked) CHK_P5.Checked = true;
}
private void changeEncountered(object sender, EventArgs e)
{
if (!(CHK_P2.Checked || CHK_P3.Checked || CHK_P4.Checked || CHK_P5.Checked))
CHK_P6.Checked = CHK_P7.Checked = CHK_P8.Checked = CHK_P9.Checked = false;
else if (!(CHK_P6.Checked || CHK_P7.Checked || CHK_P8.Checked || CHK_P9.Checked))
{
if (sender as CheckBox == CHK_P2 && CHK_P2.Checked)
CHK_P6.Checked = true;
else if (sender as CheckBox == CHK_P3 && CHK_P3.Checked)
CHK_P7.Checked = true;
else if (sender as CheckBox == CHK_P4 && CHK_P4.Checked)
CHK_P8.Checked = true;
else if (sender as CheckBox == CHK_P5 && CHK_P5.Checked)
CHK_P9.Checked = true;
}
}
private int species = -1;
@@ -270,11 +290,10 @@ private void B_GiveAll_Click(object sender, EventArgs e)
CHK_P2.Checked = CHK_P4.Checked = (gt != 254) && ModifierKeys != Keys.Control;
CHK_P3.Checked = CHK_P5.Checked = (gt != 0) && (gt != 255) && ModifierKeys != Keys.Control;
bool[] disp = { CHK_P6.Checked, CHK_P7.Checked, CHK_P8.Checked, CHK_P9.Checked };
if (ModifierKeys == Keys.Control)
foreach (var chk in new[] { CHK_P6, CHK_P7, CHK_P8, CHK_P9 })
chk.Checked = false;
else if (!disp.Contains(true))
else if (!(CHK_P6.Checked || CHK_P7.Checked || CHK_P8.Checked || CHK_P9.Checked))
{
if (gt != 254)
CHK_P6.Checked = true;