diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.Designer.cs index 75fa42427..a73680009 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.Designer.cs @@ -68,6 +68,7 @@ private void InitializeComponent() this.mnuFormNone = new System.Windows.Forms.ToolStripMenuItem(); this.mnuForm1 = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFormAll = new System.Windows.Forms.ToolStripMenuItem(); + this.LB_Forms = new System.Windows.Forms.ListBox(); this.GB_Language.SuspendLayout(); this.GB_Encountered.SuspendLayout(); this.GB_Owned.SuspendLayout(); @@ -78,9 +79,9 @@ private void InitializeComponent() // B_Cancel // this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(214, 242); + this.B_Cancel.Location = new System.Drawing.Point(244, 241); this.B_Cancel.Name = "B_Cancel"; - this.B_Cancel.Size = new System.Drawing.Size(80, 23); + this.B_Cancel.Size = new System.Drawing.Size(80, 21); this.B_Cancel.TabIndex = 0; this.B_Cancel.Text = "Cancel"; this.B_Cancel.UseVisualStyleBackColor = true; @@ -89,18 +90,19 @@ private void InitializeComponent() // LB_Species // this.LB_Species.FormattingEnabled = true; - this.LB_Species.Location = new System.Drawing.Point(12, 40); + this.LB_Species.ItemHeight = 12; + this.LB_Species.Location = new System.Drawing.Point(12, 37); this.LB_Species.Name = "LB_Species"; - this.LB_Species.Size = new System.Drawing.Size(130, 225); + this.LB_Species.Size = new System.Drawing.Size(160, 160); this.LB_Species.TabIndex = 2; this.LB_Species.SelectedIndexChanged += new System.EventHandler(this.changeLBSpecies); // // CHK_P1 // this.CHK_P1.AutoSize = true; - this.CHK_P1.Location = new System.Drawing.Point(6, 15); + this.CHK_P1.Location = new System.Drawing.Point(18, 14); this.CHK_P1.Name = "CHK_P1"; - this.CHK_P1.Size = new System.Drawing.Size(60, 17); + this.CHK_P1.Size = new System.Drawing.Size(58, 16); this.CHK_P1.TabIndex = 3; this.CHK_P1.Text = "Owned"; this.CHK_P1.UseVisualStyleBackColor = true; @@ -108,9 +110,9 @@ private void InitializeComponent() // CHK_P2 // this.CHK_P2.AutoSize = true; - this.CHK_P2.Location = new System.Drawing.Point(6, 15); + this.CHK_P2.Location = new System.Drawing.Point(6, 23); this.CHK_P2.Name = "CHK_P2"; - this.CHK_P2.Size = new System.Drawing.Size(49, 17); + this.CHK_P2.Size = new System.Drawing.Size(48, 16); this.CHK_P2.TabIndex = 4; this.CHK_P2.Text = "Male"; this.CHK_P2.UseVisualStyleBackColor = true; @@ -119,9 +121,9 @@ private void InitializeComponent() // CHK_P3 // this.CHK_P3.AutoSize = true; - this.CHK_P3.Location = new System.Drawing.Point(6, 29); + this.CHK_P3.Location = new System.Drawing.Point(6, 39); this.CHK_P3.Name = "CHK_P3"; - this.CHK_P3.Size = new System.Drawing.Size(60, 17); + this.CHK_P3.Size = new System.Drawing.Size(61, 16); this.CHK_P3.TabIndex = 5; this.CHK_P3.Text = "Female"; this.CHK_P3.UseVisualStyleBackColor = true; @@ -130,9 +132,9 @@ private void InitializeComponent() // CHK_P4 // this.CHK_P4.AutoSize = true; - this.CHK_P4.Location = new System.Drawing.Point(6, 43); + this.CHK_P4.Location = new System.Drawing.Point(6, 55); this.CHK_P4.Name = "CHK_P4"; - this.CHK_P4.Size = new System.Drawing.Size(78, 17); + this.CHK_P4.Size = new System.Drawing.Size(80, 16); this.CHK_P4.TabIndex = 6; this.CHK_P4.Text = "Shiny Male"; this.CHK_P4.UseVisualStyleBackColor = true; @@ -141,9 +143,9 @@ private void InitializeComponent() // CHK_P5 // this.CHK_P5.AutoSize = true; - this.CHK_P5.Location = new System.Drawing.Point(6, 57); + this.CHK_P5.Location = new System.Drawing.Point(6, 71); this.CHK_P5.Name = "CHK_P5"; - this.CHK_P5.Size = new System.Drawing.Size(89, 17); + this.CHK_P5.Size = new System.Drawing.Size(93, 16); this.CHK_P5.TabIndex = 7; this.CHK_P5.Text = "Shiny Female"; this.CHK_P5.UseVisualStyleBackColor = true; @@ -152,9 +154,9 @@ private void InitializeComponent() // CHK_P6 // this.CHK_P6.AutoSize = true; - this.CHK_P6.Location = new System.Drawing.Point(5, 14); + this.CHK_P6.Location = new System.Drawing.Point(6, 23); this.CHK_P6.Name = "CHK_P6"; - this.CHK_P6.Size = new System.Drawing.Size(49, 17); + this.CHK_P6.Size = new System.Drawing.Size(48, 16); this.CHK_P6.TabIndex = 8; this.CHK_P6.Text = "Male"; this.CHK_P6.UseVisualStyleBackColor = true; @@ -163,9 +165,9 @@ private void InitializeComponent() // CHK_P7 // this.CHK_P7.AutoSize = true; - this.CHK_P7.Location = new System.Drawing.Point(5, 28); + this.CHK_P7.Location = new System.Drawing.Point(6, 39); this.CHK_P7.Name = "CHK_P7"; - this.CHK_P7.Size = new System.Drawing.Size(60, 17); + this.CHK_P7.Size = new System.Drawing.Size(61, 16); this.CHK_P7.TabIndex = 9; this.CHK_P7.Text = "Female"; this.CHK_P7.UseVisualStyleBackColor = true; @@ -174,9 +176,9 @@ private void InitializeComponent() // CHK_P8 // this.CHK_P8.AutoSize = true; - this.CHK_P8.Location = new System.Drawing.Point(5, 42); + this.CHK_P8.Location = new System.Drawing.Point(6, 55); this.CHK_P8.Name = "CHK_P8"; - this.CHK_P8.Size = new System.Drawing.Size(78, 17); + this.CHK_P8.Size = new System.Drawing.Size(80, 16); this.CHK_P8.TabIndex = 10; this.CHK_P8.Text = "Shiny Male"; this.CHK_P8.UseVisualStyleBackColor = true; @@ -185,9 +187,9 @@ private void InitializeComponent() // CHK_P9 // this.CHK_P9.AutoSize = true; - this.CHK_P9.Location = new System.Drawing.Point(5, 56); + this.CHK_P9.Location = new System.Drawing.Point(6, 71); this.CHK_P9.Name = "CHK_P9"; - this.CHK_P9.Size = new System.Drawing.Size(89, 17); + this.CHK_P9.Size = new System.Drawing.Size(93, 16); this.CHK_P9.TabIndex = 11; this.CHK_P9.Text = "Shiny Female"; this.CHK_P9.UseVisualStyleBackColor = true; @@ -196,9 +198,9 @@ private void InitializeComponent() // CHK_L7 // this.CHK_L7.AutoSize = true; - this.CHK_L7.Location = new System.Drawing.Point(18, 127); + this.CHK_L7.Location = new System.Drawing.Point(18, 108); this.CHK_L7.Name = "CHK_L7"; - this.CHK_L7.Size = new System.Drawing.Size(60, 17); + this.CHK_L7.Size = new System.Drawing.Size(59, 16); this.CHK_L7.TabIndex = 19; this.CHK_L7.Text = "Korean"; this.CHK_L7.UseVisualStyleBackColor = true; @@ -206,9 +208,9 @@ private void InitializeComponent() // CHK_L6 // this.CHK_L6.AutoSize = true; - this.CHK_L6.Location = new System.Drawing.Point(18, 110); + this.CHK_L6.Location = new System.Drawing.Point(18, 93); this.CHK_L6.Name = "CHK_L6"; - this.CHK_L6.Size = new System.Drawing.Size(64, 17); + this.CHK_L6.Size = new System.Drawing.Size(64, 16); this.CHK_L6.TabIndex = 18; this.CHK_L6.Text = "Spanish"; this.CHK_L6.UseVisualStyleBackColor = true; @@ -216,9 +218,9 @@ private void InitializeComponent() // CHK_L5 // this.CHK_L5.AutoSize = true; - this.CHK_L5.Location = new System.Drawing.Point(18, 93); + this.CHK_L5.Location = new System.Drawing.Point(18, 77); this.CHK_L5.Name = "CHK_L5"; - this.CHK_L5.Size = new System.Drawing.Size(63, 17); + this.CHK_L5.Size = new System.Drawing.Size(63, 16); this.CHK_L5.TabIndex = 17; this.CHK_L5.Text = "German"; this.CHK_L5.UseVisualStyleBackColor = true; @@ -226,9 +228,9 @@ private void InitializeComponent() // CHK_L4 // this.CHK_L4.AutoSize = true; - this.CHK_L4.Location = new System.Drawing.Point(18, 76); + this.CHK_L4.Location = new System.Drawing.Point(18, 61); this.CHK_L4.Name = "CHK_L4"; - this.CHK_L4.Size = new System.Drawing.Size(54, 17); + this.CHK_L4.Size = new System.Drawing.Size(55, 16); this.CHK_L4.TabIndex = 16; this.CHK_L4.Text = "Italian"; this.CHK_L4.UseVisualStyleBackColor = true; @@ -236,9 +238,9 @@ private void InitializeComponent() // CHK_L3 // this.CHK_L3.AutoSize = true; - this.CHK_L3.Location = new System.Drawing.Point(18, 59); + this.CHK_L3.Location = new System.Drawing.Point(18, 45); this.CHK_L3.Name = "CHK_L3"; - this.CHK_L3.Size = new System.Drawing.Size(59, 17); + this.CHK_L3.Size = new System.Drawing.Size(59, 16); this.CHK_L3.TabIndex = 15; this.CHK_L3.Text = "French"; this.CHK_L3.UseVisualStyleBackColor = true; @@ -246,9 +248,9 @@ private void InitializeComponent() // CHK_L2 // this.CHK_L2.AutoSize = true; - this.CHK_L2.Location = new System.Drawing.Point(18, 42); + this.CHK_L2.Location = new System.Drawing.Point(18, 30); this.CHK_L2.Name = "CHK_L2"; - this.CHK_L2.Size = new System.Drawing.Size(60, 17); + this.CHK_L2.Size = new System.Drawing.Size(61, 16); this.CHK_L2.TabIndex = 14; this.CHK_L2.Text = "English"; this.CHK_L2.UseVisualStyleBackColor = true; @@ -256,9 +258,9 @@ private void InitializeComponent() // CHK_L1 // this.CHK_L1.AutoSize = true; - this.CHK_L1.Location = new System.Drawing.Point(18, 25); + this.CHK_L1.Location = new System.Drawing.Point(18, 14); this.CHK_L1.Name = "CHK_L1"; - this.CHK_L1.Size = new System.Drawing.Size(72, 17); + this.CHK_L1.Size = new System.Drawing.Size(73, 16); this.CHK_L1.TabIndex = 13; this.CHK_L1.Text = "Japanese"; this.CHK_L1.UseVisualStyleBackColor = true; @@ -266,9 +268,9 @@ private void InitializeComponent() // L_goto // this.L_goto.AutoSize = true; - this.L_goto.Location = new System.Drawing.Point(12, 16); + this.L_goto.Location = new System.Drawing.Point(12, 15); this.L_goto.Name = "L_goto"; - this.L_goto.Size = new System.Drawing.Size(31, 13); + this.L_goto.Size = new System.Drawing.Size(29, 12); this.L_goto.TabIndex = 20; this.L_goto.Text = "goto:"; // @@ -280,9 +282,9 @@ private void InitializeComponent() this.CB_Species.FormattingEnabled = true; this.CB_Species.Items.AddRange(new object[] { "0"}); - this.CB_Species.Location = new System.Drawing.Point(50, 13); + this.CB_Species.Location = new System.Drawing.Point(50, 12); this.CB_Species.Name = "CB_Species"; - this.CB_Species.Size = new System.Drawing.Size(92, 21); + this.CB_Species.Size = new System.Drawing.Size(122, 20); this.CB_Species.TabIndex = 21; this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeCBSpecies); this.CB_Species.SelectedValueChanged += new System.EventHandler(this.changeCBSpecies); @@ -290,9 +292,9 @@ private void InitializeComponent() // // B_GiveAll // - this.B_GiveAll.Location = new System.Drawing.Point(149, 11); + this.B_GiveAll.Location = new System.Drawing.Point(178, 10); this.B_GiveAll.Name = "B_GiveAll"; - this.B_GiveAll.Size = new System.Drawing.Size(60, 23); + this.B_GiveAll.Size = new System.Drawing.Size(60, 21); this.B_GiveAll.TabIndex = 23; this.B_GiveAll.Text = "Check All"; this.B_GiveAll.UseVisualStyleBackColor = true; @@ -301,9 +303,9 @@ private void InitializeComponent() // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(300, 242); + this.B_Save.Location = new System.Drawing.Point(330, 241); this.B_Save.Name = "B_Save"; - this.B_Save.Size = new System.Drawing.Size(80, 23); + this.B_Save.Size = new System.Drawing.Size(80, 21); this.B_Save.TabIndex = 24; this.B_Save.Text = "Save"; this.B_Save.UseVisualStyleBackColor = true; @@ -311,9 +313,9 @@ private void InitializeComponent() // // B_Modify // - this.B_Modify.Location = new System.Drawing.Point(317, 11); + this.B_Modify.Location = new System.Drawing.Point(347, 10); this.B_Modify.Name = "B_Modify"; - this.B_Modify.Size = new System.Drawing.Size(60, 23); + this.B_Modify.Size = new System.Drawing.Size(60, 21); this.B_Modify.TabIndex = 25; this.B_Modify.Text = "Modify..."; this.B_Modify.UseVisualStyleBackColor = true; @@ -330,9 +332,9 @@ private void InitializeComponent() this.GB_Language.Controls.Add(this.CHK_L3); this.GB_Language.Controls.Add(this.CHK_L2); this.GB_Language.Controls.Add(this.CHK_L1); - this.GB_Language.Location = new System.Drawing.Point(269, 40); + this.GB_Language.Location = new System.Drawing.Point(300, 76); this.GB_Language.Name = "GB_Language"; - this.GB_Language.Size = new System.Drawing.Size(108, 193); + this.GB_Language.Size = new System.Drawing.Size(108, 159); this.GB_Language.TabIndex = 26; this.GB_Language.TabStop = false; this.GB_Language.Text = "Languages"; @@ -340,9 +342,9 @@ private void InitializeComponent() // CHK_L9 // this.CHK_L9.AutoSize = true; - this.CHK_L9.Location = new System.Drawing.Point(18, 161); + this.CHK_L9.Location = new System.Drawing.Point(18, 140); this.CHK_L9.Name = "CHK_L9"; - this.CHK_L9.Size = new System.Drawing.Size(70, 17); + this.CHK_L9.Size = new System.Drawing.Size(71, 16); this.CHK_L9.TabIndex = 21; this.CHK_L9.Text = "Chinese2"; this.CHK_L9.UseVisualStyleBackColor = true; @@ -350,9 +352,9 @@ private void InitializeComponent() // CHK_L8 // this.CHK_L8.AutoSize = true; - this.CHK_L8.Location = new System.Drawing.Point(18, 144); + this.CHK_L8.Location = new System.Drawing.Point(18, 124); this.CHK_L8.Name = "CHK_L8"; - this.CHK_L8.Size = new System.Drawing.Size(64, 17); + this.CHK_L8.Size = new System.Drawing.Size(65, 16); this.CHK_L8.TabIndex = 20; this.CHK_L8.Text = "Chinese"; this.CHK_L8.UseVisualStyleBackColor = true; @@ -363,9 +365,9 @@ private void InitializeComponent() this.GB_Encountered.Controls.Add(this.CHK_P4); this.GB_Encountered.Controls.Add(this.CHK_P3); this.GB_Encountered.Controls.Add(this.CHK_P2); - this.GB_Encountered.Location = new System.Drawing.Point(148, 40); + this.GB_Encountered.Location = new System.Drawing.Point(178, 37); this.GB_Encountered.Name = "GB_Encountered"; - this.GB_Encountered.Size = new System.Drawing.Size(115, 78); + this.GB_Encountered.Size = new System.Drawing.Size(116, 96); this.GB_Encountered.TabIndex = 27; this.GB_Encountered.TabStop = false; this.GB_Encountered.Text = "Seen"; @@ -373,9 +375,9 @@ private void InitializeComponent() // GB_Owned // this.GB_Owned.Controls.Add(this.CHK_P1); - this.GB_Owned.Location = new System.Drawing.Point(148, 118); + this.GB_Owned.Location = new System.Drawing.Point(300, 37); this.GB_Owned.Name = "GB_Owned"; - this.GB_Owned.Size = new System.Drawing.Size(115, 36); + this.GB_Owned.Size = new System.Drawing.Size(108, 33); this.GB_Owned.TabIndex = 28; this.GB_Owned.TabStop = false; this.GB_Owned.Text = "Owned"; @@ -386,9 +388,9 @@ private void InitializeComponent() this.GB_Displayed.Controls.Add(this.CHK_P8); this.GB_Displayed.Controls.Add(this.CHK_P7); this.GB_Displayed.Controls.Add(this.CHK_P6); - this.GB_Displayed.Location = new System.Drawing.Point(149, 156); + this.GB_Displayed.Location = new System.Drawing.Point(178, 139); this.GB_Displayed.Name = "GB_Displayed"; - this.GB_Displayed.Size = new System.Drawing.Size(115, 77); + this.GB_Displayed.Size = new System.Drawing.Size(116, 96); this.GB_Displayed.TabIndex = 31; this.GB_Displayed.TabStop = false; this.GB_Displayed.Text = "Displayed"; @@ -402,40 +404,40 @@ private void InitializeComponent() this.mnuCaughtAll, this.mnuComplete}); this.modifyMenu.Name = "modifyMenu"; - this.modifyMenu.Size = new System.Drawing.Size(149, 114); + this.modifyMenu.Size = new System.Drawing.Size(158, 114); // // mnuSeenNone // this.mnuSeenNone.Name = "mnuSeenNone"; - this.mnuSeenNone.Size = new System.Drawing.Size(148, 22); + this.mnuSeenNone.Size = new System.Drawing.Size(157, 22); this.mnuSeenNone.Text = "Seen none"; this.mnuSeenNone.Click += new System.EventHandler(this.modifyAll); // // mnuSeenAll // this.mnuSeenAll.Name = "mnuSeenAll"; - this.mnuSeenAll.Size = new System.Drawing.Size(148, 22); + this.mnuSeenAll.Size = new System.Drawing.Size(157, 22); this.mnuSeenAll.Text = "Seen all"; this.mnuSeenAll.Click += new System.EventHandler(this.modifyAll); // // mnuCaughtNone // this.mnuCaughtNone.Name = "mnuCaughtNone"; - this.mnuCaughtNone.Size = new System.Drawing.Size(148, 22); + this.mnuCaughtNone.Size = new System.Drawing.Size(157, 22); this.mnuCaughtNone.Text = "Caught none"; this.mnuCaughtNone.Click += new System.EventHandler(this.modifyAll); // // mnuCaughtAll // this.mnuCaughtAll.Name = "mnuCaughtAll"; - this.mnuCaughtAll.Size = new System.Drawing.Size(148, 22); + this.mnuCaughtAll.Size = new System.Drawing.Size(157, 22); this.mnuCaughtAll.Text = "Caught all"; this.mnuCaughtAll.Click += new System.EventHandler(this.modifyAll); // // mnuComplete // this.mnuComplete.Name = "mnuComplete"; - this.mnuComplete.Size = new System.Drawing.Size(148, 22); + this.mnuComplete.Size = new System.Drawing.Size(157, 22); this.mnuComplete.Text = "Complete Dex"; this.mnuComplete.Click += new System.EventHandler(this.modifyAll); // @@ -454,11 +456,22 @@ private void InitializeComponent() this.mnuFormAll.Name = "mnuFormAll"; this.mnuFormAll.Size = new System.Drawing.Size(32, 19); // + // LB_Forms + // + this.LB_Forms.FormattingEnabled = true; + this.LB_Forms.ItemHeight = 12; + this.LB_Forms.Location = new System.Drawing.Point(12, 205); + this.LB_Forms.Name = "LB_Forms"; + this.LB_Forms.Size = new System.Drawing.Size(160, 52); + this.LB_Forms.TabIndex = 32; + this.LB_Forms.SelectedIndexChanged += new System.EventHandler(this.changeLBForms); + // // SAV_PokedexSM // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(387, 272); + this.ClientSize = new System.Drawing.Size(417, 269); + this.Controls.Add(this.LB_Forms); this.Controls.Add(this.GB_Displayed); this.Controls.Add(this.GB_Owned); this.Controls.Add(this.GB_Encountered); @@ -531,5 +544,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem mnuFormAll; private System.Windows.Forms.CheckBox CHK_L8; private System.Windows.Forms.CheckBox CHK_L9; + private System.Windows.Forms.ListBox LB_Forms; } -} \ No newline at end of file +} diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.cs index 16091d3b4..5dd5d5ba8 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.cs @@ -20,6 +20,7 @@ public SAV_PokedexSM() // Clear Listbox and ComboBox LB_Species.Items.Clear(); CB_Species.Items.Clear(); + LB_Forms.Items.Clear(); // Fill List CB_Species.DisplayMember = "Text"; @@ -54,6 +55,7 @@ public SAV_PokedexSM() private readonly SAV7 SAV = new SAV7(Main.SAV.Data); private readonly PokeDex7 Dex; private bool editing; + private bool allModifying; private int species = -1; private readonly CheckBox[] CP, CL; @@ -76,6 +78,7 @@ private void changeCBSpecies(object sender, EventArgs e) species = (int)CB_Species.SelectedValue; LB_Species.SelectedIndex = species - 1; // Since we don't allow index0 in combobox, everything is shifted by 1 LB_Species.TopIndex = LB_Species.SelectedIndex; + if (!allModifying) fillLBForms(); getEntry(); editing = false; } @@ -87,9 +90,89 @@ private void changeLBSpecies(object sender, EventArgs e) editing = true; species = LB_Species.SelectedIndex + 1; CB_Species.SelectedValue = species; + if (!allModifying) fillLBForms(); getEntry(); editing = false; } + private void changeLBForms(object sender, EventArgs e) + { + if (allModifying) return; + if (editing) return; + setEntry(); + + editing = true; + int bspecies; + int fspecies = LB_Species.SelectedIndex + 1; + if (fspecies <= SAV.MaxSpeciesID) + bspecies = fspecies; + else + bspecies = baseSpecies[fspecies - SAV.MaxSpeciesID - 1]; + int form = LB_Forms.SelectedIndex; + if (form > 0) + { + int fc = SAV.Personal[bspecies].FormeCount; + if (fc > 1) // actually has forms + { + int f = SaveUtil.getDexFormIndexSM(bspecies, fc, SAV.MaxSpeciesID - 1); + if (f >= 0) // bit index valid + species = f + form + 1; + else + species = bspecies; + } + else + species = bspecies; + } + else species = bspecies; + CB_Species.SelectedValue = species; + LB_Species.SelectedIndex = species - 1; + LB_Species.TopIndex = LB_Species.SelectedIndex; + getEntry(); + editing = false; + } + private bool fillLBForms() + { + if (allModifying) return false; + LB_Forms.DataSource = null; + LB_Forms.Items.Clear(); + + int bspecies; + int fspecies = LB_Species.SelectedIndex + 1; + if (fspecies <= SAV.MaxSpeciesID) + bspecies = fspecies; + else + bspecies = baseSpecies[fspecies - SAV.MaxSpeciesID - 1]; + bool hasForms = SAV.Personal[bspecies].HasFormes || new[] { 201, 664, 665, 414 }.Contains(bspecies); + LB_Forms.Enabled = hasForms; + if (!hasForms) return false; + var ds = PKX.getFormList(bspecies, GameInfo.Strings.types, GameInfo.Strings.forms, new[] { "♂", "♀", "-" }, SAV.Generation).ToList(); + if (ds.Count == 1 && string.IsNullOrEmpty(ds[0])) + { // empty (Alolan Totems) + LB_Forms.Enabled = false; + return false; + } + else + { + LB_Forms.DataSource = ds; + if (fspecies <= SAV.MaxSpeciesID) + LB_Forms.SelectedIndex = 0; + else + { + int fc = SAV.Personal[bspecies].FormeCount; + if (fc > 1) // actually has forms + { + int f = SaveUtil.getDexFormIndexSM(bspecies, fc, SAV.MaxSpeciesID - 1); + if (f >= 0) + { // bit index valid + if (f > fspecies - LB_Forms.Items.Count - 1) + LB_Forms.SelectedIndex = fspecies - f - 1; + else + LB_Forms.SelectedIndex = -1; + } + } + } + } + return true; + } private void removedropCB(object sender, KeyEventArgs e) { ((ComboBox)sender).DroppedDown = false; @@ -296,10 +379,14 @@ private void B_Modify_Click(object sender, EventArgs e) } private void modifyAll(object sender, EventArgs e) { + allModifying = true; + LB_Forms.Enabled = LB_Forms.Visible = false; + int lang = SAV.Language; if (lang > 5) lang -= 1; lang -= 1; - int[] totem = { 811, 1018, 1019, 1024, 1025, 1026, 1058, 1059, 1060 }; + int[] totem = { 811, 1018, 1019, 1025, 1026, 1058, 1059, 1060 }; + // 1024 is used by Wishiwashi school form. if (sender == mnuSeenNone || sender == mnuSeenAll || sender == mnuComplete) for (int i = 0; i < LB_Species.Items.Count; i++) @@ -379,6 +466,9 @@ private void modifyAll(object sender, EventArgs e) // Turn off zh2 Petilil Dex.LanguageFlags[548*9 + 8] = false; getEntry(); + allModifying = false; + LB_Forms.Enabled = LB_Forms.Visible = true; + LB_Species.SelectedIndex = 0; } } }