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
This commit is contained in:
Kurt
2017-01-08 21:06:15 -08:00
parent 51352c3c13
commit 1fcdffc654
3 changed files with 22 additions and 2 deletions

View File

@@ -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();
}

View File

@@ -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;
}
}

View File

@@ -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)
{