From 1fcdffc65450317011802cfe400c64082dd5e927 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 8 Jan 2017 21:06:15 -0800 Subject: [PATCH] Add pkm value indication Grab an example PKM (from main window) to get the current value to assist users in creating their modification scripts. Added 3 tooltips for hovering over property/type/value controls --- PKHeX.WinForms/MainWindow/Main.cs | 2 +- .../Subforms/PKM Editors/BatchEditor.Designer.cs | 12 ++++++++++++ PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs | 10 +++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 2d9c98c33..974992fa1 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -465,7 +465,7 @@ private void mainMenuBoxDump(object sender, EventArgs e) } private void manMenuBatchEditor(object sender, EventArgs e) { - new BatchEditor().ShowDialog(); + new BatchEditor(preparePKM()).ShowDialog(); setPKXBoxes(); // refresh updateBoxViewers(); } diff --git a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.Designer.cs b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.Designer.cs index a5990665b..0585dc55a 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.Designer.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.Designer.cs @@ -41,6 +41,7 @@ private void InitializeComponent() this.CB_Require = new System.Windows.Forms.ComboBox(); this.B_Add = new System.Windows.Forms.Button(); this.L_PropType = new System.Windows.Forms.Label(); + this.L_PropValue = new System.Windows.Forms.Label(); this.FLP_RB.SuspendLayout(); this.SuspendLayout(); // @@ -187,12 +188,22 @@ private void InitializeComponent() this.L_PropType.TabIndex = 12; this.L_PropType.Text = "PropertyType"; // + // L_PropValue + // + this.L_PropValue.AutoSize = true; + this.L_PropValue.Location = new System.Drawing.Point(204, 64); + this.L_PropValue.Name = "L_PropValue"; + this.L_PropValue.Size = new System.Drawing.Size(73, 13); + this.L_PropValue.TabIndex = 13; + this.L_PropValue.Text = "PropertyValue"; + // // BatchEditor // this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(394, 261); + this.Controls.Add(this.L_PropValue); this.Controls.Add(this.L_PropType); this.Controls.Add(this.B_Add); this.Controls.Add(this.CB_Require); @@ -230,5 +241,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_Require; private System.Windows.Forms.Button B_Add; private System.Windows.Forms.Label L_PropType; + private System.Windows.Forms.Label L_PropValue; } } \ No newline at end of file diff --git a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs index 6183aa056..a6c6a3155 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs @@ -11,9 +11,10 @@ namespace PKHeX.WinForms { public partial class BatchEditor : Form { - public BatchEditor() + public BatchEditor(PKM pk) { InitializeComponent(); + pkm = pk; DragDrop += tabMain_DragDrop; DragEnter += tabMain_DragEnter; @@ -23,6 +24,9 @@ public BatchEditor() CB_Format.Items.Add("Any"); CB_Format.SelectedIndex = CB_Require.SelectedIndex = 0; + new ToolTip().SetToolTip(CB_Property, "Property of a given PKM to modify."); + new ToolTip().SetToolTip(L_PropType, "PropertyType of the currently loaded PKM in the main window."); + new ToolTip().SetToolTip(L_PropValue, "PropertyValue of the currently loaded PKM in the main window."); } private static string[][] getPropArray() { @@ -43,6 +47,7 @@ private static string[][] getPropArray() return p1; } + private readonly PKM pkm; private const string CONST_RAND = "$rand"; private const string CONST_SHINY = "$shiny"; private int currentFormat = -1; @@ -311,6 +316,9 @@ private void tabMain_DragDrop(object sender, DragEventArgs e) private void CB_Property_SelectedIndexChanged(object sender, EventArgs e) { L_PropType.Text = getPropertyType(CB_Property.Text); + L_PropValue.Text = pkm.GetType().HasProperty(CB_Property.Text) + ? ReflectUtil.GetValue(pkm, CB_Property.Text).ToString() + : ""; } private string getPropertyType(string propertyName) {