From ccb5f6e42859f13c8e66c181b0323e6e3463bcdf Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 6 Oct 2015 17:19:15 -0700 Subject: [PATCH] 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. --- SAV/SAV_PokedexORAS.Designer.cs | 12 ++++++++---- SAV/SAV_PokedexORAS.cs | 27 +++++++++++++++++++++++---- SAV/SAV_PokedexXY.Designer.cs | 12 ++++++++---- SAV/SAV_PokedexXY.cs | 27 +++++++++++++++++++++++---- 4 files changed, 62 insertions(+), 16 deletions(-) diff --git a/SAV/SAV_PokedexORAS.Designer.cs b/SAV/SAV_PokedexORAS.Designer.cs index 54a2ffc52..f36edd758 100644 --- a/SAV/SAV_PokedexORAS.Designer.cs +++ b/SAV/SAV_PokedexORAS.Designer.cs @@ -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 // diff --git a/SAV/SAV_PokedexORAS.cs b/SAV/SAV_PokedexORAS.cs index f9414a696..ded4f81e8 100644 --- a/SAV/SAV_PokedexORAS.cs +++ b/SAV/SAV_PokedexORAS.cs @@ -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; diff --git a/SAV/SAV_PokedexXY.Designer.cs b/SAV/SAV_PokedexXY.Designer.cs index 3e0197c4d..1302b646f 100644 --- a/SAV/SAV_PokedexXY.Designer.cs +++ b/SAV/SAV_PokedexXY.Designer.cs @@ -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 // diff --git a/SAV/SAV_PokedexXY.cs b/SAV/SAV_PokedexXY.cs index 8b68aa7c4..125ae74aa 100644 --- a/SAV/SAV_PokedexXY.cs +++ b/SAV/SAV_PokedexXY.cs @@ -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;