From 7f5de73003ad66f119b2c18aae54be4d4e311acf Mon Sep 17 00:00:00 2001 From: suloku Date: Thu, 16 Jun 2016 00:47:46 +0200 Subject: [PATCH] Changed medal editor to use datetimepicker and added medal removing feature. --- BW_tool/Editors/Entralink.Designer.cs | 40 +++++++++--------- BW_tool/Editors/Medals.Designer.cs | 54 +++++++++++++++++++++++-- BW_tool/Editors/Medals.cs | 58 ++++++++++++++++++++++++++- 3 files changed, 128 insertions(+), 24 deletions(-) diff --git a/BW_tool/Editors/Entralink.Designer.cs b/BW_tool/Editors/Entralink.Designer.cs index 475cf73..4695030 100644 --- a/BW_tool/Editors/Entralink.Designer.cs +++ b/BW_tool/Editors/Entralink.Designer.cs @@ -1206,7 +1206,7 @@ namespace BW_tool "647 - Keldeo", "648 - Meloetta", "649 - Genesect"}); - this.spbox1.Location = new System.Drawing.Point(266, 59); + this.spbox1.Location = new System.Drawing.Point(266, 43); this.spbox1.Name = "spbox1"; this.spbox1.Size = new System.Drawing.Size(141, 21); this.spbox1.TabIndex = 190; @@ -1775,7 +1775,7 @@ namespace BW_tool "V-create", "Fusion Flare", "Fusion Bolt"}); - this.move1box.Location = new System.Drawing.Point(413, 59); + this.move1box.Location = new System.Drawing.Point(413, 43); this.move1box.Name = "move1box"; this.move1box.Size = new System.Drawing.Size(139, 21); this.move1box.TabIndex = 53; @@ -1787,7 +1787,7 @@ namespace BW_tool "Male", "Female", "Genderless"}); - this.genderbox1.Location = new System.Drawing.Point(558, 59); + this.genderbox1.Location = new System.Drawing.Point(558, 43); this.genderbox1.Name = "genderbox1"; this.genderbox1.Size = new System.Drawing.Size(94, 21); this.genderbox1.TabIndex = 54; @@ -1819,7 +1819,7 @@ namespace BW_tool // // label3 // - this.label3.Location = new System.Drawing.Point(266, 44); + this.label3.Location = new System.Drawing.Point(266, 28); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(121, 12); this.label3.TabIndex = 67; @@ -1828,7 +1828,7 @@ namespace BW_tool // // label4 // - this.label4.Location = new System.Drawing.Point(413, 44); + this.label4.Location = new System.Drawing.Point(413, 28); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(121, 12); this.label4.TabIndex = 68; @@ -1837,7 +1837,7 @@ namespace BW_tool // // label5 // - this.label5.Location = new System.Drawing.Point(569, 44); + this.label5.Location = new System.Drawing.Point(569, 28); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(66, 12); this.label5.TabIndex = 69; @@ -1846,7 +1846,7 @@ namespace BW_tool // // label6 // - this.label6.Location = new System.Drawing.Point(682, 44); + this.label6.Location = new System.Drawing.Point(682, 28); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(41, 12); this.label6.TabIndex = 70; @@ -1855,7 +1855,7 @@ namespace BW_tool // // label7 // - this.label7.Location = new System.Drawing.Point(865, 43); + this.label7.Location = new System.Drawing.Point(865, 27); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(55, 13); this.label7.TabIndex = 71; @@ -1864,7 +1864,7 @@ namespace BW_tool // // slot // - this.slot.Location = new System.Drawing.Point(216, 59); + this.slot.Location = new System.Drawing.Point(216, 43); this.slot.Maximum = new decimal(new int[] { 19, 0, @@ -1943,7 +1943,7 @@ namespace BW_tool this.Gender, this.Form, this.Anim}); - this.dataGridView1.Location = new System.Drawing.Point(216, 85); + this.dataGridView1.Location = new System.Drawing.Point(216, 69); this.dataGridView1.MultiSelect = false; this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; @@ -1986,7 +1986,7 @@ namespace BW_tool // // del_pkm // - this.del_pkm.Location = new System.Drawing.Point(865, 145); + this.del_pkm.Location = new System.Drawing.Point(865, 129); this.del_pkm.Name = "del_pkm"; this.del_pkm.Size = new System.Drawing.Size(60, 23); this.del_pkm.TabIndex = 193; @@ -1996,7 +1996,7 @@ namespace BW_tool // // add_pkm // - this.add_pkm.Location = new System.Drawing.Point(865, 116); + this.add_pkm.Location = new System.Drawing.Point(865, 100); this.add_pkm.Name = "add_pkm"; this.add_pkm.Size = new System.Drawing.Size(60, 23); this.add_pkm.TabIndex = 194; @@ -2006,7 +2006,7 @@ namespace BW_tool // // edit_pkm // - this.edit_pkm.Location = new System.Drawing.Point(865, 87); + this.edit_pkm.Location = new System.Drawing.Point(865, 71); this.edit_pkm.Name = "edit_pkm"; this.edit_pkm.Size = new System.Drawing.Size(60, 23); this.edit_pkm.TabIndex = 195; @@ -2016,14 +2016,14 @@ namespace BW_tool // // hiderows // - this.hiderows.Location = new System.Drawing.Point(216, 327); + this.hiderows.Location = new System.Drawing.Point(216, 311); this.hiderows.Name = "hiderows"; this.hiderows.Size = new System.Drawing.Size(643, 221); this.hiderows.TabIndex = 196; // // label8 // - this.label8.Location = new System.Drawing.Point(215, 43); + this.label8.Location = new System.Drawing.Point(215, 27); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(44, 12); this.label8.TabIndex = 197; @@ -2042,7 +2042,7 @@ namespace BW_tool "12- Turning around clockwise", "14- Turning around counterclockwise", "--- Randomize ---"}); - this.animbox1.Location = new System.Drawing.Point(762, 60); + this.animbox1.Location = new System.Drawing.Point(762, 44); this.animbox1.Name = "animbox1"; this.animbox1.Size = new System.Drawing.Size(243, 21); this.animbox1.TabIndex = 198; @@ -2110,7 +2110,7 @@ namespace BW_tool // sprite_warning // this.sprite_warning.ForeColor = System.Drawing.Color.Red; - this.sprite_warning.Location = new System.Drawing.Point(266, 21); + this.sprite_warning.Location = new System.Drawing.Point(266, 5); this.sprite_warning.Name = "sprite_warning"; this.sprite_warning.Size = new System.Drawing.Size(244, 23); this.sprite_warning.TabIndex = 205; @@ -2121,7 +2121,7 @@ namespace BW_tool this.formbox1.FormattingEnabled = true; this.formbox1.Items.AddRange(new object[] { ""}); - this.formbox1.Location = new System.Drawing.Point(658, 60); + this.formbox1.Location = new System.Drawing.Point(658, 44); this.formbox1.Name = "formbox1"; this.formbox1.Size = new System.Drawing.Size(98, 21); this.formbox1.TabIndex = 206; @@ -2136,7 +2136,7 @@ namespace BW_tool this.groupBox2.Controls.Add(this.spark_but); this.groupBox2.Controls.Add(this.wind_but); this.groupBox2.Controls.Add(this.pleasant_but); - this.groupBox2.Location = new System.Drawing.Point(864, 187); + this.groupBox2.Location = new System.Drawing.Point(864, 171); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(141, 250); this.groupBox2.TabIndex = 207; @@ -2225,7 +2225,7 @@ namespace BW_tool // // pgl_but // - this.pgl_but.Location = new System.Drawing.Point(870, 438); + this.pgl_but.Location = new System.Drawing.Point(870, 427); this.pgl_but.Name = "pgl_but"; this.pgl_but.Size = new System.Drawing.Size(129, 23); this.pgl_but.TabIndex = 208; diff --git a/BW_tool/Editors/Medals.Designer.cs b/BW_tool/Editors/Medals.Designer.cs index d0e89fe..5b60b57 100644 --- a/BW_tool/Editors/Medals.Designer.cs +++ b/BW_tool/Editors/Medals.Designer.cs @@ -27,6 +27,10 @@ namespace BW_tool private System.Windows.Forms.CheckBox flag2box; private System.Windows.Forms.CheckBox flag3box; private System.Windows.Forms.CheckBox flag4box; + private System.Windows.Forms.DateTimePicker medal_date; + private System.Windows.Forms.CheckBox obtained; + private System.Windows.Forms.Panel red_panel; + private System.Windows.Forms.Button delete_but; /// /// Disposes resources used by the form. @@ -60,6 +64,10 @@ namespace BW_tool this.flag2box = new System.Windows.Forms.CheckBox(); this.flag3box = new System.Windows.Forms.CheckBox(); this.flag4box = new System.Windows.Forms.CheckBox(); + this.medal_date = new System.Windows.Forms.DateTimePicker(); + this.obtained = new System.Windows.Forms.CheckBox(); + this.red_panel = new System.Windows.Forms.Panel(); + this.delete_but = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.day)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.month)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.year)).BeginInit(); @@ -68,7 +76,7 @@ namespace BW_tool // day // this.day.Location = new System.Drawing.Point(49, 39); - this.day.Maximum = new decimal(new int[]{ + this.day.Maximum = new decimal(new int[] { 31, 0, 0, @@ -81,7 +89,7 @@ namespace BW_tool // month // this.month.Location = new System.Drawing.Point(140, 39); - this.month.Maximum = new decimal(new int[]{ + this.month.Maximum = new decimal(new int[] { 12, 0, 0, @@ -94,7 +102,7 @@ namespace BW_tool // year // this.year.Location = new System.Drawing.Point(229, 39); - this.year.Maximum = new decimal(new int[]{ + this.year.Maximum = new decimal(new int[] { 127, 0, 0, @@ -459,11 +467,51 @@ namespace BW_tool this.flag4box.UseVisualStyleBackColor = true; this.flag4box.CheckedChanged += new System.EventHandler(this.Flag4boxCheckedChanged); // + // medal_date + // + this.medal_date.Location = new System.Drawing.Point(12, 39); + this.medal_date.Name = "medal_date"; + this.medal_date.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.medal_date.Size = new System.Drawing.Size(263, 20); + this.medal_date.TabIndex = 14; + this.medal_date.ValueChanged += new System.EventHandler(this.Medal_dateValueChanged); + // + // obtained + // + this.obtained.AutoCheck = false; + this.obtained.Location = new System.Drawing.Point(12, 148); + this.obtained.Name = "obtained"; + this.obtained.Size = new System.Drawing.Size(110, 23); + this.obtained.TabIndex = 15; + this.obtained.Text = "Obtained"; + this.obtained.UseVisualStyleBackColor = true; + // + // red_panel + // + this.red_panel.Location = new System.Drawing.Point(12, 40); + this.red_panel.Name = "red_panel"; + this.red_panel.Size = new System.Drawing.Size(232, 18); + this.red_panel.TabIndex = 16; + // + // delete_but + // + this.delete_but.Location = new System.Drawing.Point(12, 177); + this.delete_but.Name = "delete_but"; + this.delete_but.Size = new System.Drawing.Size(83, 20); + this.delete_but.TabIndex = 17; + this.delete_but.Text = "Delete Medal"; + this.delete_but.UseVisualStyleBackColor = true; + this.delete_but.Click += new System.EventHandler(this.Delete_butClick); + // // Medals // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(289, 258); + this.Controls.Add(this.delete_but); + this.Controls.Add(this.red_panel); + this.Controls.Add(this.obtained); + this.Controls.Add(this.medal_date); this.Controls.Add(this.flag4box); this.Controls.Add(this.flag3box); this.Controls.Add(this.flag2box); diff --git a/BW_tool/Editors/Medals.cs b/BW_tool/Editors/Medals.cs index 573485f..7bf7dea 100644 --- a/BW_tool/Editors/Medals.cs +++ b/BW_tool/Editors/Medals.cs @@ -24,16 +24,23 @@ namespace BW_tool // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); + red_panel.Visible = false; medals = new MEDAL(MainForm.save.getBlock(68)); indexbox.SelectedIndex = 0; + + update_date(); + /* day.Value = medals.Day; month.Value = medals.Month; year.Value = medals.Year; + */ flag1box.Checked = medals.Flag1; flag2box.Checked = medals.Flag2; flag3box.Checked = medals.Flag3; flag4box.Checked = medals.Flag4; + //MessageBox.Show(medal_date.Value.Year.ToString()); + // // TODO: Add constructor code after the InitializeComponent() call. // @@ -81,20 +88,27 @@ namespace BW_tool { medals.Index = (int)indexbox.SelectedIndex - 5; } + + update_date(); + + /* day.Value = medals.Day; month.Value = medals.Month; year.Value = medals.Year; + */ flag1box.Checked = medals.Flag1; flag2box.Checked = medals.Flag2; flag3box.Checked = medals.Flag3; flag4box.Checked = medals.Flag4; } + void DayValueChanged(object sender, EventArgs e) { - medals.Day = (int)day.Value; + //medals.Day = (int)day.Value; } void MonthValueChanged(object sender, EventArgs e) { + /* medals.Month = (int)month.Value; switch((int)month.Value) { @@ -121,9 +135,11 @@ namespace BW_tool break; } + */ } void YearValueChanged(object sender, EventArgs e) { + /* medals.Year = (int)year.Value; if(month.Value == 2) { @@ -132,6 +148,7 @@ namespace BW_tool else day.Maximum = 28; } + */ } void Exit_butClick(object sender, EventArgs e) { @@ -158,6 +175,45 @@ namespace BW_tool { medals.Flag4 = flag4box.Checked; } + + void update_date() + { + if (medals.Year != 0 && medals.Month != 0 && medals.Day != 0) + { + red_panel.Visible = false; + medal_date.Value = new DateTime(2000+medals.Year, medals.Month, medals.Day); + obtained.Checked = true; + } + else + { + red_panel.Visible = true; + obtained.Checked = false; + } + } + void Medal_dateValueChanged(object sender, EventArgs e) + { + medals.Year = medal_date.Value.Year-2000; + medals.Month = medal_date.Value.Month; + medals.Day = medal_date.Value.Day; + + update_date(); + + } + void Delete_butClick(object sender, EventArgs e) + { + medals.Year = 0; + medals.Month = 0; + medals.Day = 0; + medals.Flag1 = false; + medals.Flag2 = false; + medals.Flag3 = false; + medals.Flag4 = false; + update_date(); + flag1box.Checked = medals.Flag1; + flag2box.Checked = medals.Flag2; + flag3box.Checked = medals.Flag3; + flag4box.Checked = medals.Flag4; + } public class MEDAL { internal int MedalSize = 4;